1 40 package org.dspace.app.webui.servlet.admin; 41 42 import java.io.IOException ; 43 import java.sql.SQLException ; 44 45 import javax.servlet.ServletException ; 46 import javax.servlet.http.HttpServletRequest ; 47 import javax.servlet.http.HttpServletResponse ; 48 49 import org.dspace.app.webui.servlet.DSpaceServlet; 50 import org.dspace.app.webui.util.JSPManager; 51 import org.dspace.app.webui.util.UIUtil; 52 import org.dspace.authorize.AuthorizeException; 53 import org.dspace.core.Context; 54 import org.dspace.workflow.WorkflowItem; 55 import org.dspace.workflow.WorkflowManager; 56 57 63 public class WorkflowAbortServlet extends DSpaceServlet 64 { 65 protected void doDSGet(Context c, HttpServletRequest request, 66 HttpServletResponse response) throws ServletException , IOException , 67 SQLException , AuthorizeException 68 { 69 showWorkflows(c, request, response); 71 } 72 73 protected void doDSPost(Context c, HttpServletRequest request, 74 HttpServletResponse response) throws ServletException , IOException , 75 SQLException , AuthorizeException 76 { 77 String button = UIUtil.getSubmitButton(request, "submit"); 78 79 if (button.equals("submit_abort")) 80 { 81 WorkflowItem wi = WorkflowItem.find(c, UIUtil.getIntParameter( 83 request, "workflow_id")); 84 85 request.setAttribute("workflow", wi); 86 JSPManager.showJSP(request, response, 87 "/dspace-admin/workflow-abort-confirm.jsp"); 88 } 89 else if (button.equals("submit_abort_confirm")) 90 { 91 WorkflowItem wi = WorkflowItem.find(c, UIUtil.getIntParameter( 93 request, "workflow_id")); 94 95 WorkflowManager.abort(c, wi, c.getCurrentUser()); 96 97 showWorkflows(c, request, response); 99 } 100 else 101 { 102 showWorkflows(c, request, response); 104 } 105 106 c.complete(); 108 } 109 110 private void showWorkflows(Context c, HttpServletRequest request, 111 HttpServletResponse response) throws ServletException , IOException , 112 SQLException , AuthorizeException 113 { 114 WorkflowItem[] w = WorkflowItem.findAll(c); 115 116 request.setAttribute("workflows", w); 117 JSPManager 118 .showJSP(request, response, "/dspace-admin/workflow-list.jsp"); 119 } 120 } 121 | Popular Tags |