atg.repository.search
Class DefaultMetaPropertyValueFormatter

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.repository.search.DefaultMetaPropertyValueFormatter
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, MetaPropertyValueFormatter, java.util.EventListener

public class DefaultMetaPropertyValueFormatter
extends GenericService
implements MetaPropertyValueFormatter

Default implementation of MetaPropertyValueFormatter interface. Converts a search indexed value into a UI display string. For a given MetaProperty and optional Locale it will format the given value. Dates are stored in the search index as timestamps (/1000), this class will convert the timestamp string into a locale formatted date string. Enum values are converted into their display name equivalent, e.g. IN_STOCK is converted to 'In Stock'. Boolean values are looked up in the configured resource bundle, e.g. for the OnSale property the resource lookup might return strings 'On Sale' for true and 'Not On Sale' for false.


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
DefaultMetaPropertyValueFormatter()
           
 
Method Summary
 java.lang.String formatDisplayValue(MetaProperty pProperty, java.util.Locale pLocale, java.lang.String pValue)
          Converts a search indexed value into a UI display string.
protected  RepositoryItem getRepositoryItem(MetaProperty pMetaProperty, java.lang.String pId)
          Gets the repository item for the given id and meta property.
 java.lang.String getResourceBundle()
           
 java.util.ResourceBundle getResourceBundle(java.util.Locale pLocale)
          Returns resource bundle for this locale
 void setResourceBundle(java.lang.String pResourceBundle)
           
 
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

Constructor Detail

DefaultMetaPropertyValueFormatter

public DefaultMetaPropertyValueFormatter()
Method Detail

getResourceBundle

public java.lang.String getResourceBundle()

setResourceBundle

public void setResourceBundle(java.lang.String pResourceBundle)

getResourceBundle

public java.util.ResourceBundle getResourceBundle(java.util.Locale pLocale)
                                           throws java.util.MissingResourceException
Returns resource bundle for this locale

Parameters:
pLocale - locale
Returns:
resource bundle
Throws:
java.util.MissingResourceException - in case resource bundle not found

formatDisplayValue

public java.lang.String formatDisplayValue(MetaProperty pProperty,
                                           java.util.Locale pLocale,
                                           java.lang.String pValue)
Converts a search indexed value into a UI display string. For a given MetaProperty and optional Locale it will format the given value. Dates are stored in the search index as timestamps (/1000), this class will convert the timestamp string into a locale formatted date string. Enum values are converted into their display name equivalent, e.g. IN_STOCK is converted to 'In Stock'. Boolean values are looked up in the configured resource bundle, e.g. for the OnSale property the resource lookup might return strings 'On Sale' for true and 'Not On Sale' for false.

Specified by:
formatDisplayValue in interface MetaPropertyValueFormatter
Parameters:
pProperty - MetaProperty for the given value
pLocale - Optional locale to use for formatting, may be null
pValue - The value string to convert as returned in the search results
Returns:
String user readable value

getRepositoryItem

protected RepositoryItem getRepositoryItem(MetaProperty pMetaProperty,
                                           java.lang.String pId)
Gets the repository item for the given id and meta property.

Parameters:
pMetaProperty - MetaProperty
pId - String repository id
Returns:
RepositoryItem or null if it couldn't be retrieved