com.ibm.commerce.requisitionlist.commands
Class RequisitionListDisplayCmdImpl

java.lang.Object
  |
  +--CacheableCommandImpl
        |
        +--com.ibm.commerce.command.AbstractECTargetableCommand
              |
              +--com.ibm.commerce.command.ControllerCommandImpl
                    |
                    +--com.ibm.commerce.requisitionlist.commands.RequisitionListBaseCmdImpl
                          |
                          +--com.ibm.commerce.requisitionlist.commands.RequisitionListDisplayCmdImpl
All Implemented Interfaces:
AccCommand, ControllerCommand, ECCommand, ECTargetableCommand, RequisitionListDisplayCmd

public class RequisitionListDisplayCmdImpl
extends RequisitionListBaseCmdImpl
implements RequisitionListDisplayCmd

Display one or more requisition lists. This command uses the following AccessBeans:

See Also:
Serialized Form

Field Summary
static java.lang.String COPYRIGHT
          IBM copyright notice field.
protected  java.lang.String[] iOutRequisitionListId
          The output of the requisition list ids.
protected  java.lang.String[] iRequisitionListStoreId
          The id of the store where the requisition lists are in.
 
Fields inherited from class com.ibm.commerce.requisitionlist.commands. RequisitionListBaseCmdImpl
iOrderId, iRequisitionListId, iRequisitionListName, iRequisitionListStatus
 
Fields inherited from class com.ibm.commerce.command. ControllerCommandImpl
requestProperties, responseProperties, retriable, viewReqProperties
 
Fields inherited from class com.ibm.commerce.command. AbstractECTargetableCommand
commandContext
 
Fields inherited from interface com.ibm.commerce.requisitionlist.commands. RequisitionListDisplayCmd
ALL_STORE_ID, defaultCommandClassName, NAME
 
Constructor Summary
RequisitionListDisplayCmdImpl()
           
 
Method Summary
protected  void action()
          The main action of the command.
 void checkIsAllowed( AccessVector resource, java.lang.String action)
          Check if the access control by calling checkIsAllowed() in the super classes
protected  java.util.Enumeration findRequisitionListByStatus(java.lang.String status)
          Find the requisition lists based on the status.
protected  java.util.Enumeration findRequisitionListByStatusAndStore(java.lang.String status, java.lang.Integer storeId)
          Find the requisition lists based on the status and storeId.
 java.lang.String[] getOutRequisitionListId()
          Return the output requisition list ids.
protected  java.lang.String[] getRequisitionListStoreId()
          Return the id of the store.
 void performExecute()
          The main execution of the command.
 void reset()
          Reset all instance variables.
protected  void setOutRequisitionListId(java.lang.String[] id)
          Set an array of output requisition list ids.
 void setRequestProperties( TypedProperty reqProperties)
          Sets the request properties.
 void setRequisitionListId(java.lang.Long id)
          Specifies the requisition list id to be displayed.
 void setRequisitionListStoreId(java.lang.String[] id)
          Specifies the store id of the requisition list to be displayed.
 void setStatus(java.lang.String status)
          Specifies the status of the requisition list to be displayed.
protected  void updateResponseView()
          Sets the response view.
 void validateParameters()
          Validate the input parameters.
 
Methods inherited from class com.ibm.commerce.requisitionlist.commands. RequisitionListBaseCmdImpl
copyOrder, copyOrder, copyOrderAccessBean, copyOrderItemAccessBean, copyOrderPayInfo, getName, getOrderId, getRequisitionListId, getStatus, setDefaultRequisitionListStatus, setName, setOrderId, setRequisitionListStatus
 
Methods inherited from class com.ibm.commerce.command. ControllerCommandImpl
checkPermission, fulfills, getForUserId, getGeneric, getOwner, getRequestProperties, getResolvedRequestProperties, getResourceOwners, getResponseProperties, getRetriable, getViewInputProperties, isGeneric, isRetriable, mergeProperties, setForUserId, setGeneric, setOwner, setResponseProperties, setRetriable, setViewInputProperties
 
Methods inherited from class com.ibm.commerce.command. AbstractECTargetableCommand
accessControlCheck, checkIsAllowed, checkParameters, checkResourcePermission, createCommandExecutionEvent, execute, finalize, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getResources, getStoreId, getUser, getUserId, isReadyToCallExecute, setAccCheck, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ibm.commerce.command. ControllerCommand
checkPermission, execute, getGeneric, getRequestProperties, getResolvedRequestProperties, getResponseProperties, getRetriable, getViewInputProperties, isGeneric, isRetriable, mergeProperties, setGeneric, setRetriable, setViewInputProperties
 
Methods inherited from interface com.ibm.commerce.command. AccCommand
accessControlCheck, getAccCheck, getForUserId, getResourceOwners, setAccCheck, setForUserId, setOwner
 
Methods inherited from interface com.ibm.commerce.command. ECCommand
checkIsAllowed, checkResourcePermission, createCommandExecutionEvent, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getResources, getStoreId, getUser, getUserId, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties
 

Field Detail
public static final java.lang.String COPYRIGHT
IBM copyright notice field.
See Also:
Constant Field Values

iOutRequisitionListId

protected java.lang.String[] iOutRequisitionListId
The output of the requisition list ids.

iRequisitionListStoreId

protected java.lang.String[] iRequisitionListStoreId
The id of the store where the requisition lists are in.
Constructor Detail

RequisitionListDisplayCmdImpl

public RequisitionListDisplayCmdImpl()
Method Detail

action

protected void action()
               throws java.sql.SQLException,
                      CreateException,
                      FinderException,
                      javax.naming.NamingException,
                      java.rmi.RemoteException,
ECException
The main action of the command.

It finds the requisition lists specified by the input parameters.

It uses the following algorithm to find the requisition lists.

 if (requisitionListId is specified) {
     return requisitionListId
 } else {
     if (status is specified) {
         status_list = {status}
     } else {
         // default is all status
         status_list = {'Y', 'Z'}
     }
     if (requisitionListStoreId is specified) {
         if (requisitionListStoreId = *) {
             storeId_list = *
         } else {
             storeId_list = requisitionListStoreId
         }
     } else {
         // default is the current store and then all stores
         if (current_storeId exists in the command context) {
             storeId_list = current_storeId
         } else {
             storeId_list = *
         }
     }

     requisitionListId_list = {}
     if (storeId_list = *) {
         for (status in status_list) {
             requisitionListId_list = requisitionListId_list + findRequisitionListByStatus(status)
         }
     } else {
         for (storeId in storeId_list) {
             for (status in status_list) {
                 requisitionListId_list = requisitionListId_list + findRequisitionListByStatusAndStore(status, storeId)
             }
         }
     }
     return requisitionListId_list
 }

After finding all requisition list, it calls checkIsAllowed(AccessVector, String) to verify the access control.

Throws:
ECException
FinderException
CreateException
javax.naming.NamingException
java.rmi.RemoteException
java.sql.SQLException

checkIsAllowed

public void checkIsAllowed(AccessVector resource,
                           java.lang.String action)
                    throws ECException
Check if the access control by calling checkIsAllowed() in the super classes
Parameters:
resource - AccessVector
action - action
Throws:
ECException

findRequisitionListByStatus

protected java.util.Enumeration findRequisitionListByStatus(java.lang.String status)
                                                     throws java.sql.SQLException,
                                                            CreateException,
                                                            FinderException,
                                                            javax.naming.NamingException,
                                                            java.rmi.RemoteException,
ECException
Find the requisition lists based on the status.
Parameters:
status - status
Returns:
enumeration of OrderAccessBean
Throws:
ECException
FinderException
CreateException
javax.naming.NamingException
java.rmi.RemoteException
java.sql.SQLException

findRequisitionListByStatusAndStore

protected java.util.Enumeration findRequisitionListByStatusAndStore(java.lang.String status,
                                                                    java.lang.Integer storeId)
                                                             throws java.sql.SQLException,
                                                                    CreateException,
                                                                    FinderException,
                                                                    javax.naming.NamingException,
                                                                    java.rmi.RemoteException,
ECException
Find the requisition lists based on the status and storeId.
Parameters:
status - status
storeId - store id
Returns:
enumeration of OrderAccessBean
Throws:
ECException
FinderException
CreateException
javax.naming.NamingException
java.rmi.RemoteException
java.sql.SQLException

getOutRequisitionListId

public java.lang.String[] getOutRequisitionListId()
Return the output requisition list ids.
Returns:
an array of requisition list ids.

getRequisitionListStoreId

protected java.lang.String[] getRequisitionListStoreId()
Return the id of the store.
Returns:
an array of store ids.

performExecute

public void performExecute()
                    throws ECException
The main execution of the command. It calls the follwoing methods:
Specified by:
performExecute in interface ECCommand
Overrides:
performExecute in class AbstractECTargetableCommand
Throws:
ECException

reset

public void reset()
Reset all instance variables.
Overrides:
reset in class RequisitionListBaseCmdImpl

setOutRequisitionListId

protected void setOutRequisitionListId(java.lang.String[] id)
Set an array of output requisition list ids.
Parameters:
id - an array of requisition list id.

setRequestProperties

public void setRequestProperties(TypedProperty reqProperties)
                          throws ECException
Sets the request properties.
Specified by:
setRequestProperties in interface ControllerCommand
Overrides:
setRequestProperties in class RequisitionListBaseCmdImpl
Parameters:
reqProperties - request properties.
Throws:
ECException

setRequisitionListId

public void setRequisitionListId(java.lang.Long id)
Specifies the requisition list id to be displayed.
Specified by:
setRequisitionListId in interface RequisitionListDisplayCmd
Overrides:
setRequisitionListId in class RequisitionListBaseCmdImpl
Parameters:
id - requisition list id.

setRequisitionListStoreId

public void setRequisitionListStoreId(java.lang.String[] id)
Specifies the store id of the requisition list to be displayed.
Specified by:
setRequisitionListStoreId in interface RequisitionListDisplayCmd
Parameters:
id - an array of store ids.

setStatus

public void setStatus(java.lang.String status)
Specifies the status of the requisition list to be displayed.
Specified by:
setStatus in interface RequisitionListDisplayCmd
Overrides:
setStatus in class RequisitionListBaseCmdImpl
Parameters:
status - status

updateResponseView

protected void updateResponseView()
Sets the response view. If requisitionListId is specified, it sets RequisitionListDetailView. Otherwise it sets RequisitionListView.
Overrides:
updateResponseView in class RequisitionListBaseCmdImpl

validateParameters

public void validateParameters()
                        throws ECException
Validate the input parameters.

It checks the validation of the follwoing parameter values:

Exception:

Specified by:
validateParameters in interface ECCommand
Overrides:
validateParameters in class AbstractECTargetableCommand
Throws:
ECException