| 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 java.util.Date; |
| 19 | |
import java.util.Calendar; |
| 20 | |
import java.util.LinkedHashMap; |
| 21 | |
|
| 22 | |
import javax.persistence.Column; |
| 23 | |
import javax.persistence.Entity; |
| 24 | |
import javax.persistence.Id; |
| 25 | |
import javax.persistence.Table; |
| 26 | |
import javax.persistence.Transient; |
| 27 | |
|
| 28 | |
import org.kuali.rice.kim.bo.entity.KimEntityBioDemographics; |
| 29 | |
import org.kuali.rice.kim.bo.entity.KimEntityPrivacyPreferences; |
| 30 | |
import org.kuali.rice.kim.service.KIMServiceLocator; |
| 31 | |
import org.kuali.rice.kim.util.KimConstants; |
| 32 | |
import org.kuali.rice.kim.util.KualiDateMask; |
| 33 | |
|
| 34 | |
|
| 35 | |
|
| 36 | |
|
| 37 | |
@Entity |
| 38 | |
@Table(name = "KRIM_ENTITY_BIO_T") |
| 39 | 0 | public class KimEntityBioDemographicsImpl extends KimEntityDataBase implements KimEntityBioDemographics { |
| 40 | |
|
| 41 | |
private static final long serialVersionUID = 6317317790920881093L; |
| 42 | |
|
| 43 | |
@Id |
| 44 | |
@Column(name = "ENTITY_ID") |
| 45 | |
protected String entityId; |
| 46 | |
|
| 47 | |
@Column(name = "BIRTH_DT") |
| 48 | |
protected Date birthDate; |
| 49 | |
|
| 50 | |
@Column(name = "GNDR_CD") |
| 51 | |
protected String genderCode; |
| 52 | |
|
| 53 | |
@Column(name = "DECEASED_DT") |
| 54 | |
protected Date deceasedDate; |
| 55 | |
|
| 56 | |
@Column(name = "MARITAL_STATUS") |
| 57 | |
protected String maritalStatusCode; |
| 58 | |
|
| 59 | |
@Column(name = "PRIM_LANG_CD") |
| 60 | |
protected String primaryLanguageCode; |
| 61 | |
|
| 62 | |
@Column(name = "SEC_LANG_CD") |
| 63 | |
protected String secondaryLanguageCode; |
| 64 | |
|
| 65 | |
@Column(name = "BIRTH_CNTRY_CD") |
| 66 | |
protected String countryOfBirthCode; |
| 67 | |
|
| 68 | |
@Column(name = "BIRTH_STATE_CD") |
| 69 | |
protected String birthStateCode; |
| 70 | |
|
| 71 | |
@Column(name = "BIRTH_CITY") |
| 72 | |
protected String cityOfBirth; |
| 73 | |
|
| 74 | |
@Column(name = "GEO_ORIGIN") |
| 75 | |
protected String geographicOrigin; |
| 76 | |
|
| 77 | |
@Transient |
| 78 | |
protected Boolean suppressPersonal; |
| 79 | |
|
| 80 | |
|
| 81 | |
|
| 82 | |
|
| 83 | |
public Date getBirthDate() { |
| 84 | |
|
| 85 | 0 | if (isSuppressPersonal()) { |
| 86 | 0 | return KualiDateMask.getInstance(); |
| 87 | |
} |
| 88 | 0 | return this.birthDate; |
| 89 | |
} |
| 90 | |
|
| 91 | |
|
| 92 | |
|
| 93 | |
|
| 94 | |
|
| 95 | |
|
| 96 | |
public Date getBirthDateUnmasked() { |
| 97 | 0 | return this.birthDate; |
| 98 | |
} |
| 99 | |
|
| 100 | |
|
| 101 | |
|
| 102 | |
|
| 103 | |
public Date getDeceasedDate() { |
| 104 | 0 | return this.deceasedDate; |
| 105 | |
} |
| 106 | |
|
| 107 | |
|
| 108 | |
|
| 109 | |
|
| 110 | |
public String getMaritalStatusCode() { |
| 111 | 0 | if (isSuppressPersonal()) { |
| 112 | 0 | return KimConstants.RESTRICTED_DATA_MASK; |
| 113 | |
} |
| 114 | 0 | return this.maritalStatusCode; |
| 115 | |
} |
| 116 | |
|
| 117 | |
|
| 118 | |
|
| 119 | |
|
| 120 | |
public String getPrimaryLanguageCode() { |
| 121 | 0 | if (isSuppressPersonal()) { |
| 122 | 0 | return KimConstants.RESTRICTED_DATA_MASK; |
| 123 | |
} |
| 124 | 0 | return this.primaryLanguageCode; |
| 125 | |
} |
| 126 | |
|
| 127 | |
|
| 128 | |
|
| 129 | |
|
| 130 | |
public String getSecondaryLanguageCode() { |
| 131 | 0 | if (isSuppressPersonal()) { |
| 132 | 0 | return KimConstants.RESTRICTED_DATA_MASK; |
| 133 | |
} |
| 134 | 0 | return this.secondaryLanguageCode; |
| 135 | |
} |
| 136 | |
|
| 137 | |
|
| 138 | |
|
| 139 | |
|
| 140 | |
public String getCountryOfBirthCode() { |
| 141 | 0 | if (isSuppressPersonal()) { |
| 142 | 0 | return KimConstants.RESTRICTED_DATA_MASK; |
| 143 | |
} |
| 144 | 0 | return this.countryOfBirthCode; |
| 145 | |
} |
| 146 | |
|
| 147 | |
|
| 148 | |
|
| 149 | |
|
| 150 | |
public String getBirthStateCode() { |
| 151 | 0 | if (isSuppressPersonal()) { |
| 152 | 0 | return KimConstants.RESTRICTED_DATA_MASK; |
| 153 | |
} |
| 154 | 0 | return this.birthStateCode; |
| 155 | |
} |
| 156 | |
|
| 157 | |
|
| 158 | |
|
| 159 | |
|
| 160 | |
public String getCityOfBirth() { |
| 161 | 0 | if (isSuppressPersonal()) { |
| 162 | 0 | return KimConstants.RESTRICTED_DATA_MASK; |
| 163 | |
} |
| 164 | 0 | return this.cityOfBirth; |
| 165 | |
} |
| 166 | |
|
| 167 | |
|
| 168 | |
|
| 169 | |
|
| 170 | |
public String getGeographicOrigin() { |
| 171 | 0 | if (isSuppressPersonal()) { |
| 172 | 0 | return KimConstants.RESTRICTED_DATA_MASK; |
| 173 | |
} |
| 174 | 0 | return this.geographicOrigin; |
| 175 | |
} |
| 176 | |
|
| 177 | |
|
| 178 | |
|
| 179 | |
|
| 180 | |
public String getMaritalStatusCodeUnmasked() { |
| 181 | 0 | return this.maritalStatusCode; |
| 182 | |
} |
| 183 | |
|
| 184 | |
|
| 185 | |
|
| 186 | |
|
| 187 | |
public String getPrimaryLanguageCodeUnmasked() { |
| 188 | 0 | return this.primaryLanguageCode; |
| 189 | |
} |
| 190 | |
|
| 191 | |
|
| 192 | |
|
| 193 | |
|
| 194 | |
public String getSecondaryLanguageCodeUnmasked() { |
| 195 | 0 | return this.secondaryLanguageCode; |
| 196 | |
} |
| 197 | |
|
| 198 | |
|
| 199 | |
|
| 200 | |
|
| 201 | |
public String getCountryOfBirthCodeUnmasked() { |
| 202 | 0 | return this.countryOfBirthCode; |
| 203 | |
} |
| 204 | |
|
| 205 | |
|
| 206 | |
|
| 207 | |
|
| 208 | |
public String getBirthStateCodeUnmasked() { |
| 209 | 0 | return this.birthStateCode; |
| 210 | |
} |
| 211 | |
|
| 212 | |
|
| 213 | |
|
| 214 | |
|
| 215 | |
public String getCityOfBirthUnmasked() { |
| 216 | 0 | return this.cityOfBirth; |
| 217 | |
} |
| 218 | |
|
| 219 | |
|
| 220 | |
|
| 221 | |
|
| 222 | |
public String getGeographicOriginUnmasked() { |
| 223 | 0 | return this.geographicOrigin; |
| 224 | |
} |
| 225 | |
|
| 226 | |
|
| 227 | |
|
| 228 | |
|
| 229 | |
public void setBirthDate(Date birthDate) { |
| 230 | 0 | this.birthDate = birthDate; |
| 231 | 0 | } |
| 232 | |
|
| 233 | |
|
| 234 | |
|
| 235 | |
|
| 236 | |
public void setDeceasedDate(Date deceasedDate) { |
| 237 | 0 | this.deceasedDate = deceasedDate; |
| 238 | 0 | } |
| 239 | |
|
| 240 | |
|
| 241 | |
|
| 242 | |
|
| 243 | |
public void setMaritalStatusCode(String maritalStatusCode) { |
| 244 | 0 | this.maritalStatusCode = maritalStatusCode; |
| 245 | 0 | } |
| 246 | |
|
| 247 | |
|
| 248 | |
|
| 249 | |
|
| 250 | |
public void setPrimaryLanguageCode(String primaryLanguageCode) { |
| 251 | 0 | this.primaryLanguageCode = primaryLanguageCode; |
| 252 | 0 | } |
| 253 | |
|
| 254 | |
|
| 255 | |
|
| 256 | |
|
| 257 | |
public void setSecondaryLanguageCode(String secondaryLanguageCode) { |
| 258 | 0 | this.secondaryLanguageCode = secondaryLanguageCode; |
| 259 | 0 | } |
| 260 | |
|
| 261 | |
|
| 262 | |
|
| 263 | |
|
| 264 | |
public void setCountryOfBirthCode(String countryOfBirthCode) { |
| 265 | 0 | this.countryOfBirthCode = countryOfBirthCode; |
| 266 | 0 | } |
| 267 | |
|
| 268 | |
|
| 269 | |
|
| 270 | |
|
| 271 | |
public void setBirthStateCode(String birthStateCode) { |
| 272 | 0 | this.birthStateCode = birthStateCode; |
| 273 | 0 | } |
| 274 | |
|
| 275 | |
|
| 276 | |
|
| 277 | |
|
| 278 | |
public void setCityOfBirth(String cityOfBirth) { |
| 279 | 0 | this.cityOfBirth = cityOfBirth; |
| 280 | 0 | } |
| 281 | |
|
| 282 | |
|
| 283 | |
|
| 284 | |
|
| 285 | |
public void setGeographicOrigin(String geographicOrigin) { |
| 286 | 0 | this.geographicOrigin = geographicOrigin; |
| 287 | 0 | } |
| 288 | |
|
| 289 | |
|
| 290 | |
|
| 291 | |
|
| 292 | |
public String getEntityId() { |
| 293 | 0 | return this.entityId; |
| 294 | |
} |
| 295 | |
|
| 296 | |
|
| 297 | |
|
| 298 | |
|
| 299 | |
public void setEntityId(String entityId) { |
| 300 | 0 | this.entityId = entityId; |
| 301 | 0 | } |
| 302 | |
|
| 303 | |
|
| 304 | |
|
| 305 | |
|
| 306 | |
public String getGenderCode() { |
| 307 | 0 | if (isSuppressPersonal()) { |
| 308 | 0 | return KimConstants.RESTRICTED_DATA_MASK; |
| 309 | |
} |
| 310 | 0 | return genderCode; |
| 311 | |
} |
| 312 | |
|
| 313 | |
|
| 314 | |
|
| 315 | |
|
| 316 | |
public String getGenderCodeUnmasked() { |
| 317 | 0 | return this.genderCode; |
| 318 | |
} |
| 319 | |
|
| 320 | |
public void setGenderCode(String genderCode) { |
| 321 | 0 | this.genderCode = genderCode; |
| 322 | 0 | } |
| 323 | |
|
| 324 | |
|
| 325 | |
|
| 326 | |
|
| 327 | |
public Boolean getSuppressPersonal() { |
| 328 | 0 | return this.suppressPersonal; |
| 329 | |
} |
| 330 | |
|
| 331 | |
|
| 332 | |
|
| 333 | |
|
| 334 | |
public void setSuppressPersonal(Boolean suppressPersonal) { |
| 335 | 0 | this.suppressPersonal = suppressPersonal; |
| 336 | 0 | } |
| 337 | |
|
| 338 | |
|
| 339 | |
|
| 340 | |
|
| 341 | |
@Override |
| 342 | |
protected LinkedHashMap toStringMapper() { |
| 343 | 0 | LinkedHashMap m = new LinkedHashMap(); |
| 344 | 0 | m.put("entityId", entityId); |
| 345 | 0 | m.put("birthDate", getBirthDate()); |
| 346 | 0 | m.put("genderCode", getGenderCode()); |
| 347 | 0 | m.put("deceasedDate", getDeceasedDate()); |
| 348 | 0 | m.put("maritalStatusCode", getMaritalStatusCode()); |
| 349 | 0 | m.put("primaryLanguageCode", getPrimaryLanguageCode()); |
| 350 | 0 | m.put("secondaryLanguageCode", getSecondaryLanguageCode()); |
| 351 | 0 | m.put("countryOfBirthCode", getCountryOfBirthCode()); |
| 352 | 0 | m.put("stateOfBirth", getBirthStateCode()); |
| 353 | 0 | m.put("cityOfBirth", getCityOfBirth()); |
| 354 | 0 | m.put("geographicOrigin", getGeographicOrigin()); |
| 355 | 0 | return m; |
| 356 | |
} |
| 357 | |
|
| 358 | |
public boolean isSuppressPersonal() { |
| 359 | 0 | if (suppressPersonal != null) { |
| 360 | 0 | return suppressPersonal.booleanValue(); |
| 361 | |
} |
| 362 | 0 | KimEntityPrivacyPreferences privacy = KIMServiceLocator.getIdentityService().getEntityPrivacyPreferences(getEntityId()); |
| 363 | |
|
| 364 | 0 | suppressPersonal = false; |
| 365 | 0 | if (privacy != null) { |
| 366 | 0 | suppressPersonal = privacy.isSuppressPersonal(); |
| 367 | |
} |
| 368 | 0 | return suppressPersonal.booleanValue(); |
| 369 | |
} |
| 370 | |
|
| 371 | |
|
| 372 | |
private Date dateMask(){ |
| 373 | |
|
| 374 | 0 | Calendar calendar = Calendar.getInstance(); |
| 375 | 0 | calendar.set(calendar.getMinimum(Calendar.YEAR), |
| 376 | |
calendar.getMinimum(Calendar.MONTH ), |
| 377 | |
calendar.getMinimum(Calendar.DATE)); |
| 378 | |
|
| 379 | 0 | return (calendar != null ? new java.sql.Date(calendar.getTime().getTime()) : null); |
| 380 | |
} |
| 381 | |
} |