atg.droplet
Class Range

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.droplet.Range
All Implemented Interfaces:
NameContextBindingListener, NameContextElement, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, atg.nucleus.logging.VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, ParameterServlet, java.util.EventListener, javax.servlet.Servlet
Direct Known Subclasses:
RQLQueryRange, SQLQueryRange

public class Range
extends DynamoServlet

This servlet renders its output parameter for a subset of elements in its array parameter. In particular, howMany items starting at (1-based) index start are displayed. The array parameter can be general Collection (Vectors, Lists, Sets), Iterator, Enumeration, Map, Dictionary or an array.

Each iteration will set several parameters: index and count to the current loop index (0-based) and count (1-based), respectively; element to the value of that element of the array; hasPrev and hasNext to indicate whether there are array items before or after the current subset, respectively; plus several others to help render the previous or next range of elements.

A complete description of the parameters to the Range droplet are:

array
The parameter that defines the list of items to output. This parameter can be a general Collection (Vectors, Lists, Sets), Iterator, Enumeration, Map, Dictionary or an array.
elementName
The optional parameter that should be used for the name of the element which is bound into the scope of the output oparam.
indexName
The optional parameter that should be used for the name of the index value which is bound into the scope of the output oparam.
start
Specifies the starting index (1-based). For example, to start at the beginning of the array, set start to 1. If start points past the end of the array, the empty parameter will be rendered.
howMany
Specifies the number of items in the array set to display. If the combination of start and howMany point past the end of the array, rendering stops after the end of the array is reached.
outputStart
This parameter is rendered before any output tags if the subset of the array being displayed is not empty.
outputEnd
This parameter is rendered after all output tags if the subset of the array being displayed is not empty.
output
This parameter is rendered once for each element in the subset of the array that gets displayed.
empty
This optional parameter is rendered if the array itself, or the requested subset of the array, contains no elements.
index
This parameter is set to the (0-based) index of the current element of the array each time the output parameter is rendered. For example, if start is set to 1, the value of index for the first iteration is 0.
count
This parameter is set to the (1-based) count of the current element of the array each time the output parameter is rendered. For example, if start is set to 1, the value of count for the first iteration is 1.
element
This parameter is set to the current element of the array each time the output parameter is rendered.
key
This parameter is set once for each element in the array set if the array parameter refers to a Map or Dictionary.
end
This parameter is set before any of the output parameters are rendered. It indicates the (1-based) count of the last element in the current array set.
size
This parameter is set before any of the output parameters are rendered. It indicates the number of elements in the full array.
hasPrev
This parameter is set to true or false before any of the output parameters are rendered. It indicates whether there are any array items before the current array set.
prevStart
This parameter is set before any of the output parameters are rendered, and only if hasPrev is true. It indicates the value of start that should be used to display the previous array set.
prevEnd
This parameter is set before any of the output parameters are rendered, and only if hasPrev is true. It indicates the (1-based) count of the last element in the previous array set.
prevHowMany
This parameter is set before any of the output parameters are rendered, and only if hasPrev is true. It indicates the number of elements in the previous array set.
hasNext
This parameter is set to true or false before any of the output parameters are rendered. It indicates whether there are any array items after the current array set.
nextStart
This parameter is set before any of the output parameters are rendered, and only if hasNext is true. It indicates the value of start that should be used to display the next array set.
nextEnd
This parameter is set before any of the output parameters are rendered, and only if hasNext is true. It indicates the (1-based) count of the last element in the next array set.
nextHowMany
This parameter is set before any of the output parameters are rendered, and only if hasNext is true. It indicates the number of elements in the next array set.
reverseOrder
A boolean value that specifies whether the traversal order in the array should be back to front, or front to back. 'true' sorts from back to front. This parameter only takes effect if the sortProperties are not set.


Field Summary
static java.lang.String ARRAY
           
static java.lang.String CLASS_VERSION
          Class version string
static java.lang.String COUNT
           
static java.lang.String ELEMENT
           
static java.lang.String ELEMENT_NAME
           
static java.lang.String EMPTY
           
static java.lang.String END
           
static java.lang.String HAS_NEXT
           
static java.lang.String HAS_PREV
           
static java.lang.String HOW_MANY
           
static java.lang.String INDEX
           
static java.lang.String INDEX_NAME
           
static java.lang.String KEY
           
static java.lang.String NEXT_END
           
static java.lang.String NEXT_HOW_MANY
           
static java.lang.String NEXT_START
           
static java.lang.String OUTPUT
           
static java.lang.String OUTPUT_END
           
static java.lang.String OUTPUT_START
           
static java.lang.String PREV_END
           
static java.lang.String PREV_HOW_MANY
           
static java.lang.String PREV_START
           
static java.lang.String SIZE
           
static java.lang.String START
           
 
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
Range()
           
 
Method Summary
 java.lang.Object getArray(DynamoHttpServletRequest pRequest)
          Gets the array-like value (e.g., array, Vector, Enumeration) to be used by this droplet from the request.
 void service(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Called when a request needs to be processed.
protected  void serviceArray(java.lang.Object pArray, int pStart, int pHowMany, java.lang.String pIndexName, java.lang.String pElementName, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Renders the range operation for array objects
protected  void serviceCollection(java.util.Collection pCollection, int pStart, int pHowMany, java.lang.String pIndexName, java.lang.String pElementName, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Renders the range operation for Collection objects
protected  void serviceDictionary(java.util.Dictionary pDictionary, int pStart, int pHowMany, java.lang.String pIndexName, java.lang.String pElementName, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Renders the range operation for Dictionary objects
protected  void serviceEnumeration(java.util.Enumeration pEnumeration, int pStart, int pHowMany, java.lang.String pIndexName, java.lang.String pElementName, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Renders the range operation for Enumeration objects
protected  void serviceIterator(java.util.Iterator pIterator, int pStart, int pHowMany, java.lang.String pIndexName, java.lang.String pElementName, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Renders the range operation for Interator objects
protected  void serviceList(java.util.List pList, int pStart, int pHowMany, java.lang.String pIndexName, java.lang.String pElementName, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Renders the range operation for List objects
protected  void serviceMap(java.util.Map pMap, int pStart, int pHowMany, java.lang.String pIndexName, java.lang.String pElementName, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Renders the range operation for Map objects
static void setPrevNextParameters(int pStart, int pHowMany, int pLength, DynamoHttpServletRequest pRequest)
          Sets the HAS_PREV/NEXT, PREV/NEXT_START, PREV/NEXT_END, PREV/NEXT_HOW_MANY, SIZE, and END parameters based on the input parameter values and the length of the array.
 
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, 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


ARRAY

public static final java.lang.String ARRAY
See Also:
Constant Field Values

START

public static final java.lang.String START
See Also:
Constant Field Values

HOW_MANY

public static final java.lang.String HOW_MANY
See Also:
Constant Field Values

INDEX_NAME

public static final java.lang.String INDEX_NAME
See Also:
Constant Field Values

ELEMENT_NAME

public static final java.lang.String ELEMENT_NAME
See Also:
Constant Field Values

OUTPUT_START

public static final java.lang.String OUTPUT_START
See Also:
Constant Field Values

OUTPUT_END

public static final java.lang.String OUTPUT_END
See Also:
Constant Field Values

OUTPUT

public static final java.lang.String OUTPUT
See Also:
Constant Field Values

EMPTY

public static final java.lang.String EMPTY
See Also:
Constant Field Values

INDEX

public static final java.lang.String INDEX
See Also:
Constant Field Values

COUNT

public static final java.lang.String COUNT
See Also:
Constant Field Values

ELEMENT

public static final java.lang.String ELEMENT
See Also:
Constant Field Values

KEY

public static final java.lang.String KEY
See Also:
Constant Field Values

END

public static final java.lang.String END
See Also:
Constant Field Values

SIZE

public static final java.lang.String SIZE
See Also:
Constant Field Values

HAS_PREV

public static final java.lang.String HAS_PREV
See Also:
Constant Field Values

HAS_NEXT

public static final java.lang.String HAS_NEXT
See Also:
Constant Field Values

PREV_START

public static final java.lang.String PREV_START
See Also:
Constant Field Values

PREV_END

public static final java.lang.String PREV_END
See Also:
Constant Field Values

PREV_HOW_MANY

public static final java.lang.String PREV_HOW_MANY
See Also:
Constant Field Values

NEXT_START

public static final java.lang.String NEXT_START
See Also:
Constant Field Values

NEXT_END

public static final java.lang.String NEXT_END
See Also:
Constant Field Values

NEXT_HOW_MANY

public static final java.lang.String NEXT_HOW_MANY
See Also:
Constant Field Values
Constructor Detail

Range

public Range()
Method Detail

getArray

public java.lang.Object getArray(DynamoHttpServletRequest pRequest)
Gets the array-like value (e.g., array, Vector, Enumeration) to be used by this droplet from the request. Subclasses may override this method to extract the array by some means other than simply looking up its parameter value in the request.


setPrevNextParameters

public static void setPrevNextParameters(int pStart,
                                         int pHowMany,
                                         int pLength,
                                         DynamoHttpServletRequest pRequest)
Sets the HAS_PREV/NEXT, PREV/NEXT_START, PREV/NEXT_END, PREV/NEXT_HOW_MANY, SIZE, and END parameters based on the input parameter values and the length of the array.


service

public void service(DynamoHttpServletRequest pRequest,
                    DynamoHttpServletResponse pResponse)
             throws javax.servlet.ServletException,
                    java.io.IOException
Called when a request needs to be processed.

Overrides:
service in class DynamoServlet
Parameters:
pRequest - the request to be processed
pResponse - the response object for this request
Throws:
javax.servlet.ServletException - if an application specific error occurred processing this request
java.io.IOException - if an error occurred reading data from the request or writing data to the response

serviceArray

protected void serviceArray(java.lang.Object pArray,
                            int pStart,
                            int pHowMany,
                            java.lang.String pIndexName,
                            java.lang.String pElementName,
                            DynamoHttpServletRequest pRequest,
                            DynamoHttpServletResponse pResponse)
                     throws javax.servlet.ServletException,
                            java.io.IOException
Renders the range operation for array objects

Parameters:
pArray - the object to iterate
pStart - Specifies the starting index (1-based). For example, to start at the beginning of the array, set start to 1. If start points past the end of the array, the empty parameter will be rendered.
pHowMany - Specifies the number of items in the array set to display. If the combination of start and howMany point past the end of the array, rendering stops after the end of the array is reached.
pIndexName - the parameter name to use for the index
pElementName - the parameter name to use for the element
pRequest - the request to be processed
pResponse - the response object for this request
Throws:
javax.servlet.ServletException - if an application specific error occurred processing this request
java.io.IOException - if an error occurred reading data from the request or writing data to the response

serviceList

protected void serviceList(java.util.List pList,
                           int pStart,
                           int pHowMany,
                           java.lang.String pIndexName,
                           java.lang.String pElementName,
                           DynamoHttpServletRequest pRequest,
                           DynamoHttpServletResponse pResponse)
                    throws javax.servlet.ServletException,
                           java.io.IOException
Renders the range operation for List objects

Parameters:
pList - the object to iterate
pStart - Specifies the starting index (1-based). For example, to start at the beginning of the array, set start to 1. If start points past the end of the array, the empty parameter will be rendered.
pHowMany - Specifies the number of items in the array set to display. If the combination of start and howMany point past the end of the array, rendering stops after the end of the array is reached.
pIndexName - the parameter name to use for the index
pElementName - the parameter name to use for the element
pRequest - the request to be processed
pResponse - the response object for this request
Throws:
javax.servlet.ServletException - if an application specific error occurred processing this request
java.io.IOException - if an error occurred reading data from the request or writing data to the response

serviceCollection

protected void serviceCollection(java.util.Collection pCollection,
                                 int pStart,
                                 int pHowMany,
                                 java.lang.String pIndexName,
                                 java.lang.String pElementName,
                                 DynamoHttpServletRequest pRequest,
                                 DynamoHttpServletResponse pResponse)
                          throws javax.servlet.ServletException,
                                 java.io.IOException
Renders the range operation for Collection objects

Parameters:
pCollection - the object to iterate
pStart - Specifies the starting index (1-based). For example, to start at the beginning of the array, set start to 1. If start points past the end of the array, the empty parameter will be rendered.
pHowMany - Specifies the number of items in the array set to display. If the combination of start and howMany point past the end of the array, rendering stops after the end of the array is reached.
pIndexName - the parameter name to use for the index
pElementName - the parameter name to use for the element
pRequest - the request to be processed
pResponse - the response object for this request
Throws:
javax.servlet.ServletException - if an application specific error occurred processing this request
java.io.IOException - if an error occurred reading data from the request or writing data to the response

serviceIterator

protected void serviceIterator(java.util.Iterator pIterator,
                               int pStart,
                               int pHowMany,
                               java.lang.String pIndexName,
                               java.lang.String pElementName,
                               DynamoHttpServletRequest pRequest,
                               DynamoHttpServletResponse pResponse)
                        throws javax.servlet.ServletException,
                               java.io.IOException
Renders the range operation for Interator objects

Parameters:
pIterator - the object to iterate
pStart - Specifies the starting index (1-based). For example, to start at the beginning of the array, set start to 1. If start points past the end of the array, the empty parameter will be rendered.
pHowMany - Specifies the number of items in the array set to display. If the combination of start and howMany point past the end of the array, rendering stops after the end of the array is reached.
pIndexName - the parameter name to use for the index
pElementName - the parameter name to use for the element
pRequest - the request to be processed
pResponse - the response object for this request
Throws:
javax.servlet.ServletException - if an application specific error occurred processing this request
java.io.IOException - if an error occurred reading data from the request or writing data to the response

serviceEnumeration

protected void serviceEnumeration(java.util.Enumeration pEnumeration,
                                  int pStart,
                                  int pHowMany,
                                  java.lang.String pIndexName,
                                  java.lang.String pElementName,
                                  DynamoHttpServletRequest pRequest,
                                  DynamoHttpServletResponse pResponse)
                           throws javax.servlet.ServletException,
                                  java.io.IOException
Renders the range operation for Enumeration objects

Parameters:
pEnumeration - the object to iterate
pStart - Specifies the starting index (1-based). For example, to start at the beginning of the array, set start to 1. If start points past the end of the array, the empty parameter will be rendered.
pHowMany - Specifies the number of items in the array set to display. If the combination of start and howMany point past the end of the array, rendering stops after the end of the array is reached.
pIndexName - the parameter name to use for the index
pElementName - the parameter name to use for the element
pRequest - the request to be processed
pResponse - the response object for this request
Throws:
javax.servlet.ServletException - if an application specific error occurred processing this request
java.io.IOException - if an error occurred reading data from the request or writing data to the response

serviceMap

protected void serviceMap(java.util.Map pMap,
                          int pStart,
                          int pHowMany,
                          java.lang.String pIndexName,
                          java.lang.String pElementName,
                          DynamoHttpServletRequest pRequest,
                          DynamoHttpServletResponse pResponse)
                   throws javax.servlet.ServletException,
                          java.io.IOException
Renders the range operation for Map objects

Parameters:
pMap - the object to iterate
pStart - Specifies the starting index (1-based). For example, to start at the beginning of the array, set start to 1. If start points past the end of the array, the empty parameter will be rendered.
pHowMany - Specifies the number of items in the array set to display. If the combination of start and howMany point past the end of the array, rendering stops after the end of the array is reached.
pIndexName - the parameter name to use for the index
pElementName - the parameter name to use for the element
pRequest - the request to be processed
pResponse - the response object for this request
Throws:
javax.servlet.ServletException - if an application specific error occurred processing this request
java.io.IOException - if an error occurred reading data from the request or writing data to the response

serviceDictionary

protected void serviceDictionary(java.util.Dictionary pDictionary,
                                 int pStart,
                                 int pHowMany,
                                 java.lang.String pIndexName,
                                 java.lang.String pElementName,
                                 DynamoHttpServletRequest pRequest,
                                 DynamoHttpServletResponse pResponse)
                          throws javax.servlet.ServletException,
                                 java.io.IOException
Renders the range operation for Dictionary objects

Parameters:
pDictionary - the object to iterate
pStart - Specifies the starting index (1-based). For example, to start at the beginning of the array, set start to 1. If start points past the end of the array, the empty parameter will be rendered.
pHowMany - Specifies the number of items in the array set to display. If the combination of start and howMany point past the end of the array, rendering stops after the end of the array is reached.
pIndexName - the parameter name to use for the index
pElementName - the parameter name to use for the element
pRequest - the request to be processed
pResponse - the response object for this request
Throws:
javax.servlet.ServletException - if an application specific error occurred processing this request
java.io.IOException - if an error occurred reading data from the request or writing data to the response