1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
package org.kuali.rice.kew.web; |
18 | |
|
19 | |
import java.util.ArrayList; |
20 | |
import java.util.HashMap; |
21 | |
import java.util.List; |
22 | |
import java.util.Map; |
23 | |
|
24 | |
import org.apache.struts.action.ActionForm; |
25 | |
import org.kuali.rice.kew.doctype.bo.DocumentType; |
26 | |
import org.kuali.rice.kew.routeheader.DocumentRouteHeaderValue; |
27 | |
import org.kuali.rice.kew.service.KEWServiceLocator; |
28 | |
import org.kuali.rice.kew.service.WorkflowDocument; |
29 | |
import org.kuali.rice.kew.util.CodeTranslator; |
30 | |
import org.kuali.rice.kew.util.KEWConstants; |
31 | |
import org.kuali.rice.kim.bo.Group; |
32 | |
import org.kuali.rice.kim.service.KIMServiceLocator; |
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | |
|
39 | |
|
40 | |
|
41 | 0 | public class WorkflowRoutingForm extends ActionForm { |
42 | |
|
43 | |
private static final long serialVersionUID = -3537002710069757806L; |
44 | |
private WorkflowDocument workflowDocument; |
45 | |
private Long docId; |
46 | |
private String docTypeName; |
47 | |
private String initiateURL; |
48 | |
private String command; |
49 | |
private String annotation; |
50 | |
|
51 | |
|
52 | |
private boolean showBlanketApproveButton; |
53 | 0 | protected Map appSpecificRouteActionRequestCds = new HashMap(); |
54 | 0 | protected AppSpecificRouteRecipient appSpecificRouteRecipient = new AppSpecificRouteRecipient(); |
55 | 0 | protected List appSpecificRouteList = new ArrayList(); |
56 | |
|
57 | 0 | protected String appSpecificRouteRecipientType = "person"; |
58 | |
protected String appSpecificRouteActionRequestCd; |
59 | |
protected Integer recipientIndex; |
60 | |
protected String docHandlerReturnUrl; |
61 | |
protected String removedAppSpecificRecipient; |
62 | |
|
63 | |
public void resetAppSpecificRoute(){ |
64 | 0 | appSpecificRouteRecipient = new AppSpecificRouteRecipient(); |
65 | 0 | } |
66 | |
|
67 | |
public Map getAppSpecificRouteActionRequestCds() { |
68 | 0 | return appSpecificRouteActionRequestCds; |
69 | |
} |
70 | |
|
71 | |
|
72 | |
|
73 | |
|
74 | |
|
75 | |
|
76 | |
|
77 | |
|
78 | |
|
79 | |
|
80 | |
|
81 | |
|
82 | |
|
83 | |
|
84 | |
|
85 | |
|
86 | |
|
87 | |
public String getInitiateURL() { |
88 | 0 | return initiateURL; |
89 | |
} |
90 | |
|
91 | |
|
92 | |
|
93 | |
public void setInitiateURL(String initiateURL) { |
94 | 0 | this.initiateURL = initiateURL; |
95 | 0 | } |
96 | |
|
97 | |
|
98 | |
|
99 | |
public String getCommand() { |
100 | 0 | return command; |
101 | |
} |
102 | |
|
103 | |
|
104 | |
|
105 | |
public void setCommand(String command) { |
106 | 0 | this.command = command; |
107 | 0 | } |
108 | |
|
109 | |
|
110 | |
|
111 | |
public String getAnnotation() { |
112 | 0 | return annotation; |
113 | |
} |
114 | |
|
115 | |
|
116 | |
|
117 | |
public void setAnnotation(String annotation) { |
118 | 0 | this.annotation = annotation; |
119 | 0 | } |
120 | |
|
121 | |
|
122 | |
|
123 | |
public boolean isShowBlanketApproveButton() { |
124 | 0 | return showBlanketApproveButton; |
125 | |
} |
126 | |
|
127 | |
|
128 | |
|
129 | |
public void setShowBlanketApproveButton(boolean blanketApprove) { |
130 | 0 | this.showBlanketApproveButton = blanketApprove; |
131 | 0 | } |
132 | |
|
133 | |
|
134 | |
|
135 | |
public Long getDocId() { |
136 | 0 | return docId; |
137 | |
} |
138 | |
|
139 | |
|
140 | |
|
141 | |
public void setDocId(Long docId) { |
142 | 0 | this.docId = docId; |
143 | 0 | } |
144 | |
|
145 | |
|
146 | |
|
147 | |
public WorkflowDocument getWorkflowDocument() { |
148 | 0 | return workflowDocument; |
149 | |
} |
150 | |
|
151 | |
|
152 | |
|
153 | |
public void setWorkflowDocument(WorkflowDocument workflowDocument) { |
154 | 0 | this.workflowDocument = workflowDocument; |
155 | 0 | } |
156 | |
|
157 | |
|
158 | |
|
159 | |
|
160 | |
|
161 | |
|
162 | |
|
163 | |
|
164 | |
|
165 | |
|
166 | |
|
167 | |
|
168 | |
|
169 | |
|
170 | |
|
171 | |
public boolean isSuperUserSearch() { |
172 | 0 | return (command != null && command.equals(KEWConstants.SUPERUSER_COMMAND)); |
173 | |
} |
174 | |
|
175 | |
public String getDocTypeName() { |
176 | 0 | return docTypeName; |
177 | |
} |
178 | |
|
179 | |
public void setDocTypeName(String docTypeName) { |
180 | 0 | this.docTypeName = docTypeName; |
181 | 0 | } |
182 | |
|
183 | |
public void setAppSpecificPersonId(String networkId){ |
184 | 0 | if(networkId != null && !networkId.trim().equals("")){ |
185 | 0 | getAppSpecificRouteRecipient().setId(networkId); |
186 | |
} |
187 | 0 | getAppSpecificRouteRecipient().setType("person"); |
188 | 0 | } |
189 | |
|
190 | |
public void setAppSpecificWorkgroupId(String workgroupId){ |
191 | 0 | if(workgroupId != null){ |
192 | 0 | Group workgroup = KIMServiceLocator.getIdentityManagementService().getGroup(workgroupId); |
193 | 0 | if(workgroup != null){ |
194 | 0 | getAppSpecificRouteRecipient().setId(workgroup.getGroupId()); |
195 | |
} |
196 | |
} |
197 | 0 | getAppSpecificRouteRecipient().setType("workgroup"); |
198 | 0 | } |
199 | |
|
200 | |
public AppSpecificRouteRecipient getAppSpecificRouteRecipient() { |
201 | 0 | return appSpecificRouteRecipient; |
202 | |
} |
203 | |
public void setAppSpecificRouteRecipient(AppSpecificRouteRecipient appSpecificRouteRecipient) { |
204 | 0 | this.appSpecificRouteRecipient = appSpecificRouteRecipient; |
205 | 0 | } |
206 | |
public List getAppSpecificRouteList() { |
207 | 0 | return appSpecificRouteList; |
208 | |
} |
209 | |
public void setAppSpecificRouteList(List appSpecificRouteList) { |
210 | 0 | this.appSpecificRouteList = appSpecificRouteList; |
211 | 0 | } |
212 | |
|
213 | |
|
214 | |
public void setAppSpecificRouteRecipientType( |
215 | |
String appSpecificRouteRecipientType) { |
216 | 0 | this.appSpecificRouteRecipientType = appSpecificRouteRecipientType; |
217 | 0 | } |
218 | |
public String getAppSpecificRouteRecipientType() { |
219 | 0 | return appSpecificRouteRecipientType; |
220 | |
} |
221 | |
|
222 | |
public AppSpecificRouteRecipient getAppSpecificRoute(int index) { |
223 | 0 | while (getAppSpecificRouteList().size() <= index) { |
224 | 0 | getAppSpecificRouteList().add(new AppSpecificRouteRecipient()); |
225 | |
} |
226 | 0 | return (AppSpecificRouteRecipient) getAppSpecificRouteList().get(index); |
227 | |
} |
228 | |
|
229 | |
|
230 | |
public void setAppSpecificRoute(int index, AppSpecificRouteRecipient appSpecificRouteRecipient) { |
231 | 0 | appSpecificRouteList.set(index, appSpecificRouteRecipient); |
232 | 0 | } |
233 | |
|
234 | |
|
235 | |
public String getAppSpecificRouteActionRequestCd() { |
236 | 0 | return appSpecificRouteActionRequestCd; |
237 | |
} |
238 | |
public void setAppSpecificRouteActionRequestCd( |
239 | |
String appSpecificRouteActionRequestCd) { |
240 | 0 | this.appSpecificRouteActionRequestCd = appSpecificRouteActionRequestCd; |
241 | 0 | } |
242 | |
public Integer getRecipientIndex() { |
243 | 0 | return recipientIndex; |
244 | |
} |
245 | |
public void setRecipientIndex(Integer recipientIndex) { |
246 | 0 | this.recipientIndex = recipientIndex; |
247 | 0 | } |
248 | |
|
249 | |
|
250 | |
public void establishVisibleActionRequestCds(){ |
251 | |
try { |
252 | 0 | if(getWorkflowDocument() != null){ |
253 | 0 | Long docId = workflowDocument.getRouteHeaderId(); |
254 | 0 | DocumentRouteHeaderValue document = KEWServiceLocator.getRouteHeaderService().getRouteHeader(docId); |
255 | 0 | DocumentType documentType = document.getDocumentType(); |
256 | 0 | boolean isSuperUser = KEWServiceLocator.getDocumentTypePermissionService().canAdministerRouting(workflowDocument.getPrincipalId(), documentType); |
257 | 0 | if (isSuperUser){ |
258 | 0 | appSpecificRouteActionRequestCds = CodeTranslator.arLabels; |
259 | 0 | }else if(workflowDocument.isFYIRequested()){ |
260 | 0 | appSpecificRouteActionRequestCds.clear(); |
261 | 0 | appSpecificRouteActionRequestCds.put(KEWConstants.ACTION_REQUEST_FYI_REQ, KEWConstants.ACTION_REQUEST_FYI_REQ_LABEL); |
262 | 0 | } else if (workflowDocument.isAcknowledgeRequested()){ |
263 | 0 | appSpecificRouteActionRequestCds.clear(); |
264 | 0 | appSpecificRouteActionRequestCds.put(KEWConstants.ACTION_REQUEST_ACKNOWLEDGE_REQ, KEWConstants.ACTION_REQUEST_ACKNOWLEDGE_REQ_LABEL); |
265 | 0 | appSpecificRouteActionRequestCds.put(KEWConstants.ACTION_REQUEST_FYI_REQ, KEWConstants.ACTION_REQUEST_FYI_REQ_LABEL); |
266 | 0 | } else if(workflowDocument.isApprovalRequested() || workflowDocument.isCompletionRequested() || workflowDocument.stateIsInitiated()){ |
267 | 0 | appSpecificRouteActionRequestCds = CodeTranslator.arLabels; |
268 | |
} |
269 | |
} |
270 | 0 | } catch (Exception e) { |
271 | 0 | throw new RuntimeException("Caught exception building ad hoc action dropdown", e); |
272 | 0 | } |
273 | 0 | } |
274 | |
public String getDocHandlerReturnUrl() { |
275 | 0 | return docHandlerReturnUrl; |
276 | |
} |
277 | |
public void setDocHandlerReturnUrl(String docHandlerReturnUrl) { |
278 | 0 | this.docHandlerReturnUrl = docHandlerReturnUrl; |
279 | 0 | } |
280 | |
|
281 | |
public String getRemovedAppSpecificRecipient() { |
282 | 0 | return removedAppSpecificRecipient; |
283 | |
} |
284 | |
public void setRemovedAppSpecificRecipient( |
285 | |
String removedAppSpecificRecipient) { |
286 | 0 | this.removedAppSpecificRecipient = removedAppSpecificRecipient; |
287 | 0 | } |
288 | |
} |