atg.repository.search.indexing.refinement
Class RefineConfigXMLGenerator

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.nucleus.TimedOperationService
              extended by atg.repository.search.indexing.refinement.RefineConfigXMLGenerator
All Implemented Interfaces:
NameContextBindingListener, NameContextElement, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, java.util.EventListener

public class RefineConfigXMLGenerator
extends TimedOperationService

Service to generate ATG Search refinement configuration XML from refinement repository data.


Field Summary
static java.lang.String BUNDLE_NAME
           
static java.lang.String CLASS_VERSION
          Class version string
static java.lang.String PROPERTY_NOT_FOUND
           
static java.util.ResourceBundle sResources
           
 
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
RefineConfigXMLGenerator()
           
 
Method Summary
protected  org.w3c.dom.Document createDocument()
          Create a new DOM document, using the document builder.
protected  org.w3c.dom.Document createRefineConfigDocument(java.util.List pRefineElementItemList, RefineConfigXMLInfo pInfo)
          Create a refinement confiugration DOM document from the given name and list of refinement element repository items.
protected  org.w3c.dom.Element createRefineElement(org.w3c.dom.Document pDocument, RefinementElement pRefineElement)
          Create a refinement element DOM element from the given refinement element repository item.
 void generateRefineConfigXML(RepositoryItem pRefineConfig, RefineConfigXMLInfo pInfo, java.io.OutputStream pOut)
          Generate a refinement configuration XML to the given output stream.
 void generateRefineConfigXML(java.lang.String pName, java.util.List pRefineElementItemList, RefineConfigXMLInfo pInfo, java.io.OutputStream pOut)
          Generate a refinement configuration given a name and a list of refinement elements.
 java.lang.String getApplicationName()
           
 java.util.Map getDelimitedPropertyToAttributeMap()
          Gets the map used to translate refinement element item property names to attribute names used in the output XML.
 java.io.File getDestinationDirectory()
           
 javax.xml.parsers.DocumentBuilder getDocumentBuilder()
          Gets the document builder that will be used to create DOM documents.
 java.lang.String[] getFilterProperties()
          Gets the list of properties whose refinement Elements not be filtered by the search engine.
protected  boolean getFilterValue(RefinementElement pRefinementElement)
          Determines whether or not this facet should be filtered by the search engine.
protected  RefinementElement[] getPrioritizedRefineElements(java.util.List pRefineElements)
          Sorts the list of refine elements using the priority comparator.
 java.util.Comparator getPriorityComparator()
          Gets the comparator that can be used to sort refinement elements.
 RefinementConfigurationPropertyManager getRefinementConfigurationPropertyManager()
          Gets the refinement configuration property manager.
protected  RefinementElement getRefinementElementForItem(RepositoryItem pItem)
          Get a refinement element object for the given refinement element repository item.
 RefinementElementPropertyManager getRefinementElementPropertyManager()
          Gets the refinement element property manager.
 java.util.Map getSimplePropertyToAttributeMap()
          Gets the map used to translate refinement element item property names to attribute names used in the output XML.
 javax.xml.transform.Transformer getTransformer()
          Gets the XML Transformer that will generate the XML stream from a DOM tree.
 java.lang.String getValueDelimiter()
          Sets the String used to delimit values of collection attributes.
protected  double roundTo2Dec(double pDouble)
          Utility method to round a double to 2 decimal places
 void setApplicationName(java.lang.String pApplicationName)
           
 void setDelimitedPropertyToAttributeMap(java.util.Map pDPTAM)
          Sets the map used to translate refinement element item property names to attribute names used in the output XML.
 void setDestinationDirectory(java.io.File pDestinationDirectory)
           
 void setDocumentBuilder(javax.xml.parsers.DocumentBuilder pDocumentBuilder)
          Sets the document builder that will be used to create DOM documents.
 void setFilterProperties(java.lang.String[] pFilterProperties)
          Sets the list of properties whose refinement Elements will not be filtered by the search engine.
 void setPriorityComparator(java.util.Comparator pComparator)
          Sets the comparator that can be used to sort refinement elements.
 void setRefinementConfigurationPropertyManager(RefinementConfigurationPropertyManager pManager)
          Sets the refinement configuration property manager.
 void setRefinementElementPropertyManager(RefinementElementPropertyManager pManager)
          Sets the refinement element property manager.
 void setSimplePropertyToAttributeMap(java.util.Map pSPTAM)
          Sets the map used to translate refinement element item property names to attribute names used in the output XML.
 void setTransformer(javax.xml.transform.Transformer pTransformer)
          Sets the XML Transformer that will generate the XML stream from a DOM tree.
 void setValueDelimiter(java.lang.String pValueDelimiter)
          Sets the String used to delimit values of collection attributes.
protected  void transformToXML(org.w3c.dom.Node pDocument, java.io.OutputStream pOut)
          Transform a DOM Document object to an XML output stream.
 
Methods inherited from class atg.nucleus.TimedOperationService
getAverageRequestHandlingTime, getHandledRequestCount, getRequestStartTime, getTotalRequestHandlingTime, isKeepingStatistics, notifyHandledRequest, resetStatistics, setKeepingStatistics
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStartService, doStopService, getAbsoluteName, getAdminServlet, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, 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, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, 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


BUNDLE_NAME

public static final java.lang.String BUNDLE_NAME
See Also:
Constant Field Values

sResources

public static final java.util.ResourceBundle sResources

PROPERTY_NOT_FOUND

public static final java.lang.String PROPERTY_NOT_FOUND
See Also:
Constant Field Values
Constructor Detail

RefineConfigXMLGenerator

public RefineConfigXMLGenerator()
Method Detail

getDestinationDirectory

public java.io.File getDestinationDirectory()

setDestinationDirectory

public void setDestinationDirectory(java.io.File pDestinationDirectory)

getApplicationName

public java.lang.String getApplicationName()

setApplicationName

public void setApplicationName(java.lang.String pApplicationName)

setSimplePropertyToAttributeMap

public void setSimplePropertyToAttributeMap(java.util.Map pSPTAM)
Sets the map used to translate refinement element item property names to attribute names used in the output XML. This map contains the names of properties with non-collection values.


getSimplePropertyToAttributeMap

public java.util.Map getSimplePropertyToAttributeMap()
Gets the map used to translate refinement element item property names to attribute names used in the output XML. This map contains the names of properties with non-collection vales.


setDelimitedPropertyToAttributeMap

public void setDelimitedPropertyToAttributeMap(java.util.Map pDPTAM)
Sets the map used to translate refinement element item property names to attribute names used in the output XML. This map contains the names of properties with collection values that need to be delimited in the XML..


getDelimitedPropertyToAttributeMap

public java.util.Map getDelimitedPropertyToAttributeMap()
Gets the map used to translate refinement element item property names to attribute names used in the output XML. This map contains the names of properties with collection values that need to be delimited in the XML..


setValueDelimiter

public void setValueDelimiter(java.lang.String pValueDelimiter)
Sets the String used to delimit values of collection attributes.


getValueDelimiter

public java.lang.String getValueDelimiter()
Sets the String used to delimit values of collection attributes. Default: "|"


setFilterProperties

public void setFilterProperties(java.lang.String[] pFilterProperties)
Sets the list of properties whose refinement Elements will not be filtered by the search engine. Default behavior is for refinement Elements to be filtered (filter="1") however if a facet's property name is in this array then it is un-filtered (filter="0").


getFilterProperties

public java.lang.String[] getFilterProperties()
Gets the list of properties whose refinement Elements not be filtered by the search engine.


getTransformer

public javax.xml.transform.Transformer getTransformer()
Gets the XML Transformer that will generate the XML stream from a DOM tree. If no transformer is set, this method will provide a default.


setTransformer

public void setTransformer(javax.xml.transform.Transformer pTransformer)
Sets the XML Transformer that will generate the XML stream from a DOM tree.


setDocumentBuilder

public void setDocumentBuilder(javax.xml.parsers.DocumentBuilder pDocumentBuilder)
Sets the document builder that will be used to create DOM documents.


getDocumentBuilder

public javax.xml.parsers.DocumentBuilder getDocumentBuilder()
Gets the document builder that will be used to create DOM documents. If no builder is set, this method will provide a default.


setRefinementConfigurationPropertyManager

public void setRefinementConfigurationPropertyManager(RefinementConfigurationPropertyManager pManager)
Sets the refinement configuration property manager.


getRefinementConfigurationPropertyManager

public RefinementConfigurationPropertyManager getRefinementConfigurationPropertyManager()
Gets the refinement configuration property manager.


setRefinementElementPropertyManager

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


getRefinementElementPropertyManager

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


setPriorityComparator

public void setPriorityComparator(java.util.Comparator pComparator)
Sets the comparator that can be used to sort refinement elements.


getPriorityComparator

public java.util.Comparator getPriorityComparator()
Gets the comparator that can be used to sort refinement elements.


createDocument

protected org.w3c.dom.Document createDocument()
Create a new DOM document, using the document builder.


generateRefineConfigXML

public void generateRefineConfigXML(RepositoryItem pRefineConfig,
                                    RefineConfigXMLInfo pInfo,
                                    java.io.OutputStream pOut)
Generate a refinement configuration XML to the given output stream.


generateRefineConfigXML

public void generateRefineConfigXML(java.lang.String pName,
                                    java.util.List pRefineElementItemList,
                                    RefineConfigXMLInfo pInfo,
                                    java.io.OutputStream pOut)
Generate a refinement configuration given a name and a list of refinement elements.


transformToXML

protected void transformToXML(org.w3c.dom.Node pDocument,
                              java.io.OutputStream pOut)
Transform a DOM Document object to an XML output stream.


createRefineConfigDocument

protected org.w3c.dom.Document createRefineConfigDocument(java.util.List pRefineElementItemList,
                                                          RefineConfigXMLInfo pInfo)
Create a refinement confiugration DOM document from the given name and list of refinement element repository items.


createRefineElement

protected org.w3c.dom.Element createRefineElement(org.w3c.dom.Document pDocument,
                                                  RefinementElement pRefineElement)
Create a refinement element DOM element from the given refinement element repository item.


getPrioritizedRefineElements

protected RefinementElement[] getPrioritizedRefineElements(java.util.List pRefineElements)
Sorts the list of refine elements using the priority comparator.


getRefinementElementForItem

protected RefinementElement getRefinementElementForItem(RepositoryItem pItem)
                                                 throws RepositoryException
Get a refinement element object for the given refinement element repository item.

Throws:
RepositoryException

getFilterValue

protected boolean getFilterValue(RefinementElement pRefinementElement)
Determines whether or not this facet should be filtered by the search engine. Filtered facets are not returned in the response if there is already a constraint for their property in the request. The default is true however exceptions can be specified by adding the property name of any facets that we do not want the search engine to filter to the filterProperties array property of this component.

Parameters:
pRefinementElement - RepositoryItem refineElement to check
Returns:
true if this refinementElement should be filtered.

roundTo2Dec

protected double roundTo2Dec(double pDouble)
Utility method to round a double to 2 decimal places

Parameters:
pDouble - double value to round
Returns:
rounded double value