1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
package org.kuali.rice.kew.superuser.web; |
18 | |
|
19 | |
import org.apache.commons.lang.ArrayUtils; |
20 | |
import org.apache.struts.action.ActionMapping; |
21 | |
import org.kuali.rice.core.api.util.ConcreteKeyValue; |
22 | |
import org.kuali.rice.core.api.util.KeyValue; |
23 | |
import org.kuali.rice.kew.actionrequest.ActionRequestValue; |
24 | |
import org.kuali.rice.kew.api.KewApiServiceLocator; |
25 | |
import org.kuali.rice.kew.doctype.bo.DocumentType; |
26 | |
import org.kuali.rice.kew.routeheader.DocumentRouteHeaderValue; |
27 | |
import org.kuali.rice.kew.web.KewRoutingKualiForm; |
28 | |
|
29 | |
import javax.servlet.http.HttpServletRequest; |
30 | |
import java.util.ArrayList; |
31 | |
import java.util.Arrays; |
32 | |
import java.util.HashSet; |
33 | |
import java.util.List; |
34 | |
import java.util.Set; |
35 | |
|
36 | |
|
37 | |
|
38 | |
|
39 | |
|
40 | |
|
41 | |
|
42 | 0 | public class SuperUserForm extends KewRoutingKualiForm { |
43 | |
|
44 | |
private static final long serialVersionUID = 982228198266403397L; |
45 | |
private String documentId; |
46 | |
private String docHandlerUrl; |
47 | |
private Integer routeLevel; |
48 | 0 | private List<String> futureNodeNames = new ArrayList<String>(); |
49 | |
private String destNodeName; |
50 | |
private String returnDestNodeName; |
51 | |
private String action; |
52 | 0 | private List<ActionRequestValue> actionRequests = new ArrayList<ActionRequestValue>(); |
53 | |
private String actionTakenActionRequestId; |
54 | |
private String actionTakenNetworkId; |
55 | |
private String actionTakenWorkGroupId; |
56 | |
private String actionTakenRecipientCode; |
57 | |
private boolean authorized; |
58 | |
private boolean blanketApprove; |
59 | 0 | private String methodToCall = ""; |
60 | 0 | private boolean runPostProcessorLogic = true; |
61 | |
private String[] actionRequestRunPostProcessorCheck; |
62 | |
|
63 | |
private String lookupableImplServiceName; |
64 | |
private String lookupType; |
65 | |
|
66 | |
private DocumentRouteHeaderValue routeHeader; |
67 | |
|
68 | |
|
69 | |
private String returnLocation; |
70 | |
|
71 | |
@Override |
72 | |
public String getMethodToCall() { |
73 | 0 | return methodToCall; |
74 | |
} |
75 | |
@Override |
76 | |
public void setMethodToCall(String methodToCall) { |
77 | 0 | this.methodToCall = methodToCall; |
78 | 0 | } |
79 | |
|
80 | |
public boolean isBlanketApprove() { |
81 | 0 | return blanketApprove; |
82 | |
} |
83 | |
|
84 | |
public void setBlanketApprove(boolean blanketApprove) { |
85 | 0 | this.blanketApprove = blanketApprove; |
86 | 0 | } |
87 | |
|
88 | |
public DocumentRouteHeaderValue getRouteHeader() { |
89 | 0 | return routeHeader; |
90 | |
} |
91 | |
|
92 | |
public void setRouteHeader(DocumentRouteHeaderValue routeHeader) { |
93 | 0 | this.routeHeader = routeHeader; |
94 | 0 | } |
95 | |
|
96 | |
public String getDocumentId() { |
97 | 0 | return documentId; |
98 | |
} |
99 | |
|
100 | |
public void setDocumentId(String documentId) { |
101 | 0 | this.documentId = documentId; |
102 | 0 | } |
103 | |
|
104 | |
public String getDocHandlerUrl() { |
105 | 0 | return docHandlerUrl; |
106 | |
} |
107 | |
|
108 | |
public void setDocHandlerUrl(String docHandlerUrl) { |
109 | 0 | this.docHandlerUrl = docHandlerUrl; |
110 | 0 | } |
111 | |
|
112 | |
public Integer getRouteLevel() { |
113 | 0 | return routeLevel; |
114 | |
} |
115 | |
|
116 | |
public void setRouteLevel(Integer routeLevel) { |
117 | 0 | this.routeLevel = routeLevel; |
118 | 0 | } |
119 | |
|
120 | |
public String getAction() { |
121 | 0 | return action; |
122 | |
} |
123 | |
|
124 | |
public void setAction(String action) { |
125 | 0 | this.action = action; |
126 | 0 | } |
127 | |
|
128 | |
public List<ActionRequestValue> getActionRequests() { |
129 | 0 | return actionRequests; |
130 | |
} |
131 | |
|
132 | |
public void setActionRequests(List<ActionRequestValue> actionRequests) { |
133 | 0 | this.actionRequests = actionRequests; |
134 | 0 | } |
135 | |
|
136 | |
public String getActionTakenActionRequestId() { |
137 | 0 | return actionTakenActionRequestId; |
138 | |
} |
139 | |
|
140 | |
public void setActionTakenActionRequestId(String actionTakenActionRequestId) { |
141 | 0 | this.actionTakenActionRequestId = actionTakenActionRequestId; |
142 | 0 | } |
143 | |
|
144 | |
public String getActionTakenNetworkId() { |
145 | 0 | return actionTakenNetworkId; |
146 | |
} |
147 | |
|
148 | |
public void setActionTakenNetworkId(String actionTakenNetworkId) { |
149 | 0 | this.actionTakenNetworkId = actionTakenNetworkId; |
150 | 0 | } |
151 | |
|
152 | |
public String getActionTakenWorkGroupId() { |
153 | 0 | return actionTakenWorkGroupId; |
154 | |
} |
155 | |
|
156 | |
public void setActionTakenWorkGroupId(String actionTakenWorkGroupId) { |
157 | 0 | this.actionTakenWorkGroupId = actionTakenWorkGroupId; |
158 | 0 | } |
159 | |
|
160 | |
|
161 | |
|
162 | |
|
163 | |
|
164 | |
|
165 | |
|
166 | |
|
167 | |
|
168 | |
public boolean isAuthorized() { |
169 | 0 | return authorized; |
170 | |
} |
171 | |
|
172 | |
public void setAuthorized(boolean authorized) { |
173 | 0 | this.authorized = authorized; |
174 | 0 | } |
175 | |
|
176 | |
@Override |
177 | |
public void reset(ActionMapping mapping, HttpServletRequest request){ |
178 | 0 | this.futureNodeNames = new ArrayList<String>(); |
179 | 0 | } |
180 | |
|
181 | |
public String getActionTakenRecipientCode() { |
182 | 0 | return actionTakenRecipientCode; |
183 | |
} |
184 | |
|
185 | |
public void setActionTakenRecipientCode(String actionTakenRecipientCode) { |
186 | 0 | this.actionTakenRecipientCode = actionTakenRecipientCode; |
187 | 0 | } |
188 | |
|
189 | |
public boolean isSUDocument() { |
190 | 0 | if (routeHeader.isStateInitiated() || routeHeader.isStateSaved()) { |
191 | 0 | return false; |
192 | |
} |
193 | 0 | return true; |
194 | |
} |
195 | |
|
196 | |
public boolean isStateAllowsAction() { |
197 | 0 | if ( routeHeader.isProcessed() || routeHeader.isDisaproved() ) { |
198 | 0 | return false; |
199 | |
} |
200 | 0 | return true; |
201 | |
} |
202 | |
|
203 | |
public DocumentType getDocumentType() { |
204 | 0 | return getRouteHeader().getDocumentType(); |
205 | |
} |
206 | |
|
207 | |
public Set<KeyValue> getPreviousNodes() throws Exception { |
208 | 0 | List<String> nodeNames = KewApiServiceLocator.getWorkflowDocumentService().getPreviousRouteNodeNames(routeHeader.getDocumentId()); |
209 | 0 | Set<KeyValue> previousNodes = new HashSet<KeyValue>(); |
210 | 0 | for (String nodeName : nodeNames) { |
211 | 0 | previousNodes.add(new ConcreteKeyValue(nodeName, nodeName)); |
212 | |
} |
213 | 0 | return previousNodes; |
214 | |
} |
215 | |
|
216 | |
public String getDestNodeName() { |
217 | 0 | return destNodeName; |
218 | |
} |
219 | |
public void setDestNodeName(String previousNodeName) { |
220 | 0 | this.destNodeName = previousNodeName; |
221 | 0 | } |
222 | |
public List<String> getFutureNodeNames() { |
223 | 0 | return futureNodeNames; |
224 | |
} |
225 | |
public void setFutureNodeNames(List<String> futureNodeNames) { |
226 | 0 | this.futureNodeNames = futureNodeNames; |
227 | 0 | } |
228 | |
public String getReturnDestNodeName() { |
229 | 0 | return returnDestNodeName; |
230 | |
} |
231 | |
public void setReturnDestNodeName(String returnDestNodeName) { |
232 | 0 | this.returnDestNodeName = returnDestNodeName; |
233 | 0 | } |
234 | |
public String getLookupableImplServiceName() { |
235 | 0 | return lookupableImplServiceName; |
236 | |
} |
237 | |
public void setLookupableImplServiceName(String lookupableImplServiceName) { |
238 | 0 | this.lookupableImplServiceName = lookupableImplServiceName; |
239 | 0 | } |
240 | |
public String getLookupType() { |
241 | 0 | return lookupType; |
242 | |
} |
243 | |
public void setLookupType(String lookupType) { |
244 | 0 | this.lookupType = lookupType; |
245 | 0 | } |
246 | |
public boolean isRunPostProcessorLogic() { |
247 | 0 | return this.runPostProcessorLogic; |
248 | |
} |
249 | |
public void setRunPostProcessorLogic(boolean runPostProcessorLogic) { |
250 | 0 | this.runPostProcessorLogic = runPostProcessorLogic; |
251 | 0 | } |
252 | |
public String[] getActionRequestRunPostProcessorCheck() { |
253 | 0 | return this.actionRequestRunPostProcessorCheck; |
254 | |
} |
255 | |
public void setActionRequestRunPostProcessorCheck(String[] actionRequestRunPostProcessorCheck) { |
256 | 0 | this.actionRequestRunPostProcessorCheck = actionRequestRunPostProcessorCheck; |
257 | 0 | } |
258 | |
public Boolean getActionRequestPostProcessorCheck(String actionRequestId) { |
259 | 0 | return ArrayUtils.contains(getActionRequestRunPostProcessorCheck(), actionRequestId); |
260 | |
} |
261 | |
public List<String> getActionRequestPostProcessorCheck() { |
262 | 0 | if (getActionRequestRunPostProcessorCheck() == null) { |
263 | 0 | return null; |
264 | |
} |
265 | 0 | return Arrays.asList(getActionRequestRunPostProcessorCheck()); |
266 | |
} |
267 | |
|
268 | |
public String getReturnLocation() { |
269 | 0 | return returnLocation; |
270 | |
} |
271 | |
public void setReturnLocation(String returnLocation) { |
272 | 0 | this.returnLocation = returnLocation; |
273 | 0 | } |
274 | |
public boolean getActionRequestPostProcessorDisplayCheck(){ |
275 | 0 | return getDocumentType().getSuPostprocessorOverridePolicy().getPolicyValue().booleanValue(); |
276 | |
} |
277 | |
} |