コード例 #1
0
  @Override
  public String getItemTitle(BasicWorkflowItem wi) throws SQLException {
    Item myitem = wi.getItem();
    String title = myitem.getName();

    // only return the first element, or "Untitled"
    if (StringUtils.isNotBlank(title)) {
      return title;
    } else {
      return I18nUtil.getMessage("org.dspace.workflow.WorkflowManager.untitled ");
    }
  }
コード例 #2
0
  /** notify the submitter that the item is archived */
  protected void notifyOfArchive(Context context, Item item, Collection coll)
      throws SQLException, IOException {
    try {
      // Get submitter
      EPerson ep = item.getSubmitter();
      // Get the Locale
      Locale supportedLocale = I18nUtil.getEPersonLocale(ep);
      Email email = Email.getEmail(I18nUtil.getEmailFilename(supportedLocale, "submit_archive"));

      // Get the item handle to email to user
      String handle = handleService.findHandle(context, item);

      // Get title
      String title = item.getName();
      if (StringUtils.isBlank(title)) {
        try {
          title = I18nUtil.getMessage("org.dspace.workflow.WorkflowManager.untitled");
        } catch (MissingResourceException e) {
          title = "Untitled";
        }
      }

      email.addRecipient(ep.getEmail());
      email.addArgument(title);
      email.addArgument(coll.getName());
      email.addArgument(handleService.getCanonicalForm(handle));

      email.send();
    } catch (MessagingException e) {
      log.warn(
          LogManager.getHeader(
              context,
              "notifyOfArchive",
              "cannot email user; item_id=" + item.getID() + ":  " + e.getMessage()));
    }
  }