01: /*
02: * Copyright 2005-2007 The Kuali Foundation.
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
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.core.workflow.service.impl;
17:
18: import java.util.ArrayList;
19: import java.util.Arrays;
20: import java.util.Collection;
21: import java.util.List;
22:
23: import org.kuali.core.util.spring.Cached;
24: import org.kuali.core.workflow.service.WorkflowGroupService;
25: import org.kuali.rice.KNSServiceLocator;
26: import org.springframework.transaction.annotation.Transactional;
27:
28: import edu.iu.uis.eden.clientapp.vo.UserIdVO;
29: import edu.iu.uis.eden.clientapp.vo.WorkgroupNameIdVO;
30: import edu.iu.uis.eden.clientapp.vo.WorkgroupVO;
31: import edu.iu.uis.eden.exception.WorkflowException;
32:
33: /**
34: * This class implements the WorkflowGroup Service using OneStart Workflow.
35: *
36: *
37: */
38: @Transactional
39: public class WorkflowGroupServiceImpl implements WorkflowGroupService {
40: private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger
41: .getLogger(WorkflowGroupServiceImpl.class);
42:
43: /**
44: * @see org.kuali.core.workflow.service.WorkflowGroupService#getWorkflowUsersGroups(edu.iu.uis.eden.user.UserId)
45: */
46: public Collection getWorkflowUsersGroups(UserIdVO userId)
47: throws WorkflowException {
48: if (LOG.isDebugEnabled()) {
49: LOG.debug("retrieving workflowGroups for '" + userId + "'");
50: }
51:
52: List workgroupList = null;
53: WorkgroupVO[] workgroupArray = KNSServiceLocator
54: .getWorkflowInfoService().getUserWorkgroups(userId);
55: if (workgroupArray != null) {
56: workgroupList = Arrays.asList(workgroupArray);
57: } else {
58: workgroupList = new ArrayList();
59: }
60:
61: if (LOG.isDebugEnabled()) {
62: LOG.debug("retrieved workflowGroups for '" + userId + "'");
63: }
64: return workgroupList;
65: }
66:
67: /**
68: *
69: * @see org.kuali.core.workflow.service.WorkflowGroupService#getByGroupName(java.lang.String)
70: */
71: @Cached
72: public WorkgroupVO getWorkgroupByGroupName(String groupName)
73: throws WorkflowException {
74: if (LOG.isDebugEnabled()) {
75: LOG.debug("retrieving workgroup by name '" + groupName
76: + "'");
77: }
78: WorkgroupVO workgroupVO = KNSServiceLocator
79: .getWorkflowInfoService().getWorkgroup(
80: new WorkgroupNameIdVO(groupName));
81: if (LOG.isDebugEnabled()) {
82: LOG
83: .debug("retrieved workgroup by name '" + groupName
84: + "'");
85: }
86:
87: return workgroupVO;
88: }
89: }
|