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 private String principalId; 036 private List<TkRole> roles = new ArrayList<TkRole>(); 037 @Transient 038 private transient List<TkRole> inactiveRoles = new ArrayList<TkRole>(); 039 @Transient 040 private transient List<TkRole> positionRoles = new ArrayList<TkRole>(); 041 @Transient 042 private transient List<TkRole> inactivePositionRoles = new ArrayList<TkRole>(); 043 044 @Transient 045 private transient Person person; 046 047 private transient WorkArea workAreaObj; 048 private transient Department departmentObj; 049 private transient TkRole tkRoleObj; 050 051 private String roleName; 052 private String principalName; 053 private Long workArea; 054 private String department; 055 056 057 public WorkArea getWorkAreaObj() { 058 return workAreaObj; 059 } 060 061 public void setWorkAreaObj(WorkArea workAreaObj) { 062 this.workAreaObj = workAreaObj; 063 } 064 065 public Department getDepartmentObj() { 066 return departmentObj; 067 } 068 069 public void setDepartmentObj(Department departmentObj) { 070 this.departmentObj = departmentObj; 071 } 072 073 public TkRole getTkRoleObj() { 074 return tkRoleObj; 075 } 076 077 public void setTkRoleObj(TkRole tkRoleObj) { 078 this.tkRoleObj = tkRoleObj; 079 } 080 081 public String getRoleName() { 082 return roleName; 083 } 084 085 public void setRoleName(String roleName) { 086 this.roleName = roleName; 087 } 088 089 public String getPrincipalName() { 090 return principalName; 091 } 092 093 public void setPrincipalName(String principalName) { 094 this.principalName = principalName; 095 } 096 097 public Long getWorkArea() { 098 return workArea; 099 } 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 }