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.AbsoluteNameable, atg.naming.NameContextBindingListener, atg.naming.NameContextElement, atg.naming.NameContextParentable, atg.naming.NameResolver, atg.nucleus.AdminableService, atg.nucleus.Configured, 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.

Version:
$Revision: #3 $
Author:
ATG

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 OUTPUT
          Output parameter name.
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()
           
 java.lang.String getQueryRql()
           
 atg.repository.Repository getRepository()
           
 java.util.Map<java.lang.String,atg.repository.rql.RqlStatement> getStatementMap()
           
 javax.transaction.TransactionManager getTransactionManager()
           
protected  atg.repository.RepositoryItem[] performQuery(atg.repository.Repository pRepository, java.lang.String pViewName, atg.repository.rql.RqlStatement pStatement)
           Performs the query against the view of the particular repository.
 void service(atg.servlet.DynamoHttpServletRequest pRequest, atg.servlet.DynamoHttpServletResponse pResponse)
          Executes the RQL query and returns the results in the "items" output parameter inside the "output" open parameter.
 void setItemDescriptorName(java.lang.String pItemDescriptorName)
           
 void setQueryRql(java.lang.String pQueryRql)
           
 void setRepository(atg.repository.Repository pRepository)
           
 void setTransactionManager(javax.transaction.TransactionManager pTransactionManager)
           
 
Methods inherited from class atg.servlet.DynamoServlet
doDelete, doGet, doPost, doPut, getParameter, getParameters, getServletContext, init, service, service, setParameter
 
Methods inherited from class atg.nucleus.servlet.ServletService
destroy, getServletConfig, getServletInfo, 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, 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 final java.lang.String CLASS_VERSION
Class version string.

See Also:
Constant Field Values

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.


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:
The repository used to execute the query against.

setRepository

public void setRepository(atg.repository.Repository pRepository)
Parameters:
pRepository - Set a new 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:
The RQL query that will be executed.

setQueryRql

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

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<java.lang.String,atg.repository.rql.RqlStatement> getStatementMap()
Returns:
A cache of RQL querys to their equivalent statement objects.

service

public void service(atg.servlet.DynamoHttpServletRequest pRequest,
                    atg.servlet.DynamoHttpServletResponse pResponse)
             throws javax.servlet.ServletException,
                    java.io.IOException
Executes the RQL query and returns the results in the "items" output parameter inside the "output" open parameter.

Overrides:
service in class atg.servlet.DynamoServlet
Throws:
javax.servlet.ServletException
java.io.IOException

performQuery

protected atg.repository.RepositoryItem[] performQuery(atg.repository.Repository pRepository,
                                                       java.lang.String pViewName,
                                                       atg.repository.rql.RqlStatement pStatement)
                                                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