com.ibm.commerce.emarketing.engine

Class EmailJobKeeper

  • java.lang.Object
    • com.ibm.commerce.emarketing.engine.EmailJobKeeper


  • public class EmailJobKeeper
    extends java.lang.Object
    This class is used to keep all the information about a email-sending-job, it include the mail account information, such as host name, port number, user-name, password, reply-to address, etc. When a new sending job stared by scheduling-command (SendEmailActivityTaskImpl, EmailIndividualCreateCmdImpl, ResendEmailActivityTaskCmdImpl), it will initialize a Email-Job-Keeper for its own kind (according to class type), that means, at one time, there can only have one Email-Job-Keeper for each type of scheduling-command, this is guaranteed by the factory method "EmailJobKeeper.getInstance". During the Email-Job-Keeper initializing for a new email-sending-job, it will try to find all recipients from the email-recipient-supplier which can give a query to looking for (ListEmailRecipientsInMemberGroupTaskCmd) or just give you the list of recipients (ListEmailRecipientsInMemberGroupTaskCmd). To deal with large volume email-sending-job that may need hours to finish, and satisfy the schedule-job transaction timeout limitation on WebSphere Commerce's Scheduler system, one big email-sending-job may be split into multiple scheduler-job like below: 1) For every schedule, the Email-Job-Keeper will prepare a limited number of recipients to be sent under this schedule. (Here, we set the limitation to 20K, because 20K is close to the batch limitation of "CheetahMail system" which we try to integrate with WebSphere Commerce server). 2) After one schedule of email-sending, the Email-Job-Keeper provide a method for the scheduling-command (SendEmailActivityTaskImpl, EmailIndividualCreateCmdImpl) to do a final check whether the whole email-sending job is done or not, if not, a new schedule job will be arranged to continue sending more e-mails after a while. In a sending schedule, after the scheduling-command like SendEmailActivityTaskImpl get the Email-Job-Keeper, it will call "addToQueues" to fetch all the recipients that Email-Job-Keeper prepare for current schedule, to a sending queue, then the scheduling-command can call sending mail to each of them. From the definition of the email template (table EMLMSG), the Email-Job-Keep can also find out how much sending-thread the administrator want to use to send all these mails, As the multi-thread can only increase some the sending speed, if you use too many threads (over 10) it will actually spend more system resource than increase the performance; So we suggest not use multi-thread to do the sending, and if you specify more than 10 in the email template (table EMLMSG), the Email-Job-Keeper will only use 10.
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static int BATCH_SIZE_FOR_ONE_SCHEDULE
      BATCH SIZE FOR ONE SCHEDULE
      static java.lang.String CONFIG_SMTP_USE_SSL
      Constant for the configuration in \xml\config\com.ibm.commerce.marketing\wc-admin.component.xml to specify that when connecting to the SMTP server for a store, SSL should be used for the connection.
      static java.lang.String CONTENT_GENERIC
      Property - generic content
      static java.lang.String CONTINUEJOB
      The parameter name for Email sending job - identify this job is a continuing of a existing batch job.
      static java.lang.String COPYRIGHT
      Copyright.
      static java.lang.String DELETE_MEMBER_GROUP_AFTER_SEND
      The parameter name for Email sending job - delete member group after send
      static java.lang.String EMAIL_PROMOTION_MEMBER_GROUP_ID
      The parameter name for Email sending job - email promotion member group ID
      static java.lang.String EMLPROMO_ID
      The parameter name for Email sending job - email promotion id
      static java.lang.String PROPERTY_THREADCOUNT
      Property - THREADCOUNT
      static java.lang.String STORE_ID
      The parameter name for Email sending job - store id
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void addRecipient(javax.mail.Message.RecipientType recipientType, javax.mail.Address[] addresses)
      This method is to be used by customizations that want to set the CC or BCC recipients on the MimeMessage used to send a marketing email.
      void addToQueues(java.util.List[] queues)
      This method assign email-sending job [the e-mail target content (user Id, email1, email2)] in one schedule evenly to the sending-queues which are used in different sending threads.
      static void clean(EmailRecipientSupplier sendingJobType, long id)
      This method help to clean the on-going instance.
      static void cleanThreadLocalResources()
      This method is used to release the resource in thread local pool.
      static void cleanUpPromotionIdToAvailableCodesMap()
      This method cleans up the in memory objects containing available unique promotion codes.
      void finish()
      This method set the sending count on the batch job finish, and prepare the next batch job if there are more email to be sent.
      boolean getAuthentication()
      Returns true if authentication with the SMTP server will be attempted, false otherwise.
      static java.io.ByteArrayOutputStream getByteArrayOutputStreamForCurrentThread()
      This method help to reuse a heavy ByteArrayOutputStream for every thread.
      static com.ibm.commerce.messaging.composer.Composer getComposerForCurrentThread(java.lang.String view, com.ibm.commerce.command.CommandContext comContext, com.ibm.commerce.datatype.TypedProperty properties)
      This method help to reuse the Composer instance for every thread, and set the parameters of that composer.
      java.util.Map<javax.mail.Message.RecipientType,javax.mail.Address[]> getCustomRecipients()
      Get the custom message recipients.
      java.lang.Object getEmailPromotionId()
      Get the email promotion Id.
      java.lang.String getEmailPromotionName()
      Get the email promotion name.
      int getEmailRecipientListSize()
      Get the number of recipients to whom to send the e-mail
      java.util.Map getHeaders()
      Get the message headers.
      java.lang.String getHost()
      Gets the host name of the SMTP server.
      static EmailJobKeeper getInstance(EmailRecipientSupplier sendingJobType, long id)
      This method get the on-going instance of this class
      int getNumberOfThreads()
      Get the number of thread used to send email.
      java.lang.String getPassword()
      Gets the user account password used on the SMTP server.
      PersonalizedEmailContent getPersonalizedEmailContent()
      Get the personalized email content.
      static java.util.Stack<PoolIdAndCode> getPoolIdAndCodeStack(java.lang.Integer promoId)
      This method returns the Stack containing PoolIdAndCode objects.
      int getPort()
      Gets the port number through which the connection to the SMTP server will be attempted.
      java.lang.String getReplyTo()
      Gets the e-mail address that will be placed in the replyTo field of the e-mail message.
      java.lang.String getSender()
      Gets the e-mail address that is placed in the sender field of the e-mail message.
      java.util.Map getSmtpSessionProperties()
      This method returns the map with the additional properties to use when setting up the SMTP Session.
      PurgingStringBuffer getSuccessfulRecipientReportBuffer()
      This method return the successful recipient report buffer.
      static TagEngine getTagEngineForCurrentThread()
      This method help to reuse the TagEngine instance for every thread.
      java.lang.String getUser()
      Gets the user account name used on the SMTP server.
      void prepareBatch(int ePromId, java.util.Map triggerParas, java.lang.String reply, int msgIdInEntityType, boolean dupEmailFilter, boolean tryRecordSuccessfulRecipients, com.ibm.commerce.command.CommandContext cc)
      This method prepare the mail list to be send, if the list is empty.
      void prepareBatch(int ePromId, java.lang.String ePromoName, java.util.Map triggerParas, java.lang.String reply, int msgIdInEntityType, boolean dupEmailFilter, boolean tryRecordSuccessfulRecipients, com.ibm.commerce.command.CommandContext cc)
      This method prepare the mail list to be send, if the list is empty.
      static void putPoolIdAndCodeStack(java.lang.Integer promoId, java.util.Stack<PoolIdAndCode> poolIdAndCodeStack)
      This method associates the Stack containing PoolIdAndCode objects with a promotion.
      void setDeleteMemberGroupAfterSend(boolean del)
      This method sets if the member group associated with the e-mail promotion should be deleted after the e-mails have been sent.
      void setEmailPromoMemberGroupId(java.lang.String mbrGrpId)
      This method sets the member group to whom the e-mail is being sent.
      void setJobHost(java.lang.String host)
      This method sets the scheduled job host, that is used to tell which host to run the mail schedule-job; If the job host is empty or null, the host set in email configuration table will be used.
      void setNewHeader(java.lang.String name, java.lang.String value)
      Set a new header for the message.
      void setReplyTo(java.lang.String r)
      This method sets the e-mail address to be specified as the reply-to of the e-mail.
      void setSender(java.lang.String s)
      This method sets the e-mail address to be specified as the sender of the e-mail.
      void setSmtpSessionProperties(java.util.Map properties)
      This method checks the marketing wc-admin.component.xml file for the useSSLForSMTPAuthentication- setting.
      void startNewBatch(int ePromId, java.util.Map triggerParas, java.lang.String reply, int msgIdInEntityType, boolean dupEmailFilter, boolean tryRecordSuccessfulRecipients, com.ibm.commerce.command.CommandContext cc)
      This method prepare the mail list to be send, if the list is empty.
      void startNewBatch(int ePromId, java.lang.String ePromoName, java.util.Map triggerParas, java.lang.String reply, int msgIdInEntityType, boolean dupEmailFilter, boolean tryRecordSuccessfulRecipients, com.ibm.commerce.command.CommandContext cc)
      This method prepare the mail list to be send, if the list is empty.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • BATCH_SIZE_FOR_ONE_SCHEDULE

        public static final int BATCH_SIZE_FOR_ONE_SCHEDULE
        BATCH SIZE FOR ONE SCHEDULE
        See Also:
        Constant Field Values
      • CONFIG_SMTP_USE_SSL

        public static final java.lang.String CONFIG_SMTP_USE_SSL
        Constant for the configuration in \xml\config\com.ibm.commerce.marketing\wc-admin.component.xml to specify that when connecting to the SMTP server for a store, SSL should be used for the connection. In wc-admin.component.xml, set useSSLForSMTPAuthentication- to true to use an SSL connection. For example, for store with ID 10001:
         <_config:property name="useSSLForSMTPAuthentication-10001" value="true"/>
         
        See Also:
        Constant Field Values
      • CONTENT_GENERIC

        public static final java.lang.String CONTENT_GENERIC
        Property - generic content
        See Also:
        Constant Field Values
      • CONTINUEJOB

        public static final java.lang.String CONTINUEJOB
        The parameter name for Email sending job - identify this job is a continuing of a existing batch job.
        See Also:
        Constant Field Values
      • DELETE_MEMBER_GROUP_AFTER_SEND

        public static final java.lang.String DELETE_MEMBER_GROUP_AFTER_SEND
        The parameter name for Email sending job - delete member group after send
        See Also:
        Constant Field Values
      • EMAIL_PROMOTION_MEMBER_GROUP_ID

        public static final java.lang.String EMAIL_PROMOTION_MEMBER_GROUP_ID
        The parameter name for Email sending job - email promotion member group ID
        See Also:
        Constant Field Values
      • EMLPROMO_ID

        public static final java.lang.String EMLPROMO_ID
        The parameter name for Email sending job - email promotion id
        See Also:
        Constant Field Values
      • PROPERTY_THREADCOUNT

        public static final java.lang.String PROPERTY_THREADCOUNT
        Property - THREADCOUNT
        See Also:
        Constant Field Values
      • STORE_ID

        public static final java.lang.String STORE_ID
        The parameter name for Email sending job - store id
        See Also:
        Constant Field Values
    • Method Detail

      • addRecipient

        public void addRecipient(javax.mail.Message.RecipientType recipientType,
                                 javax.mail.Address[] addresses)
        This method is to be used by customizations that want to set the CC or BCC recipients on the MimeMessage used to send a marketing email.

        The following is an example of a customization to set a BCC email address when sending a marketing email.

        A) When sending a marketing e-mail from a dialog activity when the "Send immediately" checkbox is selected:

        1. Create a custom class that extends the class EmailIndividualCreateCmdImpl. Implement the method sendEmailDirectly to update the MimeMessage on the EmailJobKeeper object.
              package com.custom.marketing;
              import javax.mail.Address;
              import javax.mail.Message;
              import javax.mail.internet.AddressException;
              import javax.mail.internet.InternetAddress;
              import com.ibm.commerce.emarketing.commands.EmailIndividualCreateCmdImpl;
              import com.ibm.commerce.emarketing.engine.EmailJobKeeper;
              import com.ibm.commerce.exception.ECException;
          
              //insert into cmdreg (storeent_id, interfacename, classname) values (0,'com.ibm.commerce.emarketing.commands.EmailIndividualCreateCmd', 'com.custom.marketing.ExtEmailIndividualCreateCmdImpl');
          
              public class ExtEmailIndividualCreateCmdImpl extends EmailIndividualCreateCmdImpl {
          
                      protected void sendEmailDirectly(EmailJobKeeper mailJobKeeper) throws ECException {
          
                              try {
                                      Address[] addresses = new Address[] { new InternetAddress("me@mycompany.com") };
                                      mailJobKeeper.addRecipient(Message.RecipientType.BCC, addresses);
                              } catch (AddressException e) {
                                      // do nothing
                              }
          
                              super.sendEmailDirectly(mailJobKeeper);
                      }
              }
          
        2. Register the custom class in the CMDREG table.
               insert into cmdreg (storeent_id, interfacename, classname) values (0, 'com.ibm.commerce.emarketing.commands.EmailIndividualCreateCmd', 'com.custom.marketing.ExtEmailIndividualCreateCmdImpl');
          

        B) When sending a marketing e-mail from a dialog activity when the "Send immediately" checkbox not is selected, or when sending a marketing e-mail from an e-mail activity.

        1. Create a custom class that extends the class SendEmailActivityTaskCmdImpl. Implement the method sendEmail to update the MimeMessage on the EmailJobKeeper object.
              package com.custom.marketing;
              import javax.mail.Address;
              import javax.mail.Message;
              import javax.mail.internet.AddressException;
              import javax.mail.internet.InternetAddress;
              import com.ibm.commerce.emarketing.commands.SendEmailActivityTaskCmdImpl;
              import com.ibm.commerce.emarketing.engine.EmailJobKeeper;
              import com.ibm.commerce.exception.ECException;
          
              //insert into cmdreg (storeent_id, interfacename, classname) values (0, 'com.ibm.commerce.emarketing.commands.SendEmailActivityTaskCmd', 'com.custom.marketing.ExtSendEmailActivityTaskCmdImpl');
          
              public class ExtSendEmailActivityTaskCmdImpl extends SendEmailActivityTaskCmdImpl {
          
                      protected void sendEmail(EmailJobKeeper mailJobKeeper) throws ECException {
          
                              try {
                                      Address[] addresses = new Address[] { new InternetAddress("me@mycompany.com") };
                                      mailJobKeeper.addRecipient(Message.RecipientType.BCC, addresses);
                              } catch (AddressException e) {
                                      // do nothing
                              }
          
                              super.sendEmail(mailJobKeeper);
                      }
              }
          
        2. Create a custom class that extends the class ResendEmailActivityTaskCmdImpl. Implement the method sendEmail to update the MimeMessage on the EmailJobKeeper object.
              package com.custom.marketing;
              import javax.mail.Address;
              import javax.mail.Message;
              import javax.mail.internet.AddressException;
              import javax.mail.internet.InternetAddress;
              import com.ibm.commerce.emarketing.commands.ResendEmailActivityTaskCmdImpl;
              import com.ibm.commerce.emarketing.engine.EmailJobKeeper;
              import com.ibm.commerce.exception.ECException;
          
              //insert into cmdreg (storeent_id, interfacename, classname) values (0, 'com.ibm.commerce.emarketing.commands.ResendEmailActivityTaskCmd', 'com.custom.marketing.ExtResendEmailActivityTaskCmdImpl');
          
              public class ExtResendEmailActivityTaskCmdImpl extends ResendEmailActivityTaskCmdImpl {
          
                      protected void sendEmail(EmailJobKeeper mailJobKeeper) throws ECException {
          
                              try {
                                      Address[] addresses = new Address[] { new InternetAddress("me@mycompany.com") };
                                      mailJobKeeper.addRecipient(Message.RecipientType.BCC, addresses);
                              } catch (AddressException e) {
                                      // do nothing
                              }
          
                              super.sendEmail(mailJobKeeper);
                      }
          
              }
          
        3. Register the custom classes in the CMDREG table.
              insert into cmdreg (storeent_id, interfacename, classname) values (0, 'com.ibm.commerce.emarketing.commands.SendEmailActivityTaskCmd', 'com.custom.marketing.ExtSendEmailActivityTaskCmdImpl');
          
              insert into cmdreg (storeent_id, interfacename, classname) values (0, 'com.ibm.commerce.emarketing.commands.ResendEmailActivityTaskCmd', 'com.custom.marketing.ExtResendEmailActivityTaskCmdImpl');
          

Parameters:
recipientType - The recipient type.
addresses - The list of email addresses.
  • addToQueues

    public void addToQueues(java.util.List[] queues)
    This method assign email-sending job [the e-mail target content (user Id, email1, email2)] in one schedule evenly to the sending-queues which are used in different sending threads.
    Parameters:
    queues - The queue lists the email recipients.
  • clean

    public static void clean(EmailRecipientSupplier sendingJobType,
                             long id)
    This method help to clean the on-going instance.
    Parameters:
    sendingJobType - the EmailRecipientSupplier object is the type for the sending job, one type should only have one on-going sending job.
    id - the task id.
  • cleanThreadLocalResources

    public static void cleanThreadLocalResources()
    This method is used to release the resource in thread local pool.
  • cleanUpPromotionIdToAvailableCodesMap

    public static void cleanUpPromotionIdToAvailableCodesMap()
    This method cleans up the in memory objects containing available unique promotion codes. This should be called at the end of sending a batch e-mail. This method is called by the class EmailActivitySendCmdImpl after completing the sending of an e-mail in an e-mail activity.
  • finish

    public void finish()
    This method set the sending count on the batch job finish, and prepare the next batch job if there are more email to be sent.
  • getAuthentication

    public boolean getAuthentication()
    Returns true if authentication with the SMTP server will be attempted, false otherwise.
    Returns:
    true if the distributor will attempt to authenticate with the server prior t distribution; false if the distributor will not authenticate prior to distribution.
  • getByteArrayOutputStreamForCurrentThread

    public static java.io.ByteArrayOutputStream getByteArrayOutputStreamForCurrentThread()
    This method help to reuse a heavy ByteArrayOutputStream for every thread.
    Returns:
    the ByteArrayOutputStream for current thread.
  • getComposerForCurrentThread

    public static com.ibm.commerce.messaging.composer.Composer getComposerForCurrentThread(java.lang.String view,
                                                                                           com.ibm.commerce.command.CommandContext comContext,
                                                                                           com.ibm.commerce.datatype.TypedProperty properties)
    This method help to reuse the Composer instance for every thread, and set the parameters of that composer.
    Parameters:
    view - the view name of the composer.
    comContext - the command context of the composer.
    properties - the properties of the composer.
    Returns:
    the Composer instance for current thread
  • getCustomRecipients

    public java.util.Map<javax.mail.Message.RecipientType,javax.mail.Address[]> getCustomRecipients()
    Get the custom message recipients. This will set the CC or BCC recipients when sending the marketing email.
    Returns:
    The map contains the custom message recipients.
  • getEmailPromotionId

    public java.lang.Object getEmailPromotionId()
    Get the email promotion Id.
    Returns:
    the email promotion Id
  • getEmailPromotionName

    public java.lang.String getEmailPromotionName()
    Get the email promotion name.
    Returns:
    the email promotion name.
  • getEmailRecipientListSize

    public int getEmailRecipientListSize()
    Get the number of recipients to whom to send the e-mail
    Returns:
    The number of recipients to whom to send the e-mail
  • getHeaders

    public java.util.Map getHeaders()
    Get the message headers.
    Returns:
    the map contains the message headers.
  • getHost

    public java.lang.String getHost()
    Gets the host name of the SMTP server.
    Returns:
    the host name the distributor will use to connect to the SMTP server.
  • getInstance

    public static EmailJobKeeper getInstance(EmailRecipientSupplier sendingJobType,
                                             long id)
    This method get the on-going instance of this class
    Parameters:
    sendingJobType - the EmailRecipientSupplier object is the type for the sending job, one type should only have one on-going sending job.
    id - the task id.
    Returns:
    the instance for the sendingJobType class.
  • getNumberOfThreads

    public int getNumberOfThreads()
    Get the number of thread used to send email.
    Returns:
    the number of thread used to send email
  • getPassword

    public java.lang.String getPassword()
    Gets the user account password used on the SMTP server. This will only be used if getAuthenication() returns true.
    Returns:
    the password the distributor will use.
  • getPersonalizedEmailContent

    public PersonalizedEmailContent getPersonalizedEmailContent()
    Get the personalized email content.
    Returns:
    the personalized email content.
  • getPoolIdAndCodeStack

    public static java.util.Stack<PoolIdAndCode> getPoolIdAndCodeStack(java.lang.Integer promoId)
    This method returns the Stack containing PoolIdAndCode objects. Each PoolIdAndCode object represents an available unique promotion code that can be assigned to a customer. The stack contains a subset of the entire set of available promotion codes. Available promotion codes are added to the stack in batches of up to 1000 codes in the class AllocatePromotionCodeCmdImpl.
    Parameters:
    promoId - The promotion ID for which to get the stack of available promotion codes.
    Returns:
    A stack containing PoolIdAndCode objects.
  • getPort

    public int getPort()
    Gets the port number through which the connection to the SMTP server will be attempted.
    Returns:
    the port number the distributor will use.
  • getReplyTo

    public java.lang.String getReplyTo()
    Gets the e-mail address that will be placed in the replyTo field of the e-mail message. This is address the address to which e-mail replies will be sent.
    Returns:
    The replyTo e-mail address
  • getSender

    public java.lang.String getSender()
    Gets the e-mail address that is placed in the sender field of the e-mail message. This is the account that will receive messages from the SMTP server.
    Returns:
    The sender e-mail address.
  • getSmtpSessionProperties

    public java.util.Map getSmtpSessionProperties()
    This method returns the map with the additional properties to use when setting up the SMTP Session.
    Returns:
    A map of string names and string values.
  • getSuccessfulRecipientReportBuffer

    public PurgingStringBuffer getSuccessfulRecipientReportBuffer()
    This method return the successful recipient report buffer.
    Returns:
    the successful recipient report buffer.
  • getTagEngineForCurrentThread

    public static TagEngine getTagEngineForCurrentThread()
    This method help to reuse the TagEngine instance for every thread.
    Returns:
    the TagEngine instance for current thread
  • getUser

    public java.lang.String getUser()
    Gets the user account name used on the SMTP server.
    Returns:
    the account the distributor will use.
  • prepareBatch

    public void prepareBatch(int ePromId,
                             java.util.Map triggerParas,
                             java.lang.String reply,
                             int msgIdInEntityType,
                             boolean dupEmailFilter,
                             boolean tryRecordSuccessfulRecipients,
                             com.ibm.commerce.command.CommandContext cc)
                      throws com.ibm.commerce.exception.ECException
    This method prepare the mail list to be send, if the list is empty. This version used for case that the user do not need ePromoName.
    Parameters:
    ePromId - the email activity id.
    triggerParas - the trigger parameters.
    reply - the reply to.
    msgIdInEntityType - the message id in Entitytype.
    dupEmailFilter - the flag to tell if filter the duplicated mails.
    tryRecordSuccessfulRecipients - the flag to tell if try to record the successful recipient in mail-sending.
    cc - the command context.
    Throws:
    com.ibm.commerce.exception.ECException
  • prepareBatch

    public void prepareBatch(int ePromId,
                             java.lang.String ePromoName,
                             java.util.Map triggerParas,
                             java.lang.String reply,
                             int msgIdInEntityType,
                             boolean dupEmailFilter,
                             boolean tryRecordSuccessfulRecipients,
                             com.ibm.commerce.command.CommandContext cc)
                      throws com.ibm.commerce.exception.ECException
    This method prepare the mail list to be send, if the list is empty.
    Parameters:
    ePromId - the email activity id.
    ePromoName - the email activity Name.
    triggerParas - the trigger parameters.
    reply - the reply to.
    msgIdInEntityType - the message id in Entitytype.
    dupEmailFilter - the flag to tell if filter the duplicated mails.
    tryRecordSuccessfulRecipients - the flag to tell if try to record the successful recipient in mail-sending.
    cc - the command context.
    Throws:
    com.ibm.commerce.exception.ECException
  • putPoolIdAndCodeStack

    public static void putPoolIdAndCodeStack(java.lang.Integer promoId,
                                             java.util.Stack<PoolIdAndCode> poolIdAndCodeStack)
    This method associates the Stack containing PoolIdAndCode objects with a promotion. Each PoolIdAndCode object represents an available unique promotion code that can be assigned to a customer. The stack contains a subset of the entire set of available promotion codes. Available promotion codes are added to the stack in batches of up to 1000 codes in the class AllocatePromotionCodeCmdImpl.
    Parameters:
    promoId - The promotion ID for which to assign the stack of available promotion codes.
    poolIdAndCodeStack - A stack containing PoolIdAndCode objects.
  • setDeleteMemberGroupAfterSend

    public void setDeleteMemberGroupAfterSend(boolean del)
    This method sets if the member group associated with the e-mail promotion should be deleted after the e-mails have been sent.
    Parameters:
    del - Set to true if the member group should be deleted.
  • setEmailPromoMemberGroupId

    public void setEmailPromoMemberGroupId(java.lang.String mbrGrpId)
    This method sets the member group to whom the e-mail is being sent. This parameter needs to be set for the batch e-mail scheduled jobs.
    Parameters:
    mbrGrpId - The member group ID
  • setJobHost

    public void setJobHost(java.lang.String host)
    This method sets the scheduled job host, that is used to tell which host to run the mail schedule-job; If the job host is empty or null, the host set in email configuration table will be used.
    Parameters:
    host -
  • setNewHeader

    public void setNewHeader(java.lang.String name,
                             java.lang.String value)
    Set a new header for the message.
    Parameters:
    name - the string input the new header name.
    value - the string input the new header value.
  • setReplyTo

    public void setReplyTo(java.lang.String r)
    This method sets the e-mail address to be specified as the reply-to of the e-mail. A customization can call this method to set a different reply-to e-mail address.
    Parameters:
    r - The reply-to e-mail address.
  • setSender

    public void setSender(java.lang.String s)
    This method sets the e-mail address to be specified as the sender of the e-mail. By default, the sender address specified in the e-mail configuration table will be used (EMLCFG.ADDRESS - set in the E-mail Activities tool in the Administration Console). A customization can call this method to set a different sender e-mail address.
    Parameters:
    s - The sender e-mail address.
  • setSmtpSessionProperties

    public void setSmtpSessionProperties(java.util.Map properties)
    This method checks the marketing wc-admin.component.xml file for the useSSLForSMTPAuthentication- setting. If the value is true, then the SMTP server should use SSL connections. This method can be extended to add additional properties when setting up the SMTP Session object (public static Session getInstance(Properties props, Authenticator authenticator). To add additional properties, extend this method, and call properties.put(name, value).
    Parameters:
    properties - A map with additional properties to use when setting up the SMTP Session.
  • startNewBatch

    public void startNewBatch(int ePromId,
                              java.util.Map triggerParas,
                              java.lang.String reply,
                              int msgIdInEntityType,
                              boolean dupEmailFilter,
                              boolean tryRecordSuccessfulRecipients,
                              com.ibm.commerce.command.CommandContext cc)
                       throws com.ibm.commerce.exception.ECException
    This method prepare the mail list to be send, if the list is empty. This version used for case that the user do not need ePromoName.
    Parameters:
    ePromId - the email activity id.
    triggerParas - the trigger parameters.
    reply - the reply to.
    msgIdInEntityType - the message id in Entitytype.
    dupEmailFilter - the flag to tell if filter the duplicated mails.
    tryRecordSuccessfulRecipients - the flag to tell if try to record the successful recipient in mail-sending.
    cc - the command context.
    Throws:
    com.ibm.commerce.exception.ECException
  • startNewBatch

    public void startNewBatch(int ePromId,
                              java.lang.String ePromoName,
                              java.util.Map triggerParas,
                              java.lang.String reply,
                              int msgIdInEntityType,
                              boolean dupEmailFilter,
                              boolean tryRecordSuccessfulRecipients,
                              com.ibm.commerce.command.CommandContext cc)
                       throws com.ibm.commerce.exception.ECException
    This method prepare the mail list to be send, if the list is empty.
    Parameters:
    ePromId - the email activity id.
    ePromoName - the email activity Name.
    triggerParas - the trigger parameters.
    reply - the reply to.
    msgIdInEntityType - the message id in Entity type.
    dupEmailFilter - the flag to tell if filter the duplicated mails.
    tryRecordSuccessfulRecipients - the flag to tell if try to record the successful recipient in mail-sending.
    cc - the command context.
    Throws:
    com.ibm.commerce.exception.ECException