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

import javax.xml.bind.JAXBException;
import javax.xml.parsers.ParserConfigurationException;
import org.apache.commons.lang3.StringUtils;
import org.jaxen.JaxenException;
import org.openestate.io.core.XmlUtils;
import org.openestate.io.openimmo.xml.Openimmo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;

/**
 * OpenImmo-XML document with a <openimmo> root element.
 *
 * @author Andreas Rudolph
 * @since 1.0
 */
@SuppressWarnings("WeakerAccess")
public class OpenImmoTransferDocument extends OpenImmoDocument<Openimmo> {
    @SuppressWarnings("unused")
    private final static Logger LOGGER = LoggerFactory.getLogger(OpenImmoTransferDocument.class);

    /**
     * Create from a {@link Document}.
     *
     * @param document the document to create from
     */
    public OpenImmoTransferDocument(Document document) {
        super(document);
        if (!isReadable(document))
            throw new IllegalArgumentException("The provided document is invalid!");
    }

    @Override
    public OpenImmoVersion getDocumentVersion() {
        String version;
        try {
            Document doc = this.getDocument();
            version = StringUtils.trimToNull(XmlUtils
                    .newXPath("/io:openimmo/io:uebertragung/@version", doc)
                    .stringValueOf(doc));
            if (version == null) {
                LOGGER.warn("Can't find version information in the XML document!");
                //System.out.println( "----------------------------" );
                //try
                //{
                //  DocumentUtils.write( doc, System.out );
                //}
                //catch (Exception ex)
                //{
                //  LOGGER.error( "Can't write XML document!" );
                //  LOGGER.error( "> " + ex.getLocalizedMessage(), ex );
                //}
                //System.out.println( "----------------------------" );
                return null;
            }
        } catch (JaxenException ex) {
            LOGGER.error("Can't evaluate XPath expression!");
            LOGGER.error("> " + ex.getLocalizedMessage(), ex);
            return null;
        }

        OpenImmoVersion v = OpenImmoVersion.detectFromString(version);
        if (v != null) return v;

        LOGGER.warn("The provided version (" + version + ") is not supported!");
        return null;
    }

    /**
     * Checks, if a {@link Document} is readable as a
     * {@link OpenImmoTransferDocument}.
     *
     * @param doc document to check
     * @return true, if the document is usable, otherwise false
     */
    public static boolean isReadable(Document doc) {
        Element root = XmlUtils.getRootElement(doc);
        return "openimmo".equals(root.getLocalName());
    }

    /**
     * Creates an empty {@link OpenImmoTransferDocument}.
     *
     * @return created document
     * @throws ParserConfigurationException if the parser is not properly configured
     * @throws JAXBException                if a problem with JAXB occurred
     */
    public static OpenImmoTransferDocument newDocument() throws ParserConfigurationException, JAXBException {
        return newDocument(OpenImmoUtils.getFactory().createOpenimmo());
    }

    /**
     * Creates a {@link OpenImmoTransferDocument} from a {@link Openimmo} object.
     *
     * @param openimmo Java object, that represents the <openimmo> root element
     * @return created document
     * @throws ParserConfigurationException if the parser is not properly configured
     * @throws JAXBException                if a problem with JAXB occurred
     */
    public static OpenImmoTransferDocument newDocument(Openimmo openimmo) throws ParserConfigurationException, JAXBException {
        if (openimmo.getUebertragung() == null)
            openimmo.setUebertragung(OpenImmoUtils.getFactory().createUebertragung());
        if (StringUtils.isBlank(openimmo.getUebertragung().getVersion()))
            openimmo.getUebertragung().setVersion(OpenImmoUtils.VERSION.toReadableVersion());

        Document document = XmlUtils.newDocument();
        OpenImmoUtils.createMarshaller("UTF-8", true).marshal(openimmo, document);
        return new OpenImmoTransferDocument(document);
    }

    @Override
    public void setDocumentVersion(OpenImmoVersion version) {
        try {
            Document doc = this.getDocument();

            String currentVersion = StringUtils.trimToEmpty(XmlUtils
                    .newXPath("/io:openimmo/io:uebertragung/@version", doc)
                    .stringValueOf(doc));
            String[] ver = StringUtils.split(currentVersion, "/", 2);

            Element node = (Element) XmlUtils
                    .newXPath("/io:openimmo/io:uebertragung", doc)
                    .selectSingleNode(doc);
            if (node == null) {
                Element parentNode = (Element) XmlUtils
                        .newXPath("/io:openimmo", doc)
                        .selectSingleNode(doc);
                if (parentNode == null) {
                    LOGGER.warn("Can't find an <openimmo> element in the document!");
                    return;
                }
                node = doc.createElement("uebertragung");
                parentNode.insertBefore(node, parentNode.getFirstChild());
            }

            String newVersion = version.toReadableVersion();
            if (ver.length > 1) newVersion += "/" + ver[1];
            node.setAttribute("version", newVersion);
        } catch (JaxenException ex) {
            LOGGER.error("Can't evaluate XPath expression!");
            LOGGER.error("> " + ex.getLocalizedMessage(), ex);
        }
    }

    /**
     * Creates a {@link Openimmo} object from the contained {@link Document}.
     *
     * @return created object, that represents the <openimmo> root element
     * @throws JAXBException if a problem with JAXB occurred
     */
    @Override
    public Openimmo toObject() throws JAXBException {
        this.upgradeToLatestVersion();
        return (Openimmo) OpenImmoUtils.createUnmarshaller().unmarshal(this.getDocument());
    }
}


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 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 <preis_zeiteinheit> element.
 *
 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "")
@XmlRootElement(name = "preis_zeiteinheit")
@Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
public class PreisZeiteinheit implements Serializable, Cloneable, CopyTo2, Equals2, ToString2
{

    @XmlAttribute(name = "zeiteinheit")
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    protected PreisZeiteinheit.Zeiteinheit zeiteinheit;

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

    /**
     * Sets the value of the zeiteinheit property.
     *
     * @param value
     *     allowed object is
     *     {@link PreisZeiteinheit.Zeiteinheit }
     *
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    public void setZeiteinheit(PreisZeiteinheit.Zeiteinheit value) {
        this.zeiteinheit = 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) {
        {
            PreisZeiteinheit.Zeiteinheit theZeiteinheit;
            theZeiteinheit = this.getZeiteinheit();
            strategy.appendField(locator, this, "zeiteinheit", buffer, theZeiteinheit, (this.zeiteinheit!= 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 PreisZeiteinheit) {
            final PreisZeiteinheit copy = ((PreisZeiteinheit) draftCopy);
            {
                Boolean zeiteinheitShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, (this.zeiteinheit!= null));
                if (zeiteinheitShouldBeCopiedAndSet == Boolean.TRUE) {
                    PreisZeiteinheit.Zeiteinheit sourceZeiteinheit;
                    sourceZeiteinheit = this.getZeiteinheit();
                    PreisZeiteinheit.Zeiteinheit copyZeiteinheit = ((PreisZeiteinheit.Zeiteinheit) strategy.copy(LocatorUtils.property(locator, "zeiteinheit", sourceZeiteinheit), sourceZeiteinheit, (this.zeiteinheit!= null)));
                    copy.setZeiteinheit(copyZeiteinheit);
                } else {
                    if (zeiteinheitShouldBeCopiedAndSet == Boolean.FALSE) {
                        copy.zeiteinheit = 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 PreisZeiteinheit();
    }

    @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 PreisZeiteinheit that = ((PreisZeiteinheit) object);
        {
            PreisZeiteinheit.Zeiteinheit lhsZeiteinheit;
            lhsZeiteinheit = this.getZeiteinheit();
            PreisZeiteinheit.Zeiteinheit rhsZeiteinheit;
            rhsZeiteinheit = that.getZeiteinheit();
            if (!strategy.equals(LocatorUtils.property(thisLocator, "zeiteinheit", lhsZeiteinheit), LocatorUtils.property(thatLocator, "zeiteinheit", rhsZeiteinheit), lhsZeiteinheit, rhsZeiteinheit, (this.zeiteinheit!= null), (that.zeiteinheit!= 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 zeiteinheit attribute in <preis_zeiteinheit> 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="TAG"/>
     *     <enumeration value="WOCHE"/>
     *     <enumeration value="MONAT"/>
     *     <enumeration value="JAHR"/>
     *   </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 Zeiteinheit {

        TAG,
        WOCHE,
        MONAT,
        JAHR;

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

        public static PreisZeiteinheit.Zeiteinheit fromValue(String v) {
            return valueOf(v);
        }

    }

}


package org.openestate.io.immoxml.xml;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Generated;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.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 <objektart> element.
 *
 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
    "zimmer",
    "wohnung",
    "haus",
    "grundstueck",
    "bueroPraxen",
    "einzelhandel",
    "gastgewerbe",
    "hallenLagerProd",
    "landUndForstwirtschaft",
    "sonstige",
    "freizeitimmobilieGewerblich",
    "zinshausRenditeobjekt"
})
@XmlRootElement(name = "objektart")
@Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:50:55+02:00", comments = "JAXB RI v2.2.11")
public class Objektart implements Serializable, Cloneable, CopyTo2, Equals2, ToString2
{

    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:50:55+02:00", comments = "JAXB RI v2.2.11")
    protected List<Zimmer> zimmer;
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:50:55+02:00", comments = "JAXB RI v2.2.11")
    protected List<Wohnung> wohnung;
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:50:55+02:00", comments = "JAXB RI v2.2.11")
    protected List<Haus> haus;
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:50:55+02:00", comments = "JAXB RI v2.2.11")
    protected List<Grundstueck> grundstueck;
    @XmlElement(name = "buero_praxen")
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:50:55+02:00", comments = "JAXB RI v2.2.11")
    protected List<BueroPraxen> bueroPraxen;
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:50:55+02:00", comments = "JAXB RI v2.2.11")
    protected List<Einzelhandel> einzelhandel;
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:50:55+02:00", comments = "JAXB RI v2.2.11")
    protected List<Gastgewerbe> gastgewerbe;
    @XmlElement(name = "hallen_lager_prod")
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:50:55+02:00", comments = "JAXB RI v2.2.11")
    protected List<HallenLagerProd> hallenLagerProd;
    @XmlElement(name = "land_und_forstwirtschaft")
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:50:55+02:00", comments = "JAXB RI v2.2.11")
    protected List<LandUndForstwirtschaft> landUndForstwirtschaft;
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:50:55+02:00", comments = "JAXB RI v2.2.11")
    protected List<Sonstige> sonstige;
    @XmlElement(name = "freizeitimmobilie_gewerblich")
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:50:55+02:00", comments = "JAXB RI v2.2.11")
    protected List<FreizeitimmobilieGewerblich> freizeitimmobilieGewerblich;
    @XmlElement(name = "zinshaus_renditeobjekt")
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:50:55+02:00", comments = "JAXB RI v2.2.11")
    protected List<ZinshausRenditeobjekt> zinshausRenditeobjekt;

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

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

     *    getZimmer().add(newItem);
     *

     *
     *
     *

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

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

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

     *    getWohnung().add(newItem);
     *

     *
     *
     *

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

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

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

     *    getHaus().add(newItem);
     *

     *
     *
     *

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

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

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

     *    getGrundstueck().add(newItem);
     *

     *
     *
     *

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

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

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

     *    getBueroPraxen().add(newItem);
     *

     *
     *
     *

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

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

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

     *    getEinzelhandel().add(newItem);
     *

     *
     *
     *

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

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

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

     *    getGastgewerbe().add(newItem);
     *

     *
     *
     *

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

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

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

     *    getHallenLagerProd().add(newItem);
     *

     *
     *
     *

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

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

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

     *    getLandUndForstwirtschaft().add(newItem);
     *

     *
     *
     *

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

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

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

     *    getSonstige().add(newItem);
     *

     *
     *
     *

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

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

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

     *    getFreizeitimmobilieGewerblich().add(newItem);
     *

     *
     *
     *

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

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

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

     *    getZinshausRenditeobjekt().add(newItem);
     *

     *
     *
     *

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

    @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) {
        {
            List<Zimmer> theZimmer;
            theZimmer = (((this.zimmer!= null)&&(!this.zimmer.isEmpty()))?this.getZimmer():null);
            strategy.appendField(locator, this, "zimmer", buffer, theZimmer, ((this.zimmer!= null)&&(!this.zimmer.isEmpty())));
        }
        {
            List<Wohnung> theWohnung;
            theWohnung = (((this.wohnung!= null)&&(!this.wohnung.isEmpty()))?this.getWohnung():null);
            strategy.appendField(locator, this, "wohnung", buffer, theWohnung, ((this.wohnung!= null)&&(!this.wohnung.isEmpty())));
        }
        {
            List<Haus> theHaus;
            theHaus = (((this.haus!= null)&&(!this.haus.isEmpty()))?this.getHaus():null);
            strategy.appendField(locator, this, "haus", buffer, theHaus, ((this.haus!= null)&&(!this.haus.isEmpty())));
        }
        {
            List<Grundstueck> theGrundstueck;
            theGrundstueck = (((this.grundstueck!= null)&&(!this.grundstueck.isEmpty()))?this.getGrundstueck():null);
            strategy.appendField(locator, this, "grundstueck", buffer, theGrundstueck, ((this.grundstueck!= null)&&(!this.grundstueck.isEmpty())));
        }
        {
            List<BueroPraxen> theBueroPraxen;
            theBueroPraxen = (((this.bueroPraxen!= null)&&(!this.bueroPraxen.isEmpty()))?this.getBueroPraxen():null);
            strategy.appendField(locator, this, "bueroPraxen", buffer, theBueroPraxen, ((this.bueroPraxen!= null)&&(!this.bueroPraxen.isEmpty())));
        }
        {
            List<Einzelhandel> theEinzelhandel;
            theEinzelhandel = (((this.einzelhandel!= null)&&(!this.einzelhandel.isEmpty()))?this.getEinzelhandel():null);
            strategy.appendField(locator, this, "einzelhandel", buffer, theEinzelhandel, ((this.einzelhandel!= null)&&(!this.einzelhandel.isEmpty())));
        }
        {
            List<Gastgewerbe> theGastgewerbe;
            theGastgewerbe = (((this.gastgewerbe!= null)&&(!this.gastgewerbe.isEmpty()))?this.getGastgewerbe():null);
            strategy.appendField(locator, this, "gastgewerbe", buffer, theGastgewerbe, ((this.gastgewerbe!= null)&&(!this.gastgewerbe.isEmpty())));
        }
        {
            List<HallenLagerProd> theHallenLagerProd;
            theHallenLagerProd = (((this.hallenLagerProd!= null)&&(!this.hallenLagerProd.isEmpty()))?this.getHallenLagerProd():null);
            strategy.appendField(locator, this, "hallenLagerProd", buffer, theHallenLagerProd, ((this.hallenLagerProd!= null)&&(!this.hallenLagerProd.isEmpty())));
        }
        {
            List<LandUndForstwirtschaft> theLandUndForstwirtschaft;
            theLandUndForstwirtschaft = (((this.landUndForstwirtschaft!= null)&&(!this.landUndForstwirtschaft.isEmpty()))?this.getLandUndForstwirtschaft():null);
            strategy.appendField(locator, this, "landUndForstwirtschaft", buffer, theLandUndForstwirtschaft, ((this.landUndForstwirtschaft!= null)&&(!this.landUndForstwirtschaft.isEmpty())));
        }
        {
            List<Sonstige> theSonstige;
            theSonstige = (((this.sonstige!= null)&&(!this.sonstige.isEmpty()))?this.getSonstige():null);
            strategy.appendField(locator, this, "sonstige", buffer, theSonstige, ((this.sonstige!= null)&&(!this.sonstige.isEmpty())));
        }
        {
            List<FreizeitimmobilieGewerblich> theFreizeitimmobilieGewerblich;
            theFreizeitimmobilieGewerblich = (((this.freizeitimmobilieGewerblich!= null)&&(!this.freizeitimmobilieGewerblich.isEmpty()))?this.getFreizeitimmobilieGewerblich():null);
            strategy.appendField(locator, this, "freizeitimmobilieGewerblich", buffer, theFreizeitimmobilieGewerblich, ((this.freizeitimmobilieGewerblich!= null)&&(!this.freizeitimmobilieGewerblich.isEmpty())));
        }
        {
            List<ZinshausRenditeobjekt> theZinshausRenditeobjekt;
            theZinshausRenditeobjekt = (((this.zinshausRenditeobjekt!= null)&&(!this.zinshausRenditeobjekt.isEmpty()))?this.getZinshausRenditeobjekt():null);
            strategy.appendField(locator, this, "zinshausRenditeobjekt", buffer, theZinshausRenditeobjekt, ((this.zinshausRenditeobjekt!= null)&&(!this.zinshausRenditeobjekt.isEmpty())));
        }
        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 Objektart) {
            final Objektart copy = ((Objektart) draftCopy);
            {
                Boolean zimmerShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, ((this.zimmer!= null)&&(!this.zimmer.isEmpty())));
                if (zimmerShouldBeCopiedAndSet == Boolean.TRUE) {
                    List<Zimmer> sourceZimmer;
                    sourceZimmer = (((this.zimmer!= null)&&(!this.zimmer.isEmpty()))?this.getZimmer():null);
                    @SuppressWarnings("unchecked")
                    List<Zimmer> copyZimmer = ((List<Zimmer> ) strategy.copy(LocatorUtils.property(locator, "zimmer", sourceZimmer), sourceZimmer, ((this.zimmer!= null)&&(!this.zimmer.isEmpty()))));
                    copy.zimmer = null;
                    if (copyZimmer!= null) {
                        List<Zimmer> uniqueZimmerl = copy.getZimmer();
                        uniqueZimmerl.addAll(copyZimmer);
                    }
                } else {
                    if (zimmerShouldBeCopiedAndSet == Boolean.FALSE) {
                        copy.zimmer = null;
                    }
                }
            }
            {
                Boolean wohnungShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, ((this.wohnung!= null)&&(!this.wohnung.isEmpty())));
                if (wohnungShouldBeCopiedAndSet == Boolean.TRUE) {
                    List<Wohnung> sourceWohnung;
                    sourceWohnung = (((this.wohnung!= null)&&(!this.wohnung.isEmpty()))?this.getWohnung():null);
                    @SuppressWarnings("unchecked")
                    List<Wohnung> copyWohnung = ((List<Wohnung> ) strategy.copy(LocatorUtils.property(locator, "wohnung", sourceWohnung), sourceWohnung, ((this.wohnung!= null)&&(!this.wohnung.isEmpty()))));
                    copy.wohnung = null;
                    if (copyWohnung!= null) {
                        List<Wohnung> uniqueWohnungl = copy.getWohnung();
                        uniqueWohnungl.addAll(copyWohnung);
                    }
                } else {
                    if (wohnungShouldBeCopiedAndSet == Boolean.FALSE) {
                        copy.wohnung = null;
                    }
                }
            }
            {
                Boolean hausShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, ((this.haus!= null)&&(!this.haus.isEmpty())));
                if (hausShouldBeCopiedAndSet == Boolean.TRUE) {
                    List<Haus> sourceHaus;
                    sourceHaus = (((this.haus!= null)&&(!this.haus.isEmpty()))?this.getHaus():null);
                    @SuppressWarnings("unchecked")
                    List<Haus> copyHaus = ((List<Haus> ) strategy.copy(LocatorUtils.property(locator, "haus", sourceHaus), sourceHaus, ((this.haus!= null)&&(!this.haus.isEmpty()))));
                    copy.haus = null;
                    if (copyHaus!= null) {
                        List<Haus> uniqueHausl = copy.getHaus();
                        uniqueHausl.addAll(copyHaus);
                    }
                } else {
                    if (hausShouldBeCopiedAndSet == Boolean.FALSE) {
                        copy.haus = null;
                    }
                }
            }
            {
                Boolean grundstueckShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, ((this.grundstueck!= null)&&(!this.grundstueck.isEmpty())));
                if (grundstueckShouldBeCopiedAndSet == Boolean.TRUE) {
                    List<Grundstueck> sourceGrundstueck;
                    sourceGrundstueck = (((this.grundstueck!= null)&&(!this.grundstueck.isEmpty()))?this.getGrundstueck():null);
                    @SuppressWarnings("unchecked")
                    List<Grundstueck> copyGrundstueck = ((List<Grundstueck> ) strategy.copy(LocatorUtils.property(locator, "grundstueck", sourceGrundstueck), sourceGrundstueck, ((this.grundstueck!= null)&&(!this.grundstueck.isEmpty()))));
                    copy.grundstueck = null;
                    if (copyGrundstueck!= null) {
                        List<Grundstueck> uniqueGrundstueckl = copy.getGrundstueck();
                        uniqueGrundstueckl.addAll(copyGrundstueck);
                    }
                } else {
                    if (grundstueckShouldBeCopiedAndSet == Boolean.FALSE) {
                        copy.grundstueck = null;
                    }
                }
            }
            {
                Boolean bueroPraxenShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, ((this.bueroPraxen!= null)&&(!this.bueroPraxen.isEmpty())));
                if (bueroPraxenShouldBeCopiedAndSet == Boolean.TRUE) {
                    List<BueroPraxen> sourceBueroPraxen;
                    sourceBueroPraxen = (((this.bueroPraxen!= null)&&(!this.bueroPraxen.isEmpty()))?this.getBueroPraxen():null);
                    @SuppressWarnings("unchecked")
                    List<BueroPraxen> copyBueroPraxen = ((List<BueroPraxen> ) strategy.copy(LocatorUtils.property(locator, "bueroPraxen", sourceBueroPraxen), sourceBueroPraxen, ((this.bueroPraxen!= null)&&(!this.bueroPraxen.isEmpty()))));
                    copy.bueroPraxen = null;
                    if (copyBueroPraxen!= null) {
                        List<BueroPraxen> uniqueBueroPraxenl = copy.getBueroPraxen();
                        uniqueBueroPraxenl.addAll(copyBueroPraxen);
                    }
                } else {
                    if (bueroPraxenShouldBeCopiedAndSet == Boolean.FALSE) {
                        copy.bueroPraxen = null;
                    }
                }
            }
            {
                Boolean einzelhandelShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, ((this.einzelhandel!= null)&&(!this.einzelhandel.isEmpty())));
                if (einzelhandelShouldBeCopiedAndSet == Boolean.TRUE) {
                    List<Einzelhandel> sourceEinzelhandel;
                    sourceEinzelhandel = (((this.einzelhandel!= null)&&(!this.einzelhandel.isEmpty()))?this.getEinzelhandel():null);
                    @SuppressWarnings("unchecked")
                    List<Einzelhandel> copyEinzelhandel = ((List<Einzelhandel> ) strategy.copy(LocatorUtils.property(locator, "einzelhandel", sourceEinzelhandel), sourceEinzelhandel, ((this.einzelhandel!= null)&&(!this.einzelhandel.isEmpty()))));
                    copy.einzelhandel = null;
                    if (copyEinzelhandel!= null) {
                        List<Einzelhandel> uniqueEinzelhandell = copy.getEinzelhandel();
                        uniqueEinzelhandell.addAll(copyEinzelhandel);
                    }
                } else {
                    if (einzelhandelShouldBeCopiedAndSet == Boolean.FALSE) {
                        copy.einzelhandel = null;
                    }
                }
            }
            {
                Boolean gastgewerbeShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, ((this.gastgewerbe!= null)&&(!this.gastgewerbe.isEmpty())));
                if (gastgewerbeShouldBeCopiedAndSet == Boolean.TRUE) {
                    List<Gastgewerbe> sourceGastgewerbe;
                    sourceGastgewerbe = (((this.gastgewerbe!= null)&&(!this.gastgewerbe.isEmpty()))?this.getGastgewerbe():null);
                    @SuppressWarnings("unchecked")
                    List<Gastgewerbe> copyGastgewerbe = ((List<Gastgewerbe> ) strategy.copy(LocatorUtils.property(locator, "gastgewerbe", sourceGastgewerbe), sourceGastgewerbe, ((this.gastgewerbe!= null)&&(!this.gastgewerbe.isEmpty()))));
                    copy.gastgewerbe = null;
                    if (copyGastgewerbe!= null) {
                        List<Gastgewerbe> uniqueGastgewerbel = copy.getGastgewerbe();
                        uniqueGastgewerbel.addAll(copyGastgewerbe);
                    }
                } else {
                    if (gastgewerbeShouldBeCopiedAndSet == Boolean.FALSE) {
                        copy.gastgewerbe = null;
                    }
                }
            }
            {
                Boolean hallenLagerProdShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, ((this.hallenLagerProd!= null)&&(!this.hallenLagerProd.isEmpty())));
                if (hallenLagerProdShouldBeCopiedAndSet == Boolean.TRUE) {
                    List<HallenLagerProd> sourceHallenLagerProd;
                    sourceHallenLagerProd = (((this.hallenLagerProd!= null)&&(!this.hallenLagerProd.isEmpty()))?this.getHallenLagerProd():null);
                    @SuppressWarnings("unchecked")
                    List<HallenLagerProd> copyHallenLagerProd = ((List<HallenLagerProd> ) strategy.copy(LocatorUtils.property(locator, "hallenLagerProd", sourceHallenLagerProd), sourceHallenLagerProd, ((this.hallenLagerProd!= null)&&(!this.hallenLagerProd.isEmpty()))));
                    copy.hallenLagerProd = null;
                    if (copyHallenLagerProd!= null) {
                        List<HallenLagerProd> uniqueHallenLagerProdl = copy.getHallenLagerProd();
                        uniqueHallenLagerProdl.addAll(copyHallenLagerProd);
                    }
                } else {
                    if (hallenLagerProdShouldBeCopiedAndSet == Boolean.FALSE) {
                        copy.hallenLagerProd = null;
                    }
                }
            }
            {
                Boolean landUndForstwirtschaftShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, ((this.landUndForstwirtschaft!= null)&&(!this.landUndForstwirtschaft.isEmpty())));
                if (landUndForstwirtschaftShouldBeCopiedAndSet == Boolean.TRUE) {
                    List<LandUndForstwirtschaft> sourceLandUndForstwirtschaft;
                    sourceLandUndForstwirtschaft = (((this.landUndForstwirtschaft!= null)&&(!this.landUndForstwirtschaft.isEmpty()))?this.getLandUndForstwirtschaft():null);
                    @SuppressWarnings("unchecked")
                    List<LandUndForstwirtschaft> copyLandUndForstwirtschaft = ((List<LandUndForstwirtschaft> ) strategy.copy(LocatorUtils.property(locator, "landUndForstwirtschaft", sourceLandUndForstwirtschaft), sourceLandUndForstwirtschaft, ((this.landUndForstwirtschaft!= null)&&(!this.landUndForstwirtschaft.isEmpty()))));
                    copy.landUndForstwirtschaft = null;
                    if (copyLandUndForstwirtschaft!= null) {
                        List<LandUndForstwirtschaft> uniqueLandUndForstwirtschaftl = copy.getLandUndForstwirtschaft();
                        uniqueLandUndForstwirtschaftl.addAll(copyLandUndForstwirtschaft);
                    }
                } else {
                    if (landUndForstwirtschaftShouldBeCopiedAndSet == Boolean.FALSE) {
                        copy.landUndForstwirtschaft = null;
                    }
                }
            }
            {
                Boolean sonstigeShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, ((this.sonstige!= null)&&(!this.sonstige.isEmpty())));
                if (sonstigeShouldBeCopiedAndSet == Boolean.TRUE) {
                    List<Sonstige> sourceSonstige;
                    sourceSonstige = (((this.sonstige!= null)&&(!this.sonstige.isEmpty()))?this.getSonstige():null);
                    @SuppressWarnings("unchecked")
                    List<Sonstige> copySonstige = ((List<Sonstige> ) strategy.copy(LocatorUtils.property(locator, "sonstige", sourceSonstige), sourceSonstige, ((this.sonstige!= null)&&(!this.sonstige.isEmpty()))));
                    copy.sonstige = null;
                    if (copySonstige!= null) {
                        List<Sonstige> uniqueSonstigel = copy.getSonstige();
                        uniqueSonstigel.addAll(copySonstige);
                    }
                } else {
                    if (sonstigeShouldBeCopiedAndSet == Boolean.FALSE) {
                        copy.sonstige = null;
                    }
                }
            }
            {
                Boolean freizeitimmobilieGewerblichShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, ((this.freizeitimmobilieGewerblich!= null)&&(!this.freizeitimmobilieGewerblich.isEmpty())));
                if (freizeitimmobilieGewerblichShouldBeCopiedAndSet == Boolean.TRUE) {
                    List<FreizeitimmobilieGewerblich> sourceFreizeitimmobilieGewerblich;
                    sourceFreizeitimmobilieGewerblich = (((this.freizeitimmobilieGewerblich!= null)&&(!this.freizeitimmobilieGewerblich.isEmpty()))?this.getFreizeitimmobilieGewerblich():null);
                    @SuppressWarnings("unchecked")
                    List<FreizeitimmobilieGewerblich> copyFreizeitimmobilieGewerblich = ((List<FreizeitimmobilieGewerblich> ) strategy.copy(LocatorUtils.property(locator, "freizeitimmobilieGewerblich", sourceFreizeitimmobilieGewerblich), sourceFreizeitimmobilieGewerblich, ((this.freizeitimmobilieGewerblich!= null)&&(!this.freizeitimmobilieGewerblich.isEmpty()))));
                    copy.freizeitimmobilieGewerblich = null;
                    if (copyFreizeitimmobilieGewerblich!= null) {
                        List<FreizeitimmobilieGewerblich> uniqueFreizeitimmobilieGewerblichl = copy.getFreizeitimmobilieGewerblich();
                        uniqueFreizeitimmobilieGewerblichl.addAll(copyFreizeitimmobilieGewerblich);
                    }
                } else {
                    if (freizeitimmobilieGewerblichShouldBeCopiedAndSet == Boolean.FALSE) {
                        copy.freizeitimmobilieGewerblich = null;
                    }
                }
            }
            {
                Boolean zinshausRenditeobjektShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, ((this.zinshausRenditeobjekt!= null)&&(!this.zinshausRenditeobjekt.isEmpty())));
                if (zinshausRenditeobjektShouldBeCopiedAndSet == Boolean.TRUE) {
                    List<ZinshausRenditeobjekt> sourceZinshausRenditeobjekt;
                    sourceZinshausRenditeobjekt = (((this.zinshausRenditeobjekt!= null)&&(!this.zinshausRenditeobjekt.isEmpty()))?this.getZinshausRenditeobjekt():null);
                    @SuppressWarnings("unchecked")
                    List<ZinshausRenditeobjekt> copyZinshausRenditeobjekt = ((List<ZinshausRenditeobjekt> ) strategy.copy(LocatorUtils.property(locator, "zinshausRenditeobjekt", sourceZinshausRenditeobjekt), sourceZinshausRenditeobjekt, ((this.zinshausRenditeobjekt!= null)&&(!this.zinshausRenditeobjekt.isEmpty()))));
                    copy.zinshausRenditeobjekt = null;
                    if (copyZinshausRenditeobjekt!= null) {
                        List<ZinshausRenditeobjekt> uniqueZinshausRenditeobjektl = copy.getZinshausRenditeobjekt();
                        uniqueZinshausRenditeobjektl.addAll(copyZinshausRenditeobjekt);
                    }
                } else {
                    if (zinshausRenditeobjektShouldBeCopiedAndSet == Boolean.FALSE) {
                        copy.zinshausRenditeobjekt = 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 Objektart();
    }

    @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 Objektart that = ((Objektart) object);
        {
            List<Zimmer> lhsZimmer;
            lhsZimmer = (((this.zimmer!= null)&&(!this.zimmer.isEmpty()))?this.getZimmer():null);
            List<Zimmer> rhsZimmer;
            rhsZimmer = (((that.zimmer!= null)&&(!that.zimmer.isEmpty()))?that.getZimmer():null);
            if (!strategy.equals(LocatorUtils.property(thisLocator, "zimmer", lhsZimmer), LocatorUtils.property(thatLocator, "zimmer", rhsZimmer), lhsZimmer, rhsZimmer, ((this.zimmer!= null)&&(!this.zimmer.isEmpty())), ((that.zimmer!= null)&&(!that.zimmer.isEmpty())))) {
                return false;
            }
        }
        {
            List<Wohnung> lhsWohnung;
            lhsWohnung = (((this.wohnung!= null)&&(!this.wohnung.isEmpty()))?this.getWohnung():null);
            List<Wohnung> rhsWohnung;
            rhsWohnung = (((that.wohnung!= null)&&(!that.wohnung.isEmpty()))?that.getWohnung():null);
            if (!strategy.equals(LocatorUtils.property(thisLocator, "wohnung", lhsWohnung), LocatorUtils.property(thatLocator, "wohnung", rhsWohnung), lhsWohnung, rhsWohnung, ((this.wohnung!= null)&&(!this.wohnung.isEmpty())), ((that.wohnung!= null)&&(!that.wohnung.isEmpty())))) {
                return false;
            }
        }
        {
            List<Haus> lhsHaus;
            lhsHaus = (((this.haus!= null)&&(!this.haus.isEmpty()))?this.getHaus():null);
            List<Haus> rhsHaus;
            rhsHaus = (((that.haus!= null)&&(!that.haus.isEmpty()))?that.getHaus():null);
            if (!strategy.equals(LocatorUtils.property(thisLocator, "haus", lhsHaus), LocatorUtils.property(thatLocator, "haus", rhsHaus), lhsHaus, rhsHaus, ((this.haus!= null)&&(!this.haus.isEmpty())), ((that.haus!= null)&&(!that.haus.isEmpty())))) {
                return false;
            }
        }
        {
            List<Grundstueck> lhsGrundstueck;
            lhsGrundstueck = (((this.grundstueck!= null)&&(!this.grundstueck.isEmpty()))?this.getGrundstueck():null);
            List<Grundstueck> rhsGrundstueck;
            rhsGrundstueck = (((that.grundstueck!= null)&&(!that.grundstueck.isEmpty()))?that.getGrundstueck():null);
            if (!strategy.equals(LocatorUtils.property(thisLocator, "grundstueck", lhsGrundstueck), LocatorUtils.property(thatLocator, "grundstueck", rhsGrundstueck), lhsGrundstueck, rhsGrundstueck, ((this.grundstueck!= null)&&(!this.grundstueck.isEmpty())), ((that.grundstueck!= null)&&(!that.grundstueck.isEmpty())))) {
                return false;
            }
        }
        {
            List<BueroPraxen> lhsBueroPraxen;
            lhsBueroPraxen = (((this.bueroPraxen!= null)&&(!this.bueroPraxen.isEmpty()))?this.getBueroPraxen():null);
            List<BueroPraxen> rhsBueroPraxen;
            rhsBueroPraxen = (((that.bueroPraxen!= null)&&(!that.bueroPraxen.isEmpty()))?that.getBueroPraxen():null);
            if (!strategy.equals(LocatorUtils.property(thisLocator, "bueroPraxen", lhsBueroPraxen), LocatorUtils.property(thatLocator, "bueroPraxen", rhsBueroPraxen), lhsBueroPraxen, rhsBueroPraxen, ((this.bueroPraxen!= null)&&(!this.bueroPraxen.isEmpty())), ((that.bueroPraxen!= null)&&(!that.bueroPraxen.isEmpty())))) {
                return false;
            }
        }
        {
            List<Einzelhandel> lhsEinzelhandel;
            lhsEinzelhandel = (((this.einzelhandel!= null)&&(!this.einzelhandel.isEmpty()))?this.getEinzelhandel():null);
            List<Einzelhandel> rhsEinzelhandel;
            rhsEinzelhandel = (((that.einzelhandel!= null)&&(!that.einzelhandel.isEmpty()))?that.getEinzelhandel():null);
            if (!strategy.equals(LocatorUtils.property(thisLocator, "einzelhandel", lhsEinzelhandel), LocatorUtils.property(thatLocator, "einzelhandel", rhsEinzelhandel), lhsEinzelhandel, rhsEinzelhandel, ((this.einzelhandel!= null)&&(!this.einzelhandel.isEmpty())), ((that.einzelhandel!= null)&&(!that.einzelhandel.isEmpty())))) {
                return false;
            }
        }
        {
            List<Gastgewerbe> lhsGastgewerbe;
            lhsGastgewerbe = (((this.gastgewerbe!= null)&&(!this.gastgewerbe.isEmpty()))?this.getGastgewerbe():null);
            List<Gastgewerbe> rhsGastgewerbe;
            rhsGastgewerbe = (((that.gastgewerbe!= null)&&(!that.gastgewerbe.isEmpty()))?that.getGastgewerbe():null);
            if (!strategy.equals(LocatorUtils.property(thisLocator, "gastgewerbe", lhsGastgewerbe), LocatorUtils.property(thatLocator, "gastgewerbe", rhsGastgewerbe), lhsGastgewerbe, rhsGastgewerbe, ((this.gastgewerbe!= null)&&(!this.gastgewerbe.isEmpty())), ((that.gastgewerbe!= null)&&(!that.gastgewerbe.isEmpty())))) {
                return false;
            }
        }
        {
            List<HallenLagerProd> lhsHallenLagerProd;
            lhsHallenLagerProd = (((this.hallenLagerProd!= null)&&(!this.hallenLagerProd.isEmpty()))?this.getHallenLagerProd():null);
            List<HallenLagerProd> rhsHallenLagerProd;
            rhsHallenLagerProd = (((that.hallenLagerProd!= null)&&(!that.hallenLagerProd.isEmpty()))?that.getHallenLagerProd():null);
            if (!strategy.equals(LocatorUtils.property(thisLocator, "hallenLagerProd", lhsHallenLagerProd), LocatorUtils.property(thatLocator, "hallenLagerProd", rhsHallenLagerProd), lhsHallenLagerProd, rhsHallenLagerProd, ((this.hallenLagerProd!= null)&&(!this.hallenLagerProd.isEmpty())), ((that.hallenLagerProd!= null)&&(!that.hallenLagerProd.isEmpty())))) {
                return false;
            }
        }
        {
            List<LandUndForstwirtschaft> lhsLandUndForstwirtschaft;
            lhsLandUndForstwirtschaft = (((this.landUndForstwirtschaft!= null)&&(!this.landUndForstwirtschaft.isEmpty()))?this.getLandUndForstwirtschaft():null);
            List<LandUndForstwirtschaft> rhsLandUndForstwirtschaft;
            rhsLandUndForstwirtschaft = (((that.landUndForstwirtschaft!= null)&&(!that.landUndForstwirtschaft.isEmpty()))?that.getLandUndForstwirtschaft():null);
            if (!strategy.equals(LocatorUtils.property(thisLocator, "landUndForstwirtschaft", lhsLandUndForstwirtschaft), LocatorUtils.property(thatLocator, "landUndForstwirtschaft", rhsLandUndForstwirtschaft), lhsLandUndForstwirtschaft, rhsLandUndForstwirtschaft, ((this.landUndForstwirtschaft!= null)&&(!this.landUndForstwirtschaft.isEmpty())), ((that.landUndForstwirtschaft!= null)&&(!that.landUndForstwirtschaft.isEmpty())))) {
                return false;
            }
        }
        {
            List<Sonstige> lhsSonstige;
            lhsSonstige = (((this.sonstige!= null)&&(!this.sonstige.isEmpty()))?this.getSonstige():null);
            List<Sonstige> rhsSonstige;
            rhsSonstige = (((that.sonstige!= null)&&(!that.sonstige.isEmpty()))?that.getSonstige():null);
            if (!strategy.equals(LocatorUtils.property(thisLocator, "sonstige", lhsSonstige), LocatorUtils.property(thatLocator, "sonstige", rhsSonstige), lhsSonstige, rhsSonstige, ((this.sonstige!= null)&&(!this.sonstige.isEmpty())), ((that.sonstige!= null)&&(!that.sonstige.isEmpty())))) {
                return false;
            }
        }
        {
            List<FreizeitimmobilieGewerblich> lhsFreizeitimmobilieGewerblich;
            lhsFreizeitimmobilieGewerblich = (((this.freizeitimmobilieGewerblich!= null)&&(!this.freizeitimmobilieGewerblich.isEmpty()))?this.getFreizeitimmobilieGewerblich():null);
            List<FreizeitimmobilieGewerblich> rhsFreizeitimmobilieGewerblich;
            rhsFreizeitimmobilieGewerblich = (((that.freizeitimmobilieGewerblich!= null)&&(!that.freizeitimmobilieGewerblich.isEmpty()))?that.getFreizeitimmobilieGewerblich():null);
            if (!strategy.equals(LocatorUtils.property(thisLocator, "freizeitimmobilieGewerblich", lhsFreizeitimmobilieGewerblich), LocatorUtils.property(thatLocator, "freizeitimmobilieGewerblich", rhsFreizeitimmobilieGewerblich), lhsFreizeitimmobilieGewerblich, rhsFreizeitimmobilieGewerblich, ((this.freizeitimmobilieGewerblich!= null)&&(!this.freizeitimmobilieGewerblich.isEmpty())), ((that.freizeitimmobilieGewerblich!= null)&&(!that.freizeitimmobilieGewerblich.isEmpty())))) {
                return false;
            }
        }
        {
            List<ZinshausRenditeobjekt> lhsZinshausRenditeobjekt;
            lhsZinshausRenditeobjekt = (((this.zinshausRenditeobjekt!= null)&&(!this.zinshausRenditeobjekt.isEmpty()))?this.getZinshausRenditeobjekt():null);
            List<ZinshausRenditeobjekt> rhsZinshausRenditeobjekt;
            rhsZinshausRenditeobjekt = (((that.zinshausRenditeobjekt!= null)&&(!that.zinshausRenditeobjekt.isEmpty()))?that.getZinshausRenditeobjekt():null);
            if (!strategy.equals(LocatorUtils.property(thisLocator, "zinshausRenditeobjekt", lhsZinshausRenditeobjekt), LocatorUtils.property(thatLocator, "zinshausRenditeobjekt", rhsZinshausRenditeobjekt), lhsZinshausRenditeobjekt, rhsZinshausRenditeobjekt, ((this.zinshausRenditeobjekt!= null)&&(!this.zinshausRenditeobjekt.isEmpty())), ((that.zinshausRenditeobjekt!= null)&&(!that.zinshausRenditeobjekt.isEmpty())))) {
                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);
    }

}


package org.openestate.io.immobiliare_it.xml;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Generated;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSchemaType;
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 terrains complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType name="terrains">
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element name="terrain" type="{http://feed.immobiliare.it}terrainType" maxOccurs="unbounded"/>
 *       </sequence>
 *     </restriction>
 *   </complexContent>
 * </complexType>
 *

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

    @XmlElement(required = true)
    @XmlSchemaType(name = "string")
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:48:12+02:00", comments = "JAXB RI v2.2.11")
    protected List<TerrainType> terrain;

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

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

     *    getTerrain().add(newItem);
     *

     *
     *
     *

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

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

    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:48:12+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:48:12+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:48:12+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 Terrains) {
            final Terrains copy = ((Terrains) draftCopy);
            {
                Boolean terrainShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, ((this.terrain!= null)&&(!this.terrain.isEmpty())));
                if (terrainShouldBeCopiedAndSet == Boolean.TRUE) {
                    List<TerrainType> sourceTerrain;
                    sourceTerrain = (((this.terrain!= null)&&(!this.terrain.isEmpty()))?this.getTerrain():null);
                    @SuppressWarnings("unchecked")
                    List<TerrainType> copyTerrain = ((List<TerrainType> ) strategy.copy(LocatorUtils.property(locator, "terrain", sourceTerrain), sourceTerrain, ((this.terrain!= null)&&(!this.terrain.isEmpty()))));
                    copy.terrain = null;
                    if (copyTerrain!= null) {
                        List<TerrainType> uniqueTerrainl = copy.getTerrain();
                        uniqueTerrainl.addAll(copyTerrain);
                    }
                } else {
                    if (terrainShouldBeCopiedAndSet == Boolean.FALSE) {
                        copy.terrain = null;
                    }
                }
            }
        }
        return draftCopy;
    }

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

    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:48:12+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 Terrains that = ((Terrains) object);
        {
            List<TerrainType> lhsTerrain;
            lhsTerrain = (((this.terrain!= null)&&(!this.terrain.isEmpty()))?this.getTerrain():null);
            List<TerrainType> rhsTerrain;
            rhsTerrain = (((that.terrain!= null)&&(!that.terrain.isEmpty()))?that.getTerrain():null);
            if (!strategy.equals(LocatorUtils.property(thisLocator, "terrain", lhsTerrain), LocatorUtils.property(thatLocator, "terrain", rhsTerrain), lhsTerrain, rhsTerrain, ((this.terrain!= null)&&(!this.terrain.isEmpty())), ((that.terrain!= null)&&(!that.terrain.isEmpty())))) {
                return false;
            }
        }
        return true;
    }

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

}


package org.openestate.io.openimmo.xml;

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

    @XmlValue
    @XmlJavaTypeAdapter(Adapter2 .class)
    @XmlSchemaType(name = "decimal")
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    protected BigDecimal value;
    @XmlAttribute(name = "periode")
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    protected MieteinnahmenIst.Periode periode;

    /**
     * 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 BigDecimal 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(BigDecimal value) {
        this.value = value;
    }

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

    /**
     * Sets the value of the periode property.
     *
     * @param value
     *     allowed object is
     *     {@link MieteinnahmenIst.Periode }
     *
     */
    @Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
    public void setPeriode(MieteinnahmenIst.Periode value) {
        this.periode = 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) {
        {
            BigDecimal theValue;
            theValue = this.getValue();
            strategy.appendField(locator, this, "value", buffer, theValue, (this.value!= null));
        }
        {
            MieteinnahmenIst.Periode thePeriode;
            thePeriode = this.getPeriode();
            strategy.appendField(locator, this, "periode", buffer, thePeriode, (this.periode!= 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 MieteinnahmenIst) {
            final MieteinnahmenIst copy = ((MieteinnahmenIst) draftCopy);
            {
                Boolean valueShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, (this.value!= null));
                if (valueShouldBeCopiedAndSet == Boolean.TRUE) {
                    BigDecimal sourceValue;
                    sourceValue = this.getValue();
                    BigDecimal copyValue = ((BigDecimal) strategy.copy(LocatorUtils.property(locator, "value", sourceValue), sourceValue, (this.value!= null)));
                    copy.setValue(copyValue);
                } else {
                    if (valueShouldBeCopiedAndSet == Boolean.FALSE) {
                        copy.value = null;
                    }
                }
            }
            {
                Boolean periodeShouldBeCopiedAndSet = strategy.shouldBeCopiedAndSet(locator, (this.periode!= null));
                if (periodeShouldBeCopiedAndSet == Boolean.TRUE) {
                    MieteinnahmenIst.Periode sourcePeriode;
                    sourcePeriode = this.getPeriode();
                    MieteinnahmenIst.Periode copyPeriode = ((MieteinnahmenIst.Periode) strategy.copy(LocatorUtils.property(locator, "periode", sourcePeriode), sourcePeriode, (this.periode!= null)));
                    copy.setPeriode(copyPeriode);
                } else {
                    if (periodeShouldBeCopiedAndSet == Boolean.FALSE) {
                        copy.periode = 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 MieteinnahmenIst();
    }

    @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 MieteinnahmenIst that = ((MieteinnahmenIst) object);
        {
            BigDecimal lhsValue;
            lhsValue = this.getValue();
            BigDecimal 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;
            }
        }
        {
            MieteinnahmenIst.Periode lhsPeriode;
            lhsPeriode = this.getPeriode();
            MieteinnahmenIst.Periode rhsPeriode;
            rhsPeriode = that.getPeriode();
            if (!strategy.equals(LocatorUtils.property(thisLocator, "periode", lhsPeriode), LocatorUtils.property(thatLocator, "periode", rhsPeriode), lhsPeriode, rhsPeriode, (this.periode!= null), (that.periode!= 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 periode attribute in <mieteinnahmen_ist> 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="TAG"/>
     *     <enumeration value="WOCHE"/>
     *     <enumeration value="MONAT"/>
     *     <enumeration value="JAHR"/>
     *   </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 Periode {

        TAG,
        WOCHE,
        MONAT,
        JAHR;

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

        public static MieteinnahmenIst.Periode 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.openimmo.converters;

import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.jaxen.JaxenException;
import org.openestate.io.core.XmlConverter;
import org.openestate.io.core.XmlUtils;
import org.openestate.io.openimmo.OpenImmoDocument;
import org.openestate.io.openimmo.OpenImmoTransferDocument;
import org.openestate.io.openimmo.OpenImmoVersion;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;

/**
 * Converter for version 1.2.7b.
 *
 * @author Andreas Rudolph
 * @since 1.3
 */
@SuppressWarnings({"SpellCheckingInspection", "WeakerAccess"})
public class OpenImmo_1_2_7b extends XmlConverter<OpenImmoDocument, OpenImmoVersion> {
    @SuppressWarnings("unused")
    private final static Logger LOGGER = LoggerFactory.getLogger(OpenImmo_1_2_7b.class);

    @Override
    public OpenImmoVersion getVersion() {
        return OpenImmoVersion.V1_2_7B;
    }

    @Override
    public void downgradeToPreviousVersion(OpenImmoDocument doc) {
        doc.setDocumentVersion(OpenImmoVersion.V1_2_7);

        if (doc instanceof OpenImmoTransferDocument) {
            try {
                this.removeReferenzIdElements(doc.getDocument());
            } catch (Exception ex) {
                LOGGER.error("Can't remove unsupported <referenz_id> elements!");
                LOGGER.error("> " + ex.getLocalizedMessage(), ex);
            }

            try {
                this.removeGeg2018Elements(doc.getDocument());
            } catch (Exception ex) {
                LOGGER.error("Can't remove unsupported <geg2018> elements!");
                LOGGER.error("> " + ex.getLocalizedMessage(), ex);
            }

            try {
                this.downgradeEnergiepassJahrgangElements(doc.getDocument());
            } catch (Exception ex) {
                LOGGER.error("Can't downgrade <jahrgang> in <energiepass> elements!");
                LOGGER.error("> " + ex.getLocalizedMessage(), ex);
            }
        }
    }

    @Override
    public void upgradeFromPreviousVersion(OpenImmoDocument doc) {
        doc.setDocumentVersion(OpenImmoVersion.V1_2_7B);
    }

    /**
     * Remove <referenz_id> elements.
     *

     * OpenImmo 1.2.7 does not support <referenz_id> elements.
     *
     * @param doc OpenImmo document in version 1.2.7b
     * @throws JaxenException if xpath evaluation failed
     */
    protected void removeReferenzIdElements(Document doc) throws JaxenException {
        List nodes = XmlUtils.newXPath(
                "/io:openimmo/io:anbieter/io:immobilie/io:kontaktperson/io:referenz_id",
                doc).selectNodes(doc);
        for (Object item : nodes) {
            Element node = (Element) item;
            Element parentNode = (Element) node.getParentNode();
            parentNode.removeChild(node);
        }
    }

    /**
     * Remove <geg2018> elements.
     *

     * OpenImmo 1.2.7 does not support <geg2018> elements.
     *
     * @param doc OpenImmo document in version 1.2.7b
     * @throws JaxenException if xpath evaluation failed
     */
    protected void removeGeg2018Elements(Document doc) throws JaxenException {
        List nodes = XmlUtils.newXPath(
                "/io:openimmo/io:anbieter/io:immobilie/io:zustand_angaben/io:energiepass/io:geg2018",
                doc).selectNodes(doc);
        for (Object item : nodes) {
            Element node = (Element) item;
            Element parentNode = (Element) node.getParentNode();
            parentNode.removeChild(node);
        }
    }

    /**
     * Downgrade <jahrgang> elements in <energiepass>
     * to OpenImmo 1.2.7.
     *

     * The value "bei_besichtigung" of <jahrgang> elements in
     * <energiepass> is not available in OpenImmo 1.2.7.
     *
     * @param doc OpenImmo document in version 1.2.7b
     * @throws JaxenException if xpath evaluation failed
     */
    protected void downgradeEnergiepassJahrgangElements(Document doc) throws JaxenException {
        List nodes = XmlUtils.newXPath(
                "/io:openimmo/io:anbieter/io:immobilie/io:zustand_angaben/io:energiepass/io:jahrgang",
                doc).selectNodes(doc);
        for (Object item : nodes) {
            Element node = (Element) item;
            String value = StringUtils.trimToNull(node.getTextContent());
            if (value == null || value.equalsIgnoreCase("bei_besichtigung")) {
                Element parentNode = (Element) node.getParentNode();
                parentNode.removeChild(node);
            }
        }
    }
}


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

import javax.xml.bind.JAXBException;
import javax.xml.parsers.ParserConfigurationException;
import org.openestate.io.casa_it.xml.Container;
import org.openestate.io.core.XmlDocument;
import org.openestate.io.core.XmlUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;

/**
 * XML document from casa.it with a
 * <container> root element.
 *
 * @author Andreas Rudolph
 * @since 1.0
 */
@SuppressWarnings("WeakerAccess")
public class CasaItDocument extends XmlDocument<Container> {
    @SuppressWarnings("unused")
    private final static Logger LOGGER = LoggerFactory.getLogger(CasaItDocument.class);

    /**
     * Create from a {@link Document}.
     *
     * @param document the document to create from
     */
    public CasaItDocument(Document document) {
        super(document);
        if (!isReadable(document))
            throw new IllegalArgumentException("The provided document is invalid!");
    }

    /**
     * Checks, if a {@link Document} is readable as a {@link CasaItDocument}.
     *
     * @param doc document to check
     * @return true, if the document is usable, otherwise false
     */
    public static boolean isReadable(Document doc) {
        Element root = XmlUtils.getRootElement(doc);
        return "container".equals(root.getLocalName());
    }

    /**
     * Creates an empty {@link CasaItDocument}.
     *
     * @return created document
     * @throws ParserConfigurationException if the parser is not properly configured
     * @throws JAXBException                if a problem with JAXB occurred
     */
    public static CasaItDocument newDocument() throws ParserConfigurationException, JAXBException {
        return newDocument(CasaItUtils.getFactory().createContainer());
    }

    /**
     * Creates a {@link CasaItDocument} from a {@link Container} object.
     *
     * @param container Java object, that represents the <container> root element
     * @return created document
     * @throws ParserConfigurationException if the parser is not properly configured
     * @throws JAXBException                if a problem with JAXB occurred
     */
    public static CasaItDocument newDocument(Container container) throws ParserConfigurationException, JAXBException {
        Document document = XmlUtils.newDocument();
        CasaItUtils.createMarshaller("UTF-8", true).marshal(container, document);
        return new CasaItDocument(document);
    }

    /**
     * Creates a {@link Container} object from the contained {@link Document}.
     *
     * @return created object, that represents the <container> root element
     * @throws JAXBException if a problem with JAXB occurred
     */
    @Override
    public Container toObject() throws JAXBException {
        return (Container) CasaItUtils.createUnmarshaller().unmarshal(this.getDocument());
    }
}