class BasicInputControlHandler implements InputControlHandler {

    @Override
    public ReportInputControl buildReportInputControl(InputControl inputControl, String uiType, ResourceReference dataSource) throws CascadeResourceNotFoundException {
        ReportInputControl control = new ReportInputControl();
        control.setId(inputControl.getName());
        control.setLabel(inputControl.getLabel());
        control.setDescription(inputControl.getDescription());
        control.setUri(inputControl.getURI());
        control.setMandatory(inputControl.isMandatory());
        control.setReadOnly(inputControl.isReadOnly());
        control.setVisible(inputControl.isVisible());
        control.setType(getType(inputControl, uiType));
        final List<ValidationRule> validationRules = getValidationRules(inputControl);
        if (validationRules != null && !validationRules.isEmpty()) {
            control.setValidationRules(validationRules);
        }
        final ResourceReference dataTypeReference = inputControl.getDataType();
        if(dataTypeReference != null){
            final DataType dataType = dataTypeReference.isLocal() ? (DataType) dataTypeReference.getLocalResource()
                    : cachedRepositoryService.getResource(DataType.class, dataTypeReference.getReferenceURI());
            if(dataType != null && dataTypeResourceConverter != null) {
                control.setDataType(dataTypeResourceConverter.toClient(dataType, ToClientConversionOptions.getDefault()));
            }
        }
        return control;
    }

}