com.ibm.commerce.requisitionlist.commands
Class RequisitionListDisplayCmdImpl

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, Protectable, RequisitionListDisplayCmd

public class RequisitionListDisplayCmdImpl
extends RequisitionListBaseCmdImpl
implements RequisitionListDisplayCmd

Display one or more requisition lists.


Field Summary
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, COPYRIGHT, defaultCommandClassName, NAME
 
Fields inherited from interface com.ibm.commerce.command.ECTargetableCommand
COPYRIGHT
 
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()
          This method should be called after a command has been executed to reset its states variables.
protected  void setOutRequisitionListId(java.lang.String[] id)
          Set an array of output requisition list ids.
 void setRequestProperties(TypedProperty reqProperties)
          The WebController calls this method before invoking the execute method in this command to set the request properties for this command.
 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
 
Methods inherited from class com.ibm.commerce.command.ControllerCommandImpl
fulfills, getForUserId, getGeneric, getOwner, getRequestProperties, getResolvedRequestProperties, getResponseProperties, getRetriable, getViewInputProperties, isGeneric, isRetriable, mergeProperties, setForUserId, setGeneric, setOwner, setResponseProperties, setRetriable, setViewInputProperties
 
Methods inherited from class com.ibm.commerce.command.AbstractECTargetableCommand
accessControlCheck, checkIsAllowed, checkResourcePermission, execute, finalize, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getDefaultProperties, getResources, getStoreId, getUser, getUserId, isReadyToCallExecute, setAccCheck, setCommandContext, setCommandIfName, setDefaultProperties
 
Methods inherited from interface com.ibm.commerce.command.ControllerCommand
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, setAccCheck, setForUserId, setOwner
 
Methods inherited from interface com.ibm.commerce.command.ECCommand
checkIsAllowed, checkResourcePermission, getCommandContext, getCommandIfName, getCommandName, getDefaultProperties, getResources, getStoreId, getUser, getUserId, setCommandContext, setCommandIfName, setDefaultProperties
 
Methods inherited from interface com.ibm.commerce.security.Protectable
fulfills, getOwner
 

Field Detail

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,
                      javax.ejb.CreateException,
                      javax.ejb.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.


checkIsAllowed

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

findRequisitionListByStatus

protected java.util.Enumeration findRequisitionListByStatus(java.lang.String status)
                                                     throws java.sql.SQLException,
                                                            javax.ejb.CreateException,
                                                            javax.ejb.FinderException,
                                                            javax.naming.NamingException,
                                                            java.rmi.RemoteException,
                                                            ECException
Find the requisition lists based on the status.

findRequisitionListByStatusAndStore

protected java.util.Enumeration findRequisitionListByStatusAndStore(java.lang.String status,
                                                                    java.lang.Integer storeId)
                                                             throws java.sql.SQLException,
                                                                    javax.ejb.CreateException,
                                                                    javax.ejb.FinderException,
                                                                    javax.naming.NamingException,
                                                                    java.rmi.RemoteException,
                                                                    ECException
Find the requisition lists based on the status and storeId.

getOutRequisitionListId

public java.lang.String[] getOutRequisitionListId()
Return the output requisition list ids.

getRequisitionListStoreId

protected java.lang.String[] getRequisitionListStoreId()
Return the id of the store.

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
Following copied from interface: com.ibm.commerce.command.ECCommand
Throws:
com.ibm.commerce.command.CommandException - The superclass for all ECExceptions.

reset

public void reset()
Description copied from class: AbstractECTargetableCommand
This method should be called after a command has been executed to reset its states variables. After the call to reset, we should be able to execute the command again.
Overrides:
reset in class RequisitionListBaseCmdImpl

setOutRequisitionListId

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

setRequestProperties

public void setRequestProperties(TypedProperty reqProperties)
                          throws ECException
Description copied from interface: ControllerCommand
The WebController calls this method before invoking the execute method in this command to set the request properties for this command. It is the responsibility of the implementer of the ControllerCommand to extract the required input parameters from the request properties and perform parameter checking.
Specified by:
setRequestProperties in interface ControllerCommand
Overrides:
setRequestProperties in class RequisitionListBaseCmdImpl
Following copied from interface: com.ibm.commerce.command.ControllerCommand
Parameters:
requestProperties - com.ibm.commerce.datatype.TypedProperty
Throws:
com.ibm.commerce.exception.ECException. -  

setRequisitionListId

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

setRequisitionListStoreId

public void setRequisitionListStoreId(java.lang.String[] id)
Description copied from interface: RequisitionListDisplayCmd
Specifies the store id of the requisition list to be displayed.
Specified by:
setRequisitionListStoreId in interface RequisitionListDisplayCmd

setStatus

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

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
Following copied from interface: com.ibm.commerce.command.ECCommand
Throws:
ECException. -