com.ibm.commerce.negotiation.commands
Class AutoBidsTaskCmdImpl

java.lang.Object
  |
  +--CacheableCommandImpl
        |
        +--com.ibm.commerce.command.AbstractECTargetableCommand
              |
              +--com.ibm.commerce.command.TaskCommandImpl
                    |
                    +--com.ibm.commerce.negotiation.commands.ProcessTaskCmdImpl
                          |
                          +--com.ibm.commerce.negotiation.commands.AutoBidsTaskCmdImpl
All Implemented Interfaces:
AutoBidsTaskCmd, ECCommand, ECTargetableCommand, ProcessTaskCmd, TaskCommand

public class AutoBidsTaskCmdImpl
extends ProcessTaskCmdImpl
implements AutoBidsTaskCmd

The task command that computes and updates the prices of the bids that belong to auto-bids for a specified auction.

See Also:
Serialized Form

Field Summary
static java.lang.String COPYRIGHT
          Copyright statement.
static java.lang.String EC_AUTOBIDS_TASK_ERROR_VIEW_CMD
          The name for the error task.
protected  java.util.Vector winners
          The list of winners.
 
Fields inherited from class com.ibm.commerce.command. AbstractECTargetableCommand
commandContext
 
Fields inherited from interface com.ibm.commerce.negotiation.commands. AutoBidsTaskCmd
defaultCommandClassName, NAME
 
Fields inherited from interface com.ibm.commerce.command. ECCommand
defaultCommandClassName
 
Constructor Summary
AutoBidsTaskCmdImpl()
          AutoBidsTaskCmdImpl constructor.
 
Method Summary
protected  double allocateQuantity()
          Allocates the quantity on auction among the specified sorted list of bids.
protected  int calcExpectedBidCount()
          Calculates the expected number of bids to be retrieved required to fully allocate the auction quantity.
protected  void determineWinnersNextBidPrices()
          Determines the current potential bid winners's next bid prices for the current auction.
protected  java.util.Vector getWinners()
          Get the winner list.
protected  void handleException(java.lang.Exception e)
          Formats an ECException based on the input exception value.
 void performExecute()
          Auto Bids processing task.
 void reset()
          reset the command, so that it can be reused.
protected  java.util.Vector retrieveActiveBids(int count)
          Retrieve the specified number of active bids sorted by bid price/upper limit (desc), quantity (desc) and creation time (asc)
protected  void updateAuction(long auctionBookKeepTime)
          Update current auction highest/lowest winning bids, Lock flag and time.
 
Methods inherited from class com.ibm.commerce.negotiation.commands. ProcessTaskCmdImpl
getActiveBids, getAuction, getAuctionId, getDefaultBestBidValue, getDefaultBidCount, getErrorTaskName, isReadyToCallExecute, setActiveBids, setDataHandle, setErrorTaskName
 
Methods inherited from class com.ibm.commerce.command. AbstractECTargetableCommand
accessControlCheck, checkIsAllowed, checkParameters, checkResourcePermission, createCommandExecutionEvent, execute, finalize, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getResources, getStoreId, getUser, getUserId, setAccCheck, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties, validateParameters
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ibm.commerce.negotiation.commands. ProcessTaskCmd
setDataHandle, setErrorTaskName
 

Field Detail
public static final java.lang.String COPYRIGHT
Copyright statement.
See Also:
Constant Field Values

EC_AUTOBIDS_TASK_ERROR_VIEW_CMD

public static final java.lang.String EC_AUTOBIDS_TASK_ERROR_VIEW_CMD
The name for the error task.
See Also:
Constant Field Values

winners

protected java.util.Vector winners
The list of winners.
Constructor Detail

AutoBidsTaskCmdImpl

public AutoBidsTaskCmdImpl()
AutoBidsTaskCmdImpl constructor.
Method Detail

allocateQuantity

protected double allocateQuantity()
                           throws java.lang.Exception
Allocates the quantity on auction among the specified sorted list of bids.
Returns:
double - Remaining quantity after a complete round of allocation on target bids.
Throws:
java.lang.Exception

calcExpectedBidCount

protected int calcExpectedBidCount()
                            throws java.lang.Exception
Calculates the expected number of bids to be retrieved required to fully allocate the auction quantity.
Returns:
int - Expected number of bids to retrieve
Throws:
ECException - - Control Rule lookup error.
java.lang.Exception

determineWinnersNextBidPrices

protected void determineWinnersNextBidPrices()
                                      throws java.lang.Exception
Determines the current potential bid winners's next bid prices for the current auction.
Throws:
java.lang.Exception - - throws an exception when encounters an error during Determine Winner task processing.

getWinners

protected java.util.Vector getWinners()
Get the winner list.
Returns:
java.util.Vector

handleException

protected void handleException(java.lang.Exception e)
                        throws ECException
Formats an ECException based on the input exception value.
Overrides:
handleException in class ProcessTaskCmdImpl
Parameters:
e - Exception - The exception instance to be formatted.
Throws:
ECException - - could be one of many diffrenet exceptions: ECApplicationException. RemoteException, CreateException, FinderException, or NamingException.

performExecute

public void performExecute()
                    throws ECException
Auto Bids processing task.
Specified by:
performExecute in interface ECCommand
Overrides:
performExecute in class AbstractECTargetableCommand
Throws:
ECException - -

reset

public void reset()
reset the command, so that it can be reused.
Overrides:
reset in class ProcessTaskCmdImpl

retrieveActiveBids

protected java.util.Vector retrieveActiveBids(int count)
                                       throws ECException
Retrieve the specified number of active bids sorted by bid price/upper limit (desc), quantity (desc) and creation time (asc)
Parameters:
count - int - Number of active bids to retrieve. A zero count implies all active bids.
Returns:
Vector - A list of currently active bids for the current auction.
Throws:
ECException - - Exception on retrieving bids.

updateAuction

protected void updateAuction(long auctionBookKeepTime)
                      throws java.lang.Exception
Update current auction highest/lowest winning bids, Lock flag and time.
Parameters:
auctionBookKeepTime - long - Time of auction update.
Throws:
java.lang.Exception - - Exception on Auction update operation.