use of org.motechproject.mds.domain.Entity in project motech by motech.
the class EntityServiceImpl method getLookupByName.
@Override
@Transactional
public LookupDto getLookupByName(Long entityId, String lookupName) {
Entity entity = allEntities.retrieveById(entityId);
assertEntityExists(entity, entityId);
Lookup lookup = entity.getLookupByName(lookupName);
return (lookup == null) ? null : lookup.toDto();
}
use of org.motechproject.mds.domain.Entity in project motech by motech.
the class EntityServiceImpl method getAdvancedSettings.
@Override
@Transactional
public AdvancedSettingsDto getAdvancedSettings(Long entityId, boolean committed) {
if (committed) {
Entity entity = allEntities.retrieveById(entityId);
assertEntityExists(entity, entityId);
return addNonPersistentAdvancedSettingsData(entity.advancedSettingsDto(), entity, committed);
} else {
Entity entity = getEntityDraft(entityId);
return addNonPersistentAdvancedSettingsData(entity.advancedSettingsDto(), entity, committed);
}
}
use of org.motechproject.mds.domain.Entity in project motech by motech.
the class EntityServiceImpl method deleteEntity.
@Override
@Transactional
public void deleteEntity(Long entityId) {
Entity entity = allEntities.retrieveById(entityId);
assertWritableEntity(entity, entityId);
if (entity.isDraft()) {
entity = ((EntityDraft) entity).getParentEntity();
}
allEntityDrafts.deleteAll(entity);
allEntities.delete(entity);
}
use of org.motechproject.mds.domain.Entity in project motech by motech.
the class EntityServiceImpl method getCurrentSchemaVersion.
@Override
@Transactional
public Long getCurrentSchemaVersion(String className) {
Entity entity = allEntities.retrieveByClassName(className);
assertEntityExists(entity, className);
return entity.getEntityVersion();
}
use of org.motechproject.mds.domain.Entity in project motech by motech.
the class EntityServiceImpl method updateSecurityOptions.
@Override
@Transactional
public void updateSecurityOptions(Long entityId, SecurityMode securityMode, Set<String> securityMembers, SecurityMode readOnlySecurityMode, Set<String> readOnlySecurityMembers) {
Entity entity = allEntities.retrieveById(entityId);
assertEntityExists(entity, entityId);
entity.setSecurityMode(securityMode);
entity.setSecurityMembers(securityMembers);
entity.setReadOnlySecurityMode(readOnlySecurityMode);
entity.setReadOnlySecurityMembers(readOnlySecurityMembers);
allEntities.update(entity);
}
Aggregations