Class DefaultTypeAheadConfigurationService<P extends com.broadleafcommerce.search.api.domain.TypeAheadConfiguration>
- java.lang.Object
-
- com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P>
-
- com.broadleafcommerce.search.core.service.DefaultTypeAheadConfigurationService<P>
-
- 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>
-
-
Constructor Summary
Constructors Constructor Description 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 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 theirFieldDefinition.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 idOptional<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 class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
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 interfaceTypeAheadConfigurationService<P extends com.broadleafcommerce.search.api.domain.TypeAheadConfiguration>
- Parameters:
configName
- The name of the configurationcontextInfo
- 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 classcom.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 interfaceTypeAheadConfigurationService<P extends com.broadleafcommerce.search.api.domain.TypeAheadConfiguration>
- Parameters:
typeAheadConfiguration
- Configuration to hydratecontextInfo
- 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 theirFieldDefinition.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 definitionscontext
- The context- Returns:
- A list of hydrated field definitions.
-
getRepository
protected TypeAheadConfigurationRepository<com.broadleafcommerce.data.tracking.core.Trackable> getRepository()
- Overrides:
getRepository
in classcom.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P extends com.broadleafcommerce.search.api.domain.TypeAheadConfiguration>
-
getFieldDefinitionService
protected FieldDefinitionService<com.broadleafcommerce.search.api.domain.FieldDefinition> getFieldDefinitionService()
-
-