View Javadoc

1   /**
2    * Copyright 2004-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.hr.time.roles;
17  
18  
19  import java.util.ArrayList;
20  import java.util.List;
21  
22  import javax.persistence.Transient;
23  
24  import org.kuali.hr.core.KPMEConstants;
25  import org.kuali.hr.time.department.Department;
26  import org.kuali.hr.time.workarea.WorkArea;
27  import org.kuali.rice.kim.api.identity.Person;
28  import org.kuali.rice.kim.api.services.KimApiServiceLocator;
29  import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
30  
31  public class TkRoleGroup extends PersistableBusinessObjectBase {
32      public static final String CACHE_NAME = KPMEConstants.APPLICATION_NAMESPACE_CODE + "/" + "TkRoleGroup";
33      private static final long serialVersionUID = 1L;
34  
35      private String principalId;
36      private List<TkRole> roles = new ArrayList<TkRole>();
37      @Transient
38      private transient List<TkRole> inactiveRoles = new ArrayList<TkRole>();
39      @Transient
40      private transient List<TkRole> positionRoles = new ArrayList<TkRole>();
41      @Transient
42      private transient List<TkRole> inactivePositionRoles = new ArrayList<TkRole>();
43  
44      @Transient
45      private transient Person person;
46      
47      private transient WorkArea workAreaObj;
48      private transient Department departmentObj;
49      private transient TkRole tkRoleObj;
50      
51  	private String roleName;
52  	private String principalName;
53  	private Long workArea;
54  	private String department;
55  	
56  	
57      public WorkArea getWorkAreaObj() {
58  		return workAreaObj;
59  	}
60  
61  	public void setWorkAreaObj(WorkArea workAreaObj) {
62  		this.workAreaObj = workAreaObj;
63  	}
64  
65  	public Department getDepartmentObj() {
66  		return departmentObj;
67  	}
68  
69  	public void setDepartmentObj(Department departmentObj) {
70  		this.departmentObj = departmentObj;
71  	}
72  
73  	public TkRole getTkRoleObj() {
74  		return tkRoleObj;
75  	}
76  
77  	public void setTkRoleObj(TkRole tkRoleObj) {
78  		this.tkRoleObj = tkRoleObj;
79  	}
80  
81  	public String getRoleName() {
82  		return roleName;
83  	}
84  
85  	public void setRoleName(String roleName) {
86  		this.roleName = roleName;
87  	}
88  
89  	public String getPrincipalName() {
90  		return principalName;
91  	}
92  
93  	public void setPrincipalName(String principalName) {
94  		this.principalName = principalName;
95  	}
96  
97  	public Long getWorkArea() {
98  		return workArea;
99  	}
100 
101 	public void setWorkArea(Long workArea) {
102 		this.workArea = workArea;
103 	}
104 
105 	public String getDepartment() {
106 		return department;
107 	}
108 
109 	public void setDepartment(String department) {
110 		this.department = department;
111 	}
112 
113 	public Person getPerson() {
114         return person;
115     }
116 
117     public void setPerson(Person person) {
118         this.person = person;
119     }
120 
121     public List<TkRole> getRoles() {
122         return roles;
123     }
124 
125     public void setRoles(List<TkRole> roles) {
126         this.roles = roles;
127     }
128 
129     public List<TkRole> getInactiveRoles() {
130 		return inactiveRoles;
131 	}
132 
133 	public void setInactiveRoles(List<TkRole> inactiveRoles) {
134 		this.inactiveRoles = inactiveRoles;
135 	}
136 
137 	public List<TkRole> getPositionRoles() {
138 		return positionRoles;
139 	}
140 
141 	public void setPositionRoles(List<TkRole> positionRoles) {
142 		this.positionRoles = positionRoles;
143 	}
144 
145 	public List<TkRole> getInactivePositionRoles() {
146 		return inactivePositionRoles;
147 	}
148 
149 	public void setInactivePositionRoles(List<TkRole> inactivePositionRoles) {
150 		this.inactivePositionRoles = inactivePositionRoles;
151 	}
152 
153 	public String getPrincipalId() {
154         return principalId;
155     }
156 
157     public void setPrincipalId(String principalId) {
158         this.principalId = principalId;
159     }
160 
161     public String getUserName() {
162         if (person == null) {
163             person = KimApiServiceLocator.getPersonService().getPerson(this.principalId);
164         }
165 
166         return (person != null) ? person.getName() : "";
167     }
168 }