/*
 * 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.kyero;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.charset.Charset;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
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.core.XmlUtils;
import org.openestate.io.core.XmlValidationHandler;
import org.openestate.io.kyero.xml.ObjectFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;

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

    /**
     * the latest implemented version of this format
     */
    @SuppressWarnings("unused")
    public final static KyeroVersion VERSION = KyeroVersion.V3;

    /**
     * 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.kyero.xml";

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

    private KyeroUtils() {
    }

    /**
     * Creates a {@link KyeroDocument} 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 KyeroDocument createDocument(InputStream input) throws SAXException, IOException, ParserConfigurationException {
        return createDocument(XmlUtils.newDocument(input, true));
    }

    /**
     * Creates a {@link KyeroDocument} 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 KyeroDocument createDocument(File xmlFile) throws SAXException, IOException, ParserConfigurationException {
        return createDocument(XmlUtils.newDocument(xmlFile, true));
    }

    /**
     * Creates a {@link KyeroDocument} 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 KyeroDocument createDocument(String xmlString) throws SAXException, IOException, ParserConfigurationException {
        return createDocument(XmlUtils.newDocument(xmlString, true));
    }

    /**
     * Creates a {@link KyeroDocument} from a {@link Document}.
     *
     * @param doc XML document
     * @return created document or null, of the document is not supported by this format
     */
    public static KyeroDocument createDocument(Document doc) {
        if (KyeroDocument.isReadable(doc))
            return new KyeroDocument(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 preferred date format for this format.
     *
     * @return date format
     */
    public static DateFormat getDateFormat() {
        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    }

    /**
     * Returns the alternative date format for this format.
     *
     * @return date format
     */
    public static DateFormat getDateFormatAlternative() {
        return new SimpleDateFormat("yyyy-MM-dd");
    }

    /**
     * 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 boolean isValidFeedVersionType(String value) {
        return value != null && value.length() > 0 && value.length() <= 3;
    }

    public static boolean isValidIdType(String value) {
        return value != null && value.length() > 0;
    }

    public static boolean isValidImageAttributeType(Integer value) {
        return value != null && value >= 0 && value <= 100;
    }

    public static boolean isValidImageUrlType(URI value) {
        if (value == null || StringUtils.isBlank(value.getHost()))
            return false;

        String scheme = StringUtils.trimToEmpty(value.getScheme()).toLowerCase();
        if (!"http".equals(scheme) && !"https".equals(scheme) && !"ftp".equals(scheme))
            return false;

        String path = StringUtils.trimToEmpty(value.getPath()).toLowerCase();
        return path.endsWith(".gif") || path.endsWith(".jpg") || path.endsWith(".jpeg") || path.endsWith(".png");
    }

    public static boolean isValidRefType(String value) {
        return value != null && value.length() > 0;
    }

    public static boolean isValidRequiredType(String value) {
        return value != null && value.length() > 0;
    }

    public static boolean isValidTypeDataType(String value) {
        return value != null && value.matches("([a-zA-Z&\\s\\(\\)/\\-]+)");
    }

    public static boolean isValidUrlDataType(URI value) {
        if (value == null || StringUtils.isBlank(value.getHost()))
            return false;

        String scheme = StringUtils.trimToEmpty(value.getScheme()).toLowerCase();
        return "http".equals(scheme) || "https".equals(scheme);
    }

    public static Boolean parseBoolType(String value) {
        value = StringUtils.trimToNull(value);
        return (value != null) ? DatatypeConverter.parseBoolean(value) : null;
    }

    public static String parseCountryType(String value) {
        return StringUtils.trimToNull(value);
    }

    public static Calendar parseDateType(String value) {
        value = StringUtils.trimToNull(value);
        if (value == null) return null;
        try {
            Calendar cal = Calendar.getInstance();
            cal.setTime(getDateFormat().parse(value));
            return cal;
        } catch (ParseException ex) {
            //LOGGER.warn( "Can't parse value '" + value + "' against primary date format!" );
            //LOGGER.warn( "> " + ex.getLocalizedMessage(), ex );
        }
        try {
            Calendar cal = Calendar.getInstance();
            cal.setTime(getDateFormatAlternative().parse(value));
            return cal;
        } catch (ParseException ex) {
            //LOGGER.warn( "Can't parse value '" + value + "' against secondary date format!" );
            //LOGGER.warn( "> " + ex.getLocalizedMessage(), ex );
        }
        try {
            return XmlUtils.parseDateTime(value);
        } catch (Exception ex) {
            //LOGGER.warn( "Can't parse value '" + value + "' as xsd:dateTime!" );
            //LOGGER.warn( "> " + ex.getLocalizedMessage(), ex );
        }
        throw new IllegalArgumentException("Can't parse date-type value '" + value + "'!");
    }

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

    public static String parseFeedVersionType(String value) {
        return StringUtils.trimToNull(value);
    }

    public static String parseIdType(String value) {
        return StringUtils.trimToNull(value);
    }

    public static Integer parseImageAttributeType(String value) {
        value = StringUtils.trimToNull(value);
        return (value != null) ? DatatypeConverter.parseInt(value) : null;
    }

    public static URI parseImageUrlType(String value) {
        value = StringUtils.trimToNull(value);
        if (value == null) return null;
        try {
            if (StringUtils.startsWithIgnoreCase(value, "http://"))
                return new URI(value);
            else if (StringUtils.startsWithIgnoreCase(value, "https://"))
                return new URI(value);
            else if (StringUtils.startsWithIgnoreCase(value, "ftp://"))
                return new URI(value);
            else
                return new URI("http://" + value);
        } catch (URISyntaxException ex) {
            throw new IllegalArgumentException("Can't parse URI value '" + value + "'!", ex);
        }
    }

    public static BigInteger parseInteger(String value) {
        value = StringUtils.trimToNull(value);
        return (value != null) ? DatatypeConverter.parseInteger(value) : null;
    }

    public static String parseLocationType(String value) {
        return StringUtils.trimToNull(value);
    }

    public static BigInteger parseNonNegativeInteger(String value) {
        value = StringUtils.trimToNull(value);
        return (value != null) ? DatatypeConverter.parseInteger(value) : null;
    }

    public static Long parsePriceType(String value) {
        value = StringUtils.trimToNull(value);
        return (value != null && !"x".equalsIgnoreCase(value)) ?
                DatatypeConverter.parseLong(value) : null;
    }

    public static String parseRefType(String value) {
        return StringUtils.trimToNull(value);
    }

    public static String parseRequiredType(String value) {
        return StringUtils.trimToNull(value);
    }

    public static String parseTypeDataType(String value) {
        return StringUtils.trimToNull(value);
    }

    public static URI parseUrlDataType(String value) {
        value = StringUtils.trimToNull(value);
        if (value == null) return null;
        try {
            if (StringUtils.startsWithIgnoreCase(value, "http://"))
                return new URI(value);
            else if (StringUtils.startsWithIgnoreCase(value, "https://"))
                return new URI(value);
            else
                return new URI("http://" + value);
        } catch (URISyntaxException ex) {
            throw new IllegalArgumentException("Can't parse URI value '" + value + "'!", ex);
        }
    }

    public static String printBoolType(Boolean value) {
        if (Boolean.TRUE.equals(value))
            return "1";
        else if (Boolean.FALSE.equals(value))
            return "0";
        else
            return StringUtils.EMPTY;
    }

    public static String printCountryType(String value) {
        return StringUtils.abbreviate(StringUtils.trimToEmpty(value), 50);
    }

    public static String printDateType(Calendar value) {
        if (value == null)
            throw new IllegalArgumentException("Can't print date value!");

        return getDateFormat().format(value.getTime());
    }

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

    public static String printFeedVersionType(String value) {
        value = StringUtils.trimToNull(value);
        if (!isValidFeedVersionType(value))
            throw new IllegalArgumentException("Can't print feed-version value!");
        else
            return value;
    }

    public static String printIdType(String value) {
        value = StringUtils.trimToNull(value);
        if (!isValidIdType(value))
            throw new IllegalArgumentException("Can't print id value!");
        else
            return StringUtils.abbreviate(value, 50);
    }

    public static String printImageAttributeType(Integer value) {
        if (!isValidImageAttributeType(value))
            throw new IllegalArgumentException("Can't print image-attribute value!");
        else
            return DatatypeConverter.printInt(value);
    }

    public static String printImageUrlType(URI value) {
        if (!isValidImageUrlType(value))
            throw new IllegalArgumentException("Can't print image-url value!");
        else
            return value.toString();
    }

    public static String printInteger(BigInteger value) {
        if (value == null)
            throw new IllegalArgumentException("Can't print integer value '" + value + "'!");
        else
            return DatatypeConverter.printInteger(value);
    }

    public static String printLocationType(String value) {
        return StringUtils.abbreviate(StringUtils.trimToEmpty(value), 50);
    }

    public static String printNonNegativeInteger(BigInteger value) {
        if (value == null || value.compareTo(BigInteger.ZERO) < 0)
            throw new IllegalArgumentException("Can't print integer value '" + value + "'!");
        else
            return DatatypeConverter.printInteger(value);
    }

    public static String printPriceType(Long value) {
        return (value != null) ?
                DatatypeConverter.printLong(value) : "x";
    }

    public static String printRefType(String value) {
        value = StringUtils.trimToNull(value);
        if (!isValidRefType(value))
            throw new IllegalArgumentException("Can't print ref value!");
        else
            return StringUtils.abbreviate(value, 255);
    }

    public static String printRequiredType(String value) {
        value = StringUtils.trimToNull(value);
        if (!isValidRequiredType(value))
            throw new IllegalArgumentException("Can't print required value!");
        else
            return value;
    }

    public static String printTypeDataType(String value) {
        value = StringUtils.trimToNull(value);
        if (!isValidTypeDataType(value))
            throw new IllegalArgumentException("Can't print type-data value!");
        else
            return value;
    }

    public static String printUrlDataType(URI value) {
        if (!isValidUrlDataType(value))
            throw new IllegalArgumentException("Can't print url-data value!");
        else
            return value.toString();
    }
}


package org.openestate.io.immoxml.xml;

import java.io.Serializable;
import javax.annotation.Generated;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
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 <freizeitimmobilie_gewerblich> element.
 *
 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "")
@XmlRootElement(name = "freizeitimmobilie_gewerblich")
@Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:50:55+02:00", comments = "JAXB RI v2.2.11")
public class FreizeitimmobilieGewerblich implements Serializable, Cloneable, CopyTo2, Equals2, ToString2
{

    @XmlAttribute(name = "freizeit_typ")
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:50:55+02:00", comments = "JAXB RI v2.2.11")
    protected FreizeitimmobilieGewerblich.FreizeitTyp freizeitTyp;

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

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

    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:50:55+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:50:55+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:50:55+02:00", comments = "JAXB RI v2.2.11")
    public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy2 strategy) {
        {
            FreizeitimmobilieGewerblich.FreizeitTyp theFreizeitTyp;
            theFreizeitTyp = this.getFreizeitTyp();
            strategy.appendField(locator, this, "freizeitTyp", buffer, theFreizeitTyp, (this.freizeitTyp!= null));
        }
        return buffer;
    }

    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:50:55+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:50:55+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:50:55+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 FreizeitimmobilieGewerblich) {
            final FreizeitimmobilieGewerblich copy = ((FreizeitimmobilieGewerblich) draftCopy);
            {
                Boolean freizeitTypShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, (this.freizeitTyp!= null));
                if (freizeitTypShouldBeCopiedAndSet == Boolean.TRUE) {
                    FreizeitimmobilieGewerblich.FreizeitTyp sourceFreizeitTyp;
                    sourceFreizeitTyp = this.getFreizeitTyp();
                    FreizeitimmobilieGewerblich.FreizeitTyp copyFreizeitTyp = ((FreizeitimmobilieGewerblich.FreizeitTyp) strategy.copy(LocatorUtils.property(locator, "freizeitTyp", sourceFreizeitTyp), sourceFreizeitTyp, (this.freizeitTyp!= null)));
                    copy.setFreizeitTyp(copyFreizeitTyp);
                } else {
                    if (freizeitTypShouldBeCopiedAndSet == Boolean.FALSE) {
                        copy.freizeitTyp = null;
                    }
                }
            }
        }
        return draftCopy;
    }

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

    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:50:55+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 FreizeitimmobilieGewerblich that = ((FreizeitimmobilieGewerblich) object);
        {
            FreizeitimmobilieGewerblich.FreizeitTyp lhsFreizeitTyp;
            lhsFreizeitTyp = this.getFreizeitTyp();
            FreizeitimmobilieGewerblich.FreizeitTyp rhsFreizeitTyp;
            rhsFreizeitTyp = that.getFreizeitTyp();
            if (!strategy.equals(LocatorUtils.property(thisLocator, "freizeitTyp", lhsFreizeitTyp), LocatorUtils.property(thatLocator, "freizeitTyp", rhsFreizeitTyp), lhsFreizeitTyp, rhsFreizeitTyp, (this.freizeitTyp!= null), (that.freizeitTyp!= null))) {
                return false;
            }
        }
        return true;
    }

    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:50:55+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 freizeit_typ attribute in <freizeitimmobilie_gewerblich> 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="SPORTANLAGEN"/>
     *     <enumeration value="VERGNUEGUNGSPARKS_UND_CENTER"/>
     *   </restriction>
     * </simpleType>
     *

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

        SPORTANLAGEN,
        VERGNUEGUNGSPARKS_UND_CENTER;

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

        public static FreizeitimmobilieGewerblich.FreizeitTyp fromValue(String v) {
            return valueOf(v);
        }

    }

}


package org.openestate.io.openimmo.xml;

import java.io.Serializable;
import javax.annotation.Generated;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlValue;
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 <tel_sonstige> element.
 *
 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
    "value"
})
@XmlRootElement(name = "tel_sonstige")
@Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
public class TelSonstige implements Serializable, Cloneable, CopyTo2, Equals2, ToString2
{

    @XmlValue
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    protected String value;
    @XmlAttribute(name = "telefonart")
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    protected TelSonstige.Telefonart telefonart;
    @XmlAttribute(name = "bemerkung")
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    protected String bemerkung;

    /**
     * Gets the value of the value 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 getValue() {
        return value;
    }

    /**
     * Sets the value of the value 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 setValue(String value) {
        this.value = value;
    }

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

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

    /**
     * Gets the value of the bemerkung 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 getBemerkung() {
        return bemerkung;
    }

    /**
     * Sets the value of the bemerkung 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 setBemerkung(String value) {
        this.bemerkung = value;
    }

    @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 theValue;
            theValue = this.getValue();
            strategy.appendField(locator, this, "value", buffer, theValue, (this.value!= null));
        }
        {
            TelSonstige.Telefonart theTelefonart;
            theTelefonart = this.getTelefonart();
            strategy.appendField(locator, this, "telefonart", buffer, theTelefonart, (this.telefonart!= null));
        }
        {
            String theBemerkung;
            theBemerkung = this.getBemerkung();
            strategy.appendField(locator, this, "bemerkung", buffer, theBemerkung, (this.bemerkung!= null));
        }
        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 TelSonstige) {
            final TelSonstige copy = ((TelSonstige) draftCopy);
            {
                Boolean valueShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, (this.value!= null));
                if (valueShouldBeCopiedAndSet == Boolean.TRUE) {
                    String sourceValue;
                    sourceValue = this.getValue();
                    String copyValue = ((String) strategy.copy(LocatorUtils.property(locator, "value", sourceValue), sourceValue, (this.value!= null)));
                    copy.setValue(copyValue);
                } else {
                    if (valueShouldBeCopiedAndSet == Boolean.FALSE) {
                        copy.value = null;
                    }
                }
            }
            {
                Boolean telefonartShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, (this.telefonart!= null));
                if (telefonartShouldBeCopiedAndSet == Boolean.TRUE) {
                    TelSonstige.Telefonart sourceTelefonart;
                    sourceTelefonart = this.getTelefonart();
                    TelSonstige.Telefonart copyTelefonart = ((TelSonstige.Telefonart) strategy.copy(LocatorUtils.property(locator, "telefonart", sourceTelefonart), sourceTelefonart, (this.telefonart!= null)));
                    copy.setTelefonart(copyTelefonart);
                } else {
                    if (telefonartShouldBeCopiedAndSet == Boolean.FALSE) {
                        copy.telefonart = null;
                    }
                }
            }
            {
                Boolean bemerkungShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, (this.bemerkung!= null));
                if (bemerkungShouldBeCopiedAndSet == Boolean.TRUE) {
                    String sourceBemerkung;
                    sourceBemerkung = this.getBemerkung();
                    String copyBemerkung = ((String) strategy.copy(LocatorUtils.property(locator, "bemerkung", sourceBemerkung), sourceBemerkung, (this.bemerkung!= null)));
                    copy.setBemerkung(copyBemerkung);
                } else {
                    if (bemerkungShouldBeCopiedAndSet == Boolean.FALSE) {
                        copy.bemerkung = 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 TelSonstige();
    }

    @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 TelSonstige that = ((TelSonstige) object);
        {
            String lhsValue;
            lhsValue = this.getValue();
            String rhsValue;
            rhsValue = that.getValue();
            if (!strategy.equals(LocatorUtils.property(thisLocator, "value", lhsValue), LocatorUtils.property(thatLocator, "value", rhsValue), lhsValue, rhsValue, (this.value!= null), (that.value!= null))) {
                return false;
            }
        }
        {
            TelSonstige.Telefonart lhsTelefonart;
            lhsTelefonart = this.getTelefonart();
            TelSonstige.Telefonart rhsTelefonart;
            rhsTelefonart = that.getTelefonart();
            if (!strategy.equals(LocatorUtils.property(thisLocator, "telefonart", lhsTelefonart), LocatorUtils.property(thatLocator, "telefonart", rhsTelefonart), lhsTelefonart, rhsTelefonart, (this.telefonart!= null), (that.telefonart!= null))) {
                return false;
            }
        }
        {
            String lhsBemerkung;
            lhsBemerkung = this.getBemerkung();
            String rhsBemerkung;
            rhsBemerkung = that.getBemerkung();
            if (!strategy.equals(LocatorUtils.property(thisLocator, "bemerkung", lhsBemerkung), LocatorUtils.property(thatLocator, "bemerkung", rhsBemerkung), lhsBemerkung, rhsBemerkung, (this.bemerkung!= null), (that.bemerkung!= null))) {
                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 telefonart attribute in <tel_sonstige> 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="TEL_ZENTRALE"/>
     *     <enumeration value="TEL_DURCHW"/>
     *     <enumeration value="TEL_PRIVAT"/>
     *     <enumeration value="TEL_HANDY"/>
     *     <enumeration value="TEL_FAX"/>
     *     <enumeration value="TEL_SONSTIGE"/>
     *   </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 Telefonart {

        TEL_ZENTRALE,
        TEL_DURCHW,
        TEL_PRIVAT,
        TEL_HANDY,
        TEL_FAX,
        TEL_SONSTIGE;

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

        public static TelSonstige.Telefonart fromValue(String v) {
            return valueOf(v);
        }

    }

}


/*
 * 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.JAXBException;
import javax.xml.parsers.ParserConfigurationException;
import org.apache.log4j.PropertyConfigurator;
import org.openestate.io.immoxml.ImmoXmlDocument;
import org.openestate.io.immoxml.ImmoXmlUtils;
import org.openestate.io.immoxml.xml.Anbieter;
import org.openestate.io.immoxml.xml.Immobilie;
import org.openestate.io.immoxml.xml.Immoxml;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xml.sax.SAXException;

/**
 * Example for reading ImmoXML files.
 * <p>
 * This example illustrates how to read ImmoXML files.
 *
 * @author Andreas Rudolph
 * @since 1.0
 */
public class ImmoXmlReadingExample {
    @SuppressWarnings("unused")
    private final static Logger LOGGER = LoggerFactory.getLogger(ImmoXmlReadingExample.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(
                ImmoXmlReadingExample.class.getResource(PACKAGE + "/log4j.properties"));

        // read example files, if no files were specified as command line arguments
        if (args.length < 1) {
            try {
                read(ImmoXmlReadingExample.class.getResourceAsStream(PACKAGE + "/immoxml.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 ImmoXmlDocument} 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;
        }
        ImmoXmlDocument doc = ImmoXmlUtils.createDocument(xmlFile);
        if (doc == null) {
            LOGGER.warn("> provided XML is not supported");
        } else {
            printToConsole(doc);
        }
    }

    /**
     * Read a {@link InputStream} into an {@link ImmoXmlDocument} 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");
        ImmoXmlDocument doc = ImmoXmlUtils.createDocument(xmlInputStream);
        if (doc == null) {
            LOGGER.warn("> provided XML is not supported");
        } else {
            printToConsole(doc);
        }
    }

    /**
     * Print some content of an {@link ImmoXmlDocument} to console.
     *
     * @param doc the document to process
     * @throws JAXBException if XML conversion into Java objects failed
     */
    @SuppressWarnings("Duplicates")
    protected static void printToConsole(ImmoXmlDocument doc) throws JAXBException {
        LOGGER.info("> process document in version "
                + doc.getDocumentVersion());

        Immoxml immoxml = doc.toObject();

        // process agencies in the document
        for (Anbieter anbieter : immoxml.getAnbieter()) {
            LOGGER.info(">> found agency '" + anbieter.getAnbieternr() + "'");

            // process real estates of the agency
            for (Immobilie immobilie : anbieter.getImmobilie()) {
                // get object nr
                String objectNr = (immobilie.getVerwaltungTechn() != null) ?
                        immobilie.getVerwaltungTechn().getObjektnrIntern() : "???";

                // get object title
                String objectTitle = (immobilie.getFreitexte() != null) ?
                        immobilie.getFreitexte().getObjekttitel() : "???";

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


package org.openestate.io.openimmo.xml;

import java.io.Serializable;
import javax.annotation.Generated;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlValue;
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 <email_sonstige> element.
 *
 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
    "value"
})
@XmlRootElement(name = "email_sonstige")
@Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
public class EmailSonstige implements Serializable, Cloneable, CopyTo2, Equals2, ToString2
{

    @XmlValue
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    protected String value;
    @XmlAttribute(name = "emailart")
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    protected EmailSonstige.Emailart emailart;
    @XmlAttribute(name = "bemerkung")
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    protected String bemerkung;

    /**
     * Gets the value of the value 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 getValue() {
        return value;
    }

    /**
     * Sets the value of the value 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 setValue(String value) {
        this.value = value;
    }

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

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

    /**
     * Gets the value of the bemerkung 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 getBemerkung() {
        return bemerkung;
    }

    /**
     * Sets the value of the bemerkung 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 setBemerkung(String value) {
        this.bemerkung = value;
    }

    @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 theValue;
            theValue = this.getValue();
            strategy.appendField(locator, this, "value", buffer, theValue, (this.value!= null));
        }
        {
            EmailSonstige.Emailart theEmailart;
            theEmailart = this.getEmailart();
            strategy.appendField(locator, this, "emailart", buffer, theEmailart, (this.emailart!= null));
        }
        {
            String theBemerkung;
            theBemerkung = this.getBemerkung();
            strategy.appendField(locator, this, "bemerkung", buffer, theBemerkung, (this.bemerkung!= null));
        }
        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 EmailSonstige) {
            final EmailSonstige copy = ((EmailSonstige) draftCopy);
            {
                Boolean valueShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, (this.value!= null));
                if (valueShouldBeCopiedAndSet == Boolean.TRUE) {
                    String sourceValue;
                    sourceValue = this.getValue();
                    String copyValue = ((String) strategy.copy(LocatorUtils.property(locator, "value", sourceValue), sourceValue, (this.value!= null)));
                    copy.setValue(copyValue);
                } else {
                    if (valueShouldBeCopiedAndSet == Boolean.FALSE) {
                        copy.value = null;
                    }
                }
            }
            {
                Boolean emailartShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, (this.emailart!= null));
                if (emailartShouldBeCopiedAndSet == Boolean.TRUE) {
                    EmailSonstige.Emailart sourceEmailart;
                    sourceEmailart = this.getEmailart();
                    EmailSonstige.Emailart copyEmailart = ((EmailSonstige.Emailart) strategy.copy(LocatorUtils.property(locator, "emailart", sourceEmailart), sourceEmailart, (this.emailart!= null)));
                    copy.setEmailart(copyEmailart);
                } else {
                    if (emailartShouldBeCopiedAndSet == Boolean.FALSE) {
                        copy.emailart = null;
                    }
                }
            }
            {
                Boolean bemerkungShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, (this.bemerkung!= null));
                if (bemerkungShouldBeCopiedAndSet == Boolean.TRUE) {
                    String sourceBemerkung;
                    sourceBemerkung = this.getBemerkung();
                    String copyBemerkung = ((String) strategy.copy(LocatorUtils.property(locator, "bemerkung", sourceBemerkung), sourceBemerkung, (this.bemerkung!= null)));
                    copy.setBemerkung(copyBemerkung);
                } else {
                    if (bemerkungShouldBeCopiedAndSet == Boolean.FALSE) {
                        copy.bemerkung = 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 EmailSonstige();
    }

    @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 EmailSonstige that = ((EmailSonstige) object);
        {
            String lhsValue;
            lhsValue = this.getValue();
            String rhsValue;
            rhsValue = that.getValue();
            if (!strategy.equals(LocatorUtils.property(thisLocator, "value", lhsValue), LocatorUtils.property(thatLocator, "value", rhsValue), lhsValue, rhsValue, (this.value!= null), (that.value!= null))) {
                return false;
            }
        }
        {
            EmailSonstige.Emailart lhsEmailart;
            lhsEmailart = this.getEmailart();
            EmailSonstige.Emailart rhsEmailart;
            rhsEmailart = that.getEmailart();
            if (!strategy.equals(LocatorUtils.property(thisLocator, "emailart", lhsEmailart), LocatorUtils.property(thatLocator, "emailart", rhsEmailart), lhsEmailart, rhsEmailart, (this.emailart!= null), (that.emailart!= null))) {
                return false;
            }
        }
        {
            String lhsBemerkung;
            lhsBemerkung = this.getBemerkung();
            String rhsBemerkung;
            rhsBemerkung = that.getBemerkung();
            if (!strategy.equals(LocatorUtils.property(thisLocator, "bemerkung", lhsBemerkung), LocatorUtils.property(thatLocator, "bemerkung", rhsBemerkung), lhsBemerkung, rhsBemerkung, (this.bemerkung!= null), (that.bemerkung!= null))) {
                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 emailart attribute in <email_sonstige> 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="EM_ZENTRALE"/>
     *     <enumeration value="EM_DIREKT"/>
     *     <enumeration value="EM_PRIVAT"/>
     *     <enumeration value="EM_SONSTIGE"/>
     *   </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 Emailart {

        EM_ZENTRALE,
        EM_DIREKT,
        EM_PRIVAT,
        EM_SONSTIGE;

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

        public static EmailSonstige.Emailart fromValue(String v) {
            return valueOf(v);
        }

    }

}


/*
 * 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.is24_csv;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import org.apache.commons.csv.CSVParser;
import org.apache.commons.csv.CSVRecord;
import org.openestate.io.core.CsvParser;
import org.openestate.io.is24_csv.records.Anlageobjekt;
import org.openestate.io.is24_csv.records.GewerbeBueroPraxis;
import org.openestate.io.is24_csv.records.GewerbeEinzelhandel;
import org.openestate.io.is24_csv.records.GewerbeGastronomieHotel;
import org.openestate.io.is24_csv.records.GewerbeHalleProduktion;
import org.openestate.io.is24_csv.records.GewerbeSonstiges;
import org.openestate.io.is24_csv.records.Grundstueck;
import org.openestate.io.is24_csv.records.GrundstueckGewerbe;
import org.openestate.io.is24_csv.records.GrundstueckWohnen;
import org.openestate.io.is24_csv.records.HausKauf;
import org.openestate.io.is24_csv.records.HausMiete;
import org.openestate.io.is24_csv.records.StellplatzKauf;
import org.openestate.io.is24_csv.records.StellplatzMiete;
import org.openestate.io.is24_csv.records.WohnenAufZeit;
import org.openestate.io.is24_csv.records.WohnungKauf;
import org.openestate.io.is24_csv.records.WohnungMiete;
import org.openestate.io.is24_csv.types.Immobilienart;
import org.openestate.io.is24_csv.types.ObjektkategorieGrundstueck;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Parser for the IS24-CSV format.
 *
 * @author Andreas Rudolph
 * @since 1.0
 */
@SuppressWarnings("WeakerAccess")
public class Is24CsvParser extends CsvParser<Is24CsvRecord> {
    @SuppressWarnings("unused")
    private final static Logger LOGGER = LoggerFactory.getLogger(Is24CsvParser.class);

    /**
     * Create with specifications of a {@link CSVParser}.
     *
     * @param parser the CSV parser from
     *               commons-csv
     */
    protected Is24CsvParser(CSVParser parser) {
        super(parser);
    }

    /**
     * Creates a {@link Is24CsvParser} from a {@link String} with CSV data.
     *
     * @param csvString CSV string
     * @return created parser
     * @throws IOException if CSV is not readable
     */
    public static Is24CsvParser create(String csvString) throws IOException {
        return new Is24CsvFormat().parse(csvString);
    }

    /**
     * Creates a {@link Is24CsvParser} from a {@link File} with CSV data.
     *
     * @param csvFile CSV file
     * @return created parser
     * @throws IOException if CSV is not readable
     */
    public static Is24CsvParser create(File csvFile) throws IOException {
        return new Is24CsvFormat().parse(csvFile);
    }

    /**
     * Creates a {@link Is24CsvParser} from an {@link InputStream} with CSV data.
     *
     * @param input CSV input
     * @return created parser
     * @throws IOException if CSV is not readable
     */
    public static Is24CsvParser create(InputStream input) throws IOException {
        return new Is24CsvFormat().parse(input);
    }

    /**
     * Creates a {@link Is24CsvParser} from a {@link Reader} with CSV data.
     *
     * @param input CSV input
     * @return created parser
     * @throws IOException if CSV is not readable
     */
    public static Is24CsvParser create(Reader input) throws IOException {
        return new Is24CsvFormat().parse(input);
    }

    /**
     * Creates a record, according to the object category, that is provided in
     * a {@link CSVRecord}.
     *
     * @param record the record to process
     * @return created record or null, if no matching record was found
     */
    public static Is24CsvRecord createRecord(CSVRecord record) {
        Immobilienart art = Is24CsvRecord.getImmobilienart(record);

        if (Immobilienart.ANLAGE.equals(art))
            return Anlageobjekt.newRecord(record);

        else if (Immobilienart.GEWERBE_BUERO_PRAXEN.equals(art))
            return GewerbeBueroPraxis.newRecord(record);

        else if (Immobilienart.GEWERBE_EINZELHANDEL.equals(art))
            return GewerbeEinzelhandel.newRecord(record);

        else if (Immobilienart.GEWERBE_GASTRONOMIE_HOTEL.equals(art))
            return GewerbeGastronomieHotel.newRecord(record);

        else if (Immobilienart.GEWERBE_HALLE_PRODUKTION.equals(art))
            return GewerbeHalleProduktion.newRecord(record);

        else if (Immobilienart.GEWERBE_SONSTIGES.equals(art))
            return GewerbeSonstiges.newRecord(record);

        else if (Immobilienart.HAUS_KAUF.equals(art))
            return HausKauf.newRecord(record);

        else if (Immobilienart.HAUS_MIETE.equals(art))
            return HausMiete.newRecord(record);

        else if (Immobilienart.STELLPLATZ_KAUF.equals(art))
            return StellplatzKauf.newRecord(record);

        else if (Immobilienart.STELLPLATZ_MIETE.equals(art))
            return StellplatzMiete.newRecord(record);

        else if (Immobilienart.WOHNEN_AUF_ZEIT.equals(art))
            return WohnenAufZeit.newRecord(record);

        else if (Immobilienart.WOHNUNG_KAUF.equals(art))
            return WohnungKauf.newRecord(record);

        else if (Immobilienart.WOHNUNG_MIETE.equals(art))
            return WohnungMiete.newRecord(record);

        // Immobilienart für Grundstücke wird abhängig zur Objektkategorie erzeugt
        else if (Immobilienart.GRUNDSTUECKE.equals(art)) {
            ObjektkategorieGrundstueck cat = Grundstueck.getObjektkategorie(record);
            if (ObjektkategorieGrundstueck.WOHNEN.equals(cat))
                return GrundstueckWohnen.newRecord(record);
            else
                return GrundstueckGewerbe.newRecord(record);
        }

        LOGGER.warn("Unsupported 'Immobilienart' value: " + record.get(Is24CsvRecord.FIELD_IMMOBILIENART));
        return null;
    }

    @Override
    protected Is24CsvRecord newRecord(CSVRecord record) {
        return Is24CsvParser.createRecord(record);
    }
}


package org.openestate.io.daft_ie.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.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
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 anonymous complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType>
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <all>
 *         <element name="overseas_sales" minOccurs="0">
 *           <complexType>
 *             <complexContent>
 *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *                 <sequence>
 *                   <element name="overseas_sale_ad" type="{}overseasSaleAdType" maxOccurs="unbounded" minOccurs="0"/>
 *                 </sequence>
 *               </restriction>
 *             </complexContent>
 *           </complexType>
 *         </element>
 *         <element name="overseas_rental" minOccurs="0">
 *           <complexType>
 *             <complexContent>
 *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *                 <sequence>
 *                   <element name="overseas_rental_ad" type="{}overseasRentalAdType" maxOccurs="unbounded" minOccurs="0"/>
 *                 </sequence>
 *               </restriction>
 *             </complexContent>
 *           </complexType>
 *         </element>
 *       </all>
 *       <attribute name="version" type="{http://www.w3.org/2001/XMLSchema}string" />
 *     </restriction>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {

})
@XmlRootElement(name = "daft")
@Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:41:42+02:00", comments = "JAXB RI v2.2.11")
public class Daft implements Serializable, Cloneable, CopyTo2, Equals2, ToString2
{

    @XmlElement(name = "overseas_sales")
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:41:42+02:00", comments = "JAXB RI v2.2.11")
    protected Daft.OverseasSales overseasSales;
    @XmlElement(name = "overseas_rental")
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:41:42+02:00", comments = "JAXB RI v2.2.11")
    protected Daft.OverseasRental overseasRental;
    @XmlAttribute(name = "version")
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:41:42+02:00", comments = "JAXB RI v2.2.11")
    protected String version;

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

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

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

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

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

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

    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:41:42+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:41:42+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:41:42+02:00", comments = "JAXB RI v2.2.11")
    public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy2 strategy) {
        {
            Daft.OverseasSales theOverseasSales;
            theOverseasSales = this.getOverseasSales();
            strategy.appendField(locator, this, "overseasSales", buffer, theOverseasSales, (this.overseasSales!= null));
        }
        {
            Daft.OverseasRental theOverseasRental;
            theOverseasRental = this.getOverseasRental();
            strategy.appendField(locator, this, "overseasRental", buffer, theOverseasRental, (this.overseasRental!= null));
        }
        {
            String theVersion;
            theVersion = this.getVersion();
            strategy.appendField(locator, this, "version", buffer, theVersion, (this.version!= null));
        }
        return buffer;
    }

    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:41:42+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:41:42+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:41:42+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 Daft) {
            final Daft copy = ((Daft) draftCopy);
            {
                Boolean overseasSalesShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, (this.overseasSales!= null));
                if (overseasSalesShouldBeCopiedAndSet == Boolean.TRUE) {
                    Daft.OverseasSales sourceOverseasSales;
                    sourceOverseasSales = this.getOverseasSales();
                    Daft.OverseasSales copyOverseasSales = ((Daft.OverseasSales) strategy.copy(LocatorUtils.property(locator, "overseasSales", sourceOverseasSales), sourceOverseasSales, (this.overseasSales!= null)));
                    copy.setOverseasSales(copyOverseasSales);
                } else {
                    if (overseasSalesShouldBeCopiedAndSet == Boolean.FALSE) {
                        copy.overseasSales = null;
                    }
                }
            }
            {
                Boolean overseasRentalShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, (this.overseasRental!= null));
                if (overseasRentalShouldBeCopiedAndSet == Boolean.TRUE) {
                    Daft.OverseasRental sourceOverseasRental;
                    sourceOverseasRental = this.getOverseasRental();
                    Daft.OverseasRental copyOverseasRental = ((Daft.OverseasRental) strategy.copy(LocatorUtils.property(locator, "overseasRental", sourceOverseasRental), sourceOverseasRental, (this.overseasRental!= null)));
                    copy.setOverseasRental(copyOverseasRental);
                } else {
                    if (overseasRentalShouldBeCopiedAndSet == Boolean.FALSE) {
                        copy.overseasRental = null;
                    }
                }
            }
            {
                Boolean versionShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, (this.version!= null));
                if (versionShouldBeCopiedAndSet == Boolean.TRUE) {
                    String sourceVersion;
                    sourceVersion = this.getVersion();
                    String copyVersion = ((String) strategy.copy(LocatorUtils.property(locator, "version", sourceVersion), sourceVersion, (this.version!= null)));
                    copy.setVersion(copyVersion);
                } else {
                    if (versionShouldBeCopiedAndSet == Boolean.FALSE) {
                        copy.version = null;
                    }
                }
            }
        }
        return draftCopy;
    }

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

    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:41:42+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 Daft that = ((Daft) object);
        {
            Daft.OverseasSales lhsOverseasSales;
            lhsOverseasSales = this.getOverseasSales();
            Daft.OverseasSales rhsOverseasSales;
            rhsOverseasSales = that.getOverseasSales();
            if (!strategy.equals(LocatorUtils.property(thisLocator, "overseasSales", lhsOverseasSales), LocatorUtils.property(thatLocator, "overseasSales", rhsOverseasSales), lhsOverseasSales, rhsOverseasSales, (this.overseasSales!= null), (that.overseasSales!= null))) {
                return false;
            }
        }
        {
            Daft.OverseasRental lhsOverseasRental;
            lhsOverseasRental = this.getOverseasRental();
            Daft.OverseasRental rhsOverseasRental;
            rhsOverseasRental = that.getOverseasRental();
            if (!strategy.equals(LocatorUtils.property(thisLocator, "overseasRental", lhsOverseasRental), LocatorUtils.property(thatLocator, "overseasRental", rhsOverseasRental), lhsOverseasRental, rhsOverseasRental, (this.overseasRental!= null), (that.overseasRental!= null))) {
                return false;
            }
        }
        {
            String lhsVersion;
            lhsVersion = this.getVersion();
            String rhsVersion;
            rhsVersion = that.getVersion();
            if (!strategy.equals(LocatorUtils.property(thisLocator, "version", lhsVersion), LocatorUtils.property(thatLocator, "version", rhsVersion), lhsVersion, rhsVersion, (this.version!= null), (that.version!= null))) {
                return false;
            }
        }
        return true;
    }

    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:41:42+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 class for anonymous complex type.
     *
     *
The following schema fragment specifies the expected content contained within this class.
     *
     *

     * <complexType>
     *   <complexContent>
     *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
     *       <sequence>
     *         <element name="overseas_rental_ad" type="{}overseasRentalAdType" maxOccurs="unbounded" minOccurs="0"/>
     *       </sequence>
     *     </restriction>
     *   </complexContent>
     * </complexType>
     *

     *
     *
     */
    @XmlAccessorType(XmlAccessType.FIELD)
    @XmlType(name = "", propOrder = {
        "overseasRentalAd"
    })
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:41:42+02:00", comments = "JAXB RI v2.2.11")
    public static class OverseasRental implements Serializable, Cloneable, CopyTo2, Equals2, ToString2
    {

        @XmlElement(name = "overseas_rental_ad")
        @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:41:42+02:00", comments = "JAXB RI v2.2.11")
        protected List<OverseasRentalAdType> overseasRentalAd;

        /**
         * Gets the value of the overseasRentalAd 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 overseasRentalAd property.
         *
         *

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

         *    getOverseasRentalAd().add(newItem);
         *

         *
         *
         *

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

        @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:41:42+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:41:42+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:41:42+02:00", comments = "JAXB RI v2.2.11")
        public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy2 strategy) {
            {
                List<OverseasRentalAdType> theOverseasRentalAd;
                theOverseasRentalAd = (((this.overseasRentalAd!= null)&&(!this.overseasRentalAd.isEmpty()))?this.getOverseasRentalAd():null);
                strategy.appendField(locator, this, "overseasRentalAd", buffer, theOverseasRentalAd, ((this.overseasRentalAd!= null)&&(!this.overseasRentalAd.isEmpty())));
            }
            return buffer;
        }

        @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:41:42+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:41:42+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:41:42+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 Daft.OverseasRental) {
                final Daft.OverseasRental copy = ((Daft.OverseasRental) draftCopy);
                {
                    Boolean overseasRentalAdShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, ((this.overseasRentalAd!= null)&&(!this.overseasRentalAd.isEmpty())));
                    if (overseasRentalAdShouldBeCopiedAndSet == Boolean.TRUE) {
                        List<OverseasRentalAdType> sourceOverseasRentalAd;
                        sourceOverseasRentalAd = (((this.overseasRentalAd!= null)&&(!this.overseasRentalAd.isEmpty()))?this.getOverseasRentalAd():null);
                        @SuppressWarnings("unchecked")
                        List<OverseasRentalAdType> copyOverseasRentalAd = ((List<OverseasRentalAdType> ) strategy.copy(LocatorUtils.property(locator, "overseasRentalAd", sourceOverseasRentalAd), sourceOverseasRentalAd, ((this.overseasRentalAd!= null)&&(!this.overseasRentalAd.isEmpty()))));
                        copy.overseasRentalAd = null;
                        if (copyOverseasRentalAd!= null) {
                            List<OverseasRentalAdType> uniqueOverseasRentalAdl = copy.getOverseasRentalAd();
                            uniqueOverseasRentalAdl.addAll(copyOverseasRentalAd);
                        }
                    } else {
                        if (overseasRentalAdShouldBeCopiedAndSet == Boolean.FALSE) {
                            copy.overseasRentalAd = null;
                        }
                    }
                }
            }
            return draftCopy;
        }

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

        @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:41:42+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 Daft.OverseasRental that = ((Daft.OverseasRental) object);
            {
                List<OverseasRentalAdType> lhsOverseasRentalAd;
                lhsOverseasRentalAd = (((this.overseasRentalAd!= null)&&(!this.overseasRentalAd.isEmpty()))?this.getOverseasRentalAd():null);
                List<OverseasRentalAdType> rhsOverseasRentalAd;
                rhsOverseasRentalAd = (((that.overseasRentalAd!= null)&&(!that.overseasRentalAd.isEmpty()))?that.getOverseasRentalAd():null);
                if (!strategy.equals(LocatorUtils.property(thisLocator, "overseasRentalAd", lhsOverseasRentalAd), LocatorUtils.property(thatLocator, "overseasRentalAd", rhsOverseasRentalAd), lhsOverseasRentalAd, rhsOverseasRentalAd, ((this.overseasRentalAd!= null)&&(!this.overseasRentalAd.isEmpty())), ((that.overseasRentalAd!= null)&&(!that.overseasRentalAd.isEmpty())))) {
                    return false;
                }
            }
            return true;
        }

        @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:41:42+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 class for anonymous complex type.
     *
     *
The following schema fragment specifies the expected content contained within this class.
     *
     *

     * <complexType>
     *   <complexContent>
     *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
     *       <sequence>
     *         <element name="overseas_sale_ad" type="{}overseasSaleAdType" maxOccurs="unbounded" minOccurs="0"/>
     *       </sequence>
     *     </restriction>
     *   </complexContent>
     * </complexType>
     *

     *
     *
     */
    @XmlAccessorType(XmlAccessType.FIELD)
    @XmlType(name = "", propOrder = {
        "overseasSaleAd"
    })
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:41:42+02:00", comments = "JAXB RI v2.2.11")
    public static class OverseasSales implements Serializable, Cloneable, CopyTo2, Equals2, ToString2
    {

        @XmlElement(name = "overseas_sale_ad")
        @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:41:42+02:00", comments = "JAXB RI v2.2.11")
        protected List<OverseasSaleAdType> overseasSaleAd;

        /**
         * Gets the value of the overseasSaleAd 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 overseasSaleAd property.
         *
         *

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

         *    getOverseasSaleAd().add(newItem);
         *

         *
         *
         *

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

        @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:41:42+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:41:42+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:41:42+02:00", comments = "JAXB RI v2.2.11")
        public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy2 strategy) {
            {
                List<OverseasSaleAdType> theOverseasSaleAd;
                theOverseasSaleAd = (((this.overseasSaleAd!= null)&&(!this.overseasSaleAd.isEmpty()))?this.getOverseasSaleAd():null);
                strategy.appendField(locator, this, "overseasSaleAd", buffer, theOverseasSaleAd, ((this.overseasSaleAd!= null)&&(!this.overseasSaleAd.isEmpty())));
            }
            return buffer;
        }

        @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:41:42+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:41:42+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:41:42+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 Daft.OverseasSales) {
                final Daft.OverseasSales copy = ((Daft.OverseasSales) draftCopy);
                {
                    Boolean overseasSaleAdShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, ((this.overseasSaleAd!= null)&&(!this.overseasSaleAd.isEmpty())));
                    if (overseasSaleAdShouldBeCopiedAndSet == Boolean.TRUE) {
                        List<OverseasSaleAdType> sourceOverseasSaleAd;
                        sourceOverseasSaleAd = (((this.overseasSaleAd!= null)&&(!this.overseasSaleAd.isEmpty()))?this.getOverseasSaleAd():null);
                        @SuppressWarnings("unchecked")
                        List<OverseasSaleAdType> copyOverseasSaleAd = ((List<OverseasSaleAdType> ) strategy.copy(LocatorUtils.property(locator, "overseasSaleAd", sourceOverseasSaleAd), sourceOverseasSaleAd, ((this.overseasSaleAd!= null)&&(!this.overseasSaleAd.isEmpty()))));
                        copy.overseasSaleAd = null;
                        if (copyOverseasSaleAd!= null) {
                            List<OverseasSaleAdType> uniqueOverseasSaleAdl = copy.getOverseasSaleAd();
                            uniqueOverseasSaleAdl.addAll(copyOverseasSaleAd);
                        }
                    } else {
                        if (overseasSaleAdShouldBeCopiedAndSet == Boolean.FALSE) {
                            copy.overseasSaleAd = null;
                        }
                    }
                }
            }
            return draftCopy;
        }

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

        @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:41:42+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 Daft.OverseasSales that = ((Daft.OverseasSales) object);
            {
                List<OverseasSaleAdType> lhsOverseasSaleAd;
                lhsOverseasSaleAd = (((this.overseasSaleAd!= null)&&(!this.overseasSaleAd.isEmpty()))?this.getOverseasSaleAd():null);
                List<OverseasSaleAdType> rhsOverseasSaleAd;
                rhsOverseasSaleAd = (((that.overseasSaleAd!= null)&&(!that.overseasSaleAd.isEmpty()))?that.getOverseasSaleAd():null);
                if (!strategy.equals(LocatorUtils.property(thisLocator, "overseasSaleAd", lhsOverseasSaleAd), LocatorUtils.property(thatLocator, "overseasSaleAd", rhsOverseasSaleAd), lhsOverseasSaleAd, rhsOverseasSaleAd, ((this.overseasSaleAd!= null)&&(!this.overseasSaleAd.isEmpty())), ((that.overseasSaleAd!= null)&&(!that.overseasSaleAd.isEmpty())))) {
                    return false;
                }
            }
            return true;
        }

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

    }

}