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
174   556   72   3.87
54   451   0.41   45
45     1.6  
1    
 
  IdentityManagementPersonDocument       Line # 88 174 0% 72 273 0% 0.0
 
No Tests
 
1    /*
2    * Copyright 2007-2008 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.document;
17   
18    import java.util.ArrayList;
19    import java.util.HashMap;
20    import java.util.List;
21    import java.util.Map;
22   
23    import javax.persistence.AssociationOverride;
24    import javax.persistence.AssociationOverrides;
25    import javax.persistence.AttributeOverride;
26    import javax.persistence.AttributeOverrides;
27    import javax.persistence.CascadeType;
28    import javax.persistence.Column;
29    import javax.persistence.Entity;
30    import javax.persistence.FetchType;
31    import javax.persistence.GeneratedValue;
32    import javax.persistence.JoinColumn;
33    import javax.persistence.OneToMany;
34    import javax.persistence.OneToOne;
35    import javax.persistence.Table;
36    import javax.persistence.Transient;
37   
38    import org.apache.commons.collections.CollectionUtils;
39    import org.apache.commons.lang.StringUtils;
40    import org.hibernate.annotations.Fetch;
41    import org.hibernate.annotations.FetchMode;
42    import org.hibernate.annotations.GenericGenerator;
43    import org.hibernate.annotations.Parameter;
44    import org.hibernate.annotations.Type;
45    import org.kuali.rice.kew.dto.DocumentRouteStatusChangeDTO;
46    import org.kuali.rice.kim.bo.entity.dto.KimEntityEmploymentInformationInfo;
47    import org.kuali.rice.kim.bo.role.dto.KimRoleInfo;
48    import org.kuali.rice.kim.bo.types.dto.KimTypeInfo;
49    import org.kuali.rice.kim.bo.ui.KimDocumentRoleMember;
50    import org.kuali.rice.kim.bo.ui.KimDocumentRoleQualifier;
51    import org.kuali.rice.kim.bo.ui.PersonDocumentAddress;
52    import org.kuali.rice.kim.bo.ui.PersonDocumentAffiliation;
53    import org.kuali.rice.kim.bo.ui.PersonDocumentCitizenship;
54    import org.kuali.rice.kim.bo.ui.PersonDocumentEmail;
55    import org.kuali.rice.kim.bo.ui.PersonDocumentEmploymentInfo;
56    import org.kuali.rice.kim.bo.ui.PersonDocumentGroup;
57    import org.kuali.rice.kim.bo.ui.PersonDocumentName;
58    import org.kuali.rice.kim.bo.ui.PersonDocumentPhone;
59    import org.kuali.rice.kim.bo.ui.PersonDocumentPrivacy;
60    import org.kuali.rice.kim.bo.ui.PersonDocumentRole;
61    import org.kuali.rice.kim.bo.ui.RoleDocumentDelegationMember;
62    import org.kuali.rice.kim.bo.ui.RoleDocumentDelegationMemberQualifier;
63    import org.kuali.rice.kim.service.KIMServiceLocator;
64    import org.kuali.rice.kim.service.KIMServiceLocatorInternal;
65    import org.kuali.rice.kim.service.KIMServiceLocatorWeb;
66    import org.kuali.rice.kim.service.UiDocumentService;
67    import org.kuali.rice.kim.util.KimConstants;
68    import org.kuali.rice.kns.service.DocumentHelperService;
69    import org.kuali.rice.kns.service.KNSServiceLocatorWeb;
70    import org.kuali.rice.kns.service.SequenceAccessorService;
71    import org.kuali.rice.kns.util.GlobalVariables;
72   
73    /**
74    * This is a description of what this class does - shyu don't forget to fill
75    * this in.
76    *
77    * @author Kuali Rice Team (rice.collab@kuali.org)
78    *
79    */
80    @Entity
81    @AttributeOverrides({
82    @AttributeOverride(name="documentNumber",column=@Column(name="FDOC_NBR"))
83    })
84    @AssociationOverrides({
85    @AssociationOverride(name="documentHeader",joinColumns=@JoinColumn(name="FDOC_NBR",referencedColumnName="DOC_HDR_ID",insertable=false,updatable=false))
86    })
87    @Table(name="KRIM_PERSON_DOCUMENT_T")
 
88    public class IdentityManagementPersonDocument extends IdentityManagementKimDocument {
89   
90    protected static final long serialVersionUID = -534993712085516925L;
91    // principal data
92   
93    @GeneratedValue(generator="KRIM_PRNCPL_ID_S")
94    @GenericGenerator(name="KRIM_PRNCPL_ID_S",strategy="org.kuali.rice.core.jpa.spring.RiceNumericStringSequenceStyleGenerator",parameters={
95    @Parameter(name="sequence_name",value="KRIM_PRNCPL_ID_S"),
96    @Parameter(name="value_column",value="id")
97    })
98    @Column(name="PRNCPL_ID")
99    protected String principalId;
100    @Column(name="PRNCPL_NM")
101    protected String principalName;
102    @GeneratedValue(generator="KRIM_ENTITY_ID_S")
103    @GenericGenerator(name="KRIM_ENTITY_ID_S",strategy="org.kuali.rice.core.jpa.spring.RiceNumericStringSequenceStyleGenerator",parameters={
104    @Parameter(name="sequence_name",value="KRIM_ENTITY_ID_S"),
105    @Parameter(name="value_column",value="id")
106    })
107    @Column(name="ENTITY_ID")
108    protected String entityId;
109    @Type(type="org.kuali.rice.kns.util.HibernateKualiHashType")
110    @Column(name="PRNCPL_PSWD")
111    protected String password;
112   
113    protected String univId = "";
114    // affiliation data
115    @OneToMany(targetEntity=PersonDocumentAffiliation.class, fetch=FetchType.EAGER, cascade={CascadeType.ALL})
116    @Fetch(value = FetchMode.SELECT)
117    @JoinColumn(name="FDOC_NBR",insertable=false,updatable=false)
118    protected List<PersonDocumentAffiliation> affiliations;
119   
120    @Transient
121    protected String campusCode = "";
122    // external identifier data
123    @Transient
124    protected Map<String, String> externalIdentifiers = null;
125   
126    @Column(name="ACTV_IND")
127    @Type(type="yes_no")
128    protected boolean active;
129   
130    // citizenship
131    @Transient
132    protected List<PersonDocumentCitizenship> citizenships;
133    // protected List<DocEmploymentInfo> employmentInformations;
134    @OneToMany(targetEntity=PersonDocumentName.class, fetch=FetchType.EAGER, cascade={CascadeType.ALL})
135    @Fetch(value = FetchMode.SELECT)
136    @JoinColumn(name="FDOC_NBR",insertable=false,updatable=false)
137    protected List<PersonDocumentName> names;
138    @OneToMany(targetEntity=PersonDocumentAddress.class, fetch=FetchType.EAGER, cascade={CascadeType.ALL})
139    @Fetch(value = FetchMode.SELECT)
140    @JoinColumn(name="FDOC_NBR",insertable=false,updatable=false)
141    protected List<PersonDocumentAddress> addrs;
142    @OneToMany(targetEntity=PersonDocumentPhone.class, fetch=FetchType.EAGER, cascade={CascadeType.ALL})
143    @Fetch(value = FetchMode.SELECT)
144    @JoinColumn(name="FDOC_NBR")
145    protected List<PersonDocumentPhone> phones;
146    @OneToMany(targetEntity=PersonDocumentEmail.class, fetch=FetchType.EAGER, cascade={CascadeType.ALL})
147    @Fetch(value = FetchMode.SELECT)
148    @JoinColumn(name="FDOC_NBR",insertable=false,updatable=false)
149    protected List<PersonDocumentEmail> emails;
150    @OneToMany(targetEntity=PersonDocumentGroup.class, fetch=FetchType.EAGER, cascade={CascadeType.ALL})
151    @Fetch(value = FetchMode.SELECT)
152    @JoinColumn(name="FDOC_NBR",insertable=false,updatable=false)
153    protected List<PersonDocumentGroup> groups;
154    @OneToMany(targetEntity=PersonDocumentRole.class, fetch=FetchType.EAGER, cascade={CascadeType.ALL})
155    @Fetch(value = FetchMode.SELECT)
156    @JoinColumn(name="FDOC_NBR",insertable=false,updatable=false)
157    protected List<PersonDocumentRole> roles;
158   
159    @OneToOne(targetEntity=PersonDocumentPrivacy.class, fetch=FetchType.EAGER, cascade={CascadeType.ALL})
160    @JoinColumn(name="FDOC_NBR",insertable=false,updatable=false)
161    protected PersonDocumentPrivacy privacy;
162   
 
163  0 toggle public IdentityManagementPersonDocument() {
164  0 affiliations = new ArrayList<PersonDocumentAffiliation>();
165  0 citizenships = new ArrayList<PersonDocumentCitizenship>();
166    // employmentInformations = new ArrayList<DocEmploymentInfo>();
167  0 names = new ArrayList<PersonDocumentName>();
168  0 addrs = new ArrayList<PersonDocumentAddress>();
169  0 phones = new ArrayList<PersonDocumentPhone>();
170  0 emails = new ArrayList<PersonDocumentEmail>();
171  0 groups = new ArrayList<PersonDocumentGroup>();
172  0 roles = new ArrayList<PersonDocumentRole>();
173  0 privacy = new PersonDocumentPrivacy();
174  0 this.active = true;
175    // privacy.setDocumentNumber(documentNumber);
176    }
177   
 
178  0 toggle public String getPrincipalId() {
179  0 return this.principalId;
180    }
181   
 
182  0 toggle public void setPrincipalId(String principalId) {
183  0 this.principalId = principalId;
184    }
185   
 
186  0 toggle public String getPrincipalName() {
187  0 return this.principalName;
188    }
189   
190    /*
191    * sets the principal name.
192    * Principal names are converted to lower case.
193    */
 
194  0 toggle public void setPrincipalName(String principalName) {
195  0 this.principalName = principalName; // != null ? principalName.toLowerCase() : principalName ;
196    }
197   
 
198  0 toggle public String getEntityId() {
199  0 return this.entityId;
200    }
201   
 
202  0 toggle public void setEntityId(String entityId) {
203  0 this.entityId = entityId;
204    }
205   
 
206  0 toggle public List<PersonDocumentAffiliation> getAffiliations() {
207  0 return this.affiliations;
208    }
209   
 
210  0 toggle public void setAffiliations(List<PersonDocumentAffiliation> affiliations) {
211  0 this.affiliations = affiliations;
212    }
213   
 
214  0 toggle public String getCampusCode() {
215  0 return this.campusCode;
216    }
217   
 
218  0 toggle public void setCampusCode(String campusCode) {
219  0 this.campusCode = campusCode;
220    }
221   
 
222  0 toggle public Map<String, String> getExternalIdentifiers() {
223  0 return this.externalIdentifiers;
224    }
225   
 
226  0 toggle public void setExternalIdentifiers(Map<String, String> externalIdentifiers) {
227  0 this.externalIdentifiers = externalIdentifiers;
228    }
229   
 
230  0 toggle public String getPassword() {
231  0 return this.password;
232    }
233   
 
234  0 toggle public void setPassword(String password) {
235  0 this.password = password;
236    }
237   
 
238  0 toggle public boolean isActive() {
239  0 return this.active;
240    }
241   
 
242  0 toggle public void setActive(boolean active) {
243  0 this.active = active;
244    }
245   
 
246  0 toggle public List<PersonDocumentCitizenship> getCitizenships() {
247  0 return this.citizenships;
248    }
249   
 
250  0 toggle public void setCitizenships(List<PersonDocumentCitizenship> citizenships) {
251  0 this.citizenships = citizenships;
252    }
253   
 
254  0 toggle public List<PersonDocumentName> getNames() {
255  0 return this.names;
256    }
257   
 
258  0 toggle public void setNames(List<PersonDocumentName> names) {
259  0 this.names = names;
260    }
261   
 
262  0 toggle public List<PersonDocumentAddress> getAddrs() {
263  0 return this.addrs;
264    }
265   
 
266  0 toggle public void setAddrs(List<PersonDocumentAddress> addrs) {
267  0 this.addrs = addrs;
268    }
269   
 
270  0 toggle public List<PersonDocumentPhone> getPhones() {
271  0 return this.phones;
272    }
273   
 
274  0 toggle public void setPhones(List<PersonDocumentPhone> phones) {
275  0 this.phones = phones;
276    }
277   
 
278  0 toggle public List<PersonDocumentEmail> getEmails() {
279  0 return this.emails;
280    }
281   
 
282  0 toggle public void setEmails(List<PersonDocumentEmail> emails) {
283  0 this.emails = emails;
284    }
285   
 
286  0 toggle public void setGroups(List<PersonDocumentGroup> groups) {
287  0 this.groups = groups;
288    }
289   
 
290  0 toggle public List<PersonDocumentRole> getRoles() {
291  0 return this.roles;
292    }
293   
 
294  0 toggle public void setRoles(List<PersonDocumentRole> roles) {
295  0 this.roles = roles;
296    }
297   
 
298  0 toggle public List<PersonDocumentGroup> getGroups() {
299  0 return this.groups;
300    }
301   
 
302  0 toggle public String getUnivId() {
303  0 return this.univId;
304    }
305   
 
306  0 toggle public void setUnivId(String univId) {
307  0 this.univId = univId;
308    }
309   
 
310  0 toggle public PersonDocumentPrivacy getPrivacy() {
311  0 return this.privacy;
312    }
313   
 
314  0 toggle public void setPrivacy(PersonDocumentPrivacy privacy) {
315  0 this.privacy = privacy;
316    }
317   
 
318  0 toggle public void initializeDocumentForNewPerson() {
319  0 if(StringUtils.isBlank(this.principalId)){
320  0 this.principalId = getSequenceAccessorService().getNextAvailableSequenceNumber(KimConstants.SequenceNames.KRIM_PRNCPL_ID_S).toString();
321    }
322  0 if(StringUtils.isBlank(this.entityId)){
323  0 this.entityId = getSequenceAccessorService().getNextAvailableSequenceNumber(KimConstants.SequenceNames.KRIM_ENTITY_ID_S).toString();
324    }
325    }
326   
 
327  0 toggle @SuppressWarnings("unchecked")
328    @Override
329    public List buildListOfDeletionAwareLists() {
330  0 List managedLists = super.buildListOfDeletionAwareLists();
331  0 List<PersonDocumentEmploymentInfo> empInfos = new ArrayList<PersonDocumentEmploymentInfo>();
332  0 for (PersonDocumentAffiliation affiliation : getAffiliations()) {
333  0 empInfos.addAll(affiliation.getEmpInfos());
334    }
335   
336  0 managedLists.add(empInfos);
337  0 managedLists.add(getAffiliations());
338  0 managedLists.add(getCitizenships());
339  0 managedLists.add(getPhones());
340  0 managedLists.add(getAddrs());
341  0 managedLists.add(getEmails());
342  0 managedLists.add(getNames());
343  0 managedLists.add(getGroups());
344  0 managedLists.add(getRoles());
345  0 return managedLists;
346    }
347   
348    /**
349    * @see org.kuali.rice.kns.document.DocumentBase#doRouteStatusChange(org.kuali.rice.kew.dto.DocumentRouteStatusChangeDTO)
350    */
 
351  0 toggle @Override
352    public void doRouteStatusChange(DocumentRouteStatusChangeDTO statusChangeEvent) {
353  0 super.doRouteStatusChange(statusChangeEvent);
354  0 if (getDocumentHeader().getWorkflowDocument().stateIsProcessed()) {
355  0 setIfRolesEditable();
356  0 KIMServiceLocatorInternal.getUiDocumentService().saveEntityPerson(this);
357    }
358    }
359   
360   
 
361  0 toggle @Override
362    public void prepareForSave(){
363  0 if (StringUtils.isBlank(getPrivacy().getDocumentNumber())) {
364  0 getPrivacy().setDocumentNumber(
365    getDocumentNumber());
366    }
367  0 setEmployeeRecordIds();
368  0 for (PersonDocumentRole role : getRoles()) {
369  0 role.setDocumentNumber(getDocumentNumber());
370    //if (StringUtils.isEmpty(role.getRoleId())) {
371    // SequenceAccessorService sas = getSequenceAccessorService();
372    // Long nextSeq = sas.getNextAvailableSequenceNumber(
373    // "KRIM_ROLE_ID_S", this.getClass());
374    // String roleId = nextSeq.toString();
375    // role.setRoleId(roleId);
376    //}
377  0 for (KimDocumentRoleMember rolePrncpl : role.getRolePrncpls()) {
378  0 rolePrncpl.setDocumentNumber(getDocumentNumber());
379  0 rolePrncpl.setRoleId(role.getRoleId());
380  0 if (StringUtils.isEmpty(rolePrncpl.getRoleMemberId())) {
381  0 SequenceAccessorService sas = getSequenceAccessorService();
382  0 Long nextSeq = sas.getNextAvailableSequenceNumber(
383    "KRIM_ROLE_MBR_ID_S", this.getClass());
384  0 String roleMemberId = nextSeq.toString();
385  0 rolePrncpl.setRoleMemberId(roleMemberId);
386    }
387  0 for (KimDocumentRoleQualifier qualifier : rolePrncpl.getQualifiers()) {
388  0 qualifier.setDocumentNumber(getDocumentNumber());
389  0 qualifier.setKimTypId(role.getKimTypeId());
390    }
391    }
392    }
393  0 if(getDelegationMembers()!=null){
394  0 for(RoleDocumentDelegationMember delegationMember: getDelegationMembers()){
395  0 delegationMember.setDocumentNumber(getDocumentNumber());
396  0 for (RoleDocumentDelegationMemberQualifier qualifier: delegationMember.getQualifiers()) {
397  0 qualifier.setDocumentNumber(getDocumentNumber());
398  0 qualifier.setKimTypId(delegationMember.getRoleImpl().getKimTypeId());
399    }
400  0 addDelegationMemberToDelegation(delegationMember);
401    }
402    }
403  0 if (getAddrs() != null) {
404  0 String entityAddressId;
405  0 for(PersonDocumentAddress address : getAddrs()) {
406  0 address.setDocumentNumber(getDocumentNumber());
407  0 if (StringUtils.isEmpty(address.getEntityAddressId())) {
408  0 SequenceAccessorService sas = getSequenceAccessorService();
409  0 Long nextSeq = sas.getNextAvailableSequenceNumber(
410    "KRIM_ENTITY_ADDR_ID_S", this.getClass());
411  0 entityAddressId = nextSeq.toString();
412  0 address.setEntityAddressId(entityAddressId);
413    }
414    }
415    }
416  0 if (getAffiliations() != null) {
417  0 String affiliationId;
418  0 for(PersonDocumentAffiliation affiliation : getAffiliations()) {
419  0 affiliation.setDocumentNumber(getDocumentNumber());
420  0 if (StringUtils.isEmpty(affiliation.getEntityAffiliationId())) {
421  0 SequenceAccessorService sas = getSequenceAccessorService();
422  0 Long nextSeq = sas.getNextAvailableSequenceNumber(
423    "KRIM_ENTITY_AFLTN_ID_S", this.getClass());
424  0 affiliationId = nextSeq.toString();
425  0 affiliation.setEntityAffiliationId(affiliationId);
426    }
427    }
428    }
429  0 if (getEmails() != null) {
430  0 String entityEmailId;
431  0 for(PersonDocumentEmail email : getEmails()) {
432  0 email.setDocumentNumber(getDocumentNumber());
433  0 if (StringUtils.isEmpty(email.getEntityEmailId())) {
434  0 SequenceAccessorService sas = getSequenceAccessorService();
435  0 Long nextSeq = sas.getNextAvailableSequenceNumber(
436    "KRIM_ENTITY_EMAIL_ID_S", this.getClass());
437  0 entityEmailId = nextSeq.toString();
438  0 email.setEntityEmailId(entityEmailId);
439    }
440    }
441    }
442  0 if (getGroups() != null) {
443  0 String groupMemberId;
444  0 for(PersonDocumentGroup group : getGroups()) {
445  0 group.setDocumentNumber(getDocumentNumber());
446  0 if (StringUtils.isEmpty(group.getGroupMemberId())) {
447  0 SequenceAccessorService sas = getSequenceAccessorService();
448  0 Long nextSeq = sas.getNextAvailableSequenceNumber(
449    "KRIM_GRP_MBR_ID_S", this.getClass());
450  0 groupMemberId = nextSeq.toString();
451  0 group.setGroupMemberId(groupMemberId);
452    }
453    }
454    }
455  0 if (getNames() != null) {
456  0 String entityNameId;
457  0 for(PersonDocumentName name : getNames()) {
458  0 name.setDocumentNumber(getDocumentNumber());
459  0 if (StringUtils.isEmpty(name.getEntityNameId())) {
460  0 SequenceAccessorService sas = getSequenceAccessorService();
461  0 Long nextSeq = sas.getNextAvailableSequenceNumber(
462    "KRIM_ENTITY_NM_ID_S", this.getClass());
463  0 entityNameId = nextSeq.toString();
464  0 name.setEntityNameId(entityNameId);
465    }
466    }
467    }
468  0 if (getPhones() != null) {
469  0 String entityPhoneId;
470  0 for(PersonDocumentPhone phone : getPhones()) {
471  0 phone.setDocumentNumber(getDocumentNumber());
472  0 if (StringUtils.isEmpty(phone.getEntityPhoneId())) {
473  0 SequenceAccessorService sas = getSequenceAccessorService();
474  0 Long nextSeq = sas.getNextAvailableSequenceNumber(
475    "KRIM_ENTITY_PHONE_ID_S", this.getClass());
476  0 entityPhoneId = nextSeq.toString();
477  0 phone.setEntityPhoneId(entityPhoneId);
478    }
479    }
480    }
481   
482    }
483   
 
484  0 toggle protected void setEmployeeRecordIds(){
485  0 List<KimEntityEmploymentInformationInfo> empInfos = getUiDocumentService().getEntityEmploymentInformationInfo(getEntityId());
486  0 for(PersonDocumentAffiliation affiliation: getAffiliations()) {
487  0 int employeeRecordCounter = CollectionUtils.isEmpty(empInfos) ? 0 : empInfos.size();
488  0 for(PersonDocumentEmploymentInfo empInfo: affiliation.getEmpInfos()){
489  0 if(CollectionUtils.isNotEmpty(empInfos)){
490  0 for(KimEntityEmploymentInformationInfo origEmpInfo: empInfos){
491  0 if (origEmpInfo.getEntityEmploymentId().equals(empInfo.getEntityEmploymentId())) {
492  0 empInfo.setEmploymentRecordId(origEmpInfo.getEmploymentRecordId());
493    }
494    }
495    }
496  0 if(StringUtils.isEmpty(empInfo.getEmploymentRecordId())){
497  0 employeeRecordCounter++;
498  0 empInfo.setEmploymentRecordId(employeeRecordCounter+"");
499    }
500    }
501    }
502    }
503   
 
504  0 toggle public KimTypeAttributesHelper getKimTypeAttributesHelper(String roleId) {
505  0 KimRoleInfo roleInfo = KIMServiceLocator.getRoleService().getRole(roleId);
506  0 KimTypeInfo kimTypeInfo = KIMServiceLocatorWeb.getTypeInfoService().getKimType(roleInfo.getKimTypeId());
507  0 return new KimTypeAttributesHelper(kimTypeInfo);
508    //addDelegationRoleKimTypeAttributeHelper(roleId, helper);
509    }
510   
 
511  0 toggle public void setIfRolesEditable(){
512  0 if(CollectionUtils.isNotEmpty(getRoles())){
513  0 for(PersonDocumentRole role: getRoles()){
514  0 role.setEditable(validAssignRole(role));
515    }
516    }
517    }
518   
 
519  0 toggle public boolean validAssignRole(PersonDocumentRole role){
520  0 boolean rulePassed = true;
521  0 if(StringUtils.isNotEmpty(role.getNamespaceCode())){
522  0 Map<String,String> additionalPermissionDetails = new HashMap<String,String>();
523  0 additionalPermissionDetails.put(KimConstants.AttributeConstants.NAMESPACE_CODE, role.getNamespaceCode());
524  0 additionalPermissionDetails.put(KimConstants.AttributeConstants.ROLE_NAME, role.getRoleName());
525  0 if (!getDocumentHelperService().getDocumentAuthorizer(this).isAuthorizedByTemplate(
526    this,
527    KimConstants.NAMESPACE_CODE,
528    KimConstants.PermissionTemplateNames.ASSIGN_ROLE,
529    GlobalVariables.getUserSession().getPrincipalId(),
530    additionalPermissionDetails, null)){
531  0 rulePassed = false;
532    }
533    }
534  0 return rulePassed;
535    }
536   
537    @Transient
538    protected transient DocumentHelperService documentHelperService;
539    @Transient
540    protected transient UiDocumentService uiDocumentService;
541   
 
542  0 toggle protected DocumentHelperService getDocumentHelperService() {
543  0 if ( documentHelperService == null ) {
544  0 documentHelperService = KNSServiceLocatorWeb.getDocumentHelperService();
545    }
546  0 return this.documentHelperService;
547    }
548   
 
549  0 toggle protected UiDocumentService getUiDocumentService() {
550  0 if (uiDocumentService == null ) {
551  0 uiDocumentService = KIMServiceLocatorInternal.getUiDocumentService();
552    }
553  0 return this.uiDocumentService;
554    }
555   
556    }