-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into front-end-master
- Loading branch information
Showing
150 changed files
with
1,682 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
Code-DD-UFG/Back-End/sdd-ufg/.settings/org.eclipse.jdt.core.prefs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 | ||
org.eclipse.jdt.core.compiler.compliance=1.5 | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning | ||
org.eclipse.jdt.core.compiler.source=1.5 |
3 changes: 3 additions & 0 deletions
3
Code-DD-UFG/Back-End/sdd-ufg/.settings/org.eclipse.jpt.core.prefs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jpt.core.platform=eclipselink2_2 | ||
org.eclipse.jpt.jpa.core.discoverAnnotatedClasses=true |
7 changes: 7 additions & 0 deletions
7
Code-DD-UFG/Back-End/sdd-ufg/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<root> | ||
<facet id="jpt.jpa"> | ||
<node name="libprov"> | ||
<attribute name="provider-id" value="jpa-no-op-library-provider"/> | ||
</node> | ||
</facet> | ||
</root> |
5 changes: 5 additions & 0 deletions
5
Code-DD-UFG/Back-End/sdd-ufg/.settings/org.eclipse.wst.common.project.facet.core.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<faceted-project> | ||
<installed facet="java" version="1.5"/> | ||
<installed facet="jpt.jpa" version="2.0"/> | ||
</faceted-project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
server: | ||
applicationConnectors: | ||
- type: http | ||
port: 8090 | ||
adminConnectors: | ||
- type: http | ||
port: 8091 | ||
database: | ||
driverClass: org.postgresql.Driver | ||
user: postgres | ||
password: postgres | ||
url: jdbc:postgresql://localhost/sddufg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 50 additions & 15 deletions
65
Code-DD-UFG/Back-End/sdd-ufg/src/main/java/br/ufg/inf/sdd_ufg/SddUfgApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,68 @@ | ||
package br.ufg.inf.sdd_ufg; | ||
|
||
import io.dropwizard.Application; | ||
import io.dropwizard.setup.Bootstrap; | ||
import io.dropwizard.setup.Environment; | ||
import br.ufg.inf.sdd_ufg.config.JpaConfiguration; | ||
import br.ufg.inf.sdd_ufg.dao.ClazzDao; | ||
import br.ufg.inf.sdd_ufg.dao.ClazzIntentDao; | ||
import br.ufg.inf.sdd_ufg.dao.CourseDao; | ||
import br.ufg.inf.sdd_ufg.dao.DistributionProcessDao; | ||
import br.ufg.inf.sdd_ufg.dao.GradeDao; | ||
import br.ufg.inf.sdd_ufg.dao.KnowledgeGroupDao; | ||
import br.ufg.inf.sdd_ufg.dao.TeacherDao; | ||
import br.ufg.inf.sdd_ufg.dao.UserDao; | ||
import br.ufg.inf.sdd_ufg.jpa.ClazzDaoJpa; | ||
import br.ufg.inf.sdd_ufg.jpa.ClazzIntentDaoJpa; | ||
import br.ufg.inf.sdd_ufg.jpa.CourseDaoJpa; | ||
import br.ufg.inf.sdd_ufg.jpa.DistributionProcessDaoJpa; | ||
import br.ufg.inf.sdd_ufg.jpa.GradeDaoJpa; | ||
import br.ufg.inf.sdd_ufg.jpa.KnowledgeGroupDaoJpa; | ||
import br.ufg.inf.sdd_ufg.jpa.TeacherDaoJpa; | ||
import br.ufg.inf.sdd_ufg.jpa.UserDaoJpa; | ||
import br.ufg.inf.sdd_ufg.resource.CourseResource; | ||
import br.ufg.inf.sdd_ufg.resource.UserResource; | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.fasterxml.jackson.databind.SerializationFeature; | ||
import com.google.inject.AbstractModule; | ||
import com.google.inject.Guice; | ||
import com.google.inject.Injector; | ||
import com.google.inject.persist.PersistFilter; | ||
import com.yammer.dropwizard.Service; | ||
import com.yammer.dropwizard.config.Bootstrap; | ||
import com.yammer.dropwizard.config.Environment; | ||
|
||
public class SddUfgApplication extends Application<SddUfgConfiguration> { | ||
|
||
public class SddUfgApplication extends Service<SddUfgConfiguration> { | ||
public static void main(String[] args) throws Exception { | ||
new SddUfgApplication().run(args); | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return "sdd-ufg"; | ||
public void initialize(final Bootstrap<SddUfgConfiguration> bootstrap) { | ||
bootstrap.setName("mr-api"); | ||
} | ||
|
||
@Override | ||
public void initialize(Bootstrap<SddUfgConfiguration> bootstrap) { | ||
// nothing to do yet | ||
|
||
private Injector createInjector(final SddUfgConfiguration conf) { | ||
return Guice.createInjector(new AbstractModule() { | ||
@Override | ||
protected void configure() { | ||
bind(ClazzDao.class).to(ClazzDaoJpa.class); | ||
bind(ClazzIntentDao.class).to(ClazzIntentDaoJpa.class); | ||
bind(CourseDao.class).to(CourseDaoJpa.class); | ||
bind(DistributionProcessDao.class).to(DistributionProcessDaoJpa.class); | ||
bind(GradeDao.class).to(GradeDaoJpa.class); | ||
bind(KnowledgeGroupDao.class).to(KnowledgeGroupDaoJpa.class); | ||
bind(TeacherDao.class).to(TeacherDaoJpa.class); | ||
bind(UserDao.class).to(UserDaoJpa.class); | ||
} | ||
}, JpaConfiguration.createJpaPersistModule(conf)); | ||
} | ||
|
||
|
||
@Override | ||
public void run(SddUfgConfiguration configuration, Environment environment) { | ||
// Configure pretty print of json | ||
ObjectMapper factory = environment.getObjectMapper(); | ||
factory.enable(SerializationFeature.INDENT_OUTPUT); | ||
Injector injector = createInjector(configuration); | ||
|
||
environment.addFilter(injector.getInstance(PersistFilter.class), "/*"); | ||
environment.addResource(injector.getInstance(UserResource.class)); | ||
environment.addResource(injector.getInstance(CourseResource.class)); | ||
} | ||
|
||
} |
26 changes: 23 additions & 3 deletions
26
Code-DD-UFG/Back-End/sdd-ufg/src/main/java/br/ufg/inf/sdd_ufg/SddUfgConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,27 @@ | ||
package br.ufg.inf.sdd_ufg; | ||
|
||
import io.dropwizard.Configuration; | ||
import io.dropwizard.db.DataSourceFactory; | ||
|
||
import com.yammer.dropwizard.config.Configuration; | ||
|
||
import javax.validation.Valid; | ||
import javax.validation.constraints.NotNull; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
public class SddUfgConfiguration extends Configuration { | ||
|
||
} | ||
|
||
@Valid | ||
@NotNull | ||
private DataSourceFactory database = new DataSourceFactory(); | ||
|
||
@JsonProperty("database") | ||
public DataSourceFactory getDataSourceFactory() { | ||
return database; | ||
} | ||
|
||
@JsonProperty("database") | ||
public void setDataSourceFactory(DataSourceFactory dataSourceFactory) { | ||
this.database = dataSourceFactory; | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
Code-DD-UFG/Back-End/sdd-ufg/src/main/java/br/ufg/inf/sdd_ufg/config/JpaConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package br.ufg.inf.sdd_ufg.config; | ||
|
||
import java.util.Properties; | ||
|
||
import br.ufg.inf.sdd_ufg.SddUfgConfiguration; | ||
|
||
import com.google.inject.persist.jpa.JpaPersistModule; | ||
|
||
public class JpaConfiguration { | ||
|
||
public static JpaPersistModule createJpaPersistModule(SddUfgConfiguration conf) { | ||
Properties props = new Properties(); | ||
props.put("javax.persistence.jdbc.url", conf.getDataSourceFactory().getUrl()); | ||
props.put("javax.persistence.jdbc.user", conf.getDataSourceFactory().getUser()); | ||
props.put("javax.persistence.jdbc.password", conf.getDataSourceFactory().getPassword()); | ||
props.put("javax.persistence.jdbc.driver", conf.getDataSourceFactory().getDriverClass()); | ||
JpaPersistModule jpaModule = new JpaPersistModule("Default"); | ||
jpaModule.properties(props); | ||
return jpaModule; | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
Code-DD-UFG/Back-End/sdd-ufg/src/main/java/br/ufg/inf/sdd_ufg/dao/ClazzDao.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package br.ufg.inf.sdd_ufg.dao; | ||
|
||
import br.ufg.inf.sdd_ufg.model.Clazz; | ||
|
||
public interface ClazzDao extends EntityDao<Clazz> { | ||
} |
6 changes: 6 additions & 0 deletions
6
Code-DD-UFG/Back-End/sdd-ufg/src/main/java/br/ufg/inf/sdd_ufg/dao/ClazzIntentDao.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package br.ufg.inf.sdd_ufg.dao; | ||
|
||
import br.ufg.inf.sdd_ufg.model.ClazzIntent; | ||
|
||
public interface ClazzIntentDao extends EntityDao<ClazzIntent> { | ||
} |
6 changes: 6 additions & 0 deletions
6
Code-DD-UFG/Back-End/sdd-ufg/src/main/java/br/ufg/inf/sdd_ufg/dao/CourseDao.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package br.ufg.inf.sdd_ufg.dao; | ||
|
||
import br.ufg.inf.sdd_ufg.model.Course; | ||
|
||
public interface CourseDao extends EntityDao<Course> { | ||
} |
6 changes: 6 additions & 0 deletions
6
...-DD-UFG/Back-End/sdd-ufg/src/main/java/br/ufg/inf/sdd_ufg/dao/DistributionProcessDao.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package br.ufg.inf.sdd_ufg.dao; | ||
|
||
import br.ufg.inf.sdd_ufg.model.DistributionProcess; | ||
|
||
public interface DistributionProcessDao extends EntityDao<DistributionProcess> { | ||
} |
25 changes: 25 additions & 0 deletions
25
Code-DD-UFG/Back-End/sdd-ufg/src/main/java/br/ufg/inf/sdd_ufg/dao/EntityDao.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package br.ufg.inf.sdd_ufg.dao; | ||
|
||
import java.util.List; | ||
|
||
import br.ufg.inf.sdd_ufg.model.Entity; | ||
|
||
public interface EntityDao <E extends Entity<E>> { | ||
|
||
E create(); | ||
|
||
E findById(Long id, Integer depth); | ||
|
||
List<E> findAll(Integer depth); | ||
|
||
E refresh(E entity); | ||
|
||
E save(E entity); | ||
|
||
E insert(E entity); | ||
|
||
E update(E entity); | ||
|
||
void delete(E entity); | ||
void delete(Long id); | ||
} |
6 changes: 6 additions & 0 deletions
6
Code-DD-UFG/Back-End/sdd-ufg/src/main/java/br/ufg/inf/sdd_ufg/dao/GradeDao.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package br.ufg.inf.sdd_ufg.dao; | ||
|
||
import br.ufg.inf.sdd_ufg.model.Grade; | ||
|
||
public interface GradeDao extends EntityDao<Grade> { | ||
} |
6 changes: 6 additions & 0 deletions
6
Code-DD-UFG/Back-End/sdd-ufg/src/main/java/br/ufg/inf/sdd_ufg/dao/KnowledgeGroupDao.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package br.ufg.inf.sdd_ufg.dao; | ||
|
||
import br.ufg.inf.sdd_ufg.model.KnowledgeGroup; | ||
|
||
public interface KnowledgeGroupDao extends EntityDao<KnowledgeGroup> { | ||
} |
Oops, something went wrong.