AuthorizeException
{
String buttonPressed = UIUtil.getSubmitButton(request, "submit_cancel");
// Get workflow item
WorkflowItem workflowItem;
try
{
int wfID = Integer.parseInt(request.getParameter("workflow_id"));
workflowItem = WorkflowItem.find(context, wfID);
}
catch (NumberFormatException nfe)
{
workflowItem = null;
}
if (workflowItem == null)
{
log.warn(LogManager.getHeader(context, "integrity_error", UIUtil
.getRequestLogInfo(request)));
JSPManager.showIntegrityError(request, response);
return;
}
if (buttonPressed.equals("submit_approve"))
{
Item item = workflowItem.getItem();
// Advance the item along the workflow
WorkflowManager.advance(context, workflowItem, context
.getCurrentUser());
// FIXME: This should be a return value from advance()
// See if that gave the item a Handle. If it did,
// the item made it into the archive, so we
// should display a suitable page.
String handle = HandleManager.findHandle(context, item);
if (handle != null)
{
String displayHandle = HandleManager.getCanonicalForm(handle);
request.setAttribute("handle", displayHandle);
JSPManager.showJSP(request, response,
"/mydspace/in-archive.jsp");
}
else
{
JSPManager.showJSP(request, response,
"/mydspace/task-complete.jsp");
}
context.complete();
}
else if (buttonPressed.equals("submit_reject"))
{
// Submission rejected. Ask the user for a reason
log.info(LogManager.getHeader(context, "get_reject_reason",
"workflow_id=" + workflowItem.getID() + ",item_id="
+ workflowItem.getItem().getID()));
request.setAttribute("workflow.item", workflowItem);
JSPManager
.showJSP(request, response, "/mydspace/reject-reason.jsp");
}
else if (buttonPressed.equals("submit_edit"))
{
// FIXME: Check auth
log.info(LogManager.getHeader(context, "edit_workflow_item",
"workflow_id=" + workflowItem.getID() + ",item_id="
+ workflowItem.getItem().getID()));
// Forward control to the submission interface
// with the relevant item
response.sendRedirect(response.encodeRedirectURL(request
.getContextPath()
+ "/submit?workflow=" + workflowItem.getID()));
}
else if (buttonPressed.equals("submit_pool"))
{
// Return task to pool
WorkflowManager.unclaim(context, workflowItem, context