|  1 |     | 
     | 
  |  2 |     | 
     | 
  |  3 |     | 
     | 
  |  4 |     | 
     | 
  |  5 |     | 
     | 
  |  6 |     | 
     | 
  |  7 |     | 
     | 
  |  8 |     | 
     | 
  |  9 |     | 
     | 
  |  10 |     | 
     | 
  |  11 |     | 
     | 
  |  12 |     | 
     | 
  |  13 |     | 
     | 
  |  14 |     | 
     | 
  |  15 |     | 
     | 
  |  16 |     | 
   package org.kuali.rice.kim.bo.entity.impl;  | 
  |  17 |     | 
     | 
  |  18 |     | 
   import javax.persistence.Column;  | 
  |  19 |     | 
   import javax.persistence.Entity;  | 
  |  20 |     | 
   import javax.persistence.FetchType;  | 
  |  21 |     | 
   import javax.persistence.Id;  | 
  |  22 |     | 
   import javax.persistence.JoinColumn;  | 
  |  23 |     | 
   import javax.persistence.ManyToOne;  | 
  |  24 |     | 
   import javax.persistence.Table;  | 
  |  25 |     | 
   import javax.persistence.Transient;  | 
  |  26 |     | 
     | 
  |  27 |     | 
   import org.kuali.rice.kim.bo.entity.KimEntityName;  | 
  |  28 |     | 
   import org.kuali.rice.kim.bo.entity.KimEntityPrivacyPreferences;  | 
  |  29 |     | 
   import org.kuali.rice.kim.bo.reference.EntityNameType;  | 
  |  30 |     | 
   import org.kuali.rice.kim.bo.reference.impl.EntityNameTypeImpl;  | 
  |  31 |     | 
   import org.kuali.rice.kim.service.KIMServiceLocator;  | 
  |  32 |     | 
   import org.kuali.rice.kim.util.KimConstants;  | 
  |  33 |     | 
     | 
  |  34 |     | 
     | 
  |  35 |     | 
     | 
  |  36 |     | 
     | 
  |  37 |     | 
   @Entity  | 
  |  38 |     | 
   @Table(name = "KRIM_ENTITY_NM_T")  | 
  |  39 |    0 |    public class KimEntityNameImpl extends KimDefaultableEntityDataBase implements KimEntityName { | 
  |  40 |     | 
     | 
  |  41 |     | 
           private static final long serialVersionUID = 1L;  | 
  |  42 |     | 
     | 
  |  43 |     | 
           @Id  | 
  |  44 |     | 
           @Column(name = "ENTITY_NM_ID")  | 
  |  45 |     | 
           protected String entityNameId;  | 
  |  46 |     | 
     | 
  |  47 |     | 
           @Column(name = "ENTITY_ID")  | 
  |  48 |     | 
           protected String entityId;  | 
  |  49 |     | 
     | 
  |  50 |     | 
           @Column(name = "NM_TYP_CD")  | 
  |  51 |     | 
           protected String nameTypeCode ;  | 
  |  52 |     | 
     | 
  |  53 |     | 
           @Column(name = "FIRST_NM")  | 
  |  54 |     | 
           protected String firstName;  | 
  |  55 |     | 
     | 
  |  56 |     | 
           @Column(name = "MIDDLE_NM")  | 
  |  57 |     | 
           protected String middleName;  | 
  |  58 |     | 
     | 
  |  59 |     | 
           @Column(name = "LAST_NM")  | 
  |  60 |     | 
           protected String lastName;  | 
  |  61 |     | 
     | 
  |  62 |     | 
           @Column(name = "TITLE_NM")  | 
  |  63 |     | 
           protected String title;  | 
  |  64 |     | 
     | 
  |  65 |     | 
           @Column(name = "SUFFIX_NM")  | 
  |  66 |     | 
           protected String suffix;  | 
  |  67 |     | 
             | 
  |  68 |     | 
           @ManyToOne(targetEntity=EntityNameTypeImpl.class, fetch = FetchType.EAGER, cascade = {}) | 
  |  69 |     | 
           @JoinColumn(name = "NM_TYP_CD", insertable = false, updatable = false)  | 
  |  70 |     | 
           protected EntityNameType entityNameType;  | 
  |  71 |     | 
             | 
  |  72 |     | 
           @Transient  | 
  |  73 |     | 
           protected Boolean suppressName;  | 
  |  74 |     | 
             | 
  |  75 |     | 
     | 
  |  76 |     | 
             | 
  |  77 |     | 
     | 
  |  78 |     | 
     | 
  |  79 |     | 
           public String getEntityNameId() { | 
  |  80 |    0 |                    return entityNameId;  | 
  |  81 |     | 
           }  | 
  |  82 |     | 
     | 
  |  83 |     | 
             | 
  |  84 |     | 
     | 
  |  85 |     | 
     | 
  |  86 |     | 
           public String getFirstName() { | 
  |  87 |    0 |                if (isSuppressName()) { | 
  |  88 |    0 |                return KimConstants.RESTRICTED_DATA_MASK;  | 
  |  89 |     | 
           }  | 
  |  90 |    0 |                    return firstName;  | 
  |  91 |     | 
           }  | 
  |  92 |     | 
     | 
  |  93 |     | 
             | 
  |  94 |     | 
     | 
  |  95 |     | 
     | 
  |  96 |     | 
           public String getLastName() { | 
  |  97 |    0 |                if (isSuppressName()) { | 
  |  98 |    0 |                return KimConstants.RESTRICTED_DATA_MASK;  | 
  |  99 |     | 
           }  | 
  |  100 |    0 |                    return lastName;  | 
  |  101 |     | 
           }  | 
  |  102 |     | 
     | 
  |  103 |     | 
             | 
  |  104 |     | 
     | 
  |  105 |     | 
     | 
  |  106 |     | 
           public String getMiddleName() { | 
  |  107 |    0 |                if (isSuppressName()) { | 
  |  108 |    0 |                return KimConstants.RESTRICTED_DATA_MASK;  | 
  |  109 |     | 
           }  | 
  |  110 |    0 |                    return middleName;  | 
  |  111 |     | 
           }  | 
  |  112 |     | 
     | 
  |  113 |     | 
             | 
  |  114 |     | 
     | 
  |  115 |     | 
     | 
  |  116 |     | 
           public String getNameTypeCode() { | 
  |  117 |    0 |                    return nameTypeCode;  | 
  |  118 |     | 
           }  | 
  |  119 |     | 
     | 
  |  120 |     | 
             | 
  |  121 |     | 
     | 
  |  122 |     | 
     | 
  |  123 |     | 
           public String getSuffix() { | 
  |  124 |    0 |                if (isSuppressName()) { | 
  |  125 |    0 |                return KimConstants.RESTRICTED_DATA_MASK;  | 
  |  126 |     | 
           }  | 
  |  127 |    0 |                    return suffix;  | 
  |  128 |     | 
           }  | 
  |  129 |     | 
     | 
  |  130 |     | 
             | 
  |  131 |     | 
     | 
  |  132 |     | 
     | 
  |  133 |     | 
           public String getTitle() { | 
  |  134 |    0 |                if (isSuppressName()) { | 
  |  135 |    0 |                return KimConstants.RESTRICTED_DATA_MASK;  | 
  |  136 |     | 
           }  | 
  |  137 |    0 |                    return title;  | 
  |  138 |     | 
           }  | 
  |  139 |     | 
     | 
  |  140 |     | 
           public void setFirstName(String firstName) { | 
  |  141 |    0 |                    this.firstName = firstName;  | 
  |  142 |    0 |            }  | 
  |  143 |     | 
     | 
  |  144 |     | 
           public void setLastName(String lastName) { | 
  |  145 |    0 |                    this.lastName = lastName;  | 
  |  146 |    0 |            }  | 
  |  147 |     | 
     | 
  |  148 |     | 
           public void setMiddleName(String middleName) { | 
  |  149 |    0 |                    this.middleName = middleName;  | 
  |  150 |    0 |            }  | 
  |  151 |     | 
     | 
  |  152 |     | 
           public void setNameTypeCode(String nameTypeCode) { | 
  |  153 |    0 |                    this.nameTypeCode = nameTypeCode;  | 
  |  154 |    0 |            }  | 
  |  155 |     | 
     | 
  |  156 |     | 
           public void setSuffix(String suffix) { | 
  |  157 |    0 |                    this.suffix = suffix;  | 
  |  158 |    0 |            }  | 
  |  159 |     | 
     | 
  |  160 |     | 
           public void setTitle(String title) { | 
  |  161 |    0 |                    this.title = title;  | 
  |  162 |    0 |            }  | 
  |  163 |     | 
     | 
  |  164 |     | 
             | 
  |  165 |     | 
     | 
  |  166 |     | 
     | 
  |  167 |     | 
     | 
  |  168 |     | 
     | 
  |  169 |     | 
           public String getFormattedName() { | 
  |  170 |    0 |                if (isSuppressName()) { | 
  |  171 |    0 |                return KimConstants.RESTRICTED_DATA_MASK;  | 
  |  172 |     | 
           }  | 
  |  173 |    0 |                    return getLastName() + ", " + getFirstName() + (getMiddleName()==null?"":" " + getMiddleName());  | 
  |  174 |     | 
           }  | 
  |  175 |     | 
     | 
  |  176 |     | 
           public String getEntityId() { | 
  |  177 |    0 |                    return this.entityId;  | 
  |  178 |     | 
           }  | 
  |  179 |     | 
     | 
  |  180 |     | 
           public void setEntityId(String entityId) { | 
  |  181 |    0 |                    this.entityId = entityId;  | 
  |  182 |    0 |            }  | 
  |  183 |     | 
     | 
  |  184 |     | 
           public EntityNameType getEntityNameType() { | 
  |  185 |    0 |                    return this.entityNameType;  | 
  |  186 |     | 
           }  | 
  |  187 |     | 
     | 
  |  188 |     | 
           public void setEntityNameType(EntityNameType entityNameType) { | 
  |  189 |    0 |                    this.entityNameType = entityNameType;  | 
  |  190 |    0 |            }  | 
  |  191 |     | 
     | 
  |  192 |     | 
           public void setEntityNameId(String entityNameId) { | 
  |  193 |    0 |                    this.entityNameId = entityNameId;  | 
  |  194 |    0 |            }  | 
  |  195 |     | 
     | 
  |  196 |     | 
         | 
  |  197 |     | 
     | 
  |  198 |     | 
     | 
  |  199 |     | 
       public String getFirstNameUnmasked() { | 
  |  200 |    0 |            return this.firstName;  | 
  |  201 |     | 
       }  | 
  |  202 |     | 
     | 
  |  203 |     | 
         | 
  |  204 |     | 
     | 
  |  205 |     | 
     | 
  |  206 |     | 
       public String getFormattedNameUnmasked() { | 
  |  207 |    0 |            return this.lastName + ", " + this.firstName + (this.middleName==null?"":" " + this.middleName);  | 
  |  208 |     | 
       }  | 
  |  209 |     | 
     | 
  |  210 |     | 
         | 
  |  211 |     | 
     | 
  |  212 |     | 
     | 
  |  213 |     | 
       public String getLastNameUnmasked() { | 
  |  214 |    0 |            return this.lastName;  | 
  |  215 |     | 
       }  | 
  |  216 |     | 
     | 
  |  217 |     | 
         | 
  |  218 |     | 
     | 
  |  219 |     | 
     | 
  |  220 |     | 
       public String getMiddleNameUnmasked() { | 
  |  221 |    0 |            return this.middleName;  | 
  |  222 |     | 
       }  | 
  |  223 |     | 
     | 
  |  224 |     | 
         | 
  |  225 |     | 
     | 
  |  226 |     | 
     | 
  |  227 |     | 
       public String getSuffixUnmasked() { | 
  |  228 |    0 |            return this.suffix;  | 
  |  229 |     | 
       }  | 
  |  230 |     | 
     | 
  |  231 |     | 
         | 
  |  232 |     | 
     | 
  |  233 |     | 
     | 
  |  234 |     | 
       public String getTitleUnmasked() { | 
  |  235 |    0 |            return this.title;  | 
  |  236 |     | 
       }  | 
  |  237 |     | 
     | 
  |  238 |     | 
       public boolean isSuppressName() { | 
  |  239 |    0 |            if (suppressName != null) { | 
  |  240 |    0 |                return suppressName.booleanValue();  | 
  |  241 |     | 
           }  | 
  |  242 |    0 |            KimEntityPrivacyPreferences privacy = KIMServiceLocator.getIdentityService().getEntityPrivacyPreferences(getEntityId());  | 
  |  243 |     | 
     | 
  |  244 |    0 |            suppressName = false;  | 
  |  245 |    0 |            if (privacy != null) { | 
  |  246 |    0 |                suppressName = privacy.isSuppressName();  | 
  |  247 |     | 
           }   | 
  |  248 |    0 |            return suppressName.booleanValue();  | 
  |  249 |     | 
       }  | 
  |  250 |     | 
   }  |