View Javadoc

1   /*
2    * Copyright 2005-2007 The Kuali Foundation
3    * 
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    * http://www.opensource.org/licenses/ecl2.php
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.krad.workflow.service.impl;
17  
18  import java.rmi.RemoteException;
19  import java.util.ArrayList;
20  import java.util.List;
21  
22  import org.apache.log4j.Logger;
23  import org.kuali.rice.kew.dto.ActionItemDTO;
24  import org.kuali.rice.kew.dto.ActionRequestDTO;
25  import org.kuali.rice.kew.dto.ActionTakenDTO;
26  import org.kuali.rice.kew.dto.DocumentSearchCriteriaDTO;
27  import org.kuali.rice.kew.dto.DocumentSearchResultDTO;
28  import org.kuali.rice.kew.dto.ReportCriteriaDTO;
29  import org.kuali.rice.kew.exception.WorkflowException;
30  import org.kuali.rice.kew.service.WorkflowInfo;
31  import org.kuali.rice.kew.util.KEWConstants;
32  import org.kuali.rice.krad.workflow.service.KualiWorkflowInfo;
33  import org.springframework.transaction.annotation.Transactional;
34  
35  
36  @SuppressWarnings("deprecation")
37  @Transactional
38  public class KualiWorkflowInfoImpl implements KualiWorkflowInfo {
39  
40      private static final Logger LOG = Logger.getLogger(KualiWorkflowInfoImpl.class);
41      
42      private WorkflowInfo workflowInfo;
43  
44      public KualiWorkflowInfoImpl() {
45          workflowInfo = new WorkflowInfo();
46      }
47  
48      private WorkflowInfo getWorkflowUtility() {
49          return workflowInfo;
50      }
51  
52      public String getNewResponsibilityId() throws WorkflowException {
53      	return getWorkflowUtility().getNewResponsibilityId();
54      }
55  
56      public ActionRequestDTO[] getActionRequests(String documentId) throws WorkflowException {
57      	return getWorkflowUtility().getActionRequests(documentId);
58      }
59  
60      public ActionRequestDTO[] getActionRequests(String documentId, String nodeName, String principalId) throws WorkflowException {
61      	return getWorkflowUtility().getActionRequests(documentId, nodeName, principalId);
62      }
63  
64      public ActionTakenDTO[] getActionsTaken(String documentId) throws WorkflowException {
65      	return getWorkflowUtility().getActionsTaken(documentId);
66      }
67    
68      public void reResolveRoleByDocTypeName(String documentTypeName, String roleName, String qualifiedRoleNameLabel) throws WorkflowException {
69      	getWorkflowUtility().reResolveRoleByDocTypeName(documentTypeName, roleName, qualifiedRoleNameLabel);
70      }
71  
72      public void reResolveRoleByDocumentId(String documentId, String roleName, String qualifiedRoleNameLabel) throws WorkflowException {
73      	getWorkflowUtility().reResolveRoleByDocumentId(documentId, roleName, qualifiedRoleNameLabel);
74      }
75          
76      /**
77       * @deprecated
78       * @see org.kuali.rice.krad.workflow.service.KualiWorkflowInfo#documentWillHaveAtLeastOneActionRequest(org.kuali.rice.kew.dto.ReportCriteriaDTO, java.lang.String[])
79       */
80      public boolean documentWillHaveAtLeastOneActionRequest(ReportCriteriaDTO reportCriteriaDTO, String[] actionRequestedCodes) throws WorkflowException {
81          return documentWillHaveAtLeastOneActionRequest(reportCriteriaDTO, actionRequestedCodes, false);
82      }
83  
84      /**
85       * @see org.kuali.rice.krad.workflow.service.KualiWorkflowInfo#documentWillHaveAtLeastOneActionRequest(org.kuali.rice.kew.dto.ReportCriteriaDTO, java.lang.String[], boolean)
86       */
87      public boolean documentWillHaveAtLeastOneActionRequest(ReportCriteriaDTO reportCriteriaDTO, String[] actionRequestedCodes, boolean ignoreCurrentlyActiveRequests) throws WorkflowException {
88      	return getWorkflowUtility().documentWillHaveAtLeastOneActionRequest(reportCriteriaDTO, actionRequestedCodes, ignoreCurrentlyActiveRequests);
89      }
90      
91      /**
92       * @see org.kuali.rice.krad.workflow.service.KualiWorkflowInfo#getApprovalRequestedUsers(java.lang.String)
93       */
94      public List<String> getApprovalRequestedUsers(String documentId) throws WorkflowException {
95      	ActionItemDTO[] actionItemVOs = getWorkflowUtility().getActionItems(documentId, new String[]{KEWConstants.ACTION_REQUEST_COMPLETE_REQ, KEWConstants.ACTION_REQUEST_APPROVE_REQ});
96      	List<String> users = new ArrayList<String>();
97      	for (int i = 0; i < actionItemVOs.length; i++) {
98      		ActionItemDTO actionItemVO = actionItemVOs[i];
99      		users.add(actionItemVO.getPrincipalId());
100     	}
101     	return users;
102     }
103 
104     public DocumentSearchResultDTO performDocumentSearch(DocumentSearchCriteriaDTO criteriaVO) throws WorkflowException {
105     	return getWorkflowUtility().performDocumentSearch(criteriaVO);
106     }
107 
108     public DocumentSearchResultDTO performDocumentSearch(String principalId, DocumentSearchCriteriaDTO criteriaVO) throws RemoteException, WorkflowException {
109     	return getWorkflowUtility().performDocumentSearch(principalId, criteriaVO);
110     }
111     
112 }