Class InstanceStartEventHandler

All Implemented Interfaces:
EventHandler

@ConfigurationDescription(properties={@Property(name="FileStorePath",defaultNull=true,description="File system path for storing mails, e.g. in case URI parameters are used for storing the message. If this is not set, temporary files will be created."),}) public class InstanceStartEventHandler extends AbstractInstanceStartEventHandler<MailEvent>
An event handler for mail events, that stores data from an occurred mail event as input parameters in the data container of an instance and starts this instance afterwards.
The input parameters need to have specific names to allow for setting the values according to the mail. This handler allows for lists and subtables of mail addresses and attachments (indirectly via file).
  • Field Details

    • URI_LIST_TYPE

      protected static final String URI_LIST_TYPE
      The name of the UDT type for URI lists.
    • fileStore

      protected final File fileStore
      The configured file store path, used for providing the mail content as file URI to the started process or null in case no files should be stored.
  • Constructor Details

    • InstanceStartEventHandler

      public InstanceStartEventHandler(Configuration conf, AbstractEventManager eventManager, Registry registry) throws ConfigurationException
      Creates a new handler for mail events that starts instances and stores data from the mail in the instance input parameters.
      Parameters:
      conf - The configuration for this plugin instance.
      eventManager - The event manager for starting the process instance.
      registry - The registry for retrieving the plugin instance name (handler ID).
      Throws:
      ConfigurationException - If there are problems creating the configured file store or writing to it or the template cannot be retrieved or has the wrong input parameter, a ConfigurationException will be thrown.
  • Method Details

    • checkInputParameter

      protected void checkInputParameter(TemplateReference templ, Collection<ProcessModelParameter> inParams) throws InvalidDataTypeException, NoSuchParameterException
      Description copied from class: AbstractInstanceStartEventHandler
      Checks for whether the designated template has the right input parameters. An input parameter having the right name for a file event must be of the right data type and there must not be any mandatory input parameter that do not have an appropriate file event name.
      This method is called by the constructor! Overriding subclasses must not access their own instance fields but the instance fields of this parent class.
      Specified by:
      checkInputParameter in class AbstractInstanceStartEventHandler<MailEvent>
      Parameters:
      templ - The template reference found as "latest" template of the configured process type.
      inParams - The input parameters of the designated template.
      Throws:
      InvalidDataTypeException - If the template has an input parameter mapping to a wrong type with respect to the event type, an InvalidDataTypeException will be thrown.
      NoSuchParameterException - If the template is missing an input parameter that is required for event handling or it has a mandatory input parameter that cannot be supplied by the event type, a NoSuchParameterException will be thrown.
    • processEvent

      protected void processEvent(MailEvent event, Collection<ProcessModelParameter> inParams, InstanceDataContainer dataContainer) throws Exception
      Description copied from class: AbstractInstanceStartEventHandler
      Processes the designated event and sets the values of the input parameters in the designated data container.
      Specified by:
      processEvent in class AbstractInstanceStartEventHandler<MailEvent>
      Parameters:
      event - The event which to process and which provides the values for the input parameters.
      inParams - The input parameters of the template.
      dataContainer - The data container of the template in which to set the values.
      Throws:
      Exception - If there are problems handling the event, an arbitrary exception will be thrown leading to appropriate exception handling. This is usually aborting event handling and removing the loaded template so that it gets re-loaded.