Search in sources :

Example 1 with Project

use of org.activityinfo.server.database.hibernate.entity.Project in project activityinfo by bedatadriven.

the class AddProjectHandler method execute.

@Override
public CommandResult execute(AddProject cmd, User user) {
    Database db = em.find(Database.class, cmd.getDatabaseId());
    ProjectDTO from = cmd.getProjectDTO();
    Project project = new Project();
    project.setName(from.getName());
    project.setDescription(from.getDescription());
    project.setDatabase(db);
    db.setLastSchemaUpdate(new Date());
    em.persist(project);
    em.persist(db);
    db.getProjects().add(project);
    return new CreateResult(project.getId());
}
Also used : ProjectDTO(org.activityinfo.legacy.shared.model.ProjectDTO) Project(org.activityinfo.server.database.hibernate.entity.Project) AddProject(org.activityinfo.legacy.shared.command.AddProject) CreateResult(org.activityinfo.legacy.shared.command.result.CreateResult) Database(org.activityinfo.server.database.hibernate.entity.Database) Date(java.util.Date)

Aggregations

Date (java.util.Date)1 AddProject (org.activityinfo.legacy.shared.command.AddProject)1 CreateResult (org.activityinfo.legacy.shared.command.result.CreateResult)1 ProjectDTO (org.activityinfo.legacy.shared.model.ProjectDTO)1 Database (org.activityinfo.server.database.hibernate.entity.Database)1 Project (org.activityinfo.server.database.hibernate.entity.Project)1