public final class OrderItemsCmdHelper
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
PRICEREF_COMPLETE_REFRESH
The price refresh flag in the store table.
|
static int |
PRICEREF_DEFAULT
The price refresh flag in the store table.
|
static int |
PRICEREF_MERGE_BEFORE_CAL
The price refresh flag in the store table.
|
static int |
PRICEREF_QUICK_COMPLETE_REFRESH
The price refresh flag in the store table.
|
static int |
PRICEREF_QUICK_REFRESH
The price refresh flag in the store table.
|
Constructor and Description |
---|
OrderItemsCmdHelper()
OrderProcessingHelper constructor.
|
Modifier and Type | Method and Description |
---|---|
static java.sql.Timestamp |
getEarliestShipTime(StoreAccessBean abStore)
This method gets the earliest ship time of a future order
for a given store.
|
static java.lang.String[] |
getEligibleTradingAgreements(CommandContext commandContext,
java.lang.Long memberId)
Obtains a list of eligible trading agreements to be used.
|
static double |
getInventoryOffsetInDays(java.lang.String storeId)
get the numeric value of the Inventory Allocation Offset in days for a given store
|
static java.lang.String |
getPriceFromConfigurator(java.util.Hashtable ihshQuantity,
java.util.Hashtable ihshDk_price,
java.util.Hashtable ihshComp_quantity,
java.util.Hashtable ihshComp_prices)
Get price from the BOM XML if price is locked from sterling configurator.
|
static OrderItemsCmdHelper |
getUniqueInstance()
Get the unique instance of the OrderItemsCmdHelper object.
|
static void |
handleKitPriceNotFoundException(OrderItemAccessBean abOrderItem,
java.lang.String aClassName)
Handles the Kit price not found exception.
|
static void |
insertOrderItemOffer(OrderItemAccessBean orderitemAB,
java.lang.Long[] offerIds)
Saves the offers that were used for searching the price for an order item.
|
static void |
insertOrderItemTrading(OrderItemAccessBean orderitemAB,
java.lang.Long[] tradingIds)
Saves the trading agreements that were used for searching the price for an order item.
|
static boolean |
isNonPriceLock(java.util.Hashtable ihash_dk_priceLock,
java.util.Hashtable ihash_Comp_priceLocks)
Check whether the price is not locked by sterling configurator
|
static boolean |
isPriceLock(java.util.Hashtable ihash_dk_priceLock,
java.util.Hashtable ihash_Comp_priceLocks)
Check whether the price is locked by sterling configurator
|
static boolean |
isPriceLock(java.lang.String[] comp_priceLocks)
Check whether the configuration is price locked.
|
static boolean |
isTradingAgreementValid(java.lang.Long tradingId,
java.lang.String[] eligibleTradingIds)
Verifies the input trading agreement against a list of eligible trading agreements.
|
static void |
notifyBlocker(boolean toBlock,
java.lang.Integer aStoreId,
CommandContext aContext,
java.lang.String aOrderId,
java.lang.String aBlockReasonCode,
java.lang.String aComment)
notify the order block manager of an override on an order
Invokes NotifyBlockCmd.
|
static java.lang.Long[] |
resolveTradingAgreements(CommandContext commandContext,
OrderItemAccessBean orderitemAB,
java.lang.Long[] tradingIds,
int refreshFlag)
Verifies and resolves a list of eligible trading agreements for the user.
|
static java.lang.Long[] |
retrieveOffers(OrderItemAccessBean anabOrderItem,
int anRefreshFlag)
Retrieves previously searched offers for an order item based on the Price Refresh Flag
(PRICEREFFLAGS) in STORE:
0: Default, same as 1 except that it will not save the offer id.
|
static java.lang.Long[] |
retrieveOffers(OrderItemAccessBean orderitemAB,
int refreshFlag,
boolean retryFlag)
Retrieves previously searched offers for an order item based on the Price Refresh Flag
(PRICEREFFLAGS) in STORE:
0: Default, same as 1 except that it will not save the offer id.
|
static java.lang.Long[] |
retrieveSearchedAndSavedOffers(OrderItemAccessBean anabOrderItem)
Retrieves previously searched offers for an order item.
|
static java.lang.Long[] |
retrieveSearchedAndSavedTradings(OrderItemAccessBean anabOrderItem,
CommandContext aCommandContext)
Retrieves previously searched valid trading agreements for an order item.
|
static java.lang.Long[] |
retrieveTradings(CommandContext aCommandContext,
OrderItemAccessBean anabOrderItem,
int anRefreshFlag)
This method calls the task command
RetrieveTradingsTaskCmd to retrieve previously searched trading agreements
for an orderitem based on the Price Refresh Flag (PRICEREFFLAGS) in STORE:
0: Default, same as 1 except that it will not save the trading agreement id. |
static java.lang.Long[] |
retrieveTradings(CommandContext commandContext,
OrderItemAccessBean orderitemAB,
int refreshFlag,
boolean retryFlag)
Retrieves previously searched trading agreements for an order item based on the Price Refresh Flag
(PRICEREFFLAGS) in STORE:
0: Default, same as 1 except that it will not save the trading agreement id.
|
static void |
setInventoryOffsetInDays(java.lang.String storeId,
double days)
set the Allocation Offset for a store by days
|
static java.lang.String |
toString(java.lang.Long[] anArr) |
static void |
updateContractId(OrderItemAccessBean orderitemAB,
StoreAccessBean storeAB)
Saves the default contract id that provided the price for the order item
(old support).
|
static void |
updateOrderItemConfigurations(java.util.Vector ivOrderItems,
CommandContext commandContext)
Updates order item configurations.
|
static void |
updateTotalProductPrice(OrderItemAccessBean orderitemAB)
Update the total price for the order item.
|
static void |
updateTradingId(OrderItemAccessBean orderitemAB,
StoreAccessBean storeAB,
java.lang.Long anTradingId)
Saves the trading agreement ids that provided the best price for the order item.
|
static int |
validatePrice(java.lang.Integer aStoreId,
CommandContext aContext,
java.lang.String aCurrency,
java.lang.Long aUserId,
java.lang.Long aCatEntry,
java.lang.String aPrice)
to validate if a price is valid by calling the
ValidateDelegatedPriceCmd by CSR/TSR.
|
static void |
verifyTradingIsStillValid(CommandContext theCommandContext,
OrderItemAccessBean theOrderItemAB)
Verifies that the trading id of the order item is still valid.
|
static void |
verifyTradingPaymentMethods(CommandContext commandContext,
java.util.Enumeration enOrderItemABs)
Validate the trading agreements used by the order items in an order.
|
static java.lang.Long[] |
verifyTradingPaymentMethods(CommandContext commandContext,
OrderItemAccessBean orderitemAB,
java.lang.Long[] tradingIds)
Verifies if the trading agreements used in the orderitem have defined
compatible payment methods with those trading agreements used
in the order.
|
public static final int PRICEREF_DEFAULT
public static final int PRICEREF_QUICK_REFRESH
public static final int PRICEREF_QUICK_COMPLETE_REFRESH
public static final int PRICEREF_COMPLETE_REFRESH
public static final int PRICEREF_MERGE_BEFORE_CAL
public OrderItemsCmdHelper()
public static java.lang.String[] getEligibleTradingAgreements(CommandContext commandContext, java.lang.Long memberId) throws ECException, java.sql.SQLException
The eligible list of trading agreements can be obtained directly from the Command Context. This case occurs if no member id is provided or the input member id is the one in Command Context. Else, they are retrieved by the member id if the id is provided and different from that in the Command Context.
commandContext
- the current command context.memberId
- the id of the member.
ECException
java.sql.SQLException
public static OrderItemsCmdHelper getUniqueInstance()
public static void insertOrderItemOffer(OrderItemAccessBean orderitemAB, java.lang.Long[] offerIds) throws ECException, java.sql.SQLException
orderitemAB
- the access bean of the order item.offerIds
- the ids of the offers to be saved.ECException
java.sql.SQLException
public static void insertOrderItemTrading(OrderItemAccessBean orderitemAB, java.lang.Long[] tradingIds) throws ECException, java.sql.SQLException
orderitemAB
- the access bean of the order item.tradingIds
- the ids of the tradings to be saved.ECException
java.sql.SQLException
public static boolean isTradingAgreementValid(java.lang.Long tradingId, java.lang.String[] eligibleTradingIds) throws ECException
tradingId
- the id of the trading agreement to be verified.eligibleTradingIds
- the ids of the list of eligible trading agreements.
ECException
public static java.lang.Long[] resolveTradingAgreements(CommandContext commandContext, OrderItemAccessBean orderitemAB, java.lang.Long[] tradingIds, int refreshFlag) throws ECException, java.sql.SQLException
If trading agreements are specified, the input list will be verified against the eligible list before they will be used.
If the orderitem is newly created but no trading agreements are specified. The trading agreements can be obtained from the Command Context if the input member id is the one in Command Context. Or they can be retrieved by the member id (if it is provided and different from that in the Command Context). Existing order item will have the price refreshed according to the price refresh flag.
commandContext
- the command context.orderitemAB
- the access bean of the order item.tradingIds
- the input trading agreement ids.refreshFlag
- the price refresh flag.
ECException
java.sql.SQLException
public static void verifyTradingIsStillValid(CommandContext theCommandContext, OrderItemAccessBean theOrderItemAB) throws ECException
theCommandContext
- The command context.theOrderItemAB
- The order item to check.ECException
- If the trading is no longer valid then this exception is raised with the message
_ERR_INVALID_TRADING.public static java.lang.Long[] retrieveOffers(OrderItemAccessBean orderitemAB, int refreshFlag, boolean retryFlag) throws ECException, java.sql.SQLException
orderitemAB
- the access bean of the order item.refreshFlag
- the price refresh flag.retryFlag
- the price calculation retry flag.
ECException
java.sql.SQLException
public static java.lang.Long[] retrieveOffers(OrderItemAccessBean anabOrderItem, int anRefreshFlag)
anabOrderItem
- the access bean of the order item.anRefreshFlag
- the price refresh flag.
public static java.lang.Long[] retrieveSearchedAndSavedOffers(OrderItemAccessBean anabOrderItem)
anabOrderItem
- the access bean of the order item.
public static java.lang.Long[] retrieveTradings(CommandContext aCommandContext, OrderItemAccessBean anabOrderItem, int anRefreshFlag) throws java.sql.SQLException, ECException
RetrieveTradingsTaskCmd
to retrieve previously searched trading agreements
for an orderitem based on the Price Refresh Flag (PRICEREFFLAGS) in STORE:
0: Default, same as 1 except that it will not save the trading agreement id.
1: This means useCurrentOnly. This uses the prices directly referenced by the OrderItems.
Fail if they can no longer be used.
2: This means useCurrentOrSearchAgain. This is the same as useCurrentOnly.
But instead of failing when they can no longer be used, it searches the ones that were
originally searched. That is, when the OrderItems were created or updated with new
trading agreement ids specified.
4: This means alwaysSearchAgain. This option always searches the prices that were
originally searched when the OrderItems were created or updated with new
trading agreement ids specified.
8: Before calling price command, sum the quantity for the order items with same catentry.
It will get the best price and update the orderitem tradingId.
It will not save the tradingId in the ORDITRD.
aCommandContext
- the current command context.anabOrderItem
- the access bean of the order item.anRefreshFlag
- the price refresh flag.
java.sql.SQLException
ECException
public static java.lang.Long[] retrieveSearchedAndSavedTradings(OrderItemAccessBean anabOrderItem, CommandContext aCommandContext) throws java.sql.SQLException, ECException
anabOrderItem
- the access bean of the order item.aCommandContext
- the current command context.
java.sql.SQLException
ECException
public static java.lang.String toString(java.lang.Long[] anArr)
public static java.lang.Long[] retrieveTradings(CommandContext commandContext, OrderItemAccessBean orderitemAB, int refreshFlag, boolean retryFlag) throws ECException, java.sql.SQLException
commandContext
- command context.orderitemAB
- the access bean of the order item.refreshFlag
- the price refresh flag.retryFlag
- the price calculation retry flag.
ECException
java.sql.SQLException
public static void updateContractId(OrderItemAccessBean orderitemAB, StoreAccessBean storeAB) throws ECException, java.sql.SQLException
orderitemAB
- the access bean of the order item.storeAB
- the access bean of the store.ECException
java.sql.SQLException
public static void updateTotalProductPrice(OrderItemAccessBean orderitemAB) throws ECException, java.sql.SQLException
orderitemAB
- OrderItemAccessBeanECException
java.sql.SQLException
public static void updateTradingId(OrderItemAccessBean orderitemAB, StoreAccessBean storeAB, java.lang.Long anTradingId)
orderitemAB
- the access bean of the order item.storeAB
- the access bean of the store.anTradingId
- the id of the trading agreement.public static java.lang.Long[] verifyTradingPaymentMethods(CommandContext commandContext, OrderItemAccessBean orderitemAB, java.lang.Long[] tradingIds) throws ECException
commandContext
- the command context.orderitemAB
- the access bean of the order item.tradingIds
- the trading agreement ids to be used in the order item.
ECException
public static void verifyTradingPaymentMethods(CommandContext commandContext, java.util.Enumeration enOrderItemABs) throws ECException
commandContext
- CommandContextenOrderItemABs
- EnumerationECException
public static java.sql.Timestamp getEarliestShipTime(StoreAccessBean abStore) throws ECException
abStore
- as StoreAccessBeanECException
public static double getInventoryOffsetInDays(java.lang.String storeId) throws ECException
storeId
- String of store entity Id such as "201"ECException
public static void setInventoryOffsetInDays(java.lang.String storeId, double days) throws ECException
storeId
- such as "201"days
- such as 1.5ECException
public static void notifyBlocker(boolean toBlock, java.lang.Integer aStoreId, CommandContext aContext, java.lang.String aOrderId, java.lang.String aBlockReasonCode, java.lang.String aComment) throws ECException
toBlock
- boolean, true for blocking, false for unblockingaStoreId
- IntegeraContext
- CommandContextaOrderId
- String orderIdaBlockReasonCode
- String predefinedaComment
- String commentECException
- propagated from the NotifyBlockCmdpublic static int validatePrice(java.lang.Integer aStoreId, CommandContext aContext, java.lang.String aCurrency, java.lang.Long aUserId, java.lang.Long aCatEntry, java.lang.String aPrice) throws ECException
aStoreId
- IntegeraContext
- CommandContextaCurrency
- StringaUserId
- LongaCatEntry
- LongaPrice
- StringECException
- propagated from ValidateDelegatedPriceCmdpublic static void handleKitPriceNotFoundException(OrderItemAccessBean abOrderItem, java.lang.String aClassName) throws ECException
abOrderItem
- OrderItemAccessBean.aClassName
- the name of the Class that detects the exception.ECException,
- FinderException, CreateException, NamingException, RemoteExceptionECException
public static boolean isPriceLock(java.util.Hashtable ihash_dk_priceLock, java.util.Hashtable ihash_Comp_priceLocks)
ihash_dk_priceLock
- pricelock of the dkihash_Comp_priceLocks
- pricelocks of the componentspublic static boolean isPriceLock(java.lang.String[] comp_priceLocks)
comp_priceLocks
- The price lock property of componentspublic static boolean isNonPriceLock(java.util.Hashtable ihash_dk_priceLock, java.util.Hashtable ihash_Comp_priceLocks)
ihash_dk_priceLock
- pricelock of the dkihash_Comp_priceLocks
- pricelocks of the componentspublic static java.lang.String getPriceFromConfigurator(java.util.Hashtable ihshQuantity, java.util.Hashtable ihshDk_price, java.util.Hashtable ihshComp_quantity, java.util.Hashtable ihshComp_prices)
ihshQuantity
- The quantity of the dk.ihshDk_price
- The price of the dk.ihshComp_quantity
- A list of component quantities.ihshComp_prices
- A list of component prices.public static void updateOrderItemConfigurations(java.util.Vector ivOrderItems, CommandContext commandContext) throws ECException
ivOrderItems
- the order items to be updated.commandContext
- command contextECException.
ECException