1
2
3
4
5 package gboat2.serviceflow.action;
6
7 import gboat2.base.core.annotation.ListDomain;
8 import gboat2.base.core.annotation.Module;
9 import gboat2.base.core.annotation.Operation;
10 import gboat2.base.core.annotation.Operations;
11 import gboat2.base.core.annotation.Preference;
12 import gboat2.base.core.dao.Page;
13 import gboat2.base.core.dao.PageBean;
14 import gboat2.base.core.web.BaseActionSupport;
15 import gboat2.base.core.web.JsonResultSupport;
16 import gboat2.serviceflow.JBPMHelper;
17 import gboat2.serviceflow.model.ProcessInfo;
18 import gboat2.serviceflow.service.IEntryActionHandler;
19 import gboat2.serviceflow.service.IExitActionHandler;
20 import gboat2.serviceflow.service.IHandlerRegister;
21 import gboat2.serviceflow.service.IServiceFlowService;
22
23 import java.util.Collection;
24 import java.util.LinkedList;
25 import java.util.List;
26
27 import org.apache.commons.lang.StringUtils;
28 import org.apache.struts2.convention.annotation.ResultPath;
29 import org.drools.definition.KnowledgePackage;
30 import org.springframework.beans.factory.annotation.Autowired;
31
32
33
34
35
36
37
38
39
40 @ListDomain(value = ProcessInfo.class)
41 @ResultPath("/content/serviceflow")
42 @Preference("/系统配置/业务流管理")
43 @Module(name = "业务流管理", desc = "提供对业务流程管理")
44 @Operations({
45 @Operation(code="view",name="查看",desc="查看流程"),
46 @Operation(code="edit",name="编辑",desc="编辑流程")
47 })
48 public class ServiceflowAction extends BaseActionSupport {
49
50 @Autowired
51 private IHandlerRegister handlerRegister;
52
53 @Autowired
54 private IServiceFlowService workflowService;
55
56 private List<KnowledgePackage> packages = new LinkedList<KnowledgePackage>();
57
58 private List<IEntryActionHandler> entryActionHandlers;
59
60 private List<IExitActionHandler> exitActionHandlers;
61
62 private String processId;
63
64 public String list(){
65 List<ProcessInfo> proces = workflowService.getProcessInfos();
66 PageBean pb = new PageBean(1,-1);
67 page = new Page(proces,pb);
68 return "list";
69 }
70
71 @Operation(code = "status", name = "查看状态")
72 public String status() {
73 Collection<KnowledgePackage> packs = JBPMHelper.getKnowledgeBase().getKnowledgePackages();
74 packages.addAll(packs);
75 entryActionHandlers = handlerRegister.getEntryActionHandlers();
76 exitActionHandlers = handlerRegister.getExitActionHandlers();
77 return "status";
78 }
79
80 public void getProcessImgByProcessId(){
81 String url = workflowService.getPathForDisplay(this.processId);
82 if(StringUtils.isEmpty(url)){
83 JsonResultSupport.outputFailure();
84 }
85 JsonResultSupport.output(request.getContextPath()+url);
86 }
87
88 public List<KnowledgePackage> getPackages() {
89 return packages;
90 }
91
92 public List<IEntryActionHandler> getEntryActionHandlers() {
93 return entryActionHandlers;
94 }
95
96 public List<IExitActionHandler> getExitActionHandlers() {
97 return exitActionHandlers;
98 }
99
100 public String getProcessId() {
101 return processId;
102 }
103
104 public void setProcessId(String processId) {
105 this.processId = processId;
106 }
107
108 }