use of org.hisp.dhis.render.type.ValueTypeRenderingObject in project dhis2-core by dhis2.
the class ProgramTrackedEntityAttributeObjectBundleHook method renderTypeConformsToConstrains.
private void renderTypeConformsToConstrains(ProgramTrackedEntityAttribute ptea, Consumer<ErrorReport> addReports) {
DeviceRenderTypeMap<ValueTypeRenderingObject> map = ptea.getRenderType();
TrackedEntityAttribute attr = ptea.getAttribute();
if (map == null) {
return;
}
for (ValueTypeRenderingObject renderingObject : map.values()) {
if (renderingObject.getType() == null) {
addReports.accept(new ErrorReport(ProgramTrackedEntityAttribute.class, ErrorCode.E4011, "renderType.type"));
}
if (!ValidationUtils.validateRenderingType(ProgramTrackedEntityAttribute.class, attr.getValueType(), attr.hasOptionSet(), renderingObject.getType())) {
addReports.accept(new ErrorReport(ProgramTrackedEntityAttribute.class, ErrorCode.E4020, renderingObject.getType(), attr.getValueType()));
}
}
}
use of org.hisp.dhis.render.type.ValueTypeRenderingObject in project dhis2-core by dhis2.
the class ProgramStageDataElementObjectBundleHook method validate.
/**
* Validate that the RenderType (if any) conforms to the constraints of
* ValueType or OptionSet.
*/
@Override
public void validate(ProgramStageDataElement psda, ObjectBundle bundle, Consumer<ErrorReport> addReports) {
DeviceRenderTypeMap<ValueTypeRenderingObject> map = psda.getRenderType();
if (map == null) {
return;
}
DataElement de = psda.getDataElement();
for (ValueTypeRenderingObject renderingObject : map.values()) {
if (renderingObject.getType() == null) {
addReports.accept(new ErrorReport(ProgramStageDataElement.class, ErrorCode.E4011, "renderType.type"));
}
if (!ValidationUtils.validateRenderingType(ProgramStageDataElement.class, de.getValueType(), de.hasOptionSet(), renderingObject.getType())) {
addReports.accept(new ErrorReport(ProgramStageDataElement.class, ErrorCode.E4017, renderingObject.getType(), de.getValueType()));
}
}
}
use of org.hisp.dhis.render.type.ValueTypeRenderingObject in project dhis2-core by dhis2.
the class JsonBinaryTypeTest method getValueTypeRenderingObject.
private ValueTypeRenderingObject getValueTypeRenderingObject() {
ValueTypeRenderingObject valueTypeRenderingObject = new ValueTypeRenderingObject();
valueTypeRenderingObject.setType(BAR_CODE);
return valueTypeRenderingObject;
}
Aggregations