public class DetermineSortedPaymentsCmdImpl extends TaskCommandImpl implements DetermineSortedPaymentsCmd
paymentContainer
: All available
com.ibm.commerce.payment.rules.AtomicPaymentToBackendLinkObject objects which
can be used. Each com.ibm.commerce.payment.rules.AtomicPaymentToBackendLinkObject object
corresponds to an available payment object. This parameter is passed in by
setPaymentContainer(Collection).
releasesWithAmount
: The LinkedHashMap
object
containing all releases to process. The key of this
LinkedHashMap
is ID of the release object with
Long
type. The value of this LinkedHashMap
is
the amount with BigDecimal
that needs to process of the
corresponding release. This parameter should be set to the request properties
in the command context with the key "releasesWithAmount".
Step 1. This class firstly iterates the releases in input collection. For each release, this class checks all of the payments in the payment container passed in. If the items of this release include the items associated with the payment object, then relationship will be built between this release and the payment. Also those payment objects which are built relationship with release in this step will be put into the resulting payment container. They will be in the beginning position of the resulting payment container. This is to notify the payment rules engine to pick up these payment with the highest priority when it calculates payment actions for the releases.
Step 2. This class then iterates the releases which have not been built relationship with any payment objects. For each release, this class checks all of the payments which have not been built relationship with any releases. If the total amount of this release equals to the available amount of one payment, the relationship is built between this release and the payment. At once a release is built relationship with any one payment object here, the iteration for this release will exit. That is, one release would be built relationship with at most one payment object here. Also those payment objects which are built relationship with release in this step will be put into resulting container. The position of these payment objects is after the payment objects of step 1 in the payment container. The remaining payments which have not been built relationship with any releases just keep original order. But they will be at the last part of the resulting payment container.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASS_NAME
Class name
|
static java.lang.String |
COPYRIGHT
The internal copyright field.
|
defaultCommandClassName, NAME
Constructor and Description |
---|
DetermineSortedPaymentsCmdImpl() |
Modifier and Type | Method and Description |
---|---|
java.lang.Long |
getOrderId()
This method returns the current order ID.
|
java.util.Collection |
getPaymentContainer()
This method gets the payment container passed in.
|
java.util.LinkedHashMap |
getReleases()
This method gets the collection containing numbers of the release in
process.
|
void |
performExecute()
The main business logic of this command.
|
void |
setOrderId(java.lang.Long orderIdentifier)
This method sets the current order ID.
|
void |
setPaymentContainer(java.util.Collection container)
This method sets the payment container passed in.
|
accessControlCheck, checkIsAllowed, checkResourcePermission, createCommandExecutionEvent, execute, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getExceptionInvokeParameters, getObjectSize, getPostInvokeParameters, getPreInvokeParameters, getResources, getStoreId, getUser, getUserId, isReadyToCallExecute, reset, setAccCheck, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties, validateParameters
executeFromCache, getCaller, getEntryInfo, getId, getSharingPolicy, postExecute, preExecute, setCaller, setObjectSize, unionDependencies, updateCache
getCommandTarget, getCommandTargetName, getTargetPolicy, hasOutputProperties, setCommandTarget, setCommandTargetName, setHasOutputProperties, setOutputProperties, setTargetPolicy
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
executeFromCache, getCaller, getEntryInfo, getId, getSharingPolicy, postExecute, preExecute, setCaller, updateCache
getCommandTarget, getCommandTargetName, hasOutputProperties, setCommandTarget, setCommandTargetName, setOutputProperties
checkIsAllowed, checkResourcePermission, createCommandExecutionEvent, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getExceptionInvokeParameters, getPostInvokeParameters, getPreInvokeParameters, getResources, getStoreId, getUser, getUserId, setAccCheck, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties, validateParameters
public static final java.lang.String COPYRIGHT
public static final java.lang.String CLASS_NAME
public java.util.LinkedHashMap getReleases() throws ECException
LinkedHashMap
object in the request propertiesECException
- in case of exceptional situationspublic java.util.Collection getPaymentContainer()
getPaymentContainer
in interface DetermineSortedPaymentsCmd
public void setPaymentContainer(java.util.Collection container)
setPaymentContainer
in interface DetermineSortedPaymentsCmd
container
- the payment container passed inpublic void setOrderId(java.lang.Long orderIdentifier)
setOrderId
in interface DetermineSortedPaymentsCmd
orderIdentifier
- the current order IDpublic java.lang.Long getOrderId()
public void performExecute() throws ECException
performExecute
in interface ECCommand
performExecute
in interface com.ibm.websphere.command.TargetableCommand
performExecute
in class AbstractECTargetableCommand
ECException
- in case of exceptional situation