|  1 |     | 
   package org.kuali.rice.kim.impl.entity.personal  | 
  |  2 |     | 
     | 
  |  3 |     | 
   import javax.persistence.Table  | 
  |  4 |     | 
   import javax.persistence.Entity  | 
  |  5 |     | 
   import javax.persistence.Id  | 
  |  6 |     | 
   import javax.persistence.Column  | 
  |  7 |     | 
   import javax.persistence.Transient  | 
  |  8 |     | 
   import org.kuali.rice.kim.api.entity.personal.EntityBioDemographics  | 
  |  9 |     | 
   import org.kuali.rice.kim.api.entity.personal.EntityBioDemographicsContract  | 
  |  10 |     | 
   import org.kuali.rice.krad.bo.PersistableBusinessObjectBase  | 
  |  11 |     | 
   import org.kuali.rice.kim.api.entity.privacy.EntityPrivacyPreferences  | 
  |  12 |     | 
   import org.kuali.rice.kim.api.services.KimApiServiceLocator  | 
  |  13 |     | 
   import org.kuali.rice.kim.api.util.KualiDateMask  | 
  |  14 |     | 
   import org.kuali.rice.kim.api.KimConstants  | 
  |  15 |     | 
     | 
  |  16 |     | 
   @Entity  | 
  |  17 |     | 
   @Table(name = "KRIM_ENTITY_BIO_T")  | 
  |  18 |     | 
   class EntityBioDemographicsBo extends PersistableBusinessObjectBase implements EntityBioDemographicsContract { | 
  |  19 |     | 
       private static final long serialVersionUID = 6317317790920881093L;  | 
  |  20 |     | 
     | 
  |  21 |     | 
       @Id  | 
  |  22 |     | 
       @Column(name = "ENTITY_ID")  | 
  |  23 |     | 
       String entityId;  | 
  |  24 |     | 
     | 
  |  25 |     | 
       @Column(name = "BIRTH_DT")  | 
  |  26 |     | 
       Date birthDate;  | 
  |  27 |     | 
     | 
  |  28 |     | 
       @Column(name = "GNDR_CD")  | 
  |  29 |     | 
       String genderCode;  | 
  |  30 |     | 
     | 
  |  31 |     | 
       @Column(name = "DECEASED_DT")  | 
  |  32 |     | 
       Date deceasedDate;  | 
  |  33 |     | 
     | 
  |  34 |     | 
       @Column(name = "MARITAL_STATUS")  | 
  |  35 |     | 
       String maritalStatusCode;  | 
  |  36 |     | 
     | 
  |  37 |     | 
       @Column(name = "PRIM_LANG_CD")  | 
  |  38 |     | 
       String primaryLanguageCode;  | 
  |  39 |     | 
     | 
  |  40 |     | 
       @Column(name = "SEC_LANG_CD")  | 
  |  41 |     | 
       String secondaryLanguageCode;  | 
  |  42 |     | 
     | 
  |  43 |     | 
       @Column(name = "BIRTH_CNTRY_CD")  | 
  |  44 |     | 
       String countryOfBirthCode;  | 
  |  45 |     | 
     | 
  |  46 |     | 
       @Column(name = "BIRTH_STATE_CD")  | 
  |  47 |     | 
       String birthStateCode;  | 
  |  48 |     | 
     | 
  |  49 |     | 
       @Column(name = "BIRTH_CITY")  | 
  |  50 |     | 
       String cityOfBirth;  | 
  |  51 |     | 
     | 
  |  52 |     | 
       @Column(name = "GEO_ORIGIN")  | 
  |  53 |     | 
       String geographicOrigin;  | 
  |  54 |     | 
     | 
  |  55 |     | 
       @Transient  | 
  |  56 |     | 
       boolean suppressPersonal;  | 
  |  57 |     | 
     | 
  |  58 |     | 
       | 
  |  59 |     | 
     | 
  |  60 |     | 
     | 
  |  61 |     | 
     | 
  |  62 |     | 
     | 
  |  63 |     | 
     static EntityBioDemographics to(EntityBioDemographicsBo bo) { | 
  |  64 |    1 |        if (bo == null) { return null } | 
  |  65 |    1 |        return EntityBioDemographics.Builder.create(bo).build()  | 
  |  66 |     | 
     }  | 
  |  67 |     | 
     | 
  |  68 |     | 
       | 
  |  69 |     | 
     | 
  |  70 |     | 
     | 
  |  71 |     | 
     | 
  |  72 |     | 
     | 
  |  73 |     | 
     static EntityBioDemographicsBo from(EntityBioDemographics immutable) { | 
  |  74 |    1 |        if (immutable == null) {return null} | 
  |  75 |     | 
     | 
  |  76 |    1 |        EntityBioDemographicsBo bo = new EntityBioDemographicsBo()  | 
  |  77 |    1 |        bo.entityId = immutable.entityId  | 
  |  78 |    1 |        bo.birthDate = immutable.birthDateUnmasked  | 
  |  79 |    1 |        bo.birthStateCode = immutable.birthStateCodeUnmasked  | 
  |  80 |    1 |        bo.cityOfBirth = immutable.cityOfBirthUnmasked  | 
  |  81 |    1 |        bo.countryOfBirthCode = immutable.countryOfBirthCodeUnmasked  | 
  |  82 |    1 |        bo.deceasedDate = immutable.deceasedDate  | 
  |  83 |    1 |        bo.genderCode = immutable.genderCodeUnmasked  | 
  |  84 |    1 |        bo.geographicOrigin = immutable.geographicOriginUnmasked  | 
  |  85 |    1 |        bo.maritalStatusCode = immutable.maritalStatusCodeUnmasked  | 
  |  86 |    1 |        bo.primaryLanguageCode = immutable.primaryLanguageCodeUnmasked  | 
  |  87 |    1 |        bo.secondaryLanguageCode = immutable.secondaryLanguageCodeUnmasked  | 
  |  88 |    1 |        bo.versionNumber = immutable.versionNumber  | 
  |  89 |    1 |        bo.objectId = immutable.objectId  | 
  |  90 |     | 
     | 
  |  91 |    1 |        return bo;  | 
  |  92 |     | 
     }  | 
  |  93 |     | 
     | 
  |  94 |     | 
       @Override  | 
  |  95 |     | 
       boolean isSuppressPersonal() { | 
  |  96 |    10 |            if (this.suppressPersonal == null) { | 
  |  97 |    0 |                EntityPrivacyPreferences privacy = KimApiServiceLocator.getIdentityService().getEntityPrivacyPreferences(getEntityId())  | 
  |  98 |    0 |                if (privacy != null) { | 
  |  99 |    0 |                   this.suppressPersonal = privacy.isSuppressPersonal()  | 
  |  100 |     | 
               } else { | 
  |  101 |    0 |                    this.suppressPersonal = false  | 
  |  102 |     | 
               }  | 
  |  103 |     | 
           }  | 
  |  104 |     | 
     | 
  |  105 |    10 |            return suppressPersonal;  | 
  |  106 |     | 
       }  | 
  |  107 |     | 
     | 
  |  108 |     | 
       Date getBirthDate() { | 
  |  109 |    1 |            if (isSuppressPersonal()) { | 
  |  110 |    0 |                return KualiDateMask.getInstance()  | 
  |  111 |     | 
           }  | 
  |  112 |    1 |            return this.birthDate  | 
  |  113 |     | 
       }  | 
  |  114 |     | 
       String getGenderCode() { | 
  |  115 |    1 |            if (isSuppressPersonal()) { | 
  |  116 |    0 |                return KimConstants.RestrictedMasks.RESTRICTED_DATA_MASK_CODE  | 
  |  117 |     | 
           }  | 
  |  118 |    1 |            return this.genderCode  | 
  |  119 |     | 
       }  | 
  |  120 |     | 
       String getMaritalStatusCode() { | 
  |  121 |    1 |            if (isSuppressPersonal()) { | 
  |  122 |    0 |                return KimConstants.RestrictedMasks.RESTRICTED_DATA_MASK_CODE  | 
  |  123 |     | 
           }  | 
  |  124 |    1 |            return this.maritalStatusCode  | 
  |  125 |     | 
       }  | 
  |  126 |     | 
       String getPrimaryLanguageCode() { | 
  |  127 |    1 |            if (isSuppressPersonal()) { | 
  |  128 |    0 |                return KimConstants.RestrictedMasks.RESTRICTED_DATA_MASK_CODE  | 
  |  129 |     | 
           }  | 
  |  130 |    1 |            return this.primaryLanguageCode  | 
  |  131 |     | 
       }  | 
  |  132 |     | 
       String getSecondaryLanguageCode() { | 
  |  133 |    1 |            if (isSuppressPersonal()) { | 
  |  134 |    0 |                return KimConstants.RestrictedMasks.RESTRICTED_DATA_MASK_CODE  | 
  |  135 |     | 
           }  | 
  |  136 |    1 |            return this.secondaryLanguageCode  | 
  |  137 |     | 
       }  | 
  |  138 |     | 
       String getCountryOfBirthCode() { | 
  |  139 |    1 |            if (isSuppressPersonal()) { | 
  |  140 |    0 |                return KimConstants.RestrictedMasks.RESTRICTED_DATA_MASK_CODE  | 
  |  141 |     | 
           }  | 
  |  142 |    1 |            return this.countryOfBirthCode  | 
  |  143 |     | 
       }  | 
  |  144 |     | 
       String getBirthStateCode() { | 
  |  145 |    1 |            if (isSuppressPersonal()) { | 
  |  146 |    0 |                return KimConstants.RestrictedMasks.RESTRICTED_DATA_MASK_CODE  | 
  |  147 |     | 
           }  | 
  |  148 |    1 |            return this.birthStateCode  | 
  |  149 |     | 
       }  | 
  |  150 |     | 
       String getCityOfBirth() { | 
  |  151 |    1 |            if (isSuppressPersonal()) { | 
  |  152 |    0 |                return KimConstants.RestrictedMasks.RESTRICTED_DATA_MASK_CODE  | 
  |  153 |     | 
           }  | 
  |  154 |    1 |            return this.cityOfBirth  | 
  |  155 |     | 
       }  | 
  |  156 |     | 
       String getGeographicOrigin() { | 
  |  157 |    1 |            if (isSuppressPersonal()) { | 
  |  158 |    0 |                return KimConstants.RestrictedMasks.RESTRICTED_DATA_MASK_CODE  | 
  |  159 |     | 
           }  | 
  |  160 |    1 |            return this.geographicOrigin  | 
  |  161 |     | 
       }  | 
  |  162 |     | 
     | 
  |  163 |     | 
       Date getBirthDateUnmasked() { | 
  |  164 |    0 |            return this.birthDate  | 
  |  165 |     | 
       }  | 
  |  166 |     | 
       String getGenderCodeUnmasked() { | 
  |  167 |    0 |            return this.genderCode  | 
  |  168 |     | 
       }  | 
  |  169 |     | 
       String getMaritalStatusCodeUnmasked() { | 
  |  170 |    0 |            return this.maritalStatusCode  | 
  |  171 |     | 
       }  | 
  |  172 |     | 
       String getPrimaryLanguageCodeUnmasked() { | 
  |  173 |    0 |            return this.primaryLanguageCode  | 
  |  174 |     | 
       }  | 
  |  175 |     | 
       String getSecondaryLanguageCodeUnmasked() { | 
  |  176 |    0 |            return this.secondaryLanguageCode  | 
  |  177 |     | 
       }  | 
  |  178 |     | 
       String getCountryOfBirthCodeUnmasked() { | 
  |  179 |    0 |            return this.countryOfBirthCode  | 
  |  180 |     | 
       }  | 
  |  181 |     | 
       String getBirthStateCodeUnmasked() { | 
  |  182 |    0 |            return this.birthStateCode  | 
  |  183 |     | 
       }  | 
  |  184 |     | 
       String getCityOfBirthUnmasked() { | 
  |  185 |    0 |            return this.cityOfBirth  | 
  |  186 |     | 
       }  | 
  |  187 |     | 
       String getGeographicOriginUnmasked() { | 
  |  188 |    0 |            return this.geographicOrigin  | 
  |  189 |     | 
       }  | 
  |  190 |     | 
   }  |