use of org.motechproject.mds.exception.field.FieldNotFoundException in project motech by motech.
the class LookupReader method readFields.
private List<Field> readFields() throws IOException {
List<Field> fields = new ArrayList<>();
objectReader.expect("fields");
jsonReader.beginArray();
while (jsonReader.hasNext()) {
String fieldName = jsonReader.nextString();
Field field = entity.getField(fieldName);
if (null != field) {
fields.add(field);
} else {
throw new FieldNotFoundException(entity.getClassName(), fieldName);
}
}
jsonReader.endArray();
return fields;
}
use of org.motechproject.mds.exception.field.FieldNotFoundException in project motech by motech.
the class EntityServiceImpl method findEntityFieldByName.
@Override
@Transactional
public FieldDto findEntityFieldByName(Long entityId, String name) {
Entity entity = allEntities.retrieveById(entityId);
Field field = entity.getField(name);
if (field == null) {
throw new FieldNotFoundException(entity.getClassName(), name);
}
return field.toDto();
}
use of org.motechproject.mds.exception.field.FieldNotFoundException in project motech by motech.
the class EntityServiceImpl method getEntityFieldById.
@Override
@Transactional
public FieldDto getEntityFieldById(Long entityId, Long fieldId) {
Entity entity = allEntities.retrieveById(entityId);
Field field = entity.getField(fieldId);
if (field == null) {
throw new FieldNotFoundException(entity.getClassName(), fieldId);
}
return field.toDto();
}
Aggregations