mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-14 05:23:14 +00:00
[DS-1240] Sword V2 doesn't support the configurable workflow
This commit is contained in:
@@ -632,6 +632,41 @@ public class XmlWorkflowManager {
|
||||
return wsi;
|
||||
}
|
||||
|
||||
public static WorkspaceItem abort(Context c, XmlWorkflowItem wi, EPerson e) throws AuthorizeException, SQLException, IOException {
|
||||
if (!AuthorizeManager.isAdmin(c))
|
||||
{
|
||||
throw new AuthorizeException(
|
||||
"You must be an admin to abort a workflow");
|
||||
}
|
||||
|
||||
deleteAllTasks(c, wi);
|
||||
|
||||
c.turnOffAuthorisationSystem();
|
||||
//Also clear all info for this step
|
||||
WorkflowRequirementsManager.clearInProgressUsers(c, wi);
|
||||
|
||||
// Remove (if any) the workflowItemroles for this item
|
||||
WorkflowItemRole[] workflowItemRoles = WorkflowItemRole.findAllForItem(c, wi.getID());
|
||||
for (WorkflowItemRole workflowItemRole : workflowItemRoles) {
|
||||
workflowItemRole.delete();
|
||||
}
|
||||
|
||||
//Restore permissions for the submitter
|
||||
Item item = wi.getItem();
|
||||
grantUserAllItemPolicies(c, item, item.getSubmitter());
|
||||
// convert into personal workspace
|
||||
WorkspaceItem wsi = returnToWorkspace(c, wi);
|
||||
|
||||
log.info(LogManager.getHeader(c, "abort_workflow", "workflow_item_id="
|
||||
+ wi.getID() + "item_id=" + item.getID()
|
||||
+ "collection_id=" + wi.getCollection().getID() + "eperson_id="
|
||||
+ e.getID()));
|
||||
|
||||
|
||||
c.restoreAuthSystemState();
|
||||
return wsi;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the workflow item to the workspace of the submitter. The workflow
|
||||
* item is removed, and a workspace item created.
|
||||
|
@@ -63,7 +63,7 @@ public class XmlWorkflowItem implements InProgressSubmission {
|
||||
*/
|
||||
// private ArrayList<StepRecord> activeSteps;
|
||||
|
||||
XmlWorkflowItem(Context context, TableRow row) throws SQLException, AuthorizeException, IOException {
|
||||
XmlWorkflowItem(Context context, TableRow row) throws SQLException {
|
||||
ourContext = context;
|
||||
wfRow = row;
|
||||
// activeSteps = new ArrayList<StepRecord>();
|
||||
@@ -358,6 +358,33 @@ public class XmlWorkflowItem implements InProgressSubmission {
|
||||
return wsArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check to see if a particular item is currently under Workflow.
|
||||
* If so, its XmlWorkflowItem is returned. If not, null is returned
|
||||
*
|
||||
* @param context
|
||||
* the context object
|
||||
* @param i
|
||||
* the item
|
||||
*
|
||||
* @return XmlWorkflow item corresponding to the item, or null
|
||||
*/
|
||||
public static XmlWorkflowItem findByItem(Context context, Item i)
|
||||
throws SQLException
|
||||
{
|
||||
// Look for the unique workflowitem entry where 'item_id' references this item
|
||||
TableRow row = DatabaseManager.findByUnique(context, "cwf_workflowitem", "item_id", i.getID());
|
||||
|
||||
if (row == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
return new XmlWorkflowItem(context, row);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the workflow item, including the unarchived item.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user