package com.effektif.workflow.impl.email;

import com.effektif.workflow.api.workflow.Trigger;
import com.fasterxml.jackson.annotation.JsonTypeName;

/**
 * Starts a workflow as a result of receiving an email.
 *
 * @author Peter Hilton
 */
@JsonTypeName("email")
public class EmailTrigger extends Trigger {

  public static final String EMAIL_KEY = "email";
  public static final String EMAIL_ID_KEY = "emailId";

  /** Optional variable that specifies the name to use for the process variable, instead of <code>EMAIL_ID_KEY</code>. */
  protected String emailIdVariableId;

  /**
   * Returns the variable ID to use to look up the {@link com.effektif.workflow.api.model.EmailId},
   * using {@link #EMAIL_ID_KEY} as a default value.
   */
  public String getEmailIdVariableId() {
    return emailIdVariableId == null ? EMAIL_ID_KEY : emailIdVariableId;
  }
  public void setEmailIdVariableId(String emailIdVariableId) {
    this.emailIdVariableId = emailIdVariableId;
  }
  public EmailTrigger emailIdVariableId(String emailIdVariableId) {
    this.emailIdVariableId = emailIdVariableId;
    return this;
  }
}

@@ -200,16 +200,385 @@
 an email
+, instead of starting a workflow directly and setting workflow%0A * variables for initial data.%0A *%0A * %3Cp%3EWhen you use an email trigger, you provide either an %7B@link com.effektif.workflow.api.model.EmailId%7D for a%0A * previously-stored email, or an actual %7B@link com.effektif.workflow.impl.email.Email%7D, which will be stored and made%0A * available via an %3Ccode%3EEmailId%3C/code%3E
 .%0A *%0A * 

Add Javadoc