1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
package org.kuali.rice.kew.service.impl; |
18 | |
|
19 | |
import java.util.List; |
20 | |
import java.util.Set; |
21 | |
|
22 | |
import org.apache.commons.lang.ArrayUtils; |
23 | |
import org.kuali.rice.kew.docsearch.service.SearchableAttributeProcessingService; |
24 | |
import org.kuali.rice.kew.dto.AdHocRevokeDTO; |
25 | |
import org.kuali.rice.kew.dto.DTOConverter; |
26 | |
import org.kuali.rice.kew.dto.DocumentContentDTO; |
27 | |
import org.kuali.rice.kew.dto.MovePointDTO; |
28 | |
import org.kuali.rice.kew.dto.ReturnPointDTO; |
29 | |
import org.kuali.rice.kew.dto.RouteHeaderDTO; |
30 | |
import org.kuali.rice.kew.engine.node.RouteNodeInstance; |
31 | |
import org.kuali.rice.kew.exception.WorkflowException; |
32 | |
import org.kuali.rice.kew.messaging.MessageServiceNames; |
33 | |
import org.kuali.rice.kew.routeheader.DocumentRouteHeaderValue; |
34 | |
import org.kuali.rice.kew.service.KEWServiceLocator; |
35 | |
import org.kuali.rice.kew.service.WorkflowDocumentActions; |
36 | |
import org.kuali.rice.kew.util.Utilities; |
37 | |
|
38 | |
|
39 | 0 | public class WorkflowDocumentActionsWebServiceImpl implements WorkflowDocumentActions { |
40 | |
|
41 | 0 | private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(WorkflowDocumentActionsWebServiceImpl.class); |
42 | |
|
43 | |
private DocumentRouteHeaderValue init(RouteHeaderDTO routeHeaderVO) throws WorkflowException { |
44 | 0 | incomingParamCheck(routeHeaderVO, "routeHeaderVO"); |
45 | 0 | Long documentId = routeHeaderVO.getRouteHeaderId(); |
46 | 0 | LOG.debug("Initializing Document from incoming RouteHeaderVO [docId=" + documentId + "]"); |
47 | 0 | KEWServiceLocator.getRouteHeaderService().lockRouteHeader(documentId, true); |
48 | |
|
49 | |
|
50 | 0 | DTOConverter.updateNotes(routeHeaderVO, routeHeaderVO.getRouteHeaderId()); |
51 | |
|
52 | 0 | DocumentRouteHeaderValue document = KEWServiceLocator.getRouteHeaderService().getRouteHeader(documentId); |
53 | 0 | document.setRouteHeaderData(routeHeaderVO); |
54 | |
|
55 | 0 | KEWServiceLocator.getRouteHeaderService().saveRouteHeader(document); |
56 | |
|
57 | |
|
58 | |
|
59 | |
|
60 | |
|
61 | |
|
62 | |
|
63 | |
|
64 | |
|
65 | |
|
66 | |
|
67 | |
|
68 | |
|
69 | 0 | this.saveRouteNodeInstances(document); |
70 | |
|
71 | 0 | return document; |
72 | |
} |
73 | |
|
74 | |
|
75 | |
|
76 | |
|
77 | |
|
78 | |
|
79 | |
|
80 | |
private void saveRouteNodeInstances(DocumentRouteHeaderValue routeHeader){ |
81 | |
|
82 | 0 | List<RouteNodeInstance> routeNodes = routeHeader.getInitialRouteNodeInstances(); |
83 | 0 | if(routeNodes != null && !routeNodes.isEmpty()){ |
84 | 0 | for(RouteNodeInstance rni: routeNodes){ |
85 | 0 | KEWServiceLocator.getRouteNodeService().save(rni); |
86 | |
} |
87 | |
} |
88 | |
|
89 | 0 | } |
90 | |
|
91 | |
private void init(Long documentId) throws WorkflowException { |
92 | 0 | incomingParamCheck(documentId, "documentId"); |
93 | 0 | LOG.debug("Initializing Document from incoming Document ID [docId=" + documentId + "]"); |
94 | 0 | KEWServiceLocator.getRouteHeaderService().lockRouteHeader(documentId, true); |
95 | 0 | } |
96 | |
|
97 | |
private void incomingParamCheck(Object object, String name) { |
98 | 0 | if (object == null) { |
99 | 0 | LOG.error("null " + name + " passed in."); |
100 | 0 | throw new RuntimeException("null " + name + " passed in."); |
101 | |
} |
102 | 0 | } |
103 | |
|
104 | |
public RouteHeaderDTO releaseGroupAuthority(String principalId, RouteHeaderDTO routeHeaderVO, String groupId, String annotation) throws WorkflowException { |
105 | 0 | DocumentRouteHeaderValue routeHeader = init(routeHeaderVO); |
106 | 0 | incomingParamCheck(principalId, "principalId"); |
107 | 0 | LOG.debug("Releasing group authority [principalId=" + principalId + ", docId=" + routeHeaderVO.getRouteHeaderId() + ", groupId=" + groupId + ", annotation=" + annotation + "]"); |
108 | 0 | routeHeader = KEWServiceLocator.getWorkflowDocumentService().releaseGroupAuthority(principalId, routeHeader, groupId, annotation); |
109 | 0 | return DTOConverter.convertRouteHeader(routeHeader, principalId); |
110 | |
} |
111 | |
|
112 | |
public RouteHeaderDTO takeGroupAuthority(String principalId, RouteHeaderDTO routeHeaderVO, String groupId, String annotation) throws WorkflowException { |
113 | 0 | DocumentRouteHeaderValue routeHeader = init(routeHeaderVO); |
114 | 0 | incomingParamCheck(principalId, "principalId"); |
115 | 0 | LOG.debug("Taking workgroup authority [principalId=" + principalId + ", docId=" + routeHeaderVO.getRouteHeaderId() + ", groupInfo=" + groupId + ", annotation=" + annotation + "]"); |
116 | 0 | routeHeader = KEWServiceLocator.getWorkflowDocumentService().takeGroupAuthority(principalId, routeHeader, groupId, annotation); |
117 | 0 | return DTOConverter.convertRouteHeader(routeHeader, principalId); |
118 | |
} |
119 | |
|
120 | |
public RouteHeaderDTO acknowledgeDocument(String principalId, RouteHeaderDTO routeHeaderVO, String annotation) throws WorkflowException { |
121 | 0 | DocumentRouteHeaderValue routeHeader = init(routeHeaderVO); |
122 | 0 | incomingParamCheck(principalId, "principalId"); |
123 | 0 | LOG.debug("Acknowledge [principalId=" + principalId + ", docId=" + routeHeaderVO.getRouteHeaderId() + ", annotation=" + annotation + "]"); |
124 | 0 | routeHeader = KEWServiceLocator.getWorkflowDocumentService().acknowledgeDocument(principalId, routeHeader, annotation); |
125 | 0 | return DTOConverter.convertRouteHeader(routeHeader, principalId); |
126 | |
} |
127 | |
|
128 | |
public RouteHeaderDTO approveDocument(String principalId, RouteHeaderDTO routeHeaderVO, String annotation) throws WorkflowException { |
129 | 0 | DocumentRouteHeaderValue routeHeader = init(routeHeaderVO); |
130 | 0 | incomingParamCheck(principalId, "principalId"); |
131 | 0 | LOG.debug("Approve [principalId=" + principalId + ", docId=" + routeHeaderVO.getRouteHeaderId() + ", annotation=" + annotation + "]"); |
132 | 0 | routeHeader = KEWServiceLocator.getWorkflowDocumentService().approveDocument(principalId, routeHeader, annotation); |
133 | 0 | return DTOConverter.convertRouteHeader(routeHeader, principalId); |
134 | |
} |
135 | |
|
136 | |
public RouteHeaderDTO adHocRouteDocumentToPrincipal(String principalId, RouteHeaderDTO routeHeaderVO, String actionRequested, String nodeName, String annotation, String recipientPrincipalId, String responsibilityDesc, boolean forceAction, String requestLabel) throws WorkflowException { |
137 | 0 | DocumentRouteHeaderValue routeHeader = init(routeHeaderVO); |
138 | 0 | incomingParamCheck(principalId, "principalId"); |
139 | 0 | incomingParamCheck(actionRequested, "actionRequested"); |
140 | |
|
141 | 0 | incomingParamCheck(recipientPrincipalId, "recipientPrincipalId"); |
142 | 0 | LOG.debug("AdHoc Route [principalId=" + principalId + ", docId=" + routeHeaderVO.getRouteHeaderId() + ", actionRequest=" + actionRequested + ", nodeName=" + nodeName + ", recipientPrincipalId=" + recipientPrincipalId + ", forceAction=" + forceAction + ", annotation="+annotation + ", requestLabel="+requestLabel+"]"); |
143 | 0 | routeHeader = KEWServiceLocator.getWorkflowDocumentService().adHocRouteDocumentToPrincipal(principalId, routeHeader, actionRequested, nodeName, annotation, recipientPrincipalId, responsibilityDesc, new Boolean(forceAction), requestLabel); |
144 | 0 | return DTOConverter.convertRouteHeader(routeHeader, principalId); |
145 | |
} |
146 | |
|
147 | |
public RouteHeaderDTO adHocRouteDocumentToGroup(String principalId, RouteHeaderDTO routeHeaderVO, String actionRequested, String nodeName, String annotation, String recipientGroupId, String responsibilityDesc, boolean forceAction, String requestLabel) throws WorkflowException { |
148 | 0 | DocumentRouteHeaderValue routeHeader = init(routeHeaderVO); |
149 | 0 | incomingParamCheck(principalId, "principalId"); |
150 | 0 | incomingParamCheck(actionRequested, "actionRequested"); |
151 | |
|
152 | 0 | incomingParamCheck(recipientGroupId, "recipientGroupId"); |
153 | 0 | LOG.debug("AdHoc Route [principalId=" + principalId + ", docId=" + routeHeaderVO.getRouteHeaderId() + ", actionRequest=" + actionRequested + ", nodeName=" + nodeName + ", recipientGroupId=" + recipientGroupId + ", forceAction=" + forceAction + ", annotation="+annotation+"]"); |
154 | 0 | routeHeader = KEWServiceLocator.getWorkflowDocumentService().adHocRouteDocumentToGroup(principalId, routeHeader, actionRequested, nodeName, annotation, recipientGroupId, responsibilityDesc, new Boolean(forceAction), requestLabel); |
155 | 0 | return DTOConverter.convertRouteHeader(routeHeader, principalId); |
156 | |
} |
157 | |
|
158 | |
public RouteHeaderDTO blanketApproval(String principalId, RouteHeaderDTO routeHeaderVO, String annotation, Integer routeLevel) throws WorkflowException { |
159 | 0 | DocumentRouteHeaderValue routeHeader = init(routeHeaderVO); |
160 | 0 | incomingParamCheck(principalId, "principalId"); |
161 | 0 | LOG.debug("Blanket Approve [principalId=" + principalId + ", docId=" + routeHeaderVO.getRouteHeaderId() + ", annotation=" + annotation + ", routeLevel=" + routeLevel + "]"); |
162 | 0 | routeHeader = KEWServiceLocator.getWorkflowDocumentService().blanketApproval(principalId, routeHeader, annotation, routeLevel); |
163 | 0 | return DTOConverter.convertRouteHeader(routeHeader, principalId); |
164 | |
} |
165 | |
|
166 | |
public RouteHeaderDTO blanketApprovalToNodes(String principalId, RouteHeaderDTO routeHeaderVO, String annotation, String[] nodeNames) throws WorkflowException { |
167 | 0 | DocumentRouteHeaderValue routeHeader = init(routeHeaderVO); |
168 | 0 | incomingParamCheck(principalId, "principalId"); |
169 | 0 | LOG.debug("Blanket Approve [principalId=" + principalId + ", docId=" + routeHeaderVO.getRouteHeaderId() + ", annotation=" + annotation + ", nodeNames=" + ArrayUtils.toString(nodeNames) + "]"); |
170 | 0 | Set nodeNameSet = Utilities.asSet(nodeNames); |
171 | 0 | routeHeader = KEWServiceLocator.getWorkflowDocumentService().blanketApproval(principalId, routeHeader, annotation, nodeNameSet); |
172 | 0 | return DTOConverter.convertRouteHeader(routeHeader, principalId); |
173 | |
} |
174 | |
|
175 | |
|
176 | |
public RouteHeaderDTO cancelDocument(String principalId, RouteHeaderDTO routeHeaderVO, String annotation) throws WorkflowException { |
177 | 0 | DocumentRouteHeaderValue routeHeader = init(routeHeaderVO); |
178 | 0 | incomingParamCheck(principalId, "principalId"); |
179 | 0 | LOG.debug("Cancel [principalId=" + principalId + ", docId=" + routeHeaderVO.getRouteHeaderId() + ", annotation=" + annotation + "]"); |
180 | 0 | routeHeader = KEWServiceLocator.getWorkflowDocumentService().cancelDocument(principalId, routeHeader, annotation); |
181 | 0 | return DTOConverter.convertRouteHeader(routeHeader, principalId); |
182 | |
} |
183 | |
|
184 | |
public RouteHeaderDTO clearFYIDocument(String principalId, RouteHeaderDTO routeHeaderVO) throws WorkflowException { |
185 | 0 | DocumentRouteHeaderValue routeHeader = init(routeHeaderVO); |
186 | 0 | incomingParamCheck(principalId, "principalId"); |
187 | 0 | LOG.debug("Clear FYI [principalId=" + principalId + ", docId=" + routeHeaderVO.getRouteHeaderId() + "]"); |
188 | 0 | routeHeader = KEWServiceLocator.getWorkflowDocumentService().clearFYIDocument(principalId, routeHeader); |
189 | 0 | return DTOConverter.convertRouteHeader(routeHeader, principalId); |
190 | |
} |
191 | |
|
192 | |
public RouteHeaderDTO completeDocument(String principalId, RouteHeaderDTO routeHeaderVO, String annotation) throws WorkflowException { |
193 | 0 | DocumentRouteHeaderValue routeHeader = init(routeHeaderVO); |
194 | 0 | incomingParamCheck(principalId, "principalId"); |
195 | 0 | LOG.debug("Complete [principalId=" + principalId + ", docId=" + routeHeaderVO.getRouteHeaderId() + ", annotation=" + annotation + "]"); |
196 | 0 | routeHeader = KEWServiceLocator.getWorkflowDocumentService().completeDocument(principalId, routeHeader, annotation); |
197 | 0 | return DTOConverter.convertRouteHeader(routeHeader, principalId); |
198 | |
} |
199 | |
|
200 | |
public RouteHeaderDTO createDocument(String principalId, RouteHeaderDTO routeHeaderVO) throws WorkflowException { |
201 | 0 | incomingParamCheck(principalId, "principalId"); |
202 | 0 | incomingParamCheck(routeHeaderVO, "routeHeaderVO"); |
203 | 0 | LOG.debug("Create Document [principalId=" + principalId + ", docTypeName=" + routeHeaderVO.getDocTypeName() + "]"); |
204 | 0 | DocumentRouteHeaderValue routeHeader = DTOConverter.convertRouteHeaderVO(routeHeaderVO); |
205 | 0 | routeHeader.setInitiatorWorkflowId(principalId); |
206 | 0 | routeHeader = KEWServiceLocator.getWorkflowDocumentService().createDocument(principalId, routeHeader); |
207 | |
|
208 | |
|
209 | 0 | DTOConverter.updateNotes(routeHeaderVO, routeHeader.getRouteHeaderId()); |
210 | |
|
211 | 0 | return DTOConverter.convertRouteHeader(routeHeader, principalId); |
212 | |
} |
213 | |
|
214 | |
public RouteHeaderDTO disapproveDocument(String principalId, RouteHeaderDTO routeHeaderVO, String annotation) throws WorkflowException { |
215 | 0 | DocumentRouteHeaderValue routeHeader = init(routeHeaderVO); |
216 | 0 | incomingParamCheck(principalId, "principalId"); |
217 | 0 | LOG.debug("Disapprove [principalId=" + principalId + ", docId=" + routeHeaderVO.getRouteHeaderId() + ", annotation=" + annotation + "]"); |
218 | 0 | routeHeader = KEWServiceLocator.getWorkflowDocumentService().disapproveDocument(principalId, routeHeader, annotation); |
219 | 0 | return DTOConverter.convertRouteHeader(routeHeader, principalId); |
220 | |
} |
221 | |
|
222 | |
public RouteHeaderDTO returnDocumentToPreviousRouteLevel(String principalId, RouteHeaderDTO routeHeaderVO, Integer destRouteLevel, String annotation) throws WorkflowException { |
223 | 0 | DocumentRouteHeaderValue routeHeader = init(routeHeaderVO); |
224 | 0 | incomingParamCheck(principalId, "principalId"); |
225 | 0 | incomingParamCheck(destRouteLevel, "destRouteLevel"); |
226 | 0 | LOG.debug("Return to Previous [principalId=" + principalId + ", docId=" + routeHeaderVO.getRouteHeaderId() + ", annotation=" + annotation + ", destRouteLevel=" + destRouteLevel + "]"); |
227 | 0 | routeHeader = KEWServiceLocator.getWorkflowDocumentService().returnDocumentToPreviousRouteLevel(principalId, routeHeader, destRouteLevel, annotation); |
228 | 0 | return DTOConverter.convertRouteHeader(routeHeader, principalId); |
229 | |
} |
230 | |
|
231 | |
public RouteHeaderDTO returnDocumentToPreviousNode(String principalId, RouteHeaderDTO routeHeaderVO, ReturnPointDTO returnPoint, String annotation) throws WorkflowException { |
232 | 0 | DocumentRouteHeaderValue routeHeader = init(routeHeaderVO); |
233 | 0 | incomingParamCheck(principalId, "principalId"); |
234 | 0 | incomingParamCheck(returnPoint, "returnPoint"); |
235 | 0 | LOG.debug("Return to Previous [principalId=" + principalId + ", docId=" + routeHeaderVO.getRouteHeaderId() + ", annotation=" + annotation + ", destNodeName=" + returnPoint.getNodeName() + "]"); |
236 | 0 | routeHeader = KEWServiceLocator.getWorkflowDocumentService().returnDocumentToPreviousNode(principalId, routeHeader, returnPoint.getNodeName(), annotation); |
237 | 0 | return DTOConverter.convertRouteHeader(routeHeader, principalId); |
238 | |
} |
239 | |
|
240 | |
public RouteHeaderDTO routeDocument(String principalId, RouteHeaderDTO routeHeaderVO, String annotation) throws WorkflowException { |
241 | 0 | DocumentRouteHeaderValue routeHeader = init(routeHeaderVO); |
242 | 0 | incomingParamCheck(principalId, "principalId"); |
243 | 0 | LOG.debug("Route Document [principalId=" + principalId + ", docId=" + routeHeaderVO.getRouteHeaderId() + ", annotation=" + annotation + "]"); |
244 | 0 | routeHeader = KEWServiceLocator.getWorkflowDocumentService().routeDocument(principalId, routeHeader, annotation); |
245 | 0 | return DTOConverter.convertRouteHeader(routeHeader, principalId); |
246 | |
} |
247 | |
|
248 | |
public RouteHeaderDTO saveRoutingData(String principalId, RouteHeaderDTO routeHeaderVO) throws WorkflowException { |
249 | 0 | DocumentRouteHeaderValue routeHeader = init(routeHeaderVO); |
250 | 0 | incomingParamCheck(principalId, "principalId"); |
251 | 0 | LOG.debug("Saving Routing Data [principalId=" + principalId + ", docId=" + routeHeaderVO.getRouteHeaderId() + "]"); |
252 | 0 | routeHeader = KEWServiceLocator.getWorkflowDocumentService().saveRoutingData(principalId, routeHeader); |
253 | 0 | return DTOConverter.convertRouteHeader(routeHeader, principalId); |
254 | |
} |
255 | |
|
256 | |
public RouteHeaderDTO saveDocument(String principalId, RouteHeaderDTO routeHeaderVO, String annotation) throws WorkflowException { |
257 | 0 | DocumentRouteHeaderValue routeHeader = init(routeHeaderVO); |
258 | 0 | incomingParamCheck(principalId, "principalId"); |
259 | 0 | LOG.debug("Save Document [principalId=" + principalId + ", docId=" + routeHeaderVO.getRouteHeaderId() + ", annotation=" + annotation + "]"); |
260 | 0 | routeHeader = KEWServiceLocator.getWorkflowDocumentService().saveDocument(principalId, routeHeader, annotation); |
261 | 0 | return DTOConverter.convertRouteHeader(routeHeader, principalId); |
262 | |
} |
263 | |
|
264 | |
public void deleteDocument(String principalId, RouteHeaderDTO routeHeaderVO) throws WorkflowException { |
265 | 0 | DocumentRouteHeaderValue routeHeader = init(routeHeaderVO); |
266 | 0 | incomingParamCheck(principalId, "principalId"); |
267 | 0 | LOG.debug("Delete [principalId=" + principalId + ", docId=" + routeHeaderVO.getRouteHeaderId() + "]"); |
268 | 0 | KEWServiceLocator.getWorkflowDocumentService().deleteDocument(principalId, routeHeader); |
269 | 0 | } |
270 | |
|
271 | |
public void logDocumentAction(String principalId, RouteHeaderDTO routeHeaderVO, String annotation) throws WorkflowException { |
272 | 0 | DocumentRouteHeaderValue routeHeader = init(routeHeaderVO); |
273 | 0 | incomingParamCheck(principalId, "principalId"); |
274 | 0 | LOG.debug("Log [principalId=" + principalId + ", docId=" + routeHeaderVO.getRouteHeaderId() + ", annotation=" + annotation + "]"); |
275 | 0 | KEWServiceLocator.getWorkflowDocumentService().logDocumentAction(principalId, routeHeader, annotation); |
276 | 0 | } |
277 | |
|
278 | |
public RouteHeaderDTO moveDocument(String principalId, RouteHeaderDTO routeHeaderVO, MovePointDTO movePoint, String annotation) throws WorkflowException { |
279 | 0 | DocumentRouteHeaderValue routeHeader = init(routeHeaderVO); |
280 | 0 | incomingParamCheck(principalId, "principalId"); |
281 | 0 | LOG.debug("Move [principalId=" + principalId + ", docId=" + routeHeaderVO.getRouteHeaderId() + ", annotation=" + annotation + ", startNode=" + movePoint.getStartNodeName() + "steps=" + movePoint.getStepsToMove() + "]"); |
282 | 0 | routeHeader = KEWServiceLocator.getWorkflowDocumentService().moveDocument(principalId, routeHeader, DTOConverter.convertMovePointVO(movePoint), annotation); |
283 | 0 | return DTOConverter.convertRouteHeader(routeHeader, principalId); |
284 | |
} |
285 | |
|
286 | |
public RouteHeaderDTO revokeAdHocRequests(String principalId, RouteHeaderDTO routeHeaderVO, AdHocRevokeDTO revoke, String annotation) throws WorkflowException { |
287 | 0 | DocumentRouteHeaderValue routeHeader = init(routeHeaderVO); |
288 | 0 | incomingParamCheck(principalId, "principalId"); |
289 | 0 | LOG.debug("Revoke AdHoc [principalId=" + principalId + ", docId=" + routeHeaderVO.getRouteHeaderId() + ", annotation=" + annotation + "]"); |
290 | 0 | routeHeader = KEWServiceLocator.getWorkflowDocumentService().revokeAdHocRequests(principalId, routeHeader, DTOConverter.convertAdHocRevokeVO(revoke), annotation); |
291 | 0 | return DTOConverter.convertRouteHeader(routeHeader, principalId); |
292 | |
} |
293 | |
|
294 | |
public RouteHeaderDTO superUserApprove(String principalId, RouteHeaderDTO routeHeaderVO, String annotation, boolean runPostProcessor) throws WorkflowException { |
295 | 0 | DocumentRouteHeaderValue routeHeader = init(routeHeaderVO); |
296 | 0 | incomingParamCheck(principalId, "principalId"); |
297 | 0 | LOG.debug("SU Approve [principalId=" + principalId + ", docId=" + routeHeaderVO.getRouteHeaderId() + ", annotation=" + annotation + "]"); |
298 | 0 | routeHeader = KEWServiceLocator.getWorkflowDocumentService().superUserApprove(principalId, routeHeader, annotation, runPostProcessor); |
299 | 0 | return DTOConverter.convertRouteHeader(routeHeader, principalId); |
300 | |
} |
301 | |
|
302 | |
public RouteHeaderDTO superUserApprove(String principalId, RouteHeaderDTO routeHeaderVO, String annotation) throws WorkflowException { |
303 | 0 | return superUserApprove(principalId, routeHeaderVO, annotation, true); |
304 | |
} |
305 | |
|
306 | |
public RouteHeaderDTO superUserActionRequestApprove(String principalId, RouteHeaderDTO routeHeaderVO, Long actionRequestId, String annotation) throws WorkflowException { |
307 | 0 | DocumentRouteHeaderValue routeHeader = init(routeHeaderVO); |
308 | 0 | incomingParamCheck(principalId, "principalId"); |
309 | 0 | LOG.debug("SU Cancel [principalId=" + principalId + ", docId=" + routeHeaderVO.getRouteHeaderId() + ", annotation=" + annotation + "]"); |
310 | 0 | routeHeader = KEWServiceLocator.getWorkflowDocumentService().superUserActionRequestApproveAction(principalId, routeHeader, actionRequestId, annotation, true); |
311 | 0 | return DTOConverter.convertRouteHeader(routeHeader, principalId); |
312 | |
} |
313 | |
|
314 | |
public RouteHeaderDTO superUserDisapprove(String principalId, RouteHeaderDTO routeHeaderVO, String annotation, boolean runPostProcessor) throws WorkflowException { |
315 | 0 | DocumentRouteHeaderValue routeHeader = init(routeHeaderVO); |
316 | 0 | incomingParamCheck(principalId, "principalId"); |
317 | 0 | LOG.debug("SU Disapprove [principalId=" + principalId + ", docId=" + routeHeaderVO.getRouteHeaderId() + ", annotation=" + annotation + "]"); |
318 | 0 | routeHeader = KEWServiceLocator.getWorkflowDocumentService().superUserDisapproveAction(principalId, routeHeader, annotation, runPostProcessor); |
319 | 0 | return DTOConverter.convertRouteHeader(routeHeader, principalId); |
320 | |
} |
321 | |
|
322 | |
public RouteHeaderDTO superUserDisapprove(String principalId, RouteHeaderDTO routeHeaderVO, String annotation) throws WorkflowException { |
323 | 0 | return superUserDisapprove(principalId, routeHeaderVO, annotation, true); |
324 | |
} |
325 | |
|
326 | |
public RouteHeaderDTO superUserCancel(String principalId, RouteHeaderDTO routeHeaderVO, String annotation, boolean runPostProcessor) throws WorkflowException { |
327 | 0 | DocumentRouteHeaderValue routeHeader = init(routeHeaderVO); |
328 | 0 | incomingParamCheck(principalId, "principalId"); |
329 | 0 | LOG.debug("SU Cancel [principalId=" + principalId + ", docId=" + routeHeaderVO.getRouteHeaderId() + ", annotation=" + annotation + "]"); |
330 | 0 | routeHeader = KEWServiceLocator.getWorkflowDocumentService().superUserCancelAction(principalId, routeHeader, annotation, runPostProcessor); |
331 | 0 | return DTOConverter.convertRouteHeader(routeHeader, principalId); |
332 | |
} |
333 | |
|
334 | |
public RouteHeaderDTO superUserCancel(String principalId, RouteHeaderDTO routeHeaderVO, String annotation) throws WorkflowException { |
335 | 0 | return superUserCancel(principalId, routeHeaderVO, annotation, true); |
336 | |
} |
337 | |
|
338 | |
public RouteHeaderDTO placeInExceptionRouting(String principalId, RouteHeaderDTO routeHeaderVO, String annotation) throws WorkflowException { |
339 | 0 | DocumentRouteHeaderValue routeHeader = init(routeHeaderVO); |
340 | 0 | incomingParamCheck(principalId, "principalId"); |
341 | 0 | LOG.debug("placeInExceptionRouting [principalId=" + principalId + ", docId=" + routeHeaderVO.getRouteHeaderId() + ", annotation=" + annotation + "]"); |
342 | 0 | routeHeader = KEWServiceLocator.getWorkflowDocumentService().placeInExceptionRouting(principalId, routeHeader, annotation); |
343 | 0 | return DTOConverter.convertRouteHeader(routeHeader, principalId); |
344 | |
} |
345 | |
|
346 | |
public DocumentContentDTO saveDocumentContent(DocumentContentDTO documentContent) throws WorkflowException { |
347 | 0 | incomingParamCheck(documentContent, "documentContent"); |
348 | 0 | Long documentId = documentContent.getRouteHeaderId(); |
349 | 0 | incomingParamCheck(documentId, "documentContent document ID"); |
350 | 0 | KEWServiceLocator.getRouteHeaderService().lockRouteHeader(documentId, true); |
351 | 0 | DocumentRouteHeaderValue document = KEWServiceLocator.getRouteHeaderService().getRouteHeader(documentId); |
352 | 0 | LOG.debug("Saving Document Content [documentId=" + documentId + "]"); |
353 | 0 | String updatedDocumentContent = DTOConverter.buildUpdatedDocumentContent(documentContent); |
354 | |
|
355 | 0 | if (updatedDocumentContent != null) { |
356 | 0 | document.setDocContent(updatedDocumentContent); |
357 | 0 | KEWServiceLocator.getRouteHeaderService().saveRouteHeader(document); |
358 | |
} |
359 | 0 | return DTOConverter.convertDocumentContent(document.getDocContent(), documentId); |
360 | |
} |
361 | |
|
362 | |
public void superUserNodeApproveAction(String principalId, Long documentId, String nodeName, String annotation, boolean runPostProcessor) throws WorkflowException { |
363 | 0 | init(documentId); |
364 | 0 | incomingParamCheck(principalId, "principalId"); |
365 | 0 | LOG.debug("SU Node Approve Action [principalId=" + principalId + ", docId=" + documentId + ", nodeName=" + nodeName + ", annotation=" + annotation + "]"); |
366 | 0 | KEWServiceLocator.getWorkflowDocumentService().superUserNodeApproveAction(principalId, documentId, nodeName, annotation, runPostProcessor); |
367 | 0 | } |
368 | |
|
369 | |
public void superUserNodeApproveAction(String principalId, Long documentId, String nodeName, String annotation) throws WorkflowException { |
370 | 0 | superUserNodeApproveAction(principalId, documentId, nodeName, annotation, true); |
371 | 0 | } |
372 | |
|
373 | |
public void superUserActionRequestApproveAction(String principalId, Long documentId, Long actionRequestId, String annotation, boolean runPostProcessor) throws WorkflowException { |
374 | 0 | init(documentId); |
375 | 0 | incomingParamCheck(principalId, "principalId"); |
376 | 0 | LOG.debug("SU Action Request Approve [principalId=" + principalId + ", docId=" + documentId + ", actionRequestId=" + actionRequestId + ", annotation=" + annotation + "]"); |
377 | 0 | DocumentRouteHeaderValue document = KEWServiceLocator.getRouteHeaderService().getRouteHeader(documentId); |
378 | 0 | document = KEWServiceLocator.getWorkflowDocumentService().superUserActionRequestApproveAction(principalId, document, actionRequestId, annotation, runPostProcessor); |
379 | 0 | } |
380 | |
|
381 | |
public void superUserActionRequestApproveAction(String principalId, Long documentId, Long actionRequestId, String annotation) throws WorkflowException { |
382 | 0 | superUserActionRequestApproveAction(principalId, documentId, actionRequestId, annotation, true); |
383 | 0 | } |
384 | |
|
385 | |
public void superUserReturnToPreviousNode(String principalId, Long documentId, String destinationNodeName, String annotation, boolean runPostProcessor) throws WorkflowException { |
386 | 0 | init(documentId); |
387 | 0 | incomingParamCheck(principalId, "principalId"); |
388 | 0 | LOG.debug("SU Cancel [principalId=" + principalId + ", docId=" + documentId + ", destinationNodeName=" + destinationNodeName + ", annotation=" + annotation + "]"); |
389 | 0 | KEWServiceLocator.getWorkflowDocumentService().superUserReturnDocumentToPreviousNode(principalId, documentId, destinationNodeName, annotation, runPostProcessor); |
390 | 0 | } |
391 | |
|
392 | |
public void superUserReturnToPreviousNode(String principalId, Long documentId, String destinationNodeName, String annotation) throws WorkflowException { |
393 | 0 | superUserReturnToPreviousNode(principalId, documentId, destinationNodeName, annotation, true); |
394 | 0 | } |
395 | |
|
396 | |
|
397 | |
|
398 | |
|
399 | |
|
400 | |
|
401 | |
public void indexDocument(Long documentId) { |
402 | 0 | SearchableAttributeProcessingService searchableAttService = (SearchableAttributeProcessingService) MessageServiceNames.getSearchableAttributeService(KEWServiceLocator.getRouteHeaderService().getRouteHeader(documentId)); |
403 | 0 | searchableAttService.indexDocument(documentId); |
404 | 0 | } |
405 | |
|
406 | |
} |