@SuppressWarnings("unchecked")
 @Override
 public void prepareEdit() {
   stillBirthRegistration =
       (StillBirthRegistration) birthRegistrationService.getBirthRegistrationById(idTemp);
   // stillBirthRegistration =
   // (StillBirthRegistration)birthRegistrationService.merge(stillBirthRegistration);
   fatherAddressSet =
       (Set<Address>)
           stillBirthRegistration
               .getCitizen()
               .getRelatedPerson(BndConstants.FATHER.toUpperCase())
               .getAddress();
   motherAddressSet =
       (Set<Address>)
           stillBirthRegistration
               .getCitizen()
               .getRelatedPerson(BndConstants.MOTHER.toUpperCase())
               .getAddress();
   informantAddressSet.add(
       stillBirthRegistration.getInformant().getRelatedAddress(BndConstants.PRESENTADDRESS));
   citizenAddressSet = (Set<Address>) stillBirthRegistration.getCitizen().getAddress();
   oldRelations = stillBirthRegistration.getCitizen().getRelations();
   fatherAddressSet.removeAll(informantAddressSet);
   motherAddressSet.removeAll(informantAddressSet);
   getDetailsAddressTypeAndRelation();
 }
 private void buildCitizenAddress() {
   stillBirthRegistration.getCitizen().setName(BndConstants.STILLBIRTH);
   if (placeTypeTemp != null && BndConstants.NOTSTATED.equals(placeTypeTemp))
     stillBirthRegistration.setEventAddress(null);
   else if (placeTypeTemp != null && BndConstants.HOSPTIAL.equals(placeTypeTemp))
     stillBirthRegistration.setEventAddress(
         stillBirthRegistration.getEstablishment().getAddress());
   else stillBirthRegistration.getEventAddress().setType(eventAddressType);
   stillBirthRegistration.getMotherResidenceAddress().setType(usualAddressType);
   buildNewAddressFromOldAddress(
       motherAddressSet, stillBirthRegistration.getMotherResidenceAddress());
   stillBirthRegistration.getInformantAddress().setType(AddressType.CORRESPONDENCE);
 }
  private void beforeViewAndModify() {
    stillBirthRegistration =
        (StillBirthRegistration) birthRegistrationService.getBirthRegistrationById(idTemp);
    stillBirthRegistration.setFather(
        stillBirthRegistration.getCitizen().getRelatedPerson(BndConstants.FATHER.toUpperCase()));
    stillBirthRegistration.setMother(
        stillBirthRegistration.getCitizen().getRelatedPerson(BndConstants.MOTHER.toUpperCase()));

    if (stillBirthRegistration.getInformant() != null) {
      final CRelation relation =
          stillBirthRegistration.getCitizen().getRelation(stillBirthRegistration.getInformant());
      if (relation != null) informantFlag = relation.getDesc();
      informantCitizen = stillBirthRegistration.getInformant();
      stillBirthRegistration.setInformantAddress(
          stillBirthRegistration.getInformant().getRelatedAddress(BndConstants.PRESENTADDRESS));
    }
    stillBirthRegistration.setMotherResidenceAddress(
        stillBirthRegistration.getMother().getRelatedAddress(BndConstants.USUALADDRESS));
    placeTypeTemp = stillBirthRegistration.getPlaceType().getDesc();

    if (stillBirthRegistration.getCitizenBDDetails().getCauseOfDeath() != null)
      if (stillBirthRegistration.getCitizenBDDetails().getCauseOfDeath().getParent() != null) {
        stillBirthRegistration.setCauseOfDeathParent(
            stillBirthRegistration.getCitizenBDDetails().getCauseOfDeath().getParent());
        addDropdownData(
            "diseaseList",
            bndCommonService.getCauseofDeathbyParentId(
                stillBirthRegistration
                    .getCitizenBDDetails()
                    .getCauseOfDeath()
                    .getParent()
                    .getId()));
      } else
        stillBirthRegistration.setCauseOfDeathParent(
            stillBirthRegistration.getCitizenBDDetails().getCauseOfDeath());
  }