atg.commerce.search.refinement.admin
Class RefinementConfigurationGenerator

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.commerce.search.refinement.admin.RefinementConfigurationGenerator
All Implemented Interfaces:
atg.naming.AbsoluteNameable, NameContextBindingListener, NameContextElement, atg.naming.NameContextParentable, NameResolver, AdminableService, atg.nucleus.Configured, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, java.util.EventListener
Direct Known Subclasses:
CustomRefinementConfigurationGenerator, StandardRefinementConfigurationGenerator

public abstract class RefinementConfigurationGenerator
extends GenericService

Abstract base class for refinement configuration generators.


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
 CommerceRefinementConfigurationPropertyManager mCommerceRefinementConfigurationPropertyManager
           
protected  atg.commerce.search.refinement.CommerceFacetSourceGenerator mFacetSourceGenerator
           
protected  IdGenerator mIdGenerator
           
protected  java.lang.String mIdSpace
           
 RefinementElementPropertyManager mRefinementElementPropertyManager
           
protected  Repository mRefinementRepository
          Gets the refinement repository from the property manager.
 javax.transaction.TransactionManager mTransactionManager
           
 
Fields inherited from class atg.nucleus.GenericService
SERVICE_INFO_KEY
 
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging
DEFAULT_LOG_TRACE_STATUS
 
Fields inherited from interface atg.nucleus.logging.ApplicationLogging
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
 
Constructor Summary
RefinementConfigurationGenerator()
           
 
Method Summary
abstract  RefinementConfigurationCollector collect()
          Convenience method to call generate with a null XML handler, which tells it to update the refinement configuration generated refinement elements, but not create the XML.
abstract  RefinementConfigurationCollector collect(atg.search.index.IndexInfo pIndexInfo)
          Convenience method to call generate with a null XML handler, which tells it to update the refinement configuration generated refinement elements, but not create the XML.
protected  RefinementConfigurationCollector createCollector(RefinementConfigurationCollectorFactory pFactory)
          Create an instance of RefinementConfigurationCollector using the supplied RefinementConfigurationCollectorFactory.
protected  RefinementConfigurationCollector createCollector(RefinementConfigurationCollectorFactory pFactory, MutableRepository pRefinementRepository)
          Create an instance of RefinementConfigurationCollector using the supplied RefinementConfigurationCollectorFactory and Refinement repository.
abstract  void generate(RefinementConfigurationCollector pCollector, RefinementConfigurationXMLHandler pHandler)
          Generate the refinement configurations.
protected  void generateXMLsAndSubmitToEngine(RefinementConfigurationCollector pCollector, RefinementConfigurationXMLHandler pHandler)
          Iterates through the "elementsToConfigurations" map property of pCollector method parameter and for each entry generates a refine-config xml document and submits this to the search engine via the pHandler.
 RefinementConfigurationCollectorFactory getCollectorFactory()
          Gets the refinement configuration collector factory.
 CommerceRefinementConfigurationPropertyManager getCommerceRefinementConfigurationPropertyManager()
          Gets the refinement element property manager.
 atg.commerce.search.refinement.CommerceFacetSourceGenerator getFacetSourceGenerator()
           
 IdGenerator getIdGenerator()
           
 java.lang.String getIdSpace()
           
 RefineConfigXMLGenerator getRefineConfigXMLGenerator()
          Gets the refinement configuration XML generator.
 java.lang.String getRefinementElementItemDescriptorName()
          Gets the refinement element item descriptor name from the property manager.
 RefinementElementPropertyManager getRefinementElementPropertyManager()
          Gets the refinement element property manager.
 MutableRepository getRefinementRepository()
           
protected  java.util.Map<java.lang.String,java.lang.Object> getRepositoryItemPropertyValueVariations(MutableRepository pRepository, RepositoryItem pItem, java.util.Map<java.lang.String,java.lang.Object> pExpectedValuesMap)
          Checks whether specified property values of a RepositoryItem match passed in values.
 javax.transaction.TransactionManager getTransactionManager()
          Gets the transaction manager.
 void setCollectorFactory(RefinementConfigurationCollectorFactory pCollectorFactory)
          Sets the refinement configuration collector.
 void setCommerceRefinementConfigurationPropertyManager(CommerceRefinementConfigurationPropertyManager pCommerceRefinementConfigurationPropertyManager)
          Sets the refinement element property manager.
 void setFacetSourceGenerator(atg.commerce.search.refinement.CommerceFacetSourceGenerator pFacetSourceGenerator)
           
 void setIdGenerator(IdGenerator pIdGenerator)
           
 void setIdSpace(java.lang.String pIdSpace)
           
 void setRefineConfigXMLGenerator(RefineConfigXMLGenerator pRefineConfigXMLGenerator)
          Sets the refinement configuration XML generator.
 void setRefinementElementPropertyManager(RefinementElementPropertyManager pRefinementElementPropertyManager)
          Sets the refinement element property manager.
 void setTransactionManager(javax.transaction.TransactionManager pTransactionManager)
          Sets the transaction manager.
 void updateCollectedRefineConfigs(RefinementConfigurationCollector pCollector)
          Iterates through the "elementsToConfigurations" map property of pCollector method parameter.
protected  void updateRepositoryItem(MutableRepository pRepository, RepositoryItem pItem, java.lang.String pItemDescriptorName, java.util.Map<java.lang.String,java.lang.Object> pValues)
          Updates a RepositoryItem using a map of property name -> property values.
protected  boolean valueMatchesItemPropertyValue(RepositoryItem pItem, java.lang.String pPropertyName, java.lang.Object pValue)
          Tests whether a given value matches the specified property value of a RepositoryItem and returns the result of the comparison.
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStartService, doStopService, getAbsoluteName, getAdminServlet, getAdminServletOutputStreamEncoding, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isAdminServletUseServletOutputStream, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, reResolveThis, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setAdminServletOutputStreamEncoding, setAdminServletUseServletOutputStream, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string


mIdGenerator

protected IdGenerator mIdGenerator

mIdSpace

protected java.lang.String mIdSpace

mCommerceRefinementConfigurationPropertyManager

public CommerceRefinementConfigurationPropertyManager mCommerceRefinementConfigurationPropertyManager

mRefinementRepository

protected Repository mRefinementRepository
Gets the refinement repository from the property manager.


mTransactionManager

public javax.transaction.TransactionManager mTransactionManager

mRefinementElementPropertyManager

public RefinementElementPropertyManager mRefinementElementPropertyManager

mFacetSourceGenerator

protected atg.commerce.search.refinement.CommerceFacetSourceGenerator mFacetSourceGenerator
Constructor Detail

RefinementConfigurationGenerator

public RefinementConfigurationGenerator()
Method Detail

setIdGenerator

public void setIdGenerator(IdGenerator pIdGenerator)

getIdGenerator

public IdGenerator getIdGenerator()

setIdSpace

public void setIdSpace(java.lang.String pIdSpace)

getIdSpace

public java.lang.String getIdSpace()

setRefineConfigXMLGenerator

public void setRefineConfigXMLGenerator(RefineConfigXMLGenerator pRefineConfigXMLGenerator)
Sets the refinement configuration XML generator.


getRefineConfigXMLGenerator

public RefineConfigXMLGenerator getRefineConfigXMLGenerator()
Gets the refinement configuration XML generator.


setCommerceRefinementConfigurationPropertyManager

public void setCommerceRefinementConfigurationPropertyManager(CommerceRefinementConfigurationPropertyManager pCommerceRefinementConfigurationPropertyManager)
Sets the refinement element property manager.


getCommerceRefinementConfigurationPropertyManager

public CommerceRefinementConfigurationPropertyManager getCommerceRefinementConfigurationPropertyManager()
Gets the refinement element property manager.


getRefinementRepository

public MutableRepository getRefinementRepository()

setTransactionManager

public void setTransactionManager(javax.transaction.TransactionManager pTransactionManager)
Sets the transaction manager.


getTransactionManager

public javax.transaction.TransactionManager getTransactionManager()
Gets the transaction manager.


setRefinementElementPropertyManager

public void setRefinementElementPropertyManager(RefinementElementPropertyManager pRefinementElementPropertyManager)
Sets the refinement element property manager.


getRefinementElementPropertyManager

public RefinementElementPropertyManager getRefinementElementPropertyManager()
Gets the refinement element property manager.


getRefinementElementItemDescriptorName

public java.lang.String getRefinementElementItemDescriptorName()
Gets the refinement element item descriptor name from the property manager.


getCollectorFactory

public RefinementConfigurationCollectorFactory getCollectorFactory()
Gets the refinement configuration collector factory.


setCollectorFactory

public void setCollectorFactory(RefinementConfigurationCollectorFactory pCollectorFactory)
Sets the refinement configuration collector.


setFacetSourceGenerator

public void setFacetSourceGenerator(atg.commerce.search.refinement.CommerceFacetSourceGenerator pFacetSourceGenerator)

getFacetSourceGenerator

public atg.commerce.search.refinement.CommerceFacetSourceGenerator getFacetSourceGenerator()

generate

public abstract void generate(RefinementConfigurationCollector pCollector,
                              RefinementConfigurationXMLHandler pHandler)
Generate the refinement configurations.


collect

public abstract RefinementConfigurationCollector collect()
Convenience method to call generate with a null XML handler, which tells it to update the refinement configuration generated refinement elements, but not create the XML.


collect

public abstract RefinementConfigurationCollector collect(atg.search.index.IndexInfo pIndexInfo)
Convenience method to call generate with a null XML handler, which tells it to update the refinement configuration generated refinement elements, but not create the XML.


generateXMLsAndSubmitToEngine

protected void generateXMLsAndSubmitToEngine(RefinementConfigurationCollector pCollector,
                                             RefinementConfigurationXMLHandler pHandler)
                                      throws IdGeneratorException,
                                             atg.repository.search.indexing.IndexingException,
                                             RepositoryException
Iterates through the "elementsToConfigurations" map property of pCollector method parameter and for each entry generates a refine-config xml document and submits this to the search engine via the pHandler. During iteration there is also a check to ensure that the refineConfig repositoryItem "generatedRefineElements" and "refineConfigName " properties match values obtained during collection. If they don't then behavior is determined by the value of pCollector's hasRepositoryUpdatePermissions property. If hasRepositoryUpdatePermissions is true then the repositoryItem is updated with the expected values. If false then a RepositoryException is thrown.

Parameters:
pCollector -
pHandler -
Throws:
IdGeneratorException
atg.repository.search.indexing.IndexingException
RepositoryException

updateCollectedRefineConfigs

public void updateCollectedRefineConfigs(RefinementConfigurationCollector pCollector)
                                  throws atg.repository.search.indexing.IndexingException
Iterates through the "elementsToConfigurations" map property of pCollector method parameter. Each entry maps a set of refineElements to a set of corresponding refineConfigs that should have these refineElements as its generatedRefineElements property value. If a refineConfig does not have a matching generatedRefineElements property value then the repository item is updated accordingly. Likewise its refineConfigName property may also be updated with a common value for each map entry which is derived from pCollector's "existingNameMap".

Parameters:
pCollector -
Throws:
atg.repository.search.indexing.IndexingException

getRepositoryItemPropertyValueVariations

protected java.util.Map<java.lang.String,java.lang.Object> getRepositoryItemPropertyValueVariations(MutableRepository pRepository,
                                                                                                    RepositoryItem pItem,
                                                                                                    java.util.Map<java.lang.String,java.lang.Object> pExpectedValuesMap)
                                                                                             throws RepositoryException
Checks whether specified property values of a RepositoryItem match passed in values. Any values that do not match are returned in the "variations" map.

Parameters:
pRepository -
pItem -
pExpectedValuesMap -
Returns:
Throws:
RepositoryException

valueMatchesItemPropertyValue

protected boolean valueMatchesItemPropertyValue(RepositoryItem pItem,
                                                java.lang.String pPropertyName,
                                                java.lang.Object pValue)
                                         throws RepositoryException
Tests whether a given value matches the specified property value of a RepositoryItem and returns the result of the comparison.

Parameters:
pItem -
pPropertyName -
pValue -
Returns:
Throws:
RepositoryException

updateRepositoryItem

protected void updateRepositoryItem(MutableRepository pRepository,
                                    RepositoryItem pItem,
                                    java.lang.String pItemDescriptorName,
                                    java.util.Map<java.lang.String,java.lang.Object> pValues)
                             throws RepositoryException
Updates a RepositoryItem using a map of property name -> property values.

Parameters:
pRepository -
pItem -
pValues -
Throws:
RepositoryException

createCollector

protected RefinementConfigurationCollector createCollector(RefinementConfigurationCollectorFactory pFactory)
Create an instance of RefinementConfigurationCollector using the supplied RefinementConfigurationCollectorFactory.

Parameters:
pFactory -
Returns:

createCollector

protected RefinementConfigurationCollector createCollector(RefinementConfigurationCollectorFactory pFactory,
                                                           MutableRepository pRefinementRepository)
Create an instance of RefinementConfigurationCollector using the supplied RefinementConfigurationCollectorFactory and Refinement repository.

Parameters:
pFactory -
pRefinementRepository -
idGenerator -
Returns: