use of org.motechproject.mds.dto.EntityDto in project motech by motech.
the class JdoListenerRegistryServiceImpl method updateEntityNames.
@Override
public void updateEntityNames() {
for (MotechLifecycleListener listener : listeners) {
String packageName = listener.getPackageName();
if (!packageName.isEmpty()) {
List<String> entityNames = new ArrayList<>();
for (EntityDto entityDto : entityService.findEntitiesByPackage(packageName)) {
entityNames.add(entityDto.getClassName());
}
listener.setEntityNames(entityNames);
}
}
}
use of org.motechproject.mds.dto.EntityDto in project motech by motech.
the class InstanceServiceImpl method getInstanceHistory.
@Override
public List<BasicHistoryRecord> getInstanceHistory(Long entityId, Long instanceId, QueryParams queryParams) {
EntityDto entity = getEntity(entityId);
validateCredentialsForReading(entity);
MotechDataService service = getServiceForEntity(entity);
Object instance = service.retrieve(ID_FIELD_NAME, instanceId);
List history = historyService.getHistoryForInstance(instance, queryParams);
updateGridSize(entityId, queryParams);
List<BasicHistoryRecord> result = new ArrayList<>();
for (Object o : history) {
result.add(convertToBasicHistoryRecord(o, entity, instanceId, service));
}
return result;
}
use of org.motechproject.mds.dto.EntityDto in project motech by motech.
the class InstanceServiceImpl method getEntityRecords.
@Override
public List<BasicEntityRecord> getEntityRecords(Long entityId, QueryParams queryParams) {
EntityDto entity = getEntity(entityId);
validateCredentialsForReading(entity);
List<FieldDto> fields = entityService.getEntityFieldsForUI(entityId);
MotechDataService service = getServiceForEntity(entity);
List instances = service.retrieveAll(queryParams);
updateGridSize(entityId, queryParams);
return instancesToBasicRecords(instances, entity, fields, service, EntityType.STANDARD);
}
use of org.motechproject.mds.dto.EntityDto in project motech by motech.
the class InstanceServiceImpl method countHistoryRecords.
@Override
public long countHistoryRecords(Long entityId, Long instanceId) {
EntityDto entity = getEntity(entityId);
validateCredentialsForReading(entity);
MotechDataService service = getServiceForEntity(entity);
Object instance = service.retrieve(ID_FIELD_NAME, instanceId);
return historyService.countHistoryRecords(instance);
}
use of org.motechproject.mds.dto.EntityDto in project motech by motech.
the class InstanceServiceImpl method getTrashRecords.
@Override
public List<BasicEntityRecord> getTrashRecords(Long entityId, QueryParams queryParams) {
EntityDto entity = getEntity(entityId);
validateCredentialsForReading(entity);
MotechDataService service = getServiceForEntity(entity);
List<FieldDto> fields = entityService.getEntityFieldsForUI(entityId);
Collection collection = trashService.getInstancesFromTrash(entity.getClassName(), queryParams);
updateGridSize(entityId, queryParams);
return instancesToBasicRecords(collection, entity, fields, service, EntityType.TRASH);
}
Aggregations