Clover Coverage Report - Implementation 2.0.0-SNAPSHOT
Coverage timestamp: Wed Dec 31 1969 19:00:00 EST
../../../../../../img/srcFileCovDistChart0.png 0% of files have more coverage
58   301   46   1.38
6   210   0.79   42
42     1.1  
1    
 
  RoleImpl       Line # 44 58 0% 46 106 0% 0.0
 
No Tests
 
1    /*
2    * Copyright 2007-2009 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.kim.bo.impl;
17   
18    import org.apache.commons.lang.builder.EqualsBuilder;
19    import org.apache.commons.lang.builder.HashCodeBuilder;
20    import org.hibernate.annotations.Fetch;
21    import org.hibernate.annotations.FetchMode;
22    import org.hibernate.annotations.Type;
23    import org.kuali.rice.kim.bo.Role;
24    import org.kuali.rice.kim.bo.role.dto.KimRoleInfo;
25    import org.kuali.rice.kim.bo.role.impl.RoleMemberImpl;
26    import org.kuali.rice.kim.bo.types.dto.KimTypeInfo;
27    import org.kuali.rice.kim.service.KIMServiceLocatorWeb;
28    import org.kuali.rice.kim.service.KimTypeInfoService;
29    import org.kuali.rice.kns.bo.PersistableBusinessObjectBase;
30    import org.springframework.util.AutoPopulatingList;
31   
32    import javax.persistence.*;
33    import java.util.ArrayList;
34    import java.util.List;
35   
36    /**
37    * This is a description of what this class does - shyu don't forget to fill this in.
38    *
39    * @author Kuali Rice Team (rice.collab@kuali.org)
40    *
41    */
42    @Entity
43    @Table(name="KRIM_ROLE_T")
 
44    public class RoleImpl extends PersistableBusinessObjectBase implements Role {
45   
46    private static final long serialVersionUID = 1L;
47   
48    @Id
49    @Column(name="ROLE_ID")
50    protected String roleId;
51    @Column(name="ROLE_NM")
52    protected String roleName;
53    @Column(name="DESC_TXT",length=4000)
54    protected String roleDescription;
55    @Type(type="yes_no")
56    @Column(name="ACTV_IND")
57    protected boolean active;
58    @Column(name="KIM_TYP_ID")
59    protected String kimTypeId;
60    @Column(name="NMSPC_CD")
61    protected String namespaceCode;
62   
63    @OneToMany(targetEntity=RoleMemberImpl.class,cascade={CascadeType.MERGE, CascadeType.REFRESH},fetch=FetchType.EAGER)
64    @Fetch(value = FetchMode.SELECT)
65    @JoinColumn(name="ROLE_ID", insertable=false, updatable=false)
66    protected List<RoleMemberImpl> members = new AutoPopulatingList(RoleMemberImpl.class);
67   
68    @Transient
69    protected String principalName;
70    @Transient
71    protected String groupNamespaceCode;
72    @Transient
73    protected String groupName;
74    @Transient
75    protected String permNamespaceCode;
76    @Transient
77    protected String permName;
78    @Transient
79    protected String permTmplNamespaceCode;
80    @Transient
81    protected String permTmplName;
82    @Transient
83    protected String respNamespaceCode;
84    @Transient
85    protected String respName;
86    @Transient
87    protected String respTmplNamespaceCode;
88    @Transient
89    protected String respTmplName;
90   
 
91  0 toggle public String getRoleId() {
92  0 return this.roleId;
93    }
94   
 
95  0 toggle public void setRoleId(String roleId) {
96  0 this.roleId = roleId;
97    }
98   
 
99  0 toggle public String getRoleName() {
100  0 return this.roleName;
101    }
102   
 
103  0 toggle public void setRoleName(String roleName) {
104  0 this.roleName = roleName;
105    }
106   
 
107  0 toggle public String getKimTypeId() {
108  0 return this.kimTypeId;
109    }
110   
 
111  0 toggle public void setKimTypeId(String kimTypeId) {
112  0 this.kimTypeId = kimTypeId;
113    }
114   
 
115  0 toggle public String getNamespaceCode() {
116  0 return this.namespaceCode;
117    }
118   
 
119  0 toggle public void setNamespaceCode(String namespaceCode) {
120  0 this.namespaceCode = namespaceCode;
121    }
122   
 
123  0 toggle public String getPrincipalName() {
124  0 return this.principalName;
125    }
126   
 
127  0 toggle public void setPrincipalName(String principalName) {
128  0 this.principalName = principalName;
129    }
130   
 
131  0 toggle public String getGroupNamespaceCode() {
132  0 return this.groupNamespaceCode;
133    }
134   
 
135  0 toggle public void setGroupNamespaceCode(String groupNamespaceCode) {
136  0 this.groupNamespaceCode = groupNamespaceCode;
137    }
138   
 
139  0 toggle public String getGroupName() {
140  0 return this.groupName;
141    }
142   
 
143  0 toggle public void setGroupName(String groupName) {
144  0 this.groupName = groupName;
145    }
146   
 
147  0 toggle public String getPermNamespaceCode() {
148  0 return this.permNamespaceCode;
149    }
150   
 
151  0 toggle public void setPermNamespaceCode(String permNamespaceCode) {
152  0 this.permNamespaceCode = permNamespaceCode;
153    }
154   
 
155  0 toggle public String getPermName() {
156  0 return this.permName;
157    }
158   
 
159  0 toggle public void setPermName(String permName) {
160  0 this.permName = permName;
161    }
162   
 
163  0 toggle public String getRespNamespaceCode() {
164  0 return this.respNamespaceCode;
165    }
166   
 
167  0 toggle public void setRespNamespaceCode(String respNamespaceCode) {
168  0 this.respNamespaceCode = respNamespaceCode;
169    }
170   
 
171  0 toggle public String getRespName() {
172  0 return this.respName;
173    }
174   
 
175  0 toggle public void setRespName(String respName) {
176  0 this.respName = respName;
177    }
178   
 
179  0 toggle public String getPermTmplNamespaceCode() {
180  0 return this.permTmplNamespaceCode;
181    }
182   
 
183  0 toggle public void setPermTmplNamespaceCode(String permTmplNamespaceCode) {
184  0 this.permTmplNamespaceCode = permTmplNamespaceCode;
185    }
186   
 
187  0 toggle public String getPermTmplName() {
188  0 return this.permTmplName;
189    }
190   
 
191  0 toggle public void setPermTmplName(String permTmplName) {
192  0 this.permTmplName = permTmplName;
193    }
194   
 
195  0 toggle public String getRespTmplNamespaceCode() {
196  0 return this.respTmplNamespaceCode;
197    }
198   
 
199  0 toggle public void setRespTmplNamespaceCode(String respTmplNamespaceCode) {
200  0 this.respTmplNamespaceCode = respTmplNamespaceCode;
201    }
202   
 
203  0 toggle public String getRespTmplName() {
204  0 return this.respTmplName;
205    }
206   
 
207  0 toggle public void setRespTmplName(String respTmplName) {
208  0 this.respTmplName = respTmplName;
209    }
210   
211    /**
212    * @return the roleDescription
213    */
 
214  0 toggle public String getRoleDescription() {
215  0 return this.roleDescription;
216    }
217   
218    /**
219    * @param roleDescription the roleDescription to set
220    */
 
221  0 toggle public void setRoleDescription(String roleDescription) {
222  0 this.roleDescription = roleDescription;
223    }
224   
 
225  0 toggle protected List<String> getMembersOfType( String memberTypeCode ) {
226  0 List<String> roleMembers = new ArrayList<String>();
227  0 for ( RoleMemberImpl member : getMembers() ) {
228  0 if ( member.getMemberTypeCode().equals ( memberTypeCode )
229    && member.isActive() ) {
230  0 roleMembers.add( member.getMemberId() );
231    }
232    }
233  0 return roleMembers;
234    }
235   
236   
237    /**
238    * @see java.lang.Object#equals(Object)
239    */
 
240  0 toggle public boolean equals(Object object) {
241  0 if ( !(object instanceof Role) ) {
242  0 return false;
243    }
244  0 Role rhs = (Role)object;
245  0 return new EqualsBuilder().append( this.roleId, rhs.getRoleId() ).isEquals();
246    }
247   
248   
249    /**
250    * @see java.lang.Object#hashCode()
251    */
 
252  0 toggle public int hashCode() {
253  0 return new HashCodeBuilder( -460627871, 746615189 ).append( this.roleId ).toHashCode();
254    }
255   
 
256  0 toggle public KimTypeInfo getKimRoleType() {
257  0 return getTypeInfoService().getKimType(kimTypeId);
258    }
259    private transient static KimTypeInfoService kimTypeInfoService;
 
260  0 toggle protected KimTypeInfoService getTypeInfoService() {
261  0 if(kimTypeInfoService == null){
262  0 kimTypeInfoService = KIMServiceLocatorWeb.getTypeInfoService();
263    }
264  0 return kimTypeInfoService;
265    }
266   
 
267  0 toggle public KimRoleInfo toSimpleInfo() {
268  0 KimRoleInfo dto = new KimRoleInfo();
269   
270  0 dto.setRoleId( getRoleId() );
271  0 dto.setRoleName( getRoleName() );
272  0 dto.setNamespaceCode( getNamespaceCode() );
273  0 dto.setRoleDescription( getRoleDescription() );
274  0 dto.setKimTypeId( getKimTypeId() );
275  0 dto.setActive( isActive() );
276   
277  0 return dto;
278    }
279   
 
280  0 toggle public List<RoleMemberImpl> getMembers() {
281  0 return this.members;
282    }
283   
 
284  0 toggle public void setMembers(List<RoleMemberImpl> members) {
285  0 this.members = members;
286    }
287   
288    /**
289    * @return the active
290    */
 
291  0 toggle public boolean isActive() {
292  0 return this.active;
293    }
294   
295    /**
296    * @param active the active to set
297    */
 
298  0 toggle public void setActive(boolean active) {
299  0 this.active = active;
300    }
301    }