@Override
 public final String modelToXmlString() {
   DeathDetailsRequestDocument object = this.modelToXml();
   XmlOptions opts = new XmlOptions();
   opts.setSavePrettyPrint();
   opts.setSavePrettyPrintIndent(4);
   opts.setUseDefaultNamespace();
   opts.setCharacterEncoding("UTF-8");
   return object.xmlText(opts);
 }
  @Override
  public final DeathDetailsRequestDocument modelToXml() {

    Calendar calendar = Calendar.getInstance();
    LocalTime localTime = new LocalTime();
    Date date = null;
    DeathDetailsRequestDocument deathDetailsRequestDoc =
        DeathDetailsRequestDocument.Factory.newInstance();
    DeathDetailsRequestDocument.DeathDetailsRequest deathDetailsRequest =
        deathDetailsRequestDoc.addNewDeathDetailsRequest();
    super.fillCommonXmlInfo(deathDetailsRequest);
    int i = 0;

    deathDetailsRequest.setComment(getComment());

    if (getCopies() != null) deathDetailsRequest.setCopies(new BigInteger(getCopies().toString()));

    deathDetailsRequest.setDeathCity(getDeathCity());

    date = getDeathDate();
    if (date != null) {
      calendar.setTime(date);
      deathDetailsRequest.setDeathDate(calendar);
    }

    deathDetailsRequest.setDeathFirstNames(getDeathFirstNames());

    deathDetailsRequest.setDeathLastName(getDeathLastName());

    deathDetailsRequest.setDeathPostalCode(getDeathPostalCode());

    if (getFormat() != null)
      deathDetailsRequest.setFormat(
          fr.cg95.cvq.xml.request.civil.DeathCertificateFormatType.Enum.forString(
              getFormat().toString()));

    if (getMotive() != null)
      deathDetailsRequest.setMotive(
          fr.cg95.cvq.xml.request.civil.DeathCertificateMotiveType.Enum.forString(
              getMotive().toString()));

    return deathDetailsRequestDoc;
  }
  public static DeathDetailsRequest xmlToModel(DeathDetailsRequestDocument deathDetailsRequestDoc) {
    DeathDetailsRequestDocument.DeathDetailsRequest deathDetailsRequestXml =
        deathDetailsRequestDoc.getDeathDetailsRequest();
    Calendar calendar = Calendar.getInstance();
    LocalTime localTime = new LocalTime();
    List list = new ArrayList();
    DeathDetailsRequest deathDetailsRequest = new DeathDetailsRequest();
    deathDetailsRequest.fillCommonModelInfo(deathDetailsRequest, deathDetailsRequestXml);

    deathDetailsRequest.setComment(deathDetailsRequestXml.getComment());

    deathDetailsRequest.setCopies(deathDetailsRequestXml.getCopies());

    deathDetailsRequest.setDeathCity(deathDetailsRequestXml.getDeathCity());

    calendar = deathDetailsRequestXml.getDeathDate();
    if (calendar != null) {
      deathDetailsRequest.setDeathDate(calendar.getTime());
    }

    deathDetailsRequest.setDeathFirstNames(deathDetailsRequestXml.getDeathFirstNames());

    deathDetailsRequest.setDeathLastName(deathDetailsRequestXml.getDeathLastName());

    deathDetailsRequest.setDeathPostalCode(deathDetailsRequestXml.getDeathPostalCode());

    if (deathDetailsRequestXml.getFormat() != null)
      deathDetailsRequest.setFormat(
          fr.cg95.cvq.business.request.civil.DeathCertificateFormatType.forString(
              deathDetailsRequestXml.getFormat().toString()));
    else
      deathDetailsRequest.setFormat(
          fr.cg95.cvq.business.request.civil.DeathCertificateFormatType
              .getDefaultDeathCertificateFormatType());

    if (deathDetailsRequestXml.getMotive() != null)
      deathDetailsRequest.setMotive(
          fr.cg95.cvq.business.request.civil.DeathCertificateMotiveType.forString(
              deathDetailsRequestXml.getMotive().toString()));
    else
      deathDetailsRequest.setMotive(
          fr.cg95.cvq.business.request.civil.DeathCertificateMotiveType
              .getDefaultDeathCertificateMotiveType());

    return deathDetailsRequest;
  }