Search in sources :

Example 1 with AddMetadataFromMappingDataRequest

use of org.broadleafcommerce.openadmin.server.dao.provider.metadata.request.AddMetadataFromMappingDataRequest in project BroadleafCommerce by BroadleafCommerce.

the class Metadata method getFieldMetadata.

public FieldMetadata getFieldMetadata(String prefix, final String propertyName, final List<Property> componentProperties, final SupportedFieldType type, final SupportedFieldType secondaryType, final Type entityType, Class<?> targetClass, final FieldMetadata presentationAttribute, final MergedPropertyType mergedPropertyType, final DynamicEntityDao dynamicEntityDao) {
    if (presentationAttribute.getTargetClass() == null) {
        presentationAttribute.setTargetClass(targetClass.getName());
        presentationAttribute.setFieldName(propertyName);
    }
    presentationAttribute.setInheritedFromType(targetClass.getName());
    presentationAttribute.setAvailableToTypes(new String[] { targetClass.getName() });
    boolean handled = false;
    for (FieldMetadataProvider fieldMetadataProvider : fieldMetadataProviders) {
        MetadataProviderResponse response = fieldMetadataProvider.addMetadataFromMappingData(new AddMetadataFromMappingDataRequest(componentProperties, type, secondaryType, entityType, propertyName, mergedPropertyType, dynamicEntityDao), presentationAttribute);
        if (MetadataProviderResponse.NOT_HANDLED != response) {
            handled = true;
        }
        if (MetadataProviderResponse.HANDLED_BREAK == response) {
            break;
        }
    }
    if (!handled) {
        defaultFieldMetadataProvider.addMetadataFromMappingData(new AddMetadataFromMappingDataRequest(componentProperties, type, secondaryType, entityType, propertyName, mergedPropertyType, dynamicEntityDao), presentationAttribute);
    }
    return presentationAttribute;
}
Also used : DefaultFieldMetadataProvider(org.broadleafcommerce.openadmin.server.dao.provider.metadata.DefaultFieldMetadataProvider) FieldMetadataProvider(org.broadleafcommerce.openadmin.server.dao.provider.metadata.FieldMetadataProvider) AddMetadataFromMappingDataRequest(org.broadleafcommerce.openadmin.server.dao.provider.metadata.request.AddMetadataFromMappingDataRequest) MetadataProviderResponse(org.broadleafcommerce.openadmin.server.service.type.MetadataProviderResponse)

Aggregations

DefaultFieldMetadataProvider (org.broadleafcommerce.openadmin.server.dao.provider.metadata.DefaultFieldMetadataProvider)1 FieldMetadataProvider (org.broadleafcommerce.openadmin.server.dao.provider.metadata.FieldMetadataProvider)1 AddMetadataFromMappingDataRequest (org.broadleafcommerce.openadmin.server.dao.provider.metadata.request.AddMetadataFromMappingDataRequest)1 MetadataProviderResponse (org.broadleafcommerce.openadmin.server.service.type.MetadataProviderResponse)1