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