Coverage Report - org.kuali.rice.kim.api.identity.personal.EntityBioDemographics
 
Classes in this File Line Coverage Branch Coverage Complexity
EntityBioDemographics
0%
0/101
0%
0/6
1.506
EntityBioDemographics$1
N/A
N/A
1.506
EntityBioDemographics$Builder
0%
0/124
0%
0/30
1.506
EntityBioDemographics$Constants
0%
0/1
N/A
1.506
EntityBioDemographics$Elements
0%
0/1
N/A
1.506
 
 1  
 /**
 2  
  * Copyright 2005-2011 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.api.identity.personal;
 17  
 
 18  
 import org.apache.commons.lang.StringUtils;
 19  
 import org.apache.log4j.Logger;
 20  
 import org.joda.time.DateTime;
 21  
 import org.joda.time.Years;
 22  
 import org.kuali.rice.core.api.CoreConstants;
 23  
 import org.kuali.rice.core.api.mo.AbstractDataTransferObject;
 24  
 import org.kuali.rice.core.api.mo.ModelBuilder;
 25  
 import org.kuali.rice.kim.api.KimConstants;
 26  
 import org.w3c.dom.Element;
 27  
 
 28  
 import javax.xml.bind.annotation.XmlAccessType;
 29  
 import javax.xml.bind.annotation.XmlAccessorType;
 30  
 import javax.xml.bind.annotation.XmlAnyElement;
 31  
 import javax.xml.bind.annotation.XmlElement;
 32  
 import javax.xml.bind.annotation.XmlRootElement;
 33  
 import javax.xml.bind.annotation.XmlType;
 34  
 import java.io.Serializable;
 35  
 import java.text.ParseException;
 36  
 import java.text.SimpleDateFormat;
 37  
 import java.util.Collection;
 38  
 import java.util.Date;
 39  
 
 40  
 @XmlRootElement(name = EntityBioDemographics.Constants.ROOT_ELEMENT_NAME)
 41  
 @XmlAccessorType(XmlAccessType.NONE)
 42  
 @XmlType(name = EntityBioDemographics.Constants.TYPE_NAME, propOrder = {
 43  
     EntityBioDemographics.Elements.ENTITY_ID,
 44  
     EntityBioDemographics.Elements.DECEASED_DATE,
 45  
     EntityBioDemographics.Elements.BIRTH_DATE,
 46  
     EntityBioDemographics.Elements.AGE,
 47  
     EntityBioDemographics.Elements.GENDER_CODE,
 48  
     EntityBioDemographics.Elements.GENDER_CHANGE_CODE,
 49  
     EntityBioDemographics.Elements.MARITAL_STATUS_CODE,
 50  
     EntityBioDemographics.Elements.PRIMARY_LANGUAGE_CODE,
 51  
     EntityBioDemographics.Elements.SECONDARY_LANGUAGE_CODE,
 52  
     EntityBioDemographics.Elements.BIRTH_COUNTRY,
 53  
     EntityBioDemographics.Elements.BIRTH_STATE_PROVINCE_CODE,
 54  
     EntityBioDemographics.Elements.BIRTH_CITY,
 55  
     EntityBioDemographics.Elements.GEOGRAPHIC_ORIGIN,
 56  
     EntityBioDemographics.Elements.BIRTH_DATE_UNMASKED,
 57  
     EntityBioDemographics.Elements.GENDER_CODE_UNMASKED,
 58  
     EntityBioDemographics.Elements.GENDER_CHANGE_CODE_UNMASKED,
 59  
     EntityBioDemographics.Elements.MARITAL_STATUS_CODE_UNMASKED,
 60  
     EntityBioDemographics.Elements.PRIMARY_LANGUAGE_CODE_UNMASKED,
 61  
     EntityBioDemographics.Elements.SECONDARY_LANGUAGE_CODE_UNMASKED,
 62  
     EntityBioDemographics.Elements.BIRTH_COUNTRY_UNMASKED,
 63  
     EntityBioDemographics.Elements.BIRTH_STATE_PROVINCE_CODE_UNMASKED,
 64  
     EntityBioDemographics.Elements.BIRTH_CITY_UNMASKED,
 65  
     EntityBioDemographics.Elements.GEOGRAPHIC_ORIGIN_UNMASKED,
 66  
     EntityBioDemographics.Elements.NOTE_MESSAGE,
 67  
     EntityBioDemographics.Elements.SUPPRESS_PERSONAL,
 68  
     CoreConstants.CommonElements.VERSION_NUMBER,
 69  
     CoreConstants.CommonElements.OBJECT_ID,
 70  
     CoreConstants.CommonElements.FUTURE_ELEMENTS
 71  
 })
 72  0
 public final class EntityBioDemographics extends AbstractDataTransferObject
 73  
     implements EntityBioDemographicsContract
 74  
 {
 75  0
     private static final Logger LOG = Logger.getLogger(EntityBioDemographics.class);
 76  
 
 77  
     @XmlElement(name = Elements.ENTITY_ID, required = false)
 78  
     private final String entityId;
 79  
     @XmlElement(name = Elements.DECEASED_DATE, required = false)
 80  
     private final String deceasedDate;
 81  
     @XmlElement(name = Elements.BIRTH_DATE, required = false)
 82  
     private final String birthDate;
 83  
     @XmlElement(name = Elements.GENDER_CODE, required = false)
 84  
     private final String genderCode;
 85  
     @XmlElement(name = Elements.GENDER_CHANGE_CODE, required = false)
 86  
     private final String genderChangeCode;
 87  
     @XmlElement(name = Elements.MARITAL_STATUS_CODE, required = false)
 88  
     private final String maritalStatusCode;
 89  
     @XmlElement(name = Elements.PRIMARY_LANGUAGE_CODE, required = false)
 90  
     private final String primaryLanguageCode;
 91  
     @XmlElement(name = Elements.SECONDARY_LANGUAGE_CODE, required = false)
 92  
     private final String secondaryLanguageCode;
 93  
     @XmlElement(name = Elements.BIRTH_COUNTRY, required = false)
 94  
     private final String birthCountry;
 95  
     @XmlElement(name = Elements.BIRTH_STATE_PROVINCE_CODE, required = false)
 96  
     private final String birthStateProvinceCode;
 97  
     @XmlElement(name = Elements.BIRTH_CITY, required = false)
 98  
     private final String birthCity;
 99  
     @XmlElement(name = Elements.GEOGRAPHIC_ORIGIN, required = false)
 100  
     private final String geographicOrigin;
 101  
 
 102  
     @XmlElement(name = Elements.BIRTH_DATE_UNMASKED, required = false)
 103  
     private final String birthDateUnmasked;
 104  
     @XmlElement(name = Elements.GENDER_CODE_UNMASKED, required = false)
 105  
     private final String genderCodeUnmasked;
 106  
     @XmlElement(name = Elements.GENDER_CHANGE_CODE_UNMASKED, required = false)
 107  
     private final String genderChangeCodeUnmasked;
 108  
     @XmlElement(name = Elements.MARITAL_STATUS_CODE_UNMASKED, required = false)
 109  
     private final String maritalStatusCodeUnmasked;
 110  
     @XmlElement(name = Elements.PRIMARY_LANGUAGE_CODE_UNMASKED, required = false)
 111  
     private final String primaryLanguageCodeUnmasked;
 112  
     @XmlElement(name = Elements.SECONDARY_LANGUAGE_CODE_UNMASKED, required = false)
 113  
     private final String secondaryLanguageCodeUnmasked;
 114  
     @XmlElement(name = Elements.BIRTH_COUNTRY_UNMASKED, required = false)
 115  
     private final String birthCountryUnmasked;
 116  
     @XmlElement(name = Elements.BIRTH_STATE_PROVINCE_CODE_UNMASKED, required = false)
 117  
     private final String birthStateProvinceCodeUnmasked;
 118  
     @XmlElement(name = Elements.BIRTH_CITY_UNMASKED, required = false)
 119  
     private final String birthCityUnmasked;
 120  
     @XmlElement(name = Elements.GEOGRAPHIC_ORIGIN_UNMASKED, required = false)
 121  
     private final String geographicOriginUnmasked;
 122  
 
 123  
     @XmlElement(name = Elements.NOTE_MESSAGE, required = false)
 124  
     private final String noteMessage;
 125  
     @XmlElement(name = Elements.SUPPRESS_PERSONAL, required = false)
 126  
     private final boolean suppressPersonal;
 127  
     @XmlElement(name = CoreConstants.CommonElements.VERSION_NUMBER, required = false)
 128  
     private final Long versionNumber;
 129  
     @XmlElement(name = CoreConstants.CommonElements.OBJECT_ID, required = false)
 130  
     private final String objectId;
 131  0
     @SuppressWarnings("unused")
 132  
     @XmlAnyElement
 133  
     private final Collection<Element> _futureElements = null;
 134  
 
 135  
     /**
 136  
      * Private constructor used only by JAXB.
 137  
      * 
 138  
      */
 139  0
     private EntityBioDemographics() {
 140  0
         this.entityId = null;
 141  0
         this.deceasedDate = null;
 142  0
         this.birthDate = null;
 143  0
         this.genderCode = null;
 144  0
         this.genderChangeCode = null;
 145  0
         this.maritalStatusCode = null;
 146  0
         this.primaryLanguageCode = null;
 147  0
         this.secondaryLanguageCode = null;
 148  0
         this.birthCountry = null;
 149  0
         this.birthStateProvinceCode = null;
 150  0
         this.birthCity = null;
 151  0
         this.geographicOrigin = null;
 152  
 
 153  0
         this.birthDateUnmasked = null;
 154  0
         this.genderCodeUnmasked = null;
 155  0
         this.genderChangeCodeUnmasked = null;
 156  0
         this.maritalStatusCodeUnmasked = null;
 157  0
         this.primaryLanguageCodeUnmasked = null;
 158  0
         this.secondaryLanguageCodeUnmasked = null;
 159  0
         this.birthCountryUnmasked = null;
 160  0
         this.birthStateProvinceCodeUnmasked = null;
 161  0
         this.birthCityUnmasked = null;
 162  0
         this.geographicOriginUnmasked = null;
 163  
 
 164  0
         this.noteMessage = null;
 165  0
         this.suppressPersonal = false;
 166  0
         this.versionNumber = null;
 167  0
         this.objectId = null;
 168  0
     }
 169  
 
 170  0
     private EntityBioDemographics(Builder builder) {
 171  0
         this.entityId = builder.getEntityId();
 172  0
         this.deceasedDate = builder.getDeceasedDate();
 173  0
         this.birthDate = builder.getBirthDate();
 174  0
         this.genderCode = builder.getGenderCode();
 175  0
         this.genderChangeCode = builder.getGenderChangeCode();
 176  0
         this.maritalStatusCode = builder.getMaritalStatusCode();
 177  0
         this.primaryLanguageCode = builder.getPrimaryLanguageCode();
 178  0
         this.secondaryLanguageCode = builder.getSecondaryLanguageCode();
 179  0
         this.birthCountry = builder.getBirthCountry();
 180  0
         this.birthStateProvinceCode = builder.getBirthStateProvinceCode();
 181  0
         this.birthCity = builder.getBirthCity();
 182  0
         this.geographicOrigin = builder.getGeographicOrigin();
 183  
 
 184  0
         this.birthDateUnmasked = builder.getBirthDateUnmasked();
 185  0
         this.genderCodeUnmasked = builder.getGenderCodeUnmasked();
 186  0
         this.genderChangeCodeUnmasked = builder.getGenderChangeCodeUnmasked();
 187  0
         this.maritalStatusCodeUnmasked = builder.getMaritalStatusCodeUnmasked();
 188  0
         this.primaryLanguageCodeUnmasked = builder.getPrimaryLanguageCodeUnmasked();
 189  0
         this.secondaryLanguageCodeUnmasked = builder.getSecondaryLanguageCodeUnmasked();
 190  0
         this.birthCountryUnmasked = builder.getBirthCountryUnmasked();
 191  0
         this.birthStateProvinceCodeUnmasked = builder.getBirthStateProvinceCodeUnmasked();
 192  0
         this.birthCityUnmasked = builder.getBirthCityUnmasked();
 193  0
         this.geographicOriginUnmasked = builder.getGeographicOriginUnmasked();
 194  
 
 195  0
         this.noteMessage = builder.getNoteMessage();
 196  0
         this.suppressPersonal = builder.isSuppressPersonal();
 197  0
         this.versionNumber = builder.getVersionNumber();
 198  0
         this.objectId = builder.getObjectId();
 199  0
     }
 200  
 
 201  
     @Override
 202  
     public String getEntityId() {
 203  0
         return this.entityId;
 204  
     }
 205  
 
 206  
     @Override
 207  
     public String getDeceasedDate() {
 208  0
         return this.deceasedDate;
 209  
     }
 210  
 
 211  
     @Override
 212  
     public String getBirthDate() {
 213  0
         return this.birthDate;
 214  
     }
 215  
 
 216  
     @Override
 217  
     @XmlElement(name = Elements.AGE, required = true)
 218  
     public Integer getAge() {
 219  0
         return calculateAge(this.birthDate, this.deceasedDate, isSuppressPersonal());
 220  
     }
 221  
 
 222  
     @Override
 223  
     public String getGenderCode() {
 224  0
         return this.genderCode;
 225  
     }
 226  
 
 227  
     @Override
 228  
     public String getGenderChangeCode() {
 229  0
         return this.genderChangeCode;
 230  
     }
 231  
 
 232  
     @Override
 233  
     public String getMaritalStatusCode() {
 234  0
         return this.maritalStatusCode;
 235  
     }
 236  
 
 237  
     @Override
 238  
     public String getPrimaryLanguageCode() {
 239  0
         return this.primaryLanguageCode;
 240  
     }
 241  
 
 242  
     @Override
 243  
     public String getSecondaryLanguageCode() {
 244  0
         return this.secondaryLanguageCode;
 245  
     }
 246  
 
 247  
     @Override
 248  
     public String getBirthCountry() {
 249  0
         return this.birthCountry;
 250  
     }
 251  
 
 252  
     @Override
 253  
     public String getBirthStateProvinceCode() {
 254  0
         return this.birthStateProvinceCode;
 255  
     }
 256  
 
 257  
     @Override
 258  
     public String getBirthCity() {
 259  0
         return this.birthCity;
 260  
     }
 261  
 
 262  
     @Override
 263  
     public String getGeographicOrigin() {
 264  0
         return this.geographicOrigin;
 265  
     }
 266  
 
 267  
     @Override
 268  
     public String getBirthDateUnmasked() {
 269  0
         return this.birthDateUnmasked;
 270  
     }
 271  
 
 272  
     @Override
 273  
     public String getGenderCodeUnmasked() {
 274  0
         return this.genderCodeUnmasked;
 275  
     }
 276  
 
 277  
     @Override
 278  
     public String getGenderChangeCodeUnmasked() {
 279  0
         return this.genderChangeCodeUnmasked;
 280  
     }
 281  
     
 282  
     @Override
 283  
     public String getMaritalStatusCodeUnmasked() {
 284  0
         return this.maritalStatusCodeUnmasked;
 285  
     }
 286  
 
 287  
     @Override
 288  
     public String getPrimaryLanguageCodeUnmasked() {
 289  0
         return this.primaryLanguageCodeUnmasked;
 290  
     }
 291  
 
 292  
     @Override
 293  
     public String getSecondaryLanguageCodeUnmasked() {
 294  0
         return this.secondaryLanguageCodeUnmasked;
 295  
     }
 296  
 
 297  
     @Override
 298  
     public String getBirthCountryUnmasked() {
 299  0
         return this.birthCountryUnmasked;
 300  
     }
 301  
 
 302  
     @Override
 303  
     public String getBirthStateProvinceCodeUnmasked() {
 304  0
         return this.birthStateProvinceCodeUnmasked;
 305  
     }
 306  
 
 307  
     @Override
 308  
     public String getBirthCityUnmasked() {
 309  0
         return this.birthCityUnmasked;
 310  
     }
 311  
 
 312  
     @Override
 313  
     public String getGeographicOriginUnmasked() {
 314  0
         return this.geographicOriginUnmasked;
 315  
     }
 316  
 
 317  
     @Override
 318  
     public String getNoteMessage() {
 319  0
         return this.noteMessage;
 320  
     }
 321  
 
 322  
     @Override
 323  
     public boolean isSuppressPersonal() {
 324  0
         return this.suppressPersonal;
 325  
     }
 326  
 
 327  
     @Override
 328  
     public Long getVersionNumber() {
 329  0
         return this.versionNumber;
 330  
     }
 331  
 
 332  
     @Override
 333  
     public String getObjectId() {
 334  0
         return this.objectId;
 335  
     }
 336  
 
 337  
     /**
 338  
      * Helper to parse the birth date for age calculation
 339  
      * @param birthDate the birth date in EntityBioDemographicsContract BIRTH_DATE_FORMAT format
 340  
      * @param deceasedDate the deceased date in EntityBioDemographicsContract DECEASED_DATE_FORMAT format
 341  
      * @param suppressPersonal whether personal information is being suppressed
 342  
      * @return the age in years or null if unavailable, suppressed, or an error occurs during calculation
 343  
      */
 344  
     private static Integer calculateAge(String birthDate, String deceasedDate, boolean suppressPersonal) {
 345  0
         if (birthDate != null && ! suppressPersonal) {
 346  
             Date parsedBirthDate;
 347  
             try {
 348  0
                 parsedBirthDate = new SimpleDateFormat(BIRTH_DATE_FORMAT).parse(birthDate);
 349  0
             } catch (ParseException pe) {
 350  0
                 LOG.error("Error parsing EntityBioDemographics birth date: '" + birthDate + "'", pe);
 351  0
                 return null;
 352  0
             }
 353  
             DateTime endDate;
 354  0
             if (deceasedDate != null) {
 355  
                 try {
 356  0
                    endDate = new DateTime(new SimpleDateFormat(BIRTH_DATE_FORMAT).parse(deceasedDate));
 357  0
                 } catch (ParseException pe) {
 358  0
                     LOG.error("Error parsing EntityBioDemographics deceased date: '" + deceasedDate+ "'", pe);
 359  0
                     return null;
 360  0
                 }
 361  
             } else {
 362  0
                 endDate = new DateTime();
 363  
             }
 364  0
             return Years.yearsBetween(new DateTime(parsedBirthDate), endDate).getYears();
 365  
         }
 366  0
         return null;
 367  
     }
 368  
 
 369  
     /**
 370  
      * A builder which can be used to construct {@link EntityBioDemographics} instances.  Enforces the constraints of the {@link EntityBioDemographicsContract}.
 371  
      * 
 372  
      */
 373  0
     public final static class Builder
 374  
         implements Serializable, ModelBuilder, EntityBioDemographicsContract
 375  
     {
 376  
 
 377  
         private String entityId;
 378  
         private String deceasedDate;
 379  
         private String birthDate;
 380  
         private String genderCode;
 381  
         private String maritalStatusCode;
 382  
         private String primaryLanguageCode;
 383  
         private String secondaryLanguageCode;
 384  
         private String birthCountry;
 385  
         private String birthStateProvinceCode;
 386  
         private String birthCity;
 387  
         private String geographicOrigin;
 388  
         private String genderChangeCode;
 389  
         private String noteMessage;
 390  
         private boolean suppressPersonal;
 391  
         private Long versionNumber;
 392  
         private String objectId;
 393  
 
 394  0
         private Builder(String entityId, String genderCode) {
 395  0
             setEntityId(entityId);
 396  0
             setGenderCode(genderCode);
 397  0
         }
 398  
 
 399  
         public static Builder create(String entityId, String genderCode) {
 400  
             // TODO modify as needed to pass any required values and add them to the signature of the 'create' method
 401  0
             return new Builder(entityId, genderCode);
 402  
         }
 403  
 
 404  
         public static Builder create(EntityBioDemographicsContract contract) {
 405  0
             if (contract == null) {
 406  0
                 throw new IllegalArgumentException("contract was null");
 407  
             }
 408  0
             Builder builder = create(contract.getEntityId(), contract.getGenderCode());
 409  0
             builder.setDeceasedDate(contract.getDeceasedDate());
 410  0
             builder.setBirthDate(contract.getBirthDate());
 411  0
             builder.setMaritalStatusCode(contract.getMaritalStatusCode());
 412  0
             builder.setPrimaryLanguageCode(contract.getPrimaryLanguageCode());
 413  0
             builder.setSecondaryLanguageCode(contract.getSecondaryLanguageCode());
 414  0
             builder.setBirthCountry(contract.getBirthCountry());
 415  0
             builder.setBirthStateProvinceCode(contract.getBirthStateProvinceCode());
 416  0
             builder.setBirthCity(contract.getBirthCity());
 417  0
             builder.setGeographicOrigin(contract.getGeographicOrigin());
 418  0
             builder.setGenderChangeCode(contract.getGenderChangeCode());
 419  0
             builder.setNoteMessage(contract.getNoteMessage());
 420  0
             builder.setSuppressPersonal(contract.isSuppressPersonal());
 421  0
             builder.setVersionNumber(contract.getVersionNumber());
 422  0
             builder.setObjectId(contract.getObjectId());
 423  0
             return builder;
 424  
         }
 425  
 
 426  
         public EntityBioDemographics build() {
 427  0
             return new EntityBioDemographics(this);
 428  
         }
 429  
 
 430  
         @Override
 431  
         public String getEntityId() {
 432  0
             return this.entityId;
 433  
         }
 434  
 
 435  
         @Override
 436  
         public String getDeceasedDate() {
 437  0
             return this.deceasedDate;
 438  
         }
 439  
 
 440  
         @Override
 441  
         public String getBirthDate() {
 442  0
             if (isSuppressPersonal()) {
 443  0
                 return KimConstants.RESTRICTED_DATA_MASK;
 444  
             }
 445  0
             return this.birthDate;
 446  
         }
 447  
 
 448  
         @Override
 449  
         public Integer getAge() {
 450  0
             return calculateAge(this.birthDate, this.deceasedDate, isSuppressPersonal());
 451  
         }
 452  
 
 453  
         @Override
 454  
         public String getGenderCode() {
 455  0
             if (isSuppressPersonal()) {
 456  0
                 return KimConstants.RESTRICTED_DATA_MASK;
 457  
             }
 458  0
             return this.genderCode;
 459  
         }
 460  
 
 461  
         @Override
 462  
         public String getGenderChangeCode() {
 463  0
             if (isSuppressPersonal()) {
 464  0
                 return KimConstants.RESTRICTED_DATA_MASK;
 465  
             }
 466  0
             return this.genderChangeCode;
 467  
         }
 468  
 
 469  
         @Override
 470  
         public String getMaritalStatusCode() {
 471  0
             if (isSuppressPersonal()) {
 472  0
                 return KimConstants.RESTRICTED_DATA_MASK;
 473  
             }
 474  0
             return this.maritalStatusCode;
 475  
         }
 476  
 
 477  
         @Override
 478  
         public String getPrimaryLanguageCode() {
 479  0
             if (isSuppressPersonal()) {
 480  0
                 return KimConstants.RESTRICTED_DATA_MASK;
 481  
             }
 482  0
             return this.primaryLanguageCode;
 483  
         }
 484  
 
 485  
         @Override
 486  
         public String getSecondaryLanguageCode() {
 487  0
             if (isSuppressPersonal()) {
 488  0
                 return KimConstants.RESTRICTED_DATA_MASK;
 489  
             }
 490  0
             return this.secondaryLanguageCode;
 491  
         }
 492  
 
 493  
         @Override
 494  
         public String getBirthCountry() {
 495  0
             if (isSuppressPersonal()) {
 496  0
                 return KimConstants.RESTRICTED_DATA_MASK;
 497  
             }
 498  0
             return this.birthCountry;
 499  
         }
 500  
 
 501  
         @Override
 502  
         public String getBirthStateProvinceCode() {
 503  0
             if (isSuppressPersonal()) {
 504  0
                 return KimConstants.RESTRICTED_DATA_MASK;
 505  
             }
 506  0
             return this.birthStateProvinceCode;
 507  
         }
 508  
 
 509  
         @Override
 510  
         public String getBirthCity() {
 511  0
             if (isSuppressPersonal()) {
 512  0
                 return KimConstants.RESTRICTED_DATA_MASK;
 513  
             }
 514  0
             return this.birthCity;
 515  
         }
 516  
 
 517  
         @Override
 518  
         public String getGeographicOrigin() {
 519  0
             if (isSuppressPersonal()) {
 520  0
                 return KimConstants.RESTRICTED_DATA_MASK;
 521  
             }
 522  0
             return this.geographicOrigin;
 523  
         }
 524  
 
 525  
         @Override
 526  
         public String getBirthDateUnmasked() {
 527  0
             return this.birthDate;
 528  
         }
 529  
 
 530  
         @Override
 531  
         public String getGenderCodeUnmasked() {
 532  0
             return this.genderCode;
 533  
         }
 534  
 
 535  
         @Override
 536  
         public String getGenderChangeCodeUnmasked() {
 537  0
             return this.genderChangeCode;
 538  
         }
 539  
 
 540  
         @Override
 541  
         public String getMaritalStatusCodeUnmasked() {
 542  0
             return this.maritalStatusCode;
 543  
         }
 544  
 
 545  
         @Override
 546  
         public String getPrimaryLanguageCodeUnmasked() {
 547  0
             return this.primaryLanguageCode;
 548  
         }
 549  
 
 550  
         @Override
 551  
         public String getSecondaryLanguageCodeUnmasked() {
 552  0
             return this.secondaryLanguageCode;
 553  
         }
 554  
 
 555  
         @Override
 556  
         public String getBirthCountryUnmasked() {
 557  0
             return this.birthCountry;
 558  
         }
 559  
 
 560  
         @Override
 561  
         public String getBirthStateProvinceCodeUnmasked() {
 562  0
             return this.birthStateProvinceCode;
 563  
         }
 564  
 
 565  
         @Override
 566  
         public String getBirthCityUnmasked() {
 567  0
             return this.birthCity;
 568  
         }
 569  
 
 570  
         @Override
 571  
         public String getGeographicOriginUnmasked() {
 572  0
             return this.geographicOrigin;
 573  
         }
 574  
 
 575  
         @Override
 576  
         public String getNoteMessage() {
 577  0
             return this.noteMessage;
 578  
         }
 579  
 
 580  
         @Override
 581  
         public boolean isSuppressPersonal() {
 582  0
             return this.suppressPersonal;
 583  
         }
 584  
 
 585  
         @Override
 586  
         public Long getVersionNumber() {
 587  0
             return this.versionNumber;
 588  
         }
 589  
 
 590  
         @Override
 591  
         public String getObjectId() {
 592  0
             return this.objectId;
 593  
         }
 594  
 
 595  
         public void setEntityId(String entityId) {
 596  0
             if (StringUtils.isEmpty(entityId)) {
 597  0
                 throw new IllegalArgumentException("id is empty");
 598  
             }
 599  0
             this.entityId = entityId;
 600  0
         }
 601  
 
 602  
         public void setDeceasedDate(String deceasedDate) {
 603  0
             if (deceasedDate != null) {
 604  0
                 SimpleDateFormat format = new SimpleDateFormat(DECEASED_DATE_FORMAT);
 605  
                 try{
 606  0
                     format.parse(deceasedDate);
 607  0
                     this.deceasedDate = deceasedDate;
 608  
                 }
 609  0
                 catch(ParseException e) {
 610  0
                     throw new IllegalArgumentException("deceasedDate is not of the format 'yyyy-MM-DD'");
 611  0
                 }
 612  
             }
 613  0
         }
 614  
 
 615  
         public void setBirthDate(String birthDate) {
 616  0
             if (birthDate != null) {
 617  0
                 SimpleDateFormat format = new SimpleDateFormat(BIRTH_DATE_FORMAT);
 618  
                 try{
 619  0
                     format.parse(birthDate);
 620  0
                     this.birthDate = birthDate;
 621  
                 }
 622  0
                 catch(ParseException e) {
 623  0
                     throw new IllegalArgumentException("birthDate is not of the format 'yyyy-MM-DD'");
 624  0
                 }
 625  
             }
 626  0
         }
 627  
 
 628  
         public void setDeceasedDate(Date deceasedDate) {
 629  0
             this.deceasedDate = new SimpleDateFormat(DECEASED_DATE_FORMAT).format(deceasedDate);
 630  0
         }
 631  
 
 632  
         public void setBirthDate(Date birthDate) {
 633  0
             this.birthDate = new SimpleDateFormat(BIRTH_DATE_FORMAT).format(birthDate);
 634  0
         }
 635  
 
 636  
         public void setGenderCode(String genderCode) {
 637  0
             if (StringUtils.isEmpty(genderCode)) {
 638  0
                 throw new IllegalArgumentException("genderCode is empty");
 639  
             }
 640  0
             this.genderCode = genderCode;
 641  0
         }
 642  
 
 643  
         public void setGenderChangeCode(String genderChangeCode) {
 644  0
             this.genderChangeCode = genderChangeCode;
 645  0
         }
 646  
 
 647  
         public void setMaritalStatusCode(String maritalStatusCode) {
 648  0
             this.maritalStatusCode = maritalStatusCode;
 649  0
         }
 650  
 
 651  
         public void setPrimaryLanguageCode(String primaryLanguageCode) {
 652  0
             this.primaryLanguageCode = primaryLanguageCode;
 653  0
         }
 654  
 
 655  
         public void setSecondaryLanguageCode(String secondaryLanguageCode) {
 656  0
             this.secondaryLanguageCode = secondaryLanguageCode;
 657  0
         }
 658  
 
 659  
         public void setBirthCountry(String birthCountry) {
 660  0
             this.birthCountry = birthCountry;
 661  0
         }
 662  
 
 663  
         public void setBirthStateProvinceCode(String birthStateProvinceCode) {
 664  0
             this.birthStateProvinceCode = birthStateProvinceCode;
 665  0
         }
 666  
 
 667  
         public void setBirthCity(String birthCity) {
 668  0
             this.birthCity = birthCity;
 669  0
         }
 670  
 
 671  
         public void setGeographicOrigin(String geographicOrigin) {
 672  0
             this.geographicOrigin = geographicOrigin;
 673  0
         }
 674  
 
 675  
         private void setNoteMessage(String noteMessage) {
 676  0
             this.noteMessage = noteMessage;
 677  0
         }
 678  
 
 679  
         private void setSuppressPersonal(boolean suppressPersonal) {
 680  0
             this.suppressPersonal = suppressPersonal;
 681  0
         }
 682  
 
 683  
         public void setVersionNumber(Long versionNumber) {
 684  0
             this.versionNumber = versionNumber;
 685  0
         }
 686  
 
 687  
         public void setObjectId(String objectId) {
 688  0
             this.objectId = objectId;
 689  0
         }
 690  
 
 691  
     }
 692  
 
 693  
 
 694  
     /**
 695  
      * Defines some internal constants used on this class.
 696  
      * 
 697  
      */
 698  0
     static class Constants {
 699  
 
 700  
         final static String ROOT_ELEMENT_NAME = "entityBioDemographics";
 701  
         final static String TYPE_NAME = "EntityBioDemographicsType";
 702  
     }
 703  
 
 704  
 
 705  
     /**
 706  
      * A private class which exposes constants which define the XML element names to use when this object is marshalled to XML.
 707  
      * 
 708  
      */
 709  0
     static class Elements {
 710  
 
 711  
         final static String ENTITY_ID = "entityId";
 712  
         final static String DECEASED_DATE = "deceasedDate";
 713  
         final static String BIRTH_DATE = "birthDate";
 714  
         final static String AGE = "age";
 715  
         final static String GENDER_CODE = "genderCode";
 716  
         final static String MARITAL_STATUS_CODE = "maritalStatusCode";
 717  
         final static String PRIMARY_LANGUAGE_CODE = "primaryLanguageCode";
 718  
         final static String SECONDARY_LANGUAGE_CODE = "secondaryLanguageCode";
 719  
         final static String BIRTH_COUNTRY = "birthCountry";
 720  
         final static String BIRTH_STATE_PROVINCE_CODE = "birthStateProvinceCode";
 721  
         final static String BIRTH_CITY = "birthCity";
 722  
         final static String GEOGRAPHIC_ORIGIN = "geographicOrigin";
 723  
         final static String BIRTH_DATE_UNMASKED = "birthDateUnmasked";
 724  
         final static String GENDER_CODE_UNMASKED = "genderCodeUnmasked";
 725  
         final static String MARITAL_STATUS_CODE_UNMASKED = "maritalStatusCodeUnmasked";
 726  
         final static String PRIMARY_LANGUAGE_CODE_UNMASKED = "primaryLanguageCodeUnmasked";
 727  
         final static String SECONDARY_LANGUAGE_CODE_UNMASKED = "secondaryLanguageCodeUnmasked";
 728  
         final static String BIRTH_COUNTRY_UNMASKED = "birthCountryUnmasked";
 729  
         final static String BIRTH_STATE_PROVINCE_CODE_UNMASKED = "birthStateProvinceCodeUnmasked";
 730  
         final static String BIRTH_CITY_UNMASKED = "birthCityUnmasked";
 731  
         final static String GEOGRAPHIC_ORIGIN_UNMASKED = "geographicOriginUnmasked";
 732  
         final static String GENDER_CHANGE_CODE = "genderChangeCode";
 733  
         final static String GENDER_CHANGE_CODE_UNMASKED = "genderChangeCodeUnmasked";
 734  
         final static String NOTE_MESSAGE = "noteMessage";
 735  
         final static String SUPPRESS_PERSONAL = "suppressPersonal";
 736  
 
 737  
     }
 738  
 
 739  
 }