use of org.kie.workbench.common.forms.service.shared.meta.processing.MetaDataEntryProcessor in project kie-wb-common by kiegroup.
the class AbstractFieldManager method getDefinitionByModelProperty.
@Override
public FieldDefinition getDefinitionByModelProperty(ModelProperty modelProperty) {
FieldTypeEntry fieldTypeEntry = (FieldTypeEntry) modelProperty.getMetaData().getEntry(FieldTypeEntry.NAME);
FieldDefinition fieldDefinition = null;
if (fieldTypeEntry != null) {
fieldDefinition = getFieldFromProvider(fieldTypeEntry.getValue(), modelProperty.getTypeInfo());
}
if (fieldDefinition == null) {
Optional<FieldDefinition> optional = Optional.ofNullable(getDefinitionByDataType(modelProperty.getTypeInfo()));
if (optional.isPresent()) {
fieldDefinition = optional.get();
}
}
if (fieldDefinition != null) {
fieldDefinition.setName(modelProperty.getName());
fieldDefinition.setBinding(modelProperty.getName());
String label = modelProperty.getName();
label = label.substring(0, 1).toUpperCase() + label.substring(1);
fieldDefinition.setLabel(label);
fieldDefinition.setStandaloneClassName(modelProperty.getTypeInfo().getClassName());
if (fieldDefinition instanceof HasPlaceHolder) {
((HasPlaceHolder) fieldDefinition).setPlaceHolder(label);
}
for (MetaDataEntry entry : modelProperty.getMetaData().getEntries()) {
MetaDataEntryProcessor processor = metaDataEntryManager.getProcessorForEntry(entry);
if (processor != null && processor.supports(fieldDefinition)) {
processor.process(entry, fieldDefinition);
}
}
return fieldDefinition;
}
return null;
}
Aggregations