| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| WorkflowInfo |
|
| 1.1951219512195121;1.195 |
| 1 | /* | |
| 2 | * Copyright 2005-2007 The Kuali Foundation | |
| 3 | * | |
| 4 | * | |
| 5 | * Licensed under the Educational Community License, Version 2.0 (the "License"); | |
| 6 | * you may not use this file except in compliance with the License. | |
| 7 | * You may obtain a copy of the License at | |
| 8 | * | |
| 9 | * http://www.opensource.org/licenses/ecl2.php | |
| 10 | * | |
| 11 | * Unless required by applicable law or agreed to in writing, software | |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, | |
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 14 | * See the License for the specific language governing permissions and | |
| 15 | * limitations under the License. | |
| 16 | */ | |
| 17 | package org.kuali.rice.kew.service; | |
| 18 | ||
| 19 | import org.apache.commons.lang.ObjectUtils; | |
| 20 | import org.kuali.rice.core.api.resourceloader.GlobalResourceLoader; | |
| 21 | import org.kuali.rice.kew.dto.ActionItemDTO; | |
| 22 | import org.kuali.rice.kew.dto.ActionRequestDTO; | |
| 23 | import org.kuali.rice.kew.dto.ActionTakenDTO; | |
| 24 | import org.kuali.rice.kew.dto.DocumentContentDTO; | |
| 25 | import org.kuali.rice.kew.dto.DocumentDetailDTO; | |
| 26 | import org.kuali.rice.kew.dto.DocumentSearchCriteriaDTO; | |
| 27 | import org.kuali.rice.kew.dto.DocumentSearchResultDTO; | |
| 28 | import org.kuali.rice.kew.dto.DocumentStatusTransitionDTO; | |
| 29 | import org.kuali.rice.kew.dto.ReportCriteriaDTO; | |
| 30 | import org.kuali.rice.kew.dto.RouteNodeInstanceDTO; | |
| 31 | import org.kuali.rice.kew.dto.RuleDTO; | |
| 32 | import org.kuali.rice.kew.dto.RuleReportCriteriaDTO; | |
| 33 | import org.kuali.rice.kew.dto.WorkflowAttributeDefinitionDTO; | |
| 34 | import org.kuali.rice.kew.dto.WorkflowAttributeValidationErrorDTO; | |
| 35 | import org.kuali.rice.kew.exception.WorkflowException; | |
| 36 | import org.kuali.rice.kew.util.KEWConstants; | |
| 37 | ||
| 38 | import java.util.Arrays; | |
| 39 | import java.util.List; | |
| 40 | import java.util.Map; | |
| 41 | ||
| 42 | /** | |
| 43 | * Convenience class for client applications to query workflow. This class is one of two | |
| 44 | * (Java) client interfaces to the KEW system. | |
| 45 | * | |
| 46 | * <p>The first time an instance of this class is created, it will read the client configuration to | |
| 47 | * determine how to connect to KEW. To use this API, simply create a new instance using the | |
| 48 | * empty constructor. | |
| 49 | * | |
| 50 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
| 51 | */ | |
| 52 | 0 | public class WorkflowInfo implements java.io.Serializable { |
| 53 | ||
| 54 | private static final long serialVersionUID = 3231835171780770399L; | |
| 55 | ||
| 56 | /** | |
| 57 | * Retrieves the WorkflowUtility proxy from the locator. The locator will cache this for us. | |
| 58 | */ | |
| 59 | private WorkflowUtility getWorkflowUtility() throws WorkflowException { | |
| 60 | 0 | WorkflowUtility workflowUtility = |
| 61 | (WorkflowUtility)GlobalResourceLoader.getService(KEWConstants.WORKFLOW_UTILITY_SERVICE); | |
| 62 | 0 | if (workflowUtility == null) { |
| 63 | 0 | throw new WorkflowException("Could not locate the WorkflowUtility service. Please ensure that KEW client is configured properly!"); |
| 64 | } | |
| 65 | 0 | return workflowUtility; |
| 66 | ||
| 67 | } | |
| 68 | ||
| 69 | public Map<String, String> getActionsRequested(String principalId, String documentId) throws WorkflowException { | |
| 70 | 0 | return getWorkflowUtility().getActionsRequested(principalId, documentId); |
| 71 | } | |
| 72 | ||
| 73 | /** | |
| 74 | * Returns the status of the document with the given ID. | |
| 75 | * | |
| 76 | * @since 0.9.1 | |
| 77 | * @throws WorkflowException if document cannot be found for the given ID or | |
| 78 | * if the given document ID is null. | |
| 79 | */ | |
| 80 | public String getDocumentStatus(String documentId) throws WorkflowException { | |
| 81 | 0 | return getWorkflowUtility().getDocumentStatus(documentId); |
| 82 | } | |
| 83 | ||
| 84 | /** | |
| 85 | * Returns the status of the document with the given ID. | |
| 86 | * | |
| 87 | * @since 0.9.1 | |
| 88 | * @throws WorkflowException if document cannot be found for the given ID or | |
| 89 | * if the given document ID is null. | |
| 90 | */ | |
| 91 | public DocumentStatusTransitionDTO[] getDocumentStatusTransitionHistory(String documentId) throws WorkflowException { | |
| 92 | 0 | return getWorkflowUtility().getDocumentStatusTransitionHistory(documentId); |
| 93 | } | |
| 94 | ||
| 95 | /** | |
| 96 | * Returns a new unique id to be used as a responsibility id | |
| 97 | * @return a new unique id to be used as a responsibility id | |
| 98 | * @throws WorkflowException if an error occurs obtaining a new responsibility id | |
| 99 | * @see WorkflowUtility#getNewResponsibilityId() | |
| 100 | */ | |
| 101 | public String getNewResponsibilityId() throws WorkflowException { | |
| 102 | 0 | return getWorkflowUtility().getNewResponsibilityId(); |
| 103 | } | |
| 104 | ||
| 105 | public Integer getUserActionItemCount(String principalId) throws WorkflowException { | |
| 106 | 0 | return getWorkflowUtility().getUserActionItemCount(principalId); |
| 107 | } | |
| 108 | ||
| 109 | public ActionItemDTO[] getActionItems(String documentId) throws WorkflowException { | |
| 110 | 0 | return getWorkflowUtility().getAllActionItems(documentId); |
| 111 | } | |
| 112 | ||
| 113 | public ActionItemDTO[] getActionItems(String documentId, String[] actionRequestedCodes) throws WorkflowException { | |
| 114 | 0 | return getWorkflowUtility().getActionItems(documentId, actionRequestedCodes); |
| 115 | } | |
| 116 | ||
| 117 | /** | |
| 118 | * Returns the pending action requests of the document of the specified id | |
| 119 | * @param documentId the id of the document whose action requests will be retrieved | |
| 120 | * @return the pending action requests of the document of the specified id | |
| 121 | * @throws WorkflowException if an error occurs obtaining the documents action requests | |
| 122 | * @see WorkflowUtility#getActionRequests(Long) | |
| 123 | */ | |
| 124 | public ActionRequestDTO[] getActionRequests(String documentId) throws WorkflowException { | |
| 125 | 0 | return getWorkflowUtility().getAllActionRequests(documentId); |
| 126 | } | |
| 127 | ||
| 128 | /** | |
| 129 | * Returns the pending action requests of the document of the specified id for the specified | |
| 130 | * user and/or the specified node name. If both user and node name are empty then will | |
| 131 | * return all pending action requests. | |
| 132 | * @param documentId the id of the document whose action requests will be retrieved | |
| 133 | * @param nodeName the node name of the requests to be retrieved | |
| 134 | * @param userId the user that the requests would be satisfied by | |
| 135 | * @return the pending action requests of the document of the specified id | |
| 136 | * @throws WorkflowException if an error occurs obtaining the documents action requests | |
| 137 | * @see WorkflowUtility#getActionRequests(Long) | |
| 138 | */ | |
| 139 | public ActionRequestDTO[] getActionRequests(String documentId, String nodeName, String principalId) throws WorkflowException { | |
| 140 | 0 | return getWorkflowUtility().getActionRequests(documentId, nodeName, principalId); |
| 141 | } | |
| 142 | ||
| 143 | /** | |
| 144 | ||
| 145 | ||
| 146 | /** | |
| 147 | * Returns the actions taken on the document of the specified id | |
| 148 | * @param documentId the id of the document whose actions taken will be retrieved | |
| 149 | * @return the actions taken on the document of the specified id | |
| 150 | * @throws WorkflowException if an error occurs obtaining the actions taken | |
| 151 | * @see WorkflowUtility#getActionsTaken(Long) | |
| 152 | */ | |
| 153 | public ActionTakenDTO[] getActionsTaken(String documentId) throws WorkflowException { | |
| 154 | 0 | return getWorkflowUtility().getActionsTaken(documentId); |
| 155 | } | |
| 156 | ||
| 157 | /** | |
| 158 | * Returns whether the user is in the document's route log (whether an action request has been, or may be, | |
| 159 | * generated for the user) | |
| 160 | * @param documentId the id of the document to analyze | |
| 161 | * @param userId the id of the user to check | |
| 162 | * @param lookFuture whether to evaluate potential future requests | |
| 163 | * @return whether the user is in the document's route log | |
| 164 | * @throws WorkflowException if an error occurs determining whether the user is in the document's route log | |
| 165 | * @see WorkflowUtility#isUserInRouteLog(Long, String, boolean) | |
| 166 | */ | |
| 167 | public boolean isUserAuthenticatedByRouteLog(String documentId, String principalId, boolean lookFuture) throws WorkflowException { | |
| 168 | 0 | return getWorkflowUtility().isUserInRouteLog(documentId, principalId, lookFuture); |
| 169 | } | |
| 170 | ||
| 171 | /** | |
| 172 | * Returns whether the user is in the document's route log (whether an action request has been, or may be, | |
| 173 | * generated for the user). The flattenNodes boolean instructs the underlying Simulation Engine to perform | |
| 174 | * a "flattened" evaluation or not and only takes effect if lookFuture is true. When doing a "flattened" | |
| 175 | * evaluation, all branches will be followed regardless of split and join logic built into the document type. | |
| 176 | * | |
| 177 | * @param documentId the id of the document to analyze | |
| 178 | * @param userId the id of the user to check | |
| 179 | * @param lookFuture whether to evaluate potential future requests | |
| 180 | * @return whether the user is in the document's route log | |
| 181 | * @throws WorkflowException if an error occurs determining whether the user is in the document's route log | |
| 182 | * @see WorkflowUtility#isUserInRouteLog(Long, String, boolean) | |
| 183 | */ | |
| 184 | public boolean isUserAuthenticatedByRouteLog(String documentId, String principalId, boolean lookFuture, boolean flattenNodes) throws WorkflowException { | |
| 185 | 0 | return getWorkflowUtility().isUserInRouteLogWithOptionalFlattening(documentId, principalId, lookFuture, flattenNodes); |
| 186 | } | |
| 187 | ||
| 188 | /** | |
| 189 | * Returns whether the specified user is the final approver for the document | |
| 190 | * @param documentId the id of document to check | |
| 191 | * @param userId the id of the user to check | |
| 192 | * @return whether the specified user is the final approver for the document | |
| 193 | * @throws WorkflowException if an error occurs determining whether the user is the final approver on the document | |
| 194 | * @see WorkflowUtility#isFinalApprover(Long, String) | |
| 195 | */ | |
| 196 | public boolean isFinalApprover(String documentId, String principalId) throws WorkflowException { | |
| 197 | 0 | return getWorkflowUtility().isFinalApprover(documentId, principalId); |
| 198 | } | |
| 199 | ||
| 200 | /** | |
| 201 | * Validate the WorkflowAttributeDefinition against it's attribute on the server. This will validate | |
| 202 | * the inputs that will eventually become xml. | |
| 203 | * | |
| 204 | * Only applies to attributes implementing WorkflowAttributeXmlValidator. | |
| 205 | * | |
| 206 | * @param attributeDefinition the attribute definition to validate | |
| 207 | * @return WorkflowAttributeValidationErrorVO[] of error from the attribute | |
| 208 | * @throws WorkflowException when attribute doesn't implement WorkflowAttributeXmlValidator | |
| 209 | * @see WorkflowUtility#validateWorkflowAttributeDefinitionVO(WorkflowAttributeDefinitionDTO) | |
| 210 | */ | |
| 211 | public WorkflowAttributeValidationErrorDTO[] validAttributeDefinition(WorkflowAttributeDefinitionDTO attributeDefinition) throws WorkflowException { | |
| 212 | 0 | return getWorkflowUtility().validateWorkflowAttributeDefinitionVO(attributeDefinition); |
| 213 | } | |
| 214 | ||
| 215 | // WORKFLOW 2.3: new methods | |
| 216 | ||
| 217 | /** | |
| 218 | * Runs a "rule report" give a rule report criteria. | |
| 219 | * @param ruleReportCriteria the criteria for the rule report | |
| 220 | * @return an array of RuleVO representing rules that will fire under the specified criteria | |
| 221 | * @see WorkflowUtility#ruleReport(RuleReportCriteriaDTO) | |
| 222 | */ | |
| 223 | public RuleDTO[] ruleReport(RuleReportCriteriaDTO ruleReportCriteria) throws WorkflowException { | |
| 224 | 0 | return getWorkflowUtility().ruleReport(ruleReportCriteria); |
| 225 | } | |
| 226 | ||
| 227 | // WORKFLOW 2.1: new methods | |
| 228 | ||
| 229 | /** | |
| 230 | * Returns a document detail VO representing the route header along with action requests, actions taken, | |
| 231 | * and route node instances. | |
| 232 | * @param documentId id of the document whose details should be returned | |
| 233 | * @return Returns a document detail VO representing the route header along with action requests, actions taken, and route node instances. | |
| 234 | * @throws WorkflowException | |
| 235 | * @see WorkflowUtility#getDocumentDetail(Long) | |
| 236 | */ | |
| 237 | public DocumentDetailDTO getDocumentDetail(String documentId) throws WorkflowException { | |
| 238 | 0 | return getWorkflowUtility().getDocumentDetail(documentId); |
| 239 | } | |
| 240 | ||
| 241 | /** | |
| 242 | * Returns a node instance of the specified note instance id | |
| 243 | * @param nodeInstanceId the id of the node instance to return | |
| 244 | * @return a node instance of the specified note instance id | |
| 245 | * @throws WorkflowException if an error occurs obtaining the node instance | |
| 246 | * @see WorkflowUtility#getNodeInstance(String) | |
| 247 | */ | |
| 248 | public RouteNodeInstanceDTO getNodeInstance(String nodeInstanceId) throws WorkflowException { | |
| 249 | 0 | return getWorkflowUtility().getNodeInstance(nodeInstanceId); |
| 250 | } | |
| 251 | ||
| 252 | /** | |
| 253 | * Returns the route node instances that have been created so far during the life of the specified document. This includes | |
| 254 | * all previous instances which have already been processed and are no longer active. | |
| 255 | * @param documentId the id of the document whose route node instances should be returned | |
| 256 | * @return the route node instances that have been created so far during the life of this document | |
| 257 | * @throws WorkflowException if there is an error getting the route node instances for the document | |
| 258 | * @see WorkflowUtility#getDocumentRouteNodeInstances(Long) | |
| 259 | */ | |
| 260 | public RouteNodeInstanceDTO[] getDocumentRouteNodeInstances(String documentId) throws WorkflowException { | |
| 261 | 0 | return getWorkflowUtility().getDocumentRouteNodeInstances(documentId); |
| 262 | } | |
| 263 | ||
| 264 | /** | |
| 265 | * Returns all active node instances on the document. | |
| 266 | * @param documentId id of the document whose active node instances should be returned | |
| 267 | * @return all active node instances on the document | |
| 268 | * @throws WorkflowException if there is an error obtaining the currently active nodes on the document | |
| 269 | * @see WorkflowUtility#getActiveNodeInstances(Long) | |
| 270 | */ | |
| 271 | public RouteNodeInstanceDTO[] getActiveNodeInstances(String documentId) throws WorkflowException { | |
| 272 | 0 | return getWorkflowUtility().getActiveNodeInstances(documentId); |
| 273 | } | |
| 274 | ||
| 275 | /** | |
| 276 | * Returns all node instances on the document which have no successor. | |
| 277 | * @param documentId id of the document whose terminal node instances should be returned | |
| 278 | * @return all terminal node instances of the document | |
| 279 | * @throws WorkflowException if there is an error obtaining the terminal node instances on the document | |
| 280 | * @see WorkflowUtility#getTerminalNodeInstances(Long) | |
| 281 | */ | |
| 282 | public RouteNodeInstanceDTO[] getTerminalNodeInstances(String documentId) throws WorkflowException { | |
| 283 | 0 | return getWorkflowUtility().getTerminalNodeInstances(documentId); |
| 284 | } | |
| 285 | ||
| 286 | /** | |
| 287 | * Returns the current node instances on the document. If the document has active nodes, those will | |
| 288 | * be returned. Otherwise, all terminal nodes will be returned. | |
| 289 | * @param documentId id of the document whose current node instances should be returned | |
| 290 | * @return all current node instances of the document | |
| 291 | * @throws WorkflowException if there is an error obtaining the current node instances on the document | |
| 292 | * @see WorkflowUtility#getCurrentNodeInstances(Long) | |
| 293 | */ | |
| 294 | public RouteNodeInstanceDTO[] getCurrentNodeInstances(String documentId) throws WorkflowException { | |
| 295 | 0 | return getWorkflowUtility().getCurrentNodeInstances(documentId); |
| 296 | } | |
| 297 | ||
| 298 | /** | |
| 299 | * Returns names of all current nodes the document is currently at. If the document has active nodes, those | |
| 300 | * will be returned. Otherwise, the document's terminal nodes will be returned. | |
| 301 | * | |
| 302 | * @return names of all current nodes the document is currently at. | |
| 303 | * @throws WorkflowException if there is an error obtaining the current nodes on the document | |
| 304 | * @see WorkflowUtility#getCurrentNodeInstances(Long) | |
| 305 | */ | |
| 306 | public String[] getCurrentNodeNames(String documentId) throws WorkflowException { | |
| 307 | 0 | RouteNodeInstanceDTO[] currentNodeInstances = getWorkflowUtility().getCurrentNodeInstances(documentId); |
| 308 | 0 | String[] nodeNames = new String[(currentNodeInstances == null ? 0 : currentNodeInstances.length)]; |
| 309 | 0 | for (int index = 0; index < currentNodeInstances.length; index++) { |
| 310 | 0 | nodeNames[index] = currentNodeInstances[index].getName(); |
| 311 | } | |
| 312 | 0 | return nodeNames; |
| 313 | } | |
| 314 | ||
| 315 | /** | |
| 316 | * Re-resolves the specified role on the document, and refreshes any pending action requests. | |
| 317 | * @param documentTypeName the type of the document for which to re-resolve roles | |
| 318 | * @param roleName the role name to re-resolve | |
| 319 | * @param qualifiedRoleNameLabel the qualified role name label | |
| 320 | * @throws WorkflowException if an error occurs re-resolving the role | |
| 321 | * @see WorkflowUtility#reResolveRole(String, String, String) | |
| 322 | */ | |
| 323 | public void reResolveRoleByDocTypeName(String documentTypeName, String roleName, String qualifiedRoleNameLabel) throws WorkflowException { | |
| 324 | 0 | getWorkflowUtility().reResolveRoleByDocTypeName(documentTypeName, roleName, qualifiedRoleNameLabel); |
| 325 | 0 | } |
| 326 | ||
| 327 | /** | |
| 328 | * Re-resolves the specified role on the document, and refreshes any pending action requests. | |
| 329 | * @param documentId the id of the document for which to re-resolve roles | |
| 330 | * @param roleName the role name to re-resolve | |
| 331 | * @param qualifiedRoleNameLabel the qualified role name label | |
| 332 | * @throws WorkflowException if an error occurs re-resolving the role | |
| 333 | * @see WorkflowUtility#reResolveRoleByDocumentId(Long, String, String) | |
| 334 | */ | |
| 335 | public void reResolveRoleByDocumentId(String documentId, String roleName, String qualifiedRoleNameLabel) throws WorkflowException { | |
| 336 | 0 | getWorkflowUtility().reResolveRoleByDocumentId(documentId, roleName, qualifiedRoleNameLabel); |
| 337 | 0 | } |
| 338 | ||
| 339 | /** | |
| 340 | * Runs a "routing report" | |
| 341 | * @param reportCriteria routing report criteria | |
| 342 | * @return DocumentDetailVO detailing the actionrequests that would be generated under the specified criteria | |
| 343 | * @see WorkflowUtility#routingReport(ReportCriteriaDTO) | |
| 344 | */ | |
| 345 | public DocumentDetailDTO routingReport(ReportCriteriaDTO reportCriteria) throws WorkflowException { | |
| 346 | 0 | return getWorkflowUtility().routingReport(reportCriteria); |
| 347 | } | |
| 348 | ||
| 349 | /** | |
| 350 | * Returns the application document id for the document with the given id. | |
| 351 | * | |
| 352 | * @param documentId the document id of the document for which to fetch the application document id | |
| 353 | * @return the application document of the document with the given id or null if the document does not have an application document id | |
| 354 | */ | |
| 355 | public String getAppDocId(String documentId) throws WorkflowException { | |
| 356 | 0 | return getWorkflowUtility().getAppDocId(documentId); |
| 357 | } | |
| 358 | ||
| 359 | /** | |
| 360 | * Returns whether the specified user is the last approver at the specified node name | |
| 361 | * @param documentId the id of document to check | |
| 362 | * @param userId the id of the user to check | |
| 363 | * @param nodeName name of node to check | |
| 364 | * @return whether the specified user is the last approver at the specified node name | |
| 365 | * @throws WorkflowException if an error occurs determining whether the user is the last approver at the specified node | |
| 366 | * @see WorkflowUtility#isLastApproverAtNode(Long, String, String) | |
| 367 | */ | |
| 368 | public boolean isLastApproverAtNode(String documentId, String principalId, String nodeName) throws WorkflowException { | |
| 369 | 0 | return getWorkflowUtility().isLastApproverAtNode(documentId, principalId, nodeName); |
| 370 | } | |
| 371 | ||
| 372 | /** | |
| 373 | * Returns whether the specified node on the specified document type would produce approve or complete requests | |
| 374 | * @param docType the type of the document to check | |
| 375 | * @param docContent the content to use | |
| 376 | * @param nodeName the node to check | |
| 377 | * @return whether the specified node on the specified document type would produce approve or complete requests | |
| 378 | * @throws WorkflowException if an error occurs | |
| 379 | * @see WorkflowUtility#routeNodeHasApproverActionRequest(String, String, String) | |
| 380 | */ | |
| 381 | public boolean routeNodeHasApproverActionRequest(String docType, String docContent, String nodeName) throws WorkflowException { | |
| 382 | 0 | return getWorkflowUtility().routeNodeHasApproverActionRequest(docType, docContent, nodeName); |
| 383 | } | |
| 384 | ||
| 385 | /** | |
| 386 | * This method allows a document search to be executed just as would occur from the User Interface using the given user as | |
| 387 | * the searching user | |
| 388 | * | |
| 389 | * @param userId - user to use when executing the search (for security filtering purposes) | |
| 390 | * @param criteriaVO - criteria to use for the search | |
| 391 | * @return a {@link DocumentSearchResultDTO} object containing a list of search result columns and data rows | |
| 392 | * @throws WorkflowException | |
| 393 | */ | |
| 394 | public DocumentSearchResultDTO performDocumentSearch(String principalId, DocumentSearchCriteriaDTO criteriaVO) throws WorkflowException { | |
| 395 | 0 | return getWorkflowUtility().performDocumentSearchWithPrincipal(principalId, criteriaVO); |
| 396 | } | |
| 397 | ||
| 398 | /** | |
| 399 | * This method allows a document search to be executed just as would occur from the User Interface | |
| 400 | * | |
| 401 | * @param criteriaVO - criteria to use for the search | |
| 402 | * @return a {@link DocumentSearchResultDTO} object containing a list of search result columns and data rows | |
| 403 | * @throws WorkflowException | |
| 404 | */ | |
| 405 | public DocumentSearchResultDTO performDocumentSearch(DocumentSearchCriteriaDTO criteriaVO) throws WorkflowException { | |
| 406 | 0 | return getWorkflowUtility().performDocumentSearch(criteriaVO); |
| 407 | } | |
| 408 | ||
| 409 | /** | |
| 410 | * Returns the document content VO of the specified document | |
| 411 | * @param documentId the id of the document whose content should be returned | |
| 412 | * @return the document content VO of the specified document | |
| 413 | * @throws WorkflowException if an error occurs obtaining the document content | |
| 414 | * @see WorkflowUtility#getDocumentContent(Long) | |
| 415 | */ | |
| 416 | public DocumentContentDTO getDocumentContent(String documentId) throws WorkflowException { | |
| 417 | 0 | return getWorkflowUtility().getDocumentContent(documentId); |
| 418 | } | |
| 419 | ||
| 420 | /** | |
| 421 | * Returns names of nodes already traversed | |
| 422 | * @param documentId id of the document to check | |
| 423 | * @return names of nodes already traversed | |
| 424 | * @throws WorkflowException if an error occurs | |
| 425 | * @see WorkflowUtility#getPreviousRouteNodeNames(Long) | |
| 426 | */ | |
| 427 | public String[] getPreviousRouteNodeNames(String documentId) throws WorkflowException { | |
| 428 | 0 | return getWorkflowUtility().getPreviousRouteNodeNames(documentId); |
| 429 | } | |
| 430 | ||
| 431 | /** | |
| 432 | * Checks whether a document would product at least one action request under the specified criteria | |
| 433 | * @param reportCriteriaDTO criteria under which to perform the check | |
| 434 | * @param actionRequestedCodes the types of action requests to check for | |
| 435 | * @param ignoreCurrentActionRequests determines if method should look only at simulation generated requests | |
| 436 | * or both simulation generated requests and requests that are currently active on the document | |
| 437 | * @return whether a document would product at least one action request under the specified criteria | |
| 438 | * @throws WorkflowException if an error occurs | |
| 439 | * @see WorkflowUtility#documentWillHaveAtLeastOneActionRequest(ReportCriteriaDTO, String[], boolean) | |
| 440 | */ | |
| 441 | public boolean documentWillHaveAtLeastOneActionRequest(ReportCriteriaDTO reportCriteriaDTO, String[] actionRequestedCodes, boolean ignoreCurrentActionRequests) throws WorkflowException { | |
| 442 | 0 | return getWorkflowUtility().documentWillHaveAtLeastOneActionRequest(reportCriteriaDTO, actionRequestedCodes, ignoreCurrentActionRequests); |
| 443 | } | |
| 444 | ||
| 445 | /** | |
| 446 | * @deprecated use {@link #documentWillHaveAtLeastOneActionRequest(ReportCriteriaDTO, String[], boolean)} instead | |
| 447 | * | |
| 448 | * This method assumes both existing and generated requests should be taken into account | |
| 449 | */ | |
| 450 | public boolean documentWillHaveAtLeastOneActionRequest(ReportCriteriaDTO reportCriteriaDTO, String[] actionRequestedCodes) throws WorkflowException { | |
| 451 | 0 | return getWorkflowUtility().documentWillHaveAtLeastOneActionRequest(reportCriteriaDTO, actionRequestedCodes, false); |
| 452 | } | |
| 453 | ||
| 454 | // DEPRECATED: as of Workflow 2.1 | |
| 455 | ||
| 456 | /** | |
| 457 | * @deprecated use {@link #isLastApproverAtNode(Long, String, String) instead | |
| 458 | */ | |
| 459 | protected boolean isLastApproverInRouteLevel(String documentId, String principalId, Integer routeLevel) throws WorkflowException { | |
| 460 | 0 | return getWorkflowUtility().isLastApproverInRouteLevel(documentId, principalId, routeLevel); |
| 461 | } | |
| 462 | ||
| 463 | /** | |
| 464 | * @deprecated use {@link #routeNodeHasApproverActionRequest(String, String, String)} | |
| 465 | */ | |
| 466 | protected boolean routeLevelHasApproverActionRequest(String docType, String docContent, Integer routeLevel) throws WorkflowException { | |
| 467 | 0 | return getWorkflowUtility().routeLevelHasApproverActionRequest(docType, docContent, routeLevel); |
| 468 | } | |
| 469 | ||
| 470 | /** | |
| 471 | * | |
| 472 | * This method gets a list of ids of all principals who have a pending action request for a document. | |
| 473 | * | |
| 474 | * @param actionRequestedCd | |
| 475 | * @param documentId | |
| 476 | * @return | |
| 477 | * @throws WorkflowException | |
| 478 | */ | |
| 479 | public List<String> getPrincipalIdsWithPendingActionRequestByActionRequestedAndDocId(String actionRequestedCd, String documentId) throws WorkflowException { | |
| 480 | 0 | String[] results = getWorkflowUtility().getPrincipalIdsWithPendingActionRequestByActionRequestedAndDocId(actionRequestedCd, documentId); |
| 481 | 0 | if (ObjectUtils.equals(null, results)) { |
| 482 | 0 | return null; |
| 483 | } | |
| 484 | 0 | return (List<String>) Arrays.asList(results); |
| 485 | } | |
| 486 | ||
| 487 | /** | |
| 488 | * This method gets a list of ids of all principals in the route log - | |
| 489 | * - initiators, | |
| 490 | * - people who have taken action, | |
| 491 | * - people with a pending action request, | |
| 492 | * - people who will receive an action request for the document in question | |
| 493 | * | |
| 494 | * @param documentId | |
| 495 | * @param lookFuture | |
| 496 | * @return | |
| 497 | * @throws WorkflowException | |
| 498 | */ | |
| 499 | public List<String> getPrincipalIdsInRouteLog(String documentId, boolean lookFuture) throws WorkflowException { | |
| 500 | 0 | String[] results = getWorkflowUtility().getPrincipalIdsInRouteLog(documentId, lookFuture); |
| 501 | 0 | if (ObjectUtils.equals(null, results)) { |
| 502 | 0 | return null; |
| 503 | } | |
| 504 | 0 | return (List<String>) Arrays.asList(results); |
| 505 | } | |
| 506 | ||
| 507 | public String getDocumentInitiatorPrincipalId( String documentId ) throws WorkflowException { | |
| 508 | 0 | return getWorkflowUtility().getDocumentInitiatorPrincipalId(documentId); |
| 509 | } | |
| 510 | public String getDocumentRoutedByPrincipalId( String documentId ) throws WorkflowException { | |
| 511 | 0 | return getWorkflowUtility().getDocumentRoutedByPrincipalId(documentId); |
| 512 | } | |
| 513 | ||
| 514 | } |