com.ibm.commerce.price.commands

Class FloorPriceLookupCmdImpl

  • java.lang.Object
    • com.ibm.websphere.command.CacheableCommandImpl
      • com.ibm.commerce.command.MeasuredCacheableCommandImpl
        • com.ibm.commerce.command.AbstractECTargetableCommand
          • com.ibm.commerce.command.TaskCommandImpl
            • com.ibm.commerce.price.commands.FloorPriceLookupCmdImpl
  • All Implemented Interfaces:
    com.ibm.commerce.command.CacheableECCommand, com.ibm.commerce.command.ECCommand, com.ibm.commerce.command.ECTargetableCommand, com.ibm.commerce.command.TaskCommand, FloorPriceLookupCmd, com.ibm.websphere.command.CacheableCommand, com.ibm.websphere.command.Command


    public class FloorPriceLookupCmdImpl
    extends com.ibm.commerce.command.TaskCommandImpl
    implements FloorPriceLookupCmd
    This FloorPriceLookupCmdImpl Task Command Implementation retrieves the floor price for a given catalog entry. The process goes like following

    Behaviour

    1) Retrieve all the entitled Delegation Grid IDs from the contract entitlement utility based on TSR ID and store ID;

    2) Resolve grid-memberGroup relationship:

           1      *
       TSR -------- MemberGroup
    
    and
           1      *
      Grid -------- MemberGroup(as participant);
    
    We proceed as follows:
    • Get all participants for each grid;
    • For each participant, check if its member is a member group of the current TSR.

    3) Retrieve the floor price via GetContractUnitPriceCmd for given contract IDs, which are the delegation grid IDs obtained previously.

    • If the catalog entry is a BUNDLE, the floor price is a sum over all its child entries, if anyone of the children has failed to be priced, the whole bundle will be not priced
    • If it is a DynamicKit, treat as Bundle
    • Any other cat-entry type, retrieve the floor price directly for the entry;

    4) Partition all retrieved contract prices on member group and pricelist

           1      *             1      *           1      *
       TSR -------- MemberGroup -------- PriceList -------- ContractPrice
    
    The last relationship is one-to-one in the current requirements, but we offer the more general classification.

    5) Select a price based on the following rules:

    • The lowest price wins among member-groups;
    • The highest price wins within a specific member-group;
    • The lowest price wins within a specific price-list.

    6) Validate the final selected price: if there is no price,

    • Error-Mode = true: throw ECApplicationException,
    • Error-Mode = false: log a warning message.

    7) Round/convert price.

    This command calls the following TaskCommands:

    This command uses the following AccessBeans:
    • BusinessPolicyAccessBean
    • CatalogEntryAccessBean
    • CatalogEntryRelationAccessBean
    • CatalogEntryShippingAccessBean
    • ContractAccessBean
    • MemberGroupMemberAccessBean
    • OrderItemComponentAccessBean
    • StoreAccessBean
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      java.lang.Long getCatEntryId()
      Returns the catEntryIds.
      java.lang.String getConfigurationID()
      Gets the configuration ID of a dynamic-kit
      java.lang.String getCurrency()
      Returns the currency.
      java.lang.String getCustomPartnumber()
      Returns the custom partnumber.
      boolean getErrorMode()
      Gets the flag to indicate if an exception will be thrown when the price cannot be found.
      MonetaryAmount getFloorPrice()
      Gets the floor price for the given catalog entry with the requested currency.
      QuantityAmount getQuantity()
      Gets a quantity object of the catalog entry.
      java.lang.Integer getStoreId()
      Get the store ID
      java.lang.Long getTSRId()
      Get the TSR ID
      void performExecute()
      Executes main business logic of the command.
      void reset() 
      void setCatEntryId(java.lang.Long aCatEntryID)
      Sets the catEntryIds.
      void setConfigurationID(java.lang.String aConfigID)
      Sets the configuration ID, if this catalog entry is a DynamicKit.
      void setCurrency(java.lang.String aCurrency)
      Sets the currency.
      void setCustomPartnumber(java.lang.String aCustomPartnumber)
      Sets the custom partnumber whose floor price is to be retrieved.
      void setErrorMode(boolean anErrorMode)
      Sets the flag to indicate if exception will be thrown when the price cannot be found for the input catentry (Optional).
      void setQuantity(QuantityAmount aQuantityAmount)
      Sets the quantity amount of the input catalog entry that is to be priced (Optional).
      void setStoreId(java.lang.Integer aStoreId)
      Set the store ID
      void setTSRId(java.lang.Long aTsrId)
      Set the TSR ID.
      void validateParameters()
      Check mandatory parameters.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from class com.ibm.commerce.command.AbstractECTargetableCommand

        accessControlCheck, checkIsAllowed, checkResourcePermission, createCommandExecutionEvent, execute, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getExceptionInvokeParameters, getObjectSize, getPostInvokeParameters, getPreInvokeParameters, getResources, getUser, getUserId, isReadyToCallExecute, setAccCheck, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties
      • Methods inherited from interface com.ibm.commerce.command.CacheableECCommand

        execute
      • Methods inherited from interface com.ibm.commerce.command.ECCommand

        checkIsAllowed, checkResourcePermission, createCommandExecutionEvent, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getExceptionInvokeParameters, getPostInvokeParameters, getPreInvokeParameters, getResources, getUser, getUserId, setAccCheck, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties
    • Field Detail

      • COPYRIGHT

        public static final java.lang.String COPYRIGHT
        IBM copyright notice field.
        See Also:
        Constant Field Values
    • Constructor Detail

      • FloorPriceLookupCmdImpl

        public FloorPriceLookupCmdImpl()
    • Method Detail

      • getCatEntryId

        public java.lang.Long getCatEntryId()
        Returns the catEntryIds.
        Returns:
        Long[]
      • getConfigurationID

        public java.lang.String getConfigurationID()
        Gets the configuration ID of a dynamic-kit
        Returns:
        String
      • getCurrency

        public java.lang.String getCurrency()
        Returns the currency.
        Specified by:
        getCurrency in interface FloorPriceLookupCmd
        Returns:
        String
        Throws:
        com.ibm.commerce.exception.ECSystemException
      • getCustomPartnumber

        public java.lang.String getCustomPartnumber()
        Returns the custom partnumber.
        Returns:
        String
      • getErrorMode

        public boolean getErrorMode()
        Gets the flag to indicate if an exception will be thrown when the price cannot be found.
        Returns:
        boolean true is an exception will be thrown, false otherwise
      • getFloorPrice

        public MonetaryAmount getFloorPrice()
        Gets the floor price for the given catalog entry with the requested currency.
        Specified by:
        getFloorPrice in interface FloorPriceLookupCmd
        Returns:
        A MonetaryAmount for the catalog entry.
      • getQuantity

        public QuantityAmount getQuantity()
        Gets a quantity object of the catalog entry.
        Returns:
        A QuantityAmount for the catalog entry.
      • getStoreId

        public java.lang.Integer getStoreId()
        Get the store ID
        Specified by:
        getStoreId in interface com.ibm.commerce.command.ECCommand
        Overrides:
        getStoreId in class com.ibm.commerce.command.AbstractECTargetableCommand
        Returns:
        Integer A store ID
      • getTSRId

        public java.lang.Long getTSRId()
        Get the TSR ID
        Returns:
        Long a TSR ID
      • performExecute

        public void performExecute()
                            throws com.ibm.commerce.exception.ECException
        Executes main business logic of the command.

        Specified by:
        performExecute in interface com.ibm.commerce.command.ECCommand
        Overrides:
        performExecute in class com.ibm.commerce.command.AbstractECTargetableCommand
        Throws:
        com.ibm.commerce.exception.ECException
      • reset

        public void reset()
        Overrides:
        reset in class com.ibm.commerce.command.AbstractECTargetableCommand
        See Also:
        com.ibm.websphere.command.Command#reset()
      • setCatEntryId

        public void setCatEntryId(java.lang.Long aCatEntryID)
        Sets the catEntryIds.
        Specified by:
        setCatEntryId in interface FloorPriceLookupCmd
        Parameters:
        aCatEntryID - The catEntryIds to set
      • setConfigurationID

        public void setConfigurationID(java.lang.String aConfigID)
        Sets the configuration ID, if this catalog entry is a DynamicKit. (Optional)
        Specified by:
        setConfigurationID in interface FloorPriceLookupCmd
        Parameters:
        aConfigID - A String of pre-configuration ID for a DynamicKit
      • setCurrency

        public void setCurrency(java.lang.String aCurrency)
        Sets the currency.
        Specified by:
        setCurrency in interface FloorPriceLookupCmd
        Parameters:
        aCurrency - The currency to set
      • setCustomPartnumber

        public void setCustomPartnumber(java.lang.String aCustomPartnumber)
        Sets the custom partnumber whose floor price is to be retrieved.
        Specified by:
        setCustomPartnumber in interface FloorPriceLookupCmd
        Parameters:
        aCustomPartnumber - The custom partnumber.
      • setErrorMode

        public void setErrorMode(boolean anErrorMode)
        Sets the flag to indicate if exception will be thrown when the price cannot be found for the input catentry (Optional).
        Specified by:
        setErrorMode in interface FloorPriceLookupCmd
        Parameters:
        anErrorMode - true if throw exceptions
      • setQuantity

        public void setQuantity(QuantityAmount aQuantityAmount)
        Sets the quantity amount of the input catalog entry that is to be priced (Optional).
        Specified by:
        setQuantity in interface FloorPriceLookupCmd
        Parameters:
        aQuantityAmount - The quantity amount of the catalog entry.
      • setStoreId

        public void setStoreId(java.lang.Integer aStoreId)
        Set the store ID
        Specified by:
        setStoreId in interface FloorPriceLookupCmd
        Parameters:
        aStoreId - A store ID, if not provided, get from the CommandContext.
      • setTSRId

        public void setTSRId(java.lang.Long aTsrId)
        Set the TSR ID. If not provided, uses the user ID from CommandContext as TSR ID.
        Specified by:
        setTSRId in interface FloorPriceLookupCmd
        Parameters:
        aTsrId - Long A TSR ID
      • validateParameters

        public void validateParameters()
                                throws com.ibm.commerce.exception.ECException
        Check mandatory parameters.
        Specified by:
        validateParameters in interface com.ibm.commerce.command.ECCommand
        Overrides:
        validateParameters in class com.ibm.commerce.command.AbstractECTargetableCommand
        Throws:
        com.ibm.commerce.exception.ECException