public class ItemLookupDroplet extends DynamoServlet
output is rendered.  If the
 item is not found empty is rendered. If property filterBySite is true
 or filterBySite param is true, found item will be filtered by the item's "sites" property.
 If the item is not accessible in the current site, wrongSite is rendered. 
 
 
 
 The repository and item descriptor
 type can be configured through properties. If the useParams
 property is true, then the repository and item descriptor can be resolved
 through input parameters.
 One can configure this droplet to define a mapping from a key to an alternate set of
 repositories.  
 For example: ProductLookup.properties
 
 $class=atg.repository.servlet.ItemLookupDroplet
 
 repository=/atg/commerce/catalog/ProductCatalog
 itemDescriptor=product
 
 alternateRepositories=\
      fr_FR=/atg/commerce/catalog/FrenchProductCatalog
      ja_JP=/atg/commerce/catalog/JapaneseProductCatalog
      de_DE=/atg/commerce/catalog/GermanProductCatalog
 
 The invocation of the droplet can then be invoked with the following parameters:
 
  <dsp:droplet name="/atg/commerce/catalog/ProductLookup">
    <dsp:param name="id" param="productId"/>
    <dsp:param  name="repositoryKey" bean="/OriginatingRequest.requestLocale.localeString"/>
    <dsp:setvalue param="product" paramvalue="element"/>
    <dsp:oparam name="output">
       <dsp:getvalueof id="a11" param="product.template.url" idtype="java.lang.String">
         <dsp:a href="<%=a11%>">
            <dsp:param name="prod_id" param="product.repositoryId"/>
            <dsp:valueof param="product.displayName"/>
         </dsp:a>
       </dsp:getvalueof>
    </dsp:oparam>
  </dsp:droplet>
 
 If the mapping for the provided key is found that repository will be used, otherwise the system 
 will fall back to the default repository and search for the item.
 If the item cannot be found in the repository searched (e.g. the french product catalog), then the droplet will once again fall back to the default repository and attempt to find the item using the same id. Obviously this is only useful if the items have the exact same id in each repository.
In this example if you are french and attempt to look at product 1234, and product 1234 is defined in the french product catalog you will see that item. However if 1234 is not defined then you will see the default english version of 1234.
 This behavior can be modified with use of the useDefaultRepository and 
 getDefaultItem properties. If useDefaultRepository is false
 and an alternate repository cannot be found, then no repository is searched and empty
 is serviced. Like wise, if an alternative repository is selected, but the item cannot be
 found, and if getDefaultItem is false, then the default repository will not be searched
 and empty will be serviced.
 
 The required input paramters for this servlet are:
 
The following parameters are rendered:
The output parameters for this servlet are:
| Modifier and Type | Field and Description | 
|---|---|
static java.lang.String | 
CLASS_VERSION
Class version string 
 | 
static java.lang.String | 
ELEMENT  | 
static java.lang.String | 
ELEMENT_NAME_STR  | 
static java.lang.String | 
EMPTY_OPARAM  | 
static java.lang.String | 
ERROR  | 
static java.lang.String | 
FILTER_BY_SITE  | 
protected static ParameterName | 
FILTER_BY_SITE_PARAM  | 
static java.lang.String | 
ID  | 
static java.lang.String | 
ITEM_DESC  | 
static java.lang.String | 
OUTPUT_OPARAM  | 
static java.lang.String | 
REPOSITORY  | 
static java.lang.String | 
REPOSITORY_KEY  | 
protected static ParameterName | 
SITE_IDS_PARAM  | 
static java.lang.String | 
SITEIDS  | 
static java.lang.String | 
SITES  | 
protected static ParameterName | 
SITES_PARAM  | 
static java.lang.String | 
WRONG_SITE_OPARAM  | 
mAllowCleanupRequest, mParametersSERVLET_INFO_KEYSERVICE_INFO_KEYDEFAULT_LOG_TRACE_STATUSDEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS| Constructor and Description | 
|---|
ItemLookupDroplet()  | 
| Modifier and Type | Method and Description | 
|---|---|
protected void | 
commitTransaction(javax.transaction.Transaction pTransaction)
Commits the supplied transaction 
 | 
protected javax.transaction.Transaction | 
ensureTransaction()
This method ensures that a transaction exists before returning. 
 | 
ServiceMap | 
getAlternateRepositories()
Returns property AlternateRepositories 
 | 
java.lang.String | 
getItemDescriptor()
Returns property ItemDescriptor 
 | 
Repository | 
getRepository()
Returns property Repository 
 | 
protected java.util.Collection<java.lang.String> | 
getSiteIds(DynamoHttpServletRequest pRequest)
If we have collection of site ids in request parameter,
 then returns them, otherwise returns  
null. | 
protected java.util.Collection<Site> | 
getSites(DynamoHttpServletRequest pRequest)
If we have collection of sites in request parameter, 
 then returns them, otherwise returns  
null. | 
java.lang.String | 
getSitesPropertyName()
Returns property SitesPropertyName 
 | 
javax.transaction.TransactionManager | 
getTransactionManager()
Returns property TransactionManager. 
 | 
boolean | 
isEnsureTransaction()
Returns property EnsureTransaction 
 | 
boolean | 
isFilterBySite()
Returns property FilterBySite 
 | 
boolean | 
isFilterBySite(DynamoHttpServletRequest pRequest)
Determines if we are filtering by sites. 
 | 
boolean | 
isGetDefaultItem()
Returns property GetDefaultItem 
 | 
protected boolean | 
isItemInSites(java.util.Collection<Site> pSites,
             java.util.Collection<java.lang.String> pItemSites,
             java.util.Collection<java.lang.String> pItemSiteIdsResolved)
Determines if an item belongs to any of the given set of sites or the current site. 
 | 
boolean | 
isItemInSites(RepositoryItem pItem,
             java.util.Collection<Site> pSites)
Determines if a given item is a part of any sites from the given set or the
 current site. 
 | 
boolean | 
isItemInSites(RepositoryItem pItem,
             java.util.Collection<Site> pSites,
             java.util.Collection<java.lang.String> pSiteIds)
Determines if a given item is a part of the given sets or the current site. 
 | 
boolean | 
isUseDefaultRepository()
Returns property UseDefaultRepository 
 | 
boolean | 
isUseParams()
Returns property UseParams 
 | 
protected java.util.Collection<java.lang.String> | 
retrieveItemSites(RepositoryItem pItem)
Calculates given item site ids, looking in the item's sitesPropertyName property
 If the item's site property doesn't exists then check the item descriptor's
 context membership, e.g. 
 | 
void | 
service(DynamoHttpServletRequest pRequest,
       DynamoHttpServletResponse pResponse)
Look for the RepositoryItem and if found render the output oparam by
 binding the item as a parameter. 
 | 
void | 
setAlternateRepositories(ServiceMap pAlternateRepositories)
Sets property AlternateRepositories 
 | 
void | 
setEnsureTransaction(boolean pEnsureTransaction)
Sets property EnsureTransaction 
 | 
void | 
setFilterBySite(boolean pFilterBySite)
Sets property FilterBySite 
 | 
void | 
setGetDefaultItem(boolean pGetDefaultItem)
Sets property GetDefaultItem 
 | 
void | 
setItemDescriptor(java.lang.String pItemDescriptor)
Sets property ItemDescriptor 
 | 
void | 
setRepository(Repository pRepository)
Sets property Repository 
 | 
void | 
setSitesPropertyName(java.lang.String pSitesPropertyName)
Sets property SitesPropertyName 
 | 
void | 
setTransactionManager(javax.transaction.TransactionManager pTransactionManager)
Sets property TransactionManager 
 | 
void | 
setUseDefaultRepository(boolean pUseDefaultRepository)
Sets property UseDefaultRepository 
 | 
void | 
setUseParams(boolean pUseParams)
Sets property UseParams 
 | 
doDelete, doGet, doPost, doPut, getParameter, getParameters, getServletContext, init, service, service, setParameterdestroy, getServletConfig, getServletInfo, setServletInfogetAverageRequestHandlingTime, getHandledRequestCount, getRequestStartTime, getTotalRequestHandlingTime, isKeepingStatistics, notifyHandledRequest, resetStatistics, setKeepingStatisticsaddLogListener, 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, toStringvlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarningpublic static java.lang.String CLASS_VERSION
public static final java.lang.String ELEMENT_NAME_STR
public static final java.lang.String REPOSITORY
public static final java.lang.String ID
public static final java.lang.String REPOSITORY_KEY
public static final java.lang.String ITEM_DESC
public static final java.lang.String SITES
public static final java.lang.String FILTER_BY_SITE
public static final java.lang.String SITEIDS
protected static final ParameterName SITES_PARAM
protected static final ParameterName FILTER_BY_SITE_PARAM
protected static final ParameterName SITE_IDS_PARAM
public static final java.lang.String ELEMENT
public static final java.lang.String ERROR
public static final java.lang.String OUTPUT_OPARAM
public static final java.lang.String EMPTY_OPARAM
public static final java.lang.String WRONG_SITE_OPARAM
public void setRepository(Repository pRepository)
public Repository getRepository()
public void setItemDescriptor(java.lang.String pItemDescriptor)
public java.lang.String getItemDescriptor()
public void setAlternateRepositories(ServiceMap pAlternateRepositories)
public ServiceMap getAlternateRepositories()
public void setTransactionManager(javax.transaction.TransactionManager pTransactionManager)
public javax.transaction.TransactionManager getTransactionManager()
public void setEnsureTransaction(boolean pEnsureTransaction)
public boolean isEnsureTransaction()
public void setUseParams(boolean pUseParams)
public boolean isUseParams()
public void setUseDefaultRepository(boolean pUseDefaultRepository)
public boolean isUseDefaultRepository()
public void setGetDefaultItem(boolean pGetDefaultItem)
public boolean isGetDefaultItem()
public void setFilterBySite(boolean pFilterBySite)
public boolean isFilterBySite()
public void setSitesPropertyName(java.lang.String pSitesPropertyName)
public java.lang.String getSitesPropertyName()
protected javax.transaction.Transaction ensureTransaction()
protected void commitTransaction(javax.transaction.Transaction pTransaction)
public void service(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse) throws javax.servlet.ServletException, java.io.IOException
service in class DynamoServletpRequest - the request to be processedpResponse - the response object for this requestjavax.servlet.ServletException - an application specific error occurred
 processing this requestjava.io.IOException - an error occurred reading data from the request
 or writing data to the response.public boolean isItemInSites(RepositoryItem pItem, java.util.Collection<Site> pSites)
true.  If sites are
 not set, check against current site if current site context is not set,
 return true.  If the item has no sites return false.pItem - repository itempSites - set of sitesprotected boolean isItemInSites(java.util.Collection<Site> pSites, java.util.Collection<java.lang.String> pItemSites, java.util.Collection<java.lang.String> pItemSiteIdsResolved)
pSites - set of sites the item must belong to (can reference sites/site groups),
               if null check the current sitepItemSites - set of site ids, or site group ids e.g. sg:us, the item belongs to,pItemSiteIdsResolved - full set of site ids the item belongs topublic boolean isItemInSites(RepositoryItem pItem, java.util.Collection<Site> pSites, java.util.Collection<java.lang.String> pSiteIds)
true.
 If the sitesPropertyName is defined but the item has no site property to check
 or if the sitesPropertyName is not defined but site context membership is not enabled,
 return true.
 If the item has no sites return false.pItem - repository itempSites - set of site objectspSiteIds - set of site idsprotected java.util.Collection<java.lang.String> retrieveItemSites(RepositoryItem pItem)
pItem - given repository itemprotected java.util.Collection<Site> getSites(DynamoHttpServletRequest pRequest)
null.pRequest - Dynamo http requestnullprotected java.util.Collection<java.lang.String> getSiteIds(DynamoHttpServletRequest pRequest)
null.pRequest - Dynamo http requestnullpublic boolean isFilterBySite(DynamoHttpServletRequest pRequest)
pRequest - Dynamo http request