View Javadoc

1   /**
2    * Copyright 2004-2012 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      @Transient
36      private List<TkRole> roles = new ArrayList<TkRole>();
37      @Transient
38      private List<TkRole> inactiveRoles = new ArrayList<TkRole>();
39      @Transient
40      private List<TkRole> positionRoles = new ArrayList<TkRole>();
41      @Transient
42      private List<TkRole> inactivePositionRoles = new ArrayList<TkRole>();
43      @Transient
44      private String principalId;
45      @Transient
46      private Person person;
47      
48      private WorkArea workAreaObj;
49      private Department departmentObj;
50      private TkRole tkRoleObj;
51      
52  	private String roleName;
53  	private String principalName;
54  	private Long workArea;
55  	private String department;
56  	
57  	
58      public WorkArea getWorkAreaObj() {
59  		return workAreaObj;
60  	}
61  
62  	public void setWorkAreaObj(WorkArea workAreaObj) {
63  		this.workAreaObj = workAreaObj;
64  	}
65  
66  	public Department getDepartmentObj() {
67  		return departmentObj;
68  	}
69  
70  	public void setDepartmentObj(Department departmentObj) {
71  		this.departmentObj = departmentObj;
72  	}
73  
74  	public TkRole getTkRoleObj() {
75  		return tkRoleObj;
76  	}
77  
78  	public void setTkRoleObj(TkRole tkRoleObj) {
79  		this.tkRoleObj = tkRoleObj;
80  	}
81  
82  	public String getRoleName() {
83  		return roleName;
84  	}
85  
86  	public void setRoleName(String roleName) {
87  		this.roleName = roleName;
88  	}
89  
90  	public String getPrincipalName() {
91  		return principalName;
92  	}
93  
94  	public void setPrincipalName(String principalName) {
95  		this.principalName = principalName;
96  	}
97  
98  	public Long getWorkArea() {
99  		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 }