* @param context The current DSpace content
* @param id The unique ID of the current workflow
*/
public static void processClaimTask(Context context, String id) throws SQLException, UIException, ServletException, AuthorizeException, IOException
{
WorkflowItem workflowItem = findWorkflow(context, id);
if(workflowItem.getState() != WorkflowManager.WFSTATE_STEP1POOL &&
workflowItem.getState() != WorkflowManager.WFSTATE_STEP2POOL &&
workflowItem.getState() != WorkflowManager.WFSTATE_STEP3POOL){
// Only allow tasks in the pool to be claimed !
throw new AuthorizeException("Error while claiming task: this task has already been claimed !");
}
// Claim the task
WorkflowManager.claim(context, workflowItem, context.getCurrentUser());
context.commit();
// log this claim information
log.info(LogManager.getHeader(context, "claim_task", "workflow_item_id="
+ workflowItem.getID() + "item_id=" + workflowItem.getItem().getID()
+ "collection_id=" + workflowItem.getCollection().getID()
+ "newowner_id=" + workflowItem.getOwner().getID()
+ "new_state=" + workflowItem.getState()));
}