Hi,
I want to develop one button in my custom step that allow to
return/reject the item to previous step and not to the first step
(submitter). My custom workflow have 3 steps different.
By default, DSpace has a 'rejec't button that rejects the item to submitter.
I revised the code and I see the method 'sendWorkflowItemBackSubmission'
in class 'XmlWorkflowManager.java'.
public static WorkspaceItem sendWorkflowItemBackSubmission(Context c,
XmlWorkflowItem wi, EPerson e, String provenance,
String rejection_message) throws SQLException,
AuthorizeException,
IOException
{
String workflowID = null;
String currentStepId = null;
String currentActionConfigId = null;
ClaimedTask claimedTask =
ClaimedTask.findByWorkflowIdAndEPerson(c, wi.getID(), e.getID());
if(claimedTask != null){
//Log it
workflowID = claimedTask.getWorkflowID();
currentStepId = claimedTask.getStepID();
currentActionConfigId = claimedTask.getActionID();
}
// authorize a DSpaceActions.REJECT
// stop 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();
}
// rejection provenance
Item myitem = wi.getItem();
// Get current date
String now = DCDate.getCurrent().toString();
// Get user's name + email address
String usersName = getEPersonName(e);
// Here's what happened
String provDescription = provenance + " Rejected by " +
usersName + ", reason: "
+ rejection_message + " on " + now + " (GMT) ";
// Add to item as a DC field
myitem.addMetadata(MetadataSchema.DC_SCHEMA, "description",
"provenance", "en", provDescription);
//Clear any workflow schema related metadata
myitem.clearMetadata(WorkflowRequirementsManager.WORKFLOW_SCHEMA,
Item.ANY, Item.ANY, Item.ANY);
myitem.update();
//Restore permissions for the submitter
grantUserAllItemPolicies(c, myitem, myitem.getSubmitter());
// convert into personal workspace
WorkspaceItem wsi = returnToWorkspace(c, wi);
// notify that it's been rejected
notifyOfReject(c, wi, e, rejection_message);
log.info(LogManager.getHeader(c, "reject_workflow",
"workflow_item_id="
+ wi.getID() + "item_id=" + wi.getItem().getID()
+ "collection_id=" + wi.getCollection().getID() +
"eperson_id="
+ e.getID()));
logWorkflowEvent(c, workflowID, currentStepId,
currentActionConfigId, wi, e, null, null);
c.restoreAuthSystemState();
return wsi;
}
Has anyone implemented a similar feature or can give me any
indication/tip/advice to implement it?
Thanks in advance,
Dani
--
- no title specified
------------------------------------------------------------------------
Daniel Garcia Mejia
Tècnic de projectes - Càlcul i Aplicacions
Consorci de Serveis Universitaris de Catalunya (CSUC)
Gran Capità, 2 (Edifici Nexus) ?08034 Barcelona
T. 93 551 6210 ?F. 93 205 6979 ?daniel.gar...@csuc.cat
www.csuc.cat ?Twitter @CSUC_info ?Facebook ?Linkedin
Subscriu-te al butlletí; (www.csuc.cat/butlleti)
------------------------------------------------------------------------
------------------------------------------------------------------------------
Android apps run on BlackBerry 10
Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
Now with support for Jelly Bean, Bluetooth, Mapview and more.
Get your Android app in front of a whole new audience. Start now.
http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk
_______________________________________________
Dspace-devel mailing list
Dspace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dspace-devel