01: package xflow.action;
02:
03: import java.io.IOException;
04: import java.util.*;
05: import javax.servlet.*;
06: import javax.servlet.http.*;
07:
08: import org.apache.struts.action.*;
09: import org.apache.struts.Globals;
10:
11: import xflow.client.*;
12: import xflow.security.*;
13: import xflow.common.*;
14: import xflow.forms.*;
15:
16: public class AbortWorkflowAction extends Action {
17:
18: public ActionForward execute(ActionMapping mapping,
19: ActionForm form, HttpServletRequest request,
20: HttpServletResponse response) throws IOException,
21: ServletException {
22:
23: // Default target to success
24: String target = new String("success");
25:
26: try {
27:
28: //get the workflow Id
29: WorkflowId workflowId = new WorkflowId(Integer
30: .parseInt(request.getParameter("workflowId")));
31: User user = new User("foo", "bar");
32:
33: WorkflowManager.abortWorkflow(workflowId, user);
34:
35: } catch (Exception e) {
36: e.printStackTrace();
37: target = "failure";
38: }
39:
40: // Forward to the appropriate View
41: return (mapping.findForward(target));
42: }
43: }
|