当前位置: 首页>>代码示例>>Java>>正文


Java MotechDataService.retrieve方法代码示例

本文整理汇总了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;
}
 
开发者ID:motech,项目名称:motech,代码行数:18,代码来源:InstanceServiceImpl.java

示例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);
}
 
开发者ID:motech,项目名称:motech,代码行数:17,代码来源:InstanceServiceImpl.java

示例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);
        }
    }
}
 
开发者ID:motech,项目名称:motech,代码行数:36,代码来源:InstanceServiceImpl.java

示例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);
}
 
开发者ID:motech,项目名称:motech,代码行数:11,代码来源:InstanceServiceImpl.java

示例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);
}
 
开发者ID:motech,项目名称:motech,代码行数:13,代码来源:InstanceServiceImpl.java


注:本文中的org.motechproject.mds.service.MotechDataService.retrieve方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。