コード例 #1
0
  // Create workflow start provenance message
  protected void recordStart(Context context, Item myitem)
      throws SQLException, IOException, AuthorizeException {
    // get date
    DCDate now = DCDate.getCurrent();

    // Create provenance description
    String provmessage;

    if (myitem.getSubmitter() != null) {
      provmessage =
          "Submitted by "
              + myitem.getSubmitter().getFullName()
              + " ("
              + myitem.getSubmitter().getEmail()
              + ") on "
              + now.toString()
              + "\n";
    } else
    // null submitter
    {
      provmessage = "Submitted by unknown (probably automated) on" + now.toString() + "\n";
    }

    // add sizes and checksums of bitstreams
    provmessage += installItemService.getBitstreamProvenanceMessage(context, myitem);

    // Add message to the DC
    itemService.addMetadata(
        context, myitem, MetadataSchema.DC_SCHEMA, "description", "provenance", "en", provmessage);
    itemService.update(context, myitem);
  }
コード例 #2
0
  // Record approval provenance statement
  protected void recordApproval(Context context, BasicWorkflowItem workflowItem, EPerson e)
      throws SQLException, IOException, AuthorizeException {
    Item item = workflowItem.getItem();

    // Get user's name + email address
    String usersName = getEPersonName(e);

    // Get current date
    String now = DCDate.getCurrent().toString();

    // Here's what happened
    String provDescription =
        "Approved for entry into archive by " + usersName + " on " + now + " (GMT) ";

    // add bitstream descriptions (name, size, checksums)
    provDescription += installItemService.getBitstreamProvenanceMessage(context, item);

    // Add to item as a DC field
    itemService.addMetadata(
        context,
        item,
        MetadataSchema.DC_SCHEMA,
        "description",
        "provenance",
        "en",
        provDescription);
    itemService.update(context, item);
  }