Search in sources :

Example 1 with AdminPresentationToOneLookup

use of org.broadleafcommerce.common.presentation.AdminPresentationToOneLookup in project BroadleafCommerce by BroadleafCommerce.

the class BasicFieldMetadataProvider method buildAdminPresentationToOneLookupOverride.

protected void buildAdminPresentationToOneLookupOverride(Map<String, FieldMetadata> mergedProperties, Map<String, AdminPresentationToOneLookupOverride> presentationOverrides, String propertyName, String key) {
    AdminPresentationToOneLookupOverride override = presentationOverrides.get(propertyName);
    if (override != null) {
        AdminPresentationToOneLookup annot = override.value();
        if (annot != null) {
            if (!(mergedProperties.get(key) instanceof BasicFieldMetadata)) {
                return;
            }
            BasicFieldMetadata metadata = (BasicFieldMetadata) mergedProperties.get(key);
            metadata.setFieldType(SupportedFieldType.ADDITIONAL_FOREIGN_KEY);
            metadata.setExplicitFieldType(SupportedFieldType.ADDITIONAL_FOREIGN_KEY);
            metadata.setLookupDisplayProperty(annot.lookupDisplayProperty());
            metadata.setForcePopulateChildProperties(annot.forcePopulateChildProperties());
            metadata.setEnableTypeaheadLookup(annot.enableTypeaheadLookup());
            if (!StringUtils.isEmpty(annot.lookupDisplayProperty())) {
                metadata.setForeignKeyDisplayValueProperty(annot.lookupDisplayProperty());
            }
            metadata.setCustomCriteria(annot.customCriteria());
            metadata.setUseServerSideInspectionCache(annot.useServerSideInspectionCache());
        }
    }
}
Also used : BasicFieldMetadata(org.broadleafcommerce.openadmin.dto.BasicFieldMetadata) AdminPresentationToOneLookup(org.broadleafcommerce.common.presentation.AdminPresentationToOneLookup) AdminPresentationToOneLookupOverride(org.broadleafcommerce.common.presentation.override.AdminPresentationToOneLookupOverride)

Aggregations

AdminPresentationToOneLookup (org.broadleafcommerce.common.presentation.AdminPresentationToOneLookup)1 AdminPresentationToOneLookupOverride (org.broadleafcommerce.common.presentation.override.AdminPresentationToOneLookupOverride)1 BasicFieldMetadata (org.broadleafcommerce.openadmin.dto.BasicFieldMetadata)1