#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
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);
@@ -334,7 +336,7 @@ public class XmlWorkflowServiceImpl implements XmlWorkflowService {
+ "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 !
@@ -1187,25 +1189,30 @@ public class XmlWorkflowServiceImpl implements XmlWorkflowService {
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);
}