Skip to content

Commit

Permalink
DSpace#8585 Add submitter information to provenance metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
aroman-arvo committed Oct 6, 2023
1 parent 5a43e6b commit c15ac0e
Showing 1 changed file with 16 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,8 @@ public XmlWorkflowItem start(Context context, WorkspaceItem wsi)
//Get our next step, if none is found, archive our item
firstStep = wf.getNextStep(context, wfi, firstStep, ActionResult.OUTCOME_COMPLETE);
if (firstStep == null) {
// record the submitted provenance message
recordStart(context, wfi.getItem(),null);
archive(context, wfi);
} else {
activateFirstStep(context, wf, firstStep, wfi);
Expand Down Expand Up @@ -334,7 +336,7 @@ protected void activateFirstStep(Context context, Workflow wf, Step firstStep, X
+ "item_id=" + wfi.getItem().getID()
+ "collection_id=" + wfi.getCollection().getID()));

// record the start of the workflow w/provenance message
// record the start of the workflow w/provenance message
recordStart(context, wfi.getItem(), firstActionConfig.getProcessingAction());

//Fire an event !
Expand Down Expand Up @@ -1187,25 +1189,30 @@ protected void recordStart(Context context, Item myitem, Action action)
DCDate now = DCDate.getCurrent();

// Create provenance description
String provmessage = "";
StringBuffer provmessage = new StringBuffer();

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

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

// Add message to the DC
itemService
.addMetadata(context, myitem, MetadataSchemaEnum.DC.getName(),
"description", "provenance", "en", provmessage);
"description", "provenance", "en", provmessage.toString());
itemService.update(context, myitem);
}

Expand Down

0 comments on commit c15ac0e

Please sign in to comment.