com.ibm.commerce.price.commands

Class CompositeGetContractUnitPriceCmdImpl

  • java.lang.Object
    • com.ibm.websphere.command.CacheableCommandImpl
  • All Implemented Interfaces:
    com.ibm.commerce.command.CacheableECCommand, com.ibm.commerce.command.ECCommand, com.ibm.commerce.command.ECTargetableCommand, com.ibm.commerce.command.TaskCommand, GetContractSpecialPriceCmd, GetContractUnitPriceCmd, GetProductContractUnitPriceCmd, com.ibm.websphere.command.CacheableCommand, com.ibm.websphere.command.Command


    public class CompositeGetContractUnitPriceCmdImpl
    extends AbstractGetPriceCmdImpl
    CompositeGetContractUnitPriceCmdImpl can merge the functions of two price command implementations.

    The two implementations are called the "primary" command and the "secondary" command. The expected default primary command implementation is PriceRuleGetContractUnitPriceCmdImpl, and the expected default secondary command implementation is GetContractUnitPriceCmdImpl. Although this command is not hard-coded to call these two implementations, the usePrimaryCommand(PriceInputCase) method behaves as though the primary command is PriceRuleGetContractUnitPriceCmdImpl, and the secondary command is any other implementation.

    To use this command, register the interface name in the command registry similar to the example below.

    Interface name Command
    com.ibm.commerce.price.commands.GetContractUnitPriceCmd com.ibm.commerce.price.commands.CompositeGetContractUnitPriceCmdImpl
    com.ibm.commerce.price.commands.GetProductContractUnitPriceCmd com.ibm.commerce.price.commands.CompositeGetContractUnitPriceCmdImpl
    com.ibm.commerce.price.commands.GetContractSpecialPriceCmd com.ibm.commerce.price.commands.CompositeGetContractUnitPriceCmdImpl
    com.ibm.commerce.price.commands.GetContractUnitPriceCmd+AfterCompositePrimary <Next Implementation of com.ibm.commerce.price.commands.GetContractUnitPriceCmd>
    com.ibm.commerce.price.commands.GetProductContractUnitPriceCmd+AfterCompositePrimary <Next Implementation of com.ibm.commerce.price.commands.GetProductContractUnitPriceCmd >
    com.ibm.commerce.price.commands.GetContractSpecialPriceCmd+AfterCompositePrimary <Next Implementation of com.ibm.commerce.price.commands.GetContractSpecialPriceCmd>
    com.ibm.commerce.price.commands.GetContractUnitPriceCmd+AfterCompositeSecondary <Next Implementation of com.ibm.commerce.price.commands.GetContractUnitPriceCmd>
    com.ibm.commerce.price.commands.GetProductContractUnitPriceCmd+AfterCompositeSecondary <Next Implementation of com.ibm.commerce.price.commands.GetProductContractUnitPriceCmd >
    com.ibm.commerce.price.commands.GetContractSpecialPriceCmd+AfterCompositeSecondary <Next Implementation of com.ibm.commerce.price.commands.GetContractSpecialPriceCmd>

    Note that this command can be called by other price commands to form a chain.

    • Field Detail

      • SUFFIX_AFTER_COMPOSITE_PRIMARY

        public static final java.lang.String SUFFIX_AFTER_COMPOSITE_PRIMARY
        Suffix for {@link #executeNextInChain(GetPriceCmdInput, String) which is called by this implementation for the primary command.
        See Also:
        Constant Field Values
      • SUFFIX_AFTER_COMPOSITE_SECONDARY

        public static final java.lang.String SUFFIX_AFTER_COMPOSITE_SECONDARY
        Suffix for {@link #executeNextInChain(GetPriceCmdInput, String) which is called by this implementation for the secondary command.
        See Also:
        Constant Field Values
    • Constructor Detail

      • CompositeGetContractUnitPriceCmdImpl

        public CompositeGetContractUnitPriceCmdImpl()
    • Method Detail

      • performExecute

        public void performExecute()
                            throws com.ibm.commerce.exception.ECException
        Splits the input between the two implementations, executes them both, then recombines them.

        Splitting is done by calling usePrimaryCommand(PriceInputCase) to decide which implementation gets what. Two commands are then both executed by calling #executeCommand(GetPriceCmdInput, String, PriceOutputCaseGetPriceCmdOutput) with the suffix SUFFIX_AFTER_COMPOSITE_PRIMARY and SUFFIX_AFTER_COMPOSITE_SECONDARY. Finally the output of the commands are combined and the result is used as the output of this 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 - If there was an error when calling usePrimaryCommand(PriceInputCase) or when executing either the primary or secondary command. This error will not be thrown if AbstractGetPriceCmdImpl.setErrorMode(boolean) was set to false.