String reason = request.getParameter("reason");
if (reason != null && reason.length() > 1)
{
WorkspaceItem wsi = WorkflowManager.reject(context, workflowItem,context.getCurrentUser(), reason);
// Load the Submission Process for the collection this WSI is associated with
Collection c = wsi.getCollection();
SubmissionConfigReader subConfigReader = new SubmissionConfigReader();
SubmissionConfig subConfig = subConfigReader.getSubmissionConfig(c.getHandle(), false);
// Set the "stage_reached" column on the workspace item
// to the LAST page of the LAST step in the submission process
// (i.e. the page just before "Complete", which is at NumSteps-1)
int lastStep = subConfig.getNumberOfSteps()-2;
wsi.setStageReached(lastStep);
wsi.setPageReached(AbstractProcessingStep.LAST_PAGE_REACHED);
wsi.update();
context.commit();
// Submission rejected. Log this information
log.info(LogManager.getHeader(context, "reject_workflow", "workflow_item_id="
+ wsi.getID() + "item_id=" + wsi.getItem().getID()
+ "collection_id=" + wsi.getCollection().getID()
+ "eperson_id=" + context.getCurrentUser().getID()));
// Return no errors.
return null;
}