#8585 Add submitter information to provenance metadata

(cherry picked from commit c15ac0eb4a)
This commit is contained in:
Adán Román Ruiz
2023-10-06 10:04:41 +02:00
committed by github-actions[bot]
parent 4a3b9c1e47
commit 668b5b24df

View File

@@ -221,6 +221,8 @@ public class XmlWorkflowServiceImpl implements XmlWorkflowService {
//Get our next step, if none is found, archive our item //Get our next step, if none is found, archive our item
firstStep = wf.getNextStep(context, wfi, firstStep, ActionResult.OUTCOME_COMPLETE); firstStep = wf.getNextStep(context, wfi, firstStep, ActionResult.OUTCOME_COMPLETE);
if (firstStep == null) { if (firstStep == null) {
// record the submitted provenance message
recordStart(context, wfi.getItem(),null);
archive(context, wfi); archive(context, wfi);
} else { } else {
activateFirstStep(context, wf, firstStep, wfi); activateFirstStep(context, wf, firstStep, wfi);
@@ -1187,25 +1189,30 @@ public class XmlWorkflowServiceImpl implements XmlWorkflowService {
DCDate now = DCDate.getCurrent(); DCDate now = DCDate.getCurrent();
// Create provenance description // Create provenance description
String provmessage = ""; StringBuffer provmessage = new StringBuffer();
if (myitem.getSubmitter() != null) { if (myitem.getSubmitter() != null) {
provmessage = "Submitted by " + myitem.getSubmitter().getFullName() provmessage.append("Submitted by ").append(myitem.getSubmitter().getFullName())
+ " (" + myitem.getSubmitter().getEmail() + ") on " .append(" (").append(myitem.getSubmitter().getEmail()).append(") on ")
+ now.toString() + " workflow start=" + action.getProvenanceStartId() + "\n"; .append(now.toString());
} else { } else {
// else, null submitter // else, null submitter
provmessage = "Submitted by unknown (probably automated) on" provmessage.append("Submitted by unknown (probably automated) on")
+ now.toString() + " workflow start=" + action.getProvenanceStartId() + "\n"; .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 // add sizes and checksums of bitstreams
provmessage += installItemService.getBitstreamProvenanceMessage(context, myitem); provmessage.append(installItemService.getBitstreamProvenanceMessage(context, myitem));
// Add message to the DC // Add message to the DC
itemService itemService
.addMetadata(context, myitem, MetadataSchemaEnum.DC.getName(), .addMetadata(context, myitem, MetadataSchemaEnum.DC.getName(),
"description", "provenance", "en", provmessage); "description", "provenance", "en", provmessage.toString());
itemService.update(context, myitem); itemService.update(context, myitem);
} }