| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 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 |
|
|
| 38 |
|
|
| 39 |
|
@author |
| 40 |
|
|
| 41 |
|
|
| 42 |
|
@Entity |
| 43 |
|
@Table(name="KRIM_ROLE_T") |
|
|
|
| 0% |
Uncovered Elements: 106 (106) |
Complexity: 46 |
Complexity Density: 0.79 |
|
| 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 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 91 |
0
|
public String getRoleId() {... |
| 92 |
0
|
return this.roleId; |
| 93 |
|
} |
| 94 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 95 |
0
|
public void setRoleId(String roleId) {... |
| 96 |
0
|
this.roleId = roleId; |
| 97 |
|
} |
| 98 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 99 |
0
|
public String getRoleName() {... |
| 100 |
0
|
return this.roleName; |
| 101 |
|
} |
| 102 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 103 |
0
|
public void setRoleName(String roleName) {... |
| 104 |
0
|
this.roleName = roleName; |
| 105 |
|
} |
| 106 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 107 |
0
|
public String getKimTypeId() {... |
| 108 |
0
|
return this.kimTypeId; |
| 109 |
|
} |
| 110 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 111 |
0
|
public void setKimTypeId(String kimTypeId) {... |
| 112 |
0
|
this.kimTypeId = kimTypeId; |
| 113 |
|
} |
| 114 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 115 |
0
|
public String getNamespaceCode() {... |
| 116 |
0
|
return this.namespaceCode; |
| 117 |
|
} |
| 118 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 119 |
0
|
public void setNamespaceCode(String namespaceCode) {... |
| 120 |
0
|
this.namespaceCode = namespaceCode; |
| 121 |
|
} |
| 122 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 123 |
0
|
public String getPrincipalName() {... |
| 124 |
0
|
return this.principalName; |
| 125 |
|
} |
| 126 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 127 |
0
|
public void setPrincipalName(String principalName) {... |
| 128 |
0
|
this.principalName = principalName; |
| 129 |
|
} |
| 130 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 131 |
0
|
public String getGroupNamespaceCode() {... |
| 132 |
0
|
return this.groupNamespaceCode; |
| 133 |
|
} |
| 134 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 135 |
0
|
public void setGroupNamespaceCode(String groupNamespaceCode) {... |
| 136 |
0
|
this.groupNamespaceCode = groupNamespaceCode; |
| 137 |
|
} |
| 138 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 139 |
0
|
public String getGroupName() {... |
| 140 |
0
|
return this.groupName; |
| 141 |
|
} |
| 142 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 143 |
0
|
public void setGroupName(String groupName) {... |
| 144 |
0
|
this.groupName = groupName; |
| 145 |
|
} |
| 146 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 147 |
0
|
public String getPermNamespaceCode() {... |
| 148 |
0
|
return this.permNamespaceCode; |
| 149 |
|
} |
| 150 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 151 |
0
|
public void setPermNamespaceCode(String permNamespaceCode) {... |
| 152 |
0
|
this.permNamespaceCode = permNamespaceCode; |
| 153 |
|
} |
| 154 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 155 |
0
|
public String getPermName() {... |
| 156 |
0
|
return this.permName; |
| 157 |
|
} |
| 158 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 159 |
0
|
public void setPermName(String permName) {... |
| 160 |
0
|
this.permName = permName; |
| 161 |
|
} |
| 162 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 163 |
0
|
public String getRespNamespaceCode() {... |
| 164 |
0
|
return this.respNamespaceCode; |
| 165 |
|
} |
| 166 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 167 |
0
|
public void setRespNamespaceCode(String respNamespaceCode) {... |
| 168 |
0
|
this.respNamespaceCode = respNamespaceCode; |
| 169 |
|
} |
| 170 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 171 |
0
|
public String getRespName() {... |
| 172 |
0
|
return this.respName; |
| 173 |
|
} |
| 174 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 175 |
0
|
public void setRespName(String respName) {... |
| 176 |
0
|
this.respName = respName; |
| 177 |
|
} |
| 178 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 179 |
0
|
public String getPermTmplNamespaceCode() {... |
| 180 |
0
|
return this.permTmplNamespaceCode; |
| 181 |
|
} |
| 182 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 183 |
0
|
public void setPermTmplNamespaceCode(String permTmplNamespaceCode) {... |
| 184 |
0
|
this.permTmplNamespaceCode = permTmplNamespaceCode; |
| 185 |
|
} |
| 186 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 187 |
0
|
public String getPermTmplName() {... |
| 188 |
0
|
return this.permTmplName; |
| 189 |
|
} |
| 190 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 191 |
0
|
public void setPermTmplName(String permTmplName) {... |
| 192 |
0
|
this.permTmplName = permTmplName; |
| 193 |
|
} |
| 194 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 195 |
0
|
public String getRespTmplNamespaceCode() {... |
| 196 |
0
|
return this.respTmplNamespaceCode; |
| 197 |
|
} |
| 198 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 199 |
0
|
public void setRespTmplNamespaceCode(String respTmplNamespaceCode) {... |
| 200 |
0
|
this.respTmplNamespaceCode = respTmplNamespaceCode; |
| 201 |
|
} |
| 202 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 203 |
0
|
public String getRespTmplName() {... |
| 204 |
0
|
return this.respTmplName; |
| 205 |
|
} |
| 206 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 207 |
0
|
public void setRespTmplName(String respTmplName) {... |
| 208 |
0
|
this.respTmplName = respTmplName; |
| 209 |
|
} |
| 210 |
|
|
| 211 |
|
|
| 212 |
|
@return |
| 213 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 214 |
0
|
public String getRoleDescription() {... |
| 215 |
0
|
return this.roleDescription; |
| 216 |
|
} |
| 217 |
|
|
| 218 |
|
|
| 219 |
|
@param |
| 220 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 221 |
0
|
public void setRoleDescription(String roleDescription) {... |
| 222 |
0
|
this.roleDescription = roleDescription; |
| 223 |
|
} |
| 224 |
|
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 3 |
Complexity Density: 0.6 |
|
| 225 |
0
|
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 |
| 239 |
|
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
| 240 |
0
|
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 |
| 251 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 252 |
0
|
public int hashCode() {... |
| 253 |
0
|
return new HashCodeBuilder( -460627871, 746615189 ).append( this.roleId ).toHashCode(); |
| 254 |
|
} |
| 255 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 256 |
0
|
public KimTypeInfo getKimRoleType() {... |
| 257 |
0
|
return getTypeInfoService().getKimType(kimTypeId); |
| 258 |
|
} |
| 259 |
|
private transient static KimTypeInfoService kimTypeInfoService; |
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 260 |
0
|
protected KimTypeInfoService getTypeInfoService() {... |
| 261 |
0
|
if(kimTypeInfoService == null){ |
| 262 |
0
|
kimTypeInfoService = KIMServiceLocatorWeb.getTypeInfoService(); |
| 263 |
|
} |
| 264 |
0
|
return kimTypeInfoService; |
| 265 |
|
} |
| 266 |
|
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 1 |
Complexity Density: 0.12 |
|
| 267 |
0
|
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 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 280 |
0
|
public List<RoleMemberImpl> getMembers() {... |
| 281 |
0
|
return this.members; |
| 282 |
|
} |
| 283 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 284 |
0
|
public void setMembers(List<RoleMemberImpl> members) {... |
| 285 |
0
|
this.members = members; |
| 286 |
|
} |
| 287 |
|
|
| 288 |
|
|
| 289 |
|
@return |
| 290 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 291 |
0
|
public boolean isActive() {... |
| 292 |
0
|
return this.active; |
| 293 |
|
} |
| 294 |
|
|
| 295 |
|
|
| 296 |
|
@param |
| 297 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 298 |
0
|
public void setActive(boolean active) {... |
| 299 |
0
|
this.active = active; |
| 300 |
|
} |
| 301 |
|
} |