atg.projects.store.droplet
Class RqlDroplet

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.nucleus.TimedOperationService
              extended by atg.nucleus.servlet.ServletService
                  extended by atg.nucleus.servlet.HttpServletService
                      extended by atg.servlet.DynamoServlet
                          extended by atg.projects.store.droplet.RqlDroplet
All Implemented Interfaces:
atg.naming.NameContextBindingListener, atg.naming.NameContextElement, atg.naming.NameResolver, atg.nucleus.AdminableService, atg.nucleus.logging.ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, atg.nucleus.logging.VariableArgumentApplicationLogging, atg.nucleus.naming.ComponentNameResolver, atg.nucleus.Service, atg.nucleus.ServiceListener, atg.servlet.ParameterServlet, java.util.EventListener, javax.servlet.Servlet

public class RqlDroplet
extends atg.servlet.DynamoServlet

This droplet is used in favor of the ATG RQLQueryForEach droplet. There are two reasons for this. The first is that this droplet must be configured from outside the JSP to prevent the setting of an RQL query string in the JSP template. The second is that this droplet returns the result set (array of repository items) which allows other droplets to loop through them appropriately (Range for example). It also wraps the results in a transaction, something RQLQueryForEach does not do.

The repository, itemDescriptorName, and queryRql properties must be set on the nucleus component that uses this class. For example:


  $class=com.awedirect.base.droplet.RqlDroplet
  transactionManager=/atg/dynamo/transaction/TransactionManager
  repository=/atg/commerce/catalog/ProductCatalog
  itemDescriptorName=promotionRelationship
  queryRql=contractType.code = ?0

 

this droplet takes the following parameters

numRQLParams
The parameter that defines the URL, relative or absolute, to which this page that called the servlet will be redirected.
param#
The parameter.
rqlQuery
The parameter that defines a rqlQuery

Example



  <dsp:droplet name="RqlDroplet">
    <param name="numRQLParams" value="1">
    <param name="param0" value="atg.com">
    <dsp:oparam name="output">
      <dsp:droplet name="ForEach">
        <dsp:param name="array" param="items"/>
        <dsp:oparam name="output">
          <dsp:getvalueof id="url" idtype="java.lang.string" param="element.url">
          <dsp:a page="<=url>">
            <dsp:valueof param="element.name"/>
          </dsp:a><br>
          </dsp:getvalueof>
        </dsp:oparam>
      </dsp:droplet>
    </dsp:oparam>
  </dsp:droplet>


 

Parameters:
   empty- Rendered if no results found.
   output- Rendered on successful query.
     items- Array of RepositoryItem object that match the query.


Field Summary
static java.lang.String CLASS_VERSION
          Class version string.
static atg.nucleus.naming.ParameterName EMPTY
          Empty parameter name.
static java.lang.String ITEMS
          Items name.
static atg.nucleus.naming.ParameterName NUMBER_OF_RQL_PARAMS
          Number of RQL parameters parameter name.
static atg.nucleus.naming.ParameterName OUTPUT
          Output parameter name.
static java.lang.String PARAM_PREFIX
          Parameter prefix.
static atg.nucleus.naming.ParameterName QUERY_RQL
          Query RQL parameter name.
static java.lang.String XA_FAILURE
          XA failure message.
 
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
RqlDroplet()
           
 
Method Summary
 java.lang.String getItemDescriptorName()
           
protected  java.lang.Object[] getQueryParameters(atg.servlet.DynamoHttpServletRequest pRequest, atg.servlet.DynamoHttpServletResponse pResponse)
          Get query parameters.
 java.lang.String getQueryRql()
           
 atg.repository.Repository getRepository()
           
 java.util.List getRqlParameters()
           
 java.util.Map getStatementMap()
           
 javax.transaction.TransactionManager getTransactionManager()
           
 boolean isResultAsCollection()
           
protected  atg.repository.RepositoryItem[] performQuery(atg.repository.Repository pRepository, java.lang.String pViewName, atg.repository.rql.RqlStatement pStatement, java.lang.Object[] pParams)
           Performs the query against the view of the particular repository.
 void service(atg.servlet.DynamoHttpServletRequest pRequest, atg.servlet.DynamoHttpServletResponse pResponse)
          Service method.
 void setItemDescriptorName(java.lang.String pItemDescriptorName)
           
 void setQueryRql(java.lang.String pQueryRql)
           
 void setRepository(atg.repository.Repository pRepository)
           
 void setResultAsCollection(boolean pResultAsCollection)
           
 void setRqlParameters(java.util.List pRqlParameters)
           
 void setTransactionManager(javax.transaction.TransactionManager pTransactionManager)
           
 
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.GenericService
addLogListener, createAdminServlet, doStartService, 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.


XA_FAILURE

public static final java.lang.String XA_FAILURE
XA failure message.

See Also:
Constant Field Values

OUTPUT

public static final atg.nucleus.naming.ParameterName OUTPUT
Output parameter name.


EMPTY

public static final atg.nucleus.naming.ParameterName EMPTY
Empty parameter name.


QUERY_RQL

public static final atg.nucleus.naming.ParameterName QUERY_RQL
Query RQL parameter name.


NUMBER_OF_RQL_PARAMS

public static final atg.nucleus.naming.ParameterName NUMBER_OF_RQL_PARAMS
Number of RQL parameters parameter name.


PARAM_PREFIX

public static final java.lang.String PARAM_PREFIX
Parameter prefix.

See Also:
Constant Field Values

ITEMS

public static final java.lang.String ITEMS
Items name.

See Also:
Constant Field Values
Constructor Detail

RqlDroplet

public RqlDroplet()
Method Detail

getRepository

public atg.repository.Repository getRepository()
Returns:
Repository.

setRepository

public void setRepository(atg.repository.Repository pRepository)
Parameters:
pRepository - - repository.

getItemDescriptorName

public java.lang.String getItemDescriptorName()
Returns:
item descriptor name.

setItemDescriptorName

public void setItemDescriptorName(java.lang.String pItemDescriptorName)
Parameters:
pItemDescriptorName - - item descriptor name.

getQueryRql

public java.lang.String getQueryRql()
Returns:
RQL query text.

setQueryRql

public void setQueryRql(java.lang.String pQueryRql)
Parameters:
pQueryRql - - RQL query text.

getRqlParameters

public java.util.List getRqlParameters()
Returns:
list of RQL query parameters.

setRqlParameters

public void setRqlParameters(java.util.List pRqlParameters)
Parameters:
pRqlParameters - - list of RQL query parameters.

getTransactionManager

public javax.transaction.TransactionManager getTransactionManager()
Returns:
transaction manager.

setTransactionManager

public void setTransactionManager(javax.transaction.TransactionManager pTransactionManager)
Parameters:
pTransactionManager - - transaction manager.

getStatementMap

public java.util.Map getStatementMap()
Returns:
statement map.

isResultAsCollection

public boolean isResultAsCollection()
Returns:
boolean that specifies whether result should be returned as collection or as array.

setResultAsCollection

public void setResultAsCollection(boolean pResultAsCollection)
Parameters:
pQueryRql - - boolean that specifies whether result should be returned as collection or as array.

service

public void service(atg.servlet.DynamoHttpServletRequest pRequest,
                    atg.servlet.DynamoHttpServletResponse pResponse)
             throws javax.servlet.ServletException,
                    java.io.IOException
Service method.

Overrides:
service in class atg.servlet.DynamoServlet
Parameters:
pRequest - DynamoHttpServletRequest
pResponse - DynamoHttpServletResponse
Throws:
javax.servlet.ServletException - if an error occurs
java.io.IOException - if an error occurs

getQueryParameters

protected java.lang.Object[] getQueryParameters(atg.servlet.DynamoHttpServletRequest pRequest,
                                                atg.servlet.DynamoHttpServletResponse pResponse)
                                         throws javax.servlet.ServletException,
                                                java.io.IOException
Get query parameters.

Parameters:
pRequest - - http request
pResponse - - http response
Returns:
array of query parameters
Throws:
javax.servlet.ServletException - if error occurs
java.io.IOException - if an error occurs

performQuery

protected atg.repository.RepositoryItem[] performQuery(atg.repository.Repository pRepository,
                                                       java.lang.String pViewName,
                                                       atg.repository.rql.RqlStatement pStatement,
                                                       java.lang.Object[] pParams)
                                                throws atg.repository.RepositoryException

Performs the query against the view of the particular repository.

Parameters:
pRepository - - repository
pViewName - - view name
pStatement - - statement
pParams - - parameters
Returns:
selected data array
Throws:
atg.repository.RepositoryException - if an error occurs