Search in sources :

Example 1 with FieldInstanceDto

use of org.motechproject.mds.dto.FieldInstanceDto in project motech by motech.

the class InstanceServiceImpl method getInstanceFields.

@Override
public List<FieldInstanceDto> getInstanceFields(Long entityId, Long instanceId) {
    EntityDto entity = entityService.getEntity(entityId);
    validateCredentialsForReading(entity);
    List<FieldDto> fields = entityService.getEntityFieldsForUI(entityId);
    List<FieldInstanceDto> result = new ArrayList<>();
    for (FieldDto field : fields) {
        FieldInstanceDto fieldInstanceDto = new FieldInstanceDto(field.getId(), instanceId, field.getBasic());
        result.add(fieldInstanceDto);
    }
    return result;
}
Also used : EntityDto(org.motechproject.mds.dto.EntityDto) ArrayList(java.util.ArrayList) FieldInstanceDto(org.motechproject.mds.dto.FieldInstanceDto) FieldDto(org.motechproject.mds.dto.FieldDto)

Aggregations

ArrayList (java.util.ArrayList)1 EntityDto (org.motechproject.mds.dto.EntityDto)1 FieldDto (org.motechproject.mds.dto.FieldDto)1 FieldInstanceDto (org.motechproject.mds.dto.FieldInstanceDto)1