public class ItemLookupDroplet extends DynamoServlet
output is rendered. If the
item is not found empty 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.
$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
|
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
|
javax.transaction.TransactionManager |
getTransactionManager()
Returns property TransactionManager.
|
boolean |
isEnsureTransaction()
Returns property EnsureTransaction
|
boolean |
isGetDefaultItem()
Returns property GetDefaultItem
|
boolean |
isUseDefaultRepository()
Returns property UseDefaultRepository
|
boolean |
isUseParams()
Returns property UseParams
|
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 |
setGetDefaultItem(boolean pGetDefaultItem)
Sets property GetDefaultItem
|
void |
setItemDescriptor(java.lang.String pItemDescriptor)
Sets property ItemDescriptor
|
void |
setRepository(Repository pRepository)
Sets property Repository
|
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, stopServicevlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarningpublic 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()
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.