/*
 * Copyright 2015-2018 OpenEstate.org.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.openestate.io.examples;

import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.io.Writer;
import java.math.BigDecimal;
import java.util.Calendar;
import java.util.Locale;
import org.apache.commons.io.output.NullOutputStream;
import org.apache.commons.io.output.NullWriter;
import org.apache.commons.lang3.RandomUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.PropertyConfigurator;
import org.openestate.io.examples.utils.RandomStringUtils;
import org.openestate.io.openimmo.OpenImmoTransferDocument;
import org.openestate.io.openimmo.OpenImmoUtils;
import org.openestate.io.openimmo.OpenImmoVersion;
import org.openestate.io.openimmo.xml.Aktion;
import org.openestate.io.openimmo.xml.Anbieter;
import org.openestate.io.openimmo.xml.Haus;
import org.openestate.io.openimmo.xml.Immobilie;
import org.openestate.io.openimmo.xml.ObjectFactory;
import org.openestate.io.openimmo.xml.Openimmo;
import org.openestate.io.openimmo.xml.Uebertragung;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Example for writing OpenImmo files.
 * <p>
 * This example illustrates the programmatic creation of OpenImmo documents, how
 * they are written into XML and how they are downgraded to earlier versions.
 *
 * @author Andreas Rudolph
 * @since 1.0
 */
@SuppressWarnings("WeakerAccess")
public class OpenImmoWritingExample {
    @SuppressWarnings("unused")
    private final static Logger LOGGER = LoggerFactory.getLogger(OpenImmoWritingExample.class);
    private final static String PACKAGE = "/org/openestate/io/examples";
    private final static ObjectFactory FACTORY = OpenImmoUtils.getFactory();
    private final static boolean PRETTY_PRINT = true;

    /**
     * Start the example application.
     *
     * @param args command line arguments
     */
    @SuppressWarnings("Duplicates")
    public static void main(String[] args) {
        // init logging
        PropertyConfigurator.configure(
                OpenImmoWritingExample.class.getResource(PACKAGE + "/log4j.properties"));

        // create an Openimmo object with some example data
        // this object corresponds to the <openimmo> root element in XML
        Openimmo openimmo = FACTORY.createOpenimmo();
        openimmo.setUebertragung(createUebertragung());
        openimmo.getAnbieter().add(createAnbieter());

        // convert the Openimmo object into a XML document
        OpenImmoTransferDocument doc = null;
        try {
            doc = OpenImmoTransferDocument.newDocument(openimmo);
        } catch (Exception ex) {
            LOGGER.error("Can't create XML document!");
            LOGGER.error("> " + ex.getLocalizedMessage(), ex);
            System.exit(1);
        }

        // write XML document into a java.io.File
        try {
            write(doc, File.createTempFile("output-", ".xml"));
        } catch (IOException ex) {
            LOGGER.error("Can't create temporary file!");
            LOGGER.error("> " + ex.getLocalizedMessage(), ex);
            System.exit(1);
        }

        // write XML document into a java.io.OutputStream
        write(doc, new NullOutputStream());

        // write XML document into a java.io.Writer
        write(doc, new NullWriter());

        // write XML document into a string and send it to the console
        writeToConsole(doc);

        // downgrade XML document to an earlier version
        // and write it to the console
        doc.downgrade(OpenImmoVersion.V1_2_3);
        writeToConsole(doc);

        // downgrade XML document to the first version
        // and write it to the console
        doc.downgrade(OpenImmoVersion.V1_1);
        writeToConsole(doc);
    }

    /**
     * Create an {@link Anbieter} with some example data.
     *
     * @return created example object
     */
    protected static Anbieter createAnbieter() {
        // create an example agency
        Anbieter anbieter = FACTORY.createAnbieter();
        anbieter.setAnbieternr("123456");
        anbieter.setFirma("Agency Name");
        anbieter.setOpenimmoAnid("123456");

        // add some real estates to the agency
        anbieter.getImmobilie().add(createImmobilie());
        anbieter.getImmobilie().add(createImmobilie());

        return anbieter;
    }

    /**
     * Create an {@link Immobilie} with some example data.
     *
     * @return created example object
     */
    protected static Immobilie createImmobilie() {
        // create an example real estate
        Immobilie immobilie = FACTORY.createImmobilie();

        // add some administrative information
        immobilie.setVerwaltungTechn(FACTORY.createVerwaltungTechn());
        immobilie.getVerwaltungTechn().setAktion(FACTORY.createAktion());
        immobilie.getVerwaltungTechn().getAktion().setAktionart(Aktion.AktionArt.CHANGE);
        immobilie.getVerwaltungTechn().setObjektnrIntern(RandomStringUtils.randomNumeric(10));

        // set categorization
        immobilie.setObjektkategorie(FACTORY.createObjektkategorie());
        immobilie.getObjektkategorie().setNutzungsart(FACTORY.createNutzungsart());
        immobilie.getObjektkategorie().getNutzungsart().setANLAGE(RandomUtils.nextInt(0, 2) == 1);
        immobilie.getObjektkategorie().getNutzungsart().setGEWERBE(RandomUtils.nextInt(0, 2) == 1);
        immobilie.getObjektkategorie().getNutzungsart().setWAZ(RandomUtils.nextInt(0, 2) == 1);
        immobilie.getObjektkategorie().getNutzungsart().setWOHNEN(RandomUtils.nextInt(0, 2) == 1);
        immobilie.getObjektkategorie().setVermarktungsart(FACTORY.createVermarktungsart());
        immobilie.getObjektkategorie().getVermarktungsart().setKAUF(true);
        immobilie.getObjektkategorie().setObjektart(FACTORY.createObjektart());

        Haus singleFamilyHouse = FACTORY.createHaus();
        singleFamilyHouse.setHaustyp(Haus.Haustyp.EINFAMILIENHAUS);
        immobilie.getObjektkategorie().getObjektart().getHaus().add(singleFamilyHouse);

        // add some information about the location
        immobilie.setGeo(FACTORY.createGeo());
        immobilie.getGeo().setPlz(RandomStringUtils.randomNumeric(5));
        immobilie.getGeo().setOrt("Berlin");
        immobilie.getGeo().setLand(FACTORY.createLand());
        immobilie.getGeo().getLand().setIsoLand(Locale.GERMANY.getISO3Country());

        // add some information about prices
        immobilie.setPreise(FACTORY.createPreise());
        immobilie.getPreise().setHeizkosten(new BigDecimal("456.0"));
        immobilie.getPreise().setKaufpreis(FACTORY.createKaufpreis());
        immobilie.getPreise().getKaufpreis().setAufAnfrage(false);
        immobilie.getPreise().getKaufpreis().setValue(new BigDecimal("123456.79"));

        // add some information about features
        immobilie.setAusstattung(FACTORY.createAusstattung());
        immobilie.getAusstattung().setGaestewc(true);
        immobilie.getAusstattung().setGartennutzung(true);
        immobilie.getAusstattung().setHeizungsart(FACTORY.createHeizungsart());
        immobilie.getAusstattung().getHeizungsart().setZENTRAL(true);
        immobilie.getAusstattung().getHeizungsart().setFUSSBODEN(true);

        // add some descriptions
        immobilie.setFreitexte(FACTORY.createFreitexte());
        immobilie.getFreitexte().setObjekttitel("A title for the property.");
        immobilie.getFreitexte().setObjektbeschreibung("Some longer descriptive text about the property.");

        // set the contact person
        immobilie.setKontaktperson(FACTORY.createKontaktperson());
        immobilie.getKontaktperson().setName("Max Mustermann");
        immobilie.getKontaktperson().setEmailFeedback("max@mustermann.org");
        immobilie.getKontaktperson().setTelDurchw("030/123456789");
        immobilie.getKontaktperson().setPlz(RandomStringUtils.randomNumeric(5));
        immobilie.getKontaktperson().setOrt("Berlin");
        immobilie.getKontaktperson().setLand(FACTORY.createLand());
        immobilie.getKontaktperson().getLand().setIsoLand(Locale.GERMANY.getISO3Country());

        return immobilie;
    }

    /**
     * Create an {@link Uebertragung} with some example data.
     *
     * @return created example object
     */
    protected static Uebertragung createUebertragung() {
        // create an example transfer
        Uebertragung uebertragung = FACTORY.createUebertragung();
        uebertragung.setArt(Uebertragung.Art.OFFLINE);
        uebertragung.setModus(Uebertragung.Modus.NEW);
        uebertragung.setSendersoftware("OpenEstate-IO");
        uebertragung.setSenderversion("1.4");
        uebertragung.setTechnEmail("test@test.org");
        uebertragung.setTimestamp(Calendar.getInstance());
        uebertragung.setUmfang(Uebertragung.Umfang.VOLL);
        return uebertragung;
    }

    /**
     * Write an {@link OpenImmoTransferDocument} into a {@link File}.
     *
     * @param doc  the document to write
     * @param file the file, where the document is written to
     */
    @SuppressWarnings("Duplicates")
    protected static void write(OpenImmoTransferDocument doc, File file) {
        LOGGER.info("writing document with version " + doc.getDocumentVersion());
        try {
            doc.toXml(file, PRETTY_PRINT);
            LOGGER.info("> written to: " + file.getAbsolutePath());
        } catch (Exception ex) {
            LOGGER.error("Can't write document into a file!");
            LOGGER.error("> " + ex.getLocalizedMessage(), ex);
            System.exit(1);
        }
    }

    /**
     * Write an {@link OpenImmoTransferDocument} into an {@link OutputStream}.
     *
     * @param doc    the document to write
     * @param output the stream, where the document is written to
     */
    @SuppressWarnings("Duplicates")
    protected static void write(OpenImmoTransferDocument doc, OutputStream output) {
        LOGGER.info("writing document with version " + doc.getDocumentVersion());
        try {
            doc.toXml(output, PRETTY_PRINT);
            LOGGER.info("> written to a java.io.OutputStream");
        } catch (Exception ex) {
            LOGGER.error("Can't write document into an OutputStream!");
            LOGGER.error("> " + ex.getLocalizedMessage(), ex);
            System.exit(1);
        }
    }

    /**
     * Write an {@link OpenImmoTransferDocument} into a {@link Writer}.
     *
     * @param doc    the document to write
     * @param output the writer, where the document is written to
     */
    @SuppressWarnings("Duplicates")
    protected static void write(OpenImmoTransferDocument doc, Writer output) {
        LOGGER.info("writing document with version " + doc.getDocumentVersion());
        try {
            doc.toXml(output, PRETTY_PRINT);
            LOGGER.info("> written to a java.io.Writer");
        } catch (Exception ex) {
            LOGGER.error("Can't write document into an OutputStream!");
            LOGGER.error("> " + ex.getLocalizedMessage(), ex);
            System.exit(1);
        }
    }

    /**
     * Write an {@link OpenImmoTransferDocument} into a {@link String} and print the
     * results to the console.
     *
     * @param doc the document to write
     */
    @SuppressWarnings("Duplicates")
    protected static void writeToConsole(OpenImmoTransferDocument doc) {
        LOGGER.info("writing document with version " + doc.getDocumentVersion());
        try {
            String xml = doc.toXmlString(PRETTY_PRINT);
            LOGGER.info(StringUtils.repeat("-", 50)
                    + System.lineSeparator() + xml);
        } catch (Exception ex) {
            LOGGER.error("Can't write document into a string!");
            LOGGER.error("> " + ex.getLocalizedMessage(), ex);
            System.exit(1);
        }
    }
}


/*
 * Copyright 2015-2018 OpenEstate.org.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.openestate.io.examples;

import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.io.Writer;
import java.math.BigInteger;
import org.apache.commons.io.output.NullOutputStream;
import org.apache.commons.io.output.NullWriter;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.PropertyConfigurator;
import org.openestate.io.filemaker.FilemakerResultDocument;
import org.openestate.io.filemaker.FilemakerUtils;
import org.openestate.io.filemaker.xml.result.DatabaseType;
import org.openestate.io.filemaker.xml.result.FMPXMLRESULT;
import org.openestate.io.filemaker.xml.result.FieldType;
import org.openestate.io.filemaker.xml.result.MetaDataType;
import org.openestate.io.filemaker.xml.result.ObjectFactory;
import org.openestate.io.filemaker.xml.result.ProductType;
import org.openestate.io.filemaker.xml.result.ResultSetType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Example for writing XML files for Filemaker PRO.
 * <p>
 * This example illustrates the programmatic creation of documents for
 * Filemaker PRO and how they are written into XML.
 *
 * @author Andreas Rudolph
 * @since 1.0
 */
@SuppressWarnings("WeakerAccess")
public class FilemakerWritingExample {
    @SuppressWarnings("unused")
    private final static Logger LOGGER = LoggerFactory.getLogger(FilemakerWritingExample.class);
    private final static String PACKAGE = "/org/openestate/io/examples";
    private final static ObjectFactory FACTORY = FilemakerUtils.getFactoryForResult();
    private final static boolean PRETTY_PRINT = true;

    /**
     * Start the example application.
     *
     * @param args command line arguments
     */
    @SuppressWarnings("Duplicates")
    public static void main(String[] args) {
        // init logging
        PropertyConfigurator.configure(
                FilemakerWritingExample.class.getResource(PACKAGE + "/log4j.properties"));

        // create a FMPXMLRESULT object with some example data
        // this object corresponds to the <FMPXMLRESULT> root element in XML
        FMPXMLRESULT result = FACTORY.createFMPXMLRESULT();
        result.setERRORCODE("0");
        result.setPRODUCT(createProduct());
        result.setDATABASE(createDatabase());
        result.setMETADATA(createMetaData());
        result.setRESULTSET(createResultSet());

        // convert the Openimmo object into a XML document
        FilemakerResultDocument doc = null;
        try {
            doc = FilemakerResultDocument.newDocument(result);
        } catch (Exception ex) {
            LOGGER.error("Can't create XML document!");
            LOGGER.error("> " + ex.getLocalizedMessage(), ex);
            System.exit(1);
        }

        // write XML document into a java.io.File
        try {
            write(doc, File.createTempFile("output-", ".xml"));
        } catch (IOException ex) {
            LOGGER.error("Can't create temporary file!");
            LOGGER.error("> " + ex.getLocalizedMessage(), ex);
            System.exit(1);
        }

        // write XML document into a java.io.OutputStream
        write(doc, new NullOutputStream());

        // write XML document into a java.io.Writer
        write(doc, new NullWriter());

        // write XML document into a string and send it to the console
        writeToConsole(doc);
    }

    /**
     * Create a {@link DatabaseType} with some example data.
     *
     * @return created example object
     */
    protected static DatabaseType createDatabase() {
        DatabaseType database = FACTORY.createDatabaseType();
        database.setNAME("example database");
        database.setLAYOUT("fmmedia2universal");
        database.setDATEFORMAT("D.m.yyyy");
        database.setTIMEFORMAT("k:mm:ss");
        database.setRECORDS(BigInteger.ZERO);
        return database;
    }

    /**
     * Create a {@link MetaDataType} with some example data.
     *
     * @return created example object
     */
    protected static MetaDataType createMetaData() {
        MetaDataType metadata = FACTORY.createMetaDataType();
        MetaDataType.FIELD field;

        field = FACTORY.createMetaDataTypeFIELD();
        field.setNAME("number of rooms");
        field.setEMPTYOK(true);
        field.setMAXREPEAT(BigInteger.ONE);
        field.setTYPE(FieldType.NUMBER);
        metadata.getFIELD().add(field);

        field = FACTORY.createMetaDataTypeFIELD();
        field.setNAME("price");
        field.setEMPTYOK(false);
        field.setMAXREPEAT(BigInteger.ONE);
        field.setTYPE(FieldType.NUMBER);
        metadata.getFIELD().add(field);

        field = FACTORY.createMetaDataTypeFIELD();
        field.setNAME("description");
        field.setEMPTYOK(true);
        field.setMAXREPEAT(BigInteger.ONE);
        field.setTYPE(FieldType.TEXT);
        metadata.getFIELD().add(field);

        return metadata;
    }

    /**
     * Create a {@link ProductType} with some example data.
     *
     * @return created example object
     */
    protected static ProductType createProduct() {
        ProductType product = FACTORY.createProductType();
        product.setNAME("OpenEstate-IO");
        product.setVERSION("1.4");
        product.setBUILD("123");
        return product;
    }

    /**
     * Create a {@link ResultSetType} with some example data.
     *
     * @return created example object
     */
    protected static ResultSetType createResultSet() {
        ResultSetType result = FACTORY.createResultSetType();
        result.getROW().add(createResultSetRow(1, 3, 100, "a first example"));
        result.getROW().add(createResultSetRow(2, null, 200, "a second example"));
        result.getROW().add(createResultSetRow(3, 5, 300, null));
        result.setFOUND(BigInteger.valueOf(result.getROW().size()));
        return result;
    }

    /**
     * Create a {@link org.openestate.io.filemaker.xml.result.ResultSetType.ROW}
     * with some example data.
     *
     * @param id            id of the record
     * @param numberOfRooms value for number of rooms
     * @param price         value for price
     * @param description   value for description
     * @return created example object
     */
    @SuppressWarnings("ConstantConditions")
    protected static ResultSetType.ROW createResultSetRow(long id, Number numberOfRooms, Number price, String description) {
        ResultSetType.ROW.COL col;

        ResultSetType.ROW row = FACTORY.createResultSetTypeROW();
        row.setRECORDID(BigInteger.valueOf(id));
        row.setMODID(BigInteger.valueOf(id));

        col = FACTORY.createResultSetTypeROWCOL();
        if (numberOfRooms != null)
            col.getDATA().add(StringUtils.EMPTY);
        else
            col.getDATA().add(String.valueOf(numberOfRooms));
        row.getCOL().add(col);

        col = FACTORY.createResultSetTypeROWCOL();
        if (price != null)
            col.getDATA().add("0");
        else
            col.getDATA().add(String.valueOf(price));
        row.getCOL().add(col);

        col = FACTORY.createResultSetTypeROWCOL();
        col.getDATA().add(StringUtils.trimToEmpty(description));
        row.getCOL().add(col);

        return row;
    }

    /**
     * Write a {@link FilemakerResultDocument} into a {@link File}.
     *
     * @param doc  the document to write
     * @param file the file, where the document is written to
     */
    @SuppressWarnings("Duplicates")
    protected static void write(FilemakerResultDocument doc, File file) {
        LOGGER.info("writing document");
        try {
            doc.toXml(file, PRETTY_PRINT);
            LOGGER.info("> written to: " + file.getAbsolutePath());
        } catch (Exception ex) {
            LOGGER.error("Can't write document into a file!");
            LOGGER.error("> " + ex.getLocalizedMessage(), ex);
            System.exit(1);
        }
    }

    /**
     * Write a {@link FilemakerResultDocument} into an {@link OutputStream}.
     *
     * @param doc    the document to write
     * @param output the stream, where the document is written to
     */
    @SuppressWarnings("Duplicates")
    protected static void write(FilemakerResultDocument doc, OutputStream output) {
        LOGGER.info("writing document");
        try {
            doc.toXml(output, PRETTY_PRINT);
            LOGGER.info("> written to a java.io.OutputStream");
        } catch (Exception ex) {
            LOGGER.error("Can't write document into an OutputStream!");
            LOGGER.error("> " + ex.getLocalizedMessage(), ex);
            System.exit(1);
        }
    }

    /**
     * Write a {@link FilemakerResultDocument} into a {@link Writer}.
     *
     * @param doc    the document to write
     * @param output the writer, where the document is written to
     */
    @SuppressWarnings("Duplicates")
    protected static void write(FilemakerResultDocument doc, Writer output) {
        LOGGER.info("writing document");
        try {
            doc.toXml(output, PRETTY_PRINT);
            LOGGER.info("> written to a java.io.Writer");
        } catch (Exception ex) {
            LOGGER.error("Can't write document into an OutputStream!");
            LOGGER.error("> " + ex.getLocalizedMessage(), ex);
            System.exit(1);
        }
    }

    /**
     * Write a {@link FilemakerResultDocument} into a {@link String} and print the
     * results to the console.
     *
     * @param doc the document to write
     */
    @SuppressWarnings("Duplicates")
    protected static void writeToConsole(FilemakerResultDocument doc) {
        LOGGER.info("writing document");
        try {
            String xml = doc.toXmlString(PRETTY_PRINT);
            LOGGER.info(StringUtils.repeat("-", 50)
                    + System.lineSeparator() + xml);
        } catch (Exception ex) {
            LOGGER.error("Can't write document into a string!");
            LOGGER.error("> " + ex.getLocalizedMessage(), ex);
            System.exit(1);
        }
    }
}


/*
 * Copyright 2015-2018 OpenEstate.org.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.openestate.io.casa_it;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.nio.charset.Charset;
import javax.xml.bind.DatatypeConverter;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
import javax.xml.parsers.ParserConfigurationException;
import org.apache.commons.lang3.StringUtils;
import org.openestate.io.casa_it.xml.ObjectFactory;
import org.openestate.io.core.XmlUtils;
import org.openestate.io.core.XmlValidationHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;

/**
 * Some helper functions for the XML format of
 * casa.it.
 *
 * @author Andreas Rudolph
 * @since 1.0
 */
@SuppressWarnings("WeakerAccess")
public class CasaItUtils {
    @SuppressWarnings("unused")
    private final static Logger LOGGER = LoggerFactory.getLogger(CasaItUtils.class);
    private static JAXBContext JAXB = null;

    /*
     * the latest implemented version of this format
     *
     * public final static String VERSION = "1.0";
     */

    /**
     * the XML target namespace of this format
     */
    @SuppressWarnings("unused")
    public final static String NAMESPACE = StringUtils.EMPTY;

    /**
     * the package, where generated JAXB classes are located
     */
    @SuppressWarnings("unused")
    public final static String PACKAGE = "org.openestate.io.casa_it.xml";

    /**
     * the factory for creation of JAXB objects
     */
    @SuppressWarnings("unused")
    public final static ObjectFactory FACTORY = new ObjectFactory();

    private CasaItUtils() {
    }

    /**
     * Creates a {@link CasaItDocument} from an {@link InputStream}.
     *
     * @param input XML input
     * @return created document or null, of the document is not supported by this format
     * @throws SAXException                 if XML is invalid
     * @throws IOException                  if reading failed
     * @throws ParserConfigurationException if the parser is not properly configured
     */
    public static CasaItDocument createDocument(InputStream input) throws SAXException, IOException, ParserConfigurationException {
        return createDocument(XmlUtils.newDocument(input, true));
    }

    /**
     * Creates a {@link CasaItDocument} from a {@link File}.
     *
     * @param xmlFile XML file
     * @return created document or null, of the document is not supported by this format
     * @throws SAXException                 if XML is invalid
     * @throws IOException                  if reading failed
     * @throws ParserConfigurationException if the parser is not properly configured
     */
    public static CasaItDocument createDocument(File xmlFile) throws SAXException, IOException, ParserConfigurationException {
        return createDocument(XmlUtils.newDocument(xmlFile, true));
    }

    /**
     * Creates a {@link CasaItDocument} from a {@link String}.
     *
     * @param xmlString XML string
     * @return created document or null, of the document is not supported by this format
     * @throws SAXException                 if XML is invalid
     * @throws IOException                  if reading failed
     * @throws ParserConfigurationException if the parser is not properly configured
     */
    public static CasaItDocument createDocument(String xmlString) throws SAXException, IOException, ParserConfigurationException {
        return createDocument(XmlUtils.newDocument(xmlString, true));
    }

    /**
     * Creates a {@link CasaItDocument} from a {@link Document}.
     *
     * @param doc XML document
     * @return created document or null, of the document is not supported by this format
     */
    public static CasaItDocument createDocument(Document doc) {
        if (CasaItDocument.isReadable(doc))
            return new CasaItDocument(doc);
        else
            return null;
    }

    /**
     * Creates a {@link Marshaller} to write JAXB objects into XML.
     *
     * @return created marshaller
     * @throws JAXBException if a problem with JAXB occurred
     */
    @SuppressWarnings("unused")
    public static Marshaller createMarshaller() throws JAXBException {
        return createMarshaller(Charset.defaultCharset().name(), true);
    }

    /**
     * Creates a {@link Marshaller} to write JAXB objects into XML.
     *
     * @param encoding  encoding of written XML
     * @param formatted if written XML is pretty printed
     * @return created marshaller
     * @throws JAXBException if a problem with JAXB occurred
     */
    @SuppressWarnings("Duplicates")
    public static Marshaller createMarshaller(String encoding, boolean formatted) throws JAXBException {
        Marshaller m = getContext().createMarshaller();
        m.setProperty(Marshaller.JAXB_ENCODING, encoding);
        m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, formatted);
        m.setEventHandler(new XmlValidationHandler());
        return m;
    }

    /**
     * Creates a {@link Unmarshaller} to read JAXB objects from XML.
     *
     * @return created unmarshaller
     * @throws JAXBException if a problem with JAXB occurred
     */
    public static Unmarshaller createUnmarshaller() throws JAXBException {
        Unmarshaller m = getContext().createUnmarshaller();
        m.setEventHandler(new XmlValidationHandler());
        return m;
    }

    /**
     * Returns the {@link JAXBContext} for this format.
     *
     * @return context
     * @throws JAXBException if a problem with JAXB occurred
     */
    public synchronized static JAXBContext getContext() throws JAXBException {
        if (JAXB == null) initContext(Thread.currentThread().getContextClassLoader());
        return JAXB;
    }

    /**
     * Returns the {@link ObjectFactory} for this format.
     *
     * @return object factory
     */
    public synchronized static ObjectFactory getFactory() {
        return FACTORY;
    }

    /**
     * Initializes the {@link JAXBContext} for this format.
     *
     * @param classloader the classloader to load the generated JAXB classes with
     * @throws JAXBException if a problem with JAXB occurred
     */
    public synchronized static void initContext(ClassLoader classloader) throws JAXBException {
        JAXB = JAXBContext.newInstance(PACKAGE, classloader);
    }

    public static BigDecimal parseDouble(String value) {
        value = StringUtils.trimToNull(value);
        return (value != null) ? DatatypeConverter.parseDecimal(value) : null;
    }

    public static String printDouble(BigDecimal value) {
        if (value == null)
            throw new IllegalArgumentException("Can't print decimal value!");
        else
            return DatatypeConverter.printDecimal(value);
    }
}


/*
 * Copyright 2015-2018 OpenEstate.org.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.openestate.io.examples;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
import javax.xml.parsers.ParserConfigurationException;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.PropertyConfigurator;
import org.openestate.io.is24_xml.Is24XmlDocument;
import org.openestate.io.is24_xml.Is24XmlUtils;
import org.openestate.io.is24_xml.xml.ImmobilieBaseTyp;
import org.openestate.io.is24_xml.xml.ImmobilienTransferTyp;
import org.openestate.io.is24_xml.xml.VirtuelleImmobilieBaseTyp;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xml.sax.SAXException;

/**
 * Example for reading IS24-XML files.
 * <p>
 * This example illustrates how to read IS24-XML files.
 *
 * @author Andreas Rudolph
 * @since 1.0
 */
public class Is24XmlReadingExample {
    @SuppressWarnings("unused")
    private final static Logger LOGGER = LoggerFactory.getLogger(Is24XmlReadingExample.class);
    private final static String PACKAGE = "/org/openestate/io/examples";

    /**
     * Start the example application.
     *
     * @param args command line arguments
     */
    @SuppressWarnings("Duplicates")
    public static void main(String[] args) {
        // init logging
        PropertyConfigurator.configure(
                Is24XmlReadingExample.class.getResource(PACKAGE + "/log4j.properties"));

        // read example file, if no files were specified as command line arguments
        if (args.length < 1) {
            try {
                read(Is24XmlReadingExample.class.getResourceAsStream(PACKAGE + "/is24.xml"));
            } catch (Exception ex) {
                LOGGER.error("Can't read example file!");
                LOGGER.error("> " + ex.getLocalizedMessage(), ex);
                System.exit(2);
            }
        }

        // read files, that were specified as command line arguments
        else {
            for (String arg : args) {
                try {
                    read(new File(arg));
                } catch (Exception ex) {
                    LOGGER.error("Can't read file '" + arg + "'!");
                    LOGGER.error("> " + ex.getLocalizedMessage(), ex);
                    System.exit(2);
                }
            }
        }
    }

    /**
     * Read a {@link File} into an {@link Is24XmlDocument} and print some of its
     * content to console.
     *
     * @param xmlFile the file to read
     * @throws SAXException                 if the file is not readable by the XML parser
     * @throws IOException                  if the file is not readable
     * @throws ParserConfigurationException if the XML parser is improperly configured
     * @throws JAXBException                if XML conversion into Java objects failed
     */
    protected static void read(File xmlFile) throws SAXException, IOException, ParserConfigurationException, JAXBException {
        LOGGER.info("process file: " + xmlFile.getAbsolutePath());
        if (!xmlFile.isFile()) {
            LOGGER.warn("> provided file is invalid");
            return;
        }
        Is24XmlDocument doc = Is24XmlUtils.createDocument(xmlFile);
        if (doc == null) {
            LOGGER.warn("> provided XML is not supported");
        } else {
            printToConsole(doc);
        }
    }

    /**
     * Read an {@link InputStream} into an {@link Is24XmlDocument} and print some
     * of its content to console.
     *
     * @param xmlInputStream the input stream to read
     * @throws SAXException                 if the file is not readable by the XML parser
     * @throws IOException                  if the file is not readable
     * @throws ParserConfigurationException if the XML parser is improperly configured
     * @throws JAXBException                if XML conversion into Java objects failed
     */
    protected static void read(InputStream xmlInputStream) throws SAXException, IOException, ParserConfigurationException, JAXBException {
        LOGGER.info("process example file");
        Is24XmlDocument doc = Is24XmlUtils.createDocument(xmlInputStream);
        if (doc == null) {
            LOGGER.warn("> provided XML is not supported");
        } else {
            printToConsole(doc);
        }
    }

    /**
     * Print some content of an {@link Is24XmlDocument} to console.
     *
     * @param doc the document to process
     * @throws JAXBException if XML conversion into Java objects failed
     */
    protected static void printToConsole(Is24XmlDocument doc) throws JAXBException {
        ImmobilienTransferTyp transfer = doc.toObject();

        // process agency in the document
        if (transfer.getAnbieter() != null) {
            // process objects
            for (JAXBElement<? extends ImmobilieBaseTyp> i : transfer.getAnbieter().getImmobilie()) {
                ImmobilieBaseTyp obj = i.getValue();

                // get object nr
                String objectNr = (!StringUtils.isBlank(obj.getAnbieterObjektID())) ?
                        obj.getAnbieterObjektID().trim() : "???";

                // get object title
                String objectTitle = (!StringUtils.isBlank(obj.getUeberschrift())) ?
                        obj.getUeberschrift().trim() : "???";

                // print object information to console
                LOGGER.info("> found object '" + objectNr + "' "
                        + "with title '" + objectTitle + "'");
            }

            // process virtual objects
            for (JAXBElement<? extends VirtuelleImmobilieBaseTyp> i : transfer.getAnbieter().getVirtuelleImmobilie()) {
                VirtuelleImmobilieBaseTyp obj = i.getValue();

                // get object nr
                String objectNr = (!StringUtils.isBlank(obj.getAnbieterObjektID())) ?
                        obj.getAnbieterObjektID().trim() : "???";

                // get object title
                String objectTitle = (!StringUtils.isBlank(obj.getUeberschrift())) ?
                        obj.getUeberschrift().trim() : "???";

                // print object information to console
                LOGGER.info("> found virtual object '" + objectNr + "' "
                        + "with title '" + objectTitle + "'");
            }
        }
    }
}


package org.openestate.io.openimmo.xml;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Generated;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import org.jvnet.jaxb2_commons.lang.CopyStrategy2;
import org.jvnet.jaxb2_commons.lang.CopyTo2;
import org.jvnet.jaxb2_commons.lang.Equals2;
import org.jvnet.jaxb2_commons.lang.EqualsStrategy2;
import org.jvnet.jaxb2_commons.lang.JAXBCopyStrategy;
import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy;
import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy;
import org.jvnet.jaxb2_commons.lang.ToString2;
import org.jvnet.jaxb2_commons.lang.ToStringStrategy2;
import org.jvnet.jaxb2_commons.locator.ObjectLocator;
import org.jvnet.jaxb2_commons.locator.util.LocatorUtils;

/**
 * Java class for <interessent> element.
 *
 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
    "intId",
    "anrede",
    "vorname",
    "nachname",
    "firma",
    "strasse",
    "postfach",
    "plz",
    "ort",
    "tel",
    "fax",
    "mobil",
    "email",
    "bevorzugt",
    "wunsch",
    "anfrage",
    "userDefinedExtend"
})
@XmlRootElement(name = "interessent")
@Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
public class Interessent implements Serializable, Cloneable, CopyTo2, Equals2, ToString2
{

    @XmlElement(name = "int_id")
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    protected String intId;
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    protected String anrede;
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    protected String vorname;
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    protected String nachname;
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    protected String firma;
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    protected String strasse;
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    protected String postfach;
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    protected String plz;
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    protected String ort;
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    protected String tel;
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    protected String fax;
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    protected String mobil;
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    protected String email;
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    protected List<Interessent.Bevorzugt> bevorzugt;
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    protected List<Interessent.Wunsch> wunsch;
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    protected String anfrage;
    @XmlElement(name = "user_defined_extend")
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    protected List<UserDefinedExtend> userDefinedExtend;

    /**
     * Gets the value of the intId property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    public String getIntId() {
        return intId;
    }

    /**
     * Sets the value of the intId property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    public void setIntId(String value) {
        this.intId = value;
    }

    /**
     * Gets the value of the anrede property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    public String getAnrede() {
        return anrede;
    }

    /**
     * Sets the value of the anrede property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    public void setAnrede(String value) {
        this.anrede = value;
    }

    /**
     * Gets the value of the vorname property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    public String getVorname() {
        return vorname;
    }

    /**
     * Sets the value of the vorname property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    public void setVorname(String value) {
        this.vorname = value;
    }

    /**
     * Gets the value of the nachname property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    public String getNachname() {
        return nachname;
    }

    /**
     * Sets the value of the nachname property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    public void setNachname(String value) {
        this.nachname = value;
    }

    /**
     * Gets the value of the firma property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    public String getFirma() {
        return firma;
    }

    /**
     * Sets the value of the firma property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    public void setFirma(String value) {
        this.firma = value;
    }

    /**
     * Gets the value of the strasse property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    public String getStrasse() {
        return strasse;
    }

    /**
     * Sets the value of the strasse property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    public void setStrasse(String value) {
        this.strasse = value;
    }

    /**
     * Gets the value of the postfach property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    public String getPostfach() {
        return postfach;
    }

    /**
     * Sets the value of the postfach property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    public void setPostfach(String value) {
        this.postfach = value;
    }

    /**
     * Gets the value of the plz property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    public String getPlz() {
        return plz;
    }

    /**
     * Sets the value of the plz property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    public void setPlz(String value) {
        this.plz = value;
    }

    /**
     * Gets the value of the ort property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    public String getOrt() {
        return ort;
    }

    /**
     * Sets the value of the ort property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    public void setOrt(String value) {
        this.ort = value;
    }

    /**
     * Gets the value of the tel property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    public String getTel() {
        return tel;
    }

    /**
     * Sets the value of the tel property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    public void setTel(String value) {
        this.tel = value;
    }

    /**
     * Gets the value of the fax property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    public String getFax() {
        return fax;
    }

    /**
     * Sets the value of the fax property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    public void setFax(String value) {
        this.fax = value;
    }

    /**
     * Gets the value of the mobil property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    public String getMobil() {
        return mobil;
    }

    /**
     * Sets the value of the mobil property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    public void setMobil(String value) {
        this.mobil = value;
    }

    /**
     * Gets the value of the email property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    public String getEmail() {
        return email;
    }

    /**
     * Sets the value of the email property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    public void setEmail(String value) {
        this.email = value;
    }

    /**
     * Gets the value of the bevorzugt property.
     *
     *

     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a set method for the bevorzugt property.
     *
     *

     * For example, to add a new item, do as follows:
     *

     *    getBevorzugt().add(newItem);
     *

     *
     *
     *

     * Objects of the following type(s) are allowed in the list
     * {@link Interessent.Bevorzugt }
     *
     *
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    public List<Interessent.Bevorzugt> getBevorzugt() {
        if (bevorzugt == null) {
            bevorzugt = new ArrayList<Interessent.Bevorzugt>();
        }
        return this.bevorzugt;
    }

    /**
     * Gets the value of the wunsch property.
     *
     *

     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a set method for the wunsch property.
     *
     *

     * For example, to add a new item, do as follows:
     *

     *    getWunsch().add(newItem);
     *

     *
     *
     *

     * Objects of the following type(s) are allowed in the list
     * {@link Interessent.Wunsch }
     *
     *
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    public List<Interessent.Wunsch> getWunsch() {
        if (wunsch == null) {
            wunsch = new ArrayList<Interessent.Wunsch>();
        }
        return this.wunsch;
    }

    /**
     * Gets the value of the anfrage property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    public String getAnfrage() {
        return anfrage;
    }

    /**
     * Sets the value of the anfrage property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    public void setAnfrage(String value) {
        this.anfrage = value;
    }

    /**
     * Gets the value of the userDefinedExtend property.
     *
     *

     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a set method for the userDefinedExtend property.
     *
     *

     * For example, to add a new item, do as follows:
     *

     *    getUserDefinedExtend().add(newItem);
     *

     *
     *
     *

     * Objects of the following type(s) are allowed in the list
     * {@link UserDefinedExtend }
     *
     *
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    public List<UserDefinedExtend> getUserDefinedExtend() {
        if (userDefinedExtend == null) {
            userDefinedExtend = new ArrayList<UserDefinedExtend>();
        }
        return this.userDefinedExtend;
    }

    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    public String toString() {
        final ToStringStrategy2 strategy = JAXBToStringStrategy.INSTANCE;
        final StringBuilder buffer = new StringBuilder();
        append(null, buffer, strategy);
        return buffer.toString();
    }

    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    public StringBuilder append(ObjectLocator locator, StringBuilder buffer, ToStringStrategy2 strategy) {
        strategy.appendStart(locator, this, buffer);
        appendFields(locator, buffer, strategy);
        strategy.appendEnd(locator, this, buffer);
        return buffer;
    }

    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy2 strategy) {
        {
            String theIntId;
            theIntId = this.getIntId();
            strategy.appendField(locator, this, "intId", buffer, theIntId, (this.intId!= null));
        }
        {
            String theAnrede;
            theAnrede = this.getAnrede();
            strategy.appendField(locator, this, "anrede", buffer, theAnrede, (this.anrede!= null));
        }
        {
            String theVorname;
            theVorname = this.getVorname();
            strategy.appendField(locator, this, "vorname", buffer, theVorname, (this.vorname!= null));
        }
        {
            String theNachname;
            theNachname = this.getNachname();
            strategy.appendField(locator, this, "nachname", buffer, theNachname, (this.nachname!= null));
        }
        {
            String theFirma;
            theFirma = this.getFirma();
            strategy.appendField(locator, this, "firma", buffer, theFirma, (this.firma!= null));
        }
        {
            String theStrasse;
            theStrasse = this.getStrasse();
            strategy.appendField(locator, this, "strasse", buffer, theStrasse, (this.strasse!= null));
        }
        {
            String thePostfach;
            thePostfach = this.getPostfach();
            strategy.appendField(locator, this, "postfach", buffer, thePostfach, (this.postfach!= null));
        }
        {
            String thePlz;
            thePlz = this.getPlz();
            strategy.appendField(locator, this, "plz", buffer, thePlz, (this.plz!= null));
        }
        {
            String theOrt;
            theOrt = this.getOrt();
            strategy.appendField(locator, this, "ort", buffer, theOrt, (this.ort!= null));
        }
        {
            String theTel;
            theTel = this.getTel();
            strategy.appendField(locator, this, "tel", buffer, theTel, (this.tel!= null));
        }
        {
            String theFax;
            theFax = this.getFax();
            strategy.appendField(locator, this, "fax", buffer, theFax, (this.fax!= null));
        }
        {
            String theMobil;
            theMobil = this.getMobil();
            strategy.appendField(locator, this, "mobil", buffer, theMobil, (this.mobil!= null));
        }
        {
            String theEmail;
            theEmail = this.getEmail();
            strategy.appendField(locator, this, "email", buffer, theEmail, (this.email!= null));
        }
        {
            List<Interessent.Bevorzugt> theBevorzugt;
            theBevorzugt = (((this.bevorzugt!= null)&&(!this.bevorzugt.isEmpty()))?this.getBevorzugt():null);
            strategy.appendField(locator, this, "bevorzugt", buffer, theBevorzugt, ((this.bevorzugt!= null)&&(!this.bevorzugt.isEmpty())));
        }
        {
            List<Interessent.Wunsch> theWunsch;
            theWunsch = (((this.wunsch!= null)&&(!this.wunsch.isEmpty()))?this.getWunsch():null);
            strategy.appendField(locator, this, "wunsch", buffer, theWunsch, ((this.wunsch!= null)&&(!this.wunsch.isEmpty())));
        }
        {
            String theAnfrage;
            theAnfrage = this.getAnfrage();
            strategy.appendField(locator, this, "anfrage", buffer, theAnfrage, (this.anfrage!= null));
        }
        {
            List<UserDefinedExtend> theUserDefinedExtend;
            theUserDefinedExtend = (((this.userDefinedExtend!= null)&&(!this.userDefinedExtend.isEmpty()))?this.getUserDefinedExtend():null);
            strategy.appendField(locator, this, "userDefinedExtend", buffer, theUserDefinedExtend, ((this.userDefinedExtend!= null)&&(!this.userDefinedExtend.isEmpty())));
        }
        return buffer;
    }

    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    public Object clone() {
        return copyTo(createNewInstance());
    }

    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    public Object copyTo(Object target) {
        final CopyStrategy2 strategy = JAXBCopyStrategy.INSTANCE;
        return copyTo(null, target, strategy);
    }

    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    public Object copyTo(ObjectLocator locator, Object target, CopyStrategy2 strategy) {
        final Object draftCopy = ((target == null)?createNewInstance():target);
        if (draftCopy instanceof Interessent) {
            final Interessent copy = ((Interessent) draftCopy);
            {
                Boolean intIdShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, (this.intId!= null));
                if (intIdShouldBeCopiedAndSet == Boolean.TRUE) {
                    String sourceIntId;
                    sourceIntId = this.getIntId();
                    String copyIntId = ((String) strategy.copy(LocatorUtils.property(locator, "intId", sourceIntId), sourceIntId, (this.intId!= null)));
                    copy.setIntId(copyIntId);
                } else {
                    if (intIdShouldBeCopiedAndSet == Boolean.FALSE) {
                        copy.intId = null;
                    }
                }
            }
            {
                Boolean anredeShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, (this.anrede!= null));
                if (anredeShouldBeCopiedAndSet == Boolean.TRUE) {
                    String sourceAnrede;
                    sourceAnrede = this.getAnrede();
                    String copyAnrede = ((String) strategy.copy(LocatorUtils.property(locator, "anrede", sourceAnrede), sourceAnrede, (this.anrede!= null)));
                    copy.setAnrede(copyAnrede);
                } else {
                    if (anredeShouldBeCopiedAndSet == Boolean.FALSE) {
                        copy.anrede = null;
                    }
                }
            }
            {
                Boolean vornameShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, (this.vorname!= null));
                if (vornameShouldBeCopiedAndSet == Boolean.TRUE) {
                    String sourceVorname;
                    sourceVorname = this.getVorname();
                    String copyVorname = ((String) strategy.copy(LocatorUtils.property(locator, "vorname", sourceVorname), sourceVorname, (this.vorname!= null)));
                    copy.setVorname(copyVorname);
                } else {
                    if (vornameShouldBeCopiedAndSet == Boolean.FALSE) {
                        copy.vorname = null;
                    }
                }
            }
            {
                Boolean nachnameShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, (this.nachname!= null));
                if (nachnameShouldBeCopiedAndSet == Boolean.TRUE) {
                    String sourceNachname;
                    sourceNachname = this.getNachname();
                    String copyNachname = ((String) strategy.copy(LocatorUtils.property(locator, "nachname", sourceNachname), sourceNachname, (this.nachname!= null)));
                    copy.setNachname(copyNachname);
                } else {
                    if (nachnameShouldBeCopiedAndSet == Boolean.FALSE) {
                        copy.nachname = null;
                    }
                }
            }
            {
                Boolean firmaShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, (this.firma!= null));
                if (firmaShouldBeCopiedAndSet == Boolean.TRUE) {
                    String sourceFirma;
                    sourceFirma = this.getFirma();
                    String copyFirma = ((String) strategy.copy(LocatorUtils.property(locator, "firma", sourceFirma), sourceFirma, (this.firma!= null)));
                    copy.setFirma(copyFirma);
                } else {
                    if (firmaShouldBeCopiedAndSet == Boolean.FALSE) {
                        copy.firma = null;
                    }
                }
            }
            {
                Boolean strasseShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, (this.strasse!= null));
                if (strasseShouldBeCopiedAndSet == Boolean.TRUE) {
                    String sourceStrasse;
                    sourceStrasse = this.getStrasse();
                    String copyStrasse = ((String) strategy.copy(LocatorUtils.property(locator, "strasse", sourceStrasse), sourceStrasse, (this.strasse!= null)));
                    copy.setStrasse(copyStrasse);
                } else {
                    if (strasseShouldBeCopiedAndSet == Boolean.FALSE) {
                        copy.strasse = null;
                    }
                }
            }
            {
                Boolean postfachShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, (this.postfach!= null));
                if (postfachShouldBeCopiedAndSet == Boolean.TRUE) {
                    String sourcePostfach;
                    sourcePostfach = this.getPostfach();
                    String copyPostfach = ((String) strategy.copy(LocatorUtils.property(locator, "postfach", sourcePostfach), sourcePostfach, (this.postfach!= null)));
                    copy.setPostfach(copyPostfach);
                } else {
                    if (postfachShouldBeCopiedAndSet == Boolean.FALSE) {
                        copy.postfach = null;
                    }
                }
            }
            {
                Boolean plzShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, (this.plz!= null));
                if (plzShouldBeCopiedAndSet == Boolean.TRUE) {
                    String sourcePlz;
                    sourcePlz = this.getPlz();
                    String copyPlz = ((String) strategy.copy(LocatorUtils.property(locator, "plz", sourcePlz), sourcePlz, (this.plz!= null)));
                    copy.setPlz(copyPlz);
                } else {
                    if (plzShouldBeCopiedAndSet == Boolean.FALSE) {
                        copy.plz = null;
                    }
                }
            }
            {
                Boolean ortShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, (this.ort!= null));
                if (ortShouldBeCopiedAndSet == Boolean.TRUE) {
                    String sourceOrt;
                    sourceOrt = this.getOrt();
                    String copyOrt = ((String) strategy.copy(LocatorUtils.property(locator, "ort", sourceOrt), sourceOrt, (this.ort!= null)));
                    copy.setOrt(copyOrt);
                } else {
                    if (ortShouldBeCopiedAndSet == Boolean.FALSE) {
                        copy.ort = null;
                    }
                }
            }
            {
                Boolean telShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, (this.tel!= null));
                if (telShouldBeCopiedAndSet == Boolean.TRUE) {
                    String sourceTel;
                    sourceTel = this.getTel();
                    String copyTel = ((String) strategy.copy(LocatorUtils.property(locator, "tel", sourceTel), sourceTel, (this.tel!= null)));
                    copy.setTel(copyTel);
                } else {
                    if (telShouldBeCopiedAndSet == Boolean.FALSE) {
                        copy.tel = null;
                    }
                }
            }
            {
                Boolean faxShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, (this.fax!= null));
                if (faxShouldBeCopiedAndSet == Boolean.TRUE) {
                    String sourceFax;
                    sourceFax = this.getFax();
                    String copyFax = ((String) strategy.copy(LocatorUtils.property(locator, "fax", sourceFax), sourceFax, (this.fax!= null)));
                    copy.setFax(copyFax);
                } else {
                    if (faxShouldBeCopiedAndSet == Boolean.FALSE) {
                        copy.fax = null;
                    }
                }
            }
            {
                Boolean mobilShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, (this.mobil!= null));
                if (mobilShouldBeCopiedAndSet == Boolean.TRUE) {
                    String sourceMobil;
                    sourceMobil = this.getMobil();
                    String copyMobil = ((String) strategy.copy(LocatorUtils.property(locator, "mobil", sourceMobil), sourceMobil, (this.mobil!= null)));
                    copy.setMobil(copyMobil);
                } else {
                    if (mobilShouldBeCopiedAndSet == Boolean.FALSE) {
                        copy.mobil = null;
                    }
                }
            }
            {
                Boolean emailShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, (this.email!= null));
                if (emailShouldBeCopiedAndSet == Boolean.TRUE) {
                    String sourceEmail;
                    sourceEmail = this.getEmail();
                    String copyEmail = ((String) strategy.copy(LocatorUtils.property(locator, "email", sourceEmail), sourceEmail, (this.email!= null)));
                    copy.setEmail(copyEmail);
                } else {
                    if (emailShouldBeCopiedAndSet == Boolean.FALSE) {
                        copy.email = null;
                    }
                }
            }
            {
                Boolean bevorzugtShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, ((this.bevorzugt!= null)&&(!this.bevorzugt.isEmpty())));
                if (bevorzugtShouldBeCopiedAndSet == Boolean.TRUE) {
                    List<Interessent.Bevorzugt> sourceBevorzugt;
                    sourceBevorzugt = (((this.bevorzugt!= null)&&(!this.bevorzugt.isEmpty()))?this.getBevorzugt():null);
                    @SuppressWarnings("unchecked")
                    List<Interessent.Bevorzugt> copyBevorzugt = ((List<Interessent.Bevorzugt> ) strategy.copy(LocatorUtils.property(locator, "bevorzugt", sourceBevorzugt), sourceBevorzugt, ((this.bevorzugt!= null)&&(!this.bevorzugt.isEmpty()))));
                    copy.bevorzugt = null;
                    if (copyBevorzugt!= null) {
                        List<Interessent.Bevorzugt> uniqueBevorzugtl = copy.getBevorzugt();
                        uniqueBevorzugtl.addAll(copyBevorzugt);
                    }
                } else {
                    if (bevorzugtShouldBeCopiedAndSet == Boolean.FALSE) {
                        copy.bevorzugt = null;
                    }
                }
            }
            {
                Boolean wunschShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, ((this.wunsch!= null)&&(!this.wunsch.isEmpty())));
                if (wunschShouldBeCopiedAndSet == Boolean.TRUE) {
                    List<Interessent.Wunsch> sourceWunsch;
                    sourceWunsch = (((this.wunsch!= null)&&(!this.wunsch.isEmpty()))?this.getWunsch():null);
                    @SuppressWarnings("unchecked")
                    List<Interessent.Wunsch> copyWunsch = ((List<Interessent.Wunsch> ) strategy.copy(LocatorUtils.property(locator, "wunsch", sourceWunsch), sourceWunsch, ((this.wunsch!= null)&&(!this.wunsch.isEmpty()))));
                    copy.wunsch = null;
                    if (copyWunsch!= null) {
                        List<Interessent.Wunsch> uniqueWunschl = copy.getWunsch();
                        uniqueWunschl.addAll(copyWunsch);
                    }
                } else {
                    if (wunschShouldBeCopiedAndSet == Boolean.FALSE) {
                        copy.wunsch = null;
                    }
                }
            }
            {
                Boolean anfrageShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, (this.anfrage!= null));
                if (anfrageShouldBeCopiedAndSet == Boolean.TRUE) {
                    String sourceAnfrage;
                    sourceAnfrage = this.getAnfrage();
                    String copyAnfrage = ((String) strategy.copy(LocatorUtils.property(locator, "anfrage", sourceAnfrage), sourceAnfrage, (this.anfrage!= null)));
                    copy.setAnfrage(copyAnfrage);
                } else {
                    if (anfrageShouldBeCopiedAndSet == Boolean.FALSE) {
                        copy.anfrage = null;
                    }
                }
            }
            {
                Boolean userDefinedExtendShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, ((this.userDefinedExtend!= null)&&(!this.userDefinedExtend.isEmpty())));
                if (userDefinedExtendShouldBeCopiedAndSet == Boolean.TRUE) {
                    List<UserDefinedExtend> sourceUserDefinedExtend;
                    sourceUserDefinedExtend = (((this.userDefinedExtend!= null)&&(!this.userDefinedExtend.isEmpty()))?this.getUserDefinedExtend():null);
                    @SuppressWarnings("unchecked")
                    List<UserDefinedExtend> copyUserDefinedExtend = ((List<UserDefinedExtend> ) strategy.copy(LocatorUtils.property(locator, "userDefinedExtend", sourceUserDefinedExtend), sourceUserDefinedExtend, ((this.userDefinedExtend!= null)&&(!this.userDefinedExtend.isEmpty()))));
                    copy.userDefinedExtend = null;
                    if (copyUserDefinedExtend!= null) {
                        List<UserDefinedExtend> uniqueUserDefinedExtendl = copy.getUserDefinedExtend();
                        uniqueUserDefinedExtendl.addAll(copyUserDefinedExtend);
                    }
                } else {
                    if (userDefinedExtendShouldBeCopiedAndSet == Boolean.FALSE) {
                        copy.userDefinedExtend = null;
                    }
                }
            }
        }
        return draftCopy;
    }

    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    public Object createNewInstance() {
        return new Interessent();
    }

    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, Object object, EqualsStrategy2 strategy) {
        if ((object == null)||(this.getClass()!= object.getClass())) {
            return false;
        }
        if (this == object) {
            return true;
        }
        final Interessent that = ((Interessent) object);
        {
            String lhsIntId;
            lhsIntId = this.getIntId();
            String rhsIntId;
            rhsIntId = that.getIntId();
            if (!strategy.equals(LocatorUtils.property(thisLocator, "intId", lhsIntId), LocatorUtils.property(thatLocator, "intId", rhsIntId), lhsIntId, rhsIntId, (this.intId!= null), (that.intId!= null))) {
                return false;
            }
        }
        {
            String lhsAnrede;
            lhsAnrede = this.getAnrede();
            String rhsAnrede;
            rhsAnrede = that.getAnrede();
            if (!strategy.equals(LocatorUtils.property(thisLocator, "anrede", lhsAnrede), LocatorUtils.property(thatLocator, "anrede", rhsAnrede), lhsAnrede, rhsAnrede, (this.anrede!= null), (that.anrede!= null))) {
                return false;
            }
        }
        {
            String lhsVorname;
            lhsVorname = this.getVorname();
            String rhsVorname;
            rhsVorname = that.getVorname();
            if (!strategy.equals(LocatorUtils.property(thisLocator, "vorname", lhsVorname), LocatorUtils.property(thatLocator, "vorname", rhsVorname), lhsVorname, rhsVorname, (this.vorname!= null), (that.vorname!= null))) {
                return false;
            }
        }
        {
            String lhsNachname;
            lhsNachname = this.getNachname();
            String rhsNachname;
            rhsNachname = that.getNachname();
            if (!strategy.equals(LocatorUtils.property(thisLocator, "nachname", lhsNachname), LocatorUtils.property(thatLocator, "nachname", rhsNachname), lhsNachname, rhsNachname, (this.nachname!= null), (that.nachname!= null))) {
                return false;
            }
        }
        {
            String lhsFirma;
            lhsFirma = this.getFirma();
            String rhsFirma;
            rhsFirma = that.getFirma();
            if (!strategy.equals(LocatorUtils.property(thisLocator, "firma", lhsFirma), LocatorUtils.property(thatLocator, "firma", rhsFirma), lhsFirma, rhsFirma, (this.firma!= null), (that.firma!= null))) {
                return false;
            }
        }
        {
            String lhsStrasse;
            lhsStrasse = this.getStrasse();
            String rhsStrasse;
            rhsStrasse = that.getStrasse();
            if (!strategy.equals(LocatorUtils.property(thisLocator, "strasse", lhsStrasse), LocatorUtils.property(thatLocator, "strasse", rhsStrasse), lhsStrasse, rhsStrasse, (this.strasse!= null), (that.strasse!= null))) {
                return false;
            }
        }
        {
            String lhsPostfach;
            lhsPostfach = this.getPostfach();
            String rhsPostfach;
            rhsPostfach = that.getPostfach();
            if (!strategy.equals(LocatorUtils.property(thisLocator, "postfach", lhsPostfach), LocatorUtils.property(thatLocator, "postfach", rhsPostfach), lhsPostfach, rhsPostfach, (this.postfach!= null), (that.postfach!= null))) {
                return false;
            }
        }
        {
            String lhsPlz;
            lhsPlz = this.getPlz();
            String rhsPlz;
            rhsPlz = that.getPlz();
            if (!strategy.equals(LocatorUtils.property(thisLocator, "plz", lhsPlz), LocatorUtils.property(thatLocator, "plz", rhsPlz), lhsPlz, rhsPlz, (this.plz!= null), (that.plz!= null))) {
                return false;
            }
        }
        {
            String lhsOrt;
            lhsOrt = this.getOrt();
            String rhsOrt;
            rhsOrt = that.getOrt();
            if (!strategy.equals(LocatorUtils.property(thisLocator, "ort", lhsOrt), LocatorUtils.property(thatLocator, "ort", rhsOrt), lhsOrt, rhsOrt, (this.ort!= null), (that.ort!= null))) {
                return false;
            }
        }
        {
            String lhsTel;
            lhsTel = this.getTel();
            String rhsTel;
            rhsTel = that.getTel();
            if (!strategy.equals(LocatorUtils.property(thisLocator, "tel", lhsTel), LocatorUtils.property(thatLocator, "tel", rhsTel), lhsTel, rhsTel, (this.tel!= null), (that.tel!= null))) {
                return false;
            }
        }
        {
            String lhsFax;
            lhsFax = this.getFax();
            String rhsFax;
            rhsFax = that.getFax();
            if (!strategy.equals(LocatorUtils.property(thisLocator, "fax", lhsFax), LocatorUtils.property(thatLocator, "fax", rhsFax), lhsFax, rhsFax, (this.fax!= null), (that.fax!= null))) {
                return false;
            }
        }
        {
            String lhsMobil;
            lhsMobil = this.getMobil();
            String rhsMobil;
            rhsMobil = that.getMobil();
            if (!strategy.equals(LocatorUtils.property(thisLocator, "mobil", lhsMobil), LocatorUtils.property(thatLocator, "mobil", rhsMobil), lhsMobil, rhsMobil, (this.mobil!= null), (that.mobil!= null))) {
                return false;
            }
        }
        {
            String lhsEmail;
            lhsEmail = this.getEmail();
            String rhsEmail;
            rhsEmail = that.getEmail();
            if (!strategy.equals(LocatorUtils.property(thisLocator, "email", lhsEmail), LocatorUtils.property(thatLocator, "email", rhsEmail), lhsEmail, rhsEmail, (this.email!= null), (that.email!= null))) {
                return false;
            }
        }
        {
            List<Interessent.Bevorzugt> lhsBevorzugt;
            lhsBevorzugt = (((this.bevorzugt!= null)&&(!this.bevorzugt.isEmpty()))?this.getBevorzugt():null);
            List<Interessent.Bevorzugt> rhsBevorzugt;
            rhsBevorzugt = (((that.bevorzugt!= null)&&(!that.bevorzugt.isEmpty()))?that.getBevorzugt():null);
            if (!strategy.equals(LocatorUtils.property(thisLocator, "bevorzugt", lhsBevorzugt), LocatorUtils.property(thatLocator, "bevorzugt", rhsBevorzugt), lhsBevorzugt, rhsBevorzugt, ((this.bevorzugt!= null)&&(!this.bevorzugt.isEmpty())), ((that.bevorzugt!= null)&&(!that.bevorzugt.isEmpty())))) {
                return false;
            }
        }
        {
            List<Interessent.Wunsch> lhsWunsch;
            lhsWunsch = (((this.wunsch!= null)&&(!this.wunsch.isEmpty()))?this.getWunsch():null);
            List<Interessent.Wunsch> rhsWunsch;
            rhsWunsch = (((that.wunsch!= null)&&(!that.wunsch.isEmpty()))?that.getWunsch():null);
            if (!strategy.equals(LocatorUtils.property(thisLocator, "wunsch", lhsWunsch), LocatorUtils.property(thatLocator, "wunsch", rhsWunsch), lhsWunsch, rhsWunsch, ((this.wunsch!= null)&&(!this.wunsch.isEmpty())), ((that.wunsch!= null)&&(!that.wunsch.isEmpty())))) {
                return false;
            }
        }
        {
            String lhsAnfrage;
            lhsAnfrage = this.getAnfrage();
            String rhsAnfrage;
            rhsAnfrage = that.getAnfrage();
            if (!strategy.equals(LocatorUtils.property(thisLocator, "anfrage", lhsAnfrage), LocatorUtils.property(thatLocator, "anfrage", rhsAnfrage), lhsAnfrage, rhsAnfrage, (this.anfrage!= null), (that.anfrage!= null))) {
                return false;
            }
        }
        {
            List<UserDefinedExtend> lhsUserDefinedExtend;
            lhsUserDefinedExtend = (((this.userDefinedExtend!= null)&&(!this.userDefinedExtend.isEmpty()))?this.getUserDefinedExtend():null);
            List<UserDefinedExtend> rhsUserDefinedExtend;
            rhsUserDefinedExtend = (((that.userDefinedExtend!= null)&&(!that.userDefinedExtend.isEmpty()))?that.getUserDefinedExtend():null);
            if (!strategy.equals(LocatorUtils.property(thisLocator, "userDefinedExtend", lhsUserDefinedExtend), LocatorUtils.property(thatLocator, "userDefinedExtend", rhsUserDefinedExtend), lhsUserDefinedExtend, rhsUserDefinedExtend, ((this.userDefinedExtend!= null)&&(!this.userDefinedExtend.isEmpty())), ((that.userDefinedExtend!= null)&&(!that.userDefinedExtend.isEmpty())))) {
                return false;
            }
        }
        return true;
    }

    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    public boolean equals(Object object) {
        final EqualsStrategy2 strategy = JAXBEqualsStrategy.INSTANCE;
        return equals(null, null, object, strategy);
    }

    /**
     *
     *                     Java enum for <bevorzugt> in <interessent> elements.
     *
     *
Java class for null.
     *
     *
The following schema fragment specifies the expected content contained within this class.
     *

     *

     * <simpleType>
     *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
     *     <enumeration value="EMAIL"/>
     *     <enumeration value="TEL"/>
     *     <enumeration value="MOBIL"/>
     *     <enumeration value="FAX"/>
     *     <enumeration value="BRIEF"/>
     *   </restriction>
     * </simpleType>
     *

     *
     */
    @XmlType(name = "")
    @XmlEnum
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    public enum Bevorzugt {

        EMAIL,
        TEL,
        MOBIL,
        FAX,
        BRIEF;

        public String value() {
            return name();
        }

        public static Interessent.Bevorzugt fromValue(String v) {
            return valueOf(v);
        }

    }

    /**
     * Java enum for <wunsch> in <interessent> elements.

     */
    @XmlType(name = "")
    @XmlEnum
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    public enum Wunsch {

        BESICHTIGUNG,
        ANRUF,
        DETAIL;

        public String value() {
            return name();
        }

        public static Interessent.Wunsch fromValue(String v) {
            return valueOf(v);
        }

    }

}