com.ibm.commerce.orderitems.commands
Interface OrderItemAddCmd
- All Superinterfaces:
- AccCommand, ControllerCommand, ECCommand, Protectable
- All Known Implementing Classes:
- OrderItemAddCmdImpl, OrderItemBaseCmdImpl
- public interface OrderItemAddCmd
- extends ControllerCommand
Adds items to one or a list of orders.
This command accepts enumeration type of parameters. That is, it accepts parameterName_i=parameterValue.
For example, to add three order items with the catalog entries id 15, 16, and 17, you can pass catEntryId_1=15&catEntryId_2=16&catEntryId_3=17 to the command. If you call the individual set method setCatEntryId(Hashtable) to pass the above parameters, you need to create a hashtable and add the following to the hashtable:
hashtable.put(new Integer(1), new String("15"));
hashtable.put(new Integer(2), new String("16"));
hashtable.put(new Integer(3), new String("17"));
Behavior
- The command calls ResolveOrdersCmd with the input parameter orderId to get a list orders. If the orderId is not specified, the default is "." (the current pending orders).
- The command can handle multiple items at one transaction. The multiple items are specified using the enumeration group i. For example, if you want to update multiple order items, you can specify orderItemId_i as parameters and i can be 1, 2, 3, ...
- The enumeration group i must be an integer. They don't have to be consecutive integers. The command will handle each enumeration group in numeric order.
- A parameter in enumeration group i = 0 has special meaning. That is, if a parameter with enumeration group 0, this parameter applies to all other enumeration groups. For example, if you want to update all order items with the same shipping address with id=1001, you can specify addressId_0=1001 instead of specifying addressId_1=1001&addressId_2=1001&addressId_3=1001...
- If a parameter does not have enumeration group, it means that it is in enumeration group 0. The above special meaning also applies. So instead of specifying addressId_0=1001, you can just specify addressId=1001.
- The parameters orderItemId, caEntryId and partNumber, expandConfigurationId are the keys for each enumeration group. It does not make sense to have one orderItemId to apply to all enumeration group. So you should not use enumeration group 0 for these parameters. If you use the enumeration group 0 or don't specify the enumeration group for these parameters, the command will only handle one item. All parameters in other enumeration groups are ignored.
- The command does the following for each enumeration group i of parameters:
- Only one of the following parameters should be specified: orderItemId_i, expandConfigurationId_i, partNumber_i, catEntryId_i. If more than one of above parameters are specified, only one will take effect and the others are ignored. The order of precedence is: orderItemId_i, expandConfigurationId_i, partNumber_i, catEntryId_i, that is, if the orderItemId_i is specified, the others are ignored.
- If the parameter orderItemId_i is specified, the command tries to update the order item.
- If the parameter partNumber_i or parameter catEntryId_i is specified, the command tries to create a new order item and insert into all resolved orders. If the list of resolved orders is empty, a new pending order will be created.
- If the parameter partNumber_i is specified,the command uses the partNumber_i with the optional parameter memberId_i to find the catalog entry. If the memberId_i is not specified, we use the store path to search the catalog entry with the specified part number..
- If the parameter expandConfigurationId_i is specified, the command tries to create multiple new order items and insert them into one order. That is, the list of resolved orders should be maximal to one. If the list of resolved order contains more than one orders, the created order items will be inserted into only one order. It does the following:
- Find all rows in the OICOMPLIST table based on the CONIFGURATIONID = expandConfigurationId_i and ORDERITEMS_ID is null.
- For each row found above, use the field CATENTRY_ID to create a new order item.
- The quantity in the order item is the quantity_i specified on the URL multiplied by the field CATALOGQUANTITY.
- If the field UNITPRICE and the field CURRENCY are both not null, they will be copied to the order item, and the manual price bit in the prepareflags of the order item will be set.
- The field ORDERITEMS_ID of the row will be set to orderitems_id of the newly created order item.
- The configurationid of the order item will be set to the expandConfigurationId_i.
- When a new order is created, the member id of the new order is set to the current user in the command context and the currency is also taken from the one in the command context.
- When creating a new order item, the parameter quantity_i is required and must be a positive number. The member id and currency of the order item is set to be the same as the member id and currency of the order. The storeId is also required.
- If the same enumeration group i is specifed more than once, only one is effective, the others are ignored.
- To add a new order item with catEntryId, the following things are checked:
- It calls the ResolveSkuCmd task command to resolve the SKU.
- It checks if the catalog entry is buyable in this store.
- It checks if the shopper is entitled to buy this catalog entry.
- If any above checking failed, an exception will be thrown. But if the parameter continue is specified with value 1, the error will be ignored. This order item will not be added and the command will continue to process the next order item.
- Either updating the existing order item when the orderItemId_i is specified or create a new order item when the partNumber_i or catEntryId_i are specified, the command uses the rest of parameters to update the order item.
- If the parameter addressId_i is not specified, for registered user, the default will be the addressId in the ADDRESS table (where the STATUS column has a value of P and the value in the NICKNAME column is the user's login id obtained from the LOGONID column in the USERREG table). If the address cannot be found in the ADDRESS table, the address_id will be NULL for the order item in the ORDERITEMS table.
- If the quantity_i is zero, the order item is removed from the orders.
- If the parameter shipModeId_i is not specified, the default is taken from the STOREDEF table.
- It calls the GetContractUnitPriceCmd task command to get the contract price of the product or item using the specified trading agreements (contracts) or all eligible trading agreements (contracts) for which the member of the order is eligible, except for order items which were generated or whose price were manually entered (overriden by the administrator). All input trading agreements (contracts) to be used will be checked to verify that if they apply compatible payment methods. The currency is always the same as the currency of the order.
- For any orders in which one or more order items got updated or inserted, the orders are unlocked and the lastUpdate fields are updated with the current time stamp.
- After all enumeration group are processed, the command determines fulfillment centers and checks for available inventory for all order items modified or created. If ATP inventory is enabled, it calls AllocateInventoryCmd. Otherwise it calls ResolveFulfillmentCenterCmd which is the WCS 5.1 behavior.
- Calls the ExtendOrderItemProcessCmd task command to perform additional processing to meet any unique requirements.
View
- RedirectView
After the command finishes, it redirects to the URL that is specified.
Exception conditions
- Different exception tasks are called depending on the error.
- If any parameter value is invalid, the command throws an ECApplicationException with message: _ERR_INVALID_INPUT and error view: InvalidInputErrorView.
- If the partNumber is specified and it cannot be found in the catalog, the command throws an ECApplicationException with message: _ERR_PROD_NOT_EXISTING and error view: badPartNumberErrorView.
- ECApplicationException will be thrown too if the following errors are encountered:
- Input trading agreements (contracts) are not valid or eligible to use.
- Trading agreements (contracts) being used in the order applies incompatible payment methods.
- Price Lists cannot be retrieved
- If ATP is not enabled, the task command ResolveFulfillmentCenterCmd may throw ECApplicationException with message: _API_BAD_INV and error view: ResolveFulfillmentCenterErrorView.
Method Summary |
java.lang.String[] |
getOrderIds()
Return a list of order ids which are touched or created by the command. |
java.lang.String[] |
getOrderItemIds()
Return a list of order item ids which are created or updated by the command. |
void |
setAddressId(java.util.Hashtable ahshAddress_id)
Set the address id parameters (optional). |
void |
setAttrName(java.util.Hashtable ahshAttr_name)
Set the attribute name parameters (optional). |
void |
setAttrValue(java.util.Hashtable ahshAttr_value)
Set the attribute value parameters (optional). |
void |
setCatEntryId(java.util.Hashtable ahshCatentry_id)
Set the attribute name parameters. |
void |
setComment(java.util.Hashtable ahshComment)
Set the comment parameters (optional). |
void |
setConfigurationId(java.util.Hashtable ahshConfigurationId)
Set the configurationId parameters (optional). |
void |
setContinue(java.lang.String aContinue)
Set the continue parameter (optional). |
void |
setContractId(java.util.Hashtable ahshContract_id)
Set the contract id parameters (optional). |
void |
setCorrelationGroup(java.util.Hashtable ahshCorrelationGroup)
Set the correlation group parameters. |
void |
setDescription(java.util.Hashtable ahshDescription)
Set the description parameters (optional). |
void |
setExpandConfigurationId(java.util.Hashtable ahshExpandConfigurationId)
Set the expandConfigurationId parameter. |
void |
setField1(java.util.Hashtable ahshField1)
Set the field1 parameters (optional). |
void |
setField2(java.util.Hashtable ahshField2)
Set the field2 parameters (optional). |
void |
setListId(java.lang.String[] aList_id)
Set the interest item list id parameters (optional). |
void |
setMemberId(java.util.Hashtable ahshMember_id)
Set the member id parameters (optional). |
void |
setOfferId(java.util.Hashtable ahshOffer_id)
Set the offer id parameters (optional). |
void |
setOrderComment(java.lang.String aOrderComment)
Set the Order comment parameter (optional). |
void |
setOrderDesc(java.lang.String aOrder_desc)
Set the Order description parameter (optional). |
void |
setOrderId(java.lang.String[] aOrder_id)
Set the order id parameters (optional). |
void |
setOutOrderItemName(java.lang.String[] aOut_orderitem_name)
Set the out order item name parameters (optional). |
void |
setOutOrderName(java.lang.String[] aarrOutOrderName)
Set the out order name parameters (optional). |
void |
setPartNumber(java.util.Hashtable ahshPart_number)
Set the part number parameters (optional). |
void |
setQuantity(java.util.Hashtable ahshQuantity)
Set the quantity parameters (mandatory). |
void |
setShipmodeId(java.util.Hashtable ahshShipmode_id)
Set the ship mode id parameters (optional). |
void |
setTradingId(java.util.Hashtable ahshTrading_id)
Set the trading id parameters (optional). |
void |
setUom(java.util.Hashtable ahshUom)
Set the unit of measure parameters (optional). |
Methods inherited from interface com.ibm.commerce.command.ControllerCommand |
checkPermission, execute, getGeneric, getRequestProperties, getResolvedRequestProperties, getResponseProperties, getRetriable, getViewInputProperties, isGeneric, isRetriable, mergeProperties, setGeneric, setRequestProperties, setRetriable, setViewInputProperties |
Methods inherited from interface com.ibm.commerce.command.ECCommand |
checkIsAllowed, checkResourcePermission, createCommandExecutionEvent, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getResources, getStoreId, getUser, getUserId, performExecute, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties, validateParameters |
COPYRIGHT
public static final java.lang.String COPYRIGHT
- IBM copyright notice field.
- See Also:
- Constant Field Values
NAME
public static final java.lang.String NAME
- The name of the Command Interface class.
- See Also:
- Constant Field Values
defaultCommandClassName
public static final java.lang.String defaultCommandClassName
- The default implementation class.
- See Also:
- Constant Field Values
badPartNumberList
public static final java.lang.String badPartNumberList
- The parameter badPartNumberList. If there are bad part numbers in the request, the following parameters will be in the response: badPartNumberList, goodPartNumberList, badPartNumberQuantityList, goodPartNumberQuantityList, badPartNumberErrorView.
- See Also:
- Constant Field Values
goodPartNumberList
public static final java.lang.String goodPartNumberList
- The parameter goodPartNumberList.
- See Also:
- Constant Field Values
badPartNumberQuantityList
public static final java.lang.String badPartNumberQuantityList
- The parameter badPartNumberQuantityList.
- See Also:
- Constant Field Values
goodPartNumberQuantityList
public static final java.lang.String goodPartNumberQuantityList
- The parameter goodPartNumberQuantityList.
- See Also:
- Constant Field Values
multiplePartNumberList
public static final java.lang.String multiplePartNumberList
- The parameter multiplePartNumberList. If there is a part number which can be resolved to multiple catalog entries, the following parameters will be in the response: multiplePartNumberList, multiplePartNumberQuantityList and multiplePartNumberCatalogEntriesList.
- See Also:
- Constant Field Values
multiplePartNumberQuantityList
public static final java.lang.String multiplePartNumberQuantityList
- The parameter multiplePartNumberQuantityList.
- See Also:
- Constant Field Values
multiplePartNumberCatalogEntriesList
public static final java.lang.String multiplePartNumberCatalogEntriesList
- The parameter multiplePartNumberCatalogEntriesList.
- See Also:
- Constant Field Values
badPartNumberErrorView
public static final java.lang.String badPartNumberErrorView
- The parameter badPartNumberErrorView.
- See Also:
- Constant Field Values
getOrderIds
public java.lang.String[] getOrderIds()
- Return a list of order ids which are touched or created by the command. These order ids are also appended to redirection url.
-
- Returns:
- an array of order IDs
getOrderItemIds
public java.lang.String[] getOrderItemIds()
- Return a list of order item ids which are created or updated by the command. These order item ids are also appended to redirection url.
-
- Returns:
- an array of order item IDs
setAddressId
public void setAddressId(java.util.Hashtable ahshAddress_id)
- Set the address id parameters (optional).
-
- Parameters:
- ahshAddress_id - Contains a list of address ids. The key is the enumeration group (Integer) and the value is the address id (String). For example, if you have input parameters: addressId_1=123&addressId=234, the hashtable can be constructed by:
ahshAddress_id.put(new Integer(1), new String("123"));
ahshAddress_id.put(new Integer(2), new String("234"));
setAttrName
public void setAttrName(java.util.Hashtable ahshAttr_name)
- Set the attribute name parameters (optional). The attribute name, together with the attribute value are used to determine a SKU.
-
- Parameters:
- ahshAttr_name - Contains a list of attribute names. The key is the enumeration group (Integer) and the value is the attribute name (String[]). For example, if you have input parameters: attrName_1=123&attrName_1=234&attrName_2=123, the hashtable can be constructed by:
ahshAttr_name.put(new Integer(1), new String[] {"123", "234"});
ahshAttr_name.put(new Integer(2), new String[] {"123"});
setAttrValue
public void setAttrValue(java.util.Hashtable ahshAttr_value)
- Set the attribute value parameters (optional). The attribute name, together with the attribute value are used to determine a SKU.
-
- Parameters:
- ahshAttr_value - a list of attribute values.
setCatEntryId
public void setCatEntryId(java.util.Hashtable ahshCatentry_id)
- Set the attribute name parameters. This parameter is mandatory if the partNumber parameter is not set. This parameter is ignored when the partNumber parameter is set.
-
- Parameters:
- ahshCatentry_id - a list of catalog entry ids.
setComment
public void setComment(java.util.Hashtable ahshComment)
- Set the comment parameters (optional).
-
- Parameters:
- ahshComment - a list of comments
setConfigurationId
public void setConfigurationId(java.util.Hashtable ahshConfigurationId)
- Set the configurationId parameters (optional).
-
- Parameters:
- ahshConfigurationId - a list of configuration ids.
setContinue
public void setContinue(java.lang.String aContinue)
- Set the continue parameter (optional).
-
- Parameters:
- aContinue - a string can be either "0" or "1".
setContractId
public void setContractId(java.util.Hashtable ahshContract_id)
- Set the contract id parameters (optional). It is used to calculate the price.
-
- Parameters:
- ahshContract_id - a list of contract ids.
setCorrelationGroup
public void setCorrelationGroup(java.util.Hashtable ahshCorrelationGroup)
- Set the correlation group parameters. It is optional.
-
- Parameters:
- ahshCorrelationGroup - a list of correlation groups.
setDescription
public void setDescription(java.util.Hashtable ahshDescription)
- Set the description parameters (optional).
-
- Parameters:
- ahshDescription - a list of order item descriptions.
setExpandConfigurationId
public void setExpandConfigurationId(java.util.Hashtable ahshExpandConfigurationId)
- Set the expandConfigurationId parameter. This parameter is optional.
-
- Parameters:
- ahshExpandConfigurationId - a list of expand configuration ids.
setField1
public void setField1(java.util.Hashtable ahshField1)
- Set the field1 parameters (optional).
-
- Parameters:
- ahshField1 - a list of field1.
setField2
public void setField2(java.util.Hashtable ahshField2)
- Set the field2 parameters (optional).
setListId
public void setListId(java.lang.String[] aList_id)
- Set the interest item list id parameters (optional).
-
- Parameters:
- aList_id - an array of interest item list ids.
setMemberId
public void setMemberId(java.util.Hashtable ahshMember_id)
- Set the member id parameters (optional). It is the catalog owner's member id. It is necessary when the partNumber parameter is set. Together with the partNumber, the catalog entry id can uniquely be determined.
-
- Parameters:
- ahshMember_id - a list of member ids.
setOfferId
public void setOfferId(java.util.Hashtable ahshOffer_id)
- Set the offer id parameters (optional). It is used to calculate the price.
-
- Parameters:
- ahshOffer_id - a list of offer ids.
setOrderComment
public void setOrderComment(java.lang.String aOrderComment)
- Set the Order comment parameter (optional).
-
- Parameters:
- aOrderComment - order comment.
setOrderDesc
public void setOrderDesc(java.lang.String aOrder_desc)
- Set the Order description parameter (optional).
-
- Parameters:
- aOrder_desc - order description.
setOrderId
public void setOrderId(java.lang.String[] aOrder_id)
- Set the order id parameters (optional). If it is not set, the current pending order id will be used. If there is no current pending order, a new order will be created.
-
- Parameters:
- aOrder_id - an array of order ids.
setOutOrderItemName
public void setOutOrderItemName(java.lang.String[] aOut_orderitem_name)
- Set the out order item name parameters (optional). If it is not set, the default name is "orderItemId".
-
- Parameters:
- aOut_orderitem_name - an array of out order item names.
setOutOrderName
public void setOutOrderName(java.lang.String[] aarrOutOrderName)
- Set the out order name parameters (optional). If it is not set, the default name is "orderId".
-
- Parameters:
- aarrOutOrderName - an array of out order names.
setPartNumber
public void setPartNumber(java.util.Hashtable ahshPart_number)
- Set the part number parameters (optional).
-
- Parameters:
- ahshPart_number - a list of part numbers.
setQuantity
public void setQuantity(java.util.Hashtable ahshQuantity)
- Set the quantity parameters (mandatory).
-
- Parameters:
- ahshQuantity - a list of quantities.
setShipmodeId
public void setShipmodeId(java.util.Hashtable ahshShipmode_id)
- Set the ship mode id parameters (optional).
-
- Parameters:
- ahshShipmode_id - a list of shipping mode ids.
setTradingId
public void setTradingId(java.util.Hashtable ahshTrading_id)
- Set the trading id parameters (optional). It is used to calculate the price.
-
- Parameters:
- ahshTrading_id - a list of trading ids.
setUom
public void setUom(java.util.Hashtable ahshUom)
- Set the unit of measure parameters (optional).
-
- Parameters:
- ahshUom - a list of UOMs.
Feedback
(C) Copyright IBM Corporation 1996, 2005. All Rights Reserved.