|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object atg.nucleus.logging.VariableArgumentApplicationLoggingImpl atg.nucleus.GenericService atg.nucleus.TimedOperationService atg.nucleus.servlet.ServletService atg.nucleus.servlet.HttpServletService atg.servlet.DynamoServlet atg.repository.search.refinement.RefinementValueDroplet
public class RefinementValueDroplet
A Droplet that parses refinement values into human-readable strings.
The droplet has 2 input parameters: "refinementId" - The repository item id of the refineElement (facet) in the refinement repository. "refinementValue" - A String value for the facet as returned by the search response (i.e. in the format it is stored in the search index).
The output of the droplet is the refinementValue converted into a more human readable form (if needed).
So for example, date values like the creationDate are stored in the index in a strange format, basically it is the timestamp as a long divided by 1000. When we get this back in a search response we don't want to show it in this format in the UI so we use this droplet to convert it into a nicer locale string date format.
The first thing the droplet does is to get the refineElement item from the repository and then lookup the MetaPropertiesHelper to get the MetaProperty object for that refinement property. The droplet then converts the value using a MetaPropertyValueFormatter component. It first checks the MetaPropertyValueFormatterRegistry to see if there is a MetaPropertyValueFormatter registered for this refinement property name. If there isn't then it just uses the DefaultMetaPropertyValueFormatter.
MetaPropertyValueFormatter is an interface with this method: public String formatDisplayValue(MetaProperty pProperty, Locale pLocale, String pValue);
OOTB we provide 1 implementation of this interface - DefaultMetaPropertyValueFormatter which should handle most property types. This class will handle properties in this way:
Since the droplet uses the MetaPropertyValueFormatterRegistry then it is possible for a customer to configure a property to have its own MetaPropertyValueFormatter to return customized strings. E.g. you could register the "price" property with your own MetaPropertyValueFormatter that for instance might return prices prefixed with $ symbols. i.e. instead of showing on the UI: 100-200 it would show $100-$200
Also for range values the droplet splits the range into start and end values and formats each separately before recombining again. So in the example above it would call the formatter for 100 and then for 200 and then concatenate the returned values with a -.
The droplet doesn't take a locale parameter so the locale used in the default formatter is ServletUtils.getUserLocale() or failing that it will use the atg.service.dynamo.LangLicense.getLicensedDefault() locale.
Field Summary | |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string |
static java.lang.String |
DISPLAY_VALUE
|
static java.lang.String |
RANGES_SEPARATOR
|
static ParameterName |
S_ERROR
|
static java.lang.String |
S_LOCALE
|
static ParameterName |
S_OUTPUT
|
static java.lang.String |
S_REFINEMENT
|
static java.lang.String |
S_REFINEMENT_VALUE
|
Fields inherited from class atg.servlet.DynamoServlet |
---|
mAllowCleanupRequest, mParameters |
Fields inherited from class atg.nucleus.servlet.ServletService |
---|
SERVLET_INFO_KEY |
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 | |
---|---|
RefinementValueDroplet()
|
Method Summary | |
---|---|
MetaPropertyValueFormatter |
getDefaultValueFormatter()
Return default MetaPropertyValueFormatter |
FacetManager |
getFacetManager()
Returns FacetManager |
MetaPropertiesHelper |
getMetaPropertiesHelper()
Return MetaPropertisHelper |
java.lang.String |
getRangeDelimiter()
|
MetaPropertyValueFormatterRegistry |
getValueFormatterRegistry()
Return registry of value foramtters |
void |
service(DynamoHttpServletRequest req,
DynamoHttpServletResponse res)
Generates a human readable string from refinement value. |
void |
setDefaultValueFormatter(MetaPropertyValueFormatter pDefaultValueFormatter)
Sets default value formatter |
void |
setFacetManager(FacetManager pFacetManager)
Se FacetManager |
void |
setMetaPropertiesHelper(MetaPropertiesHelper pMetaPropertiesHelper)
Sets MetaPropertiesHelper |
void |
setRangeDelimiter(java.lang.String pRangeDelimiter)
|
void |
setValueFormatterRegistry(MetaPropertyValueFormatterRegistry pValueFormatterRegistry)
Set registry of formatters |
Methods inherited from class atg.servlet.DynamoServlet |
---|
doDelete, doGet, doPost, doPut, getParameter, getParameters, getServletContext, service, service, setParameter |
Methods inherited from class atg.nucleus.servlet.ServletService |
---|
destroy, getServletConfig, getServletInfo, init, setServletInfo |
Methods inherited from class atg.nucleus.TimedOperationService |
---|
getAverageRequestHandlingTime, getHandledRequestCount, getRequestStartTime, getTotalRequestHandlingTime, isKeepingStatistics, notifyHandledRequest, resetStatistics, setKeepingStatistics |
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 |
---|
public static java.lang.String CLASS_VERSION
public static final ParameterName S_OUTPUT
public static final ParameterName S_ERROR
public static final java.lang.String S_REFINEMENT
public static final java.lang.String S_REFINEMENT_VALUE
public static final java.lang.String S_LOCALE
public static final java.lang.String DISPLAY_VALUE
public static final java.lang.String RANGES_SEPARATOR
Constructor Detail |
---|
public RefinementValueDroplet()
Method Detail |
---|
public MetaPropertyValueFormatter getDefaultValueFormatter()
public void setDefaultValueFormatter(MetaPropertyValueFormatter pDefaultValueFormatter)
pDefaultValueFormatter
- default MetaPropertyValueFormatterpublic MetaPropertyValueFormatterRegistry getValueFormatterRegistry()
public void setValueFormatterRegistry(MetaPropertyValueFormatterRegistry pValueFormatterRegistry)
pValueFormatterRegistry
- registry of formatterspublic FacetManager getFacetManager()
public void setFacetManager(FacetManager pFacetManager)
pFacetManager
- facet managerpublic MetaPropertiesHelper getMetaPropertiesHelper()
public void setMetaPropertiesHelper(MetaPropertiesHelper pMetaPropertiesHelper)
pMetaPropertiesHelper
- MetaPropertiesHelperpublic java.lang.String getRangeDelimiter()
public void setRangeDelimiter(java.lang.String pRangeDelimiter)
pRangeDelimeter
- range delimiterpublic void service(DynamoHttpServletRequest req, DynamoHttpServletResponse res) throws javax.servlet.ServletException, java.io.IOException
service
in class DynamoServlet
req
- dynamo http requestres
- dynamo http response
javax.servlet.ServletException
java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |