com.ibm.commerce.orderitems.commands
Class OrderItemDeleteCmdImpl
com.ibm.commerce.command.AbstractECTargetableCommand
|
+--com.ibm.commerce.command.ControllerCommandImpl
|
+--com.ibm.commerce.orderitems.commands.OrderItemDeleteCmdImpl
- All Implemented Interfaces:
- AccCommand, ControllerCommand, ECCommand, ECTargetableCommand, OrderItemDeleteCmd, Protectable
- public class OrderItemDeleteCmdImpl
- extends ControllerCommandImpl
- implements OrderItemDeleteCmd
Deletes a product from one or more pending orders.
Behavior
- For each of the order items to be deleted, the command does the
following if orderItemId is specified:
- Obtains the order that the order item is associated with.
- If the order is in pending state, unlocks it and updates the
timestamp.
- Deletes the order items.
- The command does the following if catEntryId is specified:
- Compiles the list of orders for processing.
The ResolveOrdersCmd task command is
invoked to obtain the current pending orders, if needed.
- Does the following for each order in the list:
- If the order is in pending state and the order items for the
order contain the specified product, unlocks the order and
updates the timestamp.
- Deletes all the order items that contain the specified
product.
View Task: RedirectView
Field Summary |
static java.lang.String |
COPYRIGHT
|
Method Summary |
protected java.lang.String[] |
getOrderIds()
Return a list of ids of the orders in which at lease one order item has been delete. |
AccessVector |
getResources()
Gets the access vector accessed by this command. |
boolean |
isReadyToCallExecute()
isReadyToCallExecute method is called by the Targettable Command frame work
before the execution of the command. |
protected boolean |
isValidStatus(OrderAccessBean orderAB)
Checks whether the status of the order is valid when you tries to delete order items from the order. |
void |
performExecute()
Contains the actual business logic of the command
It should be implemented by all the command writer. |
void |
reset()
This method should be called after a command has been executed to reset its states variables. |
void |
setCatEntryId(java.lang.String[] ids)
set a list of catalog entry ids to be deleted
from the pending orders specified by orderId. |
void |
setOrderId(java.lang.String[] numbers)
Specifies zero or more orders, using order ids or one of the
special abbreviations ".", "*", ".t", "*t". |
void |
setOrderItemId(java.lang.String[] numbers)
Set an array of id of order items to be deleted. |
void |
setOutOrderName(java.lang.String[] names)
Specifies the names of name-value pairs to add to the redirection URL. |
void |
setRequestProperties(TypedProperty aRequestProperties)
The WebController calls this method before invoking the execute method in this command to
set the request properties for this command. |
protected void |
unLockOrder(java.lang.String orderId)
Unlocks the order. |
void |
validateParameters()
Performs server side parameter checking. |
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, getStoreId, getUser, getUserId, 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.ECCommand |
checkIsAllowed, checkResourcePermission, getCommandContext, getCommandIfName, getCommandName, getDefaultProperties, getStoreId, getUser, getUserId, setCommandContext, setCommandIfName, setDefaultProperties |
COPYRIGHT
public static final java.lang.String COPYRIGHT
OrderItemDeleteCmdImpl
public OrderItemDeleteCmdImpl()
getOrderIds
protected java.lang.String[] getOrderIds()
- Return a list of ids of the orders in which at lease one order item has been delete.
These order ids are also appended to redirection url.
getResources
public AccessVector getResources()
throws ECException
- Description copied from interface:
ECCommand
- Gets the access vector accessed by this command.
The default implementation returns null indicating that no protectable resource is
accessed by this command. It is the responsibilities of the command writer to
return the protectable primary resource(s) and the corresponding actions accessed
by this command.
- Specified by:
getResources
in interface ECCommand
- Overrides:
getResources
in class AbstractECTargetableCommand
- Following copied from interface:
com.ibm.commerce.command.ECCommand
- Returns:
- AccessVector - a vector of resource action pairs
isReadyToCallExecute
public boolean isReadyToCallExecute()
- Description copied from class:
AbstractECTargetableCommand
- isReadyToCallExecute method is called by the Targettable Command frame work
before the execution of the command. The default implementation is to return true.
- Overrides:
isReadyToCallExecute
in class AbstractECTargetableCommand
- Following copied from class:
com.ibm.commerce.command.AbstractECTargetableCommand
- Returns:
- boolean - true if we can execute the command
false if we canot execute the command
isValidStatus
protected boolean isValidStatus(OrderAccessBean orderAB)
throws ECException,
javax.ejb.FinderException,
javax.ejb.CreateException,
javax.naming.NamingException,
java.rmi.RemoteException,
java.sql.SQLException
- Checks whether the status of the order is valid when you tries to delete order items from the order.
It returns true if the status is 'P' or 'E'. Otherwise it returns false.
performExecute
public void performExecute()
throws ECException
- Description copied from interface:
ECCommand
- Contains the actual business logic of the command
It should be implemented by all the command writer.
- 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 AbstractECTargetableCommand
setCatEntryId
public void setCatEntryId(java.lang.String[] ids)
- set a list of catalog entry ids to be deleted
from the pending orders specified by orderId.
This parameter is mandatory if orderItemId is not set.
This parameter is ignored if orderItemId is set.
- Specified by:
setCatEntryId
in interface OrderItemDeleteCmd
setOrderId
public void setOrderId(java.lang.String[] numbers)
- Specifies zero or more orders, using order ids or one of the
special abbreviations ".", "*", ".t", "*t". See OrderItem Commands for a
description of these abbreviations. If this parameter is omitted, it defaults to
"."
- Specified by:
setOrderId
in interface OrderItemDeleteCmd
setOrderItemId
public void setOrderItemId(java.lang.String[] numbers)
- Set an array of id of order items to be deleted.
- Specified by:
setOrderItemId
in interface OrderItemDeleteCmd
setOutOrderName
public void setOutOrderName(java.lang.String[] names)
- Specifies the names of name-value pairs to add to the redirection URL.
The values of the added name-value pairs are the reference numbers of the
input orders.
- Specified by:
setOutOrderName
in interface OrderItemDeleteCmd
setRequestProperties
public void setRequestProperties(TypedProperty aRequestProperties)
throws ECApplicationException
- 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 ControllerCommandImpl
- Following copied from interface:
com.ibm.commerce.command.ControllerCommand
- Parameters:
requestProperties
- com.ibm.commerce.datatype.TypedProperty- Throws:
com.ibm.commerce.exception.ECException.
-
unLockOrder
protected void unLockOrder(java.lang.String orderId)
throws ECException,
javax.ejb.FinderException,
javax.ejb.CreateException,
javax.naming.NamingException,
java.rmi.RemoteException,
java.sql.SQLException
- Unlocks the order.
validateParameters
public void validateParameters()
throws ECException
- Description copied from interface:
ECCommand
- Performs server side parameter checking. This method replaces the checkParameters() method in a previous
version of the code.
- Specified by:
validateParameters
in interface ECCommand
- Overrides:
validateParameters
in class AbstractECTargetableCommand
- Following copied from interface:
com.ibm.commerce.command.ECCommand
- Throws:
ECException.
-