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