use of org.activityinfo.server.command.handler.crud.UserDatabasePolicy in project activityinfo by bedatadriven.
the class UpdateEntityHandler method updateDatabase.
private void updateDatabase(UpdateEntity cmd, User user, PropertyMap changeMap) {
UserDatabasePolicy policy = injector.getInstance(UserDatabasePolicy.class);
policy.update(user, cmd.getId(), changeMap);
}
use of org.activityinfo.server.command.handler.crud.UserDatabasePolicy in project activityinfo by bedatadriven.
the class CreateEntityHandler method execute.
@Override
public CommandResult execute(CreateEntity cmd, User user) throws CommandException {
Map<String, Object> properties = cmd.getProperties().getTransientMap();
PropertyMap propertyMap = new PropertyMap(cmd.getProperties().getTransientMap());
if ("UserDatabase".equals(cmd.getEntityName())) {
UserDatabasePolicy policy = injector.getInstance(UserDatabasePolicy.class);
return new CreateResult((Integer) policy.create(user, propertyMap));
} else if ("Activity".equals(cmd.getEntityName())) {
ActivityPolicy policy = injector.getInstance(ActivityPolicy.class);
return new CreateResult((Integer) policy.create(user, propertyMap));
} else if ("AttributeGroup".equals(cmd.getEntityName())) {
return createAttributeGroup(cmd, properties);
} else if ("Attribute".equals(cmd.getEntityName())) {
return createAttribute(cmd, properties);
} else if ("Indicator".equals(cmd.getEntityName())) {
return createIndicator(user, cmd, properties);
} else {
throw new CommandException("Invalid entity class " + cmd.getEntityName());
}
}
Aggregations