Search in sources :

Example 1 with AddSearchMappingRequest

use of org.broadleafcommerce.openadmin.server.service.persistence.module.provider.request.AddSearchMappingRequest in project BroadleafCommerce by BroadleafCommerce.

the class BasicPersistenceModule method getFilterMappings.

@Override
public List<FilterMapping> getFilterMappings(PersistencePerspective persistencePerspective, CriteriaTransferObject cto, String ceilingEntityFullyQualifiedClassname, Map<String, FieldMetadata> mergedUnfilteredProperties, RestrictionFactory customRestrictionFactory) {
    Map<String, FieldMetadata> mergedProperties = filterOutCollectionMetadata(mergedUnfilteredProperties);
    List<FilterMapping> filterMappings = new ArrayList<FilterMapping>();
    for (String propertyId : cto.getCriteriaMap().keySet()) {
        if (mergedProperties.containsKey(propertyId)) {
            boolean handled = false;
            for (FieldPersistenceProvider fieldPersistenceProvider : fieldPersistenceProviders) {
                MetadataProviderResponse response = fieldPersistenceProvider.addSearchMapping(new AddSearchMappingRequest(persistencePerspective, cto, ceilingEntityFullyQualifiedClassname, mergedProperties, propertyId, getFieldManager(), this, this, customRestrictionFactory == null ? restrictionFactory : customRestrictionFactory), filterMappings);
                if (MetadataProviderResponse.NOT_HANDLED != response) {
                    handled = true;
                }
                if (MetadataProviderResponse.HANDLED_BREAK == response) {
                    break;
                }
            }
            if (!handled) {
                defaultFieldPersistenceProvider.addSearchMapping(new AddSearchMappingRequest(persistencePerspective, cto, ceilingEntityFullyQualifiedClassname, mergedProperties, propertyId, getFieldManager(), this, this, customRestrictionFactory == null ? restrictionFactory : customRestrictionFactory), filterMappings);
            }
        }
    }
    return filterMappings;
}
Also used : FieldMetadata(org.broadleafcommerce.openadmin.dto.FieldMetadata) BasicFieldMetadata(org.broadleafcommerce.openadmin.dto.BasicFieldMetadata) MetadataProviderResponse(org.broadleafcommerce.openadmin.server.service.type.MetadataProviderResponse) ArrayList(java.util.ArrayList) FieldPersistenceProvider(org.broadleafcommerce.openadmin.server.service.persistence.module.provider.FieldPersistenceProvider) FilterMapping(org.broadleafcommerce.openadmin.server.service.persistence.module.criteria.FilterMapping) AddSearchMappingRequest(org.broadleafcommerce.openadmin.server.service.persistence.module.provider.request.AddSearchMappingRequest)

Aggregations

ArrayList (java.util.ArrayList)1 BasicFieldMetadata (org.broadleafcommerce.openadmin.dto.BasicFieldMetadata)1 FieldMetadata (org.broadleafcommerce.openadmin.dto.FieldMetadata)1 FilterMapping (org.broadleafcommerce.openadmin.server.service.persistence.module.criteria.FilterMapping)1 FieldPersistenceProvider (org.broadleafcommerce.openadmin.server.service.persistence.module.provider.FieldPersistenceProvider)1 AddSearchMappingRequest (org.broadleafcommerce.openadmin.server.service.persistence.module.provider.request.AddSearchMappingRequest)1 MetadataProviderResponse (org.broadleafcommerce.openadmin.server.service.type.MetadataProviderResponse)1