com.ibm.commerce.emarketing.emailtemplate.commands

Class AllocatePromotionCodeCmdImpl

  • All Implemented Interfaces:
    com.ibm.commerce.command.CacheableECCommand, ECCommand, ECTargetableCommand, TaskCommand, AllocatePromotionCodeCmd, 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 AllocatePromotionCodeCmdImpl
    extends TaskCommandImpl
    implements AllocatePromotionCodeCmd
    This task command is used to allocate a promotion code from a promotion that has multiple promotion codes associated with the promotion. To use this command:
    1. Call setPromotionId() to set the promotion from which a code should be allocated.
    2. Optionally call setOwnerId() if the code should be assigned to a particular customer. Otherwise the code will be allocated, but will be unassigned.
    3. Call performExecute.
    4. Call getAllocatedPromotionCode to get the code that has been allocated. If no code has been allocated, then this method will return null.
    See Also:
    Serialized Form
    • Field Detail

      • COPYRIGHT

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

        public static final java.lang.String CLASSNAME
        The name of the class.
    • Constructor Detail

      • AllocatePromotionCodeCmdImpl

        public AllocatePromotionCodeCmdImpl()
    • Method Detail

      • getAndAllocatePromotionCode

        public java.lang.String getAndAllocatePromotionCode(java.lang.Integer promoId)
                                                     throws java.sql.SQLException,
                                                            javax.naming.NamingException
        This method attempts to get an unallocated code from the specified promotion. If a free code is found, then it is marked as allocated.
        Parameters:
        promoId - The ID of the promotion from which a promotion code should be allocated.
        Returns:
        The promotion code that has been allocated. If no code could be allocated, then null is returned.
        Throws:
        java.sql.SQLException - if there is a problem accessing to the database.
        javax.naming.NamingException - if there is a problem obtaining the data source.
      • getAllocatedPromotionCode

        public java.lang.String getAllocatedPromotionCode()
        This method gets the promotion code that has been allocated.
        Specified by:
        getAllocatedPromotionCode in interface AllocatePromotionCodeCmd
        Returns:
        The promotion code that has been allocated.
      • setPromotionId

        public void setPromotionId(java.lang.Integer newPromotionId)
        This method sets the promotion ID of the promotion from which a promotion code should be allocated.
        Specified by:
        setPromotionId in interface AllocatePromotionCodeCmd
        Parameters:
        newPromotionId - The ID of the promotion.
      • setOwnerId

        public void setOwnerId(java.lang.Long newOwnerId)
        This method sets the member ID of the customer to whom the allocated promotion code should be assigned. If the member ID is null, the promotion code is allocated, but is unassigned to a particular customer.
        Specified by:
        setOwnerId in interface AllocatePromotionCodeCmd
        Parameters:
        newOwnerId - The ID of the owner.
      • getOwnerId

        public java.lang.Long getOwnerId()
        This method gets the member ID of the customer to whom the allocated promotion code should be assigned. If the member ID is null, the promotion code is allocated, but is unassigned to a particular customer.
        Returns:
        The ID of the owner.
      • setBatchMode

        public void setBatchMode(boolean b)
        The methods sets if the e-mail containing the PromotionCode tag is being sent from an e-mail in batch mode. If the e-mail is not being sent in batch mode, then just one free promotion code is found and allocated. If the e-mail is being sent in a batch, then for performance reasons, 1000 free promotion codes are found, and stored in memory.
        Parameters:
        b - If the e-mail requesting a promotion code is being sent immediately.