Class DefaultTypeAheadConfigurationService<P extends com.broadleafcommerce.search.api.domain.TypeAheadConfiguration>

  • All Implemented Interfaces:
    com.broadleafcommerce.data.tracking.core.service.CrudEntityService<P>, TypeAheadConfigurationService<P>

    public class DefaultTypeAheadConfigurationService<P extends com.broadleafcommerce.search.api.domain.TypeAheadConfiguration>
    extends com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P>
    implements TypeAheadConfigurationService<P>
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected List<com.broadleafcommerce.search.api.domain.FieldDefinition> buildFieldsToHydrate​(P configuration)  
      protected P convertFromPersistentDomain​(com.broadleafcommerce.data.tracking.core.Trackable domain, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)  
      protected Map<String,​com.broadleafcommerce.search.api.domain.FieldDefinition> convertToMap​(List<com.broadleafcommerce.search.api.domain.FieldDefinition> fieldDefinitions)
      Converts a list of FieldDefinitions to a map with the key being their FieldDefinition.getId()
      protected FieldDefinitionService<com.broadleafcommerce.search.api.domain.FieldDefinition> getFieldDefinitionService()  
      protected TypeAheadConfigurationRepository<com.broadleafcommerce.data.tracking.core.Trackable> getRepository()  
      P hydrateConfiguration​(P typeAheadConfiguration, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Hydrate any nested fields in the TypeAheadConfiguration.
      protected List<com.broadleafcommerce.search.api.domain.FieldDefinition> hydrateFields​(List<com.broadleafcommerce.search.api.domain.FieldDefinition> fieldDefinitions, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Hydrates a list of field definitions by their id
      Optional<P> readByName​(String configName, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Returns a TypeAheadConfiguration with the given name.
      • Methods inherited from class com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService

        convertToPersistentDomain, create, createAll, createAllAllowingPartialSuccess, delete, getHelper, getSortPositionStrategy, readAll, readAll, readAll, readAllByContextId, readByContextId, replace, replaceAll, replaceAllAllowingPartialSuccess, setSortPositionStrategy, update, updateAll, updateAllAllowingPartialSuccess, updateSort
      • Methods inherited from interface com.broadleafcommerce.data.tracking.core.service.CrudEntityService

        create, createAll, createAllAllowingPartialSuccess, delete, readAll, readAll, readAll, readAllByContextId, readByContextId, replace, replaceAll, replaceAllAllowingPartialSuccess, update, updateAll, updateAllAllowingPartialSuccess, updateSort
    • Constructor Detail

      • DefaultTypeAheadConfigurationService

        public DefaultTypeAheadConfigurationService​(TypeAheadConfigurationRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository,
                                                    FieldDefinitionService<com.broadleafcommerce.search.api.domain.FieldDefinition> fieldDefinitionService,
                                                    com.broadleafcommerce.data.tracking.core.service.CrudEntityHelper helper)
    • Method Detail

      • readByName

        public Optional<P> readByName​(String configName,
                                      @Nullable
                                      com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Description copied from interface: TypeAheadConfigurationService
        Returns a TypeAheadConfiguration with the given name.
        Specified by:
        readByName in interface TypeAheadConfigurationService<P extends com.broadleafcommerce.search.api.domain.TypeAheadConfiguration>
        Parameters:
        configName - The name of the configuration
        contextInfo - context information surrounding sandboxing/multitenant state
        Returns:
        The configuration matching the name or null if not found.
      • convertFromPersistentDomain

        protected P convertFromPersistentDomain​(com.broadleafcommerce.data.tracking.core.Trackable domain,
                                                com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Overrides:
        convertFromPersistentDomain in class com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P extends com.broadleafcommerce.search.api.domain.TypeAheadConfiguration>
      • hydrateConfiguration

        public P hydrateConfiguration​(P typeAheadConfiguration,
                                      @Nullable
                                      com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Description copied from interface: TypeAheadConfigurationService
        Hydrate any nested fields in the TypeAheadConfiguration.
        Specified by:
        hydrateConfiguration in interface TypeAheadConfigurationService<P extends com.broadleafcommerce.search.api.domain.TypeAheadConfiguration>
        Parameters:
        typeAheadConfiguration - Configuration to hydrate
        contextInfo - context information surrounding sandboxing/multitenant state
        Returns:
        Hydrated configuration
      • buildFieldsToHydrate

        protected List<com.broadleafcommerce.search.api.domain.FieldDefinition> buildFieldsToHydrate​(P configuration)
      • convertToMap

        protected Map<String,​com.broadleafcommerce.search.api.domain.FieldDefinition> convertToMap​(List<com.broadleafcommerce.search.api.domain.FieldDefinition> fieldDefinitions)
        Converts a list of FieldDefinitions to a map with the key being their FieldDefinition.getId()
        Parameters:
        fieldDefinitions - A list of field definitions.
        Returns:
        A map of field definitions with their ID as the key
      • hydrateFields

        protected List<com.broadleafcommerce.search.api.domain.FieldDefinition> hydrateFields​(List<com.broadleafcommerce.search.api.domain.FieldDefinition> fieldDefinitions,
                                                                                              @Nullable
                                                                                              com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
        Hydrates a list of field definitions by their id
        Parameters:
        fieldDefinitions - A list of field definitions
        context - The context
        Returns:
        A list of hydrated field definitions.
      • getRepository

        protected TypeAheadConfigurationRepository<com.broadleafcommerce.data.tracking.core.Trackable> getRepository()
        Overrides:
        getRepository in class com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P extends com.broadleafcommerce.search.api.domain.TypeAheadConfiguration>
      • getFieldDefinitionService

        protected FieldDefinitionService<com.broadleafcommerce.search.api.domain.FieldDefinition> getFieldDefinitionService()