001 /**
002 * Copyright 2004-2013 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package org.kuali.hr.time.roles;
017
018
019 import java.util.ArrayList;
020 import java.util.List;
021
022 import javax.persistence.Transient;
023
024 import org.kuali.hr.core.KPMEConstants;
025 import org.kuali.hr.time.department.Department;
026 import org.kuali.hr.time.workarea.WorkArea;
027 import org.kuali.rice.kim.api.identity.Person;
028 import org.kuali.rice.kim.api.services.KimApiServiceLocator;
029 import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
030
031 public class TkRoleGroup extends PersistableBusinessObjectBase {
032 public static final String CACHE_NAME = KPMEConstants.APPLICATION_NAMESPACE_CODE + "/" + "TkRoleGroup";
033 private static final long serialVersionUID = 1L;
034
035 @Transient
036 private List<TkRole> roles = new ArrayList<TkRole>();
037 @Transient
038 private List<TkRole> inactiveRoles = new ArrayList<TkRole>();
039 @Transient
040 private List<TkRole> positionRoles = new ArrayList<TkRole>();
041 @Transient
042 private List<TkRole> inactivePositionRoles = new ArrayList<TkRole>();
043 @Transient
044 private String principalId;
045 @Transient
046 private Person person;
047
048 private WorkArea workAreaObj;
049 private Department departmentObj;
050 private TkRole tkRoleObj;
051
052 private String roleName;
053 private String principalName;
054 private Long workArea;
055 private String department;
056
057
058 public WorkArea getWorkAreaObj() {
059 return workAreaObj;
060 }
061
062 public void setWorkAreaObj(WorkArea workAreaObj) {
063 this.workAreaObj = workAreaObj;
064 }
065
066 public Department getDepartmentObj() {
067 return departmentObj;
068 }
069
070 public void setDepartmentObj(Department departmentObj) {
071 this.departmentObj = departmentObj;
072 }
073
074 public TkRole getTkRoleObj() {
075 return tkRoleObj;
076 }
077
078 public void setTkRoleObj(TkRole tkRoleObj) {
079 this.tkRoleObj = tkRoleObj;
080 }
081
082 public String getRoleName() {
083 return roleName;
084 }
085
086 public void setRoleName(String roleName) {
087 this.roleName = roleName;
088 }
089
090 public String getPrincipalName() {
091 return principalName;
092 }
093
094 public void setPrincipalName(String principalName) {
095 this.principalName = principalName;
096 }
097
098 public Long getWorkArea() {
099 return workArea;
100 }
101
102 public void setWorkArea(Long workArea) {
103 this.workArea = workArea;
104 }
105
106 public String getDepartment() {
107 return department;
108 }
109
110 public void setDepartment(String department) {
111 this.department = department;
112 }
113
114 public Person getPerson() {
115 return person;
116 }
117
118 public void setPerson(Person person) {
119 this.person = person;
120 }
121
122 public List<TkRole> getRoles() {
123 return roles;
124 }
125
126 public void setRoles(List<TkRole> roles) {
127 this.roles = roles;
128 }
129
130 public List<TkRole> getInactiveRoles() {
131 return inactiveRoles;
132 }
133
134 public void setInactiveRoles(List<TkRole> inactiveRoles) {
135 this.inactiveRoles = inactiveRoles;
136 }
137
138 public List<TkRole> getPositionRoles() {
139 return positionRoles;
140 }
141
142 public void setPositionRoles(List<TkRole> positionRoles) {
143 this.positionRoles = positionRoles;
144 }
145
146 public List<TkRole> getInactivePositionRoles() {
147 return inactivePositionRoles;
148 }
149
150 public void setInactivePositionRoles(List<TkRole> inactivePositionRoles) {
151 this.inactivePositionRoles = inactivePositionRoles;
152 }
153
154 public String getPrincipalId() {
155 return principalId;
156 }
157
158 public void setPrincipalId(String principalId) {
159 this.principalId = principalId;
160 }
161
162 public String getUserName() {
163 if (person == null) {
164 person = KimApiServiceLocator.getPersonService().getPerson(this.principalId);
165 }
166
167 return (person != null) ? person.getName() : "";
168 }
169 }