atg.repository.search.indexing
Class IndexingPropertyProvider

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

public class IndexingPropertyProvider
extends GenericService
implements MetaPropertyProvider, MetaPropertyFormatter

A service that is used by MetaPropertiesHelper to determine the property name & type for properties in the search index. Much of this code came from the old MetaPropertiesHelper under DCS.


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
 
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
IndexingPropertyProvider()
           
 
Method Summary
protected  boolean acceptType(java.lang.String pType)
          Takes a parameter of type String and checks it against the set of acceptable types passed into the getProperties() method.
protected  void addPropertiesFromSpecifier(java.util.Set<MetaProperty> pProperties, atg.repository.search.indexing.specifier.OutputItemSpecifier pSpecifier, DynamicPropertyDescriptor[] pParents, boolean pUseTextProperties)
          Add the properties from the output item specifier to the set.
 boolean areSubitemsValid(MetaProperty pSortProperty)
          Method checks the passed in form handler grouping property against the doc level property.
 void doStartService()
          This is called after a Service has been created, placed into the naming hierarchy, and initialized with its configured property values.
 java.lang.String formatDisplayName(MetaProperty pProp, java.util.Locale pLocale)
          Creates a localized display name based on the property hierarchy.
 java.lang.String getDisplayNameSeparator()
          Gets the string separator between property descriptor display names.
 DynamicPropertyDescriptor getDocLevelDescriptor()
           
 RepositoryItemDescriptor getIndexedItemDescriptor()
          Utility method to get the repository item desciptor of the indexed doc level item.
 Repository getIndexedRepository()
          Utility method to return the repository that was indexed.
 IndexingOutputConfig getIndexingOutputConfig()
          Gets the indexing output configuration component.
protected  RepositoryItemDescriptor getItemDescriptor(java.lang.String subTypeName, RepositoryItemDescriptor pParentItemDescriptor)
          Gets the item descriptor for the given type name and parent item descriptor Checks to see if the item belongs to a subtype of the given parent item descriptor.
 java.lang.String getMetaIndexPropertyName()
           
 atg.repository.search.indexing.specifier.OutputItemSpecifier getOutputItemSpecifier()
          Gets the output item specifier.
 java.util.Set<MetaProperty> getProperties(java.util.Set<java.lang.String> pAcceptableTypes)
          Gets the set of meta properties that are available in the search index output.
protected  DynamicPropertyDescriptor getPropertyDescriptor(atg.repository.search.indexing.specifier.OutputProperty pOutputProperty, RepositoryItemDescriptor pParentItemDescriptor)
          Gets the property descriptor for the given output property and parent item descriptor Checks to see if the property belongs to a subtype of the given parent item descriptor.
 RepositoryItemDescriptor getPropertyItemDescriptor(MetaProperty pProp)
          Utility method to get the item descriptor for a given MetaProperty.
 java.lang.String getRepositoryIdResource()
          Gets the string resource name for the repositoryId property name.
 java.lang.String getResourceBundleName()
          Gets the ResourceBundleName to lookup resource strings.
 java.util.Set<MetaProperty> getTextProperties(java.util.Set<java.lang.String> pAcceptableTypes)
          Gets the set of text properties that are available in the search index output.
 RepositoryItemDescriptor getTopLevelDescriptor()
           
 void setDisplayNameSeparator(java.lang.String pDisplayNameSeparator)
           
 void setIndexingOutputConfig(IndexingOutputConfig pIndexingOutputConfig)
          Sets the indexing output configuration component.
 void setRepositoryIdResource(java.lang.String pRepositoryIdResource)
           
 void setResourceBundleName(java.lang.String pResourceBundleName)
           
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, 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

Constructor Detail

IndexingPropertyProvider

public IndexingPropertyProvider()
Method Detail

getTopLevelDescriptor

public RepositoryItemDescriptor getTopLevelDescriptor()

getDocLevelDescriptor

public DynamicPropertyDescriptor getDocLevelDescriptor()

getMetaIndexPropertyName

public java.lang.String getMetaIndexPropertyName()

getIndexingOutputConfig

public IndexingOutputConfig getIndexingOutputConfig()
Gets the indexing output configuration component.


setIndexingOutputConfig

public void setIndexingOutputConfig(IndexingOutputConfig pIndexingOutputConfig)
Sets the indexing output configuration component.


getDisplayNameSeparator

public java.lang.String getDisplayNameSeparator()
Gets the string separator between property descriptor display names.


setDisplayNameSeparator

public void setDisplayNameSeparator(java.lang.String pDisplayNameSeparator)

getResourceBundleName

public java.lang.String getResourceBundleName()
Gets the ResourceBundleName to lookup resource strings.


setResourceBundleName

public void setResourceBundleName(java.lang.String pResourceBundleName)

getRepositoryIdResource

public java.lang.String getRepositoryIdResource()
Gets the string resource name for the repositoryId property name.


setRepositoryIdResource

public void setRepositoryIdResource(java.lang.String pRepositoryIdResource)

getOutputItemSpecifier

public atg.repository.search.indexing.specifier.OutputItemSpecifier getOutputItemSpecifier()
Gets the output item specifier.


formatDisplayName

public java.lang.String formatDisplayName(MetaProperty pProp,
                                          java.util.Locale pLocale)
Creates a localized display name based on the property hierarchy. e.g. ancestorCategories.displayName involves two properties "ancestorCategories" and "displayName". They will be combined and resources looked up to form a string like "Ancestor Categories -> Name"

Specified by:
formatDisplayName in interface MetaPropertyFormatter
Parameters:
pProp - MetaProperty to format display name.
pLocale - Optional java locale to localize with
Returns:
String display name showing entire hierarchy for the given MetaProperty.

areSubitemsValid

public boolean areSubitemsValid(MetaProperty pSortProperty)
Method checks the passed in form handler grouping property against the doc level property. If they match then subitems are not valid in the search results. i.e. no grouping. This method is used in the UI to know whether subitems can be displayed.

Parameters:
pSortProperty - MetaProperty object corresponding to the sortProperty from the search form handler.
Returns:
true if subitems are valid.

getIndexedRepository

public Repository getIndexedRepository()
Utility method to return the repository that was indexed.

Returns:
Repository that was indexed

getIndexedItemDescriptor

public RepositoryItemDescriptor getIndexedItemDescriptor()
Utility method to get the repository item desciptor of the indexed doc level item.

Returns:
RepositoryItemDescriptor of the indexed item type.

getPropertyItemDescriptor

public RepositoryItemDescriptor getPropertyItemDescriptor(MetaProperty pProp)
Utility method to get the item descriptor for a given MetaProperty. If the property is not type of repository item descriptor it will return null.

Parameters:
pProp - MetaProperty to check.
Returns:
RepositoryItemDescriptor for the property or null if it doesn't apply.

getProperties

public java.util.Set<MetaProperty> getProperties(java.util.Set<java.lang.String> pAcceptableTypes)
Gets the set of meta properties that are available in the search index output. Only properties with a data type in the acceptable types set passed in should be included in the returned Set.

Specified by:
getProperties in interface MetaPropertyProvider
Parameters:
pAcceptableTypes - Set of valid String property data types.
Returns:
Set of MetaProperty properties

getTextProperties

public java.util.Set<MetaProperty> getTextProperties(java.util.Set<java.lang.String> pAcceptableTypes)
Gets the set of text properties that are available in the search index output. Only properties with a data type in the acceptable types set passed in should be included in the returned Set.

Parameters:
pAcceptableTypes - Set of valid String property data types.
Returns:
Set of MetaProperty text properties

acceptType

protected boolean acceptType(java.lang.String pType)
Takes a parameter of type String and checks it against the set of acceptable types passed into the getProperties() method.

Parameters:
pType - PropertyTypeEnum type
Returns:
true if this type is acceptable.

addPropertiesFromSpecifier

protected void addPropertiesFromSpecifier(java.util.Set<MetaProperty> pProperties,
                                          atg.repository.search.indexing.specifier.OutputItemSpecifier pSpecifier,
                                          DynamicPropertyDescriptor[] pParents,
                                          boolean pUseTextProperties)
Add the properties from the output item specifier to the set.


getItemDescriptor

protected RepositoryItemDescriptor getItemDescriptor(java.lang.String subTypeName,
                                                     RepositoryItemDescriptor pParentItemDescriptor)
                                              throws RepositoryException
Gets the item descriptor for the given type name and parent item descriptor Checks to see if the item belongs to a subtype of the given parent item descriptor.

Parameters:
subTypeName - The type name whose descriptor is to be retrieved
pParentItemDescriptor - The parent item descriptor
Returns:
The RepositoryItemDescriptor instance for the type, or null.
Throws:
RepositoryException

getPropertyDescriptor

protected DynamicPropertyDescriptor getPropertyDescriptor(atg.repository.search.indexing.specifier.OutputProperty pOutputProperty,
                                                          RepositoryItemDescriptor pParentItemDescriptor)
Gets the property descriptor for the given output property and parent item descriptor Checks to see if the property belongs to a subtype of the given parent item descriptor. If so, the property descriptor is retrieved from the item descriptor for the subtype. Otherwise, if the property isn't set, the property descriptor is retrieved from the parent item descriptor.

Parameters:
pOutputProperty - The property whose property descriptor is to be retrieved
pParentItemDescriptor - The parent item descriptor
Returns:
The DynamicPropertyDescriptor instance for the property, or null.

doStartService

public void doStartService()
                    throws ServiceException
Description copied from class: GenericService
This is called after a Service has been created, placed into the naming hierarchy, and initialized with its configured property values. The Service should override this method to start any processes it requires.

Overrides:
doStartService in class GenericService
Throws:
ServiceException
See Also:
Calls getProperties on start-up to set needed member variables like the docLevelDescriptor.