@Override
 public final String modelToXmlString() {
   MarriageDetailsRequestDocument 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 MarriageDetailsRequestDocument modelToXml() {

    Calendar calendar = Calendar.getInstance();
    LocalTime localTime = new LocalTime();
    Date date = null;
    MarriageDetailsRequestDocument marriageDetailsRequestDoc =
        MarriageDetailsRequestDocument.Factory.newInstance();
    MarriageDetailsRequestDocument.MarriageDetailsRequest marriageDetailsRequest =
        marriageDetailsRequestDoc.addNewMarriageDetailsRequest();
    super.fillCommonXmlInfo(marriageDetailsRequest);
    int i = 0;

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

    if (getCopies() != null)
      marriageDetailsRequest.setCopies(new BigInteger(getCopies().toString()));
    MarriageHusbandInformationType marriageHusbandInformationTypeMarriageHusband =
        marriageDetailsRequest.addNewMarriageHusband();
    marriageHusbandInformationTypeMarriageHusband.setMarriageHusbandLastName(
        getMarriageHusbandLastName());
    MarriageWifeInformationType marriageWifeInformationTypeMarriageWife =
        marriageDetailsRequest.addNewMarriageWife();
    marriageWifeInformationTypeMarriageWife.setMarriageWifeFirstNames(getMarriageWifeFirstNames());

    marriageDetailsRequest.setComment(getComment());

    marriageDetailsRequest.setRequesterQualityPrecision(getRequesterQualityPrecision());
    MarriageFatherInformationType marriageFatherInformationTypeFatherInformation =
        marriageDetailsRequest.addNewFatherInformation();
    marriageFatherInformationTypeFatherInformation.setFatherFirstNames(getFatherFirstNames());
    MarriageInformationType marriageInformationTypeMarriage =
        marriageDetailsRequest.addNewMarriage();
    marriageInformationTypeMarriage.setMarriagePostalCode(getMarriagePostalCode());
    MarriageMotherInformationType marriageMotherInformationTypeMotherInformation =
        marriageDetailsRequest.addNewMotherInformation();
    marriageMotherInformationTypeMotherInformation.setMotherMaidenName(getMotherMaidenName());

    marriageHusbandInformationTypeMarriageHusband.setMarriageHusbandFirstNames(
        getMarriageHusbandFirstNames());

    if (getRequesterQuality() != null)
      marriageDetailsRequest.setRequesterQuality(
          fr.cg95.cvq.xml.request.civil.MarriageRequesterQualityType.Enum.forString(
              getRequesterQuality().toString()));

    marriageInformationTypeMarriage.setMarriageCity(getMarriageCity());

    marriageWifeInformationTypeMarriageWife.setMarriageWifeLastName(getMarriageWifeLastName());

    date = getMarriageDate();
    if (date != null) {
      calendar.setTime(date);
      marriageInformationTypeMarriage.setMarriageDate(calendar);
    }

    marriageFatherInformationTypeFatherInformation.setFatherLastName(getFatherLastName());

    if (getRelationship() != null)
      marriageDetailsRequest.setRelationship(
          fr.cg95.cvq.xml.request.civil.MarriageRelationshipType.Enum.forString(
              getRelationship().toString()));

    marriageMotherInformationTypeMotherInformation.setMotherFirstNames(getMotherFirstNames());

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

    return marriageDetailsRequestDoc;
  }
  public static MarriageDetailsRequest xmlToModel(
      MarriageDetailsRequestDocument marriageDetailsRequestDoc) {
    MarriageDetailsRequestDocument.MarriageDetailsRequest marriageDetailsRequestXml =
        marriageDetailsRequestDoc.getMarriageDetailsRequest();
    Calendar calendar = Calendar.getInstance();
    LocalTime localTime = new LocalTime();
    List list = new ArrayList();
    MarriageDetailsRequest marriageDetailsRequest = new MarriageDetailsRequest();
    marriageDetailsRequest.fillCommonModelInfo(marriageDetailsRequest, marriageDetailsRequestXml);

    if (marriageDetailsRequestXml.getFormat() != null)
      marriageDetailsRequest.setFormat(
          fr.cg95.cvq.business.request.civil.MarriageCertificateFormatType.forString(
              marriageDetailsRequestXml.getFormat().toString()));
    else
      marriageDetailsRequest.setFormat(
          fr.cg95.cvq.business.request.civil.MarriageCertificateFormatType
              .getDefaultMarriageCertificateFormatType());

    marriageDetailsRequest.setCopies(marriageDetailsRequestXml.getCopies());

    marriageDetailsRequest.setMarriageHusbandLastName(
        marriageDetailsRequestXml.getMarriageHusband().getMarriageHusbandLastName());

    marriageDetailsRequest.setMarriageWifeFirstNames(
        marriageDetailsRequestXml.getMarriageWife().getMarriageWifeFirstNames());

    marriageDetailsRequest.setComment(marriageDetailsRequestXml.getComment());

    marriageDetailsRequest.setRequesterQualityPrecision(
        marriageDetailsRequestXml.getRequesterQualityPrecision());

    marriageDetailsRequest.setFatherFirstNames(
        marriageDetailsRequestXml.getFatherInformation().getFatherFirstNames());

    marriageDetailsRequest.setMarriagePostalCode(
        marriageDetailsRequestXml.getMarriage().getMarriagePostalCode());

    marriageDetailsRequest.setMotherMaidenName(
        marriageDetailsRequestXml.getMotherInformation().getMotherMaidenName());

    marriageDetailsRequest.setMarriageHusbandFirstNames(
        marriageDetailsRequestXml.getMarriageHusband().getMarriageHusbandFirstNames());

    if (marriageDetailsRequestXml.getRequesterQuality() != null)
      marriageDetailsRequest.setRequesterQuality(
          fr.cg95.cvq.business.request.civil.MarriageRequesterQualityType.forString(
              marriageDetailsRequestXml.getRequesterQuality().toString()));
    else
      marriageDetailsRequest.setRequesterQuality(
          fr.cg95.cvq.business.request.civil.MarriageRequesterQualityType
              .getDefaultMarriageRequesterQualityType());

    marriageDetailsRequest.setMarriageCity(
        marriageDetailsRequestXml.getMarriage().getMarriageCity());

    marriageDetailsRequest.setMarriageWifeLastName(
        marriageDetailsRequestXml.getMarriageWife().getMarriageWifeLastName());

    calendar = marriageDetailsRequestXml.getMarriage().getMarriageDate();
    if (calendar != null) {
      marriageDetailsRequest.setMarriageDate(calendar.getTime());
    }

    marriageDetailsRequest.setFatherLastName(
        marriageDetailsRequestXml.getFatherInformation().getFatherLastName());

    if (marriageDetailsRequestXml.getRelationship() != null)
      marriageDetailsRequest.setRelationship(
          fr.cg95.cvq.business.request.civil.MarriageRelationshipType.forString(
              marriageDetailsRequestXml.getRelationship().toString()));
    else
      marriageDetailsRequest.setRelationship(
          fr.cg95.cvq.business.request.civil.MarriageRelationshipType
              .getDefaultMarriageRelationshipType());

    marriageDetailsRequest.setMotherFirstNames(
        marriageDetailsRequestXml.getMotherInformation().getMotherFirstNames());

    if (marriageDetailsRequestXml.getMotive() != null)
      marriageDetailsRequest.setMotive(
          fr.cg95.cvq.business.request.civil.MarriageCertificateMotiveType.forString(
              marriageDetailsRequestXml.getMotive().toString()));
    else
      marriageDetailsRequest.setMotive(
          fr.cg95.cvq.business.request.civil.MarriageCertificateMotiveType
              .getDefaultMarriageCertificateMotiveType());

    return marriageDetailsRequest;
  }