Class CompositeGetContractUnitPriceCmdImpl

  • java.lang.Object
  • All Implemented Interfaces:,,,, GetContractSpecialPriceCmd, GetContractUnitPriceCmd, GetProductContractUnitPriceCmd,,

    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 <Next Implementation of> <Next Implementation of > <Next Implementation of> <Next Implementation of> <Next Implementation of > <Next Implementation of>

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

    • Field Detail


        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

        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()
        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
        performExecute in class
        Throws: - 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.