예제 #1
0
  /**
   * startWithoutNotify() starts the workflow normally, but disables notifications (useful for large
   * imports,) for the first workflow step - subsequent notifications happen normally
   */
  @Override
  public XmlWorkflowItem startWithoutNotify(Context context, WorkspaceItem wsi)
      throws SQLException, AuthorizeException, IOException, WorkflowException {
    // make a hash table entry with item ID for no notify
    // notify code checks no notify hash for item id
    noEMail.put(wsi.getItem().getID(), Boolean.TRUE);

    return start(context, wsi);
  }
예제 #2
0
  @Override
  public void alertUsersOnTaskActivation(
      Context c, XmlWorkflowItem wfi, String emailTemplate, List<EPerson> epa, String... arguments)
      throws IOException, SQLException, MessagingException {
    if (noEMail.containsKey(wfi.getItem().getID())) {
      // suppress email, and delete key
      noEMail.remove(wfi.getItem().getID());
    } else {
      Email mail = Email.getEmail(I18nUtil.getEmailFilename(c.getCurrentLocale(), emailTemplate));
      for (String argument : arguments) {
        mail.addArgument(argument);
      }
      for (EPerson anEpa : epa) {
        mail.addRecipient(anEpa.getEmail());
      }

      mail.send();
    }
  }