mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-16 14:33:09 +00:00
taskid 76191 Remove Traditional/Basic Workflow from codebase and database
This commit is contained in:
@@ -35,7 +35,7 @@ import org.dspace.eperson.factory.EPersonServiceFactory;
|
||||
import org.dspace.eperson.service.GroupService;
|
||||
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||
import org.dspace.utils.DSpace;
|
||||
import org.dspace.xmlworkflow.factory.XmlWorkflowServiceFactory;
|
||||
import org.dspace.workflow.factory.WorkflowServiceFactory;
|
||||
import org.dspace.xmlworkflow.storedcomponents.CollectionRole;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.CollectionRoleService;
|
||||
|
||||
@@ -566,7 +566,7 @@ public class AuthorizeUtil {
|
||||
public static void authorizeManageGroup(Context context, Group group) throws SQLException, AuthorizeException {
|
||||
AuthorizeService authorizeService = AuthorizeServiceFactory.getInstance().getAuthorizeService();
|
||||
GroupService groupService = EPersonServiceFactory.getInstance().getGroupService();
|
||||
CollectionRoleService collectionRoleService = XmlWorkflowServiceFactory.getInstance()
|
||||
CollectionRoleService collectionRoleService = WorkflowServiceFactory.getInstance()
|
||||
.getCollectionRoleService();
|
||||
if (authorizeService.isAdmin(context)) {
|
||||
return;
|
||||
|
@@ -29,7 +29,6 @@ import org.dspace.content.DSpaceObject;
|
||||
import org.dspace.content.factory.ContentServiceFactory;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.factory.CoreServiceFactory;
|
||||
import org.dspace.curate.factory.CurateServiceFactory;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.eperson.factory.EPersonServiceFactory;
|
||||
import org.dspace.eperson.service.EPersonService;
|
||||
@@ -160,13 +159,7 @@ public class Curation extends DSpaceRunnable<CurationScriptConfiguration> {
|
||||
}
|
||||
curator.curate(context, entry.getObjectId());
|
||||
} else {
|
||||
// make eperson who queued task the effective user
|
||||
EPerson agent = ePersonService.findByEmail(context, entry.getEpersonId());
|
||||
if (agent != null) {
|
||||
context.setCurrentUser(agent);
|
||||
}
|
||||
CurateServiceFactory.getInstance().getWorkflowCuratorService()
|
||||
.curate(curator, context, entry.getObjectId());
|
||||
throw new IllegalArgumentException("curation for workflow items is no longer supported");
|
||||
}
|
||||
}
|
||||
queue.release(this.queue, ticket, true);
|
||||
|
@@ -1,422 +0,0 @@
|
||||
/**
|
||||
* The contents of this file are subject to the license and copyright
|
||||
* detailed in the LICENSE and NOTICE files at the root of the source
|
||||
* tree and available online at
|
||||
*
|
||||
* http://www.dspace.org/license/
|
||||
*/
|
||||
package org.dspace.curate;
|
||||
|
||||
import static javax.xml.stream.XMLStreamConstants.CHARACTERS;
|
||||
import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
|
||||
import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.xml.stream.XMLInputFactory;
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
import javax.xml.stream.XMLStreamReader;
|
||||
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.content.Collection;
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.content.service.CollectionService;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.LogManager;
|
||||
import org.dspace.core.factory.CoreServiceFactory;
|
||||
import org.dspace.core.service.PluginService;
|
||||
import org.dspace.curate.service.WorkflowCuratorService;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.eperson.Group;
|
||||
import org.dspace.eperson.service.EPersonService;
|
||||
import org.dspace.eperson.service.GroupService;
|
||||
import org.dspace.services.ConfigurationService;
|
||||
import org.dspace.workflow.factory.WorkflowServiceFactory;
|
||||
import org.dspace.workflowbasic.BasicWorkflowItem;
|
||||
import org.dspace.workflowbasic.BasicWorkflowServiceImpl;
|
||||
import org.dspace.workflowbasic.service.BasicWorkflowItemService;
|
||||
import org.dspace.workflowbasic.service.BasicWorkflowService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
// Warning - static import ahead!
|
||||
|
||||
|
||||
/**
|
||||
* WorkflowCurator manages interactions between curation and workflow.
|
||||
* Specifically, it is invoked in WorkflowManager to allow the
|
||||
* performance of curation tasks during workflow.
|
||||
*
|
||||
* @author richardrodgers
|
||||
*/
|
||||
public class WorkflowCuratorServiceImpl implements WorkflowCuratorService {
|
||||
|
||||
/**
|
||||
* Logging category
|
||||
*/
|
||||
private static final Logger log
|
||||
= org.apache.logging.log4j.LogManager.getLogger();
|
||||
|
||||
protected Map<String, TaskSet> tsMap = new HashMap<String, TaskSet>();
|
||||
|
||||
protected final String[] flowSteps = {"step1", "step2", "step3", "archive"};
|
||||
|
||||
@Autowired(required = true)
|
||||
protected CollectionService collectionService;
|
||||
@Autowired(required = true)
|
||||
protected EPersonService ePersonService;
|
||||
@Autowired(required = true)
|
||||
protected GroupService groupService;
|
||||
protected BasicWorkflowItemService basicWorkflowItemService;
|
||||
protected BasicWorkflowService basicWorkflowService;
|
||||
@Autowired(required = true)
|
||||
protected WorkflowServiceFactory workflowServiceFactory;
|
||||
@Autowired(required = true)
|
||||
protected ConfigurationService configurationService;
|
||||
|
||||
/**
|
||||
* Initialize the bean (after dependency injection has already taken place).
|
||||
* Ensures the configurationService is injected, so that we can read the
|
||||
* settings from configuration
|
||||
* Called by "init-method" in Spring config.
|
||||
*
|
||||
* @throws Exception ...
|
||||
*/
|
||||
public void init() throws Exception {
|
||||
File cfgFile = new File(configurationService.getProperty("dspace.dir") +
|
||||
File.separator + "config" + File.separator +
|
||||
"workflow-curation.xml");
|
||||
try {
|
||||
loadTaskConfig(cfgFile);
|
||||
if (workflowServiceFactory.getWorkflowService() instanceof BasicWorkflowItemService) {
|
||||
basicWorkflowService = (BasicWorkflowService) workflowServiceFactory.getWorkflowService();
|
||||
basicWorkflowItemService = (BasicWorkflowItemService) workflowServiceFactory.getWorkflowItemService();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
// debug e.printStackTrace();
|
||||
log.fatal("Unable to load config: " + cfgFile.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
|
||||
protected WorkflowCuratorServiceImpl() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean needsCuration(BasicWorkflowItem wfi) {
|
||||
return getFlowStep(wfi) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doCuration(Context c, BasicWorkflowItem wfi)
|
||||
throws AuthorizeException, IOException, SQLException {
|
||||
FlowStep step = getFlowStep(wfi);
|
||||
if (step != null) {
|
||||
Curator curator = new Curator();
|
||||
// are we going to perform, or just put on queue?
|
||||
if (step.queue != null) {
|
||||
// The queue runner will call setReporter
|
||||
for (Task task : step.tasks) {
|
||||
curator.addTask(task.name);
|
||||
}
|
||||
curator.queue(c, String.valueOf(wfi.getID()), step.queue);
|
||||
basicWorkflowItemService.update(c, wfi);
|
||||
return false;
|
||||
} else {
|
||||
PluginService plugins = CoreServiceFactory.getInstance()
|
||||
.getPluginService();
|
||||
try (Reporter reporter
|
||||
= (Reporter) plugins
|
||||
.getSinglePlugin(Reporter.class);) {
|
||||
curator.setReporter(reporter);
|
||||
boolean status = curate(curator, c, wfi);
|
||||
reporter.close();
|
||||
return status;
|
||||
} catch (Exception e) {
|
||||
log.error("Failed to close report", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean curate(Curator curator, Context c, String wfId)
|
||||
throws AuthorizeException, IOException, SQLException {
|
||||
BasicWorkflowItem wfi = basicWorkflowItemService.find(c, Integer.parseInt(wfId));
|
||||
if (wfi != null) {
|
||||
if (curate(curator, c, wfi)) {
|
||||
basicWorkflowService.advance(c, wfi, c.getCurrentUser(), false, true);
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
log.warn(LogManager.getHeader(c, "No workflow item found for id: " + wfId, null));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean curate(Curator curator, Context c, BasicWorkflowItem wfi)
|
||||
throws AuthorizeException, IOException, SQLException {
|
||||
FlowStep step = getFlowStep(wfi);
|
||||
if (step != null) {
|
||||
// assign collection to item in case task needs it
|
||||
Item item = wfi.getItem();
|
||||
item.setOwningCollection(wfi.getCollection());
|
||||
for (Task task : step.tasks) {
|
||||
curator.addTask(task.name);
|
||||
curator.curate(item);
|
||||
int status = curator.getStatus(task.name);
|
||||
String result = curator.getResult(task.name);
|
||||
String action = "none";
|
||||
if (status == Curator.CURATE_FAIL) {
|
||||
// task failed - notify any contacts the task has assigned
|
||||
if (task.powers.contains("reject")) {
|
||||
action = "reject";
|
||||
}
|
||||
notifyContacts(c, wfi, task, "fail", action, result);
|
||||
// if task so empowered, reject submission and terminate
|
||||
if ("reject".equals(action)) {
|
||||
basicWorkflowService.sendWorkflowItemBackSubmission(c, wfi, c.getCurrentUser(),
|
||||
null, task.name + ": " + result);
|
||||
return false;
|
||||
}
|
||||
} else if (status == Curator.CURATE_SUCCESS) {
|
||||
if (task.powers.contains("approve")) {
|
||||
action = "approve";
|
||||
}
|
||||
notifyContacts(c, wfi, task, "success", action, result);
|
||||
if ("approve".equals(action)) {
|
||||
// cease further task processing and advance submission
|
||||
return true;
|
||||
}
|
||||
} else if (status == Curator.CURATE_ERROR) {
|
||||
notifyContacts(c, wfi, task, "error", action, result);
|
||||
}
|
||||
curator.clear();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void notifyContacts(Context c, BasicWorkflowItem wfi, Task task,
|
||||
String status, String action, String message)
|
||||
throws AuthorizeException, IOException, SQLException {
|
||||
List<EPerson> epa = resolveContacts(c, task.getContacts(status), wfi);
|
||||
if (epa.size() > 0) {
|
||||
basicWorkflowService.notifyOfCuration(c, wfi, epa, task.name, action, message);
|
||||
}
|
||||
}
|
||||
|
||||
protected List<EPerson> resolveContacts(Context c, List<String> contacts,
|
||||
BasicWorkflowItem wfi)
|
||||
throws AuthorizeException, IOException, SQLException {
|
||||
List<EPerson> epList = new ArrayList<EPerson>();
|
||||
for (String contact : contacts) {
|
||||
// decode contacts
|
||||
if ("$flowgroup".equals(contact)) {
|
||||
// special literal for current flowgoup
|
||||
int step = state2step(wfi.getState());
|
||||
// make sure this step exists
|
||||
if (step < 4) {
|
||||
Group wfGroup = collectionService.getWorkflowGroup(c, wfi.getCollection(), step);
|
||||
if (wfGroup != null) {
|
||||
epList.addAll(groupService.allMembers(c, wfGroup));
|
||||
}
|
||||
}
|
||||
} else if ("$colladmin".equals(contact)) {
|
||||
Group adGroup = wfi.getCollection().getAdministrators();
|
||||
if (adGroup != null) {
|
||||
epList.addAll(groupService.allMembers(c, adGroup));
|
||||
}
|
||||
} else if ("$siteadmin".equals(contact)) {
|
||||
EPerson siteEp = ePersonService.findByEmail(c,
|
||||
configurationService.getProperty("mail.admin"));
|
||||
if (siteEp != null) {
|
||||
epList.add(siteEp);
|
||||
}
|
||||
} else if (contact.indexOf("@") > 0) {
|
||||
// little shaky heuristic here - assume an eperson email name
|
||||
EPerson ep = ePersonService.findByEmail(c, contact);
|
||||
if (ep != null) {
|
||||
epList.add(ep);
|
||||
}
|
||||
} else {
|
||||
// assume it is an arbitrary group name
|
||||
Group group = groupService.findByName(c, contact);
|
||||
if (group != null) {
|
||||
epList.addAll(groupService.allMembers(c, group));
|
||||
}
|
||||
}
|
||||
}
|
||||
return epList;
|
||||
}
|
||||
|
||||
protected FlowStep getFlowStep(BasicWorkflowItem wfi) {
|
||||
Collection coll = wfi.getCollection();
|
||||
String key = tsMap.containsKey(coll.getHandle()) ? coll.getHandle() : "default";
|
||||
TaskSet ts = tsMap.get(key);
|
||||
if (ts != null) {
|
||||
int myStep = state2step(wfi.getState());
|
||||
for (FlowStep fstep : ts.steps) {
|
||||
if (fstep.step == myStep) {
|
||||
return fstep;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected int state2step(int state) {
|
||||
if (state <= BasicWorkflowServiceImpl.WFSTATE_STEP1POOL) {
|
||||
return 1;
|
||||
}
|
||||
if (state <= BasicWorkflowServiceImpl.WFSTATE_STEP2POOL) {
|
||||
return 2;
|
||||
}
|
||||
if (state <= BasicWorkflowServiceImpl.WFSTATE_STEP3POOL) {
|
||||
return 3;
|
||||
}
|
||||
return 4;
|
||||
}
|
||||
|
||||
protected int stepName2step(String name) {
|
||||
for (int i = 0; i < flowSteps.length; i++) {
|
||||
if (flowSteps[i].equals(name)) {
|
||||
return i + 1;
|
||||
}
|
||||
}
|
||||
// invalid stepName - log
|
||||
log.warn("Invalid step: '" + name + "' provided");
|
||||
return -1;
|
||||
}
|
||||
|
||||
protected void loadTaskConfig(File cfgFile) throws IOException {
|
||||
Map<String, String> collMap = new HashMap<String, String>();
|
||||
Map<String, TaskSet> setMap = new HashMap<String, TaskSet>();
|
||||
TaskSet taskSet = null;
|
||||
FlowStep flowStep = null;
|
||||
Task task = null;
|
||||
String type = null;
|
||||
try {
|
||||
XMLInputFactory factory = XMLInputFactory.newInstance();
|
||||
XMLStreamReader reader = factory.createXMLStreamReader(
|
||||
new FileInputStream(cfgFile), "UTF-8");
|
||||
while (reader.hasNext()) {
|
||||
int event = reader.next();
|
||||
if (event == START_ELEMENT) {
|
||||
String eName = reader.getLocalName();
|
||||
if ("mapping".equals(eName)) {
|
||||
collMap.put(reader.getAttributeValue(0),
|
||||
reader.getAttributeValue(1));
|
||||
} else if ("taskset".equals(eName)) {
|
||||
taskSet = new TaskSet(reader.getAttributeValue(0));
|
||||
} else if ("flowstep".equals(eName)) {
|
||||
int count = reader.getAttributeCount();
|
||||
String queue = (count == 2) ?
|
||||
reader.getAttributeValue(1) : null;
|
||||
flowStep = new FlowStep(reader.getAttributeValue(0), queue);
|
||||
} else if ("task".equals(eName)) {
|
||||
task = new Task(reader.getAttributeValue(0));
|
||||
} else if ("workflow".equals(eName)) {
|
||||
type = "power";
|
||||
} else if ("notify".equals(eName)) {
|
||||
type = reader.getAttributeValue(0);
|
||||
}
|
||||
} else if (event == CHARACTERS) {
|
||||
if (task != null) {
|
||||
if ("power".equals(type)) {
|
||||
task.addPower(reader.getText());
|
||||
} else {
|
||||
task.addContact(type, reader.getText());
|
||||
}
|
||||
}
|
||||
} else if (event == END_ELEMENT) {
|
||||
String eName = reader.getLocalName();
|
||||
if ("task".equals(eName)) {
|
||||
flowStep.addTask(task);
|
||||
task = null;
|
||||
} else if ("flowstep".equals(eName)) {
|
||||
taskSet.addStep(flowStep);
|
||||
} else if ("taskset".equals(eName)) {
|
||||
setMap.put(taskSet.setName, taskSet);
|
||||
}
|
||||
}
|
||||
}
|
||||
reader.close();
|
||||
// stitch maps together
|
||||
for (Map.Entry<String, String> collEntry : collMap.entrySet()) {
|
||||
if (!"none".equals(collEntry.getValue()) && setMap.containsKey(collEntry.getValue())) {
|
||||
tsMap.put(collEntry.getKey(), setMap.get(collEntry.getValue()));
|
||||
}
|
||||
}
|
||||
} catch (XMLStreamException xsE) {
|
||||
throw new IOException(xsE.getMessage(), xsE);
|
||||
}
|
||||
}
|
||||
|
||||
protected class TaskSet {
|
||||
public String setName = null;
|
||||
public List<FlowStep> steps = null;
|
||||
|
||||
public TaskSet(String setName) {
|
||||
this.setName = setName;
|
||||
steps = new ArrayList<FlowStep>();
|
||||
}
|
||||
|
||||
public void addStep(FlowStep step) {
|
||||
steps.add(step);
|
||||
}
|
||||
}
|
||||
|
||||
protected class FlowStep {
|
||||
public int step = -1;
|
||||
public String queue = null;
|
||||
public List<Task> tasks = null;
|
||||
|
||||
public FlowStep(String stepStr, String queueStr) {
|
||||
this.step = stepName2step(stepStr);
|
||||
this.queue = queueStr;
|
||||
tasks = new ArrayList<Task>();
|
||||
}
|
||||
|
||||
public void addTask(Task task) {
|
||||
tasks.add(task);
|
||||
}
|
||||
}
|
||||
|
||||
protected class Task {
|
||||
public String name = null;
|
||||
public List<String> powers = new ArrayList<String>();
|
||||
public Map<String, List<String>> contacts = new HashMap<String, List<String>>();
|
||||
|
||||
public Task(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void addPower(String power) {
|
||||
powers.add(power);
|
||||
}
|
||||
|
||||
public void addContact(String status, String contact) {
|
||||
List<String> sContacts = contacts.get(status);
|
||||
if (sContacts == null) {
|
||||
sContacts = new ArrayList<String>();
|
||||
contacts.put(status, sContacts);
|
||||
}
|
||||
sContacts.add(contact);
|
||||
}
|
||||
|
||||
public List<String> getContacts(String status) {
|
||||
List<String> ret = contacts.get(status);
|
||||
return (ret != null) ? ret : new ArrayList<String>();
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,27 +0,0 @@
|
||||
/**
|
||||
* The contents of this file are subject to the license and copyright
|
||||
* detailed in the LICENSE and NOTICE files at the root of the source
|
||||
* tree and available online at
|
||||
*
|
||||
* http://www.dspace.org/license/
|
||||
*/
|
||||
package org.dspace.curate.factory;
|
||||
|
||||
import org.dspace.curate.service.WorkflowCuratorService;
|
||||
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||
|
||||
/**
|
||||
* Abstract factory to get services for the curate package, use CurateServiceFactory.getInstance() to retrieve an
|
||||
* implementation
|
||||
*
|
||||
* @author kevinvandevelde at atmire.com
|
||||
*/
|
||||
public abstract class CurateServiceFactory {
|
||||
|
||||
public abstract WorkflowCuratorService getWorkflowCuratorService();
|
||||
|
||||
public static CurateServiceFactory getInstance() {
|
||||
return DSpaceServicesFactory.getInstance().getServiceManager()
|
||||
.getServiceByName("curateServiceFactory", CurateServiceFactory.class);
|
||||
}
|
||||
}
|
@@ -1,28 +0,0 @@
|
||||
/**
|
||||
* The contents of this file are subject to the license and copyright
|
||||
* detailed in the LICENSE and NOTICE files at the root of the source
|
||||
* tree and available online at
|
||||
*
|
||||
* http://www.dspace.org/license/
|
||||
*/
|
||||
package org.dspace.curate.factory;
|
||||
|
||||
import org.dspace.curate.service.WorkflowCuratorService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
* Factory implementation to get services for the curate package, use CurateServiceFactory.getInstance() to retrieve
|
||||
* an implementation
|
||||
*
|
||||
* @author kevinvandevelde at atmire.com
|
||||
*/
|
||||
public class CurateServiceFactoryImpl extends CurateServiceFactory {
|
||||
|
||||
@Autowired(required = true)
|
||||
private WorkflowCuratorService workflowCurator;
|
||||
|
||||
@Override
|
||||
public WorkflowCuratorService getWorkflowCuratorService() {
|
||||
return workflowCurator;
|
||||
}
|
||||
}
|
@@ -1,76 +0,0 @@
|
||||
/**
|
||||
* The contents of this file are subject to the license and copyright
|
||||
* detailed in the LICENSE and NOTICE files at the root of the source
|
||||
* tree and available online at
|
||||
*
|
||||
* http://www.dspace.org/license/
|
||||
*/
|
||||
package org.dspace.curate.service;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.curate.Curator;
|
||||
import org.dspace.workflowbasic.BasicWorkflowItem;
|
||||
|
||||
/**
|
||||
* WorkflowCurator manages interactions between curation and workflow.
|
||||
* Specifically, it is invoked in WorkflowManager to allow the
|
||||
* performance of curation tasks during workflow.
|
||||
*
|
||||
* @author richardrodgers
|
||||
*/
|
||||
public interface WorkflowCuratorService {
|
||||
|
||||
|
||||
public boolean needsCuration(BasicWorkflowItem wfi);
|
||||
|
||||
/**
|
||||
* Determines and executes curation on a Workflow item.
|
||||
*
|
||||
* @param c the context
|
||||
* @param wfi the workflow item
|
||||
* @return true if curation was completed or not required,
|
||||
* false if tasks were queued for later completion,
|
||||
* or item was rejected
|
||||
* @throws AuthorizeException if authorization error
|
||||
* @throws IOException if IO error
|
||||
* @throws SQLException if database error
|
||||
*/
|
||||
public boolean doCuration(Context c, BasicWorkflowItem wfi)
|
||||
throws AuthorizeException, IOException, SQLException;
|
||||
|
||||
|
||||
/**
|
||||
* Determines and executes curation of a Workflow item.
|
||||
*
|
||||
* @param curator the Curator object
|
||||
* @param c the user context
|
||||
* @param wfId the workflow id
|
||||
* @return true if curation was completed or not required,
|
||||
* false if no workflow item found for id
|
||||
* or item was rejected
|
||||
* @throws AuthorizeException if authorization error
|
||||
* @throws IOException if IO error
|
||||
* @throws SQLException if database error
|
||||
*/
|
||||
public boolean curate(Curator curator, Context c, String wfId)
|
||||
throws AuthorizeException, IOException, SQLException;
|
||||
|
||||
/**
|
||||
* Determines and executes curation of a Workflow item.
|
||||
*
|
||||
* @param curator the Curator object
|
||||
* @param c the user context
|
||||
* @param wfi the workflow item
|
||||
* @return true if curation was completed or not required,
|
||||
* false if item was rejected
|
||||
* @throws AuthorizeException if authorization error
|
||||
* @throws IOException if IO error
|
||||
* @throws SQLException if database error
|
||||
*/
|
||||
public boolean curate(Curator curator, Context c, BasicWorkflowItem wfi)
|
||||
throws AuthorizeException, IOException, SQLException;
|
||||
}
|
@@ -7,17 +7,17 @@
|
||||
*/
|
||||
package org.dspace.discovery.indexobject;
|
||||
|
||||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
|
||||
/**
|
||||
* Workflow item implementation for the IndexableObject
|
||||
* @author Kevin Van de Velde (kevin at atmire dot com)
|
||||
*/
|
||||
public class IndexableWorkflowItem extends IndexableInProgressSubmission<XmlWorkflowItem> {
|
||||
public class IndexableWorkflowItem extends IndexableInProgressSubmission<WorkflowItem> {
|
||||
|
||||
public static final String TYPE = XmlWorkflowItem.class.getSimpleName();
|
||||
public static final String TYPE = WorkflowItem.class.getSimpleName();
|
||||
|
||||
public IndexableWorkflowItem(XmlWorkflowItem inProgressSubmission) {
|
||||
public IndexableWorkflowItem(WorkflowItem inProgressSubmission) {
|
||||
super(inProgressSubmission);
|
||||
}
|
||||
|
||||
|
@@ -64,8 +64,8 @@ import org.dspace.handle.service.HandleService;
|
||||
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||
import org.dspace.util.MultiFormatDateParser;
|
||||
import org.dspace.util.SolrUtils;
|
||||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.XmlWorkflowItemService;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
import org.dspace.workflow.WorkflowItemService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
@@ -91,7 +91,7 @@ public class ItemIndexFactoryImpl extends DSpaceObjectIndexFactoryImpl<Indexable
|
||||
@Autowired
|
||||
protected WorkspaceItemService workspaceItemService;
|
||||
@Autowired
|
||||
protected XmlWorkflowItemService xmlWorkflowItemService;
|
||||
protected WorkflowItemService workflowItemService;
|
||||
@Autowired
|
||||
protected WorkflowItemIndexFactory workflowItemIndexFactory;
|
||||
@Autowired
|
||||
@@ -718,9 +718,9 @@ public class ItemIndexFactoryImpl extends DSpaceObjectIndexFactoryImpl<Indexable
|
||||
results.addAll(workspaceItemIndexFactory.getIndexableObjects(context, workspaceItem));
|
||||
} else {
|
||||
// Check if we a workflow item
|
||||
final XmlWorkflowItem xmlWorkflowItem = xmlWorkflowItemService.findByItem(context, object);
|
||||
if (xmlWorkflowItem != null) {
|
||||
results.addAll(workflowItemIndexFactory.getIndexableObjects(context, xmlWorkflowItem));
|
||||
final WorkflowItem workflowItem = workflowItemService.findByItem(context, object);
|
||||
if (workflowItem != null) {
|
||||
results.addAll(workflowItemIndexFactory.getIndexableObjects(context, workflowItem));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -23,12 +23,12 @@ import org.dspace.discovery.SearchUtils;
|
||||
import org.dspace.discovery.configuration.DiscoveryConfiguration;
|
||||
import org.dspace.discovery.indexobject.factory.WorkflowItemIndexFactory;
|
||||
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
import org.dspace.workflow.WorkflowItemService;
|
||||
import org.dspace.xmlworkflow.storedcomponents.ClaimedTask;
|
||||
import org.dspace.xmlworkflow.storedcomponents.PoolTask;
|
||||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.ClaimedTaskService;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.PoolTaskService;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.XmlWorkflowItemService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
@@ -36,11 +36,11 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
* @author Kevin Van de Velde (kevin at atmire dot com)
|
||||
*/
|
||||
public class WorkflowItemIndexFactoryImpl
|
||||
extends InprogressSubmissionIndexFactoryImpl<IndexableWorkflowItem, XmlWorkflowItem>
|
||||
extends InprogressSubmissionIndexFactoryImpl<IndexableWorkflowItem, WorkflowItem>
|
||||
implements WorkflowItemIndexFactory {
|
||||
|
||||
@Autowired
|
||||
protected XmlWorkflowItemService workflowItemService;
|
||||
protected WorkflowItemService workflowItemService;
|
||||
@Autowired
|
||||
protected ClaimedTaskService claimedTaskService;
|
||||
@Autowired
|
||||
@@ -48,7 +48,7 @@ public class WorkflowItemIndexFactoryImpl
|
||||
|
||||
@Override
|
||||
public Iterator<IndexableWorkflowItem> findAll(Context context) throws SQLException {
|
||||
final Iterator<XmlWorkflowItem> workflowItems = workflowItemService.findAll(context).iterator();
|
||||
final Iterator<WorkflowItem> workflowItems = workflowItemService.findAll(context).iterator();
|
||||
|
||||
return new Iterator<IndexableWorkflowItem>() {
|
||||
@Override
|
||||
@@ -73,7 +73,7 @@ public class WorkflowItemIndexFactoryImpl
|
||||
throws SQLException, IOException {
|
||||
// Add the ID's, types and call the SolrServiceIndexPlugins
|
||||
final SolrInputDocument doc = super.buildDocument(context, indexableObject);
|
||||
final XmlWorkflowItem workflowItem = indexableObject.getIndexedObject();
|
||||
final WorkflowItem workflowItem = indexableObject.getIndexedObject();
|
||||
final Item item = workflowItem.getItem();
|
||||
// Add the item metadata as configured
|
||||
List<DiscoveryConfiguration> discoveryConfigurations = SearchUtils
|
||||
@@ -92,11 +92,11 @@ public class WorkflowItemIndexFactoryImpl
|
||||
|
||||
@Override
|
||||
public boolean supports(Object object) {
|
||||
return object instanceof XmlWorkflowItem;
|
||||
return object instanceof WorkflowItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getIndexableObjects(Context context, XmlWorkflowItem object) throws SQLException {
|
||||
public List getIndexableObjects(Context context, WorkflowItem object) throws SQLException {
|
||||
List<IndexableObject> results = new ArrayList<>();
|
||||
results.add(new IndexableWorkflowItem(object));
|
||||
|
||||
@@ -115,7 +115,7 @@ public class WorkflowItemIndexFactoryImpl
|
||||
|
||||
@Override
|
||||
public Optional<IndexableWorkflowItem> findIndexableObject(Context context, String id) throws SQLException {
|
||||
final XmlWorkflowItem xmlWorkflowItem = workflowItemService.find(context, Integer.parseInt(id));
|
||||
return xmlWorkflowItem == null ? Optional.empty() : Optional.of(new IndexableWorkflowItem(xmlWorkflowItem));
|
||||
final WorkflowItem workflowItem = workflowItemService.find(context, Integer.parseInt(id));
|
||||
return workflowItem == null ? Optional.empty() : Optional.of(new IndexableWorkflowItem(workflowItem));
|
||||
}
|
||||
}
|
@@ -15,9 +15,9 @@ import org.dspace.content.service.WorkspaceItemService;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.discovery.IndexableObject;
|
||||
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||
import org.dspace.workflow.WorkflowItemService;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.ClaimedTaskService;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.PoolTaskService;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.XmlWorkflowItemService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
@@ -29,7 +29,7 @@ public abstract class IndexObjectFactoryFactory {
|
||||
@Autowired
|
||||
protected WorkspaceItemService workspaceItemService;
|
||||
@Autowired
|
||||
protected XmlWorkflowItemService xmlWorkflowItemService;
|
||||
protected WorkflowItemService workflowItemService;
|
||||
@Autowired
|
||||
protected ClaimedTaskService claimedTaskService;
|
||||
@Autowired
|
||||
|
@@ -8,7 +8,7 @@
|
||||
package org.dspace.discovery.indexobject.factory;
|
||||
|
||||
import org.dspace.discovery.indexobject.IndexableWorkflowItem;
|
||||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
|
||||
/**
|
||||
* Factory interface for indexing/retrieving workflow items objects in the search core
|
||||
@@ -16,5 +16,5 @@ import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
* @author Kevin Van de Velde (kevin at atmire dot com)
|
||||
*/
|
||||
public interface WorkflowItemIndexFactory
|
||||
extends InprogressSubmissionIndexFactory<IndexableWorkflowItem, XmlWorkflowItem> {
|
||||
extends InprogressSubmissionIndexFactory<IndexableWorkflowItem, WorkflowItem> {
|
||||
}
|
@@ -49,26 +49,17 @@ import org.dspace.versioning.dao.VersionDAO;
|
||||
import org.dspace.versioning.factory.VersionServiceFactory;
|
||||
import org.dspace.versioning.service.VersionHistoryService;
|
||||
import org.dspace.versioning.service.VersioningService;
|
||||
import org.dspace.workflow.WorkflowItemService;
|
||||
import org.dspace.workflow.WorkflowService;
|
||||
import org.dspace.workflow.factory.WorkflowServiceFactory;
|
||||
import org.dspace.workflowbasic.BasicWorkflowItem;
|
||||
import org.dspace.workflowbasic.BasicWorkflowServiceImpl;
|
||||
import org.dspace.workflowbasic.factory.BasicWorkflowServiceFactory;
|
||||
import org.dspace.workflowbasic.service.BasicWorkflowItemService;
|
||||
import org.dspace.workflowbasic.service.BasicWorkflowService;
|
||||
import org.dspace.workflowbasic.service.TaskListItemService;
|
||||
import org.dspace.xmlworkflow.WorkflowConfigurationException;
|
||||
import org.dspace.xmlworkflow.factory.XmlWorkflowServiceFactory;
|
||||
import org.dspace.xmlworkflow.service.WorkflowRequirementsService;
|
||||
import org.dspace.xmlworkflow.service.XmlWorkflowService;
|
||||
import org.dspace.xmlworkflow.storedcomponents.ClaimedTask;
|
||||
import org.dspace.xmlworkflow.storedcomponents.CollectionRole;
|
||||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.ClaimedTaskService;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.CollectionRoleService;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.PoolTaskService;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.WorkflowItemRoleService;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.XmlWorkflowItemService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
@@ -294,10 +285,6 @@ public class EPersonServiceImpl extends DSpaceObjectServiceImpl<EPerson> impleme
|
||||
if (constraintList.size() > 0) {
|
||||
// Check if the constraints we found should be deleted
|
||||
if (cascade) {
|
||||
boolean isBasicFramework = WorkflowServiceFactory.getInstance().getWorkflowService()
|
||||
instanceof BasicWorkflowService;
|
||||
boolean isXmlFramework = WorkflowServiceFactory.getInstance().getWorkflowService()
|
||||
instanceof XmlWorkflowService;
|
||||
Iterator<String> constraintsIterator = constraintList.iterator();
|
||||
|
||||
while (constraintsIterator.hasNext()) {
|
||||
@@ -334,23 +321,21 @@ public class EPersonServiceImpl extends DSpaceObjectServiceImpl<EPerson> impleme
|
||||
itemService.update(context, item);
|
||||
}
|
||||
}
|
||||
} else if (StringUtils.equals(tableName, "cwf_claimtask") && isXmlFramework) {
|
||||
} else if (StringUtils.equals(tableName, "cwf_claimtask")) {
|
||||
// Unclaim all XmlWorkflow tasks
|
||||
XmlWorkflowItemService xmlWorkflowItemService = XmlWorkflowServiceFactory
|
||||
.getInstance().getXmlWorkflowItemService();
|
||||
ClaimedTaskService claimedTaskService = XmlWorkflowServiceFactory
|
||||
WorkflowItemService workflowItemService = WorkflowServiceFactory
|
||||
.getInstance().getWorkflowItemService();
|
||||
ClaimedTaskService claimedTaskService = WorkflowServiceFactory
|
||||
.getInstance().getClaimedTaskService();
|
||||
XmlWorkflowService xmlWorkflowService = XmlWorkflowServiceFactory
|
||||
.getInstance().getXmlWorkflowService();
|
||||
WorkflowRequirementsService workflowRequirementsService = XmlWorkflowServiceFactory
|
||||
WorkflowService workflowService = WorkflowServiceFactory
|
||||
.getInstance().getWorkflowService();
|
||||
WorkflowRequirementsService workflowRequirementsService = WorkflowServiceFactory
|
||||
.getInstance().getWorkflowRequirementsService();
|
||||
|
||||
List<XmlWorkflowItem> xmlWorkflowItems = xmlWorkflowItemService
|
||||
.findBySubmitter(context, ePerson);
|
||||
List<ClaimedTask> claimedTasks = claimedTaskService.findByEperson(context, ePerson);
|
||||
|
||||
for (ClaimedTask task : claimedTasks) {
|
||||
xmlWorkflowService.deleteClaimedTask(context, task.getWorkflowItem(), task);
|
||||
workflowService.deleteClaimedTask(context, task.getWorkflowItem(), task);
|
||||
|
||||
try {
|
||||
workflowRequirementsService.removeClaimedUser(context, task.getWorkflowItem(),
|
||||
@@ -362,44 +347,14 @@ public class EPersonServiceImpl extends DSpaceObjectServiceImpl<EPerson> impleme
|
||||
.singletonList(tableName)));
|
||||
}
|
||||
}
|
||||
} else if (StringUtils.equals(tableName, "workflowitem") && isBasicFramework) {
|
||||
// Remove basicWorkflow workflowitem and unclaim them
|
||||
BasicWorkflowItemService basicWorkflowItemService = BasicWorkflowServiceFactory.getInstance()
|
||||
.getBasicWorkflowItemService();
|
||||
BasicWorkflowService basicWorkflowService = BasicWorkflowServiceFactory.getInstance()
|
||||
.getBasicWorkflowService();
|
||||
TaskListItemService taskListItemService = BasicWorkflowServiceFactory.getInstance()
|
||||
.getTaskListItemService();
|
||||
List<BasicWorkflowItem> workflowItems = basicWorkflowItemService.findByOwner(context, ePerson);
|
||||
for (BasicWorkflowItem workflowItem : workflowItems) {
|
||||
int state = workflowItem.getState();
|
||||
// unclaim tasks that are in the pool.
|
||||
if (state == BasicWorkflowServiceImpl.WFSTATE_STEP1
|
||||
|| state == BasicWorkflowServiceImpl.WFSTATE_STEP2
|
||||
|| state == BasicWorkflowServiceImpl.WFSTATE_STEP3) {
|
||||
log.info(LogManager.getHeader(context, "unclaim_workflow",
|
||||
"workflow_id=" + workflowItem.getID() + ", claiming EPerson is deleted"));
|
||||
basicWorkflowService.unclaim(context, workflowItem, context.getCurrentUser());
|
||||
// remove the EPerson from the list of persons that can (re-)claim the task
|
||||
// while we are doing it below, we must do this here as well as the previously
|
||||
// unclaimed tasks was put back into pool and we do not know the order the tables
|
||||
// are checked.
|
||||
taskListItemService.deleteByWorkflowItemAndEPerson(context, workflowItem, ePerson);
|
||||
}
|
||||
}
|
||||
} else if (StringUtils.equals(tableName, "resourcepolicy")) {
|
||||
// we delete the EPerson, it won't need any rights anymore.
|
||||
authorizeService.removeAllEPersonPolicies(context, ePerson);
|
||||
} else if (StringUtils.equals(tableName, "tasklistitem") && isBasicFramework) {
|
||||
// remove EPerson from the list of EPersons that may claim some specific workflow tasks.
|
||||
TaskListItemService taskListItemService = BasicWorkflowServiceFactory.getInstance()
|
||||
.getTaskListItemService();
|
||||
taskListItemService.deleteByEPerson(context, ePerson);
|
||||
} else if (StringUtils.equals(tableName, "cwf_pooltask") && isXmlFramework) {
|
||||
PoolTaskService poolTaskService = XmlWorkflowServiceFactory.getInstance().getPoolTaskService();
|
||||
} else if (StringUtils.equals(tableName, "cwf_pooltask")) {
|
||||
PoolTaskService poolTaskService = WorkflowServiceFactory.getInstance().getPoolTaskService();
|
||||
poolTaskService.deleteByEperson(context, ePerson);
|
||||
} else if (StringUtils.equals(tableName, "cwf_workflowitemrole") && isXmlFramework) {
|
||||
WorkflowItemRoleService workflowItemRoleService = XmlWorkflowServiceFactory.getInstance()
|
||||
} else if (StringUtils.equals(tableName, "cwf_workflowitemrole")) {
|
||||
WorkflowItemRoleService workflowItemRoleService = WorkflowServiceFactory.getInstance()
|
||||
.getWorkflowItemRoleService();
|
||||
workflowItemRoleService.deleteByEPerson(context, ePerson);
|
||||
} else {
|
||||
|
@@ -227,8 +227,7 @@ public interface EPersonService extends DSpaceObjectService<EPerson>, DSpaceObje
|
||||
* EPersons. Called by delete() to determine whether the eperson can
|
||||
* actually be deleted.
|
||||
*
|
||||
* An EPerson cannot be deleted if it exists in the item, workflowitem, or
|
||||
* tasklistitem tables.
|
||||
* An EPerson cannot be deleted if it exists in the item, resourcepolicy or workflow-related tables.
|
||||
*
|
||||
* @param context The relevant DSpace Context.
|
||||
* @param ePerson EPerson to find
|
||||
|
@@ -33,8 +33,8 @@ import org.dspace.eperson.service.EPersonService;
|
||||
import org.dspace.eperson.service.GroupService;
|
||||
import org.dspace.handle.factory.HandleServiceFactory;
|
||||
import org.dspace.handle.service.HandleService;
|
||||
import org.dspace.workflowbasic.factory.BasicWorkflowServiceFactory;
|
||||
import org.dspace.workflowbasic.service.BasicWorkflowItemService;
|
||||
import org.dspace.workflow.WorkflowItemService;
|
||||
import org.dspace.workflow.factory.WorkflowServiceFactory;
|
||||
|
||||
/**
|
||||
* @author LINDAT/CLARIN dev team
|
||||
@@ -48,8 +48,8 @@ public class ItemCheck extends Check {
|
||||
private MetadataValueService metadataValueService = ContentServiceFactory.getInstance().getMetadataValueService();
|
||||
private ItemService itemService = ContentServiceFactory.getInstance().getItemService();
|
||||
private WorkspaceItemService workspaceItemService = ContentServiceFactory.getInstance().getWorkspaceItemService();
|
||||
private BasicWorkflowItemService basicWorkflowItemService =
|
||||
BasicWorkflowServiceFactory.getInstance().getBasicWorkflowItemService();
|
||||
private WorkflowItemService workflowItemService =
|
||||
WorkflowServiceFactory.getInstance().getWorkflowItemService();
|
||||
private HandleService handleService = HandleServiceFactory.getInstance().getHandleService();
|
||||
private EPersonService ePersonService = EPersonServiceFactory.getInstance().getEPersonService();
|
||||
private GroupService groupService = EPersonServiceFactory.getInstance().getGroupService();
|
||||
@@ -95,7 +95,7 @@ public class ItemCheck extends Check {
|
||||
|
||||
ret += String.format(
|
||||
"\tWaiting for approval (workflow items): %d\n",
|
||||
basicWorkflowItemService.countTotal(context));
|
||||
workflowItemService.countAll(context));
|
||||
|
||||
} catch (SQLException e) {
|
||||
error(e);
|
||||
@@ -132,7 +132,7 @@ public class ItemCheck extends Check {
|
||||
sb.append(String.format("Count %-14s: %s\n", "Group",
|
||||
String.valueOf(groupService.countTotal(context))));
|
||||
sb.append(String.format("Count %-14s: %s\n", "BasicWorkflowItem",
|
||||
String.valueOf(basicWorkflowItemService.countTotal(context))));
|
||||
String.valueOf(workflowItemService.countAll(context))));
|
||||
sb.append(String.format("Count %-14s: %s\n", "WorkspaceItem",
|
||||
String.valueOf(workspaceItemService.countTotal(context))));
|
||||
return sb.toString();
|
||||
|
@@ -21,8 +21,6 @@ import org.dspace.content.NonUniqueMetadataException;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.services.ConfigurationService;
|
||||
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||
import org.dspace.workflow.factory.WorkflowServiceFactory;
|
||||
import org.dspace.xmlworkflow.service.XmlWorkflowService;
|
||||
import org.flywaydb.core.api.callback.Callback;
|
||||
import org.flywaydb.core.api.callback.Event;
|
||||
import org.slf4j.Logger;
|
||||
@@ -80,13 +78,9 @@ public class DatabaseRegistryUpdater implements Callback {
|
||||
MetadataImporter.loadRegistry(base + namespaceFile, true);
|
||||
}
|
||||
|
||||
// Check if XML Workflow is enabled in workflow.cfg
|
||||
if (WorkflowServiceFactory.getInstance().getWorkflowService() instanceof XmlWorkflowService) {
|
||||
// If so, load in the workflow metadata types as well
|
||||
String workflowTypes = "workflow-types.xml";
|
||||
log.info("Reading {}", workflowTypes);
|
||||
MetadataImporter.loadRegistry(base + workflowTypes, true);
|
||||
}
|
||||
|
||||
context.restoreAuthSystemState();
|
||||
// Commit changes and close context
|
||||
|
@@ -8,8 +8,6 @@
|
||||
package org.dspace.storage.rdbms.migration;
|
||||
|
||||
import org.dspace.storage.rdbms.DatabaseUtils;
|
||||
import org.dspace.workflow.factory.WorkflowServiceFactory;
|
||||
import org.dspace.xmlworkflow.service.XmlWorkflowService;
|
||||
import org.flywaydb.core.api.migration.BaseJavaMigration;
|
||||
import org.flywaydb.core.api.migration.Context;
|
||||
|
||||
@@ -26,10 +24,7 @@ public class V7_0_2018_04_03__Upgrade_Workflow_Policy extends BaseJavaMigration
|
||||
|
||||
@Override
|
||||
public void migrate(Context context) throws Exception {
|
||||
// Make sure XML Workflow is enabled, shouldn't even be needed since this class is only loaded if the service
|
||||
// is enabled.
|
||||
if (WorkflowServiceFactory.getInstance().getWorkflowService() instanceof XmlWorkflowService) {
|
||||
// Now, check if the XMLWorkflow table (cwf_workflowitem) already exists in this database
|
||||
// Check if the XMLWorkflow table (cwf_workflowitem) already exists in this database
|
||||
if (DatabaseUtils.tableExists(context.getConnection(), "cwf_workflowitem")) {
|
||||
String dbtype = DatabaseUtils.getDbType(context.getConnection());
|
||||
|
||||
@@ -45,7 +40,6 @@ public class V7_0_2018_04_03__Upgrade_Workflow_Policy extends BaseJavaMigration
|
||||
migration_file_size = dataMigrateSQL.length();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getChecksum() {
|
||||
|
@@ -12,8 +12,6 @@ import java.sql.SQLException;
|
||||
|
||||
import org.dspace.storage.rdbms.DatabaseUtils;
|
||||
import org.dspace.storage.rdbms.migration.MigrationUtils;
|
||||
import org.dspace.workflow.factory.WorkflowServiceFactory;
|
||||
import org.dspace.xmlworkflow.service.XmlWorkflowService;
|
||||
import org.flywaydb.core.api.migration.BaseJavaMigration;
|
||||
import org.flywaydb.core.api.migration.Context;
|
||||
import org.slf4j.Logger;
|
||||
@@ -55,15 +53,12 @@ public class V5_0_2014_11_04__Enable_XMLWorkflow_Migration
|
||||
@Override
|
||||
public void migrate(Context context)
|
||||
throws IOException, SQLException {
|
||||
// Make sure XML Workflow is enabled, shouldn't even be needed since this class is only loaded if the service
|
||||
// is enabled.
|
||||
if (WorkflowServiceFactory.getInstance().getWorkflowService() instanceof XmlWorkflowService
|
||||
// If your database was upgraded to DSpace 6 prior to enabling XML Workflow, we MUST skip this 5.x
|
||||
// migration, as it is incompatible
|
||||
// with a 6.x database. In that scenario the corresponding 6.x XML Workflow migration will create
|
||||
// necessary tables.
|
||||
&& DatabaseUtils.getCurrentFlywayDSpaceState(context.getConnection()) < 6) {
|
||||
// Now, check if the XMLWorkflow table (cwf_workflowitem) already exists in this database
|
||||
if (DatabaseUtils.getCurrentFlywayDSpaceState(context.getConnection()) < 6) {
|
||||
// Check if the XMLWorkflow table (cwf_workflowitem) already exists in this database
|
||||
// If XMLWorkflow Table does NOT exist in this database, then lets do the migration!
|
||||
// If XMLWorkflow Table ALREADY exists, then this migration is a noop, we assume you manually ran the sql
|
||||
// scripts
|
||||
|
@@ -10,8 +10,6 @@ package org.dspace.storage.rdbms.xmlworkflow;
|
||||
|
||||
import org.dspace.storage.rdbms.DatabaseUtils;
|
||||
import org.dspace.storage.rdbms.migration.MigrationUtils;
|
||||
import org.dspace.workflow.factory.WorkflowServiceFactory;
|
||||
import org.dspace.xmlworkflow.service.XmlWorkflowService;
|
||||
import org.flywaydb.core.api.migration.BaseJavaMigration;
|
||||
import org.flywaydb.core.api.migration.Context;
|
||||
|
||||
@@ -39,10 +37,7 @@ public class V6_0_2015_09_01__DS_2701_Enable_XMLWorkflow_Migration extends BaseJ
|
||||
|
||||
@Override
|
||||
public void migrate(Context context) throws Exception {
|
||||
// Make sure XML Workflow is enabled, shouldn't even be needed since this class is only loaded if the service
|
||||
// is enabled.
|
||||
if (WorkflowServiceFactory.getInstance().getWorkflowService() instanceof XmlWorkflowService) {
|
||||
// Now, check if the XMLWorkflow table (cwf_workflowitem) already exists in this database
|
||||
// Check if the XMLWorkflow table (cwf_workflowitem) already exists in this database
|
||||
// If XMLWorkflow Table does NOT exist in this database, then lets do the migration!
|
||||
// If XMLWorkflow Table ALREADY exists, then this migration is a noop, we assume you manually ran the sql
|
||||
// scripts
|
||||
@@ -85,7 +80,6 @@ public class V6_0_2015_09_01__DS_2701_Enable_XMLWorkflow_Migration extends BaseJ
|
||||
migration_file_size = dbMigrateSQL.length() + dataMigrateSQL.length();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getChecksum() {
|
||||
|
@@ -7,13 +7,128 @@
|
||||
*/
|
||||
package org.dspace.workflow;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.SequenceGenerator;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.dspace.content.Collection;
|
||||
import org.dspace.content.InProgressSubmission;
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.eperson.EPerson;
|
||||
|
||||
/**
|
||||
* Interface representing a workflowitem, each workflowItem implementation must implement this interface.
|
||||
* Class representing an item going through the workflow process in DSpace
|
||||
*
|
||||
* @author kevinvandevelde at atmire.com
|
||||
* @author Bram De Schouwer (bram.deschouwer at dot com)
|
||||
* @author Kevin Van de Velde (kevin at atmire dot com)
|
||||
* @author Ben Bosman (ben at atmire dot com)
|
||||
* @author Mark Diggory (markd at atmire dot com)
|
||||
*/
|
||||
public interface WorkflowItem extends InProgressSubmission {
|
||||
public int getState();
|
||||
@Entity
|
||||
@Table(name = "cwf_workflowitem")
|
||||
public class WorkflowItem implements InProgressSubmission {
|
||||
|
||||
@Id
|
||||
@Column(name = "workflowitem_id")
|
||||
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "cwf_workflowitem_seq")
|
||||
@SequenceGenerator(name = "cwf_workflowitem_seq", sequenceName = "cwf_workflowitem_seq", allocationSize = 1)
|
||||
private Integer id;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "collection_id")
|
||||
private Collection collection;
|
||||
|
||||
@OneToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "item_id", unique = true)
|
||||
private Item item;
|
||||
|
||||
@Column(name = "multiple_titles")
|
||||
private boolean multipleTitles = false;
|
||||
|
||||
@Column(name = "published_before")
|
||||
private boolean publishedBefore = false;
|
||||
|
||||
@Column(name = "multiple_files")
|
||||
private boolean multipleFiles = false;
|
||||
|
||||
/**
|
||||
* Protected constructor, create object using:
|
||||
* {@link WorkflowItemService#create(Context, Item, Collection)}
|
||||
*/
|
||||
protected WorkflowItem() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the internal ID of this workflow item
|
||||
*
|
||||
* @return the internal identifier
|
||||
*/
|
||||
@Override
|
||||
public Integer getID() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Collection getCollection() {
|
||||
return this.collection;
|
||||
}
|
||||
|
||||
public void setCollection(Collection collection) {
|
||||
this.collection = collection;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItem() {
|
||||
return item;
|
||||
}
|
||||
|
||||
public void setItem(Item item) {
|
||||
this.item = item;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EPerson getSubmitter() {
|
||||
return item.getSubmitter();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasMultipleFiles() {
|
||||
return multipleFiles;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMultipleFiles(boolean b) {
|
||||
this.multipleFiles = b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasMultipleTitles() {
|
||||
return this.multipleTitles;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMultipleTitles(boolean b) {
|
||||
this.multipleTitles = b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPublishedBefore() {
|
||||
return this.publishedBefore;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPublishedBefore(boolean b) {
|
||||
this.publishedBefore = b;
|
||||
}
|
||||
}
|
||||
|
@@ -26,9 +26,10 @@ import org.dspace.eperson.EPerson;
|
||||
*
|
||||
* @author kevinvandevelde at atmire.com
|
||||
*/
|
||||
public interface WorkflowItemService<T extends WorkflowItem> extends InProgressSubmissionService<T> {
|
||||
public interface WorkflowItemService extends InProgressSubmissionService<WorkflowItem> {
|
||||
|
||||
public T create(Context context, Item item, Collection collection) throws SQLException, AuthorizeException;
|
||||
public WorkflowItem create(Context context, Item item, Collection collection) throws SQLException,
|
||||
AuthorizeException;
|
||||
|
||||
/**
|
||||
* Get a workflow item from the database.
|
||||
@@ -38,7 +39,7 @@ public interface WorkflowItemService<T extends WorkflowItem> extends InProgressS
|
||||
* @return the workflow item, or null if the ID is invalid.
|
||||
* @throws SQLException An exception that provides information on a database access error or other errors.
|
||||
*/
|
||||
public T find(Context context, int id) throws SQLException;
|
||||
public WorkflowItem find(Context context, int id) throws SQLException;
|
||||
|
||||
/**
|
||||
* return all workflowitems
|
||||
@@ -47,7 +48,7 @@ public interface WorkflowItemService<T extends WorkflowItem> extends InProgressS
|
||||
* @return List of all workflowItems in system
|
||||
* @throws SQLException An exception that provides information on a database access error or other errors.
|
||||
*/
|
||||
public List<T> findAll(Context context) throws SQLException;
|
||||
public List<WorkflowItem> findAll(Context context) throws SQLException;
|
||||
|
||||
/**
|
||||
* Get all workflow items for a particular collection.
|
||||
@@ -57,7 +58,7 @@ public interface WorkflowItemService<T extends WorkflowItem> extends InProgressS
|
||||
* @return array of the corresponding workflow items
|
||||
* @throws SQLException An exception that provides information on a database access error or other errors.
|
||||
*/
|
||||
public List<T> findByCollection(Context context, Collection collection) throws SQLException;
|
||||
public List<WorkflowItem> findByCollection(Context context, Collection collection) throws SQLException;
|
||||
|
||||
/**
|
||||
* Check to see if a particular item is currently under Workflow.
|
||||
@@ -68,7 +69,7 @@ public interface WorkflowItemService<T extends WorkflowItem> extends InProgressS
|
||||
* @return workflow item corresponding to the item, or null
|
||||
* @throws SQLException An exception that provides information on a database access error or other errors.
|
||||
*/
|
||||
public T findByItem(Context context, Item item) throws SQLException;
|
||||
public WorkflowItem findByItem(Context context, Item item) throws SQLException;
|
||||
|
||||
/**
|
||||
* Get all workflow items that were original submissions by a particular
|
||||
@@ -79,7 +80,7 @@ public interface WorkflowItemService<T extends WorkflowItem> extends InProgressS
|
||||
* @return the corresponding workflow items
|
||||
* @throws SQLException An exception that provides information on a database access error or other errors.
|
||||
*/
|
||||
public List<T> findBySubmitter(Context context, EPerson ep) throws SQLException;
|
||||
public List<WorkflowItem> findBySubmitter(Context context, EPerson ep) throws SQLException;
|
||||
|
||||
/**
|
||||
* Delete all workflow items present in the specified collection.
|
||||
@@ -104,6 +105,79 @@ public interface WorkflowItemService<T extends WorkflowItem> extends InProgressS
|
||||
* @throws AuthorizeException Exception indicating the current user of the context does not have permission
|
||||
* to perform a particular action.
|
||||
*/
|
||||
public void delete(Context context, T workflowItem) throws SQLException, AuthorizeException, IOException;
|
||||
public void delete(Context context, WorkflowItem workflowItem)
|
||||
throws SQLException, AuthorizeException, IOException;
|
||||
|
||||
/**
|
||||
* return all workflowitems for a certain page
|
||||
*
|
||||
* @param context The relevant DSpace Context.
|
||||
* @param page paging: page number
|
||||
* @param pagesize paging: items per page
|
||||
* @return WorkflowItem list of all the workflow items in system
|
||||
* @throws SQLException An exception that provides information on a database access error or other errors.
|
||||
*/
|
||||
public List<WorkflowItem> findAll(Context context, Integer page, Integer pagesize) throws SQLException;
|
||||
|
||||
/**
|
||||
* return all workflowitems for a certain page with a certain collection
|
||||
*
|
||||
* @param context The relevant DSpace Context.
|
||||
* @param page paging: page number
|
||||
* @param pagesize paging: items per page
|
||||
* @param collection restrict to this collection
|
||||
* @return WorkflowItem list of all the workflow items in system
|
||||
* @throws SQLException An exception that provides information on a database access error or other errors.
|
||||
*/
|
||||
public List<WorkflowItem> findAllInCollection(Context context, Integer page, Integer pagesize,
|
||||
Collection collection) throws SQLException;
|
||||
|
||||
/**
|
||||
* return how many workflow items appear in the database
|
||||
*
|
||||
* @param context The relevant DSpace Context.
|
||||
* @return the number of workflow items
|
||||
* @throws SQLException An exception that provides information on a database access error or other errors.
|
||||
*/
|
||||
public int countAll(Context context) throws SQLException;
|
||||
|
||||
/**
|
||||
* return how many workflow items that appear in the collection
|
||||
*
|
||||
* @param context The relevant DSpace Context.
|
||||
* @param collection restrict to this collection
|
||||
* @return the number of workflow items
|
||||
* @throws SQLException An exception that provides information on a database access error or other errors.
|
||||
*/
|
||||
public int countAllInCollection(Context context, Collection collection) throws SQLException;
|
||||
|
||||
/**
|
||||
* Return all the workflow items from a specific submitter respecting the pagination parameters
|
||||
*
|
||||
* @param context
|
||||
* The relevant DSpace Context.
|
||||
* @param ep
|
||||
* the eperson that has submitted the item
|
||||
* @param pageNumber
|
||||
* paging: page number
|
||||
* @param pageSize
|
||||
* paging: items per page
|
||||
* @return
|
||||
* @throws SQLException
|
||||
*/
|
||||
public List<WorkflowItem> findBySubmitter(Context context, EPerson ep, Integer pageNumber, Integer pageSize)
|
||||
throws SQLException;
|
||||
|
||||
/**
|
||||
* Count the number of workflow items from a specific submitter
|
||||
*
|
||||
* @param context
|
||||
* The relevant DSpace Context.
|
||||
* @param ep
|
||||
* the eperson that has submitted the item
|
||||
* @return
|
||||
* @throws SQLException
|
||||
*/
|
||||
public int countBySubmitter(Context context, EPerson ep) throws SQLException;
|
||||
|
||||
}
|
||||
|
@@ -5,7 +5,7 @@
|
||||
*
|
||||
* http://www.dspace.org/license/
|
||||
*/
|
||||
package org.dspace.xmlworkflow.storedcomponents;
|
||||
package org.dspace.workflow;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
@@ -21,24 +21,24 @@ import org.dspace.core.Context;
|
||||
import org.dspace.core.LogManager;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.xmlworkflow.service.WorkflowRequirementsService;
|
||||
import org.dspace.xmlworkflow.storedcomponents.dao.XmlWorkflowItemDAO;
|
||||
import org.dspace.xmlworkflow.storedcomponents.WorkflowItemRole;
|
||||
import org.dspace.xmlworkflow.storedcomponents.dao.WorkflowItemDAO;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.ClaimedTaskService;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.PoolTaskService;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.WorkflowItemRoleService;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.XmlWorkflowItemService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
* Service implementation for the XmlWorkflowItem object.
|
||||
* This class is responsible for all business logic calls for the XmlWorkflowItem object and is autowired by spring.
|
||||
* Service implementation for the WorkflowItem object.
|
||||
* This class is responsible for all business logic calls for the WorkflowItem object and is autowired by spring.
|
||||
* This class should never be accessed directly.
|
||||
*
|
||||
* @author kevinvandevelde at atmire.com
|
||||
*/
|
||||
public class XmlWorkflowItemServiceImpl implements XmlWorkflowItemService {
|
||||
public class WorkflowItemServiceImpl implements WorkflowItemService {
|
||||
|
||||
@Autowired(required = true)
|
||||
protected XmlWorkflowItemDAO xmlWorkflowItemDAO;
|
||||
protected WorkflowItemDAO workflowItemDAO;
|
||||
|
||||
|
||||
@Autowired(required = true)
|
||||
@@ -55,25 +55,25 @@ public class XmlWorkflowItemServiceImpl implements XmlWorkflowItemService {
|
||||
/*
|
||||
* The current step in the workflow system in which this workflow item is present
|
||||
*/
|
||||
private Logger log = org.apache.logging.log4j.LogManager.getLogger(XmlWorkflowItemServiceImpl.class);
|
||||
private Logger log = org.apache.logging.log4j.LogManager.getLogger(WorkflowItemServiceImpl.class);
|
||||
|
||||
|
||||
protected XmlWorkflowItemServiceImpl() {
|
||||
protected WorkflowItemServiceImpl() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public XmlWorkflowItem create(Context context, Item item, Collection collection)
|
||||
public WorkflowItem create(Context context, Item item, Collection collection)
|
||||
throws SQLException, AuthorizeException {
|
||||
XmlWorkflowItem xmlWorkflowItem = xmlWorkflowItemDAO.create(context, new XmlWorkflowItem());
|
||||
xmlWorkflowItem.setItem(item);
|
||||
xmlWorkflowItem.setCollection(collection);
|
||||
return xmlWorkflowItem;
|
||||
WorkflowItem workflowItem = workflowItemDAO.create(context, new WorkflowItem());
|
||||
workflowItem.setItem(item);
|
||||
workflowItem.setCollection(collection);
|
||||
return workflowItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public XmlWorkflowItem find(Context context, int id) throws SQLException {
|
||||
XmlWorkflowItem workflowItem = xmlWorkflowItemDAO.findByID(context, XmlWorkflowItem.class, id);
|
||||
public WorkflowItem find(Context context, int id) throws SQLException {
|
||||
WorkflowItem workflowItem = workflowItemDAO.findByID(context, WorkflowItem.class, id);
|
||||
|
||||
if (workflowItem == null) {
|
||||
if (log.isDebugEnabled()) {
|
||||
@@ -90,69 +90,69 @@ public class XmlWorkflowItemServiceImpl implements XmlWorkflowItemService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<XmlWorkflowItem> findAll(Context context) throws SQLException {
|
||||
return xmlWorkflowItemDAO.findAll(context, XmlWorkflowItem.class);
|
||||
public List<WorkflowItem> findAll(Context context) throws SQLException {
|
||||
return workflowItemDAO.findAll(context, WorkflowItem.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<XmlWorkflowItem> findAll(Context context, Integer page, Integer pagesize) throws SQLException {
|
||||
public List<WorkflowItem> findAll(Context context, Integer page, Integer pagesize) throws SQLException {
|
||||
return findAllInCollection(context, page, pagesize, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<XmlWorkflowItem> findAllInCollection(Context context, Integer page, Integer pagesize,
|
||||
public List<WorkflowItem> findAllInCollection(Context context, Integer page, Integer pagesize,
|
||||
Collection collection) throws SQLException {
|
||||
Integer offset = null;
|
||||
if (page != null && pagesize != null) {
|
||||
offset = page * pagesize;
|
||||
}
|
||||
return xmlWorkflowItemDAO.findAllInCollection(context, offset, pagesize, collection);
|
||||
return workflowItemDAO.findAllInCollection(context, offset, pagesize, collection);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int countAll(Context context) throws SQLException {
|
||||
return xmlWorkflowItemDAO.countAll(context);
|
||||
return workflowItemDAO.countAll(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int countAllInCollection(Context context, Collection collection) throws SQLException {
|
||||
return xmlWorkflowItemDAO.countAllInCollection(context, collection);
|
||||
return workflowItemDAO.countAllInCollection(context, collection);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<XmlWorkflowItem> findBySubmitter(Context context, EPerson ep) throws SQLException {
|
||||
return xmlWorkflowItemDAO.findBySubmitter(context, ep);
|
||||
public List<WorkflowItem> findBySubmitter(Context context, EPerson ep) throws SQLException {
|
||||
return workflowItemDAO.findBySubmitter(context, ep);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<XmlWorkflowItem> findBySubmitter(Context context, EPerson ep, Integer pageNumber, Integer pageSize)
|
||||
public List<WorkflowItem> findBySubmitter(Context context, EPerson ep, Integer pageNumber, Integer pageSize)
|
||||
throws SQLException {
|
||||
Integer offset = null;
|
||||
if (pageNumber != null && pageSize != null) {
|
||||
offset = pageNumber * pageSize;
|
||||
}
|
||||
return xmlWorkflowItemDAO.findBySubmitter(context, ep, pageNumber, pageSize);
|
||||
return workflowItemDAO.findBySubmitter(context, ep, pageNumber, pageSize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int countBySubmitter(Context context, EPerson ep) throws SQLException {
|
||||
return xmlWorkflowItemDAO.countBySubmitter(context, ep);
|
||||
return workflowItemDAO.countBySubmitter(context, ep);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByCollection(Context context, Collection collection)
|
||||
throws SQLException, IOException, AuthorizeException {
|
||||
List<XmlWorkflowItem> xmlWorkflowItems = findByCollection(context, collection);
|
||||
Iterator<XmlWorkflowItem> iterator = xmlWorkflowItems.iterator();
|
||||
List<WorkflowItem> workflowItems = findByCollection(context, collection);
|
||||
Iterator<WorkflowItem> iterator = workflowItems.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
XmlWorkflowItem workflowItem = iterator.next();
|
||||
WorkflowItem workflowItem = iterator.next();
|
||||
iterator.remove();
|
||||
delete(context, workflowItem);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(Context context, XmlWorkflowItem workflowItem)
|
||||
public void delete(Context context, WorkflowItem workflowItem)
|
||||
throws SQLException, AuthorizeException, IOException {
|
||||
Item item = workflowItem.getItem();
|
||||
// Need to delete the workspaceitem row first since it refers
|
||||
@@ -164,17 +164,17 @@ public class XmlWorkflowItemServiceImpl implements XmlWorkflowItemService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<XmlWorkflowItem> findByCollection(Context context, Collection collection) throws SQLException {
|
||||
return xmlWorkflowItemDAO.findByCollection(context, collection);
|
||||
public List<WorkflowItem> findByCollection(Context context, Collection collection) throws SQLException {
|
||||
return workflowItemDAO.findByCollection(context, collection);
|
||||
}
|
||||
|
||||
@Override
|
||||
public XmlWorkflowItem findByItem(Context context, Item item) throws SQLException {
|
||||
return xmlWorkflowItemDAO.findByItem(context, item);
|
||||
public WorkflowItem findByItem(Context context, Item item) throws SQLException {
|
||||
return workflowItemDAO.findByItem(context, item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Context context, XmlWorkflowItem workflowItem) throws SQLException, AuthorizeException {
|
||||
public void update(Context context, WorkflowItem workflowItem) throws SQLException, AuthorizeException {
|
||||
// FIXME check auth
|
||||
log.info(LogManager.getHeader(context, "update_workflow_item",
|
||||
"workflowitem_id=" + workflowItem.getID()));
|
||||
@@ -182,11 +182,11 @@ public class XmlWorkflowItemServiceImpl implements XmlWorkflowItemService {
|
||||
// Update the item
|
||||
itemService.update(context, workflowItem.getItem());
|
||||
|
||||
xmlWorkflowItemDAO.save(context, workflowItem);
|
||||
workflowItemDAO.save(context, workflowItem);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteWrapper(Context context, XmlWorkflowItem workflowItem) throws SQLException, AuthorizeException {
|
||||
public void deleteWrapper(Context context, WorkflowItem workflowItem) throws SQLException, AuthorizeException {
|
||||
List<WorkflowItemRole> roles = workflowItemRoleService.findByWorkflowItem(context, workflowItem);
|
||||
Iterator<WorkflowItemRole> workflowItemRoleIterator = roles.iterator();
|
||||
while (workflowItemRoleIterator.hasNext()) {
|
||||
@@ -200,12 +200,12 @@ public class XmlWorkflowItemServiceImpl implements XmlWorkflowItemService {
|
||||
claimedTaskService.deleteByWorkflowItem(context, workflowItem);
|
||||
|
||||
// FIXME - auth?
|
||||
xmlWorkflowItemDAO.delete(context, workflowItem);
|
||||
workflowItemDAO.delete(context, workflowItem);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void move(Context context, XmlWorkflowItem inProgressSubmission, Collection fromCollection,
|
||||
public void move(Context context, WorkflowItem inProgressSubmission, Collection fromCollection,
|
||||
Collection toCollection) {
|
||||
// TODO not implemented yet
|
||||
}
|
@@ -10,27 +10,37 @@ package org.dspace.workflow;
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import javax.mail.MessagingException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.content.Collection;
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.content.WorkspaceItem;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.eperson.Group;
|
||||
import org.dspace.xmlworkflow.RoleMembers;
|
||||
import org.dspace.xmlworkflow.WorkflowConfigurationException;
|
||||
import org.dspace.xmlworkflow.state.Step;
|
||||
import org.dspace.xmlworkflow.state.Workflow;
|
||||
import org.dspace.xmlworkflow.state.actions.ActionResult;
|
||||
import org.dspace.xmlworkflow.state.actions.WorkflowActionConfig;
|
||||
import org.dspace.xmlworkflow.storedcomponents.ClaimedTask;
|
||||
import org.dspace.xmlworkflow.storedcomponents.PoolTask;
|
||||
|
||||
/**
|
||||
* Service interface class for the WorkflowService framework.
|
||||
* All WorkflowServices service classes should implement this class since it offers some basic methods which all
|
||||
* Workflows
|
||||
* are required to have.
|
||||
* When an item is submitted and is somewhere in a workflow, it has a row in the
|
||||
* cwf_workflowitem table pointing to it.
|
||||
*
|
||||
* @param <T> some implementation of workflow item.
|
||||
* @author kevinvandevelde at atmire.com
|
||||
* Once the item has completed the workflow it will be archived
|
||||
*
|
||||
* @author Bram De Schouwer (bram.deschouwer at dot com)
|
||||
* @author Kevin Van de Velde (kevin at atmire dot com)
|
||||
* @author Ben Bosman (ben at atmire dot com)
|
||||
* @author Mark Diggory (markd at atmire dot com)
|
||||
*/
|
||||
public interface WorkflowService<T extends WorkflowItem> {
|
||||
|
||||
|
||||
public interface WorkflowService {
|
||||
/**
|
||||
* startWorkflow() begins a workflow - in a single transaction do away with
|
||||
* the PersonalWorkspace entry and turn it into a WorkflowItem.
|
||||
@@ -44,7 +54,7 @@ public interface WorkflowService<T extends WorkflowItem> {
|
||||
* @throws IOException A general class of exceptions produced by failed or interrupted I/O operations.
|
||||
* @throws WorkflowException if workflow error
|
||||
*/
|
||||
public T start(Context context, WorkspaceItem wsi)
|
||||
public WorkflowItem start(Context context, WorkspaceItem wsi)
|
||||
throws SQLException, AuthorizeException, IOException, WorkflowException;
|
||||
|
||||
/**
|
||||
@@ -61,7 +71,7 @@ public interface WorkflowService<T extends WorkflowItem> {
|
||||
* @throws IOException A general class of exceptions produced by failed or interrupted I/O operations.
|
||||
* @throws WorkflowException if workflow error
|
||||
*/
|
||||
public T startWithoutNotify(Context c, WorkspaceItem wsi)
|
||||
public WorkflowItem startWithoutNotify(Context c, WorkspaceItem wsi)
|
||||
throws SQLException, AuthorizeException, IOException, WorkflowException;
|
||||
|
||||
/**
|
||||
@@ -78,7 +88,8 @@ public interface WorkflowService<T extends WorkflowItem> {
|
||||
* to perform a particular action.
|
||||
* @throws IOException A general class of exceptions produced by failed or interrupted I/O operations.
|
||||
*/
|
||||
public WorkspaceItem abort(Context c, T wi, EPerson e) throws SQLException, AuthorizeException, IOException;
|
||||
public WorkspaceItem abort(Context c, WorkflowItem wi, EPerson e)
|
||||
throws SQLException, AuthorizeException, IOException;
|
||||
|
||||
/**
|
||||
* Deletes workflow task item in correct order.
|
||||
@@ -91,10 +102,11 @@ public interface WorkflowService<T extends WorkflowItem> {
|
||||
* to perform a particular action.
|
||||
* @throws IOException A general class of exceptions produced by failed or interrupted I/O operations.
|
||||
*/
|
||||
public void deleteWorkflowByWorkflowItem(Context c, T wi, EPerson e)
|
||||
public void deleteWorkflowByWorkflowItem(Context c, WorkflowItem wi, EPerson e)
|
||||
throws SQLException, AuthorizeException, IOException;
|
||||
|
||||
public WorkspaceItem sendWorkflowItemBackSubmission(Context c, T workflowItem, EPerson e, String provenance,
|
||||
public WorkspaceItem sendWorkflowItemBackSubmission(Context c, WorkflowItem workflowItem, EPerson e,
|
||||
String provenance,
|
||||
String rejection_message)
|
||||
throws SQLException, AuthorizeException, IOException;
|
||||
|
||||
@@ -123,4 +135,40 @@ public interface WorkflowService<T extends WorkflowItem> {
|
||||
throws AuthorizeException, SQLException, IOException, WorkflowConfigurationException;
|
||||
|
||||
public List<String> getFlywayMigrationLocations();
|
||||
|
||||
public void alertUsersOnTaskActivation(Context c, WorkflowItem wfi, String emailTemplate, List<EPerson> epa,
|
||||
String... arguments) throws IOException, SQLException, MessagingException;
|
||||
|
||||
public WorkflowActionConfig doState(Context c, EPerson user, HttpServletRequest request, int workflowItemId,
|
||||
Workflow workflow, WorkflowActionConfig currentActionConfig)
|
||||
throws SQLException, AuthorizeException, IOException, MessagingException, WorkflowException;
|
||||
|
||||
public WorkflowActionConfig processOutcome(Context c, EPerson user, Workflow workflow, Step currentStep,
|
||||
WorkflowActionConfig currentActionConfig, ActionResult currentOutcome,
|
||||
WorkflowItem wfi, boolean enteredNewStep)
|
||||
throws IOException, AuthorizeException, SQLException, WorkflowException;
|
||||
|
||||
public void deleteAllTasks(Context context, WorkflowItem wi) throws SQLException, AuthorizeException;
|
||||
|
||||
public void deleteAllPooledTasks(Context c, WorkflowItem wi) throws SQLException, AuthorizeException;
|
||||
|
||||
public void deletePooledTask(Context context, WorkflowItem wi, PoolTask task)
|
||||
throws SQLException, AuthorizeException;
|
||||
|
||||
public void deleteClaimedTask(Context c, WorkflowItem wi, ClaimedTask task)
|
||||
throws SQLException, AuthorizeException;
|
||||
|
||||
public void createPoolTasks(Context context, WorkflowItem wi, RoleMembers assignees, Step step,
|
||||
WorkflowActionConfig action)
|
||||
throws SQLException, AuthorizeException;
|
||||
|
||||
public void createOwnedTask(Context context, WorkflowItem wi, Step step, WorkflowActionConfig action, EPerson e)
|
||||
throws SQLException, AuthorizeException;
|
||||
|
||||
public void grantUserAllItemPolicies(Context context, Item item, EPerson epa, String actionType)
|
||||
throws AuthorizeException, SQLException;
|
||||
|
||||
public void removeUserItemPolicies(Context context, Item item, EPerson e) throws SQLException, AuthorizeException;
|
||||
|
||||
public String getEPersonName(EPerson ePerson);
|
||||
}
|
||||
|
@@ -10,6 +10,13 @@ package org.dspace.workflow.factory;
|
||||
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||
import org.dspace.workflow.WorkflowItemService;
|
||||
import org.dspace.workflow.WorkflowService;
|
||||
import org.dspace.xmlworkflow.factory.XmlWorkflowFactory;
|
||||
import org.dspace.xmlworkflow.service.WorkflowRequirementsService;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.ClaimedTaskService;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.CollectionRoleService;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.InProgressUserService;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.PoolTaskService;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.WorkflowItemRoleService;
|
||||
|
||||
/**
|
||||
* Abstract factory to get services for the workflow package, use WorkflowServiceFactory.getInstance() to retrieve an
|
||||
@@ -19,8 +26,22 @@ import org.dspace.workflow.WorkflowService;
|
||||
*/
|
||||
public abstract class WorkflowServiceFactory {
|
||||
|
||||
public abstract XmlWorkflowFactory getWorkflowFactory();
|
||||
|
||||
public abstract WorkflowRequirementsService getWorkflowRequirementsService();
|
||||
|
||||
public abstract WorkflowService getWorkflowService();
|
||||
|
||||
public abstract ClaimedTaskService getClaimedTaskService();
|
||||
|
||||
public abstract CollectionRoleService getCollectionRoleService();
|
||||
|
||||
public abstract InProgressUserService getInProgressUserService();
|
||||
|
||||
public abstract PoolTaskService getPoolTaskService();
|
||||
|
||||
public abstract WorkflowItemRoleService getWorkflowItemRoleService();
|
||||
|
||||
public abstract WorkflowItemService getWorkflowItemService();
|
||||
|
||||
public static WorkflowServiceFactory getInstance() {
|
||||
|
@@ -5,18 +5,17 @@
|
||||
*
|
||||
* http://www.dspace.org/license/
|
||||
*/
|
||||
package org.dspace.xmlworkflow.factory;
|
||||
package org.dspace.workflow.factory;
|
||||
|
||||
import org.dspace.workflow.WorkflowItemService;
|
||||
import org.dspace.workflow.WorkflowService;
|
||||
import org.dspace.xmlworkflow.factory.XmlWorkflowFactory;
|
||||
import org.dspace.xmlworkflow.service.WorkflowRequirementsService;
|
||||
import org.dspace.xmlworkflow.service.XmlWorkflowService;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.ClaimedTaskService;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.CollectionRoleService;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.InProgressUserService;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.PoolTaskService;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.WorkflowItemRoleService;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.XmlWorkflowItemService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
@@ -25,14 +24,14 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
*
|
||||
* @author kevinvandevelde at atmire.com
|
||||
*/
|
||||
public class XmlWorkflowServiceFactoryImpl extends XmlWorkflowServiceFactory {
|
||||
public class WorkflowServiceFactoryImpl extends WorkflowServiceFactory {
|
||||
|
||||
@Autowired(required = true)
|
||||
private XmlWorkflowFactory workflowFactory;
|
||||
@Autowired(required = true)
|
||||
private WorkflowRequirementsService workflowRequirementsService;
|
||||
@Autowired(required = true)
|
||||
private XmlWorkflowService xmlWorkflowService;
|
||||
private WorkflowService workflowService;
|
||||
@Autowired(required = true)
|
||||
private ClaimedTaskService claimedTaskService;
|
||||
@Autowired(required = true)
|
||||
@@ -44,7 +43,7 @@ public class XmlWorkflowServiceFactoryImpl extends XmlWorkflowServiceFactory {
|
||||
@Autowired(required = true)
|
||||
private WorkflowItemRoleService workflowItemRoleService;
|
||||
@Autowired(required = true)
|
||||
private XmlWorkflowItemService xmlWorkflowItemService;
|
||||
private WorkflowItemService workflowItemService;
|
||||
|
||||
@Override
|
||||
public XmlWorkflowFactory getWorkflowFactory() {
|
||||
@@ -57,8 +56,8 @@ public class XmlWorkflowServiceFactoryImpl extends XmlWorkflowServiceFactory {
|
||||
}
|
||||
|
||||
@Override
|
||||
public XmlWorkflowService getXmlWorkflowService() {
|
||||
return xmlWorkflowService;
|
||||
public WorkflowService getWorkflowService() {
|
||||
return workflowService;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -86,18 +85,8 @@ public class XmlWorkflowServiceFactoryImpl extends XmlWorkflowServiceFactory {
|
||||
return workflowItemRoleService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public XmlWorkflowItemService getXmlWorkflowItemService() {
|
||||
return xmlWorkflowItemService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WorkflowService getWorkflowService() {
|
||||
return getXmlWorkflowService();
|
||||
}
|
||||
|
||||
@Override
|
||||
public WorkflowItemService getWorkflowItemService() {
|
||||
return getXmlWorkflowItemService();
|
||||
return workflowItemService;
|
||||
}
|
||||
}
|
@@ -1,41 +0,0 @@
|
||||
<!--
|
||||
|
||||
The contents of this file are subject to the license and copyright
|
||||
detailed in the LICENSE and NOTICE files at the root of the source
|
||||
tree and available online at
|
||||
|
||||
http://www.dspace.org/license/
|
||||
|
||||
-->
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||||
<html>
|
||||
<head>
|
||||
<!--
|
||||
Author: dstuve
|
||||
Version: $Id$
|
||||
Date: $Date$
|
||||
-->
|
||||
</head>
|
||||
<body bgcolor="white">
|
||||
<p>DSpace's workflow system</p>
|
||||
|
||||
<p>
|
||||
DSpace has a simple workflow system, which models the workflows
|
||||
as 5 steps: SUBMIT, three intermediate steps (STEP1, STEP2, STEP3), and ARCHIVE.
|
||||
When an item is submitted to DSpace, it is in the SUBMIT state. If there
|
||||
are no intermediate states defined, then it proceeds directly to ARCHIVE and
|
||||
is put into the main DSpace archive.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
EPerson groups may be assigned to the three possible intermediate steps,
|
||||
where they are expected to act on the item at those steps. For example,
|
||||
if a Collection's owners desire a review step, they would create a Group
|
||||
of reviewers, and assign that Group to step 1. The members of step 1's
|
||||
Group will receive emails asking them to review the submission, and
|
||||
will need to perform an action on the item before it can be rejected
|
||||
back to the submitter or placed in the archive.
|
||||
</p>
|
||||
|
||||
</body>
|
||||
</html>
|
@@ -1,185 +0,0 @@
|
||||
/**
|
||||
* The contents of this file are subject to the license and copyright
|
||||
* detailed in the LICENSE and NOTICE files at the root of the source
|
||||
* tree and available online at
|
||||
*
|
||||
* http://www.dspace.org/license/
|
||||
*/
|
||||
package org.dspace.workflowbasic;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.SequenceGenerator;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.dspace.content.Collection;
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
|
||||
/**
|
||||
* Class representing an item going through the workflow process in DSpace
|
||||
*
|
||||
* @author Robert Tansley
|
||||
* @version $Revision$
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "workflowitem")
|
||||
public class BasicWorkflowItem implements WorkflowItem {
|
||||
|
||||
@Id
|
||||
@Column(name = "workflow_id", unique = true, nullable = false)
|
||||
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "workflowitem_seq")
|
||||
@SequenceGenerator(name = "workflowitem_seq", sequenceName = "workflowitem_seq", allocationSize = 1)
|
||||
private Integer workflowitemId;
|
||||
|
||||
|
||||
/**
|
||||
* The item this workflow object pertains to
|
||||
*/
|
||||
@OneToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "item_id", unique = true)
|
||||
private Item item;
|
||||
|
||||
/**
|
||||
* The collection the item is being submitted to
|
||||
*/
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "collection_id")
|
||||
private Collection collection;
|
||||
|
||||
/**
|
||||
* EPerson owning the current state
|
||||
*/
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "owner")
|
||||
private EPerson owner;
|
||||
|
||||
@Column(name = "state")
|
||||
private int state;
|
||||
|
||||
@Column(name = "multiple_titles")
|
||||
private boolean multipleTitles = false;
|
||||
|
||||
@Column(name = "published_before")
|
||||
private boolean publishedBefore = false;
|
||||
|
||||
@Column(name = "multiple_files")
|
||||
private boolean multipleFiles = false;
|
||||
|
||||
/**
|
||||
* Protected constructor, create object using:
|
||||
* {@link org.dspace.workflowbasic.service.BasicWorkflowItemService#create(Context, Item, Collection)}
|
||||
*/
|
||||
protected BasicWorkflowItem() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the internal ID of this workflow item
|
||||
*
|
||||
* @return the internal identifier
|
||||
*/
|
||||
@Override
|
||||
public Integer getID() {
|
||||
return workflowitemId;
|
||||
}
|
||||
|
||||
/**
|
||||
* get owner of WorkflowItem
|
||||
*
|
||||
* @return EPerson owner
|
||||
*/
|
||||
public EPerson getOwner() {
|
||||
return owner;
|
||||
}
|
||||
|
||||
/**
|
||||
* set owner of WorkflowItem
|
||||
*
|
||||
* @param ep owner
|
||||
*/
|
||||
public void setOwner(EPerson ep) {
|
||||
this.owner = ep;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get state of WorkflowItem
|
||||
*
|
||||
* @return state
|
||||
*/
|
||||
public int getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set state of WorkflowItem
|
||||
*
|
||||
* @param newstate new state (from <code>WorkflowManager</code>)
|
||||
*/
|
||||
public void setState(int newstate) {
|
||||
this.state = newstate;
|
||||
}
|
||||
|
||||
// InProgressSubmission methods
|
||||
@Override
|
||||
public Item getItem() {
|
||||
return item;
|
||||
}
|
||||
|
||||
void setItem(Item item) {
|
||||
this.item = item;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection getCollection() {
|
||||
return collection;
|
||||
}
|
||||
|
||||
public void setCollection(Collection collection) {
|
||||
this.collection = collection;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EPerson getSubmitter() {
|
||||
return item.getSubmitter();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasMultipleFiles() {
|
||||
return multipleFiles;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMultipleFiles(boolean b) {
|
||||
this.multipleFiles = b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasMultipleTitles() {
|
||||
return multipleTitles;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMultipleTitles(boolean b) {
|
||||
this.multipleTitles = b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPublishedBefore() {
|
||||
return publishedBefore;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPublishedBefore(boolean b) {
|
||||
this.publishedBefore = b;
|
||||
}
|
||||
}
|
@@ -1,171 +0,0 @@
|
||||
/**
|
||||
* The contents of this file are subject to the license and copyright
|
||||
* detailed in the LICENSE and NOTICE files at the root of the source
|
||||
* tree and available online at
|
||||
*
|
||||
* http://www.dspace.org/license/
|
||||
*/
|
||||
package org.dspace.workflowbasic;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.content.Collection;
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.content.service.ItemService;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.LogManager;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.workflowbasic.dao.BasicWorkflowItemDAO;
|
||||
import org.dspace.workflowbasic.service.BasicWorkflowItemService;
|
||||
import org.dspace.workflowbasic.service.TaskListItemService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
* Service implementation for the BasicWorkflowItem object.
|
||||
* This class is responsible for all business logic calls for the BasicWorkflowItem object and is autowired by spring.
|
||||
* This class should never be accessed directly.
|
||||
*
|
||||
* @author kevinvandevelde at atmire.com
|
||||
*/
|
||||
public class BasicWorkflowItemServiceImpl implements BasicWorkflowItemService {
|
||||
|
||||
/**
|
||||
* log4j category
|
||||
*/
|
||||
protected static Logger log = org.apache.logging.log4j.LogManager.getLogger(BasicWorkflowItem.class);
|
||||
|
||||
@Autowired(required = true)
|
||||
protected BasicWorkflowItemDAO workflowItemDAO;
|
||||
|
||||
@Autowired(required = true)
|
||||
protected ItemService itemService;
|
||||
@Autowired(required = true)
|
||||
protected TaskListItemService taskListItemService;
|
||||
|
||||
|
||||
protected BasicWorkflowItemServiceImpl() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasicWorkflowItem create(Context context, Item item, Collection collection)
|
||||
throws SQLException, AuthorizeException {
|
||||
if (findByItem(context, item) != null) {
|
||||
throw new IllegalArgumentException(
|
||||
"Unable to create a workflow item for an item that already has a workflow item.");
|
||||
}
|
||||
BasicWorkflowItem workflowItem = workflowItemDAO.create(context, new BasicWorkflowItem());
|
||||
workflowItem.setItem(item);
|
||||
workflowItem.setCollection(collection);
|
||||
update(context, workflowItem);
|
||||
return workflowItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasicWorkflowItem find(Context context, int id) throws SQLException {
|
||||
BasicWorkflowItem workflowItem = workflowItemDAO.findByID(context, BasicWorkflowItem.class, id);
|
||||
|
||||
if (workflowItem == null) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug(LogManager.getHeader(context, "find_workflow_item",
|
||||
"not_found,workflow_id=" + id));
|
||||
}
|
||||
} else {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug(LogManager.getHeader(context, "find_workflow_item",
|
||||
"workflow_id=" + id));
|
||||
}
|
||||
}
|
||||
return workflowItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BasicWorkflowItem> findAll(Context context) throws SQLException {
|
||||
return workflowItemDAO.findAll(context, BasicWorkflowItem.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BasicWorkflowItem> findBySubmitter(Context context, EPerson ep) throws SQLException {
|
||||
return workflowItemDAO.findBySubmitter(context, ep);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByCollection(Context context, Collection collection)
|
||||
throws SQLException, IOException, AuthorizeException {
|
||||
List<BasicWorkflowItem> workflowItems = findByCollection(context, collection);
|
||||
Iterator<BasicWorkflowItem> iterator = workflowItems.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
BasicWorkflowItem workflowItem = iterator.next();
|
||||
iterator.remove();
|
||||
delete(context, workflowItem);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(Context context, BasicWorkflowItem workflowItem)
|
||||
throws SQLException, AuthorizeException, IOException {
|
||||
Item item = workflowItem.getItem();
|
||||
deleteWrapper(context, workflowItem);
|
||||
itemService.delete(context, item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BasicWorkflowItem> findByCollection(Context context, Collection collection) throws SQLException {
|
||||
return workflowItemDAO.findByCollection(context, collection);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasicWorkflowItem findByItem(Context context, Item item) throws SQLException {
|
||||
return workflowItemDAO.findByItem(context, item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteWrapper(Context context, BasicWorkflowItem workflowItem) throws SQLException, AuthorizeException {
|
||||
// delete any pending tasks
|
||||
taskListItemService.deleteByWorkflowItem(context, workflowItem);
|
||||
|
||||
// FIXME - auth?
|
||||
workflowItemDAO.delete(context, workflowItem);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Context context, BasicWorkflowItem workflowItem) throws SQLException, AuthorizeException {
|
||||
// FIXME check auth
|
||||
log.info(LogManager.getHeader(context, "update_workflow_item",
|
||||
"workflow_item_id=" + workflowItem.getID()));
|
||||
|
||||
|
||||
// Update the item
|
||||
itemService.update(context, workflowItem.getItem());
|
||||
|
||||
// Update ourselves
|
||||
workflowItemDAO.save(context, workflowItem);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BasicWorkflowItem> findPooledTasks(Context context, EPerson ePerson) throws SQLException {
|
||||
return workflowItemDAO.findByPooledTasks(context, ePerson);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BasicWorkflowItem> findByOwner(Context context, EPerson ePerson) throws SQLException {
|
||||
return workflowItemDAO.findByOwner(context, ePerson);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int countTotal(Context context) throws SQLException {
|
||||
return workflowItemDAO.countRows(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void move(Context context, BasicWorkflowItem inProgressSubmission, Collection fromCollection,
|
||||
Collection toCollection) {
|
||||
// TODO not implemented yet
|
||||
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@@ -1,79 +0,0 @@
|
||||
/**
|
||||
* The contents of this file are subject to the license and copyright
|
||||
* detailed in the LICENSE and NOTICE files at the root of the source
|
||||
* tree and available online at
|
||||
*
|
||||
* http://www.dspace.org/license/
|
||||
*/
|
||||
package org.dspace.workflowbasic;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.SequenceGenerator;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.ReloadableEntity;
|
||||
import org.dspace.eperson.EPerson;
|
||||
|
||||
/**
|
||||
* Database entity representation of the TaskListItem table
|
||||
*
|
||||
* @author kevinvandevelde at atmire.com
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "tasklistitem")
|
||||
public class TaskListItem implements ReloadableEntity<Integer> {
|
||||
|
||||
@Id
|
||||
@Column(name = "tasklist_id", unique = true, nullable = false)
|
||||
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "tasklistitem_seq")
|
||||
@SequenceGenerator(name = "tasklistitem_seq", sequenceName = "tasklistitem_seq", allocationSize = 1)
|
||||
private int taskListItemId;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "eperson_id")
|
||||
private EPerson ePerson;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "workflow_id")
|
||||
private BasicWorkflowItem workflowItem;
|
||||
|
||||
/**
|
||||
* Protected constructor, create object using:
|
||||
* {@link org.dspace.workflowbasic.service.TaskListItemService#create(Context, BasicWorkflowItem, EPerson)}
|
||||
*/
|
||||
protected TaskListItem() {
|
||||
|
||||
}
|
||||
|
||||
public int getTaskListItemId() {
|
||||
return taskListItemId;
|
||||
}
|
||||
|
||||
public EPerson getEPerson() {
|
||||
return ePerson;
|
||||
}
|
||||
|
||||
public BasicWorkflowItem getWorkflowItem() {
|
||||
return workflowItem;
|
||||
}
|
||||
|
||||
void setEPerson(EPerson ePerson) {
|
||||
this.ePerson = ePerson;
|
||||
}
|
||||
|
||||
void setWorkflowItem(BasicWorkflowItem workflowItem) {
|
||||
this.workflowItem = workflowItem;
|
||||
}
|
||||
|
||||
public Integer getID() {
|
||||
return taskListItemId;
|
||||
}
|
||||
}
|
@@ -1,69 +0,0 @@
|
||||
/**
|
||||
* The contents of this file are subject to the license and copyright
|
||||
* detailed in the LICENSE and NOTICE files at the root of the source
|
||||
* tree and available online at
|
||||
*
|
||||
* http://www.dspace.org/license/
|
||||
*/
|
||||
package org.dspace.workflowbasic;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.workflowbasic.dao.TaskListItemDAO;
|
||||
import org.dspace.workflowbasic.service.TaskListItemService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
* Service implementation for the TaskListItem object.
|
||||
* This class is responsible for all business logic calls for the TaskListItem object and is autowired by spring.
|
||||
* This class should never be accessed directly.
|
||||
*
|
||||
* @author kevinvandevelde at atmire.com
|
||||
*/
|
||||
public class TaskListItemServiceImpl implements TaskListItemService {
|
||||
|
||||
@Autowired(required = true)
|
||||
protected TaskListItemDAO taskListItemDAO;
|
||||
|
||||
protected TaskListItemServiceImpl() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public TaskListItem create(Context context, BasicWorkflowItem workflowItem, EPerson ePerson) throws SQLException {
|
||||
TaskListItem taskListItem = taskListItemDAO.create(context, new TaskListItem());
|
||||
taskListItem.setWorkflowItem(workflowItem);
|
||||
taskListItem.setEPerson(ePerson);
|
||||
update(context, taskListItem);
|
||||
return taskListItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByWorkflowItem(Context context, BasicWorkflowItem workflowItem) throws SQLException {
|
||||
taskListItemDAO.deleteByWorkflowItem(context, workflowItem);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByWorkflowItemAndEPerson(Context context, BasicWorkflowItem workflowItem, EPerson ePerson)
|
||||
throws SQLException {
|
||||
taskListItemDAO.deleteByWorkflowItemAndEPerson(context, workflowItem, ePerson);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByEPerson(Context context, EPerson ePerson) throws SQLException {
|
||||
taskListItemDAO.deleteByEPerson(context, ePerson);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Context context, TaskListItem taskListItem) throws SQLException {
|
||||
taskListItemDAO.save(context, taskListItem);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TaskListItem> findByEPerson(Context context, EPerson ePerson) throws SQLException {
|
||||
return taskListItemDAO.findByEPerson(context, ePerson);
|
||||
}
|
||||
}
|
@@ -1,41 +0,0 @@
|
||||
/**
|
||||
* The contents of this file are subject to the license and copyright
|
||||
* detailed in the LICENSE and NOTICE files at the root of the source
|
||||
* tree and available online at
|
||||
*
|
||||
* http://www.dspace.org/license/
|
||||
*/
|
||||
package org.dspace.workflowbasic.dao;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
import org.dspace.content.Collection;
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.GenericDAO;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.workflowbasic.BasicWorkflowItem;
|
||||
|
||||
/**
|
||||
* Database Access Object interface class for the BasicWorkflowItem object.
|
||||
* The implementation of this class is responsible for all database calls for the BasicWorkflowItem object and is
|
||||
* autowired by spring
|
||||
* This class should only be accessed from a single service and should never be exposed outside of the API
|
||||
*
|
||||
* @author kevinvandevelde at atmire.com
|
||||
*/
|
||||
public interface BasicWorkflowItemDAO extends GenericDAO<BasicWorkflowItem> {
|
||||
|
||||
public BasicWorkflowItem findByItem(Context context, Item i) throws SQLException;
|
||||
|
||||
public List<BasicWorkflowItem> findBySubmitter(Context context, EPerson ep) throws SQLException;
|
||||
|
||||
public List<BasicWorkflowItem> findByCollection(Context context, Collection c) throws SQLException;
|
||||
|
||||
public List<BasicWorkflowItem> findByPooledTasks(Context context, EPerson ePerson) throws SQLException;
|
||||
|
||||
public List<BasicWorkflowItem> findByOwner(Context context, EPerson ePerson) throws SQLException;
|
||||
|
||||
int countRows(Context context) throws SQLException;
|
||||
}
|
@@ -1,37 +0,0 @@
|
||||
/**
|
||||
* The contents of this file are subject to the license and copyright
|
||||
* detailed in the LICENSE and NOTICE files at the root of the source
|
||||
* tree and available online at
|
||||
*
|
||||
* http://www.dspace.org/license/
|
||||
*/
|
||||
package org.dspace.workflowbasic.dao;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.GenericDAO;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.workflowbasic.BasicWorkflowItem;
|
||||
import org.dspace.workflowbasic.TaskListItem;
|
||||
|
||||
/**
|
||||
* Database Access Object interface class for the TaskListItem object.
|
||||
* The implementation of this class is responsible for all database calls for the TaskListItem object and is
|
||||
* autowired by spring
|
||||
* This class should only be accessed from a single service and should never be exposed outside of the API
|
||||
*
|
||||
* @author kevinvandevelde at atmire.com
|
||||
*/
|
||||
public interface TaskListItemDAO extends GenericDAO<TaskListItem> {
|
||||
|
||||
public void deleteByWorkflowItem(Context context, BasicWorkflowItem workflowItem) throws SQLException;
|
||||
|
||||
public void deleteByWorkflowItemAndEPerson(Context context, BasicWorkflowItem workflowItem, EPerson ePerson)
|
||||
throws SQLException;
|
||||
|
||||
public void deleteByEPerson(Context context, EPerson ePerson) throws SQLException;
|
||||
|
||||
public List<TaskListItem> findByEPerson(Context context, EPerson ePerson) throws SQLException;
|
||||
}
|
@@ -1,105 +0,0 @@
|
||||
/**
|
||||
* The contents of this file are subject to the license and copyright
|
||||
* detailed in the LICENSE and NOTICE files at the root of the source
|
||||
* tree and available online at
|
||||
*
|
||||
* http://www.dspace.org/license/
|
||||
*/
|
||||
package org.dspace.workflowbasic.dao.impl;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import javax.persistence.Query;
|
||||
import javax.persistence.criteria.CriteriaBuilder;
|
||||
import javax.persistence.criteria.CriteriaQuery;
|
||||
import javax.persistence.criteria.Join;
|
||||
import javax.persistence.criteria.Root;
|
||||
|
||||
import org.dspace.content.Collection;
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.content.Item_;
|
||||
import org.dspace.core.AbstractHibernateDAO;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.workflowbasic.BasicWorkflowItem;
|
||||
import org.dspace.workflowbasic.BasicWorkflowItem_;
|
||||
import org.dspace.workflowbasic.dao.BasicWorkflowItemDAO;
|
||||
|
||||
/**
|
||||
* Hibernate implementation of the Database Access Object interface class for the BasicWorkflowItem object.
|
||||
* This class is responsible for all database calls for the BasicWorkflowItem object and is autowired by spring
|
||||
* This class should never be accessed directly.
|
||||
*
|
||||
* @author kevinvandevelde at atmire.com
|
||||
*/
|
||||
public class BasicWorkflowItemDAOImpl extends AbstractHibernateDAO<BasicWorkflowItem> implements BasicWorkflowItemDAO {
|
||||
protected BasicWorkflowItemDAOImpl() {
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public BasicWorkflowItem findByItem(Context context, Item i) throws SQLException {
|
||||
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
|
||||
CriteriaQuery criteriaQuery = getCriteriaQuery(criteriaBuilder, BasicWorkflowItem.class);
|
||||
Root<BasicWorkflowItem> basicWorkflowItemRoot = criteriaQuery.from(BasicWorkflowItem.class);
|
||||
criteriaQuery.select(basicWorkflowItemRoot);
|
||||
criteriaQuery.where(criteriaBuilder.equal(basicWorkflowItemRoot.get(BasicWorkflowItem_.item), i));
|
||||
return uniqueResult(context, criteriaQuery, false, BasicWorkflowItem.class, -1, -1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BasicWorkflowItem> findBySubmitter(Context context, EPerson ep) throws SQLException {
|
||||
|
||||
|
||||
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
|
||||
CriteriaQuery criteriaQuery = getCriteriaQuery(criteriaBuilder, BasicWorkflowItem.class);
|
||||
Root<BasicWorkflowItem> basicWorkflowItemRoot = criteriaQuery.from(BasicWorkflowItem.class);
|
||||
Join<BasicWorkflowItem, Item> join = basicWorkflowItemRoot.join("item");
|
||||
criteriaQuery.select(basicWorkflowItemRoot);
|
||||
criteriaQuery.where(criteriaBuilder.equal(join.get(Item_.submitter), ep));
|
||||
|
||||
List<javax.persistence.criteria.Order> orderList = new LinkedList<>();
|
||||
orderList.add(criteriaBuilder.asc(basicWorkflowItemRoot.get(BasicWorkflowItem_.workflowitemId)));
|
||||
criteriaQuery.orderBy(orderList);
|
||||
|
||||
|
||||
return list(context, criteriaQuery, false, BasicWorkflowItem.class, -1, -1);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BasicWorkflowItem> findByCollection(Context context, Collection c) throws SQLException {
|
||||
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
|
||||
CriteriaQuery criteriaQuery = getCriteriaQuery(criteriaBuilder, BasicWorkflowItem.class);
|
||||
Root<BasicWorkflowItem> basicWorkflowItemRoot = criteriaQuery.from(BasicWorkflowItem.class);
|
||||
criteriaQuery.select(basicWorkflowItemRoot);
|
||||
criteriaQuery.where(criteriaBuilder.equal(basicWorkflowItemRoot.get(BasicWorkflowItem_.collection), c));
|
||||
return list(context, criteriaQuery, false, BasicWorkflowItem.class, -1, -1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BasicWorkflowItem> findByPooledTasks(Context context, EPerson ePerson) throws SQLException {
|
||||
String queryString = "select wf from TaskListItem as tli join tli.workflowItem wf where tli.ePerson = " +
|
||||
":eperson ORDER BY wf.workflowitemId";
|
||||
Query query = createQuery(context, queryString);
|
||||
query.setParameter("eperson", ePerson);
|
||||
return list(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BasicWorkflowItem> findByOwner(Context context, EPerson ePerson) throws SQLException {
|
||||
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
|
||||
CriteriaQuery criteriaQuery = getCriteriaQuery(criteriaBuilder, BasicWorkflowItem.class);
|
||||
Root<BasicWorkflowItem> basicWorkflowItemRoot = criteriaQuery.from(BasicWorkflowItem.class);
|
||||
criteriaQuery.select(basicWorkflowItemRoot);
|
||||
criteriaQuery.where(criteriaBuilder.equal(basicWorkflowItemRoot.get(BasicWorkflowItem_.owner), ePerson));
|
||||
return list(context, criteriaQuery, false, BasicWorkflowItem.class, -1, -1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int countRows(Context context) throws SQLException {
|
||||
return count(createQuery(context, "SELECT count(*) FROM BasicWorkflowItem"));
|
||||
}
|
||||
}
|
@@ -1,72 +0,0 @@
|
||||
/**
|
||||
* The contents of this file are subject to the license and copyright
|
||||
* detailed in the LICENSE and NOTICE files at the root of the source
|
||||
* tree and available online at
|
||||
*
|
||||
* http://www.dspace.org/license/
|
||||
*/
|
||||
package org.dspace.workflowbasic.dao.impl;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import javax.persistence.Query;
|
||||
import javax.persistence.criteria.CriteriaBuilder;
|
||||
import javax.persistence.criteria.CriteriaQuery;
|
||||
import javax.persistence.criteria.Root;
|
||||
|
||||
import org.dspace.core.AbstractHibernateDAO;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.workflowbasic.BasicWorkflowItem;
|
||||
import org.dspace.workflowbasic.TaskListItem;
|
||||
import org.dspace.workflowbasic.TaskListItem_;
|
||||
import org.dspace.workflowbasic.dao.TaskListItemDAO;
|
||||
|
||||
/**
|
||||
* Hibernate implementation of the Database Access Object interface class for the TaskListItem object.
|
||||
* This class is responsible for all database calls for the TaskListItem object and is autowired by spring
|
||||
* This class should never be accessed directly.
|
||||
*
|
||||
* @author kevinvandevelde at atmire.com
|
||||
*/
|
||||
public class TaskListItemDAOImpl extends AbstractHibernateDAO<TaskListItem> implements TaskListItemDAO {
|
||||
protected TaskListItemDAOImpl() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByWorkflowItem(Context context, BasicWorkflowItem workflowItem) throws SQLException {
|
||||
String queryString = "delete from TaskListItem where workflowItem = :workflowItem";
|
||||
Query query = createQuery(context, queryString);
|
||||
query.setParameter("workflowItem", workflowItem);
|
||||
query.executeUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByWorkflowItemAndEPerson(Context context, BasicWorkflowItem workflowItem, EPerson ePerson)
|
||||
throws SQLException {
|
||||
String queryString = "delete from TaskListItem where workflowItem = :workflowItem AND ePerson = :ePerson";
|
||||
Query query = createQuery(context, queryString);
|
||||
query.setParameter("workflowItem", workflowItem);
|
||||
query.setParameter("ePerson", ePerson);
|
||||
query.executeUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByEPerson(Context context, EPerson ePerson) throws SQLException {
|
||||
String queryString = "delete from TaskListItem where ePerson = :ePerson";
|
||||
Query query = createQuery(context, queryString);
|
||||
query.setParameter("ePerson", ePerson);
|
||||
query.executeUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TaskListItem> findByEPerson(Context context, EPerson ePerson) throws SQLException {
|
||||
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
|
||||
CriteriaQuery criteriaQuery = getCriteriaQuery(criteriaBuilder, TaskListItem.class);
|
||||
Root<TaskListItem> taskListItemRoot = criteriaQuery.from(TaskListItem.class);
|
||||
criteriaQuery.select(taskListItemRoot);
|
||||
criteriaQuery.where(criteriaBuilder.equal(taskListItemRoot.get(TaskListItem_.ePerson), ePerson));
|
||||
return list(context, criteriaQuery, false, TaskListItem.class, -1, -1);
|
||||
}
|
||||
}
|
@@ -1,34 +0,0 @@
|
||||
/**
|
||||
* The contents of this file are subject to the license and copyright
|
||||
* detailed in the LICENSE and NOTICE files at the root of the source
|
||||
* tree and available online at
|
||||
*
|
||||
* http://www.dspace.org/license/
|
||||
*/
|
||||
package org.dspace.workflowbasic.factory;
|
||||
|
||||
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||
import org.dspace.workflow.factory.WorkflowServiceFactory;
|
||||
import org.dspace.workflowbasic.service.BasicWorkflowItemService;
|
||||
import org.dspace.workflowbasic.service.BasicWorkflowService;
|
||||
import org.dspace.workflowbasic.service.TaskListItemService;
|
||||
|
||||
/**
|
||||
* Abstract factory to get services for the workflowbasic package, use BasicWorkflowServiceFactory.getInstance() to
|
||||
* retrieve an implementation
|
||||
*
|
||||
* @author kevinvandevelde at atmire.com
|
||||
*/
|
||||
public abstract class BasicWorkflowServiceFactory extends WorkflowServiceFactory {
|
||||
|
||||
public abstract BasicWorkflowService getBasicWorkflowService();
|
||||
|
||||
public abstract BasicWorkflowItemService getBasicWorkflowItemService();
|
||||
|
||||
public abstract TaskListItemService getTaskListItemService();
|
||||
|
||||
public static BasicWorkflowServiceFactory getInstance() {
|
||||
return DSpaceServicesFactory.getInstance().getServiceManager()
|
||||
.getServiceByName("workflowServiceFactory", BasicWorkflowServiceFactory.class);
|
||||
}
|
||||
}
|
@@ -1,57 +0,0 @@
|
||||
/**
|
||||
* The contents of this file are subject to the license and copyright
|
||||
* detailed in the LICENSE and NOTICE files at the root of the source
|
||||
* tree and available online at
|
||||
*
|
||||
* http://www.dspace.org/license/
|
||||
*/
|
||||
package org.dspace.workflowbasic.factory;
|
||||
|
||||
import org.dspace.workflow.WorkflowItemService;
|
||||
import org.dspace.workflow.WorkflowService;
|
||||
import org.dspace.workflowbasic.service.BasicWorkflowItemService;
|
||||
import org.dspace.workflowbasic.service.BasicWorkflowService;
|
||||
import org.dspace.workflowbasic.service.TaskListItemService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
* Factory implementation to get services for the workflowbasic package, use BasicWorkflowServiceFactory.getInstance
|
||||
* () to retrieve an implementation
|
||||
*
|
||||
* @author kevinvandevelde at atmire.com
|
||||
*/
|
||||
public class BasicWorkflowServiceFactoryImpl extends BasicWorkflowServiceFactory {
|
||||
|
||||
@Autowired(required = true)
|
||||
private BasicWorkflowService basicWorkflowService;
|
||||
@Autowired(required = true)
|
||||
private BasicWorkflowItemService basicWorkflowItemService;
|
||||
@Autowired(required = true)
|
||||
private TaskListItemService taskListItemService;
|
||||
|
||||
|
||||
@Override
|
||||
public BasicWorkflowService getBasicWorkflowService() {
|
||||
return basicWorkflowService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasicWorkflowItemService getBasicWorkflowItemService() {
|
||||
return basicWorkflowItemService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TaskListItemService getTaskListItemService() {
|
||||
return taskListItemService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WorkflowService getWorkflowService() {
|
||||
return getBasicWorkflowService();
|
||||
}
|
||||
|
||||
@Override
|
||||
public WorkflowItemService getWorkflowItemService() {
|
||||
return getBasicWorkflowItemService();
|
||||
}
|
||||
}
|
@@ -1,40 +0,0 @@
|
||||
/**
|
||||
* The contents of this file are subject to the license and copyright
|
||||
* detailed in the LICENSE and NOTICE files at the root of the source
|
||||
* tree and available online at
|
||||
*
|
||||
* http://www.dspace.org/license/
|
||||
*/
|
||||
package org.dspace.workflowbasic.service;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.workflow.WorkflowItemService;
|
||||
import org.dspace.workflowbasic.BasicWorkflowItem;
|
||||
|
||||
/**
|
||||
* Service interface class for the BasicWorkflowItem object.
|
||||
* The implementation of this class is responsible for all business logic calls for the BasicWorkflowItem object and
|
||||
* is autowired by spring
|
||||
*
|
||||
* @author kevinvandevelde at atmire.com
|
||||
*/
|
||||
public interface BasicWorkflowItemService extends WorkflowItemService<BasicWorkflowItem> {
|
||||
|
||||
public List<BasicWorkflowItem> findPooledTasks(Context context, EPerson ePerson) throws SQLException;
|
||||
|
||||
/**
|
||||
* Retrieve the list of BasicWorkflowItems that the given EPerson is owner of (owner == claimed for review)
|
||||
*
|
||||
* @param context The relevant DSpace Context.
|
||||
* @param ePerson The DSpace EPerson object.
|
||||
* @return a list of BasicWorkflowItem objects
|
||||
* @throws SQLException An exception that provides information on a database access error or other errors.
|
||||
*/
|
||||
public List<BasicWorkflowItem> findByOwner(Context context, EPerson ePerson) throws SQLException;
|
||||
|
||||
int countTotal(Context context) throws SQLException;
|
||||
}
|
@@ -1,206 +0,0 @@
|
||||
/**
|
||||
* The contents of this file are subject to the license and copyright
|
||||
* detailed in the LICENSE and NOTICE files at the root of the source
|
||||
* tree and available online at
|
||||
*
|
||||
* http://www.dspace.org/license/
|
||||
*/
|
||||
package org.dspace.workflowbasic.service;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.workflow.WorkflowService;
|
||||
import org.dspace.workflowbasic.BasicWorkflowItem;
|
||||
|
||||
/**
|
||||
* Workflow state machine
|
||||
*
|
||||
* Notes:
|
||||
*
|
||||
* Determining item status from the database:
|
||||
*
|
||||
* When an item has not been submitted yet, it is in the user's personal
|
||||
* workspace (there is a row in PersonalWorkspace pointing to it.)
|
||||
*
|
||||
* When an item is submitted and is somewhere in a workflow, it has a row in the
|
||||
* WorkflowItem table pointing to it. The state of the workflow can be
|
||||
* determined by looking at WorkflowItem.getState()
|
||||
*
|
||||
* When a submission is complete, the WorkflowItem pointing to the item is
|
||||
* destroyed and the archive() method is called, which hooks the item up to the
|
||||
* archive.
|
||||
*
|
||||
* Notification: When an item enters a state that requires notification,
|
||||
* (WFSTATE_STEP1POOL, WFSTATE_STEP2POOL, WFSTATE_STEP3POOL,) the workflow needs
|
||||
* to notify the appropriate groups that they have a pending task to claim.
|
||||
*
|
||||
* Revealing lists of approvers, editors, and reviewers. A method could be added
|
||||
* to do this, but it isn't strictly necessary. (say public List
|
||||
* getStateEPeople( WorkflowItem wi, int state ) could return people affected by
|
||||
* the item's current state.
|
||||
*/
|
||||
public interface BasicWorkflowService extends WorkflowService<BasicWorkflowItem> {
|
||||
|
||||
// states to store in WorkflowItem for the GUI to report on
|
||||
// fits our current set of workflow states (stored in WorkflowItem.state)
|
||||
public static final int WFSTATE_SUBMIT = 0; // hmm, probably don't need
|
||||
|
||||
public static final int WFSTATE_STEP1POOL = 1; // waiting for a reviewer to
|
||||
// claim it
|
||||
|
||||
public static final int WFSTATE_STEP1 = 2; // task - reviewer has claimed it
|
||||
|
||||
public static final int WFSTATE_STEP2POOL = 3; // waiting for an admin to
|
||||
// claim it
|
||||
|
||||
public static final int WFSTATE_STEP2 = 4; // task - admin has claimed item
|
||||
|
||||
public static final int WFSTATE_STEP3POOL = 5; // waiting for an editor to
|
||||
// claim it
|
||||
|
||||
public static final int WFSTATE_STEP3 = 6; // task - editor has claimed the
|
||||
// item
|
||||
|
||||
public static final int WFSTATE_ARCHIVE = 7; // probably don't need this one
|
||||
// either
|
||||
|
||||
/**
|
||||
* Translate symbolic name of workflow state into number.
|
||||
* The name is case-insensitive. Returns -1 when name cannot
|
||||
* be matched.
|
||||
*
|
||||
* @param state symbolic name of workflow state, must be one of
|
||||
* the elements of workflowText array.
|
||||
* @return numeric workflow state or -1 for error.
|
||||
*/
|
||||
public int getWorkflowID(String state);
|
||||
|
||||
/**
|
||||
* getOwnedTasks() returns a List of WorkflowItems containing the tasks
|
||||
* claimed and owned by an EPerson. The GUI displays this info on the
|
||||
* MyDSpace page.
|
||||
*
|
||||
* @param context The relevant DSpace Context.
|
||||
* @param e The EPerson we want to fetch owned tasks for.
|
||||
* @return list of basic workflow items
|
||||
* @throws SQLException An exception that provides information on a database access error or other errors.
|
||||
*/
|
||||
public List<BasicWorkflowItem> getOwnedTasks(Context context, EPerson e)
|
||||
throws java.sql.SQLException;
|
||||
|
||||
/**
|
||||
* getPooledTasks() returns a List of WorkflowItems an EPerson could claim
|
||||
* (as a reviewer, etc.) for display on a user's MyDSpace page.
|
||||
*
|
||||
* @param context The relevant DSpace Context.
|
||||
* @param e The Eperson we want to fetch the pooled tasks for.
|
||||
* @return list of basic workflow items
|
||||
* @throws SQLException An exception that provides information on a database access error or other errors.
|
||||
*/
|
||||
public List<BasicWorkflowItem> getPooledTasks(Context context, EPerson e) throws SQLException;
|
||||
|
||||
/**
|
||||
* claim() claims a workflow task for an EPerson
|
||||
*
|
||||
* @param context The relevant DSpace Context.
|
||||
* @param workflowItem WorkflowItem to do the claim on
|
||||
* @param e The EPerson doing the claim
|
||||
* @throws SQLException An exception that provides information on a database access error or other errors.
|
||||
* @throws IOException A general class of exceptions produced by failed or interrupted I/O operations.
|
||||
* @throws AuthorizeException Exception indicating the current user of the context does not have permission
|
||||
* to perform a particular action.
|
||||
*/
|
||||
public void claim(Context context, BasicWorkflowItem workflowItem, EPerson e)
|
||||
throws SQLException, IOException, AuthorizeException;
|
||||
|
||||
|
||||
/**
|
||||
* advance() sends an item forward in the workflow (reviewers,
|
||||
* approvers, and editors all do an 'approve' to move the item forward) if
|
||||
* the item arrives at the submit state, then remove the WorkflowItem and
|
||||
* call the archive() method to put it in the archive, and email notify the
|
||||
* submitter of a successful submission
|
||||
*
|
||||
* @param context The relevant DSpace Context.
|
||||
* @param workflowItem WorkflowItem do do the approval on
|
||||
* @param e EPerson doing the approval
|
||||
* @throws SQLException An exception that provides information on a database access error or other errors.
|
||||
* @throws IOException A general class of exceptions produced by failed or interrupted I/O operations.
|
||||
* @throws AuthorizeException Exception indicating the current user of the context does not have permission
|
||||
* to perform a particular action.
|
||||
*/
|
||||
public void advance(Context context, BasicWorkflowItem workflowItem, EPerson e)
|
||||
throws SQLException, IOException, AuthorizeException;
|
||||
|
||||
/**
|
||||
* advance() sends an item forward in the workflow (reviewers,
|
||||
* approvers, and editors all do an 'approve' to move the item forward) if
|
||||
* the item arrives at the submit state, then remove the WorkflowItem and
|
||||
* call the archive() method to put it in the archive, and email notify the
|
||||
* submitter of a successful submission
|
||||
*
|
||||
* @param context The relevant DSpace Context.
|
||||
* @param workflowItem WorkflowItem do do the approval on
|
||||
* @param e EPerson doing the approval
|
||||
* @param curate boolean indicating whether curation tasks should be done
|
||||
* @param record boolean indicating whether to record action
|
||||
* @return true if the item was successfully archived
|
||||
* @throws SQLException An exception that provides information on a database access error or other errors.
|
||||
* @throws IOException A general class of exceptions produced by failed or interrupted I/O operations.
|
||||
* @throws AuthorizeException Exception indicating the current user of the context does not have permission
|
||||
* to perform a particular action.
|
||||
*/
|
||||
public boolean advance(Context context, BasicWorkflowItem workflowItem, EPerson e,
|
||||
boolean curate, boolean record)
|
||||
throws SQLException, IOException, AuthorizeException;
|
||||
|
||||
/**
|
||||
* unclaim() returns an owned task/item to the pool
|
||||
*
|
||||
* @param context Context
|
||||
* @param workflowItem WorkflowItem to operate on
|
||||
* @param e EPerson doing the operation
|
||||
* @throws SQLException An exception that provides information on a database access error or other errors.
|
||||
* @throws IOException A general class of exceptions produced by failed or interrupted I/O operations.
|
||||
* @throws AuthorizeException Exception indicating the current user of the context does not have permission
|
||||
* to perform a particular action.
|
||||
*/
|
||||
public void unclaim(Context context, BasicWorkflowItem workflowItem, EPerson e)
|
||||
throws SQLException, IOException, AuthorizeException;
|
||||
|
||||
/**
|
||||
* Get the text representing the given workflow state
|
||||
*
|
||||
* @param state the workflow state
|
||||
* @return the text representation
|
||||
*/
|
||||
public String getWorkflowText(int state);
|
||||
|
||||
|
||||
// send notices of curation activity
|
||||
public void notifyOfCuration(Context c, BasicWorkflowItem wi, List<EPerson> ePeople,
|
||||
String taskName, String action, String message) throws SQLException, IOException;
|
||||
|
||||
/**
|
||||
* get the title of the item in this workflow
|
||||
*
|
||||
* @param wi the workflow item object
|
||||
* @return item title
|
||||
* @throws SQLException An exception that provides information on a database access error or other errors.
|
||||
*/
|
||||
public String getItemTitle(BasicWorkflowItem wi) throws SQLException;
|
||||
|
||||
/**
|
||||
* get the name of the eperson who started this workflow
|
||||
*
|
||||
* @param wi the workflow item
|
||||
* @return submitter's name
|
||||
* @throws SQLException An exception that provides information on a database access error or other errors.
|
||||
*/
|
||||
public String getSubmitterName(BasicWorkflowItem wi) throws SQLException;
|
||||
}
|
@@ -1,39 +0,0 @@
|
||||
/**
|
||||
* The contents of this file are subject to the license and copyright
|
||||
* detailed in the LICENSE and NOTICE files at the root of the source
|
||||
* tree and available online at
|
||||
*
|
||||
* http://www.dspace.org/license/
|
||||
*/
|
||||
package org.dspace.workflowbasic.service;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.workflowbasic.BasicWorkflowItem;
|
||||
import org.dspace.workflowbasic.TaskListItem;
|
||||
|
||||
/**
|
||||
* Service interface class for the TaskListItem object.
|
||||
* The implementation of this class is responsible for all business logic calls for the TaskListItem object and is
|
||||
* autowired by spring
|
||||
*
|
||||
* @author kevinvandevelde at atmire.com
|
||||
*/
|
||||
public interface TaskListItemService {
|
||||
|
||||
public TaskListItem create(Context context, BasicWorkflowItem workflowItem, EPerson ePerson) throws SQLException;
|
||||
|
||||
public void deleteByWorkflowItem(Context context, BasicWorkflowItem workflowItem) throws SQLException;
|
||||
|
||||
public void deleteByWorkflowItemAndEPerson(Context context, BasicWorkflowItem workflowItem, EPerson ePerson)
|
||||
throws SQLException;
|
||||
|
||||
public void deleteByEPerson(Context context, EPerson ePerson) throws SQLException;
|
||||
|
||||
public void update(Context context, TaskListItem taskListItem) throws SQLException;
|
||||
|
||||
public List<TaskListItem> findByEPerson(Context context, EPerson ePerson) throws SQLException;
|
||||
}
|
@@ -14,9 +14,9 @@ import org.dspace.core.Context;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.eperson.Group;
|
||||
import org.dspace.eperson.service.GroupService;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
import org.dspace.xmlworkflow.storedcomponents.CollectionRole;
|
||||
import org.dspace.xmlworkflow.storedcomponents.WorkflowItemRole;
|
||||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.CollectionRoleService;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.WorkflowItemRoleService;
|
||||
import org.springframework.beans.factory.BeanNameAware;
|
||||
@@ -79,7 +79,7 @@ public class Role implements BeanNameAware {
|
||||
return scope;
|
||||
}
|
||||
|
||||
public RoleMembers getMembers(Context context, XmlWorkflowItem wfi) throws SQLException {
|
||||
public RoleMembers getMembers(Context context, WorkflowItem wfi) throws SQLException {
|
||||
if (scope == Scope.REPOSITORY) {
|
||||
Group group = groupService.findByName(context, name);
|
||||
if (group == null) {
|
||||
|
@@ -17,17 +17,17 @@ import org.dspace.authorize.ResourcePolicy;
|
||||
import org.dspace.content.service.ItemService;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
import org.dspace.workflow.WorkflowItemService;
|
||||
import org.dspace.workflow.WorkflowService;
|
||||
import org.dspace.xmlworkflow.factory.XmlWorkflowFactory;
|
||||
import org.dspace.xmlworkflow.service.WorkflowRequirementsService;
|
||||
import org.dspace.xmlworkflow.service.XmlWorkflowService;
|
||||
import org.dspace.xmlworkflow.state.Step;
|
||||
import org.dspace.xmlworkflow.state.Workflow;
|
||||
import org.dspace.xmlworkflow.storedcomponents.InProgressUser;
|
||||
import org.dspace.xmlworkflow.storedcomponents.PoolTask;
|
||||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.InProgressUserService;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.PoolTaskService;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.XmlWorkflowItemService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
@@ -52,22 +52,22 @@ public class WorkflowRequirementsServiceImpl implements WorkflowRequirementsServ
|
||||
@Autowired(required = true)
|
||||
protected XmlWorkflowFactory workflowFactory;
|
||||
@Autowired(required = true)
|
||||
protected XmlWorkflowItemService xmlWorkflowItemService;
|
||||
protected WorkflowItemService workflowItemService;
|
||||
@Autowired(required = true)
|
||||
protected XmlWorkflowService xmlWorkflowService;
|
||||
protected WorkflowService workflowService;
|
||||
|
||||
protected WorkflowRequirementsServiceImpl() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addClaimedUser(Context context, XmlWorkflowItem wfi, Step step, EPerson user)
|
||||
public void addClaimedUser(Context context, WorkflowItem wfi, Step step, EPerson user)
|
||||
throws SQLException, AuthorizeException, IOException {
|
||||
|
||||
//Make sure we delete the pooled task for our current user if the task is not a group pooltask
|
||||
PoolTask task = poolTaskService.findByWorkflowIdAndEPerson(context, wfi, user);
|
||||
if (task != null && task.getEperson() != null) {
|
||||
xmlWorkflowService.deletePooledTask(context, wfi, task);
|
||||
workflowService.deletePooledTask(context, wfi, task);
|
||||
}
|
||||
|
||||
InProgressUser ipu = inProgressUserService.create(context);
|
||||
@@ -77,21 +77,21 @@ public class WorkflowRequirementsServiceImpl implements WorkflowRequirementsServ
|
||||
inProgressUserService.update(context, ipu);
|
||||
|
||||
//Make sure the user has the necessary rights to update the item after the tasks is removed from the pool
|
||||
xmlWorkflowService.grantUserAllItemPolicies(context, wfi.getItem(), user, ResourcePolicy.TYPE_WORKFLOW);
|
||||
workflowService.grantUserAllItemPolicies(context, wfi.getItem(), user, ResourcePolicy.TYPE_WORKFLOW);
|
||||
|
||||
int totalUsers = inProgressUserService.getNumberOfInProgressUsers(context, wfi) + inProgressUserService
|
||||
.getNumberOfFinishedUsers(context, wfi);
|
||||
|
||||
if (totalUsers == step.getRequiredUsers()) {
|
||||
//If enough users have claimed/finished this step then remove the tasks
|
||||
xmlWorkflowService.deleteAllPooledTasks(context, wfi);
|
||||
workflowService.deleteAllPooledTasks(context, wfi);
|
||||
}
|
||||
|
||||
xmlWorkflowItemService.update(context, wfi);
|
||||
workflowItemService.update(context, wfi);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeClaimedUser(Context context, XmlWorkflowItem wfi, EPerson user, String stepID)
|
||||
public void removeClaimedUser(Context context, WorkflowItem wfi, EPerson user, String stepID)
|
||||
throws SQLException, IOException, WorkflowConfigurationException, AuthorizeException {
|
||||
//Check if we had reached our max number @ this moment
|
||||
int totalUsers = inProgressUserService.getNumberOfInProgressUsers(context, wfi) + inProgressUserService
|
||||
@@ -101,7 +101,7 @@ public class WorkflowRequirementsServiceImpl implements WorkflowRequirementsServ
|
||||
inProgressUserService.delete(context, inProgressUserService.findByWorkflowItemAndEPerson(context, wfi, user));
|
||||
|
||||
//Make sure the removed user has his custom rights removed
|
||||
xmlWorkflowService.removeUserItemPolicies(context, wfi.getItem(), user);
|
||||
workflowService.removeUserItemPolicies(context, wfi.getItem(), user);
|
||||
|
||||
Workflow workflow = workflowFactory.getWorkflow(wfi.getCollection());
|
||||
Step step = workflow.getStep(stepID);
|
||||
@@ -142,7 +142,7 @@ public class WorkflowRequirementsServiceImpl implements WorkflowRequirementsServ
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addFinishedUser(Context c, XmlWorkflowItem wfi, EPerson user) throws AuthorizeException, SQLException {
|
||||
public void addFinishedUser(Context c, WorkflowItem wfi, EPerson user) throws AuthorizeException, SQLException {
|
||||
InProgressUser ipu = inProgressUserService.findByWorkflowItemAndEPerson(c, wfi, user);
|
||||
ipu.setFinished(true);
|
||||
inProgressUserService.update(c, ipu);
|
||||
@@ -150,7 +150,7 @@ public class WorkflowRequirementsServiceImpl implements WorkflowRequirementsServ
|
||||
|
||||
|
||||
@Override
|
||||
public void clearInProgressUsers(Context c, XmlWorkflowItem wfi) throws AuthorizeException, SQLException {
|
||||
public void clearInProgressUsers(Context c, WorkflowItem wfi) throws AuthorizeException, SQLException {
|
||||
Iterator<InProgressUser> ipus = inProgressUserService.findByWorkflowItem(c, wfi).iterator();
|
||||
while (ipus.hasNext()) {
|
||||
InProgressUser ipu = ipus.next();
|
||||
|
@@ -54,9 +54,11 @@ import org.dspace.services.ConfigurationService;
|
||||
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||
import org.dspace.usage.UsageWorkflowEvent;
|
||||
import org.dspace.workflow.WorkflowException;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
import org.dspace.workflow.WorkflowItemService;
|
||||
import org.dspace.workflow.WorkflowService;
|
||||
import org.dspace.xmlworkflow.factory.XmlWorkflowFactory;
|
||||
import org.dspace.xmlworkflow.service.WorkflowRequirementsService;
|
||||
import org.dspace.xmlworkflow.service.XmlWorkflowService;
|
||||
import org.dspace.xmlworkflow.state.Step;
|
||||
import org.dspace.xmlworkflow.state.Workflow;
|
||||
import org.dspace.xmlworkflow.state.actions.Action;
|
||||
@@ -64,17 +66,15 @@ import org.dspace.xmlworkflow.state.actions.ActionResult;
|
||||
import org.dspace.xmlworkflow.state.actions.WorkflowActionConfig;
|
||||
import org.dspace.xmlworkflow.storedcomponents.ClaimedTask;
|
||||
import org.dspace.xmlworkflow.storedcomponents.PoolTask;
|
||||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.ClaimedTaskService;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.CollectionRoleService;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.PoolTaskService;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.WorkflowItemRoleService;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.XmlWorkflowItemService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
* When an item is submitted and is somewhere in a workflow, it has a row in the
|
||||
* WorkflowItem table pointing to it.
|
||||
* cwf_workflowitem table pointing to it.
|
||||
*
|
||||
* Once the item has completed the workflow it will be archived
|
||||
*
|
||||
@@ -83,12 +83,12 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
* @author Ben Bosman (ben at atmire dot com)
|
||||
* @author Mark Diggory (markd at atmire dot com)
|
||||
*/
|
||||
public class XmlWorkflowServiceImpl implements XmlWorkflowService {
|
||||
public class WorkflowServiceImpl implements WorkflowService {
|
||||
|
||||
/* support for 'no notification' */
|
||||
protected Map<UUID, Boolean> noEMail = new HashMap<>();
|
||||
|
||||
private final Logger log = org.apache.logging.log4j.LogManager.getLogger(XmlWorkflowServiceImpl.class);
|
||||
private final Logger log = org.apache.logging.log4j.LogManager.getLogger(WorkflowServiceImpl.class);
|
||||
|
||||
@Autowired(required = true)
|
||||
protected AuthorizeService authorizeService;
|
||||
@@ -113,7 +113,7 @@ public class XmlWorkflowServiceImpl implements XmlWorkflowService {
|
||||
@Autowired(required = true)
|
||||
protected WorkspaceItemService workspaceItemService;
|
||||
@Autowired(required = true)
|
||||
protected XmlWorkflowItemService xmlWorkflowItemService;
|
||||
protected WorkflowItemService workflowItemService;
|
||||
@Autowired(required = true)
|
||||
protected GroupService groupService;
|
||||
@Autowired(required = true)
|
||||
@@ -125,7 +125,7 @@ public class XmlWorkflowServiceImpl implements XmlWorkflowService {
|
||||
@Autowired(required = true)
|
||||
protected ConfigurationService configurationService;
|
||||
|
||||
protected XmlWorkflowServiceImpl() {
|
||||
protected WorkflowServiceImpl() {
|
||||
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ public class XmlWorkflowServiceImpl implements XmlWorkflowService {
|
||||
@Override
|
||||
public void deleteCollection(Context context, Collection collection)
|
||||
throws SQLException, IOException, AuthorizeException {
|
||||
xmlWorkflowItemService.deleteByCollection(context, collection);
|
||||
workflowItemService.deleteByCollection(context, collection);
|
||||
collectionRoleService.deleteByCollection(context, collection);
|
||||
}
|
||||
|
||||
@@ -194,18 +194,18 @@ public class XmlWorkflowServiceImpl implements XmlWorkflowService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public XmlWorkflowItem start(Context context, WorkspaceItem wsi)
|
||||
public WorkflowItem start(Context context, WorkspaceItem wsi)
|
||||
throws SQLException, AuthorizeException, IOException, WorkflowException {
|
||||
try {
|
||||
Item myitem = wsi.getItem();
|
||||
Collection collection = wsi.getCollection();
|
||||
Workflow wf = xmlWorkflowFactory.getWorkflow(collection);
|
||||
|
||||
XmlWorkflowItem wfi = xmlWorkflowItemService.create(context, myitem, collection);
|
||||
WorkflowItem wfi = workflowItemService.create(context, myitem, collection);
|
||||
wfi.setMultipleFiles(wsi.hasMultipleFiles());
|
||||
wfi.setMultipleTitles(wsi.hasMultipleTitles());
|
||||
wfi.setPublishedBefore(wsi.isPublishedBefore());
|
||||
xmlWorkflowItemService.update(context, wfi);
|
||||
workflowItemService.update(context, wfi);
|
||||
removeUserItemPolicies(context, myitem, myitem.getSubmitter());
|
||||
grantSubmitterReadPolicies(context, myitem);
|
||||
|
||||
@@ -244,7 +244,7 @@ public class XmlWorkflowServiceImpl implements XmlWorkflowService {
|
||||
* @param wsi the submitted Item entering workflow.
|
||||
*/
|
||||
@Override
|
||||
public XmlWorkflowItem startWithoutNotify(Context context, WorkspaceItem wsi)
|
||||
public WorkflowItem startWithoutNotify(Context context, WorkspaceItem wsi)
|
||||
throws SQLException, AuthorizeException, IOException, WorkflowException {
|
||||
// make a hash table entry with item ID for no notify
|
||||
// notify code checks no notify hash for item id
|
||||
@@ -254,7 +254,7 @@ public class XmlWorkflowServiceImpl implements XmlWorkflowService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void alertUsersOnTaskActivation(Context c, XmlWorkflowItem wfi, String emailTemplate, List<EPerson> epa,
|
||||
public void alertUsersOnTaskActivation(Context c, WorkflowItem wfi, String emailTemplate, List<EPerson> epa,
|
||||
String... arguments) throws IOException, SQLException, MessagingException {
|
||||
if (noEMail.containsKey(wfi.getItem().getID())) {
|
||||
// suppress email, and delete key
|
||||
@@ -292,7 +292,7 @@ public class XmlWorkflowServiceImpl implements XmlWorkflowService {
|
||||
}
|
||||
|
||||
|
||||
protected void activateFirstStep(Context context, Workflow wf, Step firstStep, XmlWorkflowItem wfi)
|
||||
protected void activateFirstStep(Context context, Workflow wf, Step firstStep, WorkflowItem wfi)
|
||||
throws AuthorizeException, IOException, SQLException, WorkflowException, WorkflowConfigurationException {
|
||||
WorkflowActionConfig firstActionConfig = firstStep.getUserSelectionMethod();
|
||||
firstActionConfig.getProcessingAction().activate(context, wfi);
|
||||
@@ -322,7 +322,7 @@ public class XmlWorkflowServiceImpl implements XmlWorkflowService {
|
||||
Workflow workflow, WorkflowActionConfig currentActionConfig)
|
||||
throws SQLException, AuthorizeException, IOException, WorkflowException {
|
||||
try {
|
||||
XmlWorkflowItem wi = xmlWorkflowItemService.find(c, workflowItemId);
|
||||
WorkflowItem wi = workflowItemService.find(c, workflowItemId);
|
||||
Step currentStep = currentActionConfig.getStep();
|
||||
if (currentActionConfig.getProcessingAction().isAuthorized(c, request, wi)) {
|
||||
ActionResult outcome = currentActionConfig.getProcessingAction().execute(c, wi, currentStep, request);
|
||||
@@ -349,7 +349,7 @@ public class XmlWorkflowServiceImpl implements XmlWorkflowService {
|
||||
@Override
|
||||
public WorkflowActionConfig processOutcome(Context c, EPerson user, Workflow workflow, Step currentStep,
|
||||
WorkflowActionConfig currentActionConfig, ActionResult currentOutcome,
|
||||
XmlWorkflowItem wfi, boolean enteredNewStep)
|
||||
WorkflowItem wfi, boolean enteredNewStep)
|
||||
throws IOException, AuthorizeException, SQLException, WorkflowException {
|
||||
if (currentOutcome.getType() == ActionResult.TYPE.TYPE_PAGE || currentOutcome
|
||||
.getType() == ActionResult.TYPE.TYPE_ERROR) {
|
||||
@@ -460,7 +460,7 @@ public class XmlWorkflowServiceImpl implements XmlWorkflowService {
|
||||
}
|
||||
|
||||
protected void logWorkflowEvent(Context c, String workflowId, String previousStepId, String previousActionConfigId,
|
||||
XmlWorkflowItem wfi, EPerson actor, Step newStep,
|
||||
WorkflowItem wfi, EPerson actor, Step newStep,
|
||||
WorkflowActionConfig newActionConfig) throws SQLException {
|
||||
try {
|
||||
//Fire an event so we can log our action !
|
||||
@@ -510,7 +510,7 @@ public class XmlWorkflowServiceImpl implements XmlWorkflowService {
|
||||
}
|
||||
|
||||
protected WorkflowActionConfig processNextStep(Context c, EPerson user, Workflow workflow,
|
||||
ActionResult currentOutcome, XmlWorkflowItem wfi, Step nextStep)
|
||||
ActionResult currentOutcome, WorkflowItem wfi, Step nextStep)
|
||||
throws SQLException, IOException, AuthorizeException, WorkflowException, WorkflowConfigurationException {
|
||||
WorkflowActionConfig nextActionConfig;
|
||||
if (nextStep != null) {
|
||||
@@ -552,7 +552,7 @@ public class XmlWorkflowServiceImpl implements XmlWorkflowService {
|
||||
* @throws AuthorizeException Exception indicating the current user of the context does not have permission
|
||||
* to perform a particular action.
|
||||
*/
|
||||
protected Item archive(Context context, XmlWorkflowItem wfi)
|
||||
protected Item archive(Context context, WorkflowItem wfi)
|
||||
throws SQLException, IOException, AuthorizeException {
|
||||
// FIXME: Check auth
|
||||
Item item = wfi.getItem();
|
||||
@@ -644,7 +644,7 @@ public class XmlWorkflowServiceImpl implements XmlWorkflowService {
|
||||
* to perform a particular action.
|
||||
*/
|
||||
@Override
|
||||
public void deleteAllTasks(Context context, XmlWorkflowItem wi) throws SQLException, AuthorizeException {
|
||||
public void deleteAllTasks(Context context, WorkflowItem wi) throws SQLException, AuthorizeException {
|
||||
deleteAllPooledTasks(context, wi);
|
||||
|
||||
Iterator<ClaimedTask> allClaimedTasks = claimedTaskService.findByWorkflowItem(context, wi).iterator();
|
||||
@@ -656,7 +656,7 @@ public class XmlWorkflowServiceImpl implements XmlWorkflowService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAllPooledTasks(Context context, XmlWorkflowItem wi) throws SQLException, AuthorizeException {
|
||||
public void deleteAllPooledTasks(Context context, WorkflowItem wi) throws SQLException, AuthorizeException {
|
||||
Iterator<PoolTask> allPooledTasks = poolTaskService.find(context, wi).iterator();
|
||||
while (allPooledTasks.hasNext()) {
|
||||
PoolTask poolTask = allPooledTasks.next();
|
||||
@@ -669,7 +669,7 @@ public class XmlWorkflowServiceImpl implements XmlWorkflowService {
|
||||
* Deletes an eperson from the taskpool of a step
|
||||
*/
|
||||
@Override
|
||||
public void deletePooledTask(Context context, XmlWorkflowItem wi, PoolTask task)
|
||||
public void deletePooledTask(Context context, WorkflowItem wi, PoolTask task)
|
||||
throws SQLException, AuthorizeException {
|
||||
if (task != null) {
|
||||
if (task.getEperson() != null) {
|
||||
@@ -682,7 +682,7 @@ public class XmlWorkflowServiceImpl implements XmlWorkflowService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteClaimedTask(Context c, XmlWorkflowItem wi, ClaimedTask task)
|
||||
public void deleteClaimedTask(Context c, WorkflowItem wi, ClaimedTask task)
|
||||
throws SQLException, AuthorizeException {
|
||||
if (task != null) {
|
||||
removeUserItemPolicies(c, wi.getItem(), task.getOwner());
|
||||
@@ -696,7 +696,7 @@ public class XmlWorkflowServiceImpl implements XmlWorkflowService {
|
||||
* Creates a task pool for a given step
|
||||
*/
|
||||
@Override
|
||||
public void createPoolTasks(Context context, XmlWorkflowItem wi, RoleMembers assignees, Step step,
|
||||
public void createPoolTasks(Context context, WorkflowItem wi, RoleMembers assignees, Step step,
|
||||
WorkflowActionConfig action)
|
||||
throws SQLException, AuthorizeException {
|
||||
// create a tasklist entry for each eperson
|
||||
@@ -728,7 +728,7 @@ public class XmlWorkflowServiceImpl implements XmlWorkflowService {
|
||||
* Claims an action for a given eperson
|
||||
*/
|
||||
@Override
|
||||
public void createOwnedTask(Context context, XmlWorkflowItem wi, Step step, WorkflowActionConfig action, EPerson e)
|
||||
public void createOwnedTask(Context context, WorkflowItem wi, Step step, WorkflowActionConfig action, EPerson e)
|
||||
throws SQLException, AuthorizeException {
|
||||
ClaimedTask task = claimedTaskService.create(context);
|
||||
task.setWorkflowItem(wi);
|
||||
@@ -875,7 +875,7 @@ public class XmlWorkflowServiceImpl implements XmlWorkflowService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteWorkflowByWorkflowItem(Context context, XmlWorkflowItem wi, EPerson e)
|
||||
public void deleteWorkflowByWorkflowItem(Context context, WorkflowItem wi, EPerson e)
|
||||
throws SQLException, AuthorizeException, IOException {
|
||||
Item myitem = wi.getItem();
|
||||
UUID itemID = myitem.getID();
|
||||
@@ -889,7 +889,7 @@ public class XmlWorkflowServiceImpl implements XmlWorkflowService {
|
||||
// Remove (if any) the workflowItemroles for this item
|
||||
workflowItemRoleService.deleteForWorkflowItem(context, wi);
|
||||
// Now remove the workflow object manually from the database
|
||||
xmlWorkflowItemService.deleteWrapper(context, wi);
|
||||
workflowItemService.deleteWrapper(context, wi);
|
||||
// Now delete the item
|
||||
itemService.delete(context, myitem);
|
||||
log.info(LogManager.getHeader(context, "delete_workflow", "workflow_item_id="
|
||||
@@ -900,7 +900,7 @@ public class XmlWorkflowServiceImpl implements XmlWorkflowService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public WorkspaceItem sendWorkflowItemBackSubmission(Context context, XmlWorkflowItem wi, EPerson e,
|
||||
public WorkspaceItem sendWorkflowItemBackSubmission(Context context, WorkflowItem wi, EPerson e,
|
||||
String provenance,
|
||||
String rejection_message)
|
||||
throws SQLException, AuthorizeException,
|
||||
@@ -962,7 +962,7 @@ public class XmlWorkflowServiceImpl implements XmlWorkflowService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public WorkspaceItem abort(Context c, XmlWorkflowItem wi, EPerson e)
|
||||
public WorkspaceItem abort(Context c, WorkflowItem wi, EPerson e)
|
||||
throws AuthorizeException, SQLException, IOException {
|
||||
if (!authorizeService.isAdmin(c)) {
|
||||
throw new AuthorizeException(
|
||||
@@ -991,13 +991,13 @@ public class XmlWorkflowServiceImpl implements XmlWorkflowService {
|
||||
* item is removed, and a workspace item created.
|
||||
*
|
||||
* @param c Context
|
||||
* @param wfi WorkflowItem to be 'dismantled'
|
||||
* @param wfi workflow item to be 'dismantled'
|
||||
* @return the workspace item
|
||||
* @throws java.io.IOException ...
|
||||
* @throws java.sql.SQLException ...
|
||||
* @throws org.dspace.authorize.AuthorizeException ...
|
||||
*/
|
||||
protected WorkspaceItem returnToWorkspace(Context c, XmlWorkflowItem wfi)
|
||||
protected WorkspaceItem returnToWorkspace(Context c, WorkflowItem wfi)
|
||||
throws SQLException, IOException, AuthorizeException {
|
||||
// authorize a DSpaceActions.REJECT
|
||||
// stop workflow
|
||||
@@ -1030,7 +1030,7 @@ public class XmlWorkflowServiceImpl implements XmlWorkflowService {
|
||||
+ workspaceItem.getID()));
|
||||
|
||||
// Now remove the workflow object manually from the database
|
||||
xmlWorkflowItemService.deleteWrapper(c, wfi);
|
||||
workflowItemService.deleteWrapper(c, wfi);
|
||||
return workspaceItem;
|
||||
}
|
||||
|
||||
@@ -1072,7 +1072,7 @@ public class XmlWorkflowServiceImpl implements XmlWorkflowService {
|
||||
itemService.update(context, myitem);
|
||||
}
|
||||
|
||||
protected void notifyOfReject(Context c, XmlWorkflowItem wi, EPerson e,
|
||||
protected void notifyOfReject(Context c, WorkflowItem wi, EPerson e,
|
||||
String reason) {
|
||||
try {
|
||||
// send the notification only if the person was not deleted in the
|
@@ -32,8 +32,8 @@ import org.dspace.eperson.factory.EPersonServiceFactory;
|
||||
import org.dspace.eperson.service.GroupService;
|
||||
import org.dspace.services.ConfigurationService;
|
||||
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||
import org.dspace.workflow.factory.WorkflowServiceFactory;
|
||||
import org.dspace.xmlworkflow.factory.XmlWorkflowFactory;
|
||||
import org.dspace.xmlworkflow.factory.XmlWorkflowServiceFactory;
|
||||
import org.dspace.xmlworkflow.state.Workflow;
|
||||
import org.dspace.xmlworkflow.storedcomponents.CollectionRole;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.CollectionRoleService;
|
||||
@@ -53,9 +53,9 @@ public class WorkflowUtils extends Util {
|
||||
public static Logger log = LogManager.getLogger(WorkflowUtils.class);
|
||||
|
||||
protected static final CollectionRoleService collectionRoleService =
|
||||
XmlWorkflowServiceFactory.getInstance().getCollectionRoleService();
|
||||
WorkflowServiceFactory.getInstance().getCollectionRoleService();
|
||||
protected static final GroupService groupService = EPersonServiceFactory.getInstance().getGroupService();
|
||||
protected static final XmlWorkflowFactory xmlWorkflowFactory = XmlWorkflowServiceFactory.getInstance()
|
||||
protected static final XmlWorkflowFactory xmlWorkflowFactory = WorkflowServiceFactory.getInstance()
|
||||
.getWorkflowFactory();
|
||||
protected static final ConfigurationService configurationService
|
||||
= DSpaceServicesFactory.getInstance().getConfigurationService();
|
||||
|
@@ -1,51 +0,0 @@
|
||||
/**
|
||||
* The contents of this file are subject to the license and copyright
|
||||
* detailed in the LICENSE and NOTICE files at the root of the source
|
||||
* tree and available online at
|
||||
*
|
||||
* http://www.dspace.org/license/
|
||||
*/
|
||||
package org.dspace.xmlworkflow.factory;
|
||||
|
||||
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||
import org.dspace.workflow.factory.WorkflowServiceFactory;
|
||||
import org.dspace.xmlworkflow.service.WorkflowRequirementsService;
|
||||
import org.dspace.xmlworkflow.service.XmlWorkflowService;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.ClaimedTaskService;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.CollectionRoleService;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.InProgressUserService;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.PoolTaskService;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.WorkflowItemRoleService;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.XmlWorkflowItemService;
|
||||
|
||||
/**
|
||||
* Abstract factory to get services for the xmlworkflow package, use XmlWorkflowServiceFactory.getInstance() to
|
||||
* retrieve an implementation
|
||||
*
|
||||
* @author kevinvandevelde at atmire.com
|
||||
*/
|
||||
public abstract class XmlWorkflowServiceFactory extends WorkflowServiceFactory {
|
||||
|
||||
public abstract XmlWorkflowFactory getWorkflowFactory();
|
||||
|
||||
public abstract WorkflowRequirementsService getWorkflowRequirementsService();
|
||||
|
||||
public abstract XmlWorkflowService getXmlWorkflowService();
|
||||
|
||||
public abstract ClaimedTaskService getClaimedTaskService();
|
||||
|
||||
public abstract CollectionRoleService getCollectionRoleService();
|
||||
|
||||
public abstract InProgressUserService getInProgressUserService();
|
||||
|
||||
public abstract PoolTaskService getPoolTaskService();
|
||||
|
||||
public abstract WorkflowItemRoleService getWorkflowItemRoleService();
|
||||
|
||||
public abstract XmlWorkflowItemService getXmlWorkflowItemService();
|
||||
|
||||
public static XmlWorkflowServiceFactory getInstance() {
|
||||
return DSpaceServicesFactory.getInstance().getServiceManager()
|
||||
.getServiceByName("workflowServiceFactory", XmlWorkflowServiceFactory.class);
|
||||
}
|
||||
}
|
@@ -13,9 +13,9 @@ import java.sql.SQLException;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
import org.dspace.xmlworkflow.WorkflowConfigurationException;
|
||||
import org.dspace.xmlworkflow.state.Step;
|
||||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
|
||||
/**
|
||||
* A class that contains utililty methods related to the workflow
|
||||
@@ -46,10 +46,10 @@ public interface WorkflowRequirementsService {
|
||||
* @throws AuthorizeException ...
|
||||
* @throws IOException ...
|
||||
*/
|
||||
public void addClaimedUser(Context context, XmlWorkflowItem wfi, Step step, EPerson user)
|
||||
public void addClaimedUser(Context context, WorkflowItem wfi, Step step, EPerson user)
|
||||
throws SQLException, AuthorizeException, IOException;
|
||||
|
||||
public void removeClaimedUser(Context context, XmlWorkflowItem wfi, EPerson user, String stepID)
|
||||
public void removeClaimedUser(Context context, WorkflowItem wfi, EPerson user, String stepID)
|
||||
throws SQLException, IOException, WorkflowConfigurationException, AuthorizeException;
|
||||
|
||||
/**
|
||||
@@ -62,8 +62,8 @@ public interface WorkflowRequirementsService {
|
||||
* @throws AuthorizeException ...
|
||||
* @throws SQLException ...
|
||||
*/
|
||||
public void addFinishedUser(Context context, XmlWorkflowItem wfi, EPerson user)
|
||||
public void addFinishedUser(Context context, WorkflowItem wfi, EPerson user)
|
||||
throws AuthorizeException, SQLException;
|
||||
|
||||
public void clearInProgressUsers(Context context, XmlWorkflowItem wfi) throws AuthorizeException, SQLException;
|
||||
public void clearInProgressUsers(Context context, WorkflowItem wfi) throws AuthorizeException, SQLException;
|
||||
}
|
||||
|
@@ -1,79 +0,0 @@
|
||||
/**
|
||||
* The contents of this file are subject to the license and copyright
|
||||
* detailed in the LICENSE and NOTICE files at the root of the source
|
||||
* tree and available online at
|
||||
*
|
||||
* http://www.dspace.org/license/
|
||||
*/
|
||||
package org.dspace.xmlworkflow.service;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import javax.mail.MessagingException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.workflow.WorkflowException;
|
||||
import org.dspace.workflow.WorkflowService;
|
||||
import org.dspace.xmlworkflow.RoleMembers;
|
||||
import org.dspace.xmlworkflow.state.Step;
|
||||
import org.dspace.xmlworkflow.state.Workflow;
|
||||
import org.dspace.xmlworkflow.state.actions.ActionResult;
|
||||
import org.dspace.xmlworkflow.state.actions.WorkflowActionConfig;
|
||||
import org.dspace.xmlworkflow.storedcomponents.ClaimedTask;
|
||||
import org.dspace.xmlworkflow.storedcomponents.PoolTask;
|
||||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
|
||||
/**
|
||||
* When an item is submitted and is somewhere in a workflow, it has a row in the
|
||||
* WorkflowItem table pointing to it.
|
||||
*
|
||||
* Once the item has completed the workflow it will be archived
|
||||
*
|
||||
* @author Bram De Schouwer (bram.deschouwer at dot com)
|
||||
* @author Kevin Van de Velde (kevin at atmire dot com)
|
||||
* @author Ben Bosman (ben at atmire dot com)
|
||||
* @author Mark Diggory (markd at atmire dot com)
|
||||
*/
|
||||
public interface XmlWorkflowService extends WorkflowService<XmlWorkflowItem> {
|
||||
|
||||
public void alertUsersOnTaskActivation(Context c, XmlWorkflowItem wfi, String emailTemplate, List<EPerson> epa,
|
||||
String... arguments) throws IOException, SQLException, MessagingException;
|
||||
|
||||
public WorkflowActionConfig doState(Context c, EPerson user, HttpServletRequest request, int workflowItemId,
|
||||
Workflow workflow, WorkflowActionConfig currentActionConfig)
|
||||
throws SQLException, AuthorizeException, IOException, MessagingException, WorkflowException;
|
||||
|
||||
public WorkflowActionConfig processOutcome(Context c, EPerson user, Workflow workflow, Step currentStep,
|
||||
WorkflowActionConfig currentActionConfig, ActionResult currentOutcome,
|
||||
XmlWorkflowItem wfi, boolean enteredNewStep)
|
||||
throws IOException, AuthorizeException, SQLException, WorkflowException;
|
||||
|
||||
public void deleteAllTasks(Context context, XmlWorkflowItem wi) throws SQLException, AuthorizeException;
|
||||
|
||||
public void deleteAllPooledTasks(Context c, XmlWorkflowItem wi) throws SQLException, AuthorizeException;
|
||||
|
||||
public void deletePooledTask(Context context, XmlWorkflowItem wi, PoolTask task)
|
||||
throws SQLException, AuthorizeException;
|
||||
|
||||
public void deleteClaimedTask(Context c, XmlWorkflowItem wi, ClaimedTask task)
|
||||
throws SQLException, AuthorizeException;
|
||||
|
||||
public void createPoolTasks(Context context, XmlWorkflowItem wi, RoleMembers assignees, Step step,
|
||||
WorkflowActionConfig action)
|
||||
throws SQLException, AuthorizeException;
|
||||
|
||||
public void createOwnedTask(Context context, XmlWorkflowItem wi, Step step, WorkflowActionConfig action, EPerson e)
|
||||
throws SQLException, AuthorizeException;
|
||||
|
||||
public void grantUserAllItemPolicies(Context context, Item item, EPerson epa, String actionType)
|
||||
throws AuthorizeException, SQLException;
|
||||
|
||||
public void removeUserItemPolicies(Context context, Item item, EPerson e) throws SQLException, AuthorizeException;
|
||||
|
||||
public String getEPersonName(EPerson ePerson);
|
||||
}
|
@@ -14,11 +14,11 @@ import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
import org.dspace.xmlworkflow.Role;
|
||||
import org.dspace.xmlworkflow.WorkflowConfigurationException;
|
||||
import org.dspace.xmlworkflow.state.actions.UserSelectionActionConfig;
|
||||
import org.dspace.xmlworkflow.state.actions.WorkflowActionConfig;
|
||||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.InProgressUserService;
|
||||
import org.springframework.beans.factory.BeanNameAware;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -87,7 +87,7 @@ public class Step implements BeanNameAware {
|
||||
}
|
||||
|
||||
|
||||
public boolean isValidStep(Context context, XmlWorkflowItem wfi)
|
||||
public boolean isValidStep(Context context, WorkflowItem wfi)
|
||||
throws WorkflowConfigurationException, SQLException {
|
||||
//Check if our next step has a UI, if not then the step is valid, no need for a group
|
||||
return !(getUserSelectionMethod() == null || getUserSelectionMethod()
|
||||
@@ -125,7 +125,7 @@ public class Step implements BeanNameAware {
|
||||
* @return if enough users have finished this task
|
||||
* @throws SQLException An exception that provides information on a database access error or other errors.
|
||||
*/
|
||||
public boolean isFinished(Context c, XmlWorkflowItem wfi) throws SQLException {
|
||||
public boolean isFinished(Context c, WorkflowItem wfi) throws SQLException {
|
||||
return inProgressUserService.getNumberOfFinishedUsers(c, wfi) == requiredUsers;
|
||||
}
|
||||
|
||||
|
@@ -13,10 +13,10 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
import org.dspace.xmlworkflow.Role;
|
||||
import org.dspace.xmlworkflow.WorkflowConfigurationException;
|
||||
import org.dspace.xmlworkflow.state.actions.ActionResult;
|
||||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
import org.springframework.beans.factory.BeanNameAware;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
@@ -55,7 +55,7 @@ public class Workflow implements BeanNameAware {
|
||||
throw new WorkflowConfigurationException("Step definition not found for: " + stepID);
|
||||
}
|
||||
|
||||
public Step getNextStep(Context context, XmlWorkflowItem wfi, Step currentStep, int outcome)
|
||||
public Step getNextStep(Context context, WorkflowItem wfi, Step currentStep, int outcome)
|
||||
throws WorkflowConfigurationException, SQLException {
|
||||
Step nextStep = currentStep.getNextStep(outcome);
|
||||
if (nextStep != null) {
|
||||
|
@@ -16,10 +16,10 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.workflow.WorkflowException;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
import org.dspace.xmlworkflow.RoleMembers;
|
||||
import org.dspace.xmlworkflow.WorkflowConfigurationException;
|
||||
import org.dspace.xmlworkflow.state.Step;
|
||||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
|
||||
/**
|
||||
* This abstract class represents an api action
|
||||
@@ -38,10 +38,10 @@ public abstract class Action {
|
||||
private WorkflowActionConfig parent;
|
||||
private static final String ERROR_FIELDS_ATTRIBUTE = "dspace.workflow.error_fields";
|
||||
|
||||
public abstract void activate(Context c, XmlWorkflowItem wf)
|
||||
public abstract void activate(Context c, WorkflowItem wf)
|
||||
throws SQLException, IOException, AuthorizeException, WorkflowException;
|
||||
|
||||
public abstract ActionResult execute(Context c, XmlWorkflowItem wfi, Step step, HttpServletRequest request)
|
||||
public abstract ActionResult execute(Context c, WorkflowItem wfi, Step step, HttpServletRequest request)
|
||||
throws SQLException, AuthorizeException, IOException, WorkflowException;
|
||||
|
||||
/**
|
||||
@@ -76,12 +76,12 @@ public abstract class Action {
|
||||
return "Step: " + getParent().getStep().getId() + " - action:" + getParent().getId();
|
||||
}
|
||||
|
||||
public void alertUsersOnActivation(Context c, XmlWorkflowItem wfi, RoleMembers members)
|
||||
public void alertUsersOnActivation(Context c, WorkflowItem wfi, RoleMembers members)
|
||||
throws SQLException, IOException {
|
||||
|
||||
}
|
||||
|
||||
public abstract boolean isAuthorized(Context context, HttpServletRequest request, XmlWorkflowItem wfi)
|
||||
public abstract boolean isAuthorized(Context context, HttpServletRequest request, WorkflowItem wfi)
|
||||
throws SQLException, AuthorizeException, IOException, WorkflowConfigurationException;
|
||||
|
||||
|
||||
|
@@ -18,10 +18,10 @@ import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.content.DCDate;
|
||||
import org.dspace.content.MetadataSchemaEnum;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.xmlworkflow.factory.XmlWorkflowServiceFactory;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
import org.dspace.workflow.factory.WorkflowServiceFactory;
|
||||
import org.dspace.xmlworkflow.state.Step;
|
||||
import org.dspace.xmlworkflow.state.actions.ActionResult;
|
||||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
|
||||
/**
|
||||
* Processing class of an action that allows users to
|
||||
@@ -41,12 +41,12 @@ public class AcceptEditRejectAction extends ProcessingAction {
|
||||
//TODO: rename to AcceptAndEditMetadataAction
|
||||
|
||||
@Override
|
||||
public void activate(Context c, XmlWorkflowItem wf) {
|
||||
public void activate(Context c, WorkflowItem wf) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult execute(Context c, XmlWorkflowItem wfi, Step step, HttpServletRequest request)
|
||||
public ActionResult execute(Context c, WorkflowItem wfi, Step step, HttpServletRequest request)
|
||||
throws SQLException, AuthorizeException, IOException {
|
||||
if (super.isOptionInParam(request)) {
|
||||
switch (Util.getSubmitButton(request, SUBMIT_CANCEL)) {
|
||||
@@ -72,7 +72,7 @@ public class AcceptEditRejectAction extends ProcessingAction {
|
||||
return options;
|
||||
}
|
||||
|
||||
public ActionResult processAccept(Context c, XmlWorkflowItem wfi)
|
||||
public ActionResult processAccept(Context c, WorkflowItem wfi)
|
||||
throws SQLException, AuthorizeException {
|
||||
//Delete the tasks
|
||||
addApprovedProvenance(c, wfi);
|
||||
@@ -80,7 +80,7 @@ public class AcceptEditRejectAction extends ProcessingAction {
|
||||
return new ActionResult(ActionResult.TYPE.TYPE_OUTCOME, ActionResult.OUTCOME_COMPLETE);
|
||||
}
|
||||
|
||||
public ActionResult processRejectPage(Context c, XmlWorkflowItem wfi, HttpServletRequest request)
|
||||
public ActionResult processRejectPage(Context c, WorkflowItem wfi, HttpServletRequest request)
|
||||
throws SQLException, AuthorizeException, IOException {
|
||||
String reason = request.getParameter("reason");
|
||||
if (reason == null || 0 == reason.trim().length()) {
|
||||
@@ -90,16 +90,16 @@ public class AcceptEditRejectAction extends ProcessingAction {
|
||||
|
||||
// We have pressed reject, so remove the task the user has & put it back
|
||||
// to a workspace item
|
||||
XmlWorkflowServiceFactory.getInstance().getXmlWorkflowService().sendWorkflowItemBackSubmission(c, wfi,
|
||||
WorkflowServiceFactory.getInstance().getWorkflowService().sendWorkflowItemBackSubmission(c, wfi,
|
||||
c.getCurrentUser(), this.getProvenanceStartId(), reason);
|
||||
|
||||
return new ActionResult(ActionResult.TYPE.TYPE_SUBMISSION_PAGE);
|
||||
}
|
||||
|
||||
public ActionResult processSubmitterIsDeletedPage(Context c, XmlWorkflowItem wfi, HttpServletRequest request)
|
||||
public ActionResult processSubmitterIsDeletedPage(Context c, WorkflowItem wfi, HttpServletRequest request)
|
||||
throws SQLException, AuthorizeException, IOException {
|
||||
if (request.getParameter("submit_delete") != null) {
|
||||
XmlWorkflowServiceFactory.getInstance().getXmlWorkflowService()
|
||||
WorkflowServiceFactory.getInstance().getWorkflowService()
|
||||
.deleteWorkflowByWorkflowItem(c, wfi, c.getCurrentUser());
|
||||
// Delete and send user back to myDspace page
|
||||
return new ActionResult(ActionResult.TYPE.TYPE_SUBMISSION_PAGE);
|
||||
@@ -112,12 +112,12 @@ public class AcceptEditRejectAction extends ProcessingAction {
|
||||
}
|
||||
}
|
||||
|
||||
private void addApprovedProvenance(Context c, XmlWorkflowItem wfi) throws SQLException, AuthorizeException {
|
||||
private void addApprovedProvenance(Context c, WorkflowItem wfi) throws SQLException, AuthorizeException {
|
||||
//Add the provenance for the accept
|
||||
String now = DCDate.getCurrent().toString();
|
||||
|
||||
// Get user's name + email address
|
||||
String usersName = XmlWorkflowServiceFactory.getInstance().getXmlWorkflowService()
|
||||
String usersName = WorkflowServiceFactory.getInstance().getWorkflowService()
|
||||
.getEPersonName(c.getCurrentUser());
|
||||
|
||||
String provDescription = getProvenanceStartId() + " Approved for entry into archive by "
|
||||
|
@@ -17,10 +17,10 @@ import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.content.DCDate;
|
||||
import org.dspace.content.MetadataSchemaEnum;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.xmlworkflow.factory.XmlWorkflowServiceFactory;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
import org.dspace.workflow.factory.WorkflowServiceFactory;
|
||||
import org.dspace.xmlworkflow.state.Step;
|
||||
import org.dspace.xmlworkflow.state.actions.ActionResult;
|
||||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
|
||||
/**
|
||||
* Processing class of an action that allows users to
|
||||
@@ -36,17 +36,17 @@ public class FinalEditAction extends ProcessingAction {
|
||||
private static final String SUBMIT_APPROVE = "submit_approve";
|
||||
|
||||
@Override
|
||||
public void activate(Context c, XmlWorkflowItem wf) {
|
||||
public void activate(Context c, WorkflowItem wf) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult execute(Context c, XmlWorkflowItem wfi, Step step, HttpServletRequest request)
|
||||
public ActionResult execute(Context c, WorkflowItem wfi, Step step, HttpServletRequest request)
|
||||
throws SQLException, AuthorizeException {
|
||||
return processMainPage(c, wfi, request);
|
||||
}
|
||||
|
||||
public ActionResult processMainPage(Context c, XmlWorkflowItem wfi, HttpServletRequest request)
|
||||
public ActionResult processMainPage(Context c, WorkflowItem wfi, HttpServletRequest request)
|
||||
throws SQLException, AuthorizeException {
|
||||
if (super.isOptionInParam(request)) {
|
||||
switch (Util.getSubmitButton(request, SUBMIT_CANCEL)) {
|
||||
@@ -70,12 +70,12 @@ public class FinalEditAction extends ProcessingAction {
|
||||
return options;
|
||||
}
|
||||
|
||||
private void addApprovedProvenance(Context c, XmlWorkflowItem wfi) throws SQLException, AuthorizeException {
|
||||
private void addApprovedProvenance(Context c, WorkflowItem wfi) throws SQLException, AuthorizeException {
|
||||
//Add the provenance for the accept
|
||||
String now = DCDate.getCurrent().toString();
|
||||
|
||||
// Get user's name + email address
|
||||
String usersName = XmlWorkflowServiceFactory.getInstance().getXmlWorkflowService()
|
||||
String usersName = WorkflowServiceFactory.getInstance().getWorkflowService()
|
||||
.getEPersonName(c.getCurrentUser());
|
||||
|
||||
String provDescription = getProvenanceStartId() + " Approved for entry into archive by "
|
||||
|
@@ -12,9 +12,9 @@ import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.dspace.content.service.ItemService;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
import org.dspace.xmlworkflow.state.actions.Action;
|
||||
import org.dspace.xmlworkflow.storedcomponents.ClaimedTask;
|
||||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.ClaimedTaskService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
@@ -38,7 +38,7 @@ public abstract class ProcessingAction extends Action {
|
||||
public static final String SUBMIT_CANCEL = "submit_cancel";
|
||||
|
||||
@Override
|
||||
public boolean isAuthorized(Context context, HttpServletRequest request, XmlWorkflowItem wfi) throws SQLException {
|
||||
public boolean isAuthorized(Context context, HttpServletRequest request, WorkflowItem wfi) throws SQLException {
|
||||
ClaimedTask task = null;
|
||||
if (context.getCurrentUser() != null) {
|
||||
task = claimedTaskService.findByWorkflowIdAndEPerson(context, wfi, context.getCurrentUser());
|
||||
|
@@ -18,10 +18,10 @@ import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.content.DCDate;
|
||||
import org.dspace.content.MetadataSchemaEnum;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.xmlworkflow.factory.XmlWorkflowServiceFactory;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
import org.dspace.workflow.factory.WorkflowServiceFactory;
|
||||
import org.dspace.xmlworkflow.state.Step;
|
||||
import org.dspace.xmlworkflow.state.actions.ActionResult;
|
||||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
|
||||
/**
|
||||
* Processing class of an accept/reject action
|
||||
@@ -42,12 +42,12 @@ public class ReviewAction extends ProcessingAction {
|
||||
|
||||
|
||||
@Override
|
||||
public void activate(Context c, XmlWorkflowItem wfItem) {
|
||||
public void activate(Context c, WorkflowItem wfItem) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult execute(Context c, XmlWorkflowItem wfi, Step step, HttpServletRequest request)
|
||||
public ActionResult execute(Context c, WorkflowItem wfi, Step step, HttpServletRequest request)
|
||||
throws SQLException, AuthorizeException, IOException {
|
||||
if (super.isOptionInParam(request)) {
|
||||
switch (Util.getSubmitButton(request, SUBMIT_CANCEL)) {
|
||||
@@ -72,18 +72,18 @@ public class ReviewAction extends ProcessingAction {
|
||||
return options;
|
||||
}
|
||||
|
||||
public ActionResult processAccept(Context c, XmlWorkflowItem wfi) throws SQLException, AuthorizeException {
|
||||
public ActionResult processAccept(Context c, WorkflowItem wfi) throws SQLException, AuthorizeException {
|
||||
//Delete the tasks
|
||||
addApprovedProvenance(c, wfi);
|
||||
return new ActionResult(ActionResult.TYPE.TYPE_OUTCOME, ActionResult.OUTCOME_COMPLETE);
|
||||
}
|
||||
|
||||
private void addApprovedProvenance(Context c, XmlWorkflowItem wfi) throws SQLException, AuthorizeException {
|
||||
private void addApprovedProvenance(Context c, WorkflowItem wfi) throws SQLException, AuthorizeException {
|
||||
//Add the provenance for the accept
|
||||
String now = DCDate.getCurrent().toString();
|
||||
|
||||
// Get user's name + email address
|
||||
String usersName = XmlWorkflowServiceFactory.getInstance().getXmlWorkflowService()
|
||||
String usersName = WorkflowServiceFactory.getInstance().getWorkflowService()
|
||||
.getEPersonName(c.getCurrentUser());
|
||||
|
||||
String provDescription = getProvenanceStartId() + " Approved for entry into archive by "
|
||||
@@ -95,7 +95,7 @@ public class ReviewAction extends ProcessingAction {
|
||||
itemService.update(c, wfi.getItem());
|
||||
}
|
||||
|
||||
public ActionResult processRejectPage(Context c, XmlWorkflowItem wfi, Step step, HttpServletRequest request)
|
||||
public ActionResult processRejectPage(Context c, WorkflowItem wfi, Step step, HttpServletRequest request)
|
||||
throws SQLException, AuthorizeException, IOException {
|
||||
String reason = request.getParameter("reason");
|
||||
if (reason == null || 0 == reason.trim().length()) {
|
||||
@@ -105,7 +105,7 @@ public class ReviewAction extends ProcessingAction {
|
||||
}
|
||||
|
||||
//We have pressed reject, so remove the task the user has & put it back to a workspace item
|
||||
XmlWorkflowServiceFactory.getInstance().getXmlWorkflowService()
|
||||
WorkflowServiceFactory.getInstance().getWorkflowService()
|
||||
.sendWorkflowItemBackSubmission(c, wfi, c.getCurrentUser(),
|
||||
this.getProvenanceStartId(), reason);
|
||||
|
||||
@@ -113,10 +113,10 @@ public class ReviewAction extends ProcessingAction {
|
||||
return new ActionResult(ActionResult.TYPE.TYPE_SUBMISSION_PAGE);
|
||||
}
|
||||
|
||||
public ActionResult processSubmitterIsDeletedPage(Context c, XmlWorkflowItem wfi, HttpServletRequest request)
|
||||
public ActionResult processSubmitterIsDeletedPage(Context c, WorkflowItem wfi, HttpServletRequest request)
|
||||
throws SQLException, AuthorizeException, IOException {
|
||||
if (request.getParameter("submit_delete") != null) {
|
||||
XmlWorkflowServiceFactory.getInstance().getXmlWorkflowService()
|
||||
WorkflowServiceFactory.getInstance().getWorkflowService()
|
||||
.deleteWorkflowByWorkflowItem(c, wfi, c.getCurrentUser());
|
||||
// Delete and send user back to myDspace page
|
||||
return new ActionResult(ActionResult.TYPE.TYPE_SUBMISSION_PAGE);
|
||||
|
@@ -18,11 +18,11 @@ import org.dspace.content.Item;
|
||||
import org.dspace.content.MetadataSchemaEnum;
|
||||
import org.dspace.content.MetadataValue;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.xmlworkflow.factory.XmlWorkflowServiceFactory;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
import org.dspace.workflow.factory.WorkflowServiceFactory;
|
||||
import org.dspace.xmlworkflow.service.WorkflowRequirementsService;
|
||||
import org.dspace.xmlworkflow.state.Step;
|
||||
import org.dspace.xmlworkflow.state.actions.ActionResult;
|
||||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
|
||||
/**
|
||||
* Processing class for the score evaluation action
|
||||
@@ -40,12 +40,12 @@ public class ScoreEvaluationAction extends ProcessingAction {
|
||||
private int minimumAcceptanceScore;
|
||||
|
||||
@Override
|
||||
public void activate(Context c, XmlWorkflowItem wf) {
|
||||
public void activate(Context c, WorkflowItem wf) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult execute(Context c, XmlWorkflowItem wfi, Step step, HttpServletRequest request)
|
||||
public ActionResult execute(Context c, WorkflowItem wfi, Step step, HttpServletRequest request)
|
||||
throws SQLException, AuthorizeException, IOException {
|
||||
boolean hasPassed = false;
|
||||
//Retrieve all our scores from the metadata & add em up
|
||||
@@ -73,7 +73,7 @@ public class ScoreEvaluationAction extends ProcessingAction {
|
||||
return new ActionResult(ActionResult.TYPE.TYPE_OUTCOME, ActionResult.OUTCOME_COMPLETE);
|
||||
} else {
|
||||
//We haven't passed, reject our item
|
||||
XmlWorkflowServiceFactory.getInstance().getXmlWorkflowService()
|
||||
WorkflowServiceFactory.getInstance().getWorkflowService()
|
||||
.sendWorkflowItemBackSubmission(c, wfi, c.getCurrentUser(),
|
||||
this.getProvenanceStartId(),
|
||||
"The item was reject due to a bad review score.");
|
||||
|
@@ -15,10 +15,10 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import org.dspace.app.util.Util;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
import org.dspace.xmlworkflow.service.WorkflowRequirementsService;
|
||||
import org.dspace.xmlworkflow.state.Step;
|
||||
import org.dspace.xmlworkflow.state.actions.ActionResult;
|
||||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
|
||||
/**
|
||||
* This action will allow multiple users to rate a certain item
|
||||
@@ -35,12 +35,12 @@ public class ScoreReviewAction extends ProcessingAction {
|
||||
private static final String SUBMIT_SCORE = "submit_score";
|
||||
|
||||
@Override
|
||||
public void activate(Context c, XmlWorkflowItem wf) {
|
||||
public void activate(Context c, WorkflowItem wf) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult execute(Context c, XmlWorkflowItem wfi, Step step, HttpServletRequest request)
|
||||
public ActionResult execute(Context c, WorkflowItem wfi, Step step, HttpServletRequest request)
|
||||
throws SQLException, AuthorizeException {
|
||||
if (request.getParameter(SUBMIT_SCORE) != null) {
|
||||
int score = Util.getIntParameter(request, "score");
|
||||
|
@@ -18,11 +18,11 @@ import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.eperson.service.EPersonService;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
import org.dspace.xmlworkflow.Role;
|
||||
import org.dspace.xmlworkflow.state.Step;
|
||||
import org.dspace.xmlworkflow.state.actions.ActionResult;
|
||||
import org.dspace.xmlworkflow.storedcomponents.WorkflowItemRole;
|
||||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.WorkflowItemRoleService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
@@ -54,12 +54,12 @@ public class SelectReviewerAction extends ProcessingAction {
|
||||
private WorkflowItemRoleService workflowItemRoleService;
|
||||
|
||||
@Override
|
||||
public void activate(Context c, XmlWorkflowItem wf) {
|
||||
public void activate(Context c, WorkflowItem wf) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult execute(Context c, XmlWorkflowItem wfi, Step step, HttpServletRequest request)
|
||||
public ActionResult execute(Context c, WorkflowItem wfi, Step step, HttpServletRequest request)
|
||||
throws SQLException, AuthorizeException {
|
||||
String submitButton = Util.getSubmitButton(request, SUBMIT_CANCEL);
|
||||
|
||||
|
@@ -18,10 +18,10 @@ import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.content.DCDate;
|
||||
import org.dspace.content.MetadataSchemaEnum;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.xmlworkflow.factory.XmlWorkflowServiceFactory;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
import org.dspace.workflow.factory.WorkflowServiceFactory;
|
||||
import org.dspace.xmlworkflow.state.Step;
|
||||
import org.dspace.xmlworkflow.state.actions.ActionResult;
|
||||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
|
||||
/**
|
||||
* Processing class of an action where a single user has
|
||||
@@ -46,12 +46,12 @@ public class SingleUserReviewAction extends ProcessingAction {
|
||||
protected static final String SUBMIT_DECLINE_TASK = "submit_decline_task";
|
||||
|
||||
@Override
|
||||
public void activate(Context c, XmlWorkflowItem wfItem) {
|
||||
public void activate(Context c, WorkflowItem wfItem) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult execute(Context c, XmlWorkflowItem wfi, Step step, HttpServletRequest request)
|
||||
public ActionResult execute(Context c, WorkflowItem wfi, Step step, HttpServletRequest request)
|
||||
throws SQLException, AuthorizeException, IOException {
|
||||
int page = Util.getIntParameter(request, "page");
|
||||
|
||||
@@ -76,7 +76,7 @@ public class SingleUserReviewAction extends ProcessingAction {
|
||||
return options;
|
||||
}
|
||||
|
||||
public ActionResult processMainPage(Context c, XmlWorkflowItem wfi, Step step, HttpServletRequest request)
|
||||
public ActionResult processMainPage(Context c, WorkflowItem wfi, Step step, HttpServletRequest request)
|
||||
throws SQLException, AuthorizeException {
|
||||
if (request.getParameter(SUBMIT_APPROVE) != null) {
|
||||
//Delete the tasks
|
||||
@@ -101,12 +101,12 @@ public class SingleUserReviewAction extends ProcessingAction {
|
||||
}
|
||||
}
|
||||
|
||||
private void addApprovedProvenance(Context c, XmlWorkflowItem wfi) throws SQLException, AuthorizeException {
|
||||
private void addApprovedProvenance(Context c, WorkflowItem wfi) throws SQLException, AuthorizeException {
|
||||
//Add the provenance for the accept
|
||||
String now = DCDate.getCurrent().toString();
|
||||
|
||||
// Get user's name + email address
|
||||
String usersName = XmlWorkflowServiceFactory.getInstance().getXmlWorkflowService()
|
||||
String usersName = WorkflowServiceFactory.getInstance().getWorkflowService()
|
||||
.getEPersonName(c.getCurrentUser());
|
||||
|
||||
String provDescription = getProvenanceStartId() + " Approved for entry into archive by "
|
||||
@@ -118,7 +118,7 @@ public class SingleUserReviewAction extends ProcessingAction {
|
||||
itemService.update(c, wfi.getItem());
|
||||
}
|
||||
|
||||
public ActionResult processRejectPage(Context c, XmlWorkflowItem wfi, Step step, HttpServletRequest request)
|
||||
public ActionResult processRejectPage(Context c, WorkflowItem wfi, Step step, HttpServletRequest request)
|
||||
throws SQLException, AuthorizeException, IOException {
|
||||
if (request.getParameter("submit_reject") != null) {
|
||||
String reason = request.getParameter("reason");
|
||||
@@ -129,7 +129,7 @@ public class SingleUserReviewAction extends ProcessingAction {
|
||||
}
|
||||
|
||||
//We have pressed reject, so remove the task the user has & put it back to a workspace item
|
||||
XmlWorkflowServiceFactory.getInstance().getXmlWorkflowService()
|
||||
WorkflowServiceFactory.getInstance().getWorkflowService()
|
||||
.sendWorkflowItemBackSubmission(c, wfi, c.getCurrentUser(),
|
||||
this.getProvenanceStartId(), reason);
|
||||
|
||||
@@ -143,10 +143,10 @@ public class SingleUserReviewAction extends ProcessingAction {
|
||||
}
|
||||
}
|
||||
|
||||
public ActionResult processSubmitterIsDeletedPage(Context c, XmlWorkflowItem wfi, HttpServletRequest request)
|
||||
public ActionResult processSubmitterIsDeletedPage(Context c, WorkflowItem wfi, HttpServletRequest request)
|
||||
throws SQLException, AuthorizeException, IOException {
|
||||
if (request.getParameter("submit_delete") != null) {
|
||||
XmlWorkflowServiceFactory.getInstance().getXmlWorkflowService()
|
||||
WorkflowServiceFactory.getInstance().getWorkflowService()
|
||||
.deleteWorkflowByWorkflowItem(c, wfi, c.getCurrentUser());
|
||||
// Delete and send user back to myDspace page
|
||||
return new ActionResult(ActionResult.TYPE.TYPE_SUBMISSION_PAGE);
|
||||
|
@@ -13,11 +13,11 @@ import java.util.List;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
import org.dspace.xmlworkflow.RoleMembers;
|
||||
import org.dspace.xmlworkflow.WorkflowConfigurationException;
|
||||
import org.dspace.xmlworkflow.state.Step;
|
||||
import org.dspace.xmlworkflow.state.actions.ActionResult;
|
||||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
|
||||
/**
|
||||
* @author Bram De Schouwer (bram.deschouwer at dot com)
|
||||
@@ -28,11 +28,11 @@ import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
public class AssignAction extends UserSelectionAction {
|
||||
|
||||
@Override
|
||||
public void activate(Context c, XmlWorkflowItem wfItem) {
|
||||
public void activate(Context c, WorkflowItem wfItem) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult execute(Context c, XmlWorkflowItem wfi, Step step, HttpServletRequest request) {
|
||||
public ActionResult execute(Context c, WorkflowItem wfi, Step step, HttpServletRequest request) {
|
||||
return new ActionResult(ActionResult.TYPE.TYPE_OUTCOME, ActionResult.OUTCOME_COMPLETE);
|
||||
}
|
||||
|
||||
@@ -45,16 +45,16 @@ public class AssignAction extends UserSelectionAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFinished(XmlWorkflowItem wfi) {
|
||||
public boolean isFinished(WorkflowItem wfi) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void regenerateTasks(Context c, XmlWorkflowItem wfi, RoleMembers roleMembers) throws SQLException {
|
||||
public void regenerateTasks(Context c, WorkflowItem wfi, RoleMembers roleMembers) throws SQLException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValidUserSelection(Context context, XmlWorkflowItem wfi, boolean hasUI)
|
||||
public boolean isValidUserSelection(Context context, WorkflowItem wfi, boolean hasUI)
|
||||
throws WorkflowConfigurationException, SQLException {
|
||||
return false;
|
||||
}
|
||||
|
@@ -20,15 +20,15 @@ import org.dspace.core.Context;
|
||||
import org.dspace.core.LogManager;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.workflow.WorkflowException;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
import org.dspace.workflow.WorkflowService;
|
||||
import org.dspace.workflow.factory.WorkflowServiceFactory;
|
||||
import org.dspace.xmlworkflow.RoleMembers;
|
||||
import org.dspace.xmlworkflow.WorkflowConfigurationException;
|
||||
import org.dspace.xmlworkflow.factory.XmlWorkflowServiceFactory;
|
||||
import org.dspace.xmlworkflow.service.WorkflowRequirementsService;
|
||||
import org.dspace.xmlworkflow.service.XmlWorkflowService;
|
||||
import org.dspace.xmlworkflow.state.Step;
|
||||
import org.dspace.xmlworkflow.state.actions.ActionResult;
|
||||
import org.dspace.xmlworkflow.state.actions.WorkflowActionConfig;
|
||||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
@@ -46,17 +46,17 @@ public class AssignOriginalSubmitterAction extends UserSelectionAction {
|
||||
protected WorkflowRequirementsService workflowRequirementsService;
|
||||
|
||||
@Override
|
||||
public boolean isFinished(XmlWorkflowItem wfi) {
|
||||
public boolean isFinished(WorkflowItem wfi) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void regenerateTasks(Context c, XmlWorkflowItem wfi, RoleMembers roleMembers) throws SQLException {
|
||||
public void regenerateTasks(Context c, WorkflowItem wfi, RoleMembers roleMembers) throws SQLException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValidUserSelection(Context context, XmlWorkflowItem wfi, boolean hasUI)
|
||||
public boolean isValidUserSelection(Context context, WorkflowItem wfi, boolean hasUI)
|
||||
throws WorkflowConfigurationException, SQLException {
|
||||
return wfi.getSubmitter() != null;
|
||||
}
|
||||
@@ -67,24 +67,24 @@ public class AssignOriginalSubmitterAction extends UserSelectionAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate(Context c, XmlWorkflowItem wf) throws SQLException, IOException {
|
||||
public void activate(Context c, WorkflowItem wf) throws SQLException, IOException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void alertUsersOnActivation(Context c, XmlWorkflowItem wfi, RoleMembers roleMembers)
|
||||
public void alertUsersOnActivation(Context c, WorkflowItem wfi, RoleMembers roleMembers)
|
||||
throws IOException, SQLException {
|
||||
if (wfi.getSubmitter() != null) {
|
||||
try {
|
||||
XmlWorkflowService xmlWorkflowService = XmlWorkflowServiceFactory.getInstance().getXmlWorkflowService();
|
||||
xmlWorkflowService.alertUsersOnTaskActivation(c, wfi, "submit_task", Arrays.asList(wfi.getSubmitter()),
|
||||
WorkflowService workflowService = WorkflowServiceFactory.getInstance().getWorkflowService();
|
||||
workflowService.alertUsersOnTaskActivation(c, wfi, "submit_task", Arrays.asList(wfi.getSubmitter()),
|
||||
//The arguments
|
||||
wfi.getItem().getName(),
|
||||
wfi.getCollection().getName(),
|
||||
wfi.getSubmitter().getFullName(),
|
||||
//TODO: message
|
||||
"New task available.",
|
||||
xmlWorkflowService.getMyDSpaceLink()
|
||||
workflowService.getMyDSpaceLink()
|
||||
);
|
||||
} catch (MessagingException e) {
|
||||
log.info(LogManager.getHeader(c, "error emailing user(s) for claimed task",
|
||||
@@ -95,7 +95,7 @@ public class AssignOriginalSubmitterAction extends UserSelectionAction {
|
||||
|
||||
|
||||
@Override
|
||||
public ActionResult execute(Context c, XmlWorkflowItem wfi, Step step, HttpServletRequest request)
|
||||
public ActionResult execute(Context c, WorkflowItem wfi, Step step, HttpServletRequest request)
|
||||
throws SQLException, AuthorizeException, IOException, WorkflowException {
|
||||
EPerson submitter = wfi.getSubmitter();
|
||||
WorkflowActionConfig nextAction = getParent().getStep().getNextAction(this.getParent());
|
||||
@@ -133,11 +133,11 @@ public class AssignOriginalSubmitterAction extends UserSelectionAction {
|
||||
* @throws AuthorizeException ...
|
||||
* @throws IOException ...
|
||||
*/
|
||||
protected void createTaskForEPerson(Context c, XmlWorkflowItem wfi, Step step, WorkflowActionConfig actionConfig,
|
||||
protected void createTaskForEPerson(Context c, WorkflowItem wfi, Step step, WorkflowActionConfig actionConfig,
|
||||
EPerson user) throws SQLException, AuthorizeException, IOException {
|
||||
if (claimedTaskService.find(c, wfi, step.getId(), actionConfig.getId()) != null) {
|
||||
workflowRequirementsService.addClaimedUser(c, wfi, step, c.getCurrentUser());
|
||||
XmlWorkflowServiceFactory.getInstance().getXmlWorkflowService()
|
||||
WorkflowServiceFactory.getInstance().getWorkflowService()
|
||||
.createOwnedTask(c, wfi, step, actionConfig, user);
|
||||
}
|
||||
}
|
||||
|
@@ -19,16 +19,16 @@ import org.dspace.core.Context;
|
||||
import org.dspace.core.LogManager;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.eperson.service.GroupService;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
import org.dspace.workflow.factory.WorkflowServiceFactory;
|
||||
import org.dspace.xmlworkflow.Role;
|
||||
import org.dspace.xmlworkflow.RoleMembers;
|
||||
import org.dspace.xmlworkflow.WorkflowConfigurationException;
|
||||
import org.dspace.xmlworkflow.factory.XmlWorkflowServiceFactory;
|
||||
import org.dspace.xmlworkflow.service.WorkflowRequirementsService;
|
||||
import org.dspace.xmlworkflow.state.Step;
|
||||
import org.dspace.xmlworkflow.state.actions.ActionResult;
|
||||
import org.dspace.xmlworkflow.state.actions.WorkflowActionConfig;
|
||||
import org.dspace.xmlworkflow.storedcomponents.WorkflowItemRole;
|
||||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
@@ -51,12 +51,12 @@ public class AutoAssignAction extends UserSelectionAction {
|
||||
protected WorkflowRequirementsService workflowRequirementsService;
|
||||
|
||||
@Override
|
||||
public void activate(Context c, XmlWorkflowItem wfItem) {
|
||||
public void activate(Context c, WorkflowItem wfItem) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult execute(Context c, XmlWorkflowItem wfi, Step step, HttpServletRequest request)
|
||||
public ActionResult execute(Context c, WorkflowItem wfi, Step step, HttpServletRequest request)
|
||||
throws SQLException, AuthorizeException, IOException {
|
||||
try {
|
||||
Role role = getParent().getStep().getRole();
|
||||
@@ -124,27 +124,27 @@ public class AutoAssignAction extends UserSelectionAction {
|
||||
* @throws AuthorizeException ...
|
||||
* @throws IOException ...
|
||||
*/
|
||||
protected void createTaskForEPerson(Context c, XmlWorkflowItem wfi, Step step, WorkflowActionConfig actionConfig,
|
||||
protected void createTaskForEPerson(Context c, WorkflowItem wfi, Step step, WorkflowActionConfig actionConfig,
|
||||
EPerson user) throws SQLException, AuthorizeException, IOException {
|
||||
if (claimedTaskService.find(c, wfi, step.getId(), actionConfig.getId()) != null) {
|
||||
workflowRequirementsService.addClaimedUser(c, wfi, step, c.getCurrentUser());
|
||||
XmlWorkflowServiceFactory.getInstance().getXmlWorkflowService()
|
||||
WorkflowServiceFactory.getInstance().getWorkflowService()
|
||||
.createOwnedTask(c, wfi, step, actionConfig, user);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFinished(XmlWorkflowItem wfi) {
|
||||
public boolean isFinished(WorkflowItem wfi) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void regenerateTasks(Context c, XmlWorkflowItem wfi, RoleMembers roleMembers) throws SQLException {
|
||||
public void regenerateTasks(Context c, WorkflowItem wfi, RoleMembers roleMembers) throws SQLException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValidUserSelection(Context context, XmlWorkflowItem wfi, boolean hasUI)
|
||||
public boolean isValidUserSelection(Context context, WorkflowItem wfi, boolean hasUI)
|
||||
throws WorkflowConfigurationException, SQLException {
|
||||
//This is an automatic assign action, it can never have a user interface
|
||||
Role role = getParent().getStep().getRole();
|
||||
|
@@ -20,14 +20,14 @@ import org.dspace.core.LogManager;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.services.ConfigurationService;
|
||||
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
import org.dspace.workflow.WorkflowService;
|
||||
import org.dspace.workflow.factory.WorkflowServiceFactory;
|
||||
import org.dspace.xmlworkflow.Role;
|
||||
import org.dspace.xmlworkflow.RoleMembers;
|
||||
import org.dspace.xmlworkflow.WorkflowConfigurationException;
|
||||
import org.dspace.xmlworkflow.factory.XmlWorkflowServiceFactory;
|
||||
import org.dspace.xmlworkflow.service.XmlWorkflowService;
|
||||
import org.dspace.xmlworkflow.state.Step;
|
||||
import org.dspace.xmlworkflow.state.actions.ActionResult;
|
||||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
|
||||
/**
|
||||
* Processing class for an action where x number of users
|
||||
@@ -43,14 +43,14 @@ public class ClaimAction extends UserSelectionAction {
|
||||
= DSpaceServicesFactory.getInstance().getConfigurationService();
|
||||
|
||||
@Override
|
||||
public void activate(Context context, XmlWorkflowItem wfItem) throws SQLException, IOException, AuthorizeException {
|
||||
public void activate(Context context, WorkflowItem wfItem) throws SQLException, IOException, AuthorizeException {
|
||||
Step owningStep = getParent().getStep();
|
||||
|
||||
RoleMembers allroleMembers = getParent().getStep().getRole().getMembers(context, wfItem);
|
||||
// Create pooled tasks for each member of our group
|
||||
if (allroleMembers != null && (allroleMembers.getGroups().size() > 0 || allroleMembers.getEPersons()
|
||||
.size() > 0)) {
|
||||
XmlWorkflowServiceFactory.getInstance().getXmlWorkflowService()
|
||||
WorkflowServiceFactory.getInstance().getWorkflowService()
|
||||
.createPoolTasks(context, wfItem, allroleMembers, owningStep, getParent());
|
||||
alertUsersOnActivation(context, wfItem, allroleMembers);
|
||||
} else {
|
||||
@@ -63,10 +63,10 @@ public class ClaimAction extends UserSelectionAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult execute(Context c, XmlWorkflowItem wfi, Step step, HttpServletRequest request)
|
||||
public ActionResult execute(Context c, WorkflowItem wfi, Step step, HttpServletRequest request)
|
||||
throws SQLException, AuthorizeException, IOException {
|
||||
// accept task, or accepting multiple tasks
|
||||
XmlWorkflowServiceFactory.getInstance().getWorkflowRequirementsService().addClaimedUser(c, wfi, step,
|
||||
WorkflowServiceFactory.getInstance().getWorkflowRequirementsService().addClaimedUser(c, wfi, step,
|
||||
c.getCurrentUser());
|
||||
return new ActionResult(ActionResult.TYPE.TYPE_OUTCOME, ActionResult.OUTCOME_COMPLETE);
|
||||
}
|
||||
@@ -77,7 +77,7 @@ public class ClaimAction extends UserSelectionAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void alertUsersOnActivation(Context c, XmlWorkflowItem wfi, RoleMembers roleMembers)
|
||||
public void alertUsersOnActivation(Context c, WorkflowItem wfi, RoleMembers roleMembers)
|
||||
throws IOException, SQLException {
|
||||
try {
|
||||
EPerson ep = wfi.getSubmitter();
|
||||
@@ -85,15 +85,15 @@ public class ClaimAction extends UserSelectionAction {
|
||||
if (ep != null) {
|
||||
submitterName = ep.getFullName();
|
||||
}
|
||||
XmlWorkflowService xmlWorkflowService = XmlWorkflowServiceFactory.getInstance().getXmlWorkflowService();
|
||||
xmlWorkflowService.alertUsersOnTaskActivation(c, wfi, "submit_task", roleMembers.getAllUniqueMembers(c),
|
||||
WorkflowService workflowService = WorkflowServiceFactory.getInstance().getWorkflowService();
|
||||
workflowService.alertUsersOnTaskActivation(c, wfi, "submit_task", roleMembers.getAllUniqueMembers(c),
|
||||
//The arguments
|
||||
wfi.getItem().getName(),
|
||||
wfi.getCollection().getName(),
|
||||
submitterName,
|
||||
//TODO: message
|
||||
"New task available.",
|
||||
xmlWorkflowService.getMyDSpaceLink()
|
||||
workflowService.getMyDSpaceLink()
|
||||
);
|
||||
} catch (MessagingException e) {
|
||||
log.info(LogManager.getHeader(c, "error emailing user(s) for claimed task",
|
||||
@@ -102,11 +102,11 @@ public class ClaimAction extends UserSelectionAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void regenerateTasks(Context c, XmlWorkflowItem wfi, RoleMembers roleMembers)
|
||||
public void regenerateTasks(Context c, WorkflowItem wfi, RoleMembers roleMembers)
|
||||
throws SQLException, AuthorizeException, IOException {
|
||||
if (roleMembers != null && (roleMembers.getEPersons().size() > 0 || roleMembers.getGroups().size() > 0)) {
|
||||
//Create task for the users left
|
||||
XmlWorkflowServiceFactory.getInstance().getXmlWorkflowService()
|
||||
WorkflowServiceFactory.getInstance().getWorkflowService()
|
||||
.createPoolTasks(c, wfi, roleMembers, getParent().getStep(), getParent());
|
||||
if (configurationService.getBooleanProperty("workflow.notify.returned.tasks", true)) {
|
||||
alertUsersOnActivation(c, wfi, roleMembers);
|
||||
@@ -121,12 +121,12 @@ public class ClaimAction extends UserSelectionAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFinished(XmlWorkflowItem wfi) {
|
||||
public boolean isFinished(WorkflowItem wfi) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValidUserSelection(Context context, XmlWorkflowItem wfi, boolean hasUI)
|
||||
public boolean isValidUserSelection(Context context, WorkflowItem wfi, boolean hasUI)
|
||||
throws WorkflowConfigurationException, SQLException {
|
||||
//A user claim action always needs to have a UI, since somebody needs to be able to claim it
|
||||
if (hasUI) {
|
||||
|
@@ -13,11 +13,11 @@ import java.util.List;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
import org.dspace.xmlworkflow.RoleMembers;
|
||||
import org.dspace.xmlworkflow.WorkflowConfigurationException;
|
||||
import org.dspace.xmlworkflow.state.Step;
|
||||
import org.dspace.xmlworkflow.state.actions.ActionResult;
|
||||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
|
||||
/**
|
||||
* A user selection action that inherits user
|
||||
@@ -31,11 +31,11 @@ import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
public class InheritUsersAction extends UserSelectionAction {
|
||||
|
||||
@Override
|
||||
public void activate(Context c, XmlWorkflowItem wfItem) {
|
||||
public void activate(Context c, WorkflowItem wfItem) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult execute(Context c, XmlWorkflowItem wfi, Step step, HttpServletRequest request) {
|
||||
public ActionResult execute(Context c, WorkflowItem wfi, Step step, HttpServletRequest request) {
|
||||
return new ActionResult(ActionResult.TYPE.TYPE_OUTCOME, ActionResult.OUTCOME_COMPLETE);
|
||||
}
|
||||
|
||||
@@ -45,16 +45,16 @@ public class InheritUsersAction extends UserSelectionAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFinished(XmlWorkflowItem wfi) {
|
||||
public boolean isFinished(WorkflowItem wfi) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void regenerateTasks(Context c, XmlWorkflowItem wfi, RoleMembers roleMembers) throws SQLException {
|
||||
public void regenerateTasks(Context c, WorkflowItem wfi, RoleMembers roleMembers) throws SQLException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValidUserSelection(Context context, XmlWorkflowItem wfi, boolean hasUI)
|
||||
public boolean isValidUserSelection(Context context, WorkflowItem wfi, boolean hasUI)
|
||||
throws WorkflowConfigurationException, SQLException {
|
||||
return false;
|
||||
}
|
||||
|
@@ -12,10 +12,10 @@ import java.util.List;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
import org.dspace.xmlworkflow.RoleMembers;
|
||||
import org.dspace.xmlworkflow.state.Step;
|
||||
import org.dspace.xmlworkflow.state.actions.ActionResult;
|
||||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
|
||||
/**
|
||||
* A user selection action that does not assign any users
|
||||
@@ -27,16 +27,16 @@ import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
*/
|
||||
public class NoUserSelectionAction extends UserSelectionAction {
|
||||
@Override
|
||||
public boolean isFinished(XmlWorkflowItem wfi) {
|
||||
public boolean isFinished(WorkflowItem wfi) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void regenerateTasks(Context c, XmlWorkflowItem wfi, RoleMembers roleMembers) {
|
||||
public void regenerateTasks(Context c, WorkflowItem wfi, RoleMembers roleMembers) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValidUserSelection(Context context, XmlWorkflowItem wfi, boolean hasUI) {
|
||||
public boolean isValidUserSelection(Context context, WorkflowItem wfi, boolean hasUI) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -46,11 +46,11 @@ public class NoUserSelectionAction extends UserSelectionAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activate(Context c, XmlWorkflowItem wf) {
|
||||
public void activate(Context c, WorkflowItem wf) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult execute(Context c, XmlWorkflowItem wfi, Step step, HttpServletRequest request) {
|
||||
public ActionResult execute(Context c, WorkflowItem wfi, Step step, HttpServletRequest request) {
|
||||
return new ActionResult(ActionResult.TYPE.TYPE_OUTCOME, ActionResult.OUTCOME_COMPLETE);
|
||||
}
|
||||
|
||||
|
@@ -14,11 +14,11 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
import org.dspace.xmlworkflow.RoleMembers;
|
||||
import org.dspace.xmlworkflow.WorkflowConfigurationException;
|
||||
import org.dspace.xmlworkflow.state.actions.Action;
|
||||
import org.dspace.xmlworkflow.storedcomponents.PoolTask;
|
||||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.ClaimedTaskService;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.PoolTaskService;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.WorkflowItemRoleService;
|
||||
@@ -38,7 +38,7 @@ public abstract class UserSelectionAction extends Action {
|
||||
|
||||
protected Logger log = org.apache.logging.log4j.LogManager.getLogger(UserSelectionAction.class);
|
||||
|
||||
public abstract boolean isFinished(XmlWorkflowItem wfi);
|
||||
public abstract boolean isFinished(WorkflowItem wfi);
|
||||
|
||||
@Autowired(required = true)
|
||||
protected ClaimedTaskService claimedTaskService;
|
||||
@@ -48,7 +48,7 @@ public abstract class UserSelectionAction extends Action {
|
||||
protected WorkflowItemRoleService workflowItemRoleService;
|
||||
|
||||
@Override
|
||||
public boolean isAuthorized(Context context, HttpServletRequest request, XmlWorkflowItem wfi)
|
||||
public boolean isAuthorized(Context context, HttpServletRequest request, WorkflowItem wfi)
|
||||
throws SQLException, AuthorizeException, IOException, WorkflowConfigurationException {
|
||||
PoolTask task = null;
|
||||
if (context.getCurrentUser() != null) {
|
||||
@@ -72,7 +72,7 @@ public abstract class UserSelectionAction extends Action {
|
||||
* @throws SQLException An exception that provides information on a database access error or other errors.
|
||||
* @throws IOException A general class of exceptions produced by failed or interrupted I/O operations.
|
||||
*/
|
||||
public abstract void regenerateTasks(Context c, XmlWorkflowItem wfi, RoleMembers roleMembers)
|
||||
public abstract void regenerateTasks(Context c, WorkflowItem wfi, RoleMembers roleMembers)
|
||||
throws SQLException, AuthorizeException, IOException;
|
||||
|
||||
/**
|
||||
@@ -87,7 +87,7 @@ public abstract class UserSelectionAction extends Action {
|
||||
* @throws SQLException An exception that provides information on a database access error or
|
||||
* other errors.
|
||||
*/
|
||||
public abstract boolean isValidUserSelection(Context context, XmlWorkflowItem wfi, boolean hasUI)
|
||||
public abstract boolean isValidUserSelection(Context context, WorkflowItem wfi, boolean hasUI)
|
||||
throws WorkflowConfigurationException, SQLException;
|
||||
|
||||
/**
|
||||
|
@@ -21,6 +21,7 @@ import javax.persistence.Table;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.ReloadableEntity;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
|
||||
/**
|
||||
* Claimed task representing the database representation of an action claimed by an eperson
|
||||
@@ -42,7 +43,7 @@ public class ClaimedTask implements ReloadableEntity<Integer> {
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "workflowitem_id")
|
||||
private XmlWorkflowItem workflowItem;
|
||||
private WorkflowItem workflowItem;
|
||||
|
||||
// @Column(name = "workflow_id")
|
||||
// @Lob
|
||||
@@ -83,11 +84,11 @@ public class ClaimedTask implements ReloadableEntity<Integer> {
|
||||
return owner;
|
||||
}
|
||||
|
||||
public void setWorkflowItem(XmlWorkflowItem workflowItem) {
|
||||
public void setWorkflowItem(WorkflowItem workflowItem) {
|
||||
this.workflowItem = workflowItem;
|
||||
}
|
||||
|
||||
public XmlWorkflowItem getWorkflowItem() {
|
||||
public WorkflowItem getWorkflowItem() {
|
||||
return workflowItem;
|
||||
}
|
||||
|
||||
|
@@ -16,6 +16,7 @@ import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
import org.dspace.xmlworkflow.storedcomponents.dao.ClaimedTaskDAO;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.ClaimedTaskService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -71,12 +72,12 @@ public class ClaimedTaskServiceImpl implements ClaimedTaskService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ClaimedTask> findByWorkflowItem(Context context, XmlWorkflowItem workflowItem) throws SQLException {
|
||||
public List<ClaimedTask> findByWorkflowItem(Context context, WorkflowItem workflowItem) throws SQLException {
|
||||
return claimedTaskDAO.findByWorkflowItem(context, workflowItem);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClaimedTask findByWorkflowIdAndEPerson(Context context, XmlWorkflowItem workflowItem, EPerson ePerson)
|
||||
public ClaimedTask findByWorkflowIdAndEPerson(Context context, WorkflowItem workflowItem, EPerson ePerson)
|
||||
throws SQLException {
|
||||
return claimedTaskDAO.findByWorkflowItemAndEPerson(context, workflowItem, ePerson);
|
||||
}
|
||||
@@ -87,25 +88,25 @@ public class ClaimedTaskServiceImpl implements ClaimedTaskService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ClaimedTask> find(Context context, XmlWorkflowItem workflowItem, String stepID) throws SQLException {
|
||||
public List<ClaimedTask> find(Context context, WorkflowItem workflowItem, String stepID) throws SQLException {
|
||||
return claimedTaskDAO.findByWorkflowItemAndStepId(context, workflowItem, stepID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClaimedTask find(Context context, EPerson ePerson, XmlWorkflowItem workflowItem, String stepID,
|
||||
public ClaimedTask find(Context context, EPerson ePerson, WorkflowItem workflowItem, String stepID,
|
||||
String actionID) throws SQLException {
|
||||
return claimedTaskDAO
|
||||
.findByEPersonAndWorkflowItemAndStepIdAndActionId(context, ePerson, workflowItem, stepID, actionID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ClaimedTask> find(Context context, XmlWorkflowItem workflowItem, String stepID, String actionID)
|
||||
public List<ClaimedTask> find(Context context, WorkflowItem workflowItem, String stepID, String actionID)
|
||||
throws SQLException {
|
||||
return claimedTaskDAO.findByWorkflowItemAndStepIdAndActionId(context, workflowItem, stepID, actionID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ClaimedTask> find(Context context, XmlWorkflowItem workflowItem) throws SQLException {
|
||||
public List<ClaimedTask> find(Context context, WorkflowItem workflowItem) throws SQLException {
|
||||
return claimedTaskDAO.findByWorkflowItem(context, workflowItem);
|
||||
}
|
||||
|
||||
@@ -115,7 +116,7 @@ public class ClaimedTaskServiceImpl implements ClaimedTaskService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByWorkflowItem(Context context, XmlWorkflowItem workflowItem)
|
||||
public void deleteByWorkflowItem(Context context, WorkflowItem workflowItem)
|
||||
throws SQLException, AuthorizeException {
|
||||
List<ClaimedTask> claimedTasks = findByWorkflowItem(context, workflowItem);
|
||||
//Use an iterator to remove the tasks !
|
||||
|
@@ -21,6 +21,7 @@ import javax.persistence.Table;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.ReloadableEntity;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
|
||||
/**
|
||||
* Claimed task representing the database representation of an action claimed by an eperson
|
||||
@@ -46,7 +47,7 @@ public class InProgressUser implements ReloadableEntity<Integer> {
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "workflowitem_id")
|
||||
private XmlWorkflowItem workflowItem;
|
||||
private WorkflowItem workflowItem;
|
||||
|
||||
@Column(name = "finished")
|
||||
private boolean finished = false;
|
||||
@@ -71,11 +72,11 @@ public class InProgressUser implements ReloadableEntity<Integer> {
|
||||
return this.ePerson;
|
||||
}
|
||||
|
||||
public void setWorkflowItem(XmlWorkflowItem workflowItem) {
|
||||
public void setWorkflowItem(WorkflowItem workflowItem) {
|
||||
this.workflowItem = workflowItem;
|
||||
}
|
||||
|
||||
public XmlWorkflowItem getWorkflowItem() {
|
||||
public WorkflowItem getWorkflowItem() {
|
||||
return this.workflowItem;
|
||||
}
|
||||
|
||||
|
@@ -15,6 +15,7 @@ import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
import org.dspace.xmlworkflow.storedcomponents.dao.InProgressUserDAO;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.InProgressUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -36,7 +37,7 @@ public class InProgressUserServiceImpl implements InProgressUserService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public InProgressUser findByWorkflowItemAndEPerson(Context context, XmlWorkflowItem workflowItem, EPerson ePerson)
|
||||
public InProgressUser findByWorkflowItemAndEPerson(Context context, WorkflowItem workflowItem, EPerson ePerson)
|
||||
throws SQLException {
|
||||
return inProgressUserDAO.findByWorkflowItemAndEPerson(context, workflowItem, ePerson);
|
||||
}
|
||||
@@ -47,17 +48,17 @@ public class InProgressUserServiceImpl implements InProgressUserService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<InProgressUser> findByWorkflowItem(Context context, XmlWorkflowItem workflowItem) throws SQLException {
|
||||
public List<InProgressUser> findByWorkflowItem(Context context, WorkflowItem workflowItem) throws SQLException {
|
||||
return inProgressUserDAO.findByWorkflowItem(context, workflowItem);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNumberOfInProgressUsers(Context context, XmlWorkflowItem workflowItem) throws SQLException {
|
||||
public int getNumberOfInProgressUsers(Context context, WorkflowItem workflowItem) throws SQLException {
|
||||
return inProgressUserDAO.countInProgressUsers(context, workflowItem);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNumberOfFinishedUsers(Context context, XmlWorkflowItem workflowItem) throws SQLException {
|
||||
public int getNumberOfFinishedUsers(Context context, WorkflowItem workflowItem) throws SQLException {
|
||||
return inProgressUserDAO.countFinishedUsers(context, workflowItem);
|
||||
}
|
||||
|
||||
|
@@ -23,6 +23,7 @@ import org.dspace.core.Context;
|
||||
import org.dspace.core.ReloadableEntity;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.eperson.Group;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
|
||||
/**
|
||||
* Pool task representing the database representation of a pool task for a step and an eperson
|
||||
@@ -44,7 +45,7 @@ public class PoolTask implements ReloadableEntity<Integer> {
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name = "workflowitem_id")
|
||||
private XmlWorkflowItem workflowItem;
|
||||
private WorkflowItem workflowItem;
|
||||
|
||||
// @Column(name = "workflow_id")
|
||||
// @Lob
|
||||
@@ -106,11 +107,11 @@ public class PoolTask implements ReloadableEntity<Integer> {
|
||||
return workflowId;
|
||||
}
|
||||
|
||||
public void setWorkflowItem(XmlWorkflowItem xmlWorkflowItem) {
|
||||
this.workflowItem = xmlWorkflowItem;
|
||||
public void setWorkflowItem(WorkflowItem workflowItem) {
|
||||
this.workflowItem = workflowItem;
|
||||
}
|
||||
|
||||
public XmlWorkflowItem getWorkflowItem() {
|
||||
public WorkflowItem getWorkflowItem() {
|
||||
return this.workflowItem;
|
||||
}
|
||||
|
||||
|
@@ -21,6 +21,7 @@ import org.dspace.core.Context;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.eperson.Group;
|
||||
import org.dspace.eperson.service.GroupService;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
import org.dspace.xmlworkflow.storedcomponents.dao.PoolTaskDAO;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.InProgressUserService;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.PoolTaskService;
|
||||
@@ -67,7 +68,7 @@ public class PoolTaskServiceImpl implements PoolTaskService {
|
||||
for (Group group : groups) {
|
||||
List<PoolTask> groupTasks = poolTaskDAO.findByGroup(context, group);
|
||||
for (PoolTask poolTask : groupTasks) {
|
||||
XmlWorkflowItem workflowItem = poolTask.getWorkflowItem();
|
||||
WorkflowItem workflowItem = poolTask.getWorkflowItem();
|
||||
if (inProgressUserService.findByWorkflowItemAndEPerson(context, workflowItem, ePerson) == null) {
|
||||
result.add(poolTask);
|
||||
}
|
||||
@@ -78,12 +79,12 @@ public class PoolTaskServiceImpl implements PoolTaskService {
|
||||
|
||||
|
||||
@Override
|
||||
public List<PoolTask> find(Context context, XmlWorkflowItem workflowItem) throws SQLException {
|
||||
public List<PoolTask> find(Context context, WorkflowItem workflowItem) throws SQLException {
|
||||
return poolTaskDAO.findByWorkflowItem(context, workflowItem);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PoolTask findByWorkflowIdAndEPerson(Context context, XmlWorkflowItem workflowItem, EPerson ePerson)
|
||||
public PoolTask findByWorkflowIdAndEPerson(Context context, WorkflowItem workflowItem, EPerson ePerson)
|
||||
throws SQLException, AuthorizeException, IOException {
|
||||
PoolTask poolTask = poolTaskDAO.findByWorkflowItemAndEPerson(context, workflowItem, ePerson);
|
||||
|
||||
@@ -113,9 +114,9 @@ public class PoolTaskServiceImpl implements PoolTaskService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByWorkflowItem(Context context, XmlWorkflowItem xmlWorkflowItem)
|
||||
public void deleteByWorkflowItem(Context context, WorkflowItem workflowItem)
|
||||
throws SQLException, AuthorizeException {
|
||||
List<PoolTask> tasks = find(context, xmlWorkflowItem);
|
||||
List<PoolTask> tasks = find(context, workflowItem);
|
||||
//Use an iterator to remove the tasks !
|
||||
Iterator<PoolTask> iterator = tasks.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
|
@@ -23,6 +23,7 @@ import org.dspace.core.Context;
|
||||
import org.dspace.core.ReloadableEntity;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.eperson.Group;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
|
||||
/**
|
||||
* Represents a workflow assignments database representation.
|
||||
@@ -51,7 +52,7 @@ public class WorkflowItemRole implements ReloadableEntity<Integer> {
|
||||
|
||||
@OneToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "workflowitem_id")
|
||||
private XmlWorkflowItem workflowItem;
|
||||
private WorkflowItem workflowItem;
|
||||
|
||||
@OneToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "eperson_id")
|
||||
@@ -82,11 +83,11 @@ public class WorkflowItemRole implements ReloadableEntity<Integer> {
|
||||
return this.roleId;
|
||||
}
|
||||
|
||||
public void setWorkflowItem(XmlWorkflowItem xmlWorkflowItem) {
|
||||
this.workflowItem = xmlWorkflowItem;
|
||||
public void setWorkflowItem(WorkflowItem workflowItem) {
|
||||
this.workflowItem = workflowItem;
|
||||
}
|
||||
|
||||
public XmlWorkflowItem getWorkflowItem() {
|
||||
public WorkflowItem getWorkflowItem() {
|
||||
return workflowItem;
|
||||
}
|
||||
|
||||
|
@@ -16,6 +16,7 @@ import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
import org.dspace.xmlworkflow.storedcomponents.dao.WorkflowItemRoleDAO;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.WorkflowItemRoleService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -37,20 +38,20 @@ public class WorkflowItemRoleServiceImpl implements WorkflowItemRoleService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WorkflowItemRole> find(Context context, XmlWorkflowItem workflowItem, String role) throws SQLException {
|
||||
public List<WorkflowItemRole> find(Context context, WorkflowItem workflowItem, String role) throws SQLException {
|
||||
return workflowItemRoleDAO.findByWorkflowItemAndRole(context, workflowItem, role);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WorkflowItemRole> findByWorkflowItem(Context context, XmlWorkflowItem xmlWorkflowItem)
|
||||
public List<WorkflowItemRole> findByWorkflowItem(Context context, WorkflowItem workflowItem)
|
||||
throws SQLException {
|
||||
return workflowItemRoleDAO.findByWorkflowItem(context, xmlWorkflowItem);
|
||||
return workflowItemRoleDAO.findByWorkflowItem(context, workflowItem);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteForWorkflowItem(Context context, XmlWorkflowItem xmlWorkflowItem)
|
||||
public void deleteForWorkflowItem(Context context, WorkflowItem workflowItem)
|
||||
throws SQLException, AuthorizeException {
|
||||
Iterator<WorkflowItemRole> workflowItemRoles = findByWorkflowItem(context, xmlWorkflowItem).iterator();
|
||||
Iterator<WorkflowItemRole> workflowItemRoles = findByWorkflowItem(context, workflowItem).iterator();
|
||||
while (workflowItemRoles.hasNext()) {
|
||||
WorkflowItemRole workflowItemRole = workflowItemRoles.next();
|
||||
workflowItemRoles.remove();
|
||||
|
@@ -1,141 +0,0 @@
|
||||
/**
|
||||
* The contents of this file are subject to the license and copyright
|
||||
* detailed in the LICENSE and NOTICE files at the root of the source
|
||||
* tree and available online at
|
||||
*
|
||||
* http://www.dspace.org/license/
|
||||
*/
|
||||
package org.dspace.xmlworkflow.storedcomponents;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.SequenceGenerator;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.dspace.content.Collection;
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
|
||||
/**
|
||||
* Class representing an item going through the workflow process in DSpace
|
||||
*
|
||||
* @author Bram De Schouwer (bram.deschouwer at dot com)
|
||||
* @author Kevin Van de Velde (kevin at atmire dot com)
|
||||
* @author Ben Bosman (ben at atmire dot com)
|
||||
* @author Mark Diggory (markd at atmire dot com)
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "cwf_workflowitem")
|
||||
public class XmlWorkflowItem implements WorkflowItem {
|
||||
|
||||
@Id
|
||||
@Column(name = "workflowitem_id")
|
||||
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "cwf_workflowitem_seq")
|
||||
@SequenceGenerator(name = "cwf_workflowitem_seq", sequenceName = "cwf_workflowitem_seq", allocationSize = 1)
|
||||
private Integer id;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "collection_id")
|
||||
private Collection collection;
|
||||
|
||||
@OneToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "item_id", unique = true)
|
||||
private Item item;
|
||||
|
||||
@Column(name = "multiple_titles")
|
||||
private boolean multipleTitles = false;
|
||||
|
||||
@Column(name = "published_before")
|
||||
private boolean publishedBefore = false;
|
||||
|
||||
@Column(name = "multiple_files")
|
||||
private boolean multipleFiles = false;
|
||||
|
||||
/**
|
||||
* Protected constructor, create object using:
|
||||
* {@link org.dspace.xmlworkflow.storedcomponents.service.XmlWorkflowItemService#create(Context, Item, Collection)}
|
||||
*/
|
||||
protected XmlWorkflowItem() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the internal ID of this workflow item
|
||||
*
|
||||
* @return the internal identifier
|
||||
*/
|
||||
@Override
|
||||
public Integer getID() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Collection getCollection() {
|
||||
return this.collection;
|
||||
}
|
||||
|
||||
public void setCollection(Collection collection) {
|
||||
this.collection = collection;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItem() {
|
||||
return item;
|
||||
}
|
||||
|
||||
public void setItem(Item item) {
|
||||
this.item = item;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EPerson getSubmitter() {
|
||||
return item.getSubmitter();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasMultipleFiles() {
|
||||
return multipleFiles;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMultipleFiles(boolean b) {
|
||||
this.multipleFiles = b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasMultipleTitles() {
|
||||
return this.multipleTitles;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMultipleTitles(boolean b) {
|
||||
this.multipleTitles = b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPublishedBefore() {
|
||||
return this.publishedBefore;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPublishedBefore(boolean b) {
|
||||
this.publishedBefore = b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getState() {
|
||||
// FIXME not used by the xml workflow, should be removed when the basic workflow is removed and the interfaces
|
||||
// simplified
|
||||
return 0;
|
||||
}
|
||||
}
|
@@ -13,8 +13,8 @@ import java.util.List;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.GenericDAO;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
import org.dspace.xmlworkflow.storedcomponents.ClaimedTask;
|
||||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
|
||||
/**
|
||||
* Database Access Object interface class for the ClaimedTask object.
|
||||
@@ -26,21 +26,21 @@ import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
*/
|
||||
public interface ClaimedTaskDAO extends GenericDAO<ClaimedTask> {
|
||||
|
||||
public List<ClaimedTask> findByWorkflowItem(Context context, XmlWorkflowItem workflowItem) throws SQLException;
|
||||
public List<ClaimedTask> findByWorkflowItem(Context context, WorkflowItem workflowItem) throws SQLException;
|
||||
|
||||
public ClaimedTask findByWorkflowItemAndEPerson(Context context, XmlWorkflowItem workflowItem, EPerson ePerson)
|
||||
public ClaimedTask findByWorkflowItemAndEPerson(Context context, WorkflowItem workflowItem, EPerson ePerson)
|
||||
throws SQLException;
|
||||
|
||||
public List<ClaimedTask> findByEperson(Context context, EPerson ePerson) throws SQLException;
|
||||
|
||||
public List<ClaimedTask> findByWorkflowItemAndStepId(Context context, XmlWorkflowItem workflowItem, String stepID)
|
||||
public List<ClaimedTask> findByWorkflowItemAndStepId(Context context, WorkflowItem workflowItem, String stepID)
|
||||
throws SQLException;
|
||||
|
||||
public ClaimedTask findByEPersonAndWorkflowItemAndStepIdAndActionId(Context context, EPerson ePerson,
|
||||
XmlWorkflowItem workflowItem, String stepID,
|
||||
WorkflowItem workflowItem, String stepID,
|
||||
String actionID) throws SQLException;
|
||||
|
||||
public List<ClaimedTask> findByWorkflowItemAndStepIdAndActionId(Context c, XmlWorkflowItem workflowItem,
|
||||
public List<ClaimedTask> findByWorkflowItemAndStepIdAndActionId(Context c, WorkflowItem workflowItem,
|
||||
String stepID, String actionID) throws SQLException;
|
||||
|
||||
public List<ClaimedTask> findByStep(Context context, String stepID) throws SQLException;
|
||||
|
@@ -13,8 +13,8 @@ import java.util.List;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.GenericDAO;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
import org.dspace.xmlworkflow.storedcomponents.InProgressUser;
|
||||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
|
||||
/**
|
||||
* Database Access Object interface class for the InProgressUser object.
|
||||
@@ -26,14 +26,14 @@ import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
*/
|
||||
public interface InProgressUserDAO extends GenericDAO<InProgressUser> {
|
||||
|
||||
public InProgressUser findByWorkflowItemAndEPerson(Context context, XmlWorkflowItem workflowItem, EPerson ePerson)
|
||||
public InProgressUser findByWorkflowItemAndEPerson(Context context, WorkflowItem workflowItem, EPerson ePerson)
|
||||
throws SQLException;
|
||||
|
||||
public List<InProgressUser> findByEperson(Context context, EPerson ePerson) throws SQLException;
|
||||
|
||||
public List<InProgressUser> findByWorkflowItem(Context context, XmlWorkflowItem workflowItem) throws SQLException;
|
||||
public List<InProgressUser> findByWorkflowItem(Context context, WorkflowItem workflowItem) throws SQLException;
|
||||
|
||||
public int countInProgressUsers(Context context, XmlWorkflowItem workflowItem) throws SQLException;
|
||||
public int countInProgressUsers(Context context, WorkflowItem workflowItem) throws SQLException;
|
||||
|
||||
public int countFinishedUsers(Context context, XmlWorkflowItem workflowItem) throws SQLException;
|
||||
public int countFinishedUsers(Context context, WorkflowItem workflowItem) throws SQLException;
|
||||
}
|
||||
|
@@ -14,8 +14,8 @@ import org.dspace.core.Context;
|
||||
import org.dspace.core.GenericDAO;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.eperson.Group;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
import org.dspace.xmlworkflow.storedcomponents.PoolTask;
|
||||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
|
||||
/**
|
||||
* Database Access Object interface class for the PoolTask object.
|
||||
@@ -31,11 +31,11 @@ public interface PoolTaskDAO extends GenericDAO<PoolTask> {
|
||||
|
||||
public List<PoolTask> findByGroup(Context context, Group group) throws SQLException;
|
||||
|
||||
public List<PoolTask> findByWorkflowItem(Context context, XmlWorkflowItem workflowItem) throws SQLException;
|
||||
public List<PoolTask> findByWorkflowItem(Context context, WorkflowItem workflowItem) throws SQLException;
|
||||
|
||||
public PoolTask findByWorkflowItemAndEPerson(Context context, XmlWorkflowItem workflowItem, EPerson ePerson)
|
||||
public PoolTask findByWorkflowItemAndEPerson(Context context, WorkflowItem workflowItem, EPerson ePerson)
|
||||
throws SQLException;
|
||||
|
||||
public PoolTask findByWorkflowItemAndGroup(Context context, Group group, XmlWorkflowItem workflowItem)
|
||||
public PoolTask findByWorkflowItemAndGroup(Context context, Group group, WorkflowItem workflowItem)
|
||||
throws SQLException;
|
||||
}
|
||||
|
@@ -15,17 +15,17 @@ import org.dspace.content.Item;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.GenericDAO;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
|
||||
/**
|
||||
* Database Access Object interface class for the XmlWorkflowItem object.
|
||||
* The implementation of this class is responsible for all database calls for the XmlWorkflowItem object and is
|
||||
* Database Access Object interface class for the WorkflowItem object.
|
||||
* The implementation of this class is responsible for all database calls for the WorkflowItem object and is
|
||||
* autowired by spring
|
||||
* This class should only be accessed from a single service and should never be exposed outside of the API
|
||||
*
|
||||
* @author kevinvandevelde at atmire.com
|
||||
*/
|
||||
public interface XmlWorkflowItemDAO extends GenericDAO<XmlWorkflowItem> {
|
||||
public interface WorkflowItemDAO extends GenericDAO<WorkflowItem> {
|
||||
|
||||
/**
|
||||
* Find all the workflow items in a specific collection using the pagination parameters (offset, limit)
|
||||
@@ -41,18 +41,18 @@ public interface XmlWorkflowItemDAO extends GenericDAO<XmlWorkflowItem> {
|
||||
* @return all the workflow items respecting the parameters conditions
|
||||
* @throws SQLException
|
||||
*/
|
||||
public List<XmlWorkflowItem> findAllInCollection(Context context, Integer offset, Integer limit,
|
||||
public List<WorkflowItem> findAllInCollection(Context context, Integer offset, Integer limit,
|
||||
Collection collection) throws SQLException;
|
||||
|
||||
public int countAll(Context context) throws SQLException;
|
||||
|
||||
public int countAllInCollection(Context context, Collection collection) throws SQLException;
|
||||
|
||||
public List<XmlWorkflowItem> findBySubmitter(Context context, EPerson ep) throws SQLException;
|
||||
public List<WorkflowItem> findBySubmitter(Context context, EPerson ep) throws SQLException;
|
||||
|
||||
public List<XmlWorkflowItem> findByCollection(Context context, Collection collection) throws SQLException;
|
||||
public List<WorkflowItem> findByCollection(Context context, Collection collection) throws SQLException;
|
||||
|
||||
public XmlWorkflowItem findByItem(Context context, Item item) throws SQLException;
|
||||
public WorkflowItem findByItem(Context context, Item item) throws SQLException;
|
||||
|
||||
/**
|
||||
* Return all the workflow items from a specific submitter respecting the pagination parameters
|
||||
@@ -67,7 +67,7 @@ public interface XmlWorkflowItemDAO extends GenericDAO<XmlWorkflowItem> {
|
||||
* the max number of records to return
|
||||
* @return
|
||||
*/
|
||||
public List<XmlWorkflowItem> findBySubmitter(Context context, EPerson ep, Integer offset, Integer limit)
|
||||
public List<WorkflowItem> findBySubmitter(Context context, EPerson ep, Integer offset, Integer limit)
|
||||
throws SQLException;
|
||||
|
||||
/**
|
@@ -13,8 +13,8 @@ import java.util.List;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.GenericDAO;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
import org.dspace.xmlworkflow.storedcomponents.WorkflowItemRole;
|
||||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
|
||||
/**
|
||||
* Database Access Object interface class for the WorkflowItemRole object.
|
||||
@@ -26,10 +26,10 @@ import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
*/
|
||||
public interface WorkflowItemRoleDAO extends GenericDAO<WorkflowItemRole> {
|
||||
|
||||
public List<WorkflowItemRole> findByWorkflowItemAndRole(Context context, XmlWorkflowItem workflowItem, String role)
|
||||
public List<WorkflowItemRole> findByWorkflowItemAndRole(Context context, WorkflowItem workflowItem, String role)
|
||||
throws SQLException;
|
||||
|
||||
public List<WorkflowItemRole> findByWorkflowItem(Context context, XmlWorkflowItem workflowItem) throws SQLException;
|
||||
public List<WorkflowItemRole> findByWorkflowItem(Context context, WorkflowItem workflowItem) throws SQLException;
|
||||
|
||||
public List<WorkflowItemRole> findByEPerson(Context context, EPerson ePerson) throws SQLException;
|
||||
}
|
||||
|
@@ -16,9 +16,9 @@ import javax.persistence.criteria.Root;
|
||||
import org.dspace.core.AbstractHibernateDAO;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
import org.dspace.xmlworkflow.storedcomponents.ClaimedTask;
|
||||
import org.dspace.xmlworkflow.storedcomponents.ClaimedTask_;
|
||||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
import org.dspace.xmlworkflow.storedcomponents.dao.ClaimedTaskDAO;
|
||||
|
||||
/**
|
||||
@@ -34,7 +34,7 @@ public class ClaimedTaskDAOImpl extends AbstractHibernateDAO<ClaimedTask> implem
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ClaimedTask> findByWorkflowItem(Context context, XmlWorkflowItem workflowItem) throws SQLException {
|
||||
public List<ClaimedTask> findByWorkflowItem(Context context, WorkflowItem workflowItem) throws SQLException {
|
||||
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
|
||||
CriteriaQuery criteriaQuery = getCriteriaQuery(criteriaBuilder, ClaimedTask.class);
|
||||
Root<ClaimedTask> claimedTaskRoot = criteriaQuery.from(ClaimedTask.class);
|
||||
@@ -45,7 +45,7 @@ public class ClaimedTaskDAOImpl extends AbstractHibernateDAO<ClaimedTask> implem
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClaimedTask findByWorkflowItemAndEPerson(Context context, XmlWorkflowItem workflowItem, EPerson ePerson)
|
||||
public ClaimedTask findByWorkflowItemAndEPerson(Context context, WorkflowItem workflowItem, EPerson ePerson)
|
||||
throws SQLException {
|
||||
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
|
||||
CriteriaQuery criteriaQuery = getCriteriaQuery(criteriaBuilder, ClaimedTask.class);
|
||||
@@ -72,7 +72,7 @@ public class ClaimedTaskDAOImpl extends AbstractHibernateDAO<ClaimedTask> implem
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ClaimedTask> findByWorkflowItemAndStepId(Context context, XmlWorkflowItem workflowItem, String stepID)
|
||||
public List<ClaimedTask> findByWorkflowItemAndStepId(Context context, WorkflowItem workflowItem, String stepID)
|
||||
throws SQLException {
|
||||
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
|
||||
CriteriaQuery criteriaQuery = getCriteriaQuery(criteriaBuilder, ClaimedTask.class);
|
||||
@@ -88,7 +88,7 @@ public class ClaimedTaskDAOImpl extends AbstractHibernateDAO<ClaimedTask> implem
|
||||
|
||||
@Override
|
||||
public ClaimedTask findByEPersonAndWorkflowItemAndStepIdAndActionId(Context context, EPerson ePerson,
|
||||
XmlWorkflowItem workflowItem, String stepID,
|
||||
WorkflowItem workflowItem, String stepID,
|
||||
String actionID) throws SQLException {
|
||||
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
|
||||
CriteriaQuery criteriaQuery = getCriteriaQuery(criteriaBuilder, ClaimedTask.class);
|
||||
@@ -105,7 +105,7 @@ public class ClaimedTaskDAOImpl extends AbstractHibernateDAO<ClaimedTask> implem
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ClaimedTask> findByWorkflowItemAndStepIdAndActionId(Context context, XmlWorkflowItem workflowItem,
|
||||
public List<ClaimedTask> findByWorkflowItemAndStepIdAndActionId(Context context, WorkflowItem workflowItem,
|
||||
String stepID, String actionID)
|
||||
throws SQLException {
|
||||
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
|
||||
|
@@ -16,9 +16,9 @@ import javax.persistence.criteria.Root;
|
||||
import org.dspace.core.AbstractHibernateDAO;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
import org.dspace.xmlworkflow.storedcomponents.InProgressUser;
|
||||
import org.dspace.xmlworkflow.storedcomponents.InProgressUser_;
|
||||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
import org.dspace.xmlworkflow.storedcomponents.dao.InProgressUserDAO;
|
||||
|
||||
/**
|
||||
@@ -34,7 +34,7 @@ public class InProgressUserDAOImpl extends AbstractHibernateDAO<InProgressUser>
|
||||
}
|
||||
|
||||
@Override
|
||||
public InProgressUser findByWorkflowItemAndEPerson(Context context, XmlWorkflowItem workflowItem, EPerson ePerson)
|
||||
public InProgressUser findByWorkflowItemAndEPerson(Context context, WorkflowItem workflowItem, EPerson ePerson)
|
||||
throws SQLException {
|
||||
|
||||
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
|
||||
@@ -61,7 +61,7 @@ public class InProgressUserDAOImpl extends AbstractHibernateDAO<InProgressUser>
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<InProgressUser> findByWorkflowItem(Context context, XmlWorkflowItem workflowItem) throws SQLException {
|
||||
public List<InProgressUser> findByWorkflowItem(Context context, WorkflowItem workflowItem) throws SQLException {
|
||||
|
||||
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
|
||||
CriteriaQuery criteriaQuery = getCriteriaQuery(criteriaBuilder, InProgressUser.class);
|
||||
@@ -72,7 +72,7 @@ public class InProgressUserDAOImpl extends AbstractHibernateDAO<InProgressUser>
|
||||
}
|
||||
|
||||
@Override
|
||||
public int countInProgressUsers(Context context, XmlWorkflowItem workflowItem) throws SQLException {
|
||||
public int countInProgressUsers(Context context, WorkflowItem workflowItem) throws SQLException {
|
||||
|
||||
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
|
||||
CriteriaQuery<Long> criteriaQuery = criteriaBuilder.createQuery(Long.class);
|
||||
@@ -88,7 +88,7 @@ public class InProgressUserDAOImpl extends AbstractHibernateDAO<InProgressUser>
|
||||
}
|
||||
|
||||
@Override
|
||||
public int countFinishedUsers(Context context, XmlWorkflowItem workflowItem) throws SQLException {
|
||||
public int countFinishedUsers(Context context, WorkflowItem workflowItem) throws SQLException {
|
||||
|
||||
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
|
||||
CriteriaQuery<Long> criteriaQuery = criteriaBuilder.createQuery(Long.class);
|
||||
|
@@ -17,9 +17,9 @@ import org.dspace.core.AbstractHibernateDAO;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.eperson.Group;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
import org.dspace.xmlworkflow.storedcomponents.PoolTask;
|
||||
import org.dspace.xmlworkflow.storedcomponents.PoolTask_;
|
||||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
import org.dspace.xmlworkflow.storedcomponents.dao.PoolTaskDAO;
|
||||
|
||||
/**
|
||||
@@ -56,7 +56,7 @@ public class PoolTaskDAOImpl extends AbstractHibernateDAO<PoolTask> implements P
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PoolTask> findByWorkflowItem(Context context, XmlWorkflowItem workflowItem) throws SQLException {
|
||||
public List<PoolTask> findByWorkflowItem(Context context, WorkflowItem workflowItem) throws SQLException {
|
||||
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
|
||||
CriteriaQuery criteriaQuery = getCriteriaQuery(criteriaBuilder, PoolTask.class);
|
||||
Root<PoolTask> poolTaskRoot = criteriaQuery.from(PoolTask.class);
|
||||
@@ -66,7 +66,7 @@ public class PoolTaskDAOImpl extends AbstractHibernateDAO<PoolTask> implements P
|
||||
}
|
||||
|
||||
@Override
|
||||
public PoolTask findByWorkflowItemAndEPerson(Context context, XmlWorkflowItem workflowItem, EPerson ePerson)
|
||||
public PoolTask findByWorkflowItemAndEPerson(Context context, WorkflowItem workflowItem, EPerson ePerson)
|
||||
throws SQLException {
|
||||
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
|
||||
CriteriaQuery criteriaQuery = getCriteriaQuery(criteriaBuilder, PoolTask.class);
|
||||
@@ -81,7 +81,7 @@ public class PoolTaskDAOImpl extends AbstractHibernateDAO<PoolTask> implements P
|
||||
}
|
||||
|
||||
@Override
|
||||
public PoolTask findByWorkflowItemAndGroup(Context context, Group group, XmlWorkflowItem workflowItem)
|
||||
public PoolTask findByWorkflowItemAndGroup(Context context, Group group, WorkflowItem workflowItem)
|
||||
throws SQLException {
|
||||
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
|
||||
CriteriaQuery criteriaQuery = getCriteriaQuery(criteriaBuilder, PoolTask.class);
|
||||
|
@@ -0,0 +1,137 @@
|
||||
/**
|
||||
* The contents of this file are subject to the license and copyright
|
||||
* detailed in the LICENSE and NOTICE files at the root of the source
|
||||
* tree and available online at
|
||||
*
|
||||
* http://www.dspace.org/license/
|
||||
*/
|
||||
package org.dspace.xmlworkflow.storedcomponents.dao.impl;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import javax.persistence.criteria.CriteriaBuilder;
|
||||
import javax.persistence.criteria.CriteriaQuery;
|
||||
import javax.persistence.criteria.Join;
|
||||
import javax.persistence.criteria.Root;
|
||||
|
||||
import org.dspace.content.Collection;
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.content.Item_;
|
||||
import org.dspace.core.AbstractHibernateDAO;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
import org.dspace.workflow.WorkflowItem_;
|
||||
import org.dspace.xmlworkflow.storedcomponents.dao.WorkflowItemDAO;
|
||||
|
||||
/**
|
||||
* Hibernate implementation of the Database Access Object interface class for the WorkflowItem object.
|
||||
* This class is responsible for all database calls for the WorkflowItem object and is autowired by spring
|
||||
* This class should never be accessed directly.
|
||||
*
|
||||
* @author kevinvandevelde at atmire.com
|
||||
*/
|
||||
public class WorkflowItemDAOImpl extends AbstractHibernateDAO<WorkflowItem> implements WorkflowItemDAO {
|
||||
|
||||
protected WorkflowItemDAOImpl() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WorkflowItem> findAllInCollection(Context context, Integer offset,
|
||||
Integer limit,
|
||||
Collection collection) throws SQLException {
|
||||
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
|
||||
CriteriaQuery criteriaQuery = getCriteriaQuery(criteriaBuilder, WorkflowItem.class);
|
||||
Root<WorkflowItem> workflowItemRoot = criteriaQuery.from(WorkflowItem.class);
|
||||
criteriaQuery.select(workflowItemRoot);
|
||||
if (collection != null) {
|
||||
criteriaQuery.where(criteriaBuilder.equal(workflowItemRoot.get(WorkflowItem_.collection),
|
||||
collection));
|
||||
}
|
||||
if (offset == null) {
|
||||
offset = -1;
|
||||
}
|
||||
if (limit == null) {
|
||||
limit = -1;
|
||||
}
|
||||
criteriaQuery.orderBy(criteriaBuilder.asc(workflowItemRoot.get(WorkflowItem_.id)));
|
||||
return list(context, criteriaQuery, false, WorkflowItem.class, limit, offset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int countAll(Context context) throws SQLException {
|
||||
return countAllInCollection(context, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int countAllInCollection(Context context, Collection collection) throws SQLException {
|
||||
|
||||
|
||||
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
|
||||
CriteriaQuery<Long> criteriaQuery = criteriaBuilder.createQuery(Long.class);
|
||||
|
||||
Root<WorkflowItem> workflowItemRoot = criteriaQuery.from(WorkflowItem.class);
|
||||
if (collection != null) {
|
||||
criteriaQuery.where(criteriaBuilder.equal(workflowItemRoot.get(WorkflowItem_.collection),
|
||||
collection));
|
||||
}
|
||||
return count(context, criteriaQuery, criteriaBuilder, workflowItemRoot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WorkflowItem> findBySubmitter(Context context, EPerson ep) throws SQLException {
|
||||
return findBySubmitter(context, ep, null, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WorkflowItem> findBySubmitter(Context context, EPerson ep, Integer offset, Integer limit)
|
||||
throws SQLException {
|
||||
if (offset == null) {
|
||||
offset = -1;
|
||||
}
|
||||
if (limit == null) {
|
||||
limit = -1;
|
||||
}
|
||||
|
||||
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
|
||||
CriteriaQuery criteriaQuery = getCriteriaQuery(criteriaBuilder, WorkflowItem.class);
|
||||
Root<WorkflowItem> workflowItemRoot = criteriaQuery.from(WorkflowItem.class);
|
||||
Join<WorkflowItem, Item> join = workflowItemRoot.join("item");
|
||||
criteriaQuery.select(workflowItemRoot);
|
||||
criteriaQuery.where(criteriaBuilder.equal(join.get(Item_.submitter), ep));
|
||||
criteriaQuery.orderBy(criteriaBuilder.asc(workflowItemRoot.get(WorkflowItem_.id)));
|
||||
return list(context, criteriaQuery, false, WorkflowItem.class, limit, offset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int countBySubmitter(Context context, EPerson ep) throws SQLException {
|
||||
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
|
||||
CriteriaQuery<Long> criteriaQuery = criteriaBuilder.createQuery(Long.class);
|
||||
Root<WorkflowItem> workflowItemRoot = criteriaQuery.from(WorkflowItem.class);
|
||||
Join<WorkflowItem, Item> join = workflowItemRoot.join("item");
|
||||
criteriaQuery.where(criteriaBuilder.equal(join.get(Item_.submitter), ep));
|
||||
return count(context, criteriaQuery, criteriaBuilder, workflowItemRoot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WorkflowItem> findByCollection(Context context, Collection collection) throws SQLException {
|
||||
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
|
||||
CriteriaQuery criteriaQuery = getCriteriaQuery(criteriaBuilder, WorkflowItem.class);
|
||||
Root<WorkflowItem> workflowItemRoot = criteriaQuery.from(WorkflowItem.class);
|
||||
criteriaQuery.select(workflowItemRoot);
|
||||
criteriaQuery.where(criteriaBuilder.equal(workflowItemRoot.get(WorkflowItem_.collection), collection));
|
||||
criteriaQuery.orderBy(criteriaBuilder.asc(workflowItemRoot.get(WorkflowItem_.id)));
|
||||
return list(context, criteriaQuery, false, WorkflowItem.class, -1, -1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WorkflowItem findByItem(Context context, Item item) throws SQLException {
|
||||
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
|
||||
CriteriaQuery criteriaQuery = getCriteriaQuery(criteriaBuilder, WorkflowItem.class);
|
||||
Root<WorkflowItem> workflowItemRoot = criteriaQuery.from(WorkflowItem.class);
|
||||
criteriaQuery.select(workflowItemRoot);
|
||||
criteriaQuery.where(criteriaBuilder.equal(workflowItemRoot.get(WorkflowItem_.item), item));
|
||||
return uniqueResult(context, criteriaQuery, false, WorkflowItem.class, -1, -1);
|
||||
}
|
||||
}
|
@@ -16,9 +16,9 @@ import javax.persistence.criteria.Root;
|
||||
import org.dspace.core.AbstractHibernateDAO;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
import org.dspace.xmlworkflow.storedcomponents.WorkflowItemRole;
|
||||
import org.dspace.xmlworkflow.storedcomponents.WorkflowItemRole_;
|
||||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
import org.dspace.xmlworkflow.storedcomponents.dao.WorkflowItemRoleDAO;
|
||||
|
||||
/**
|
||||
@@ -36,7 +36,7 @@ public class WorkflowItemRoleDAOImpl extends AbstractHibernateDAO<WorkflowItemRo
|
||||
|
||||
@Override
|
||||
public List<WorkflowItemRole> findByWorkflowItemAndRole(Context context,
|
||||
XmlWorkflowItem workflowItem,
|
||||
WorkflowItem workflowItem,
|
||||
String role) throws SQLException {
|
||||
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
|
||||
CriteriaQuery criteriaQuery = getCriteriaQuery(criteriaBuilder, WorkflowItemRole.class);
|
||||
@@ -55,7 +55,7 @@ public class WorkflowItemRoleDAOImpl extends AbstractHibernateDAO<WorkflowItemRo
|
||||
|
||||
@Override
|
||||
public List<WorkflowItemRole> findByWorkflowItem(Context context,
|
||||
XmlWorkflowItem workflowItem) throws SQLException {
|
||||
WorkflowItem workflowItem) throws SQLException {
|
||||
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
|
||||
CriteriaQuery criteriaQuery = getCriteriaQuery(criteriaBuilder, WorkflowItemRole.class);
|
||||
Root<WorkflowItemRole> workflowItemRoleRoot = criteriaQuery.from(WorkflowItemRole.class);
|
||||
|
@@ -1,137 +0,0 @@
|
||||
/**
|
||||
* The contents of this file are subject to the license and copyright
|
||||
* detailed in the LICENSE and NOTICE files at the root of the source
|
||||
* tree and available online at
|
||||
*
|
||||
* http://www.dspace.org/license/
|
||||
*/
|
||||
package org.dspace.xmlworkflow.storedcomponents.dao.impl;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import javax.persistence.criteria.CriteriaBuilder;
|
||||
import javax.persistence.criteria.CriteriaQuery;
|
||||
import javax.persistence.criteria.Join;
|
||||
import javax.persistence.criteria.Root;
|
||||
|
||||
import org.dspace.content.Collection;
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.content.Item_;
|
||||
import org.dspace.core.AbstractHibernateDAO;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem_;
|
||||
import org.dspace.xmlworkflow.storedcomponents.dao.XmlWorkflowItemDAO;
|
||||
|
||||
/**
|
||||
* Hibernate implementation of the Database Access Object interface class for the XmlWorkflowItem object.
|
||||
* This class is responsible for all database calls for the XmlWorkflowItem object and is autowired by spring
|
||||
* This class should never be accessed directly.
|
||||
*
|
||||
* @author kevinvandevelde at atmire.com
|
||||
*/
|
||||
public class XmlWorkflowItemDAOImpl extends AbstractHibernateDAO<XmlWorkflowItem> implements XmlWorkflowItemDAO {
|
||||
|
||||
protected XmlWorkflowItemDAOImpl() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<XmlWorkflowItem> findAllInCollection(Context context, Integer offset,
|
||||
Integer limit,
|
||||
Collection collection) throws SQLException {
|
||||
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
|
||||
CriteriaQuery criteriaQuery = getCriteriaQuery(criteriaBuilder, XmlWorkflowItem.class);
|
||||
Root<XmlWorkflowItem> xmlWorkflowItemRoot = criteriaQuery.from(XmlWorkflowItem.class);
|
||||
criteriaQuery.select(xmlWorkflowItemRoot);
|
||||
if (collection != null) {
|
||||
criteriaQuery.where(criteriaBuilder.equal(xmlWorkflowItemRoot.get(XmlWorkflowItem_.collection),
|
||||
collection));
|
||||
}
|
||||
if (offset == null) {
|
||||
offset = -1;
|
||||
}
|
||||
if (limit == null) {
|
||||
limit = -1;
|
||||
}
|
||||
criteriaQuery.orderBy(criteriaBuilder.asc(xmlWorkflowItemRoot.get(XmlWorkflowItem_.id)));
|
||||
return list(context, criteriaQuery, false, XmlWorkflowItem.class, limit, offset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int countAll(Context context) throws SQLException {
|
||||
return countAllInCollection(context, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int countAllInCollection(Context context, Collection collection) throws SQLException {
|
||||
|
||||
|
||||
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
|
||||
CriteriaQuery<Long> criteriaQuery = criteriaBuilder.createQuery(Long.class);
|
||||
|
||||
Root<XmlWorkflowItem> xmlWorkflowItemRoot = criteriaQuery.from(XmlWorkflowItem.class);
|
||||
if (collection != null) {
|
||||
criteriaQuery.where(criteriaBuilder.equal(xmlWorkflowItemRoot.get(XmlWorkflowItem_.collection),
|
||||
collection));
|
||||
}
|
||||
return count(context, criteriaQuery, criteriaBuilder, xmlWorkflowItemRoot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<XmlWorkflowItem> findBySubmitter(Context context, EPerson ep) throws SQLException {
|
||||
return findBySubmitter(context, ep, null, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<XmlWorkflowItem> findBySubmitter(Context context, EPerson ep, Integer offset, Integer limit)
|
||||
throws SQLException {
|
||||
if (offset == null) {
|
||||
offset = -1;
|
||||
}
|
||||
if (limit == null) {
|
||||
limit = -1;
|
||||
}
|
||||
|
||||
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
|
||||
CriteriaQuery criteriaQuery = getCriteriaQuery(criteriaBuilder, XmlWorkflowItem.class);
|
||||
Root<XmlWorkflowItem> xmlWorkflowItemRoot = criteriaQuery.from(XmlWorkflowItem.class);
|
||||
Join<XmlWorkflowItem, Item> join = xmlWorkflowItemRoot.join("item");
|
||||
criteriaQuery.select(xmlWorkflowItemRoot);
|
||||
criteriaQuery.where(criteriaBuilder.equal(join.get(Item_.submitter), ep));
|
||||
criteriaQuery.orderBy(criteriaBuilder.asc(xmlWorkflowItemRoot.get(XmlWorkflowItem_.id)));
|
||||
return list(context, criteriaQuery, false, XmlWorkflowItem.class, limit, offset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int countBySubmitter(Context context, EPerson ep) throws SQLException {
|
||||
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
|
||||
CriteriaQuery<Long> criteriaQuery = criteriaBuilder.createQuery(Long.class);
|
||||
Root<XmlWorkflowItem> xmlWorkflowItemRoot = criteriaQuery.from(XmlWorkflowItem.class);
|
||||
Join<XmlWorkflowItem, Item> join = xmlWorkflowItemRoot.join("item");
|
||||
criteriaQuery.where(criteriaBuilder.equal(join.get(Item_.submitter), ep));
|
||||
return count(context, criteriaQuery, criteriaBuilder, xmlWorkflowItemRoot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<XmlWorkflowItem> findByCollection(Context context, Collection collection) throws SQLException {
|
||||
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
|
||||
CriteriaQuery criteriaQuery = getCriteriaQuery(criteriaBuilder, XmlWorkflowItem.class);
|
||||
Root<XmlWorkflowItem> xmlWorkflowItemRoot = criteriaQuery.from(XmlWorkflowItem.class);
|
||||
criteriaQuery.select(xmlWorkflowItemRoot);
|
||||
criteriaQuery.where(criteriaBuilder.equal(xmlWorkflowItemRoot.get(XmlWorkflowItem_.collection), collection));
|
||||
criteriaQuery.orderBy(criteriaBuilder.asc(xmlWorkflowItemRoot.get(XmlWorkflowItem_.id)));
|
||||
return list(context, criteriaQuery, false, XmlWorkflowItem.class, -1, -1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public XmlWorkflowItem findByItem(Context context, Item item) throws SQLException {
|
||||
CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
|
||||
CriteriaQuery criteriaQuery = getCriteriaQuery(criteriaBuilder, XmlWorkflowItem.class);
|
||||
Root<XmlWorkflowItem> xmlWorkflowItemRoot = criteriaQuery.from(XmlWorkflowItem.class);
|
||||
criteriaQuery.select(xmlWorkflowItemRoot);
|
||||
criteriaQuery.where(criteriaBuilder.equal(xmlWorkflowItemRoot.get(XmlWorkflowItem_.item), item));
|
||||
return uniqueResult(context, criteriaQuery, false, XmlWorkflowItem.class, -1, -1);
|
||||
}
|
||||
}
|
@@ -14,8 +14,8 @@ import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.service.DSpaceCRUDService;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
import org.dspace.xmlworkflow.storedcomponents.ClaimedTask;
|
||||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
|
||||
/**
|
||||
* Service interface class for the ClaimedTask object.
|
||||
@@ -26,26 +26,26 @@ import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
*/
|
||||
public interface ClaimedTaskService extends DSpaceCRUDService<ClaimedTask> {
|
||||
|
||||
public List<ClaimedTask> findByWorkflowItem(Context context, XmlWorkflowItem workflowItem) throws SQLException;
|
||||
public List<ClaimedTask> findByWorkflowItem(Context context, WorkflowItem workflowItem) throws SQLException;
|
||||
|
||||
public ClaimedTask findByWorkflowIdAndEPerson(Context context, XmlWorkflowItem workflowItem, EPerson ePerson)
|
||||
public ClaimedTask findByWorkflowIdAndEPerson(Context context, WorkflowItem workflowItem, EPerson ePerson)
|
||||
throws SQLException;
|
||||
|
||||
public List<ClaimedTask> findByEperson(Context context, EPerson ePerson) throws SQLException;
|
||||
|
||||
public List<ClaimedTask> find(Context context, XmlWorkflowItem workflowItem, String stepID) throws SQLException;
|
||||
public List<ClaimedTask> find(Context context, WorkflowItem workflowItem, String stepID) throws SQLException;
|
||||
|
||||
public ClaimedTask find(Context context, EPerson ePerson, XmlWorkflowItem workflowItem, String stepID,
|
||||
public ClaimedTask find(Context context, EPerson ePerson, WorkflowItem workflowItem, String stepID,
|
||||
String actionID) throws SQLException;
|
||||
|
||||
public List<ClaimedTask> find(Context context, XmlWorkflowItem workflowItem, String stepID, String actionID)
|
||||
public List<ClaimedTask> find(Context context, WorkflowItem workflowItem, String stepID, String actionID)
|
||||
throws SQLException;
|
||||
|
||||
public List<ClaimedTask> find(Context context, XmlWorkflowItem workflowItem) throws SQLException;
|
||||
public List<ClaimedTask> find(Context context, WorkflowItem workflowItem) throws SQLException;
|
||||
|
||||
public List<ClaimedTask> findAllInStep(Context context, String stepID) throws SQLException;
|
||||
|
||||
public void deleteByWorkflowItem(Context context, XmlWorkflowItem workflowItem)
|
||||
public void deleteByWorkflowItem(Context context, WorkflowItem workflowItem)
|
||||
throws SQLException, AuthorizeException;
|
||||
|
||||
List<ClaimedTask> findAll(Context context) throws SQLException;
|
||||
|
@@ -13,8 +13,8 @@ import java.util.List;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.service.DSpaceCRUDService;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
import org.dspace.xmlworkflow.storedcomponents.InProgressUser;
|
||||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
|
||||
/**
|
||||
* Service interface class for the InProgressUser object.
|
||||
@@ -24,14 +24,14 @@ import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
* @author kevinvandevelde at atmire.com
|
||||
*/
|
||||
public interface InProgressUserService extends DSpaceCRUDService<InProgressUser> {
|
||||
public InProgressUser findByWorkflowItemAndEPerson(Context context, XmlWorkflowItem workflowItem, EPerson ePerson)
|
||||
public InProgressUser findByWorkflowItemAndEPerson(Context context, WorkflowItem workflowItem, EPerson ePerson)
|
||||
throws SQLException;
|
||||
|
||||
public List<InProgressUser> findByEperson(Context context, EPerson ePerson) throws SQLException;
|
||||
|
||||
public List<InProgressUser> findByWorkflowItem(Context context, XmlWorkflowItem workflowItem) throws SQLException;
|
||||
public List<InProgressUser> findByWorkflowItem(Context context, WorkflowItem workflowItem) throws SQLException;
|
||||
|
||||
public int getNumberOfInProgressUsers(Context context, XmlWorkflowItem workflowItem) throws SQLException;
|
||||
public int getNumberOfInProgressUsers(Context context, WorkflowItem workflowItem) throws SQLException;
|
||||
|
||||
public int getNumberOfFinishedUsers(Context context, XmlWorkflowItem workflowItem) throws SQLException;
|
||||
public int getNumberOfFinishedUsers(Context context, WorkflowItem workflowItem) throws SQLException;
|
||||
}
|
||||
|
@@ -16,8 +16,8 @@ import org.dspace.core.Context;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.eperson.Group;
|
||||
import org.dspace.service.DSpaceCRUDService;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
import org.dspace.xmlworkflow.storedcomponents.PoolTask;
|
||||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
|
||||
/**
|
||||
* Service interface class for the PoolTask object.
|
||||
@@ -33,12 +33,12 @@ public interface PoolTaskService extends DSpaceCRUDService<PoolTask> {
|
||||
public List<PoolTask> findByEperson(Context context, EPerson ePerson)
|
||||
throws SQLException, AuthorizeException, IOException;
|
||||
|
||||
public List<PoolTask> find(Context context, XmlWorkflowItem workflowItem) throws SQLException;
|
||||
public List<PoolTask> find(Context context, WorkflowItem workflowItem) throws SQLException;
|
||||
|
||||
public PoolTask findByWorkflowIdAndEPerson(Context context, XmlWorkflowItem workflowItem, EPerson ePerson)
|
||||
public PoolTask findByWorkflowIdAndEPerson(Context context, WorkflowItem workflowItem, EPerson ePerson)
|
||||
throws SQLException, AuthorizeException, IOException;
|
||||
|
||||
public void deleteByWorkflowItem(Context context, XmlWorkflowItem xmlWorkflowItem)
|
||||
public void deleteByWorkflowItem(Context context, WorkflowItem workflowItem)
|
||||
throws SQLException, AuthorizeException;
|
||||
|
||||
public void deleteByEperson(Context context, EPerson ePerson) throws SQLException, AuthorizeException, IOException;
|
||||
|
@@ -14,8 +14,8 @@ import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.service.DSpaceCRUDService;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
import org.dspace.xmlworkflow.storedcomponents.WorkflowItemRole;
|
||||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
|
||||
/**
|
||||
* Service interface class for the WorkflowItemRole object.
|
||||
@@ -26,12 +26,12 @@ import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
*/
|
||||
public interface WorkflowItemRoleService extends DSpaceCRUDService<WorkflowItemRole> {
|
||||
|
||||
public List<WorkflowItemRole> find(Context context, XmlWorkflowItem workflowItem, String role) throws SQLException;
|
||||
public List<WorkflowItemRole> find(Context context, WorkflowItem workflowItem, String role) throws SQLException;
|
||||
|
||||
public List<WorkflowItemRole> findByWorkflowItem(Context context, XmlWorkflowItem xmlWorkflowItem)
|
||||
public List<WorkflowItemRole> findByWorkflowItem(Context context, WorkflowItem workflowItem)
|
||||
throws SQLException;
|
||||
|
||||
public void deleteForWorkflowItem(Context context, XmlWorkflowItem wfi) throws SQLException, AuthorizeException;
|
||||
public void deleteForWorkflowItem(Context context, WorkflowItem wfi) throws SQLException, AuthorizeException;
|
||||
|
||||
public void deleteByEPerson(Context context, EPerson ePerson) throws SQLException, AuthorizeException;
|
||||
|
||||
|
@@ -1,100 +0,0 @@
|
||||
/**
|
||||
* The contents of this file are subject to the license and copyright
|
||||
* detailed in the LICENSE and NOTICE files at the root of the source
|
||||
* tree and available online at
|
||||
*
|
||||
* http://www.dspace.org/license/
|
||||
*/
|
||||
package org.dspace.xmlworkflow.storedcomponents.service;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
import org.dspace.content.Collection;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.workflow.WorkflowItemService;
|
||||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
|
||||
/**
|
||||
* Service interface class for the XmlWorkflowItem object.
|
||||
* The implementation of this class is responsible for all business logic calls for the XmlWorkflowItem object and is
|
||||
* autowired by spring
|
||||
*
|
||||
* @author kevinvandevelde at atmire.com
|
||||
*/
|
||||
public interface XmlWorkflowItemService extends WorkflowItemService<XmlWorkflowItem> {
|
||||
|
||||
/**
|
||||
* return all workflowitems for a certain page
|
||||
*
|
||||
* @param context The relevant DSpace Context.
|
||||
* @param page paging: page number
|
||||
* @param pagesize paging: items per page
|
||||
* @return WorkflowItem list of all the workflow items in system
|
||||
* @throws SQLException An exception that provides information on a database access error or other errors.
|
||||
*/
|
||||
public List<XmlWorkflowItem> findAll(Context context, Integer page, Integer pagesize) throws SQLException;
|
||||
|
||||
/**
|
||||
* return all workflowitems for a certain page with a certain collection
|
||||
*
|
||||
* @param context The relevant DSpace Context.
|
||||
* @param page paging: page number
|
||||
* @param pagesize paging: items per page
|
||||
* @param collection restrict to this collection
|
||||
* @return WorkflowItem list of all the workflow items in system
|
||||
* @throws SQLException An exception that provides information on a database access error or other errors.
|
||||
*/
|
||||
public List<XmlWorkflowItem> findAllInCollection(Context context, Integer page, Integer pagesize,
|
||||
Collection collection) throws SQLException;
|
||||
|
||||
/**
|
||||
* return how many workflow items appear in the database
|
||||
*
|
||||
* @param context The relevant DSpace Context.
|
||||
* @return the number of workflow items
|
||||
* @throws SQLException An exception that provides information on a database access error or other errors.
|
||||
*/
|
||||
public int countAll(Context context) throws SQLException;
|
||||
|
||||
/**
|
||||
* return how many workflow items that appear in the collection
|
||||
*
|
||||
* @param context The relevant DSpace Context.
|
||||
* @param collection restrict to this collection
|
||||
* @return the number of workflow items
|
||||
* @throws SQLException An exception that provides information on a database access error or other errors.
|
||||
*/
|
||||
public int countAllInCollection(Context context, Collection collection) throws SQLException;
|
||||
|
||||
/**
|
||||
* Return all the workflow items from a specific submitter respecting the pagination parameters
|
||||
*
|
||||
* @param context
|
||||
* The relevant DSpace Context.
|
||||
* @param ep
|
||||
* the eperson that has submitted the item
|
||||
* @param pageNumber
|
||||
* paging: page number
|
||||
* @param pageSize
|
||||
* paging: items per page
|
||||
* @return
|
||||
* @throws SQLException
|
||||
*/
|
||||
public List<XmlWorkflowItem> findBySubmitter(Context context, EPerson ep, Integer pageNumber, Integer pageSize)
|
||||
throws SQLException;
|
||||
|
||||
/**
|
||||
* Count the number of workflow items from a specific submitter
|
||||
*
|
||||
* @param context
|
||||
* The relevant DSpace Context.
|
||||
* @param ep
|
||||
* the eperson that has submitted the item
|
||||
* @return
|
||||
* @throws SQLException
|
||||
*/
|
||||
public int countBySubmitter(Context context, EPerson ep) throws SQLException;
|
||||
|
||||
}
|
@@ -0,0 +1,17 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
-----------------------------------------------------------------------------------
|
||||
-- Drop the 'workflowitem' and 'tasklistitem' tables
|
||||
-----------------------------------------------------------------------------------
|
||||
|
||||
DROP TABLE workflowitem CASCADE CONSTRAINTS;
|
||||
DROP TABLE tasklistitem CASCADE CONSTRAINTS;
|
||||
|
||||
DROP SEQUENCE workflowitem_seq;
|
||||
DROP SEQUENCE tasklistitem_seq;
|
@@ -0,0 +1,17 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
-----------------------------------------------------------------------------------
|
||||
-- Drop the 'workflowitem' and 'tasklistitem' tables
|
||||
-----------------------------------------------------------------------------------
|
||||
|
||||
DROP TABLE workflowitem CASCADE CONSTRAINTS;
|
||||
DROP TABLE tasklistitem CASCADE CONSTRAINTS;
|
||||
|
||||
DROP SEQUENCE workflowitem_seq;
|
||||
DROP SEQUENCE tasklistitem_seq;
|
@@ -0,0 +1,17 @@
|
||||
--
|
||||
-- The contents of this file are subject to the license and copyright
|
||||
-- detailed in the LICENSE and NOTICE files at the root of the source
|
||||
-- tree and available online at
|
||||
--
|
||||
-- http://www.dspace.org/license/
|
||||
--
|
||||
|
||||
-----------------------------------------------------------------------------------
|
||||
-- Drop the 'workflowitem' and 'tasklistitem' tables
|
||||
-----------------------------------------------------------------------------------
|
||||
|
||||
DROP TABLE workflowitem CASCADE;
|
||||
DROP TABLE tasklistitem CASCADE;
|
||||
|
||||
DROP SEQUENCE workflowitem_seq;
|
||||
DROP SEQUENCE tasklistitem_seq;
|
@@ -44,13 +44,13 @@ import org.dspace.scripts.service.ProcessService;
|
||||
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||
import org.dspace.versioning.factory.VersionServiceFactory;
|
||||
import org.dspace.versioning.service.VersionHistoryService;
|
||||
import org.dspace.xmlworkflow.factory.XmlWorkflowServiceFactory;
|
||||
import org.dspace.xmlworkflow.service.XmlWorkflowService;
|
||||
import org.dspace.workflow.WorkflowItemService;
|
||||
import org.dspace.workflow.WorkflowService;
|
||||
import org.dspace.workflow.factory.WorkflowServiceFactory;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.ClaimedTaskService;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.InProgressUserService;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.PoolTaskService;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.WorkflowItemRoleService;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.XmlWorkflowItemService;
|
||||
|
||||
/**
|
||||
* Abstract builder class that holds references to all available services
|
||||
@@ -66,8 +66,8 @@ public abstract class AbstractBuilder<T, S> {
|
||||
static ItemService itemService;
|
||||
static InstallItemService installItemService;
|
||||
static WorkspaceItemService workspaceItemService;
|
||||
static XmlWorkflowItemService workflowItemService;
|
||||
static XmlWorkflowService workflowService;
|
||||
static WorkflowItemService workflowItemService;
|
||||
static WorkflowService workflowService;
|
||||
static EPersonService ePersonService;
|
||||
static GroupService groupService;
|
||||
static BundleService bundleService;
|
||||
@@ -115,8 +115,8 @@ public abstract class AbstractBuilder<T, S> {
|
||||
itemService = ContentServiceFactory.getInstance().getItemService();
|
||||
installItemService = ContentServiceFactory.getInstance().getInstallItemService();
|
||||
workspaceItemService = ContentServiceFactory.getInstance().getWorkspaceItemService();
|
||||
workflowItemService = XmlWorkflowServiceFactory.getInstance().getXmlWorkflowItemService();
|
||||
workflowService = XmlWorkflowServiceFactory.getInstance().getXmlWorkflowService();
|
||||
workflowItemService = WorkflowServiceFactory.getInstance().getWorkflowItemService();
|
||||
workflowService = WorkflowServiceFactory.getInstance().getWorkflowService();
|
||||
ePersonService = EPersonServiceFactory.getInstance().getEPersonService();
|
||||
groupService = EPersonServiceFactory.getInstance().getGroupService();
|
||||
bundleService = ContentServiceFactory.getInstance().getBundleService();
|
||||
@@ -138,10 +138,10 @@ public abstract class AbstractBuilder<T, S> {
|
||||
processService = ScriptServiceFactory.getInstance().getProcessService();
|
||||
|
||||
// Temporarily disabled
|
||||
claimedTaskService = XmlWorkflowServiceFactory.getInstance().getClaimedTaskService();
|
||||
inProgressUserService = XmlWorkflowServiceFactory.getInstance().getInProgressUserService();
|
||||
poolTaskService = XmlWorkflowServiceFactory.getInstance().getPoolTaskService();
|
||||
workflowItemRoleService = XmlWorkflowServiceFactory.getInstance().getWorkflowItemRoleService();
|
||||
claimedTaskService = WorkflowServiceFactory.getInstance().getClaimedTaskService();
|
||||
inProgressUserService = WorkflowServiceFactory.getInstance().getInProgressUserService();
|
||||
poolTaskService = WorkflowServiceFactory.getInstance().getPoolTaskService();
|
||||
workflowItemRoleService = WorkflowServiceFactory.getInstance().getWorkflowItemRoleService();
|
||||
}
|
||||
|
||||
|
||||
|
@@ -20,13 +20,13 @@ import org.dspace.core.Constants;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.event.Event;
|
||||
import org.dspace.xmlworkflow.factory.XmlWorkflowServiceFactory;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
import org.dspace.workflow.factory.WorkflowServiceFactory;
|
||||
import org.dspace.xmlworkflow.state.Step;
|
||||
import org.dspace.xmlworkflow.state.Workflow;
|
||||
import org.dspace.xmlworkflow.state.actions.WorkflowActionConfig;
|
||||
import org.dspace.xmlworkflow.storedcomponents.ClaimedTask;
|
||||
import org.dspace.xmlworkflow.storedcomponents.PoolTask;
|
||||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.ClaimedTaskService;
|
||||
|
||||
/**
|
||||
@@ -37,7 +37,7 @@ public class ClaimedTaskBuilder extends AbstractBuilder<ClaimedTask, ClaimedTask
|
||||
|
||||
private WorkspaceItem workspaceItem;
|
||||
|
||||
private XmlWorkflowItem workflowItem;
|
||||
private WorkflowItem workflowItem;
|
||||
|
||||
private ClaimedTask claimedTask;
|
||||
|
||||
@@ -88,7 +88,7 @@ public class ClaimedTaskBuilder extends AbstractBuilder<ClaimedTask, ClaimedTask
|
||||
// temporary switch to the wf user
|
||||
EPerson submitter = context.getCurrentUser();
|
||||
context.setCurrentUser(user);
|
||||
XmlWorkflowServiceFactory factory = (XmlWorkflowServiceFactory) XmlWorkflowServiceFactory.getInstance();
|
||||
WorkflowServiceFactory factory = WorkflowServiceFactory.getInstance();
|
||||
Workflow workflow = factory.getWorkflowFactory().getWorkflow(task.getWorkflowItem().getCollection());
|
||||
Step step = workflow.getStep(task.getStepID());
|
||||
WorkflowActionConfig currentActionConfig = step.getActionConfig(task.getActionID());
|
||||
|
@@ -18,8 +18,8 @@ import org.dspace.content.MetadataSchemaEnum;
|
||||
import org.dspace.content.WorkspaceItem;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
import org.dspace.xmlworkflow.storedcomponents.PoolTask;
|
||||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.PoolTaskService;
|
||||
|
||||
/**
|
||||
@@ -30,7 +30,7 @@ public class PoolTaskBuilder extends AbstractBuilder<PoolTask, PoolTaskService>
|
||||
|
||||
private WorkspaceItem workspaceItem;
|
||||
|
||||
private XmlWorkflowItem workflowItem;
|
||||
private WorkflowItem workflowItem;
|
||||
|
||||
private PoolTask poolTask;
|
||||
|
||||
|
@@ -22,21 +22,21 @@ import org.dspace.content.WorkspaceItem;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.discovery.SearchServiceException;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.XmlWorkflowItemService;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
import org.dspace.workflow.WorkflowItemService;
|
||||
|
||||
/**
|
||||
* Builder to construct WorkflowItem objects
|
||||
*
|
||||
**/
|
||||
public class WorkflowItemBuilder extends AbstractBuilder<XmlWorkflowItem, XmlWorkflowItemService> {
|
||||
public class WorkflowItemBuilder extends AbstractBuilder<WorkflowItem, WorkflowItemService> {
|
||||
|
||||
/** Keep a reference to the underlying Item for cleanup **/
|
||||
private Item item;
|
||||
|
||||
private WorkspaceItem workspaceItem;
|
||||
|
||||
private XmlWorkflowItem workflowItem;
|
||||
private WorkflowItem workflowItem;
|
||||
|
||||
protected WorkflowItemBuilder(Context context) {
|
||||
super(context);
|
||||
@@ -72,7 +72,7 @@ public class WorkflowItemBuilder extends AbstractBuilder<XmlWorkflowItem, XmlWor
|
||||
}
|
||||
|
||||
@Override
|
||||
public XmlWorkflowItem build() {
|
||||
public WorkflowItem build() {
|
||||
try {
|
||||
workflowItem = workflowService.start(context, workspaceItem);
|
||||
workspaceItem = null;
|
||||
@@ -86,7 +86,7 @@ public class WorkflowItemBuilder extends AbstractBuilder<XmlWorkflowItem, XmlWor
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(Context c, XmlWorkflowItem dso) throws Exception {
|
||||
public void delete(Context c, WorkflowItem dso) throws Exception {
|
||||
if (dso != null) {
|
||||
getService().delete(c, dso);
|
||||
item = null;
|
||||
@@ -136,7 +136,7 @@ public class WorkflowItemBuilder extends AbstractBuilder<XmlWorkflowItem, XmlWor
|
||||
}
|
||||
|
||||
@Override
|
||||
protected XmlWorkflowItemService getService() {
|
||||
protected WorkflowItemService getService() {
|
||||
return workflowItemService;
|
||||
}
|
||||
|
||||
@@ -223,7 +223,7 @@ public class WorkflowItemBuilder extends AbstractBuilder<XmlWorkflowItem, XmlWor
|
||||
throws SQLException, IOException, SearchServiceException {
|
||||
try (Context c = new Context()) {
|
||||
c.turnOffAuthorisationSystem();
|
||||
XmlWorkflowItem wi = workflowItemService.find(c, id);
|
||||
WorkflowItem wi = workflowItemService.find(c, id);
|
||||
if (wi != null) {
|
||||
try {
|
||||
workflowItemService.delete(c, wi);
|
||||
|
@@ -36,13 +36,11 @@ import org.dspace.content.service.WorkspaceItemService;
|
||||
import org.dspace.eperson.factory.EPersonServiceFactory;
|
||||
import org.dspace.eperson.service.EPersonService;
|
||||
import org.dspace.eperson.service.GroupService;
|
||||
import org.dspace.workflow.WorkflowItem;
|
||||
import org.dspace.workflow.WorkflowService;
|
||||
import org.dspace.workflow.factory.WorkflowServiceFactory;
|
||||
import org.dspace.xmlworkflow.factory.XmlWorkflowServiceFactory;
|
||||
import org.dspace.xmlworkflow.service.XmlWorkflowService;
|
||||
import org.dspace.xmlworkflow.state.Workflow;
|
||||
import org.dspace.xmlworkflow.storedcomponents.CollectionRole;
|
||||
import org.dspace.xmlworkflow.storedcomponents.XmlWorkflowItem;
|
||||
import org.dspace.xmlworkflow.storedcomponents.service.CollectionRoleService;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
@@ -69,11 +67,10 @@ public class EPersonInWorkflowIT extends AbstractIntegrationTestWithDatabase {
|
||||
protected CollectionService collectionService = ContentServiceFactory.getInstance().getCollectionService();
|
||||
protected ItemService itemService = ContentServiceFactory.getInstance().getItemService();
|
||||
protected InstallItemService installItemService = ContentServiceFactory.getInstance().getInstallItemService();
|
||||
protected WorkflowService workflowService = WorkflowServiceFactory.getInstance().getWorkflowService();
|
||||
protected WorkspaceItemService workspaceItemService = ContentServiceFactory.getInstance()
|
||||
.getWorkspaceItemService();
|
||||
protected XmlWorkflowService xmlWorkflowService = XmlWorkflowServiceFactory.getInstance().getXmlWorkflowService();
|
||||
protected CollectionRoleService collectionRoleService = XmlWorkflowServiceFactory.getInstance()
|
||||
protected WorkflowService workflowService = WorkflowServiceFactory.getInstance().getWorkflowService();
|
||||
protected CollectionRoleService collectionRoleService = WorkflowServiceFactory.getInstance()
|
||||
.getCollectionRoleService();
|
||||
|
||||
|
||||
@@ -155,9 +152,9 @@ public class EPersonInWorkflowIT extends AbstractIntegrationTestWithDatabase {
|
||||
.withSubject("ExtraEntry")
|
||||
.build();
|
||||
|
||||
Workflow workflow = XmlWorkflowServiceFactory.getInstance().getWorkflowFactory().getWorkflow(collection);
|
||||
Workflow workflow = WorkflowServiceFactory.getInstance().getWorkflowFactory().getWorkflow(collection);
|
||||
|
||||
XmlWorkflowItem workflowItem = xmlWorkflowService.startWithoutNotify(context, wsi);
|
||||
WorkflowItem workflowItem = workflowService.startWithoutNotify(context, wsi);
|
||||
MockHttpServletRequest httpServletRequest = new MockHttpServletRequest();
|
||||
httpServletRequest.setParameter("submit_approve", "submit_approve");
|
||||
|
||||
@@ -228,9 +225,9 @@ public class EPersonInWorkflowIT extends AbstractIntegrationTestWithDatabase {
|
||||
.withSubject("ExtraEntry")
|
||||
.build();
|
||||
|
||||
Workflow workflow = XmlWorkflowServiceFactory.getInstance().getWorkflowFactory().getWorkflow(collection);
|
||||
Workflow workflow = WorkflowServiceFactory.getInstance().getWorkflowFactory().getWorkflow(collection);
|
||||
|
||||
XmlWorkflowItem workflowItem = xmlWorkflowService.startWithoutNotify(context, wsi);
|
||||
WorkflowItem workflowItem = workflowService.startWithoutNotify(context, wsi);
|
||||
MockHttpServletRequest httpServletRequest = new MockHttpServletRequest();
|
||||
httpServletRequest.setParameter("submit_approve", "submit_approve");
|
||||
|
||||
@@ -297,9 +294,9 @@ public class EPersonInWorkflowIT extends AbstractIntegrationTestWithDatabase {
|
||||
.withSubject("ExtraEntry")
|
||||
.build();
|
||||
|
||||
Workflow workflow = XmlWorkflowServiceFactory.getInstance().getWorkflowFactory().getWorkflow(collection);
|
||||
Workflow workflow = WorkflowServiceFactory.getInstance().getWorkflowFactory().getWorkflow(collection);
|
||||
|
||||
XmlWorkflowItem workflowItem = xmlWorkflowService.startWithoutNotify(context, wsi);
|
||||
WorkflowItem workflowItem = workflowService.startWithoutNotify(context, wsi);
|
||||
MockHttpServletRequest httpServletRequest = new MockHttpServletRequest();
|
||||
httpServletRequest.setParameter("submit_approve", "submit_approve");
|
||||
|
||||
@@ -369,9 +366,9 @@ public class EPersonInWorkflowIT extends AbstractIntegrationTestWithDatabase {
|
||||
.withSubject("ExtraEntry")
|
||||
.build();
|
||||
|
||||
Workflow workflow = XmlWorkflowServiceFactory.getInstance().getWorkflowFactory().getWorkflow(collection);
|
||||
Workflow workflow = WorkflowServiceFactory.getInstance().getWorkflowFactory().getWorkflow(collection);
|
||||
|
||||
XmlWorkflowItem workflowItem = xmlWorkflowService.startWithoutNotify(context, wsi);
|
||||
WorkflowItem workflowItem = workflowService.startWithoutNotify(context, wsi);
|
||||
MockHttpServletRequest httpServletRequest = new MockHttpServletRequest();
|
||||
httpServletRequest.setParameter("submit_approve", "submit_approve");
|
||||
|
||||
@@ -379,7 +376,8 @@ public class EPersonInWorkflowIT extends AbstractIntegrationTestWithDatabase {
|
||||
executeWorkflowAction(httpServletRequest, workflowUserB, workflow, workflowItem, REVIEW_STEP, REVIEW_ACTION);
|
||||
executeWorkflowAction(httpServletRequest, workflowUserC, workflow, workflowItem, EDIT_STEP, CLAIM_ACTION);
|
||||
executeWorkflowAction(httpServletRequest, workflowUserC, workflow, workflowItem, EDIT_STEP, EDIT_ACTION);
|
||||
executeWorkflowAction(httpServletRequest, workflowUserB, workflow, workflowItem, FINAL_EDIT_STEP, CLAIM_ACTION);
|
||||
executeWorkflowAction(httpServletRequest, workflowUserB, workflow, workflowItem, FINAL_EDIT_STEP,
|
||||
CLAIM_ACTION);
|
||||
|
||||
assertDeletionOfEperson(workflowUserB, false);
|
||||
assertRemovalOfEpersonFromWorkflowGroup(workflowUserB, collection, REVIEW_ROLE, true);
|
||||
@@ -452,9 +450,9 @@ public class EPersonInWorkflowIT extends AbstractIntegrationTestWithDatabase {
|
||||
.withSubject("ExtraEntry")
|
||||
.build();
|
||||
|
||||
Workflow workflow = XmlWorkflowServiceFactory.getInstance().getWorkflowFactory().getWorkflow(collectionA);
|
||||
Workflow workflow = WorkflowServiceFactory.getInstance().getWorkflowFactory().getWorkflow(collectionA);
|
||||
|
||||
XmlWorkflowItem workflowItem = xmlWorkflowService.startWithoutNotify(context, wsi);
|
||||
WorkflowItem workflowItem = workflowService.startWithoutNotify(context, wsi);
|
||||
MockHttpServletRequest httpServletRequest = new MockHttpServletRequest();
|
||||
httpServletRequest.setParameter("submit_approve", "submit_approve");
|
||||
|
||||
@@ -518,9 +516,9 @@ public class EPersonInWorkflowIT extends AbstractIntegrationTestWithDatabase {
|
||||
.withSubject("ExtraEntry")
|
||||
.build();
|
||||
|
||||
Workflow workflow = XmlWorkflowServiceFactory.getInstance().getWorkflowFactory().getWorkflow(collection);
|
||||
Workflow workflow = WorkflowServiceFactory.getInstance().getWorkflowFactory().getWorkflow(collection);
|
||||
|
||||
XmlWorkflowItem workflowItem = xmlWorkflowService.startWithoutNotify(context, wsi);
|
||||
WorkflowItem workflowItem = workflowService.startWithoutNotify(context, wsi);
|
||||
MockHttpServletRequest httpServletRequest = new MockHttpServletRequest();
|
||||
httpServletRequest.setParameter("submit_approve", "submit_approve");
|
||||
|
||||
@@ -532,7 +530,8 @@ public class EPersonInWorkflowIT extends AbstractIntegrationTestWithDatabase {
|
||||
executeWorkflowAction(httpServletRequest, workflowUserC, workflow, workflowItem, EDIT_STEP, CLAIM_ACTION);
|
||||
executeWorkflowAction(httpServletRequest, workflowUserC, workflow, workflowItem, EDIT_STEP, EDIT_ACTION);
|
||||
|
||||
executeWorkflowAction(httpServletRequest, workflowUserB, workflow, workflowItem, FINAL_EDIT_STEP, CLAIM_ACTION);
|
||||
executeWorkflowAction(httpServletRequest, workflowUserB, workflow, workflowItem, FINAL_EDIT_STEP,
|
||||
CLAIM_ACTION);
|
||||
executeWorkflowAction(httpServletRequest, workflowUserB, workflow, workflowItem, FINAL_EDIT_STEP,
|
||||
FINAL_EDIT_ACTION);
|
||||
|
||||
@@ -590,9 +589,9 @@ public class EPersonInWorkflowIT extends AbstractIntegrationTestWithDatabase {
|
||||
.withSubject("ExtraEntry")
|
||||
.build();
|
||||
|
||||
Workflow workflow = XmlWorkflowServiceFactory.getInstance().getWorkflowFactory().getWorkflow(collection);
|
||||
Workflow workflow = WorkflowServiceFactory.getInstance().getWorkflowFactory().getWorkflow(collection);
|
||||
|
||||
XmlWorkflowItem workflowItem = xmlWorkflowService.startWithoutNotify(context, wsi);
|
||||
WorkflowItem workflowItem = workflowService.startWithoutNotify(context, wsi);
|
||||
MockHttpServletRequest httpServletRequest = new MockHttpServletRequest();
|
||||
httpServletRequest.setParameter("submit_approve", "submit_approve");
|
||||
|
||||
@@ -662,9 +661,9 @@ public class EPersonInWorkflowIT extends AbstractIntegrationTestWithDatabase {
|
||||
.withSubject("ExtraEntry")
|
||||
.build();
|
||||
|
||||
Workflow workflow = XmlWorkflowServiceFactory.getInstance().getWorkflowFactory().getWorkflow(collection);
|
||||
Workflow workflow = WorkflowServiceFactory.getInstance().getWorkflowFactory().getWorkflow(collection);
|
||||
|
||||
XmlWorkflowItem workflowItem = xmlWorkflowService.startWithoutNotify(context, wsi);
|
||||
WorkflowItem workflowItem = workflowService.startWithoutNotify(context, wsi);
|
||||
MockHttpServletRequest httpServletRequest = new MockHttpServletRequest();
|
||||
httpServletRequest.setParameter("submit_approve", "submit_approve");
|
||||
|
||||
@@ -683,7 +682,8 @@ public class EPersonInWorkflowIT extends AbstractIntegrationTestWithDatabase {
|
||||
|
||||
assertDeletionOfEperson(workflowUserB, true);
|
||||
|
||||
executeWorkflowAction(httpServletRequest, workflowUserD, workflow, workflowItem, FINAL_EDIT_STEP, CLAIM_ACTION);
|
||||
executeWorkflowAction(httpServletRequest, workflowUserD, workflow, workflowItem, FINAL_EDIT_STEP,
|
||||
CLAIM_ACTION);
|
||||
executeWorkflowAction(httpServletRequest, workflowUserD, workflow, workflowItem, FINAL_EDIT_STEP,
|
||||
FINAL_EDIT_ACTION);
|
||||
|
||||
@@ -738,9 +738,9 @@ public class EPersonInWorkflowIT extends AbstractIntegrationTestWithDatabase {
|
||||
.withSubject("ExtraEntry")
|
||||
.build();
|
||||
|
||||
Workflow workflow = XmlWorkflowServiceFactory.getInstance().getWorkflowFactory().getWorkflow(collection);
|
||||
Workflow workflow = WorkflowServiceFactory.getInstance().getWorkflowFactory().getWorkflow(collection);
|
||||
|
||||
XmlWorkflowItem workflowItem = xmlWorkflowService.startWithoutNotify(context, wsi);
|
||||
WorkflowItem workflowItem = workflowService.startWithoutNotify(context, wsi);
|
||||
MockHttpServletRequest httpServletRequest = new MockHttpServletRequest();
|
||||
httpServletRequest.setParameter("submit_approve", "submit_approve");
|
||||
|
||||
@@ -756,7 +756,8 @@ public class EPersonInWorkflowIT extends AbstractIntegrationTestWithDatabase {
|
||||
executeWorkflowAction(httpServletRequest, workflowUserC, workflow, workflowItem, EDIT_STEP, CLAIM_ACTION);
|
||||
executeWorkflowAction(httpServletRequest, workflowUserC, workflow, workflowItem, EDIT_STEP, EDIT_ACTION);
|
||||
|
||||
executeWorkflowAction(httpServletRequest, workflowUserD, workflow, workflowItem, FINAL_EDIT_STEP, CLAIM_ACTION);
|
||||
executeWorkflowAction(httpServletRequest, workflowUserD, workflow, workflowItem, FINAL_EDIT_STEP,
|
||||
CLAIM_ACTION);
|
||||
executeWorkflowAction(httpServletRequest, workflowUserD, workflow, workflowItem, FINAL_EDIT_STEP,
|
||||
FINAL_EDIT_ACTION);
|
||||
|
||||
@@ -811,9 +812,9 @@ public class EPersonInWorkflowIT extends AbstractIntegrationTestWithDatabase {
|
||||
.withSubject("ExtraEntry")
|
||||
.build();
|
||||
|
||||
Workflow workflow = XmlWorkflowServiceFactory.getInstance().getWorkflowFactory().getWorkflow(collection);
|
||||
Workflow workflow = WorkflowServiceFactory.getInstance().getWorkflowFactory().getWorkflow(collection);
|
||||
|
||||
XmlWorkflowItem workflowItem = xmlWorkflowService.startWithoutNotify(context, wsi);
|
||||
WorkflowItem workflowItem = workflowService.startWithoutNotify(context, wsi);
|
||||
MockHttpServletRequest httpServletRequest = new MockHttpServletRequest();
|
||||
httpServletRequest.setParameter("submit_approve", "submit_approve");
|
||||
|
||||
@@ -828,7 +829,8 @@ public class EPersonInWorkflowIT extends AbstractIntegrationTestWithDatabase {
|
||||
executeWorkflowAction(httpServletRequest, workflowUserD, workflow, workflowItem, EDIT_STEP, CLAIM_ACTION);
|
||||
executeWorkflowAction(httpServletRequest, workflowUserD, workflow, workflowItem, EDIT_STEP, EDIT_ACTION);
|
||||
|
||||
executeWorkflowAction(httpServletRequest, workflowUserB, workflow, workflowItem, FINAL_EDIT_STEP, CLAIM_ACTION);
|
||||
executeWorkflowAction(httpServletRequest, workflowUserB, workflow, workflowItem, FINAL_EDIT_STEP,
|
||||
CLAIM_ACTION);
|
||||
executeWorkflowAction(httpServletRequest, workflowUserB, workflow, workflowItem, FINAL_EDIT_STEP,
|
||||
FINAL_EDIT_ACTION);
|
||||
|
||||
@@ -888,9 +890,9 @@ public class EPersonInWorkflowIT extends AbstractIntegrationTestWithDatabase {
|
||||
.withSubject("ExtraEntry")
|
||||
.build();
|
||||
|
||||
Workflow workflow = XmlWorkflowServiceFactory.getInstance().getWorkflowFactory().getWorkflow(collection);
|
||||
Workflow workflow = WorkflowServiceFactory.getInstance().getWorkflowFactory().getWorkflow(collection);
|
||||
|
||||
XmlWorkflowItem workflowItem = xmlWorkflowService.startWithoutNotify(context, wsi);
|
||||
WorkflowItem workflowItem = workflowService.startWithoutNotify(context, wsi);
|
||||
MockHttpServletRequest httpServletRequest = new MockHttpServletRequest();
|
||||
httpServletRequest.setParameter("submit_approve", "submit_approve");
|
||||
|
||||
@@ -908,7 +910,8 @@ public class EPersonInWorkflowIT extends AbstractIntegrationTestWithDatabase {
|
||||
executeWorkflowAction(httpServletRequest, workflowUserC, workflow, workflowItem, EDIT_STEP, CLAIM_ACTION);
|
||||
executeWorkflowAction(httpServletRequest, workflowUserC, workflow, workflowItem, EDIT_STEP, EDIT_ACTION);
|
||||
|
||||
executeWorkflowAction(httpServletRequest, workflowUserD, workflow, workflowItem, FINAL_EDIT_STEP, CLAIM_ACTION);
|
||||
executeWorkflowAction(httpServletRequest, workflowUserD, workflow, workflowItem, FINAL_EDIT_STEP,
|
||||
CLAIM_ACTION);
|
||||
executeWorkflowAction(httpServletRequest, workflowUserD, workflow, workflowItem, FINAL_EDIT_STEP,
|
||||
FINAL_EDIT_ACTION);
|
||||
|
||||
@@ -966,9 +969,9 @@ public class EPersonInWorkflowIT extends AbstractIntegrationTestWithDatabase {
|
||||
.withSubject("ExtraEntry")
|
||||
.build();
|
||||
|
||||
Workflow workflow = XmlWorkflowServiceFactory.getInstance().getWorkflowFactory().getWorkflow(collection);
|
||||
Workflow workflow = WorkflowServiceFactory.getInstance().getWorkflowFactory().getWorkflow(collection);
|
||||
|
||||
XmlWorkflowItem workflowItem = xmlWorkflowService.startWithoutNotify(context, wsi);
|
||||
WorkflowItem workflowItem = workflowService.startWithoutNotify(context, wsi);
|
||||
MockHttpServletRequest httpServletRequest = new MockHttpServletRequest();
|
||||
httpServletRequest.setParameter("submit_approve", "submit_approve");
|
||||
|
||||
@@ -984,7 +987,8 @@ public class EPersonInWorkflowIT extends AbstractIntegrationTestWithDatabase {
|
||||
executeWorkflowAction(httpServletRequest, workflowUserD, workflow, workflowItem, EDIT_STEP, CLAIM_ACTION);
|
||||
executeWorkflowAction(httpServletRequest, workflowUserD, workflow, workflowItem, EDIT_STEP, EDIT_ACTION);
|
||||
|
||||
executeWorkflowAction(httpServletRequest, workflowUserB, workflow, workflowItem, FINAL_EDIT_STEP, CLAIM_ACTION);
|
||||
executeWorkflowAction(httpServletRequest, workflowUserB, workflow, workflowItem, FINAL_EDIT_STEP,
|
||||
CLAIM_ACTION);
|
||||
executeWorkflowAction(httpServletRequest, workflowUserB, workflow, workflowItem, FINAL_EDIT_STEP,
|
||||
FINAL_EDIT_ACTION);
|
||||
|
||||
@@ -1042,9 +1046,9 @@ public class EPersonInWorkflowIT extends AbstractIntegrationTestWithDatabase {
|
||||
.withSubject("ExtraEntry")
|
||||
.build();
|
||||
|
||||
Workflow workflow = XmlWorkflowServiceFactory.getInstance().getWorkflowFactory().getWorkflow(collection);
|
||||
Workflow workflow = WorkflowServiceFactory.getInstance().getWorkflowFactory().getWorkflow(collection);
|
||||
|
||||
XmlWorkflowItem workflowItem = xmlWorkflowService.startWithoutNotify(context, wsi);
|
||||
WorkflowItem workflowItem = workflowService.startWithoutNotify(context, wsi);
|
||||
MockHttpServletRequest httpServletRequest = new MockHttpServletRequest();
|
||||
httpServletRequest.setParameter("submit_approve", "submit_approve");
|
||||
|
||||
@@ -1060,7 +1064,8 @@ public class EPersonInWorkflowIT extends AbstractIntegrationTestWithDatabase {
|
||||
assertDeletionOfEperson(workflowUserB, true);
|
||||
|
||||
|
||||
executeWorkflowAction(httpServletRequest, workflowUserD, workflow, workflowItem, FINAL_EDIT_STEP, CLAIM_ACTION);
|
||||
executeWorkflowAction(httpServletRequest, workflowUserD, workflow, workflowItem, FINAL_EDIT_STEP,
|
||||
CLAIM_ACTION);
|
||||
executeWorkflowAction(httpServletRequest, workflowUserD, workflow, workflowItem, FINAL_EDIT_STEP,
|
||||
FINAL_EDIT_ACTION);
|
||||
|
||||
@@ -1109,9 +1114,9 @@ public class EPersonInWorkflowIT extends AbstractIntegrationTestWithDatabase {
|
||||
.withSubject("ExtraEntry")
|
||||
.build();
|
||||
|
||||
Workflow workflow = XmlWorkflowServiceFactory.getInstance().getWorkflowFactory().getWorkflow(collection);
|
||||
Workflow workflow = WorkflowServiceFactory.getInstance().getWorkflowFactory().getWorkflow(collection);
|
||||
|
||||
XmlWorkflowItem workflowItem = xmlWorkflowService.startWithoutNotify(context, wsi);
|
||||
WorkflowItem workflowItem = workflowService.startWithoutNotify(context, wsi);
|
||||
MockHttpServletRequest httpServletRequest = new MockHttpServletRequest();
|
||||
httpServletRequest.setParameter("submit_approve", "submit_approve");
|
||||
|
||||
@@ -1123,7 +1128,8 @@ public class EPersonInWorkflowIT extends AbstractIntegrationTestWithDatabase {
|
||||
|
||||
assertDeletionOfEperson(workflowUserB, true);
|
||||
|
||||
executeWorkflowAction(httpServletRequest, workflowUserD, workflow, workflowItem, FINAL_EDIT_STEP, CLAIM_ACTION);
|
||||
executeWorkflowAction(httpServletRequest, workflowUserD, workflow, workflowItem, FINAL_EDIT_STEP,
|
||||
CLAIM_ACTION);
|
||||
executeWorkflowAction(httpServletRequest, workflowUserD, workflow, workflowItem, FINAL_EDIT_STEP,
|
||||
FINAL_EDIT_ACTION);
|
||||
|
||||
@@ -1174,9 +1180,9 @@ public class EPersonInWorkflowIT extends AbstractIntegrationTestWithDatabase {
|
||||
.withSubject("ExtraEntry")
|
||||
.build();
|
||||
|
||||
Workflow workflow = XmlWorkflowServiceFactory.getInstance().getWorkflowFactory().getWorkflow(collection);
|
||||
Workflow workflow = WorkflowServiceFactory.getInstance().getWorkflowFactory().getWorkflow(collection);
|
||||
|
||||
XmlWorkflowItem workflowItem = xmlWorkflowService.startWithoutNotify(context, wsi);
|
||||
WorkflowItem workflowItem = workflowService.startWithoutNotify(context, wsi);
|
||||
MockHttpServletRequest httpServletRequest = new MockHttpServletRequest();
|
||||
httpServletRequest.setParameter("submit_approve", "submit_approve");
|
||||
|
||||
@@ -1189,7 +1195,8 @@ public class EPersonInWorkflowIT extends AbstractIntegrationTestWithDatabase {
|
||||
executeWorkflowAction(httpServletRequest, workflowUserC, workflow, workflowItem, EDIT_STEP, EDIT_ACTION);
|
||||
|
||||
|
||||
executeWorkflowAction(httpServletRequest, workflowUserD, workflow, workflowItem, FINAL_EDIT_STEP, CLAIM_ACTION);
|
||||
executeWorkflowAction(httpServletRequest, workflowUserD, workflow, workflowItem, FINAL_EDIT_STEP,
|
||||
CLAIM_ACTION);
|
||||
executeWorkflowAction(httpServletRequest, workflowUserD, workflow, workflowItem, FINAL_EDIT_STEP,
|
||||
FINAL_EDIT_ACTION);
|
||||
|
||||
@@ -1239,9 +1246,9 @@ public class EPersonInWorkflowIT extends AbstractIntegrationTestWithDatabase {
|
||||
.withSubject("ExtraEntry")
|
||||
.build();
|
||||
|
||||
Workflow workflow = XmlWorkflowServiceFactory.getInstance().getWorkflowFactory().getWorkflow(collection);
|
||||
Workflow workflow = WorkflowServiceFactory.getInstance().getWorkflowFactory().getWorkflow(collection);
|
||||
|
||||
XmlWorkflowItem workflowItem = xmlWorkflowService.startWithoutNotify(context, wsi);
|
||||
WorkflowItem workflowItem = workflowService.startWithoutNotify(context, wsi);
|
||||
MockHttpServletRequest httpServletRequest = new MockHttpServletRequest();
|
||||
httpServletRequest.setParameter("submit_approve", "submit_approve");
|
||||
|
||||
@@ -1254,7 +1261,8 @@ public class EPersonInWorkflowIT extends AbstractIntegrationTestWithDatabase {
|
||||
executeWorkflowAction(httpServletRequest, workflowUserD, workflow, workflowItem, EDIT_STEP, EDIT_ACTION);
|
||||
|
||||
|
||||
executeWorkflowAction(httpServletRequest, workflowUserB, workflow, workflowItem, FINAL_EDIT_STEP, CLAIM_ACTION);
|
||||
executeWorkflowAction(httpServletRequest, workflowUserB, workflow, workflowItem, FINAL_EDIT_STEP,
|
||||
CLAIM_ACTION);
|
||||
executeWorkflowAction(httpServletRequest, workflowUserB, workflow, workflowItem, FINAL_EDIT_STEP,
|
||||
FINAL_EDIT_ACTION);
|
||||
|
||||
@@ -1307,9 +1315,9 @@ public class EPersonInWorkflowIT extends AbstractIntegrationTestWithDatabase {
|
||||
.withSubject("ExtraEntry")
|
||||
.build();
|
||||
|
||||
Workflow workflow = XmlWorkflowServiceFactory.getInstance().getWorkflowFactory().getWorkflow(collection);
|
||||
Workflow workflow = WorkflowServiceFactory.getInstance().getWorkflowFactory().getWorkflow(collection);
|
||||
|
||||
XmlWorkflowItem workflowItem = xmlWorkflowService.startWithoutNotify(context, wsi);
|
||||
WorkflowItem workflowItem = workflowService.startWithoutNotify(context, wsi);
|
||||
MockHttpServletRequest httpServletRequest = new MockHttpServletRequest();
|
||||
httpServletRequest.setParameter("submit_approve", "submit_approve");
|
||||
|
||||
@@ -1324,7 +1332,8 @@ public class EPersonInWorkflowIT extends AbstractIntegrationTestWithDatabase {
|
||||
executeWorkflowAction(httpServletRequest, workflowUserC, workflow, workflowItem, EDIT_STEP, EDIT_ACTION);
|
||||
|
||||
|
||||
executeWorkflowAction(httpServletRequest, workflowUserD, workflow, workflowItem, FINAL_EDIT_STEP, CLAIM_ACTION);
|
||||
executeWorkflowAction(httpServletRequest, workflowUserD, workflow, workflowItem, FINAL_EDIT_STEP,
|
||||
CLAIM_ACTION);
|
||||
executeWorkflowAction(httpServletRequest, workflowUserD, workflow, workflowItem, FINAL_EDIT_STEP,
|
||||
FINAL_EDIT_ACTION);
|
||||
|
||||
@@ -1377,9 +1386,9 @@ public class EPersonInWorkflowIT extends AbstractIntegrationTestWithDatabase {
|
||||
.withSubject("ExtraEntry")
|
||||
.build();
|
||||
|
||||
Workflow workflow = XmlWorkflowServiceFactory.getInstance().getWorkflowFactory().getWorkflow(collection);
|
||||
Workflow workflow = WorkflowServiceFactory.getInstance().getWorkflowFactory().getWorkflow(collection);
|
||||
|
||||
XmlWorkflowItem workflowItem = xmlWorkflowService.startWithoutNotify(context, wsi);
|
||||
WorkflowItem workflowItem = workflowService.startWithoutNotify(context, wsi);
|
||||
MockHttpServletRequest httpServletRequest = new MockHttpServletRequest();
|
||||
httpServletRequest.setParameter("submit_approve", "submit_approve");
|
||||
|
||||
@@ -1393,7 +1402,8 @@ public class EPersonInWorkflowIT extends AbstractIntegrationTestWithDatabase {
|
||||
executeWorkflowAction(httpServletRequest, workflowUserD, workflow, workflowItem, EDIT_STEP, EDIT_ACTION);
|
||||
|
||||
|
||||
executeWorkflowAction(httpServletRequest, workflowUserB, workflow, workflowItem, FINAL_EDIT_STEP, CLAIM_ACTION);
|
||||
executeWorkflowAction(httpServletRequest, workflowUserB, workflow, workflowItem, FINAL_EDIT_STEP,
|
||||
CLAIM_ACTION);
|
||||
executeWorkflowAction(httpServletRequest, workflowUserB, workflow, workflowItem, FINAL_EDIT_STEP,
|
||||
FINAL_EDIT_ACTION);
|
||||
|
||||
@@ -1446,9 +1456,9 @@ public class EPersonInWorkflowIT extends AbstractIntegrationTestWithDatabase {
|
||||
.withSubject("ExtraEntry")
|
||||
.build();
|
||||
|
||||
Workflow workflow = XmlWorkflowServiceFactory.getInstance().getWorkflowFactory().getWorkflow(collection);
|
||||
Workflow workflow = WorkflowServiceFactory.getInstance().getWorkflowFactory().getWorkflow(collection);
|
||||
|
||||
XmlWorkflowItem workflowItem = xmlWorkflowService.startWithoutNotify(context, wsi);
|
||||
WorkflowItem workflowItem = workflowService.startWithoutNotify(context, wsi);
|
||||
MockHttpServletRequest httpServletRequest = new MockHttpServletRequest();
|
||||
httpServletRequest.setParameter("submit_approve", "submit_approve");
|
||||
|
||||
@@ -1460,10 +1470,12 @@ public class EPersonInWorkflowIT extends AbstractIntegrationTestWithDatabase {
|
||||
executeWorkflowAction(httpServletRequest, workflowUserC, workflow, workflowItem, EDIT_STEP, EDIT_ACTION);
|
||||
|
||||
|
||||
executeWorkflowAction(httpServletRequest, workflowUserB, workflow, workflowItem, FINAL_EDIT_STEP, CLAIM_ACTION);
|
||||
executeWorkflowAction(httpServletRequest, workflowUserB, workflow, workflowItem, FINAL_EDIT_STEP,
|
||||
CLAIM_ACTION);
|
||||
assertDeletionOfEperson(workflowUserB, true);
|
||||
|
||||
executeWorkflowAction(httpServletRequest, workflowUserD, workflow, workflowItem, FINAL_EDIT_STEP, CLAIM_ACTION);
|
||||
executeWorkflowAction(httpServletRequest, workflowUserD, workflow, workflowItem, FINAL_EDIT_STEP,
|
||||
CLAIM_ACTION);
|
||||
executeWorkflowAction(httpServletRequest, workflowUserD, workflow, workflowItem, FINAL_EDIT_STEP,
|
||||
FINAL_EDIT_ACTION);
|
||||
|
||||
@@ -1484,10 +1496,11 @@ public class EPersonInWorkflowIT extends AbstractIntegrationTestWithDatabase {
|
||||
}
|
||||
|
||||
private void executeWorkflowAction(HttpServletRequest httpServletRequest, EPerson user,
|
||||
Workflow workflow, XmlWorkflowItem workflowItem, String stepId, String actionId)
|
||||
Workflow workflow, WorkflowItem workflowItem, String stepId,
|
||||
String actionId)
|
||||
throws Exception {
|
||||
context.setCurrentUser(user);
|
||||
xmlWorkflowService.doState(context, user, httpServletRequest, workflowItem.getID(), workflow,
|
||||
workflowService.doState(context, user, httpServletRequest, workflowItem.getID(), workflow,
|
||||
workflow.getStep(stepId).getActionConfig(actionId));
|
||||
context.setCurrentUser(null);
|
||||
}
|
||||
|
@@ -1,386 +0,0 @@
|
||||
/**
|
||||
* The contents of this file are subject to the license and copyright
|
||||
* detailed in the LICENSE and NOTICE files at the root of the source
|
||||
* tree and available online at
|
||||
*
|
||||
* http://www.dspace.org/license/
|
||||
*/
|
||||
package org.dspace.workflowbasic;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dspace.AbstractDSpaceTest;
|
||||
import org.dspace.AbstractIntegrationTest;
|
||||
import org.dspace.authorize.AuthorizeException;
|
||||
import org.dspace.content.Bitstream;
|
||||
import org.dspace.content.Bundle;
|
||||
import org.dspace.content.Collection;
|
||||
import org.dspace.content.Community;
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.content.WorkspaceItem;
|
||||
import org.dspace.content.factory.ContentServiceFactory;
|
||||
import org.dspace.content.service.BitstreamService;
|
||||
import org.dspace.content.service.BundleService;
|
||||
import org.dspace.content.service.CollectionService;
|
||||
import org.dspace.content.service.CommunityService;
|
||||
import org.dspace.content.service.InstallItemService;
|
||||
import org.dspace.content.service.ItemService;
|
||||
import org.dspace.content.service.WorkspaceItemService;
|
||||
import org.dspace.core.Constants;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.eperson.Group;
|
||||
import org.dspace.eperson.factory.EPersonServiceFactory;
|
||||
import org.dspace.eperson.service.EPersonService;
|
||||
import org.dspace.eperson.service.GroupService;
|
||||
import org.dspace.services.ConfigurationService;
|
||||
import org.dspace.services.factory.DSpaceServicesFactory;
|
||||
import org.dspace.workflow.WorkflowException;
|
||||
import org.dspace.workflowbasic.factory.BasicWorkflowServiceFactory;
|
||||
import org.dspace.workflowbasic.service.BasicWorkflowItemService;
|
||||
import org.dspace.workflowbasic.service.BasicWorkflowService;
|
||||
import org.hamcrest.CoreMatchers;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* This is an integration test to ensure that the basic workflow system
|
||||
* -including methods of the collection service dealing with it- works properly
|
||||
* together with the authorization service.
|
||||
*
|
||||
* @author Pascal-Nicolas Becker
|
||||
* @author Terry Brady
|
||||
*/
|
||||
@Ignore
|
||||
public class BasicWorkflowAuthorizationIT
|
||||
extends AbstractIntegrationTest {
|
||||
/**
|
||||
* log4j category
|
||||
*/
|
||||
private static final Logger log = org.apache.logging.log4j.LogManager.getLogger(BasicWorkflowAuthorizationIT.class);
|
||||
|
||||
protected CommunityService communityService = ContentServiceFactory.getInstance().getCommunityService();
|
||||
protected CollectionService collectionService = ContentServiceFactory.getInstance().getCollectionService();
|
||||
protected ItemService itemService = ContentServiceFactory.getInstance().getItemService();
|
||||
protected InstallItemService installItemService = ContentServiceFactory.getInstance().getInstallItemService();
|
||||
protected WorkspaceItemService workspaceItemService = ContentServiceFactory.getInstance().getWorkspaceItemService();
|
||||
protected BasicWorkflowItemService basicWorkflowItemService =
|
||||
BasicWorkflowServiceFactory.getInstance().getBasicWorkflowItemService();
|
||||
protected BasicWorkflowService basicWorkflowService = BasicWorkflowServiceFactory.getInstance()
|
||||
.getBasicWorkflowService();
|
||||
protected EPersonService ePersonService = EPersonServiceFactory.getInstance().getEPersonService();
|
||||
protected GroupService groupService = EPersonServiceFactory.getInstance().getGroupService();
|
||||
protected BundleService bundleService = ContentServiceFactory.getInstance().getBundleService();
|
||||
protected BitstreamService bitstreamService = ContentServiceFactory.getInstance().getBitstreamService();
|
||||
protected ConfigurationService configurationService = DSpaceServicesFactory.getInstance().getConfigurationService();
|
||||
|
||||
protected Community owningCommunity;
|
||||
protected Collection collection;
|
||||
protected Group group;
|
||||
protected EPerson member;
|
||||
|
||||
public BasicWorkflowAuthorizationIT() {
|
||||
owningCommunity = null;
|
||||
collection = null;
|
||||
group = null;
|
||||
member = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will be run before every test as per @Before. It will
|
||||
* initialize resources required for the tests.
|
||||
*
|
||||
* Other methods can be annotated with @Before here or in subclasses
|
||||
* but no execution order is guaranteed
|
||||
*/
|
||||
@Before
|
||||
@Override
|
||||
public void init() {
|
||||
super.init();
|
||||
|
||||
try {
|
||||
//we have to create a new community in the database
|
||||
configurationService.setProperty("workflow.notify.returned.tasks", false);
|
||||
context.turnOffAuthorisationSystem();
|
||||
|
||||
this.owningCommunity = communityService.create(null, context);
|
||||
this.collection = collectionService.create(context, owningCommunity);
|
||||
this.member = ePersonService.create(context);
|
||||
this.group = groupService.create(context);
|
||||
groupService.addMember(context, group, member);
|
||||
groupService.update(context, group);
|
||||
} catch (AuthorizeException ex) {
|
||||
log.error("Authorization Error in init", ex);
|
||||
Assert.fail("Authorization Error in init: " + ex.getMessage());
|
||||
} catch (SQLException ex) {
|
||||
log.error("SQL Error in init", ex);
|
||||
Assert.fail("SQL Error in init: " + ex.getMessage());
|
||||
} finally {
|
||||
// restore the authorization system as tests expect it to be in place
|
||||
context.restoreAuthSystemState();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will be run after every test as per @After. It will
|
||||
* clean resources initialized by the @Before methods.
|
||||
*
|
||||
* Other methods can be annotated with @After here or in subclasses
|
||||
* but no execution order is guaranteed
|
||||
*/
|
||||
@After
|
||||
@Override
|
||||
public void destroy() {
|
||||
try {
|
||||
context.turnOffAuthorisationSystem();
|
||||
|
||||
// reload collection, community, group and eperson
|
||||
if (collection != null) {
|
||||
try {
|
||||
collectionService.delete(context, collection);
|
||||
} catch (Exception e) {
|
||||
log.error("deleting collection", e);
|
||||
}
|
||||
collection = null;
|
||||
}
|
||||
if (owningCommunity != null) {
|
||||
try {
|
||||
communityService.delete(context, owningCommunity);
|
||||
} catch (Exception e) {
|
||||
log.error("deleting community", e);
|
||||
}
|
||||
owningCommunity = null;
|
||||
}
|
||||
|
||||
if (member != null) {
|
||||
if (group != null) {
|
||||
try {
|
||||
groupService.removeMember(context, group, member);
|
||||
} catch (Exception e) {
|
||||
log.error("detaching group relationship", e);
|
||||
}
|
||||
try {
|
||||
groupService.delete(context, group);
|
||||
} catch (Exception e) {
|
||||
log.error("detaching group relationship", e);
|
||||
}
|
||||
group = null;
|
||||
}
|
||||
try {
|
||||
ePersonService.delete(context, member);
|
||||
} catch (Exception e) {
|
||||
log.error("deleting user", e);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
// restore the authorization system
|
||||
context.restoreAuthSystemState();
|
||||
}
|
||||
super.destroy();
|
||||
}
|
||||
|
||||
|
||||
private void setWorkflowGroup(Collection collection, Context context, int step, Group group)
|
||||
throws SQLException, AuthorizeException {
|
||||
collection.setWorkflowGroup(context, step, group);
|
||||
//collection.setWorkflowGroup(step, group);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test if setWorkflowGroup method sets the appropriate policies for the
|
||||
* new workflow group.
|
||||
*/
|
||||
@Test
|
||||
public void testsetWorkflowGroupSetsPermission() throws SQLException, AuthorizeException {
|
||||
int step = 1;
|
||||
try {
|
||||
context.turnOffAuthorisationSystem();
|
||||
setWorkflowGroup(collection, context, step, group);
|
||||
collectionService.update(context, collection);
|
||||
} finally {
|
||||
context.restoreAuthSystemState();
|
||||
}
|
||||
assertThat("testsetWorkflowGroupSetsPermission 0",
|
||||
collectionService.getWorkflowGroup(context, collection, step),
|
||||
CoreMatchers.equalTo(group));
|
||||
Assert.assertTrue(groupService.isDirectMember(group, member));
|
||||
Assert.assertTrue("testsetWorkflowGroupSetsPermission 1", authorizeService
|
||||
.authorizeActionBoolean(context, member, collection, Constants.WORKFLOW_STEP_1, true));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if setWorkflowGroup method revokes policies when a workflow group
|
||||
* is removed.
|
||||
*/
|
||||
@Test
|
||||
public void testsetWorkflowGroupRevokesPermission() throws SQLException, AuthorizeException {
|
||||
int step = 1;
|
||||
try {
|
||||
context.turnOffAuthorisationSystem();
|
||||
setWorkflowGroup(collection, context, step, group);
|
||||
collectionService.update(context, collection);
|
||||
} finally {
|
||||
context.restoreAuthSystemState();
|
||||
}
|
||||
assertThat("testsetWorkflowGroupRevokesPermission 0",
|
||||
collectionService.getWorkflowGroup(context, collection, step),
|
||||
CoreMatchers
|
||||
.equalTo(group));
|
||||
Assert.assertTrue("testsetWorkflowGroupRevokesPermission 1", authorizeService
|
||||
.authorizeActionBoolean(context, member, collection, Constants.WORKFLOW_STEP_1, true));
|
||||
try {
|
||||
context.turnOffAuthorisationSystem();
|
||||
setWorkflowGroup(collection, context, step, null);
|
||||
collectionService.update(context, collection);
|
||||
} finally {
|
||||
context.restoreAuthSystemState();
|
||||
}
|
||||
assertThat("testsetWorkflowGroupRevokesPermission 2",
|
||||
collectionService.getWorkflowGroup(context, collection, step),
|
||||
CoreMatchers
|
||||
.nullValue());
|
||||
Assert.assertFalse("testsetWorkflowGroupRevokesPermission 3", authorizeService
|
||||
.authorizeActionBoolean(context, member, collection, Constants.WORKFLOW_STEP_1, true));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that a member of a workflow step group can claim a task and get the
|
||||
* appropriate policies.
|
||||
*/
|
||||
@Test
|
||||
public void testReviewerPermissions()
|
||||
throws SQLException, AuthorizeException, IOException, WorkflowException {
|
||||
BasicWorkflowItem wfi = null;
|
||||
try {
|
||||
// prepare a task to claim
|
||||
// turn of the authorization system to be able to create the task
|
||||
context.turnOffAuthorisationSystem();
|
||||
setWorkflowGroup(collection, context, 1, group);
|
||||
collectionService.update(context, collection);
|
||||
WorkspaceItem wsi = workspaceItemService.create(context, collection, false);
|
||||
Item item = wsi.getItem();
|
||||
Bundle bundle = bundleService.create(context, item, "ORIGINAL");
|
||||
File f = new File(AbstractDSpaceTest.testProps.get("test.bitstream").toString());
|
||||
bitstreamService.create(context, bundle, new FileInputStream(f));
|
||||
bundleService.update(context, bundle);
|
||||
itemService.update(context, item);
|
||||
workspaceItemService.update(context, wsi);
|
||||
|
||||
wfi = basicWorkflowService.startWithoutNotify(context, wsi);
|
||||
basicWorkflowItemService.update(context, wfi);
|
||||
} finally {
|
||||
// restore the authorization system to perform our tests
|
||||
context.restoreAuthSystemState();
|
||||
}
|
||||
|
||||
wfi = basicWorkflowItemService.find(context, wfi.getID());
|
||||
basicWorkflowService.claim(context, wfi, member);
|
||||
Item item = wfi.getItem();
|
||||
|
||||
int i = 0;
|
||||
// check item policies
|
||||
for (int action : new int[] {Constants.READ, Constants.WRITE, Constants.ADD, Constants.REMOVE,
|
||||
Constants.DELETE}) {
|
||||
Assert.assertTrue("testReviewerPermissions 1-" + i++,
|
||||
authorizeService.authorizeActionBoolean(context, member, item, action, false));
|
||||
}
|
||||
|
||||
// ensure we can read the original bundle and its bitstream
|
||||
Bundle bundle = itemService.getBundles(item, "ORIGINAL").get(0);
|
||||
Bitstream bitstream = bundle.getBitstreams().get(0);
|
||||
Assert.assertTrue("testReviewerPermissions 2-1",
|
||||
authorizeService.authorizeActionBoolean(context, member, bundle, Constants.READ, false));
|
||||
Assert.assertTrue("testReviewerPermissions 2-2" + i++,
|
||||
authorizeService.authorizeActionBoolean(context, member, bitstream, Constants.READ, false));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that a eperson not a member of a workflow step group can't claim a task.
|
||||
*/
|
||||
@Test(expected = AuthorizeException.class)
|
||||
public void testNonWorkflowGroupMemberCannotClaimTask()
|
||||
throws SQLException, AuthorizeException, IOException, WorkflowException {
|
||||
BasicWorkflowItem wfi = null;
|
||||
EPerson someone = null;
|
||||
try {
|
||||
// prepare a task to claim
|
||||
// turn of the authorization system to be able to create the task
|
||||
context.turnOffAuthorisationSystem();
|
||||
someone = ePersonService.create(context);
|
||||
setWorkflowGroup(collection, context, 1, group);
|
||||
collectionService.update(context, collection);
|
||||
WorkspaceItem wsi = workspaceItemService.create(context, collection, false);
|
||||
Item item = wsi.getItem();
|
||||
Bundle bundle = bundleService.create(context, item, "ORIGINAL");
|
||||
File f = new File(AbstractDSpaceTest.testProps.get("test.bitstream").toString());
|
||||
bitstreamService.create(context, bundle, new FileInputStream(f));
|
||||
bundleService.update(context, bundle);
|
||||
itemService.update(context, item);
|
||||
workspaceItemService.update(context, wsi);
|
||||
|
||||
wfi = basicWorkflowService.startWithoutNotify(context, wsi);
|
||||
basicWorkflowItemService.update(context, wfi);
|
||||
} finally {
|
||||
// restore the authorization system to perform our tests
|
||||
context.restoreAuthSystemState();
|
||||
}
|
||||
|
||||
wfi = basicWorkflowItemService.find(context, wfi.getID());
|
||||
basicWorkflowService.claim(context, wfi, someone);
|
||||
Assert.fail("Someone, not part of a workflow step group was able to claim a "
|
||||
+ "task without an AUthorizeException.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that the submitter of an item who is not member of the appropriate
|
||||
* workflow step group cannot claim the task of his/her own submission.
|
||||
* Submitter habe special permissions on Workflow and Workspace items, so we
|
||||
* need to test that they are still not able to claim tasks for there own
|
||||
* items.
|
||||
*/
|
||||
@Test(expected = AuthorizeException.class)
|
||||
public void testNonWorkflowGroupSubmitterCannotClaimTask()
|
||||
throws SQLException, AuthorizeException, IOException, WorkflowException {
|
||||
BasicWorkflowItem wfi = null;
|
||||
EPerson submitter = null;
|
||||
try {
|
||||
// prepare a task to claim
|
||||
// turn of the authorization system to be able to create the task
|
||||
context.turnOffAuthorisationSystem();
|
||||
submitter = ePersonService.create(context);
|
||||
setWorkflowGroup(collection, context, 1, group);
|
||||
collectionService.update(context, collection);
|
||||
WorkspaceItem wsi = workspaceItemService.create(context, collection, false);
|
||||
Item item = wsi.getItem();
|
||||
item.setSubmitter(submitter);
|
||||
Bundle bundle = bundleService.create(context, item, "ORIGINAL");
|
||||
File f = new File(AbstractDSpaceTest.testProps.get("test.bitstream").toString());
|
||||
bitstreamService.create(context, bundle, new FileInputStream(f));
|
||||
bundleService.update(context, bundle);
|
||||
itemService.update(context, item);
|
||||
workspaceItemService.update(context, wsi);
|
||||
|
||||
wfi = basicWorkflowService.startWithoutNotify(context, wsi);
|
||||
basicWorkflowItemService.update(context, wfi);
|
||||
} finally {
|
||||
// restore the authorization system to perform our tests
|
||||
context.restoreAuthSystemState();
|
||||
}
|
||||
|
||||
wfi = basicWorkflowItemService.find(context, wfi.getID());
|
||||
basicWorkflowService.claim(context, wfi, submitter);
|
||||
Assert.fail("A submitter was able to claim a task without being a member of the "
|
||||
+ "appropriate workflow step group. Expected: AuthorizeException.");
|
||||
}
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@@ -23,6 +23,7 @@ import org.dspace.content.factory.ContentServiceFactory;
|
||||
import org.dspace.content.service.CollectionService;
|
||||
import org.dspace.content.service.CommunityService;
|
||||
import org.dspace.utils.DSpace;
|
||||
import org.dspace.workflow.factory.WorkflowServiceFactoryImpl;
|
||||
import org.dspace.xmlworkflow.factory.XmlWorkflowFactory;
|
||||
import org.dspace.xmlworkflow.state.Workflow;
|
||||
import org.junit.After;
|
||||
@@ -30,7 +31,7 @@ import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Tests that check that the spring bean {@link org.dspace.xmlworkflow.factory.XmlWorkflowServiceFactoryImpl}
|
||||
* Tests that check that the spring bean {@link WorkflowServiceFactoryImpl}
|
||||
* in workflow.xml gets created correctly
|
||||
*
|
||||
* @author Maria Verdonck (Atmire) on 19/12/2019
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user