use of org.activityinfo.server.database.hibernate.entity.LocationType in project activityinfo by bedatadriven.
the class LocationTypePolicy method create.
@Override
public Integer create(User user, PropertyMap properties) {
int databaseId = properties.get(DATABASE_ID_PROPERTY);
Database database = em.find(Database.class, databaseId);
PermissionOracle.using(em).assertDesignPrivileges(database, user);
// create the entity
LocationType locationType = new LocationType();
locationType.setVersion(1L);
locationType.setName(properties.get(NAME_PROPERTY));
locationType.setCountry(database.getCountry());
locationType.setWorkflowId(properties.getOptionalString(WORKFLOW_ID_PROPERTY, LocationTypeDTO.CLOSED_WORKFLOW_ID));
locationType.setDatabase(database);
em.persist(locationType);
return locationType.getId();
}
use of org.activityinfo.server.database.hibernate.entity.LocationType in project activityinfo by bedatadriven.
the class LocationTypePolicy method update.
@Override
public void update(User user, Object entityId, PropertyMap changes) {
LocationType locationType = em.find(LocationType.class, entityId);
PermissionOracle.using(em).assertDesignPrivileges(locationType.getDatabase(), user);
applyProperties(locationType, changes);
locationType.incrementVersion();
}
Aggregations