com.ibm.commerce.promotion.uniquecode.commands

Class CreateUniquePromotionCodeCmdImpl

  • All Implemented Interfaces:
    com.ibm.commerce.command.CacheableECCommand, ECCommand, ECTargetableCommand, TaskCommand, CreateUniquePromotionCodeCmd, com.ibm.websphere.cache.Sizeable, com.ibm.websphere.command.CacheableCommand, com.ibm.websphere.command.Command, com.ibm.websphere.command.CommandCaller, com.ibm.websphere.command.TargetableCommand, java.io.Serializable


    public class CreateUniquePromotionCodeCmdImpl
    extends TaskCommandImpl
    implements CreateUniquePromotionCodeCmd
    This class will create a new unique promotion code for an existing promotion. A new unique promotion code will be created based on the code, store id and promotion id. These values are all required.
    See Also:
    Serialized Form
    • Constructor Detail

      • CreateUniquePromotionCodeCmdImpl

        public CreateUniquePromotionCodeCmdImpl()
    • Method Detail

      • performExecute

        public void performExecute()
                            throws ECApplicationException
        This method will create the new unique promotion code(s) for the specified promotion id. It will first get the next available key in PX_CDPOOL and use that as the promotion code id. Next it will insert a new unique promotion code using the values provided for the promotion id, code and store id. All codes created are created in the base schema.
        Specified by:
        performExecute in interface ECCommand
        Specified by:
        performExecute in interface com.ibm.websphere.command.TargetableCommand
        Overrides:
        performExecute in class AbstractECTargetableCommand
        Throws:
        ECApplicationException
      • setPromotionId

        public void setPromotionId(java.lang.String promotionId)
        Sets the promotion id that the promotion code is associated with.
        Specified by:
        setPromotionId in interface CreateUniquePromotionCodeCmd
        Parameters:
        promotionId - Promotion ID of the promotion that the code is associated with.
      • setStoreId

        public void setStoreId(java.lang.String storeId)
        Sets the store id that the promotion code belongs to.
        Specified by:
        setStoreId in interface CreateUniquePromotionCodeCmd
        Parameters:
        storeId - The store id that the promotion code belongs to.
      • setPromotionCode

        public void setPromotionCode(java.lang.String promotionCode)
        Sets the code for the promotion code. This is the value that the shopper enters to redeem the promotion code.
        Specified by:
        setPromotionCode in interface CreateUniquePromotionCodeCmd
        Parameters:
        promotionCode - The code for the promotion code.
      • getPxCdpoolId

        public java.lang.Long getPxCdpoolId()
        Returns the newly created promotion code's ID.
        Specified by:
        getPxCdpoolId in interface CreateUniquePromotionCodeCmd
        Returns:
        the newly created promotion code's ID. null if creation of the new code failed.
      • validateParameters

        public void validateParameters()
                                throws ECApplicationException
        This method validates that the required parameters, Promotion Id, Store Id and Promotion code have been specified. An ECApplicationException will be thrown in the case that either the Promotion ID or Promotion Code values have not been specified. In the case that the Store ID has not been set, the store id from the command context will be used instead.
        Specified by:
        validateParameters in interface ECCommand
        Overrides:
        validateParameters in class AbstractECTargetableCommand
        Throws:
        ECApplicationException
      • setPromotionCodes

        public void setPromotionCodes(java.util.List<java.lang.String> promotionCodes)
        Sets the codes for the promotion codes. This is the value that the shopper enters to redeem the promotion code. If a list of promotion codes is passed in, all promotion codes in the list will be created for the specified promotion.
        Specified by:
        setPromotionCodes in interface CreateUniquePromotionCodeCmd
        Parameters:
        promotionCodes -
      • getPxCdpoolIds

        public java.util.Map getPxCdpoolIds()
        Returns a map containing the Promotion Code to PX_CDPOOL_ID Mapping. Promotion Code being the Key and the PX_CDPOOL_ID is the value.
        Specified by:
        getPxCdpoolIds in interface CreateUniquePromotionCodeCmd
        Returns:
        Map of Promotion Code to PX_CDPOOL_ID. null if creation of new codes failed or if only one code was created.