mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-17 23:13:10 +00:00
XmlWorkflowCuratorServiceImpl: add check to queue task if configured; Curation: remove obsolete code preventing curation running on workflow tasks as #3157 is now implemented
This commit is contained in:
@@ -152,17 +152,10 @@ public class Curation extends DSpaceRunnable<CurationScriptConfiguration> {
|
||||
super.handler.logInfo("Curating id: " + entry.getObjectId());
|
||||
}
|
||||
curator.clear();
|
||||
// does entry relate to a DSO or workflow object?
|
||||
if (entry.getObjectId().indexOf('/') > 0) {
|
||||
for (String taskName : entry.getTaskNames()) {
|
||||
curator.addTask(taskName);
|
||||
}
|
||||
curator.curate(context, entry.getObjectId());
|
||||
} else {
|
||||
// TODO: Remove this exception once curation tasks are supported by configurable workflow
|
||||
// e.g. see https://github.com/DSpace/DSpace/pull/3157
|
||||
throw new IllegalArgumentException("curation for workflow items is no longer supported");
|
||||
}
|
||||
}
|
||||
queue.release(this.queue, ticket, true);
|
||||
return ticket;
|
||||
|
@@ -13,6 +13,7 @@ import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.content.Collection;
|
||||
@@ -123,6 +124,12 @@ public class XmlWorkflowCuratorServiceImpl
|
||||
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(item);
|
||||
int status = curator.getStatus(task.name);
|
||||
String result = curator.getResult(task.name);
|
||||
@@ -158,6 +165,7 @@ public class XmlWorkflowCuratorServiceImpl
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
curator.clear();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user