atg.b2bcommerce.approval
Class ApprovedDroplet

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.b2bcommerce.approval.ApprovedDroplet
All Implemented Interfaces:
NameContextBindingListener, NameContextElement, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, ParameterServlet, java.util.EventListener, javax.servlet.Servlet

public class ApprovedDroplet
extends DynamoServlet

This droplet is used to load all the orders which have been approved and whose approver ids list contains the profile id contained in the approverid parameter.

Example:

 
        
        
        
        
                
                        
                        
                        
                                
No Orders

Usage:
approverid
The profile id of the approver
startIndex
the first order to return. This is useful for cycling through large amounts of orders. On first first query start at 0 and return 10. On the second query, start at 10, etc. If startIndex is null, it defaults to 0. (the beginning) (optional. used to break large result sets into manageable pieces.)
numOrders
the number of orders to return on the query. (optional. used to break large result sets into manageable pieces.) *
It renders the following oparams:
output
The oparam output is rendered once and the array of order objects (or the single order object if the orderId object was used) will be set in the "result" param. The index of the next displayable order is in the "nextIndex" param. The index of the previous set of orders (allowing the user to cycle back and forth) is in the "previousIndex" param.
error
error will be rendered if an error occurred
empty
empty will be rendered if there are no orders to be approved It sets the following output params:
result
This will contain an array of order objects.
count
This will contain the number of order objects in the result parameter
totalCount
This will contain the total number of order objects which satisfy the criteria
nextIndex
The index of the first order in the next set of results. If startIndex or numOrders was null, this will also be null.
previousIndex
The index of the first order in the previous set of results. If startIndex or numOrders was null, this will also be null.
startRange
The 1-based index of the first order in the set of results.
endRange
The 1-based index of the last order in the set of results.
errorMessage
if an error occurred this will be the detailed error message for the user.
This droplet has a security feature that allows only the current user to view the his own orders. This feature is enabled by default. To disable it, set the property enableSecurity=false


Field Summary
static ParameterName APPROVERID
           
static java.lang.String CLASS_VERSION
           
protected static int DEFAULT_NUM_ORDERS
           
protected  ComponentName mProfilePath
           
protected static java.lang.String MSG_GENERAL_ERROR
           
protected static java.lang.String MSG_NO_PERMISSION_FOR_ORDERS
           
static ParameterName NUMORDERS
           
static java.lang.String RESOURCE_BUNDLE
          Resource bundle that holds messages to dispay to the end user
static ParameterName STARTINDEX
           
 
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
ApprovedDroplet()
           
 
Method Summary
protected  int getApprovedOrderCount(java.lang.String pApproverId)
          This method creates and executes the query that returns the count of all the orders for approval by the approver whose id is in pApproverId.
protected  RepositoryItem[] getApprovedOrders(java.lang.String pApproverId, int pStartIndex, int pNumOrders, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          This method creates and executes the query that returns the orders for approval by the approver whose id is in pApproverId.
 java.lang.String getApproverIdsPropertyName()
          Returns the approverIdsPropertyName
protected  java.lang.String getCurrentProfileId(DynamoHttpServletRequest pRequest)
          get the profile id of the current user
 java.util.Locale getDefaultLocale()
          Returns property DefaultLocale.
 int getDefaultNumOrders()
          The default number of orders returned with each call.
 java.lang.String getOrderByProperty()
          Returns property orderByProperty
 Repository getOrderRepository()
          Returns property orderRepository
 java.lang.String getOrderRepositoryItemName()
          Returns property OrderRepositoryItemName
 java.lang.String getProfilePath()
          Returns property ProfilePath
 boolean getSortAscending()
          Returns property sortAscending
 java.util.Locale getUserLocale(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Returns the locale associated with the request.
 boolean isEnableSecurity()
          Returns property enableSecurity
 boolean isQueryTotal()
          True if the total order count should be retrieved when any order lookup is done.
 boolean isUseRequestLocale()
          Returns property UseRequestLocale
 void service(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
           Looks up all the orders that are have been approved by the approver with the passed in parameter: approverId.
 void setApproverIdsPropertyName(java.lang.String pApproverIdsPropertyName)
          Sets the approverIdsPropertyName
 void setDefaultLocale(java.util.Locale pDefaultLocale)
          Sets property DefaultLocale
 void setDefaultNumOrders(int pDefaultNumOrders)
           
 void setEnableSecurity(boolean pEnableSecurity)
          Sets property enableSecurity
 void setOrderByProperty(java.lang.String pOrderByProperty)
          Sets property orderByProperty
 void setOrderRepository(Repository pOrderRepository)
          Sets property orderRepository
 void setOrderRepositoryItemName(java.lang.String pOrderRepositoryItemName)
          Sets property OrderRepositoryItemName
 void setProfilePath(java.lang.String pProfilePath)
          Sets property ProfilePath
 void setQueryTotal(boolean pQueryTotal)
          Sets the queryTotal
 void setSortAscending(boolean pSortAscending)
          Sets property sortAscending
 void setUseRequestLocale(boolean pUseRequestLocale)
          Sets property UseRequestLocale
 
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

RESOURCE_BUNDLE

public static java.lang.String RESOURCE_BUNDLE
Resource bundle that holds messages to dispay to the end user


APPROVERID

public static final ParameterName APPROVERID

STARTINDEX

public static final ParameterName STARTINDEX

NUMORDERS

public static final ParameterName NUMORDERS

MSG_GENERAL_ERROR

protected static final java.lang.String MSG_GENERAL_ERROR
See Also:
Constant Field Values

MSG_NO_PERMISSION_FOR_ORDERS

protected static final java.lang.String MSG_NO_PERMISSION_FOR_ORDERS
See Also:
Constant Field Values

DEFAULT_NUM_ORDERS

protected static int DEFAULT_NUM_ORDERS

mProfilePath

protected ComponentName mProfilePath
Constructor Detail

ApprovedDroplet

public ApprovedDroplet()
Method Detail

setDefaultNumOrders

public void setDefaultNumOrders(int pDefaultNumOrders)

getDefaultNumOrders

public int getDefaultNumOrders()
The default number of orders returned with each call. The default is 10. Use -1 for all orders to be returned.


getOrderRepository

public Repository getOrderRepository()
Returns property orderRepository

Returns:
returns property orderRepository

setOrderRepository

public void setOrderRepository(Repository pOrderRepository)
Sets property orderRepository

Parameters:
pOrderRepository - the value to set for property orderRepository

getOrderRepositoryItemName

public java.lang.String getOrderRepositoryItemName()
Returns property OrderRepositoryItemName

Returns:
returns property OrderRepositoryItemName

setOrderRepositoryItemName

public void setOrderRepositoryItemName(java.lang.String pOrderRepositoryItemName)
Sets property OrderRepositoryItemName

Parameters:
pOrderRepositoryItemName - the value to set for property OrderRepositoryItemName

getApproverIdsPropertyName

public java.lang.String getApproverIdsPropertyName()
Returns the approverIdsPropertyName


setApproverIdsPropertyName

public void setApproverIdsPropertyName(java.lang.String pApproverIdsPropertyName)
Sets the approverIdsPropertyName


setProfilePath

public void setProfilePath(java.lang.String pProfilePath)
Sets property ProfilePath

Parameters:
pProfilePath - path to the profile nucleus component. Usually atg/userprofiling/Profile

getProfilePath

public java.lang.String getProfilePath()
Returns property ProfilePath


isEnableSecurity

public boolean isEnableSecurity()
Returns property enableSecurity

Returns:
returns property enableSecurity

setEnableSecurity

public void setEnableSecurity(boolean pEnableSecurity)
Sets property enableSecurity

Parameters:
pEnableSecurity - the value to set for property enableSecurity

getOrderByProperty

public java.lang.String getOrderByProperty()
Returns property orderByProperty

Returns:
returns property orderByProperty

setOrderByProperty

public void setOrderByProperty(java.lang.String pOrderByProperty)
Sets property orderByProperty

Parameters:
pOrderByProperty - the value to set for property orderByProperty

getSortAscending

public boolean getSortAscending()
Returns property sortAscending

Returns:
returns property sortAscending

setSortAscending

public void setSortAscending(boolean pSortAscending)
Sets property sortAscending

Parameters:
pSortAscending - the value to set for property sortAscending

isQueryTotal

public boolean isQueryTotal()
True if the total order count should be retrieved when any order lookup is done. The default setting is true.


setQueryTotal

public void setQueryTotal(boolean pQueryTotal)
Sets the queryTotal


service

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

Looks up all the orders that are have been approved by the approver with the passed in parameter: approverId. The getApprovedOrders method is used to return the list of orders which have been approved by the user whose id is approverId.

Overrides:
service in class DynamoServlet
Parameters:
DynamoHttpServletRequest -
DynamoHttpServletResponse -
Throws:
javax.servlet.ServletException - an application specific error occurred processing this request
java.io.IOException - an error occurred reading data from the request or writing data to the response.

getApprovedOrders

protected RepositoryItem[] getApprovedOrders(java.lang.String pApproverId,
                                             int pStartIndex,
                                             int pNumOrders,
                                             DynamoHttpServletRequest pRequest,
                                             DynamoHttpServletResponse pResponse)
                                      throws RepositoryException,
                                             javax.servlet.ServletException,
                                             java.io.IOException
This method creates and executes the query that returns the orders for approval by the approver whose id is in pApproverId. In order to change the query, subclass this class and override this method. This method must return an array of repository items which are order repository items.

Parameters:
pApproverId - the approver id
pStartIndex - the startIndex of orders to retrieve
pNumOrders - the number of orders to retrieve
Throws:
RepositoryException - if a repository error occurs
javax.servlet.ServletException
java.io.IOException

getApprovedOrderCount

protected int getApprovedOrderCount(java.lang.String pApproverId)
                             throws RepositoryException,
                                    javax.servlet.ServletException,
                                    java.io.IOException
This method creates and executes the query that returns the count of all the orders for approval by the approver whose id is in pApproverId. In order to change the query, subclass this class and override this method. This method must return an array of repository items which are order repository items.

Parameters:
pApproverId - the approver id
Throws:
RepositoryException - if a repository error occurs
javax.servlet.ServletException
java.io.IOException

getCurrentProfileId

protected java.lang.String getCurrentProfileId(DynamoHttpServletRequest pRequest)
get the profile id of the current user


setDefaultLocale

public void setDefaultLocale(java.util.Locale pDefaultLocale)
Sets property DefaultLocale


getDefaultLocale

public java.util.Locale getDefaultLocale()
Returns property DefaultLocale. If the property value is null, then JVM's default locale is returned.


setUseRequestLocale

public void setUseRequestLocale(boolean pUseRequestLocale)
Sets property UseRequestLocale


isUseRequestLocale

public boolean isUseRequestLocale()
Returns property UseRequestLocale


getUserLocale

public java.util.Locale getUserLocale(DynamoHttpServletRequest pRequest,
                                      DynamoHttpServletResponse pResponse)
                               throws javax.servlet.ServletException,
                                      java.io.IOException
Returns the locale associated with the request. The method first searches for a request paramater named locale. This value can be either a java.util.Locale object or a String which represents the locale. Next if the useRequestLocale property is true, then the locale of the request will be returned. Finally, if the locale cannot be determined, the the defaultLocale property is used.

Throws:
javax.servlet.ServletException
java.io.IOException