View Javadoc

1   /**
2    * Copyright 2005-2013 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.kew.rule;
17  
18  import org.kuali.rice.kim.api.group.Group;
19  import org.kuali.rice.kim.api.services.KimApiServiceLocator;
20  import org.kuali.rice.kim.impl.group.GroupBo;
21  
22  /**
23   * Represents a rule responsibility which points to a group.
24   *
25   * @author Kuali Rice Team (rice.collab@kuali.org)
26   *
27   */
28  public class GroupRuleResponsibility extends RuleResponsibilityBo {
29      protected Group group;
30  	private String namespaceCode;
31  	private String name;
32  
33  	public String getNamespaceCode() {
34  		return this.namespaceCode;
35  	}
36  
37  	public void setNamespaceCode(String namespaceCode) {
38  		this.namespaceCode = namespaceCode;
39  	}
40  
41  	public String getName() {
42  		return this.name;
43  	}
44  
45  	public void setName(String name) {
46  		this.name = name;
47  	}
48  
49      @Override
50  	public Group getGroup() {
51          if (this.group == null) {
52  	        this.group = KimApiServiceLocator.getGroupService().getGroupByNamespaceCodeAndName(getNamespaceCode(),
53                      getName());
54          }
55          return this.group;
56  	}
57  
58      public GroupBo getGroupBo() {
59          Group grp = null;
60          if (isUsingGroup()) {
61              grp = KimApiServiceLocator.getGroupService().getGroupByNamespaceCodeAndName(getNamespaceCode(),getName());
62          }
63          if(null != grp){
64              return GroupBo.from(grp);
65          }  else {
66              return null;
67          }
68      }
69  }