1 | |
package org.kuali.student.core.workflow.ui.server.gwt; |
2 | |
|
3 | |
import com.google.gwt.user.server.rpc.RemoteServiceServlet; |
4 | |
import org.apache.commons.lang.StringUtils; |
5 | |
import org.apache.log4j.Logger; |
6 | |
import org.kuali.rice.kew.api.action.ActionRequestType; |
7 | |
import org.kuali.rice.kew.api.action.DocumentActionParameters; |
8 | |
import org.kuali.rice.kew.api.action.ReturnPoint; |
9 | |
import org.kuali.rice.kew.api.action.WorkflowDocumentActionsService; |
10 | |
import org.kuali.rice.kew.api.doctype.DocumentType; |
11 | |
import org.kuali.rice.kew.api.doctype.DocumentTypeService; |
12 | |
import org.kuali.rice.kew.api.document.*; |
13 | |
import org.kuali.rice.kew.api.document.node.RouteNodeInstance; |
14 | |
import org.kuali.rice.kew.api.exception.WorkflowException; |
15 | |
import org.kuali.rice.kew.api.KewApiConstants; |
16 | |
import org.kuali.rice.kim.api.identity.IdentityService; |
17 | |
import org.kuali.rice.kim.api.identity.principal.Principal; |
18 | |
import org.kuali.rice.kim.api.permission.PermissionService; |
19 | |
import org.kuali.student.common.rice.StudentIdentityConstants; |
20 | |
import org.kuali.student.common.rice.authorization.PermissionType; |
21 | |
import org.kuali.student.common.ui.client.service.exceptions.OperationFailedException; |
22 | |
import org.kuali.student.common.util.security.SecurityUtils; |
23 | |
import org.kuali.student.core.rice.authorization.CollaboratorHelper; |
24 | |
import org.kuali.student.core.workflow.ui.client.service.WorkflowRpcService; |
25 | |
|
26 | |
import java.util.*; |
27 | |
import java.util.logging.Level; |
28 | |
|
29 | 0 | public class WorkflowRpcGwtServlet extends RemoteServiceServlet implements WorkflowRpcService { |
30 | |
|
31 | |
private static final long serialVersionUID = 1L; |
32 | |
|
33 | 0 | final Logger LOG = Logger.getLogger(WorkflowRpcGwtServlet.class); |
34 | |
|
35 | |
private WorkflowDocumentActionsService workflowDocumentActionsService; |
36 | |
private WorkflowDocumentService workflowDocumentService; |
37 | |
private DocumentTypeService workflowDocumentTypeService; |
38 | |
private IdentityService identityService; |
39 | |
private PermissionService permissionService; |
40 | |
private CollaboratorHelper collaboratorHelper; |
41 | |
|
42 | |
public static final String WORKFLOW_DOCUMENT_ACTION_ACKNOWLEGE = "Acknowlege"; |
43 | |
public static final String WORKFLOW_DOCUMENT_ACTION_APPROVE = "Approve"; |
44 | |
public static final String WORKFLOW_DOCUMENT_ACTION_BLANKET_APPROVE = "Blanket Approve"; |
45 | |
public static final String WORKFLOW_DOCUMENT_ACTION_CANCEL = "Cancel"; |
46 | |
public static final String WORKFLOW_DOCUMENT_ACTION_DISAPPROVE = "Disapprove"; |
47 | |
public static final String WORKFLOW_DOCUMENT_ACTION_FYI = "FYI"; |
48 | |
public static final String WORKFLOW_DOCUMENT_ACTION_RETURN = "Return"; |
49 | |
public static final String WORKFLOW_DOCUMENT_ACTION_SUBMIT = "Submit"; |
50 | |
public static final String WORKFLOW_DOCUMENT_ACTION_WITHDRAW = "Withdraw"; |
51 | |
|
52 | |
|
53 | |
|
54 | |
|
55 | |
public Boolean performWorkflowDocumentAction(String action, String workflowId, String targetNodeName) throws OperationFailedException { |
56 | |
try{ |
57 | 0 | String annotation = action; |
58 | |
|
59 | |
|
60 | 0 | String username = SecurityUtils.getCurrentUserId(); |
61 | |
|
62 | |
|
63 | 0 | if (StringUtils.equals(action,WORKFLOW_DOCUMENT_ACTION_WITHDRAW)) { |
64 | 0 | Principal systemPrincipal = null; |
65 | |
try { |
66 | 0 | systemPrincipal = getIdentityService().getPrincipalByPrincipalName(StudentIdentityConstants.SYSTEM_USER_PRINCIPAL_NAME); |
67 | 0 | } catch (OperationFailedException ex) { |
68 | 0 | java.util.logging.Logger.getLogger(WorkflowRpcGwtServlet.class.getName()).log(Level.SEVERE, null, ex); |
69 | 0 | } |
70 | 0 | if (systemPrincipal == null) { |
71 | 0 | throw new RuntimeException("Cannot find principal for system user principal name: " + StudentIdentityConstants.SYSTEM_USER_PRINCIPAL_NAME); |
72 | |
} |
73 | 0 | annotation = action + " Document performed as SuperUser by " + username; |
74 | 0 | username = systemPrincipal.getPrincipalId(); |
75 | |
} |
76 | |
|
77 | |
|
78 | 0 | DocumentActionParameters.Builder dapBuilder = DocumentActionParameters.Builder.create(workflowId, username); |
79 | |
|
80 | |
|
81 | 0 | if (StringUtils.equals(action,WORKFLOW_DOCUMENT_ACTION_SUBMIT)) { |
82 | |
|
83 | 0 | DocumentDetail docDetail = getWorkflowDocumentService().getDocumentDetail(workflowId); |
84 | 0 | if(docDetail==null){ |
85 | 0 | throw new OperationFailedException("Error found getting document. " ); |
86 | |
} |
87 | 0 | DocumentContent docContent = workflowDocumentService.getDocumentContent(workflowId); |
88 | 0 | DocumentUpdate docUpdate = DocumentUpdate.Builder.create(docDetail.getDocument()).build(); |
89 | 0 | dapBuilder.setDocumentUpdate(docUpdate); |
90 | 0 | DocumentContentUpdate docContentUpdate = DocumentContentUpdate.Builder.create(docContent).build(); |
91 | 0 | dapBuilder.setDocumentContentUpdate(docContentUpdate); |
92 | |
} |
93 | 0 | dapBuilder.setAnnotation(annotation); |
94 | 0 | DocumentActionParameters docActionParams = dapBuilder.build(); |
95 | |
|
96 | 0 | if(StringUtils.equals(action,WORKFLOW_DOCUMENT_ACTION_ACKNOWLEGE)) { |
97 | 0 | getWorkflowDocumentActionsService().acknowledge(docActionParams); |
98 | 0 | } else if (StringUtils.equals(action,WORKFLOW_DOCUMENT_ACTION_APPROVE)) { |
99 | 0 | getWorkflowDocumentActionsService().approve(docActionParams); |
100 | 0 | } else if (StringUtils.equals(action,WORKFLOW_DOCUMENT_ACTION_BLANKET_APPROVE)) { |
101 | 0 | getWorkflowDocumentActionsService().blanketApprove(docActionParams); |
102 | 0 | } else if (StringUtils.equals(action,WORKFLOW_DOCUMENT_ACTION_CANCEL)) { |
103 | 0 | getWorkflowDocumentActionsService().cancel(docActionParams); |
104 | 0 | } else if (StringUtils.equals(action,WORKFLOW_DOCUMENT_ACTION_DISAPPROVE)) { |
105 | 0 | getWorkflowDocumentActionsService().disapprove(docActionParams); |
106 | 0 | } else if (StringUtils.equals(action,WORKFLOW_DOCUMENT_ACTION_FYI)) { |
107 | 0 | getWorkflowDocumentActionsService().clearFyi(docActionParams); |
108 | 0 | } else if (StringUtils.equals(action,WORKFLOW_DOCUMENT_ACTION_RETURN)) { |
109 | 0 | ReturnPoint returnPoint = ReturnPoint.create(targetNodeName); |
110 | 0 | getWorkflowDocumentActionsService().returnToPreviousNode(docActionParams, returnPoint); |
111 | 0 | } else if (StringUtils.equals(action,WORKFLOW_DOCUMENT_ACTION_WITHDRAW)) { |
112 | 0 | getWorkflowDocumentActionsService().superUserDisapprove(docActionParams,true); |
113 | |
} else { |
114 | 0 | throw new OperationFailedException("Invalid Action requested:" + action); |
115 | |
} |
116 | |
|
117 | 0 | } catch(Exception e){ |
118 | 0 | LOG.error("Error attempting to " + action + " Document with workflow id:" + workflowId, e); |
119 | 0 | throw new OperationFailedException("Could not " + action + " Document"); |
120 | 0 | } |
121 | 0 | return Boolean.valueOf(true); |
122 | |
} |
123 | |
|
124 | |
@Override |
125 | |
public Boolean acknowledgeDocumentWithId(String workflowId) throws OperationFailedException { |
126 | 0 | return performWorkflowDocumentAction(WORKFLOW_DOCUMENT_ACTION_ACKNOWLEGE, workflowId, null); |
127 | |
} |
128 | |
|
129 | |
@Override |
130 | |
public Boolean approveDocumentWithId(String workflowId) throws OperationFailedException { |
131 | 0 | return performWorkflowDocumentAction(WORKFLOW_DOCUMENT_ACTION_APPROVE, workflowId, null); |
132 | |
} |
133 | |
|
134 | |
@Override |
135 | |
public Boolean blanketApproveDocumentWithId(String workflowId) throws OperationFailedException { |
136 | 0 | return performWorkflowDocumentAction(WORKFLOW_DOCUMENT_ACTION_BLANKET_APPROVE, workflowId, null); |
137 | |
} |
138 | |
|
139 | |
@Override |
140 | |
public Boolean disapproveDocumentWithId(String workflowId) throws OperationFailedException { |
141 | 0 | return performWorkflowDocumentAction(WORKFLOW_DOCUMENT_ACTION_DISAPPROVE, workflowId, null); |
142 | |
} |
143 | |
|
144 | |
@Override |
145 | |
public Boolean fyiDocumentWithId(String workflowId) throws OperationFailedException { |
146 | 0 | return performWorkflowDocumentAction(WORKFLOW_DOCUMENT_ACTION_FYI, workflowId, null); |
147 | |
} |
148 | |
|
149 | |
@Override |
150 | |
public Boolean withdrawDocumentWithId(String workflowId) throws OperationFailedException { |
151 | 0 | return performWorkflowDocumentAction(WORKFLOW_DOCUMENT_ACTION_WITHDRAW, workflowId, null); |
152 | |
} |
153 | |
|
154 | |
@Override |
155 | |
public Boolean returnDocumentWithId(String workflowId, String nodeName) throws OperationFailedException { |
156 | 0 | return performWorkflowDocumentAction(WORKFLOW_DOCUMENT_ACTION_RETURN, workflowId, null); |
157 | |
} |
158 | |
@Override |
159 | |
public Boolean cancelDocumentWithId(String workflowId) throws OperationFailedException { |
160 | 0 | return performWorkflowDocumentAction(WORKFLOW_DOCUMENT_ACTION_CANCEL, workflowId, null); |
161 | |
} |
162 | |
|
163 | |
@Override |
164 | |
public Boolean submitDocumentWithId(String workflowId) throws OperationFailedException { |
165 | 0 | return performWorkflowDocumentAction(WORKFLOW_DOCUMENT_ACTION_SUBMIT, workflowId, null); |
166 | |
} |
167 | |
|
168 | |
|
169 | |
|
170 | |
public List<String> getPreviousRouteNodeNames(String workflowId) throws OperationFailedException { |
171 | |
try { |
172 | 0 | return getWorkflowDocumentService().getPreviousRouteNodeNames(workflowId); |
173 | 0 | } catch (Exception e) { |
174 | 0 | LOG.error("Error approving document",e); |
175 | 0 | throw new OperationFailedException("Error getting previous node names"); |
176 | |
} |
177 | |
} |
178 | |
|
179 | |
@Override |
180 | |
public String getActionsRequested(String workflowId) throws OperationFailedException { |
181 | |
try{ |
182 | 0 | if(null==workflowId || workflowId.isEmpty()){ |
183 | 0 | LOG.info("No workflow id was provided."); |
184 | 0 | return ""; |
185 | |
} |
186 | |
|
187 | |
|
188 | 0 | String principalId = SecurityUtils.getCurrentUserId(); |
189 | |
|
190 | |
|
191 | 0 | LOG.debug("Calling action requested with user:"+principalId+" and workflowId:" + workflowId); |
192 | |
|
193 | 0 | Set<ActionRequestType> actionRequestTypes = getWorkflowDocumentActionsService().determineRequestedActions(workflowId, principalId).getRequestedActions(); |
194 | |
|
195 | |
|
196 | 0 | StringBuilder actionsRequestedBuffer = new StringBuilder(); |
197 | |
|
198 | 0 | DocumentDetail docDetail = getWorkflowDocumentService().getDocumentDetail(workflowId); |
199 | |
|
200 | 0 | for(ActionRequestType actionRequestType : actionRequestTypes){ |
201 | |
|
202 | 0 | if (StringUtils.equals(KewApiConstants.ROUTE_HEADER_SAVED_CD, docDetail.getDocument().getStatus().getCode()) || StringUtils.equals(KewApiConstants.ROUTE_HEADER_INITIATED_CD, docDetail.getDocument().getStatus().getCode())) { |
203 | |
|
204 | 0 | if ( actionRequestType.equals(ActionRequestType.COMPLETE) || actionRequestType.equals(ActionRequestType.APPROVE) ) { |
205 | 0 | actionsRequestedBuffer.append("S"); |
206 | 0 | actionsRequestedBuffer.append("C"); |
207 | |
} |
208 | |
|
209 | |
else { |
210 | 0 | actionsRequestedBuffer.append(actionRequestType.getCode()); |
211 | |
} |
212 | |
} |
213 | |
else { |
214 | 0 | actionsRequestedBuffer.append(actionRequestType.getCode()); |
215 | |
|
216 | 0 | if ( actionRequestType.equals(ActionRequestType.COMPLETE) || actionRequestType.equals(ActionRequestType.APPROVE) ) { |
217 | 0 | actionsRequestedBuffer.append("R"); |
218 | |
} |
219 | |
} |
220 | |
} |
221 | 0 | String docTypeName = getWorkflowDocumentTypeService().getDocumentTypeById(docDetail.getDocument().getDocumentTypeId()).getName(); |
222 | |
|
223 | 0 | Map<String,String> permDetails = new LinkedHashMap<String,String>(); |
224 | 0 | permDetails.put(StudentIdentityConstants.DOCUMENT_TYPE_NAME,docTypeName); |
225 | 0 | permDetails.put(StudentIdentityConstants.ROUTE_STATUS_CODE,docDetail.getDocument().getStatus().getCode()); |
226 | 0 | Map<String,String> workflowDetails = new LinkedHashMap<String,String> (); |
227 | 0 | workflowDetails.put (StudentIdentityConstants.DOCUMENT_NUMBER,workflowId); |
228 | 0 | if (getPermissionService().isAuthorizedByTemplate(principalId, |
229 | |
PermissionType.WITHDRAW.getPermissionNamespace(), |
230 | |
PermissionType.WITHDRAW.getPermissionTemplateName(), |
231 | |
permDetails, |
232 | |
workflowDetails)) { |
233 | 0 | LOG.info("User '" + principalId + "' is allowed to Withdraw the Document"); |
234 | 0 | actionsRequestedBuffer.append("W"); |
235 | |
} |
236 | |
|
237 | 0 | Map<String,String> permDetails2 = new HashMap<String,String>(); |
238 | 0 | permDetails2.put(StudentIdentityConstants.DOCUMENT_TYPE_NAME,docTypeName); |
239 | 0 | permDetails2.put(StudentIdentityConstants.ROUTE_STATUS_CODE,docDetail.getDocument().getStatus().getCode()); |
240 | |
|
241 | 0 | Map<String,String> qualifiers = new LinkedHashMap (); |
242 | 0 | qualifiers.put (StudentIdentityConstants.DOCUMENT_NUMBER,workflowId); |
243 | 0 | boolean canBlanketApprove = getPermissionService().isAuthorizedByTemplate(principalId, |
244 | |
PermissionType.BLANKET_APPROVE.getPermissionNamespace(), |
245 | |
PermissionType.BLANKET_APPROVE.getPermissionTemplateName(), new LinkedHashMap<String, String>(permDetails2), |
246 | |
qualifiers); |
247 | 0 | for (String nodeName : getCurrentActiveNodeNames(docDetail.getDocument().getStatus().getCode())) { |
248 | 0 | if (canBlanketApprove) { |
249 | 0 | break; |
250 | |
} |
251 | 0 | Map<String,String> newSet = new LinkedHashMap<String,String>(permDetails2); |
252 | 0 | newSet.put(StudentIdentityConstants.ROUTE_NODE_NAME, nodeName); |
253 | 0 | qualifiers = new LinkedHashMap (); |
254 | 0 | qualifiers.put (StudentIdentityConstants.DOCUMENT_NUMBER,workflowId); |
255 | 0 | canBlanketApprove = getPermissionService().isAuthorizedByTemplate(principalId, |
256 | |
PermissionType.BLANKET_APPROVE.getPermissionNamespace(), |
257 | |
PermissionType.BLANKET_APPROVE.getPermissionTemplateName(), newSet, |
258 | |
qualifiers); |
259 | 0 | } |
260 | 0 | if (canBlanketApprove) { |
261 | 0 | LOG.info("User '" + principalId + "' is allowed to Blanket Approve the Document"); |
262 | 0 | actionsRequestedBuffer.append("B"); |
263 | |
} |
264 | |
|
265 | 0 | return actionsRequestedBuffer.toString(); |
266 | 0 | } catch (Exception e) { |
267 | 0 | LOG.error("Error getting actions Requested",e); |
268 | 0 | throw new OperationFailedException("Error getting actions Requested"); |
269 | |
} |
270 | |
} |
271 | |
|
272 | |
protected List<String> getCurrentActiveNodeNames(String routeHeaderId) throws OperationFailedException, WorkflowException { |
273 | 0 | List<String> currentActiveNodeNames = new ArrayList<String>(); |
274 | 0 | List<RouteNodeInstance> nodeInstances = getWorkflowDocumentService().getActiveRouteNodeInstances(routeHeaderId); |
275 | 0 | if (null != nodeInstances) { |
276 | 0 | for (RouteNodeInstance routeNodeInstance : nodeInstances) { |
277 | 0 | currentActiveNodeNames.add(routeNodeInstance.getName()); |
278 | |
} |
279 | |
} |
280 | 0 | return currentActiveNodeNames; |
281 | |
} |
282 | |
|
283 | |
@Override |
284 | |
public String getDocumentStatus(String workflowId) |
285 | |
throws OperationFailedException { |
286 | 0 | if (workflowId != null && !workflowId.isEmpty()){ |
287 | |
try { |
288 | 0 | return workflowDocumentService.getDocumentStatus(workflowId).getCode(); |
289 | 0 | } catch (Exception e) { |
290 | 0 | throw new OperationFailedException("Error getting document status. " + e.getMessage()); |
291 | |
} |
292 | |
} |
293 | |
|
294 | 0 | return null; |
295 | |
} |
296 | |
|
297 | |
@Override |
298 | |
|
299 | |
|
300 | |
|
301 | |
public String getWorkflowIdFromDataId(String workflowDocType, String dataId) throws OperationFailedException { |
302 | 0 | if(null== workflowDocumentActionsService){ |
303 | 0 | throw new OperationFailedException("Workflow Service is unavailable"); |
304 | |
} |
305 | |
|
306 | |
DocumentDetail docDetail; |
307 | |
try { |
308 | 0 | docDetail = workflowDocumentService.getDocumentDetailByAppId(workflowDocType, dataId); |
309 | 0 | if(null==docDetail){ |
310 | 0 | LOG.error("Nothing found for id: "+dataId); |
311 | 0 | return null; |
312 | |
} |
313 | 0 | return docDetail.getDocument().getDocumentId(); |
314 | 0 | } catch (Exception e) { |
315 | 0 | LOG.error("Call Failed getting workflowId for id: "+dataId, e); |
316 | |
} |
317 | 0 | return null; |
318 | |
} |
319 | |
|
320 | |
|
321 | |
@Override |
322 | |
public String getDataIdFromWorkflowId(String workflowId) throws OperationFailedException { |
323 | 0 | String username = SecurityUtils.getCurrentUserId(); |
324 | 0 | Document docResponse = getWorkflowDocumentService().getDocument(workflowId); |
325 | |
|
326 | 0 | return docResponse.getApplicationDocumentId(); |
327 | |
} |
328 | |
|
329 | |
@Override |
330 | |
public List<String> getWorkflowNodes(String workflowId) |
331 | |
throws OperationFailedException { |
332 | 0 | List<String> routeNodeNames = new ArrayList<String>(); |
333 | |
|
334 | |
try{ |
335 | 0 | List<RouteNodeInstance> routeNodes = workflowDocumentService.getActiveRouteNodeInstances(workflowId); |
336 | 0 | if (routeNodes != null){ |
337 | 0 | for (RouteNodeInstance routeNodeInstance : routeNodes) { |
338 | 0 | routeNodeNames.add(routeNodeInstance.getName()); |
339 | |
} |
340 | |
} |
341 | |
|
342 | 0 | } catch (Exception e) { |
343 | 0 | throw new OperationFailedException(e.getMessage()); |
344 | 0 | } |
345 | |
|
346 | 0 | return routeNodeNames; |
347 | |
} |
348 | |
|
349 | |
|
350 | |
|
351 | |
@Override |
352 | |
public Boolean isAuthorizedAddReviewer(String docId) throws OperationFailedException{ |
353 | 0 | if (docId != null && (!"".equals(docId.trim()))) { |
354 | 0 | Map<String,String> permissionDetails = new LinkedHashMap<String,String>(); |
355 | 0 | Map<String,String> roleQuals = new LinkedHashMap<String,String>(); |
356 | 0 | roleQuals.put(StudentIdentityConstants.DOCUMENT_NUMBER,docId); |
357 | 0 | return Boolean.valueOf(getPermissionService().isAuthorizedByTemplate(SecurityUtils.getCurrentUserId(), PermissionType.ADD_ADHOC_REVIEWER.getPermissionNamespace(), |
358 | |
PermissionType.ADD_ADHOC_REVIEWER.getPermissionTemplateName(), permissionDetails, roleQuals)); |
359 | |
} |
360 | 0 | return Boolean.FALSE; |
361 | |
} |
362 | |
|
363 | |
public Boolean isAuthorizedRemoveReviewers(String docId) throws OperationFailedException { |
364 | |
try { |
365 | 0 | if (docId != null && (!"".equals(docId.trim()))) { |
366 | 0 | DocumentDetail docDetail = getWorkflowDocumentService().getDocumentDetail(docId); |
367 | 0 | DocumentType docType = getWorkflowDocumentTypeService().getDocumentTypeById(docDetail.getDocument().getDocumentTypeId()); |
368 | 0 | Map<String,String> permissionDetails = new LinkedHashMap<String,String>(); |
369 | 0 | permissionDetails.put(StudentIdentityConstants.DOCUMENT_TYPE_NAME,docType.getName()); |
370 | 0 | Map<String,String> roleQuals = new LinkedHashMap<String,String>(); |
371 | 0 | roleQuals.put(StudentIdentityConstants.DOCUMENT_NUMBER,docId); |
372 | 0 | boolean returnValue = getPermissionService().isAuthorizedByTemplate(SecurityUtils.getCurrentUserId(), PermissionType.REMOVE_ADHOC_REVIEWERS.getPermissionNamespace(), |
373 | |
PermissionType.REMOVE_ADHOC_REVIEWERS.getPermissionTemplateName(), permissionDetails, roleQuals); |
374 | 0 | return Boolean.valueOf(returnValue); |
375 | |
} |
376 | 0 | return Boolean.FALSE; |
377 | 0 | } catch (Exception e) { |
378 | 0 | LOG.error("Unable to get document information from Workflow for doc id " + docId); |
379 | 0 | throw new OperationFailedException("Unable to get document information from Workflow for doc id " + docId); |
380 | |
} |
381 | |
} |
382 | |
|
383 | |
public void setWorkflowDocumentActionsService(WorkflowDocumentActionsService workflowDocumentActionsService) { |
384 | 0 | this.workflowDocumentActionsService = workflowDocumentActionsService; |
385 | 0 | } |
386 | |
|
387 | |
public WorkflowDocumentActionsService getWorkflowDocumentActionsService() throws OperationFailedException{ |
388 | 0 | if(workflowDocumentActionsService ==null){ |
389 | 0 | throw new OperationFailedException("Workflow Simple Document Service is unavailable"); |
390 | |
} |
391 | |
|
392 | 0 | return workflowDocumentActionsService; |
393 | |
} |
394 | |
|
395 | |
public void setWorkflowDocumentService(WorkflowDocumentService WorkflowDocumentService) { |
396 | 0 | this.workflowDocumentService = workflowDocumentService; |
397 | 0 | } |
398 | |
|
399 | |
public WorkflowDocumentService getWorkflowDocumentService() throws OperationFailedException { |
400 | 0 | if(workflowDocumentService ==null){ |
401 | 0 | throw new OperationFailedException("Workflow Document Service is unavailable"); |
402 | |
} |
403 | |
|
404 | 0 | return workflowDocumentService; |
405 | |
} |
406 | |
|
407 | |
|
408 | |
public DocumentTypeService getWorkflowDocumentTypeService() throws OperationFailedException { |
409 | 0 | if(workflowDocumentTypeService ==null){ |
410 | 0 | throw new OperationFailedException("Workflow Document Type Service is unavailable"); |
411 | |
} |
412 | |
|
413 | 0 | return workflowDocumentTypeService; |
414 | |
} |
415 | |
|
416 | |
public void setWorkflowDocumentTypeService(DocumentTypeService workflowDocumentTypeService) { |
417 | 0 | this.workflowDocumentTypeService = workflowDocumentTypeService; |
418 | 0 | } |
419 | |
|
420 | |
public void setIdentityService(IdentityService identityService) { |
421 | 0 | this.identityService = identityService; |
422 | 0 | } |
423 | |
|
424 | |
public IdentityService getIdentityService() throws OperationFailedException{ |
425 | 0 | if(identityService==null){ |
426 | 0 | throw new OperationFailedException("Identity Service is unavailable"); |
427 | |
} |
428 | |
|
429 | 0 | return identityService; |
430 | |
} |
431 | |
|
432 | |
public void setPermissionService(PermissionService permissionService) { |
433 | 0 | this.permissionService = permissionService; |
434 | 0 | } |
435 | |
|
436 | |
public PermissionService getPermissionService()throws OperationFailedException{ |
437 | 0 | if(permissionService==null){ |
438 | 0 | throw new OperationFailedException("Permission Service is unavailable"); |
439 | |
} |
440 | |
|
441 | 0 | return permissionService; |
442 | |
} |
443 | |
|
444 | |
|
445 | |
public void setCollaboratorHelper(CollaboratorHelper collaboratorHelper) { |
446 | 0 | this.collaboratorHelper = collaboratorHelper; |
447 | 0 | } |
448 | |
|
449 | |
public CollaboratorHelper getCollaboratorHelper() throws OperationFailedException { |
450 | 0 | if(collaboratorHelper==null) { |
451 | 0 | throw new OperationFailedException("Collaborator Helper not initialized"); |
452 | |
} |
453 | 0 | return collaboratorHelper; |
454 | |
} |
455 | |
} |