|  1 |     | 
     | 
  |  2 |     | 
     | 
  |  3 |     | 
     | 
  |  4 |     | 
     | 
  |  5 |     | 
     | 
  |  6 |     | 
     | 
  |  7 |     | 
     | 
  |  8 |     | 
     | 
  |  9 |     | 
     | 
  |  10 |     | 
     | 
  |  11 |     | 
     | 
  |  12 |     | 
     | 
  |  13 |     | 
     | 
  |  14 |     | 
     | 
  |  15 |     | 
     | 
  |  16 |     | 
   package org.kuali.rice.kim.web.struts.form;  | 
  |  17 |     | 
     | 
  |  18 |     | 
   import org.apache.commons.lang.StringUtils;  | 
  |  19 |     | 
   import org.kuali.rice.core.web.format.DateDisplayTimestampObjectFormatter;  | 
  |  20 |     | 
   import org.kuali.rice.kim.bo.ui.PersonDocumentAddress;  | 
  |  21 |     | 
   import org.kuali.rice.kim.bo.ui.PersonDocumentAffiliation;  | 
  |  22 |     | 
   import org.kuali.rice.kim.bo.ui.PersonDocumentCitizenship;  | 
  |  23 |     | 
   import org.kuali.rice.kim.bo.ui.PersonDocumentEmail;  | 
  |  24 |     | 
   import org.kuali.rice.kim.bo.ui.PersonDocumentEmploymentInfo;  | 
  |  25 |     | 
   import org.kuali.rice.kim.bo.ui.PersonDocumentGroup;  | 
  |  26 |     | 
   import org.kuali.rice.kim.bo.ui.PersonDocumentName;  | 
  |  27 |     | 
   import org.kuali.rice.kim.bo.ui.PersonDocumentPhone;  | 
  |  28 |     | 
   import org.kuali.rice.kim.bo.ui.PersonDocumentRole;  | 
  |  29 |     | 
   import org.kuali.rice.kim.bo.ui.RoleDocumentDelegationMember;  | 
  |  30 |     | 
   import org.kuali.rice.kim.document.IdentityManagementPersonDocument;  | 
  |  31 |     | 
   import org.kuali.rice.kns.util.GlobalVariables;  | 
  |  32 |     | 
     | 
  |  33 |     | 
     | 
  |  34 |     | 
     | 
  |  35 |     | 
     | 
  |  36 |     | 
     | 
  |  37 |     | 
     | 
  |  38 |     | 
     | 
  |  39 |     | 
   public class IdentityManagementPersonDocumentForm extends IdentityManagementDocumentFormBase { | 
  |  40 |     | 
     | 
  |  41 |     | 
           { | 
  |  42 |    0 |                    requiredNonEditableProperties.add("methodToCall"); | 
  |  43 |     | 
           }  | 
  |  44 |     | 
     | 
  |  45 |     | 
       protected static final long serialVersionUID = -4787045391777666988L;  | 
  |  46 |     | 
       protected String principalId;  | 
  |  47 |     | 
       protected PersonDocumentAffiliation newAffln;  | 
  |  48 |     | 
       protected PersonDocumentEmploymentInfo newEmpInfo;  | 
  |  49 |     | 
       protected PersonDocumentCitizenship newCitizenship;  | 
  |  50 |     | 
       protected PersonDocumentName newName;  | 
  |  51 |     | 
       protected PersonDocumentAddress newAddress;  | 
  |  52 |     | 
       protected PersonDocumentPhone newPhone;  | 
  |  53 |     | 
       protected PersonDocumentEmail newEmail;  | 
  |  54 |     | 
       protected PersonDocumentGroup newGroup;  | 
  |  55 |     | 
       protected PersonDocumentRole newRole;  | 
  |  56 |    0 |        protected RoleDocumentDelegationMember newDelegationMember = new RoleDocumentDelegationMember();  | 
  |  57 |    0 |        protected String newDelegationMemberRoleId = null;  | 
  |  58 |    0 |        protected boolean delegationMemberLookup = false;  | 
  |  59 |    0 |        protected boolean canModifyEntity = false;  | 
  |  60 |    0 |        protected boolean canOverrideEntityPrivacyPreferences = false;  | 
  |  61 |    0 |        protected boolean userSameAsPersonEdited = false;  | 
  |  62 |     | 
         | 
  |  63 |     | 
             | 
  |  64 |     | 
     | 
  |  65 |     | 
     | 
  |  66 |     | 
           public boolean isCanModifyEntity() { | 
  |  67 |    0 |                    return this.canModifyEntity;  | 
  |  68 |     | 
           }  | 
  |  69 |     | 
     | 
  |  70 |     | 
             | 
  |  71 |     | 
     | 
  |  72 |     | 
     | 
  |  73 |     | 
           public void setCanModifyEntity(boolean canModifyEntity) { | 
  |  74 |    0 |                    this.canModifyEntity = canModifyEntity;  | 
  |  75 |    0 |            }  | 
  |  76 |     | 
     | 
  |  77 |     | 
           public IdentityManagementPersonDocumentForm() { | 
  |  78 |    0 |            super();  | 
  |  79 |     | 
             | 
  |  80 |    0 |            this.setNewAffln(new PersonDocumentAffiliation());  | 
  |  81 |    0 |            this.setNewAddress(new PersonDocumentAddress());  | 
  |  82 |    0 |            this.setNewEmpInfo(new PersonDocumentEmploymentInfo());  | 
  |  83 |    0 |            this.setNewName(new PersonDocumentName());  | 
  |  84 |    0 |            this.setNewPhone(new PersonDocumentPhone());  | 
  |  85 |    0 |            this.setNewEmail(new PersonDocumentEmail());  | 
  |  86 |    0 |            this.setNewDelegationMember(new RoleDocumentDelegationMember());  | 
  |  87 |    0 |            setFormatterType("document.groups.activeFromDate", DateDisplayTimestampObjectFormatter.class); | 
  |  88 |    0 |            setFormatterType("document.groups.activeToDate", DateDisplayTimestampObjectFormatter.class); | 
  |  89 |    0 |        }  | 
  |  90 |     | 
     | 
  |  91 |     | 
           @Override  | 
  |  92 |     | 
           public String getDefaultDocumentTypeName(){ | 
  |  93 |    0 |                    return "IdentityManagementPersonDocument";  | 
  |  94 |     | 
           }  | 
  |  95 |     | 
             | 
  |  96 |     | 
           public IdentityManagementPersonDocument getPersonDocument() { | 
  |  97 |    0 |            return (IdentityManagementPersonDocument) this.getDocument();  | 
  |  98 |     | 
       }  | 
  |  99 |     | 
     | 
  |  100 |     | 
           public PersonDocumentAffiliation getNewAffln() { | 
  |  101 |    0 |                    return this.newAffln;  | 
  |  102 |     | 
           }  | 
  |  103 |     | 
     | 
  |  104 |     | 
           public void setNewAffln(PersonDocumentAffiliation newAffln) { | 
  |  105 |    0 |                    this.newAffln = newAffln;  | 
  |  106 |    0 |            }  | 
  |  107 |     | 
     | 
  |  108 |     | 
           public PersonDocumentEmploymentInfo getNewEmpInfo() { | 
  |  109 |    0 |                    return this.newEmpInfo;  | 
  |  110 |     | 
           }  | 
  |  111 |     | 
     | 
  |  112 |     | 
           public void setNewEmpInfo(PersonDocumentEmploymentInfo newEmpInfo) { | 
  |  113 |    0 |                    this.newEmpInfo = newEmpInfo;  | 
  |  114 |    0 |            }  | 
  |  115 |     | 
     | 
  |  116 |     | 
           public PersonDocumentCitizenship getNewCitizenship() { | 
  |  117 |    0 |                    return this.newCitizenship;  | 
  |  118 |     | 
           }  | 
  |  119 |     | 
     | 
  |  120 |     | 
           public void setNewCitizenship(PersonDocumentCitizenship newCitizenship) { | 
  |  121 |    0 |                    this.newCitizenship = newCitizenship;  | 
  |  122 |    0 |            }  | 
  |  123 |     | 
     | 
  |  124 |     | 
           public PersonDocumentName getNewName() { | 
  |  125 |    0 |                    return this.newName;  | 
  |  126 |     | 
           }  | 
  |  127 |     | 
     | 
  |  128 |     | 
           public void setNewName(PersonDocumentName newName) { | 
  |  129 |    0 |                    this.newName = newName;  | 
  |  130 |    0 |            }  | 
  |  131 |     | 
     | 
  |  132 |     | 
           public PersonDocumentAddress getNewAddress() { | 
  |  133 |    0 |                    return this.newAddress;  | 
  |  134 |     | 
           }  | 
  |  135 |     | 
     | 
  |  136 |     | 
           public void setNewAddress(PersonDocumentAddress newAddress) { | 
  |  137 |    0 |                    this.newAddress = newAddress;  | 
  |  138 |    0 |            }  | 
  |  139 |     | 
     | 
  |  140 |     | 
           public PersonDocumentPhone getNewPhone() { | 
  |  141 |    0 |                    return this.newPhone;  | 
  |  142 |     | 
           }  | 
  |  143 |     | 
     | 
  |  144 |     | 
           public void setNewPhone(PersonDocumentPhone newPhone) { | 
  |  145 |    0 |                    this.newPhone = newPhone;  | 
  |  146 |    0 |            }  | 
  |  147 |     | 
     | 
  |  148 |     | 
           public PersonDocumentEmail getNewEmail() { | 
  |  149 |    0 |                    return this.newEmail;  | 
  |  150 |     | 
           }  | 
  |  151 |     | 
     | 
  |  152 |     | 
           public void setNewEmail(PersonDocumentEmail newEmail) { | 
  |  153 |    0 |                    this.newEmail = newEmail;  | 
  |  154 |    0 |            }  | 
  |  155 |     | 
     | 
  |  156 |     | 
           public PersonDocumentGroup getNewGroup() { | 
  |  157 |    0 |                    return this.newGroup;  | 
  |  158 |     | 
           }  | 
  |  159 |     | 
     | 
  |  160 |     | 
           public void setNewGroup(PersonDocumentGroup newGroup) { | 
  |  161 |    0 |                    this.newGroup = newGroup;  | 
  |  162 |    0 |            }  | 
  |  163 |     | 
     | 
  |  164 |     | 
           public PersonDocumentRole getNewRole() { | 
  |  165 |    0 |                    return this.newRole;  | 
  |  166 |     | 
           }  | 
  |  167 |     | 
     | 
  |  168 |     | 
           public void setNewRole(PersonDocumentRole newRole) { | 
  |  169 |    0 |                    this.newRole = newRole;  | 
  |  170 |    0 |            }  | 
  |  171 |     | 
     | 
  |  172 |     | 
           public String getPrincipalId() { | 
  |  173 |    0 |                    return this.principalId;  | 
  |  174 |     | 
           }  | 
  |  175 |     | 
     | 
  |  176 |     | 
           public void setPrincipalId(String principalId) { | 
  |  177 |    0 |                    this.principalId = principalId;  | 
  |  178 |    0 |            }  | 
  |  179 |     | 
     | 
  |  180 |     | 
             | 
  |  181 |     | 
     | 
  |  182 |     | 
     | 
  |  183 |     | 
           public RoleDocumentDelegationMember getNewDelegationMember() { | 
  |  184 |    0 |                    return this.newDelegationMember;  | 
  |  185 |     | 
           }  | 
  |  186 |     | 
     | 
  |  187 |     | 
             | 
  |  188 |     | 
     | 
  |  189 |     | 
     | 
  |  190 |     | 
           public void setNewDelegationMember(  | 
  |  191 |     | 
                           RoleDocumentDelegationMember newDelegationMember) { | 
  |  192 |    0 |                    this.newDelegationMember = newDelegationMember;  | 
  |  193 |    0 |            }  | 
  |  194 |     | 
     | 
  |  195 |     | 
             | 
  |  196 |     | 
     | 
  |  197 |     | 
     | 
  |  198 |     | 
           public boolean isDelegationMemberLookup() { | 
  |  199 |    0 |                    return this.delegationMemberLookup;  | 
  |  200 |     | 
           }  | 
  |  201 |     | 
     | 
  |  202 |     | 
             | 
  |  203 |     | 
     | 
  |  204 |     | 
     | 
  |  205 |     | 
           public void setDelegationMemberLookup(boolean delegationMemberLookup) { | 
  |  206 |    0 |                    this.delegationMemberLookup = delegationMemberLookup;  | 
  |  207 |    0 |            }  | 
  |  208 |     | 
     | 
  |  209 |     | 
             | 
  |  210 |     | 
     | 
  |  211 |     | 
     | 
  |  212 |     | 
           public String getNewDelegationMemberRoleId() { | 
  |  213 |    0 |                    return this.newDelegationMemberRoleId;  | 
  |  214 |     | 
           }  | 
  |  215 |     | 
     | 
  |  216 |     | 
             | 
  |  217 |     | 
     | 
  |  218 |     | 
     | 
  |  219 |     | 
           public void setNewDelegationMemberRoleId(String newDelegationMemberRoleId) { | 
  |  220 |    0 |                    this.newDelegationMemberRoleId = newDelegationMemberRoleId;  | 
  |  221 |    0 |                    if(StringUtils.isNotEmpty(newDelegationMemberRoleId)){ | 
  |  222 |    0 |                            newDelegationMember.getRoleImpl().setRoleId(newDelegationMemberRoleId);  | 
  |  223 |     | 
                   }  | 
  |  224 |    0 |            }  | 
  |  225 |     | 
     | 
  |  226 |     | 
             | 
  |  227 |     | 
     | 
  |  228 |     | 
     | 
  |  229 |     | 
           public boolean isCanOverrideEntityPrivacyPreferences() { | 
  |  230 |    0 |                    return this.canOverrideEntityPrivacyPreferences || isUserSameAsPersonEdited();  | 
  |  231 |     | 
           }  | 
  |  232 |     | 
     | 
  |  233 |     | 
             | 
  |  234 |     | 
     | 
  |  235 |     | 
     | 
  |  236 |     | 
           public void setCanOverrideEntityPrivacyPreferences(  | 
  |  237 |     | 
                           boolean canOverrideEntityPrivacyPreferences) { | 
  |  238 |    0 |                    this.canOverrideEntityPrivacyPreferences = canOverrideEntityPrivacyPreferences;  | 
  |  239 |    0 |            }  | 
  |  240 |     | 
     | 
  |  241 |     | 
             | 
  |  242 |     | 
     | 
  |  243 |     | 
     | 
  |  244 |     | 
           public boolean isUserSameAsPersonEdited() { | 
  |  245 |    0 |                    if(StringUtils.isNotEmpty(getPrincipalId())){ | 
  |  246 |    0 |                            userSameAsPersonEdited = StringUtils.equals(GlobalVariables.getUserSession().getPrincipalId(), getPrincipalId());  | 
  |  247 |     | 
                   }  | 
  |  248 |    0 |                    return this.userSameAsPersonEdited;  | 
  |  249 |     | 
           }  | 
  |  250 |     | 
     | 
  |  251 |     | 
             | 
  |  252 |     | 
     | 
  |  253 |     | 
     | 
  |  254 |     | 
           public void setUserSameAsPersonEdited(boolean userSameAsPersonEdited) { | 
  |  255 |    0 |                    this.userSameAsPersonEdited = userSameAsPersonEdited;  | 
  |  256 |    0 |            }  | 
  |  257 |     | 
     | 
  |  258 |     | 
   }  |