本文整理汇总了Java中org.motechproject.mds.service.MotechDataService.retrieve方法的典型用法代码示例。如果您正苦于以下问题:Java MotechDataService.retrieve方法的具体用法?Java MotechDataService.retrieve怎么用?Java MotechDataService.retrieve使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.motechproject.mds.service.MotechDataService
的用法示例。
在下文中一共展示了MotechDataService.retrieve方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getInstanceHistory
import org.motechproject.mds.service.MotechDataService; //导入方法依赖的package包/类
@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;
}
示例2: getEntityInstance
import org.motechproject.mds.service.MotechDataService; //导入方法依赖的package包/类
@Override
public EntityRecord getEntityInstance(Long entityId, Long instanceId) {
EntityDto entity = getEntity(entityId);
validateCredentialsForReading(entity);
MotechDataService service = getServiceForEntity(entity);
Object instance = service.retrieve(ID_FIELD_NAME, instanceId);
if (instance == null) {
throw new ObjectNotFoundException(entity.getName(), instanceId);
}
List<FieldDto> fields = entityService.getEntityFieldsForUI(entityId);
Map<String, List<FieldDto>> relatedEntitiesFields = getRelatedEntitiesFields(fields);
return instanceToRecord(instance, entity, fields, service, EntityType.STANDARD, relatedEntitiesFields);
}
示例3: saveInstance
import org.motechproject.mds.service.MotechDataService; //导入方法依赖的package包/类
@Override
@Transactional
public Object saveInstance(EntityRecord entityRecord, Long deleteValueFieldId) {
EntityDto entity = getEntity(entityRecord.getEntitySchemaId());
validateCredentials(entity);
validateNonEditableProperty(entity);
List<FieldDto> entityFields = getEntityFields(entityRecord.getEntitySchemaId());
try {
MotechDataService service = getServiceForEntity(entity);
Class<?> entityClass = getEntityClass(entity);
boolean newObject = entityRecord.getId() == null;
Object instance;
if (newObject) {
instance = newInstanceFromEntityRecord(entityClass, entityFields, entityRecord.getFields(), service);
return service.create(instance);
} else {
instance = service.retrieve(ID_FIELD_NAME, entityRecord.getId());
if (instance == null) {
throw new ObjectNotFoundException(entity.getName(), entityRecord.getId());
}
updateFields(instance, entityRecord.getFields(), service, deleteValueFieldId, true);
return service.update(instance);
}
} catch (Exception e) {
if (entityRecord.getId() == null) {
throw new ObjectCreateException(entity.getName(), e);
} else {
throw new ObjectUpdateException(entity.getName(), entityRecord.getId(), e);
}
}
}
示例4: countHistoryRecords
import org.motechproject.mds.service.MotechDataService; //导入方法依赖的package包/类
@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);
}
示例5: getHistoryRecord
import org.motechproject.mds.service.MotechDataService; //导入方法依赖的package包/类
@Override
public HistoryRecord getHistoryRecord(Long entityId, Long instanceId, Long historyId) {
EntityDto entity = getEntity(entityId);
validateCredentialsForReading(entity);
MotechDataService service = getServiceForEntity(entity);
Object instance = service.retrieve(ID_FIELD_NAME, instanceId);
Object historyInstance = historyService.getSingleHistoryInstance(instance, historyId);
return convertToHistoryRecord(historyInstance, entity, instanceId, service);
}