Skip to content

Commit

Permalink
Merge pull request DSpace#9497 from mwoodiupui/workflow-curator-nesting
Browse files Browse the repository at this point in the history
In workflow-attached curation, separate task-list building from execution.
  • Loading branch information
tdonohue authored Aug 29, 2024
2 parents 1b7d028 + c43948b commit a24a355
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,14 @@ public boolean curate(Curator curator, Context c, XmlWorkflowItem wfi)
item.setOwningCollection(wfi.getCollection());
for (Task task : step.tasks) {
curator.addTask(task.name);
// Check whether the task is configured to be queued rather than automatically run
if (StringUtils.isNotEmpty(step.queue)) {
// queue attribute has been set in the FlowStep configuration: add task to configured queue
curator.queue(c, item.getID().toString(), step.queue);
} else {
// Task is configured to be run automatically
curator.curate(c, item);
}

if (StringUtils.isNotEmpty(step.queue)) { // Step's tasks are to be queued.
curator.queue(c, item.getID().toString(), step.queue);
} else { // Step's tasks are to be run now.
curator.curate(c, item);

for (Task task : step.tasks) {
int status = curator.getStatus(task.name);
String result = curator.getResult(task.name);
String action = "none";
Expand Down Expand Up @@ -183,14 +184,14 @@ public boolean curate(Curator curator, Context c, XmlWorkflowItem wfi)
}
}
curator.clear();
}

// Record any reporting done by the tasks.
if (reporter.length() > 0) {
LOG.info("Curation tasks over item {} for step {} report:%n{}",
() -> wfi.getItem().getID(),
() -> step.step,
() -> reporter.toString());
// Record any reporting done by the tasks.
if (reporter.length() > 0) {
LOG.info("Curation tasks over item {} for step {} report:\n{}",
() -> wfi.getItem().getID(),
() -> step.step,
() -> reporter.toString());
}
}
}
return true;
Expand Down
12 changes: 12 additions & 0 deletions dspace-api/src/main/java/org/dspace/curate/package-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,24 @@
* </dl>
*
* <p>Curation requests may be run immediately or queued for batch processing.
* See {@link TaskQueue} and its relatives, {@link Curation} and its relatives
* for more on queued curation.
*
* <p>Tasks may also be attached to a workflow step, so that a set of tasks is
* applied to each uninstalled Item which passes through that step. See
* {@link org.dspace.curate.service.XmlWorkflowCuratorService}.
*
* <p>A task may return to the Curator a status code, a final status message,
* and an optional report character stream.
*
* <p>The {@link Reporter} classes absorb strings of text and preserve it in
* various ways. A Reporter is a simple {@link Appendable} and makes no
* assumptions about e.g. whether a string represents a complete line. If you
* want your report formatted, insert appropriate newlines and other whitespace
* as needed. Your tasks can emit marked-up text if you wish, but the stock
* Reporter implementations make no attempt to render it.
*
* <p>Tasks may be annotated to inform the Curator of special properties. See
* {@link Distributive}, {@link Mutative}, {@link Suspendable} etc.
*/
package org.dspace.curate;

0 comments on commit a24a355

Please sign in to comment.