Input: Start the example application . [CODESPLIT] @ SuppressWarnings ( "Duplicates" ) public static void main ( String [ ] args ) { // init logging PropertyConfigurator . configure ( OpenImmoReadingExample . class . getResource ( PACKAGE + "/log4j.properties" ) ) ; // read example files, if no files were specified as command line arguments if ( args . length < 1 ) { try { read ( OpenImmoReadingExample . class . getResourceAsStream ( PACKAGE + "/openimmo.xml" ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't read example transfer file!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; System . exit ( 2 ) ; } try { read ( OpenImmoReadingExample . class . getResourceAsStream ( PACKAGE + "/openimmo-feedback.xml" ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't read example feedback 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 ) ; } } } }


Input: Read a { @link File } into an { @link OpenImmoTransferDocument } or { @link OpenImmoFeedbackDocument } and print some of their content to console . [CODESPLIT] @ SuppressWarnings ( "Duplicates" ) 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 ; } OpenImmoDocument doc = OpenImmoUtils . createDocument ( xmlFile ) ; if ( doc == null ) { LOGGER . warn ( "> provided XML is not supported" ) ; } else if ( doc . isFeedback ( ) ) { printToConsole ( ( OpenImmoFeedbackDocument ) doc ) ; } else if ( doc . isTransfer ( ) ) { printToConsole ( ( OpenImmoTransferDocument ) doc ) ; } else { LOGGER . warn ( "> unsupported type of document: " + doc . getClass ( ) . getName ( ) ) ; } }


Input: Read a { @link InputStream } into an { @link OpenImmoTransferDocument } or { @link OpenImmoFeedbackDocument } and print some of their content to console . [CODESPLIT] @ SuppressWarnings ( "Duplicates" ) protected static void read ( InputStream xmlInputStream ) throws SAXException , IOException , ParserConfigurationException , JAXBException { LOGGER . info ( "process example file" ) ; OpenImmoDocument doc = OpenImmoUtils . createDocument ( xmlInputStream ) ; if ( doc == null ) { LOGGER . warn ( "> provided XML is not supported" ) ; } else if ( doc . isFeedback ( ) ) { printToConsole ( ( OpenImmoFeedbackDocument ) doc ) ; } else if ( doc . isTransfer ( ) ) { printToConsole ( ( OpenImmoTransferDocument ) doc ) ; } else { LOGGER . warn ( "> unsupported type of document: " + doc . getClass ( ) . getName ( ) ) ; } }


Input: Print some content of an { @link OpenImmoFeedbackDocument } to console . [CODESPLIT] protected static void printToConsole ( OpenImmoFeedbackDocument doc ) throws JAXBException { LOGGER . info ( "> process feedback document in version " + doc . getDocumentVersion ( ) ) ; OpenimmoFeedback feedback = doc . toObject ( ) ; for ( Objekt objekt : feedback . getObjekt ( ) ) { // get object nr String objectNr = ( ! StringUtils . isBlank ( objekt . getOobjId ( ) ) ) ? objekt . getOobjId ( ) . trim ( ) : "???" ; // get object title String objectTitle = ( ! StringUtils . isBlank ( objekt . getBezeichnung ( ) ) ) ? objekt . getBezeichnung ( ) . trim ( ) : "???" ; LOGGER . info ( ">> feedback for object '" + objectNr + "' " + "with title '" + objectTitle + "'" ) ; } }


Input: Print some content of an { @link OpenImmoTransferDocument } to console . [CODESPLIT] @ SuppressWarnings ( "Duplicates" ) protected static void printToConsole ( OpenImmoTransferDocument doc ) throws JAXBException { LOGGER . info ( "> process transfer document in version " + doc . getDocumentVersion ( ) ) ; Openimmo openimmo = doc . toObject ( ) ; // process agencies in the document for ( Anbieter anbieter : openimmo . 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 + "'" ) ; } } }


Input: Gets the value of the vermarktungsart property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:54:50+02:00" , comments = "JAXB RI v2.2.11" ) public List < String > getVermarktungsart ( ) { if ( vermarktungsart == null ) { vermarktungsart = new ArrayList < String > ( ) ; } return this . vermarktungsart ; }


Input: Gets the value of the interessent property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:54:50+02:00" , comments = "JAXB RI v2.2.11" ) public List < Interessent > getInteressent ( ) { if ( interessent == null ) { interessent = new ArrayList < Interessent > ( ) ; } return this . interessent ; }


Input: Sets the value of the wert property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:54:50+02:00" , comments = "JAXB RI v2.2.11" ) public void setWert ( ProvisionTeilen . Wert value ) { this . wert = value ; }


Input: Creates a { @link ImmoXmlDocument } from a { @link Immoxml } object . [CODESPLIT] public static ImmoXmlDocument newDocument ( Immoxml immoxml ) throws ParserConfigurationException , JAXBException { if ( immoxml . getUebertragung ( ) == null ) immoxml . setUebertragung ( ImmoXmlUtils . getFactory ( ) . createUebertragung ( ) ) ; if ( StringUtils . isBlank ( immoxml . getUebertragung ( ) . getVersion ( ) ) ) immoxml . getUebertragung ( ) . setVersion ( ImmoXmlUtils . VERSION . toReadableVersion ( ) ) ; Document document = XmlUtils . newDocument ( ) ; ImmoXmlUtils . createMarshaller ( "UTF-8" , true ) . marshal ( immoxml , document ) ; return new ImmoXmlDocument ( document ) ; }


Input: Creates a { @link Immoxml } object from the contained { @link Document } . [CODESPLIT] @ Override public Immoxml toObject ( ) throws JAXBException { this . upgradeToLatestVersion ( ) ; return ( Immoxml ) ImmoXmlUtils . createUnmarshaller ( ) . unmarshal ( this . getDocument ( ) ) ; }


Input: Sets the value of the ackerland property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:52:47+02:00" , comments = "JAXB RI v2.2.11" ) public void setAckerland ( JAXBElement < Object > value ) { this . ackerland = value ; }


Input: Sets the value of the bauerwartungsland property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:52:47+02:00" , comments = "JAXB RI v2.2.11" ) public void setBauerwartungsland ( JAXBElement < Object > value ) { this . bauerwartungsland = value ; }


Input: Sets the value of the bootsstaende property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:52:47+02:00" , comments = "JAXB RI v2.2.11" ) public void setBootsstaende ( JAXBElement < Object > value ) { this . bootsstaende = value ; }


Input: Sets the value of the buero property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:52:47+02:00" , comments = "JAXB RI v2.2.11" ) public void setBuero ( JAXBElement < Object > value ) { this . buero = value ; }


Input: Sets the value of the camping property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:52:47+02:00" , comments = "JAXB RI v2.2.11" ) public void setCamping ( JAXBElement < Object > value ) { this . camping = value ; }


Input: Sets the value of the doppelhaus property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:52:47+02:00" , comments = "JAXB RI v2.2.11" ) public void setDoppelhaus ( JAXBElement < Object > value ) { this . doppelhaus = value ; }


Input: Sets the value of the einfamilienhaus property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:52:47+02:00" , comments = "JAXB RI v2.2.11" ) public void setEinfamilienhaus ( JAXBElement < Object > value ) { this . einfamilienhaus = value ; }


Input: Sets the value of the einzelhandelGross property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:52:47+02:00" , comments = "JAXB RI v2.2.11" ) public void setEinzelhandelGross ( JAXBElement < Object > value ) { this . einzelhandelGross = value ; }


Input: Sets the value of the einzelhandelKlein property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:52:47+02:00" , comments = "JAXB RI v2.2.11" ) public void setEinzelhandelKlein ( JAXBElement < Object > value ) { this . einzelhandelKlein = value ; }


Input: Sets the value of the garagen property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:52:47+02:00" , comments = "JAXB RI v2.2.11" ) public void setGaragen ( JAXBElement < Object > value ) { this . garagen = value ; }


Input: Sets the value of the garten property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:52:47+02:00" , comments = "JAXB RI v2.2.11" ) public void setGarten ( JAXBElement < Object > value ) { this . garten = value ; }


Input: Sets the value of the gastronomie property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:52:47+02:00" , comments = "JAXB RI v2.2.11" ) public void setGastronomie ( JAXBElement < Object > value ) { this . gastronomie = value ; }


Input: Sets the value of the gewerbe property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:52:47+02:00" , comments = "JAXB RI v2.2.11" ) public void setGewerbe ( JAXBElement < Object > value ) { this . gewerbe = value ; }


Input: Sets the value of the hotel property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:52:47+02:00" , comments = "JAXB RI v2.2.11" ) public void setHotel ( JAXBElement < Object > value ) { this . hotel = value ; }


Input: Sets the value of the industrie property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:52:47+02:00" , comments = "JAXB RI v2.2.11" ) public void setIndustrie ( JAXBElement < Object > value ) { this . industrie = value ; }


Input: Sets the value of the keineBebauung property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:52:47+02:00" , comments = "JAXB RI v2.2.11" ) public void setKeineBebauung ( JAXBElement < Object > value ) { this . keineBebauung = value ; }


Input: Sets the value of the kleingewerbe property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:52:47+02:00" , comments = "JAXB RI v2.2.11" ) public void setKleingewerbe ( JAXBElement < Object > value ) { this . kleingewerbe = value ; }


Input: Sets the value of the lager property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:52:47+02:00" , comments = "JAXB RI v2.2.11" ) public void setLager ( JAXBElement < Object > value ) { this . lager = value ; }


Input: Sets the value of the mehrfamilienhaus property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:52:47+02:00" , comments = "JAXB RI v2.2.11" ) public void setMehrfamilienhaus ( JAXBElement < Object > value ) { this . mehrfamilienhaus = value ; }


Input: Sets the value of the obstpflanzung property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:52:47+02:00" , comments = "JAXB RI v2.2.11" ) public void setObstpflanzung ( JAXBElement < Object > value ) { this . obstpflanzung = value ; }


Input: Sets the value of the parkhaus property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:52:47+02:00" , comments = "JAXB RI v2.2.11" ) public void setParkhaus ( JAXBElement < Object > value ) { this . parkhaus = value ; }


Input: Sets the value of the produktion property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:52:47+02:00" , comments = "JAXB RI v2.2.11" ) public void setProduktion ( JAXBElement < Object > value ) { this . produktion = value ; }


Input: Sets the value of the reihenhaus property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:52:47+02:00" , comments = "JAXB RI v2.2.11" ) public void setReihenhaus ( JAXBElement < Object > value ) { this . reihenhaus = value ; }


Input: Sets the value of the stellplaetze property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:52:47+02:00" , comments = "JAXB RI v2.2.11" ) public void setStellplaetze ( JAXBElement < Object > value ) { this . stellplaetze = value ; }


Input: Sets the value of the villa property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:52:47+02:00" , comments = "JAXB RI v2.2.11" ) public void setVilla ( JAXBElement < Object > value ) { this . villa = value ; }


Input: Sets the value of the wald property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:52:47+02:00" , comments = "JAXB RI v2.2.11" ) public void setWald ( JAXBElement < Object > value ) { this . wald = value ; }


Input: Downgrades the contained { @link Document } to an earlier version . [CODESPLIT] public void downgrade ( VersionType targetVersion ) { if ( targetVersion == null ) throw new NullPointerException ( "No target version was provided!" ) ; XmlVersion currentVersion = this . getDocumentVersion ( ) ; if ( currentVersion == null ) { currentVersion = this . getLatestVersion ( ) ; LOGGER . warn ( "Can't determine document version! Assuming latest version " + currentVersion . toReadableVersion ( ) + "." ) ; } if ( currentVersion == targetVersion ) return ; if ( currentVersion . isOlderThen ( targetVersion ) ) { LOGGER . warn ( "The provided target version (" + targetVersion . toReadableVersion ( ) + ") " + "is newer then the document version (" + currentVersion . toReadableVersion ( ) + ")." ) ; return ; } XmlVersion v = currentVersion ; while ( true ) { v . getConverter ( ) . downgradeToPreviousVersion ( this ) ; v = v . getPreviousVersion ( ) ; if ( v == targetVersion ) break ; } }


Input: Upgrades the contained { @link Document } to a newer version . [CODESPLIT] public void upgrade ( XmlVersion targetVersion ) { if ( targetVersion == null ) throw new NullPointerException ( "No target version was provided!" ) ; XmlVersion currentVersion = this . getDocumentVersion ( ) ; if ( currentVersion == null ) { currentVersion = this . getLatestVersion ( ) ; LOGGER . warn ( "Can't determine document version! Assuming latest version " + currentVersion . toReadableVersion ( ) + "." ) ; } if ( currentVersion == targetVersion ) return ; if ( currentVersion . isNewerThen ( targetVersion ) ) { LOGGER . warn ( "The provided target version (" + targetVersion . toReadableVersion ( ) + ") " + "is older then the document version (" + currentVersion . toReadableVersion ( ) + ")." ) ; return ; } XmlVersion v = currentVersion ; while ( true ) { v = v . getNextVersion ( ) ; v . getConverter ( ) . upgradeFromPreviousVersion ( this ) ; if ( v == targetVersion ) break ; } }


Input: Sets the value of the anbieter property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:52:47+02:00" , comments = "JAXB RI v2.2.11" ) public void setAnbieter ( ImmobilienTransferTyp . Anbieter value ) { this . anbieter = value ; }


Input: Gets the value of the wohnung property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:54:50+02:00" , comments = "JAXB RI v2.2.11" ) public List < Wohnung > getWohnung ( ) { if ( wohnung == null ) { wohnung = new ArrayList < Wohnung > ( ) ; } return this . wohnung ; }


Input: Gets the value of the grundstueck property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:54:50+02:00" , comments = "JAXB RI v2.2.11" ) public List < Grundstueck > getGrundstueck ( ) { if ( grundstueck == null ) { grundstueck = new ArrayList < Grundstueck > ( ) ; } return this . grundstueck ; }


Input: Gets the value of the einzelhandel property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:54:50+02:00" , comments = "JAXB RI v2.2.11" ) public List < Einzelhandel > getEinzelhandel ( ) { if ( einzelhandel == null ) { einzelhandel = new ArrayList < Einzelhandel > ( ) ; } return this . einzelhandel ; }


Input: Gets the value of the hallenLagerProd property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:54:50+02:00" , comments = "JAXB RI v2.2.11" ) public List < HallenLagerProd > getHallenLagerProd ( ) { if ( hallenLagerProd == null ) { hallenLagerProd = new ArrayList < HallenLagerProd > ( ) ; } return this . hallenLagerProd ; }


Input: Gets the value of the parken property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:54:50+02:00" , comments = "JAXB RI v2.2.11" ) public List < Parken > getParken ( ) { if ( parken == null ) { parken = new ArrayList < Parken > ( ) ; } return this . parken ; }


Input: Gets the value of the freizeitimmobilieGewerblich property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:54:50+02:00" , comments = "JAXB RI v2.2.11" ) public List < FreizeitimmobilieGewerblich > getFreizeitimmobilieGewerblich ( ) { if ( freizeitimmobilieGewerblich == null ) { freizeitimmobilieGewerblich = new ArrayList < FreizeitimmobilieGewerblich > ( ) ; } return this . freizeitimmobilieGewerblich ; }


Input: Gets the value of the objektartZusatz property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:54:50+02:00" , comments = "JAXB RI v2.2.11" ) public List < String > getObjektartZusatz ( ) { if ( objektartZusatz == null ) { objektartZusatz = new ArrayList < String > ( ) ; } return this . objektartZusatz ; }


Input: Gets the value of the stellplatzart property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:54:50+02:00" , comments = "JAXB RI v2.2.11" ) public List < Stellplatzart > getStellplatzart ( ) { if ( stellplatzart == null ) { stellplatzart = new ArrayList < Stellplatzart > ( ) ; } return this . stellplatzart ; }


Input: Sets the value of the maxDauer property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:54:50+02:00" , comments = "JAXB RI v2.2.11" ) public void setMaxDauer ( MaxMietdauer . MaxDauer value ) { this . maxDauer = value ; }


Input: Creates a { @link FilemakerDocument } from a { @link Document } . [CODESPLIT] public static FilemakerDocument createDocument ( Document doc ) { if ( FilemakerResultDocument . isReadable ( doc ) ) return new FilemakerResultDocument ( doc ) ; else if ( FilemakerLayoutDocument . isReadable ( doc ) ) return new FilemakerLayoutDocument ( doc ) ; else return null ; }


Input: Start the example application . [CODESPLIT] @ SuppressWarnings ( "Duplicates" ) public static void main ( String [ ] args ) { // init logging PropertyConfigurator . configure ( IdxWritingExample . class . getResource ( PACKAGE + "/log4j.properties" ) ) ; // create some CSV records List < IdxRecord > records = new ArrayList <> ( ) ; records . add ( createRecord ( ) ) ; records . add ( createRecord ( ) ) ; records . add ( createRecord ( ) ) ; records . add ( createRecord ( ) ) ; // write CSV records into a java.io.File try { write ( records , File . createTempFile ( "output-" , ".csv" ) ) ; } catch ( IOException ex ) { LOGGER . error ( "Can't create temporary file!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; System . exit ( 1 ) ; } // write CSV records into a java.io.OutputStream write ( records , new NullOutputStream ( ) ) ; // write CSV records into a java.io.Writer write ( records , new NullWriter ( ) ) ; // write CSV records into a string and send it to the console writeToConsole ( records ) ; }


Input: Create an { @link IdxRecord } with some example data . [CODESPLIT] protected static IdxRecord createRecord ( ) { // create an example real estate IdxRecord obj = new IdxRecord ( ) ; obj . setAdvertisementId ( RandomStringUtils . random ( 5 ) ) ; obj . setAgencyCity ( "Berlin" ) ; obj . setAgencyCountry ( Locale . GERMANY . getCountry ( ) ) ; obj . setAgencyEmail ( "tester@test.org" ) ; obj . setAgencyFax ( "030/123456" ) ; obj . setAgencyId ( RandomStringUtils . random ( 5 ) ) ; obj . setAgencyName ( "agency name" ) ; obj . setAgencyName2 ( "additional agency name" ) ; obj . setAgencyPhone ( "030/123457" ) ; obj . setAgencyReference ( RandomStringUtils . random ( 5 ) ) ; obj . setAgencyStreet ( "example street 123" ) ; obj . setAgencyZip ( "12345" ) ; obj . setAnimalAllowed ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . setAvailableFrom ( Calendar . getInstance ( ) ) ; obj . setBalcony ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . setBillingCompany ( "agency name" ) ; obj . setBillingCountry ( "Germany" ) ; obj . setBillingFirstName ( "Max" ) ; obj . setBillingLanguage ( Language . GERMAN ) ; obj . setBillingMobile ( "030/132456" ) ; obj . setBillingName ( "Mustermann" ) ; obj . setBillingPhone ( "030/123457" ) ; obj . setBillingPhone2 ( "030/123458" ) ; obj . setBillingPlaceName ( "Berlin" ) ; obj . setBillingPostBox ( "additional address notes" ) ; obj . setBillingSalutation ( Salutation . MALE ) ; obj . setBillingStreet ( "example street 123" ) ; obj . setBillingZip ( "12345" ) ; obj . setBuildingLandConnected ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . setCableTv ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . setCarryingCapacityCrane ( RandomUtils . nextDouble ( 500 , 5000 ) ) ; obj . setCarryingCapacityElevator ( RandomUtils . nextDouble ( 500 , 5000 ) ) ; obj . setCeilingHeight ( RandomUtils . nextDouble ( 2 , 10 ) ) ; obj . setChildFriendly ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . setCornerHouse ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . setCurrency ( Currency . getInstance ( "EUR" ) ) ; obj . setDistanceKindergarten ( RandomUtils . nextInt ( 50 , 5000 ) ) ; obj . setDistanceMotorway ( RandomUtils . nextInt ( 50 , 5000 ) ) ; obj . setDistancePublicTransport ( RandomUtils . nextInt ( 50 , 5000 ) ) ; obj . setDistanceSchool1 ( RandomUtils . nextInt ( 50 , 5000 ) ) ; obj . setDistanceSchool2 ( RandomUtils . nextInt ( 50 , 5000 ) ) ; obj . setDistanceShop ( RandomUtils . nextInt ( 50 , 5000 ) ) ; obj . setElevator ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . setFireplace ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . setFlatSharingCommunity ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . setFloor ( RandomUtils . nextInt ( 0 , 10 ) ) ; obj . setGarage ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . setGardenhouse ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . setGasSupply ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . setGrossPremium ( GrossPremium . FROM_4_UNTIL_5 ) ; obj . setHallHeight ( RandomUtils . nextDouble ( 3 , 15 ) ) ; obj . setIsdn ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . setLastModified ( Calendar . getInstance ( ) ) ; obj . setLiftingPlatform ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . setMaximalFloorLoading ( RandomUtils . nextDouble ( 50 , 5000 ) ) ; obj . setMiddleHouse ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . setMinEnergyCertified ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . setMinEnergyGeneral ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . setNewBuilding ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . setNumberOfApartments ( RandomUtils . nextDouble ( 1 , 10 ) ) ; obj . setNumberOfFloors ( RandomUtils . nextInt ( 1 , 10 ) ) ; obj . setNumberOfRooms ( RandomUtils . nextDouble ( 1 , 10 ) ) ; obj . setObjectCity ( "Berlin" ) ; obj . setObjectCountry ( Locale . GERMANY . getCountry ( ) ) ; obj . setObjectDescription ( "some description" + System . lineSeparator ( ) + " about the object" ) ; obj . setObjectSituation ( "some description about the location" ) ; obj . setObjectState ( "BE" ) ; obj . setObjectStreet ( "example street 124" ) ; obj . setObjectTitle ( "title of object" ) ; obj . setObjectType ( ObjectType . HOUSE_VILLA ) ; obj . setObjectZip ( "12345" ) ; obj . setOfferType ( OfferType . SALE ) ; obj . setOldBuilding ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . setOwnObjectUrl ( "http://test.org/object/123" ) ; obj . setParking ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . setPowerSupply ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . setPriceUnit ( PriceUnit . MONTHLY ) ; obj . setRailwayTerminal ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . setRaisedGroundFloor ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . setRamp ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . setRefHouse ( RandomStringUtils . random ( 5 ) ) ; obj . setRefObject ( RandomStringUtils . random ( 5 ) ) ; obj . setRefProperty ( RandomStringUtils . random ( 5 ) ) ; obj . setRentExtra ( RandomUtils . nextLong ( 100 , 1000 ) ) ; obj . setRentNet ( RandomUtils . nextLong ( 100 , 1000 ) ) ; obj . setRestrooms ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . setSellingPrice ( RandomUtils . nextLong ( 100 , 1000 ) ) ; obj . setSenderId ( "OpenEstate.org" ) ; obj . setSewageSupply ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . setSparefield1 ( "spare field 1" ) ; obj . setSparefield2 ( "spare field 2" ) ; obj . setSparefield3 ( "spare field 3" ) ; obj . setSparefield4 ( "spare field 4" ) ; obj . setSurfaceLiving ( RandomUtils . nextLong ( 50 , 300 ) ) ; obj . setSurfaceProperty ( RandomUtils . nextLong ( 100 , 1000 ) ) ; obj . setSurfaceUsable ( RandomUtils . nextLong ( 100 , 1000 ) ) ; obj . setSwimmingpool ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . setUnderBuildingLaws ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . setUnderRoof ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . setUrl ( "http://test.org/object/123" ) ; obj . setView ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . setVisitName ( "Max Mustermann" ) ; obj . setVisitPhone ( "030/123456" ) ; obj . setVisitRemark ( "notes about the contact person" ) ; obj . setVolume ( RandomUtils . nextLong ( 50 , 500 ) ) ; obj . setWaterSupply ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . setWheelcharAccessible ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . setYearBuilt ( RandomUtils . nextInt ( 1900 , 1995 ) ) ; obj . setYearRenovated ( RandomUtils . nextInt ( 1995 , 2010 ) ) ; obj . setDocument ( new Media ( "document.pdf" , "a document about the object" ) ) ; obj . setMovie ( new Media ( "document.mp4" , "a document about the object" ) ) ; obj . setPicture1 ( new Media ( "image1.jpg" , "title for image 1" , "description for image 1" ) ) ; obj . setPicture2 ( new Media ( "image2.jpg" , "title for image 2" , "description for image 2" ) ) ; obj . setPicture3 ( new Media ( "image3.jpg" , "title for image 3" , "description for image 3" ) ) ; obj . setPicture4 ( new Media ( "image4.jpg" , "title for image 4" , "description for image 4" ) ) ; obj . setPicture5 ( new Media ( "image5.jpg" , "title for image 5" , "description for image 5" ) ) ; obj . setPicture6 ( new Media ( "image6.jpg" , "title for image 6" , "description for image 6" ) ) ; obj . setPicture7 ( new Media ( "image7.jpg" , "title for image 7" , "description for image 7" ) ) ; obj . setPicture8 ( new Media ( "image8.jpg" , "title for image 8" , "description for image 8" ) ) ; obj . setPicture9 ( new Media ( "image9.jpg" , "title for image 9" , "description for image 9" ) ) ; obj . setPicture10 ( new Media ( "image10.jpg" , "title for image 10" , "description for image 10" ) ) ; obj . setPicture11 ( new Media ( "image11.jpg" , "title for image 11" , "description for image 11" ) ) ; obj . setPicture12 ( new Media ( "image12.jpg" , "title for image 12" , "description for image 12" ) ) ; obj . setPicture13 ( new Media ( "image13.jpg" , "title for image 13" , "description for image 13" ) ) ; return obj ; }


Input: Write some { @link IdxRecord } objects into a { @link File } . [CODESPLIT] protected static void write ( List < IdxRecord > records , File file ) { LOGGER . info ( "writing document" ) ; try ( IdxPrinter printer = IdxPrinter . create ( file ) ) { printer . printRecords ( records ) ; LOGGER . info ( "> written to: " + file . getAbsolutePath ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't write document into a file!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; System . exit ( 1 ) ; } }


Input: Sets the value of the erschlAttr property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:54:50+02:00" , comments = "JAXB RI v2.2.11" ) public void setErschlAttr ( ErschliessungUmfang . ErschlAttr value ) { this . erschlAttr = value ; }


Input: Gets the value of the feature property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:41:42+02:00" , comments = "JAXB RI v2.2.11" ) public List < String > getFeature ( ) { if ( feature == null ) { feature = new ArrayList < String > ( ) ; } return this . feature ; }


Input: Creates a { @link CsvParser } from a { @link File } with CSV data . [CODESPLIT] @ SuppressFBWarnings ( value = "OBL_UNSATISFIED_OBLIGATION" , justification = "The stream is closed later together with the parser." ) public final Parser parse ( File csvFile ) throws IOException { return this . parse ( new FileInputStream ( csvFile ) ) ; }


Input: Creates a { @link CsvPrinter } that writes CSV data into a { @link File } . [CODESPLIT] @ SuppressFBWarnings ( value = "OBL_UNSATISFIED_OBLIGATION" , justification = "The stream is closed later together with the printer." ) public final Printer print ( File csvFile ) throws IOException { return print ( new FileOutputStream ( csvFile ) ) ; }


Input: Print a { @link CsvRecord } followed by a record separator ( line break ) . [CODESPLIT] public void printRecord ( Record record ) throws IOException { for ( String value : record . print ( ) ) { this . print ( value ) ; } this . println ( ) ; }


Input: Print multiple { @link CsvRecord } objects . [CODESPLIT] public void printRecords ( Iterable < Record > records ) throws IOException { for ( Record record : records ) { this . printRecord ( record ) ; } this . flush ( ) ; }


Input: Helper function to replace line breaks in a string with a custom value before printing . <p > This method may be used by inheriting classes if the particular format does not support line breaks . [CODESPLIT] protected static String replaceLineBreaks ( String value , String lineBreak ) { value = StringUtils . trimToNull ( value ) ; if ( value == null ) return null ; if ( lineBreak == null ) lineBreak = "<br/>" ; Matcher m = LINES . matcher ( value ) ; StringBuilder out = new StringBuilder ( ) ; while ( m . find ( ) ) { out . append ( StringUtils . trimToEmpty ( m . group ( ) ) ) ; if ( ! m . hitEnd ( ) ) out . append ( lineBreak ) ; } return out . toString ( ) ; }


Input: Creates a { @link ImmobiliareItDocument } from a { @link Document } . [CODESPLIT] public static ImmobiliareItDocument createDocument ( Document doc ) { if ( ImmobiliareItDocument . isReadable ( doc ) ) return new ImmobiliareItDocument ( doc ) ; else return null ; }


Input: Creates a { @link TrovitDocument } from a { @link Document } . [CODESPLIT] public static TrovitDocument createDocument ( Document doc ) { if ( TrovitDocument . isReadable ( doc ) ) return new TrovitDocument ( doc ) ; else return null ; }


Input: Read a { @link AreaUnitValue } value from XML . [CODESPLIT] public static AreaUnitValue parseAreaUnitValue ( String value ) { value = StringUtils . trimToNull ( value ) ; if ( value == null ) return null ; final AreaUnitValue unit = AreaUnitValue . fromXmlValue ( value ) ; if ( unit != null ) return unit ; throw new IllegalArgumentException ( "Can't parse foreclosure type value '" + value + "'!" ) ; }


Input: Read a { @link Boolean } value from XML . [CODESPLIT] public static Boolean parseBooleanValue ( String value ) { value = StringUtils . lowerCase ( StringUtils . trimToEmpty ( value ) , Locale . ENGLISH ) ; switch ( value ) { case "true" : case "yes" : case "si" : case "1" : return Boolean . TRUE ; case "false" : case "no" : case "0" : return Boolean . FALSE ; default : throw new IllegalArgumentException ( "Can't parse boolean value '" + value + "'!" ) ; } }


Input: Read a { @link Calendar } value from XML . [CODESPLIT] public static Calendar parseDateValue ( String value ) { value = StringUtils . trimToNull ( value ) ; if ( value == null ) return null ; final String [ ] patterns = new String [ ] { "dd/MM/yyyy" , "dd/MM/yyyy hh:mm:ss" , "dd-MM-yyyy" , "dd-MM-yyyy hh:mm:ss" , "yyyy/MM/dd" , "yyyy/MM/dd hh:mm:ss" , "yyyy-MM-dd" , "yyyy-MM-dd hh:mm:ss" } ; try { Date date = DateUtils . parseDateStrictly ( value , Locale . ENGLISH , patterns ) ; Calendar cal = Calendar . getInstance ( Locale . getDefault ( ) ) ; cal . setTime ( date ) ; return cal ; } catch ( ParseException ex ) { throw new IllegalArgumentException ( "Can't parse date value '" + value + "'!" , ex ) ; } }


Input: Read a { @link ForeclosureTypeValue } value from XML . [CODESPLIT] public static ForeclosureTypeValue parseForeclosureTypeValue ( String value ) { value = StringUtils . trimToNull ( value ) ; if ( value == null ) return null ; final ForeclosureTypeValue foreclosure = ForeclosureTypeValue . fromXmlValue ( value ) ; if ( foreclosure != null ) return foreclosure ; throw new IllegalArgumentException ( "Can't parse foreclosure type value '" + value + "'!" ) ; }


Input: Read a { @link OrientationValue } value from XML . [CODESPLIT] public static OrientationValue parseOrientationValue ( String value ) { value = StringUtils . trimToNull ( value ) ; if ( value == null ) return null ; final OrientationValue orientation = OrientationValue . fromXmlValue ( value ) ; if ( orientation != null ) return orientation ; throw new IllegalArgumentException ( "Can't parse orientation value '" + value + "'!" ) ; }


Input: Read a { @link Currency } value from XML . [CODESPLIT] public static Currency parsePriceCurrencyValue ( String value ) { value = StringUtils . trimToNull ( value ) ; if ( value == null ) return null ; try { return Currency . getInstance ( value . toUpperCase ( ) ) ; } catch ( IllegalArgumentException ex ) { throw new IllegalArgumentException ( "Can't parse price currency value '" + value + "'!" , ex ) ; } }


Input: Read a { @link PricePeriodValue } value from XML . [CODESPLIT] public static PricePeriodValue parsePricePeriodValue ( String value ) { value = StringUtils . trimToNull ( value ) ; if ( value == null ) return null ; final PricePeriodValue period = PricePeriodValue . fromXmlValue ( value ) ; if ( period != null ) return period ; throw new IllegalArgumentException ( "Can't parse price period value '" + value + "'!" ) ; }


Input: Read a { @link BigDecimal } value from XML for a price . [CODESPLIT] public static BigDecimal parsePriceValue ( String value ) { value = StringUtils . trimToNull ( value ) ; if ( value == null ) return null ; try { return DatatypeConverter . parseDecimal ( value ) ; } catch ( NumberFormatException ex ) { throw new IllegalArgumentException ( "Can't parse price value '" + value + "'!" , ex ) ; } }


Input: Read a { @link BigDecimal } value from XML for a number of rooms . [CODESPLIT] public static BigDecimal parseRoomsValue ( String value ) { value = StringUtils . trimToNull ( value ) ; if ( value == null ) return null ; final Matcher m = ROOMS_INTERVAL . matcher ( value ) ; if ( m . find ( ) ) { final int from = Integer . parseInt ( m . group ( 1 ) ) ; final int to = Integer . parseInt ( m . group ( 2 ) ) ; if ( ( to - from ) != - 1 ) { throw new IllegalArgumentException ( "Can't parse rooms value '" + value + "' because of an invalid interval!" ) ; } return DatatypeConverter . parseDecimal ( to + ".5" ) ; } try { return DatatypeConverter . parseDecimal ( value ) ; } catch ( NumberFormatException ex ) { throw new IllegalArgumentException ( "Can't parse rooms value '" + value + "'!" , ex ) ; } }


Input: Read a { @link TypeValue } value from XML . [CODESPLIT] public static TypeValue parseTypeValue ( String value ) { value = StringUtils . trimToNull ( value ) ; if ( value == null ) return null ; final TypeValue type = TypeValue . fromXmlValue ( value ) ; if ( type != null ) return type ; throw new IllegalArgumentException ( "Can't parse type value '" + value + "'!" ) ; }


Input: Write a { @link Boolean } value into XML output . [CODESPLIT] public static String printBooleanValue ( Boolean value ) { if ( value == null ) throw new IllegalArgumentException ( "Can't print empty boolean value!" ) ; return DatatypeConverter . printBoolean ( value ) ; }


Input: Write a { @link String } value for a description into XML output . <p > The description must contain at least 30 characters . [CODESPLIT] public static String printContentValue ( String value ) { value = StringUtils . trimToNull ( value ) ; if ( value == null ) throw new IllegalArgumentException ( "Can't print empty content value!" ) ; if ( value . length ( ) < 30 ) throw new IllegalArgumentException ( "Can't print content value '" + value + "' because it is shorter than 30 characters!" ) ; return value ; }


Input: Write a { @link String } value for a country code into XML output . <p > The country has to be represendet by a ISO - Code wirh two or three characters . [CODESPLIT] public static String printCountryValue ( String value ) { value = StringUtils . trimToNull ( value ) ; if ( value == null ) throw new IllegalArgumentException ( "Can't print empty country value!" ) ; if ( value . length ( ) != 2 && value . length ( ) != 3 ) throw new IllegalArgumentException ( "Can't print country value '" + value + "' because it is neither an ISO-2-Code nor an ISO-3-Code!" ) ; return StringUtils . upperCase ( value , Locale . ENGLISH ) ; }


Input: Write a { @link Calendar } value into XML output . [CODESPLIT] public static String printDateValue ( Calendar value ) { if ( value == null ) throw new IllegalArgumentException ( "Can't print empty date value!" ) ; return new SimpleDateFormat ( "dd-MM-yyyy hh:mm:ss" , Locale . ENGLISH ) . format ( value . getTime ( ) ) ; }


Input: Write a { @link BigDecimal } value into XML output with a valid latitude range . [CODESPLIT] public static String printLatitudeValue ( BigDecimal value ) { if ( value == null ) throw new IllegalArgumentException ( "Can't print empty latitude value!" ) ; if ( value . compareTo ( new BigDecimal ( "-90" ) ) < 0 ) throw new IllegalArgumentException ( "Can't print latitude value '" + value + "' because it is below -90!" ) ; if ( value . compareTo ( new BigDecimal ( "90" ) ) > 0 ) throw new IllegalArgumentException ( "Can't print latitude value '" + value + "' because it is above 90!" ) ; value = value . setScale ( 10 , BigDecimal . ROUND_HALF_UP ) ; return DatatypeConverter . printDecimal ( value ) ; }


Input: Write a { @link BigInteger } value into XML output for a plot area . [CODESPLIT] public static String printPlotAreaValue ( BigInteger value ) { if ( value == null ) throw new IllegalArgumentException ( "Can't print empty plot area value!" ) ; if ( value . compareTo ( BigInteger . ONE ) < 0 ) throw new IllegalArgumentException ( "Can't print floor plot value '" + value + "' because it is below 1!" ) ; if ( value . compareTo ( BigInteger . valueOf ( 1000000000L ) ) > 0 ) throw new IllegalArgumentException ( "Can't print floor plot value '" + value + "' because it is above 1000000000!" ) ; return DatatypeConverter . printInteger ( value ) ; }


Input: Write a { @link BigDecimal } value into XML output for a price . [CODESPLIT] public static String printPriceValue ( BigDecimal value ) { if ( value == null ) throw new IllegalArgumentException ( "Can't print empty price value!" ) ; if ( value . compareTo ( BigDecimal . ZERO ) < 0 ) throw new IllegalArgumentException ( "Can't print price value '" + value + "' because it is below 0!" ) ; if ( value . compareTo ( new BigDecimal ( "1000000000" ) ) > 0 ) throw new IllegalArgumentException ( "Can't print price value '" + value + "' because it is above 1000000000!" ) ; value = value . setScale ( 2 , BigDecimal . ROUND_HALF_UP ) ; return DatatypeConverter . printDecimal ( value ) ; }


Input: Write a { @link BigDecimal } value into XML output for a room number . [CODESPLIT] public static String printRoomsValue ( BigDecimal value ) { if ( value == null ) throw new IllegalArgumentException ( "Can't print empty rooms value!" ) ; if ( value . compareTo ( BigDecimal . ZERO ) < 0 ) throw new IllegalArgumentException ( "Can't print rooms value '" + value + "' because it is below 0!" ) ; if ( value . compareTo ( new BigDecimal ( "20" ) ) > 0 ) throw new IllegalArgumentException ( "Can't print rooms value '" + value + "' because it is above 20!" ) ; value = value . setScale ( 1 , BigDecimal . ROUND_HALF_UP ) ; //return DatatypeConverter.printDecimal( value ); final BigInteger integerPart = value . toBigInteger ( ) ; final BigInteger decimalPart = value . subtract ( new BigDecimal ( integerPart , 1 ) ) . multiply ( BigDecimal . TEN ) . toBigInteger ( ) ; if ( decimalPart . compareTo ( BigInteger . ZERO ) != 0 ) return integerPart . toString ( ) + ".5" ; return DatatypeConverter . printInteger ( integerPart ) ; }


Input: Write an { @link URI } value into XML output . [CODESPLIT] public static String printUriValue ( URI value ) { if ( value == null ) throw new IllegalArgumentException ( "Can't print empty URI value!" ) ; if ( "http" . equalsIgnoreCase ( value . getScheme ( ) ) ) return value . toString ( ) ; if ( "https" . equalsIgnoreCase ( value . getScheme ( ) ) ) return value . toString ( ) ; throw new IllegalArgumentException ( "Can't print URI '" + value + "' because of an unsupported scheme!" ) ; }


Input: Write a { @link BigInteger } value into XML output for a year number . [CODESPLIT] public static String printYearValue ( BigInteger value ) { if ( value == null ) throw new IllegalArgumentException ( "Can't print empty year value!" ) ; if ( value . compareTo ( BigInteger . valueOf ( 1700L ) ) < 0 ) throw new IllegalArgumentException ( "Can't print year value '" + value + "' because it is below 1700!" ) ; if ( value . compareTo ( BigInteger . valueOf ( 9999L ) ) > 0 ) throw new IllegalArgumentException ( "Can't print year value '" + value + "' because it is above 9999!" ) ; return DatatypeConverter . printInteger ( value ) ; }


Input: Sets the value of the zimmertyp property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:50:55+02:00" , comments = "JAXB RI v2.2.11" ) public void setZimmertyp ( Zimmer . Zimmertyp value ) { this . zimmertyp = value ; }


Input: Recursively remove any comments and unnecessary white spaces from a { @link Node } and its children . [CODESPLIT] public static void clean ( Node node ) { NodeList childNodes = node . getChildNodes ( ) ; for ( int n = childNodes . getLength ( ) - 1 ; n >= 0 ; n -- ) { Node child = childNodes . item ( n ) ; short nodeType = child . getNodeType ( ) ; if ( nodeType == Node . ELEMENT_NODE ) { XmlUtils . clean ( child ) ; } else if ( nodeType == Node . COMMENT_NODE ) { node . removeChild ( child ) ; } else if ( nodeType == Node . TEXT_NODE ) { String value = StringUtils . trimToNull ( child . getNodeValue ( ) ) ; if ( value == null ) node . removeChild ( child ) ; else child . setNodeValue ( value ) ; } } }


Input: Count the number of nodes that are matching against an XPath expression . [CODESPLIT] public static int countNodes ( String xpathExpression , Document doc ) throws JaxenException { return XmlUtils . countNodes ( xpathExpression , doc , doc ) ; }


Input: Count the number of nodes that are matching against an XPath expression . [CODESPLIT] public static int countNodes ( String xpathExpression , Document doc , Object context ) throws JaxenException { return XmlUtils . newXPath ( xpathExpression , doc ) . selectNodes ( context ) . size ( ) ; }


Input: Return the root { @link Element } of a { @link Document } . [CODESPLIT] public static Element getRootElement ( Document doc ) { if ( doc == null ) return null ; NodeList children = doc . getChildNodes ( ) ; for ( int i = 0 ; i < children . getLength ( ) ; i ++ ) { Node node = children . item ( i ) ; if ( node instanceof Element ) return ( Element ) node ; } return null ; }


Input: Create an empty { @link Document } . [CODESPLIT] public static Document newDocument ( boolean namespaceAware ) throws ParserConfigurationException { DocumentBuilderFactory factory = DocumentBuilderFactory . newInstance ( ) ; factory . setNamespaceAware ( namespaceAware ) ; DocumentBuilder builder = factory . newDocumentBuilder ( ) ; return builder . newDocument ( ) ; }


Input: Create a { @link Document } from a XML string . [CODESPLIT] public static Document newDocument ( String xmlString ) throws SAXException , IOException , ParserConfigurationException { return XmlUtils . newDocument ( xmlString , true ) ; }


Input: Create a { @link Document } from a XML string . [CODESPLIT] public static Document newDocument ( String xmlString , boolean namespaceAware ) throws SAXException , IOException , ParserConfigurationException { return XmlUtils . newDocument ( new InputSource ( new StringReader ( xmlString ) ) , namespaceAware ) ; }


Input: Create a { @link Document } from an { @link InputSource } . [CODESPLIT] public static Document newDocument ( InputSource xmlSource ) throws SAXException , IOException , ParserConfigurationException { return XmlUtils . newDocument ( xmlSource , true ) ; }


Input: Create a { @link Document } from an { @link InputSource } . [CODESPLIT] public static Document newDocument ( InputSource xmlSource , boolean namespaceAware ) throws SAXException , IOException , ParserConfigurationException { DocumentBuilderFactory factory = DocumentBuilderFactory . newInstance ( ) ; factory . setNamespaceAware ( namespaceAware ) ; DocumentBuilder builder = factory . newDocumentBuilder ( ) ; return builder . parse ( xmlSource ) ; }


Input: Create a { @link Document } from an { @link InputStream } . [CODESPLIT] public static Document newDocument ( InputStream xmlStream ) throws SAXException , IOException , ParserConfigurationException { return XmlUtils . newDocument ( xmlStream , true ) ; }


Input: Create a { @link Document } from an { @link InputStream } . [CODESPLIT] public static Document newDocument ( InputStream xmlStream , boolean namespaceAware ) throws SAXException , IOException , ParserConfigurationException { DocumentBuilderFactory factory = DocumentBuilderFactory . newInstance ( ) ; factory . setNamespaceAware ( namespaceAware ) ; DocumentBuilder builder = factory . newDocumentBuilder ( ) ; return builder . parse ( xmlStream ) ; }


Input: Create a { @link Document } from a { @link File } . [CODESPLIT] public static Document newDocument ( File xmlFile ) throws SAXException , IOException , ParserConfigurationException { return XmlUtils . newDocument ( xmlFile , true ) ; }


Input: Create a { @link Document } from a { @link File } . [CODESPLIT] public static Document newDocument ( File xmlFile , boolean namespaceAware ) throws SAXException , IOException , ParserConfigurationException { DocumentBuilderFactory factory = DocumentBuilderFactory . newInstance ( ) ; factory . setNamespaceAware ( namespaceAware ) ; DocumentBuilder builder = factory . newDocumentBuilder ( ) ; return builder . parse ( xmlFile ) ; }


Input: Create a { @link XPath } expression . [CODESPLIT] public static XPath newXPath ( String expression ) throws JaxenException { return XmlUtils . newXPath ( expression , null , null ) ; }


Input: Create a { @link XPath } expression . [CODESPLIT] public static XPath newXPath ( String expression , Document doc ) throws JaxenException { return XmlUtils . newXPath ( expression , doc , "io" ) ; }


Input: Create a { @link XPath } expression . [CODESPLIT] public static XPath newXPath ( String expression , Document doc , String namespacePrefix ) throws JaxenException { DOMXPath xpath = new DOMXPath ( expression ) ; //LOGGER.debug( "new xpath: " + xpath.debug() ); if ( doc != null && namespacePrefix != null ) { Element root = XmlUtils . getRootElement ( doc ) ; String uri = StringUtils . trimToEmpty ( root . getNamespaceURI ( ) ) ; xpath . addNamespace ( namespacePrefix , uri ) ; } return xpath ; }


Input: Print nodes of a { @link Document } recursively to the local logger . [CODESPLIT] public static void printNodes ( Document doc ) { NodeList children = doc . getChildNodes ( ) ; for ( int i = 0 ; i < children . getLength ( ) ; i ++ ) { Node node = children . item ( i ) ; if ( node instanceof Element ) printNode ( ( Element ) node ) ; } }


Input: Replace the namespace of any { @link Element } in a { @link Document } . [CODESPLIT] public static void replaceNamespace ( Document doc , String newNamespaceURI ) { NodeList children = doc . getChildNodes ( ) ; for ( int i = 0 ; i < children . getLength ( ) ; i ++ ) { XmlUtils . replaceNamespace ( doc , children . item ( i ) , newNamespaceURI ) ; } }


Input: Replace the namespace of a { @link Node } and its children . [CODESPLIT] public static void replaceNamespace ( Document doc , Node node , String newNamespaceURI ) { if ( node instanceof Attr ) { doc . renameNode ( node , newNamespaceURI , node . getLocalName ( ) ) ; } else if ( node instanceof Element ) { doc . renameNode ( node , newNamespaceURI , node . getLocalName ( ) ) ; NodeList children = node . getChildNodes ( ) ; for ( int i = 0 ; i < children . getLength ( ) ; i ++ ) { XmlUtils . replaceNamespace ( doc , children . item ( i ) , newNamespaceURI ) ; } } }


Input: Replace all text values of a { @link Document } with CDATA values . [CODESPLIT] public static void replaceTextWithCData ( Document doc ) { NodeList children = doc . getChildNodes ( ) ; for ( int i = 0 ; i < children . getLength ( ) ; i ++ ) { XmlUtils . replaceTextWithCData ( doc , children . item ( i ) ) ; } }


Input: Replace all text values of a { @link Node } with CDATA values . [CODESPLIT] public static void replaceTextWithCData ( Document doc , Node node ) { if ( node instanceof Text ) { Text text = ( Text ) node ; CDATASection cdata = doc . createCDATASection ( text . getTextContent ( ) ) ; Element parent = ( Element ) text . getParentNode ( ) ; parent . replaceChild ( cdata , text ) ; } else if ( node instanceof Element ) { //LOGGER.debug( "ELEMENT " + element.getTagName() ); NodeList children = node . getChildNodes ( ) ; for ( int i = 0 ; i < children . getLength ( ) ; i ++ ) { //LOGGER.debug( "> " + children.item( i ).getClass().getName() ); XmlUtils . replaceTextWithCData ( doc , children . item ( i ) ) ; } } }


Input: Write a { @link Document } to a { @link File } . [CODESPLIT] public static void write ( Document doc , File file ) throws TransformerException , IOException { XmlUtils . write ( doc , file , true ) ; }


Input: Write a { @link Document } to a { @link File } . [CODESPLIT] public static void write ( Document doc , File file , boolean prettyPrint ) throws TransformerException , IOException { try ( OutputStream output = new FileOutputStream ( file ) ) { XmlUtils . write ( doc , output , prettyPrint ) ; } }


Input: Write a { @link Document } to an { @link OutputStream } . [CODESPLIT] public static void write ( Document doc , OutputStream output ) throws TransformerException { XmlUtils . write ( doc , output , true ) ; }


Input: Write a { @link Document } to a { @link Writer } . [CODESPLIT] public static void write ( Document doc , Writer output ) throws TransformerException { XmlUtils . write ( doc , output , true ) ; }


Input: Write a { @link Document } to a { @link Writer } . [CODESPLIT] public static void write ( Document doc , Writer output , boolean prettyPrint ) throws TransformerException { XmlUtils . clean ( doc ) ; Transformer transformer = TransformerFactory . newInstance ( ) . newTransformer ( ) ; transformer . setOutputProperty ( OutputKeys . OMIT_XML_DECLARATION , "no" ) ; transformer . setOutputProperty ( OutputKeys . METHOD , "xml" ) ; transformer . setOutputProperty ( OutputKeys . ENCODING , "UTF-8" ) ; transformer . setOutputProperty ( OutputKeys . STANDALONE , "yes" ) ; transformer . setOutputProperty ( OutputKeys . INDENT , ( prettyPrint ) ? "yes" : "no" ) ; if ( prettyPrint ) { transformer . setOutputProperty ( "{http://xml.apache.org/xslt}indent-amount" , "2" ) ; } transformer . transform ( new DOMSource ( doc ) , new StreamResult ( output ) ) ; }


Input: Generate XML for the contained { @link Document } . [CODESPLIT] public void toXml ( File xmlFile , boolean prettyPrint ) throws TransformerException , IOException { if ( this . isTextWrittenAsCDATA ( ) ) { XmlUtils . replaceTextWithCData ( this . getDocument ( ) ) ; } prepareDocumentBeforeWritingToXml ( this . getDocument ( ) ) ; XmlUtils . write ( this . getDocument ( ) , xmlFile , prettyPrint ) ; }


Input: Generate XML for the contained { @link Document } . [CODESPLIT] public void toXml ( OutputStream output , boolean prettyPrint ) throws TransformerException , IOException { if ( this . isTextWrittenAsCDATA ( ) ) { XmlUtils . replaceTextWithCData ( this . getDocument ( ) ) ; } prepareDocumentBeforeWritingToXml ( this . getDocument ( ) ) ; XmlUtils . write ( this . getDocument ( ) , output , prettyPrint ) ; }


Input: Returns XML for the contained { @link Document } . [CODESPLIT] public final String toXmlString ( boolean prettyPrint ) throws TransformerException , IOException { try ( StringWriter w = new StringWriter ( ) ) { this . toXml ( w , prettyPrint ) ; return w . toString ( ) ; } }


Input: Creates a { @link WisItDocument } from a { @link Document } . [CODESPLIT] public static WisItDocument createDocument ( Document doc ) { if ( WisItDocument . isReadable ( doc ) ) return new WisItDocument ( doc ) ; else return null ; }


Input: Downgrade an OpenImmo document from version 1 . 2 . 5 to 1 . 2 . 4 . [CODESPLIT] @ Override public void downgradeToPreviousVersion ( OpenImmoDocument doc ) { doc . setDocumentVersion ( OpenImmoVersion . V1_2_4 ) ; // downgrade a feedback document if ( doc instanceof OpenImmoFeedbackDocument ) { try { this . removeFeedbackObjektChildElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't remove unsupported children of <objekt> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } } // downgrade a transfer document else if ( doc instanceof OpenImmoTransferDocument ) { try { this . removeKontaktpersonChildElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't remove unsupported children of <kontaktperson> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } try { this . removeMwstGesamtElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't remove unsupported <mwst_gesamt> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } try { this . removeVerkehrswertElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't remove unsupported <verkehrswert> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } try { this . removeAnzahlLogiaElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't remove unsupported <anzahl_logia> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } try { this . removeErschliessungUmfangElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't remove unsupported <erschliessung_umfang> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } try { this . removeVerwaltungTechnChildElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't remove unsupported children of <verwaltung_techn> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } try { this . downgradeZustandElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't downgrade <zustand> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } try { this . downgradeBebaubarNachElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't downgrade <bebaubar_nach> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } try { this . downgradeErschliessungElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't downgrade <erschliessung> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } try { this . downgradeWohnungElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't downgrade <wohnung> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } try { this . downgradeHausElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't downgrade <haus> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } try { this . downgradeEnergiepassElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't downgrade <energiepass> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } } }


Input: Upgrade an OpenImmo document from version 1 . 2 . 4 to 1 . 2 . 5 . [CODESPLIT] @ Override @ SuppressWarnings ( "Duplicates" ) public void upgradeFromPreviousVersion ( OpenImmoDocument doc ) { doc . setDocumentVersion ( OpenImmoVersion . V1_2_5 ) ; if ( doc instanceof OpenImmoTransferDocument ) { try { this . upgradeEnergiepassElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't upgrade <energiepass> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } } }


Input: Downgrade &lt ; energiepass&gt ; elements to OpenImmo 1 . 2 . 4 . <p > The child elements &lt ; hwbwert&gt ; &lt ; hwbklasse&gt ; &lt ; fgeewert&gt ; &lt ; fgeeklasse&gt ; are copied into separate &lt ; user_defined_simplefield&gt ; elements as it was suggested by OpenImmo e . V .. [CODESPLIT] protected void downgradeEnergiepassElements ( Document doc ) throws JaxenException { List nodes = XmlUtils . newXPath ( "/io:openimmo/io:anbieter/io:immobilie/io:zustand_angaben/io:energiepass" , doc ) . selectNodes ( doc ) ; for ( Object item : nodes ) { Element node = ( Element ) item ; Element parentNode = ( Element ) node . getParentNode ( ) ; boolean hwbwertPassed = false ; boolean hwbklassePassed = false ; boolean fgeewertPassed = false ; boolean fgeeklassePassed = false ; List childNodes ; // create a <user_defined_simplefield> for <hwbwert> elements childNodes = XmlUtils . newXPath ( "io:hwbwert" , doc ) . selectNodes ( node ) ; for ( Object childItem : childNodes ) { Node childNode = ( Node ) childItem ; if ( ! hwbwertPassed ) { String value = StringUtils . trimToNull ( childNode . getTextContent ( ) ) ; if ( value != null ) { parentNode . appendChild ( OpenImmoUtils . createUserDefinedSimplefield ( doc , "epass_hwbwert" , value ) ) ; hwbwertPassed = true ; } } node . removeChild ( childNode ) ; } // create a <user_defined_simplefield> for <hwbklasse> elements childNodes = XmlUtils . newXPath ( "io:hwbklasse" , doc ) . selectNodes ( node ) ; for ( Object childItem : childNodes ) { Node childNode = ( Node ) childItem ; if ( ! hwbklassePassed ) { String value = StringUtils . trimToNull ( childNode . getTextContent ( ) ) ; if ( value != null ) { parentNode . appendChild ( OpenImmoUtils . createUserDefinedSimplefield ( doc , "epass_hwbklasse" , value ) ) ; hwbklassePassed = true ; } } node . removeChild ( childNode ) ; } // create a <user_defined_simplefield> for <fgeewert> elements childNodes = XmlUtils . newXPath ( "io:fgeewert" , doc ) . selectNodes ( node ) ; for ( Object childItem : childNodes ) { Node childNode = ( Node ) childItem ; if ( ! fgeewertPassed ) { String value = StringUtils . trimToNull ( childNode . getTextContent ( ) ) ; if ( value != null ) { parentNode . appendChild ( OpenImmoUtils . createUserDefinedSimplefield ( doc , "epass_fgeewert" , value ) ) ; fgeewertPassed = true ; } } node . removeChild ( childNode ) ; } // create a <user_defined_simplefield> for <baujahr> elements childNodes = XmlUtils . newXPath ( "io:fgeeklasse" , doc ) . selectNodes ( node ) ; for ( Object childItem : childNodes ) { Node childNode = ( Node ) childItem ; if ( ! fgeeklassePassed ) { String value = StringUtils . trimToNull ( childNode . getTextContent ( ) ) ; if ( value != null ) { parentNode . appendChild ( OpenImmoUtils . createUserDefinedSimplefield ( doc , "epass_fgeeklasse" , value ) ) ; fgeeklassePassed = true ; } } node . removeChild ( childNode ) ; } } }


Input: Upgrade &lt ; energiepass&gt ; elements to OpenImmo 1 . 2 . 5 . <p > The &lt ; user_defined_simplefield&gt ; elements for Austria that were suggested by OpenImmo e . V . are explicitly supported in OpenImmo 1 . 2 . 5 as child elements of &lt ; energiepass&gt ; . Any matching &lt ; user_defined_simplefield&gt ; elements are moved into the &lt ; energiepass&gt ; element . [CODESPLIT] @ SuppressWarnings ( "Duplicates" ) protected void upgradeEnergiepassElements ( Document doc ) throws JaxenException { Map < String , String > fields = new HashMap <> ( ) ; fields . put ( "hwbwert" , "user_defined_simplefield[@feldname='epass_hwbwert']" ) ; fields . put ( "hwbklasse" , "user_defined_simplefield[@feldname='epass_hwbklasse']" ) ; fields . put ( "fgeewert" , "user_defined_simplefield[@feldname='epass_fgeewert']" ) ; fields . put ( "fgeeklasse" , "user_defined_simplefield[@feldname='epass_fgeeklasse']" ) ; List nodes = XmlUtils . newXPath ( "/io:openimmo/io:anbieter/io:immobilie/io:zustand_angaben" , doc ) . selectNodes ( doc ) ; for ( Object item : nodes ) { Element node = ( Element ) item ; Element energiepassNode = ( Element ) XmlUtils . newXPath ( "io:energiepass" , doc ) . selectSingleNode ( node ) ; if ( energiepassNode == null ) { energiepassNode = doc . createElementNS ( StringUtils . EMPTY , "energiepass" ) ; } for ( Map . Entry < String , String > entry : fields . entrySet ( ) ) { boolean fieldProcessed = false ; List childNodes = XmlUtils . newXPath ( entry . getValue ( ) , doc ) . selectNodes ( node ) ; for ( Object childItem : childNodes ) { Node childNode = ( Node ) childItem ; if ( ! fieldProcessed ) { String value = StringUtils . trimToNull ( childNode . getTextContent ( ) ) ; if ( value != null ) { Element newElement = doc . createElementNS ( StringUtils . EMPTY , entry . getKey ( ) ) ; newElement . setTextContent ( value ) ; energiepassNode . appendChild ( newElement ) ; fieldProcessed = true ; } } node . removeChild ( childNode ) ; } } if ( energiepassNode . getParentNode ( ) == null && energiepassNode . hasChildNodes ( ) ) { node . appendChild ( energiepassNode ) ; } } }


Input: Sets the value of the keineAngabe property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:52:47+02:00" , comments = "JAXB RI v2.2.11" ) public void setKeineAngabe ( JAXBElement < Object > value ) { this . keineAngabe = value ; }


Input: Sets the value of the erdwaerme property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:52:47+02:00" , comments = "JAXB RI v2.2.11" ) public void setErdwaerme ( JAXBElement < Object > value ) { this . erdwaerme = value ; }


Input: Sets the value of the solarheizung property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:52:47+02:00" , comments = "JAXB RI v2.2.11" ) public void setSolarheizung ( JAXBElement < Object > value ) { this . solarheizung = value ; }


Input: Sets the value of the pelletheizung property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:52:47+02:00" , comments = "JAXB RI v2.2.11" ) public void setPelletheizung ( JAXBElement < Object > value ) { this . pelletheizung = value ; }


Input: Sets the value of the gas property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:52:47+02:00" , comments = "JAXB RI v2.2.11" ) public void setGas ( JAXBElement < Object > value ) { this . gas = value ; }


Input: Sets the value of the oel property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:52:47+02:00" , comments = "JAXB RI v2.2.11" ) public void setOel ( JAXBElement < Object > value ) { this . oel = value ; }


Input: Sets the value of the fernwaerme property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:52:47+02:00" , comments = "JAXB RI v2.2.11" ) public void setFernwaerme ( JAXBElement < Object > value ) { this . fernwaerme = value ; }


Input: Sets the value of the strom property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:52:47+02:00" , comments = "JAXB RI v2.2.11" ) public void setStrom ( JAXBElement < Object > value ) { this . strom = value ; }


Input: Sets the value of the kohle property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:52:47+02:00" , comments = "JAXB RI v2.2.11" ) public void setKohle ( JAXBElement < Object > value ) { this . kohle = value ; }


Input: Start the example application . [CODESPLIT] @ SuppressWarnings ( "Duplicates" ) public static void main ( String [ ] args ) { // init logging PropertyConfigurator . configure ( ImmobiliareItWritingExample . class . getResource ( PACKAGE + "/log4j.properties" ) ) ; // create a Feed object with some example data // this object corresponds to the <feed> root element in XML Feed feed = FACTORY . createFeed ( ) ; // append some example objects to the Feed object feed . setProperties ( FACTORY . createFeedProperties ( ) ) ; feed . getProperties ( ) . getProperty ( ) . add ( createProperty ( ) ) ; feed . getProperties ( ) . getProperty ( ) . add ( createProperty ( ) ) ; // convert the Feed object into a XML document ImmobiliareItDocument doc = null ; try { doc = ImmobiliareItDocument . newDocument ( feed ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't create XML document!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; System . exit ( 1 ) ; } // write XML document into a java.io.File try { write ( doc , File . createTempFile ( "output-" , ".xml" ) ) ; } catch ( IOException ex ) { LOGGER . error ( "Can't create temporary file!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; System . exit ( 1 ) ; } // write XML document into a java.io.OutputStream write ( doc , new NullOutputStream ( ) ) ; // write XML document into a java.io.Writer write ( doc , new NullWriter ( ) ) ; // write XML document into a string and send it to the console writeToConsole ( doc ) ; }


Input: Create a { @link Property } with some example data . [CODESPLIT] protected static Property createProperty ( ) { // create an example real estate for rent Property obj = FACTORY . createFeedPropertiesProperty ( ) ; obj . setBuildingStatus ( Status . ABITABILE ) ; obj . setCategory ( Category . COMMERCIALE ) ; obj . setDateExpiration ( Calendar . getInstance ( ) ) ; obj . setDateUpdated ( Calendar . getInstance ( ) ) ; obj . setOperation ( Operation . WRITE ) ; obj . setUniqueId ( RandomStringUtils . random ( 5 ) ) ; obj . setAgent ( FACTORY . createFeedPropertiesPropertyAgent ( ) ) ; obj . getAgent ( ) . setEmail ( "agency@test.org" ) ; obj . getAgent ( ) . setOfficeName ( "agency name" ) ; obj . setBlueprints ( FACTORY . createFeedPropertiesPropertyBlueprints ( ) ) ; obj . getBlueprints ( ) . getBlueprint ( ) . add ( createPictureExtended ( ) ) ; obj . getBlueprints ( ) . getBlueprint ( ) . add ( createPictureExtended ( ) ) ; obj . getBlueprints ( ) . getBlueprint ( ) . add ( createPictureExtended ( ) ) ; obj . setBuilding ( FACTORY . createBuilding ( ) ) ; obj . getBuilding ( ) . setCategory ( Category . COMMERCIALE ) ; obj . getBuilding ( ) . setClazz ( Clazz . SIGNORILE ) ; obj . getBuilding ( ) . setDetail ( PropertyTypeBusiness . ALBERGO ) ; obj . getBuilding ( ) . setStatus ( Status . DISCRETO ) ; obj . getBuilding ( ) . setType ( PropertyType . APPARTAMENTO ) ; obj . setExtraFeatures ( FACTORY . createFeedPropertiesPropertyExtraFeatures ( ) ) ; obj . getExtraFeatures ( ) . setAirConditioning ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . getExtraFeatures ( ) . setBalcony ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . getExtraFeatures ( ) . setBathrooms ( BigInteger . valueOf ( RandomUtils . nextLong ( 1 , 5 ) ) ) ; obj . getExtraFeatures ( ) . setBeamHeight ( BigInteger . valueOf ( RandomUtils . nextLong ( 1 , 10 ) ) ) ; obj . getExtraFeatures ( ) . setBedrooms ( BigInteger . valueOf ( RandomUtils . nextLong ( 1 , 5 ) ) ) ; obj . getExtraFeatures ( ) . setBuildYear ( RandomUtils . nextInt ( 1900 , 2000 ) ) ; obj . getExtraFeatures ( ) . setDocDescription ( "some descriptions" ) ; obj . getExtraFeatures ( ) . setDocSpecification ( "some specifications" ) ; obj . getExtraFeatures ( ) . setElevator ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . getExtraFeatures ( ) . setFloorplannerUrl ( "http://floorplanner-url.it/" ) ; obj . getExtraFeatures ( ) . setFreeConditions ( "free conditions" ) ; obj . getExtraFeatures ( ) . setFurniture ( Furniture . PARZIALMENTE_ARREDATO ) ; obj . getExtraFeatures ( ) . setGarden ( Garden . NESSUNO ) ; obj . getExtraFeatures ( ) . setHeating ( Heat . AUTONOMO ) ; obj . getExtraFeatures ( ) . setKitchen ( Kitchen . SEMI_ABITABILE ) ; obj . getExtraFeatures ( ) . setNet ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . getExtraFeatures ( ) . setNumFloors ( BigInteger . valueOf ( RandomUtils . nextLong ( 1 , 5 ) ) ) ; obj . getExtraFeatures ( ) . setOverheadCrane ( YesNoReady . READY ) ; obj . getExtraFeatures ( ) . setReception ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . getExtraFeatures ( ) . setRentContract ( Rental . LIBERO ) ; obj . getExtraFeatures ( ) . setSecurityAlarm ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . getExtraFeatures ( ) . setTerrace ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . getExtraFeatures ( ) . setVirtualTour ( "virtual tour" ) ; obj . getExtraFeatures ( ) . setAdditionalCosts ( FACTORY . createAdditionalCostsType ( ) ) ; obj . getExtraFeatures ( ) . getAdditionalCosts ( ) . setCurrency ( Currency . getInstance ( "EUR" ) ) ; obj . getExtraFeatures ( ) . getAdditionalCosts ( ) . setValue ( BigInteger . valueOf ( RandomUtils . nextLong ( 0 , 5000 ) ) ) ; obj . getExtraFeatures ( ) . setExternalArea ( FACTORY . createLandSizeType ( ) ) ; obj . getExtraFeatures ( ) . getExternalArea ( ) . setUnit ( LandSizeUnit . M2 ) ; obj . getExtraFeatures ( ) . getExternalArea ( ) . setValue ( BigInteger . valueOf ( RandomUtils . nextLong ( 50 , 5000 ) ) ) ; obj . getExtraFeatures ( ) . setFloor ( FACTORY . createFloor ( ) ) ; obj . getExtraFeatures ( ) . getFloor ( ) . setType ( Floor . FloorType . INTERMEDIO ) ; obj . getExtraFeatures ( ) . getFloor ( ) . setValue ( BigInteger . valueOf ( RandomUtils . nextLong ( 0 , 10 ) ) ) ; obj . getExtraFeatures ( ) . setGarage ( FACTORY . createBox ( ) ) ; obj . getExtraFeatures ( ) . getGarage ( ) . setType ( Box . BoxType . POSTO_AUTO ) ; obj . getExtraFeatures ( ) . getGarage ( ) . setValue ( BigInteger . valueOf ( RandomUtils . nextLong ( 0 , 10 ) ) ) ; obj . getExtraFeatures ( ) . setOfficeSize ( FACTORY . createSizeType ( ) ) ; obj . getExtraFeatures ( ) . getOfficeSize ( ) . setUnit ( SizeUnit . M2 ) ; obj . getExtraFeatures ( ) . getOfficeSize ( ) . setValue ( BigInteger . valueOf ( RandomUtils . nextLong ( 5 , 50 ) ) ) ; obj . setFeatures ( FACTORY . createFeedPropertiesPropertyFeatures ( ) ) ; obj . getFeatures ( ) . setEnergyClass ( ClassEnergy . D ) ; obj . getFeatures ( ) . setRooms ( RandomUtils . nextInt ( 1 , 5 ) ) ; obj . getFeatures ( ) . setEnergyPerformance ( FACTORY . createClassEnergyPerformance ( ) ) ; obj . getFeatures ( ) . getEnergyPerformance ( ) . setCertified ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . getFeatures ( ) . getEnergyPerformance ( ) . setUnit ( EnergyUnit . KWH_M2ANNO ) ; obj . getFeatures ( ) . getEnergyPerformance ( ) . setValue ( "energy performance" ) ; obj . getFeatures ( ) . setPrice ( FACTORY . createPriceType ( ) ) ; obj . getFeatures ( ) . getPrice ( ) . setCurrency ( Currency . getInstance ( "EUR" ) ) ; obj . getFeatures ( ) . getPrice ( ) . setReserved ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . getFeatures ( ) . getPrice ( ) . setValue ( BigInteger . valueOf ( RandomUtils . nextLong ( 500 , 5000000 ) ) ) ; obj . getFeatures ( ) . setSize ( FACTORY . createSizeType ( ) ) ; obj . getFeatures ( ) . getSize ( ) . setUnit ( SizeUnit . M2 ) ; obj . getFeatures ( ) . getSize ( ) . setValue ( BigInteger . valueOf ( RandomUtils . nextLong ( 50 , 5000 ) ) ) ; obj . setLocation ( FACTORY . createLocationStructure ( ) ) ; obj . getLocation ( ) . setAdministrativeArea ( "administrative area" ) ; obj . getLocation ( ) . setCountryCode ( "DE" ) ; obj . getLocation ( ) . setCity ( FACTORY . createLocationStructureCity ( ) ) ; obj . getLocation ( ) . getCity ( ) . setCode ( BigInteger . ZERO ) ; obj . getLocation ( ) . getCity ( ) . setValue ( "Berlin" ) ; obj . getLocation ( ) . setLocality ( FACTORY . createLocationStructureLocality ( ) ) ; obj . getLocation ( ) . getLocality ( ) . setLatitude ( BigDecimal . valueOf ( RandomUtils . nextDouble ( 0 , 90 ) ) ) ; obj . getLocation ( ) . getLocality ( ) . setLongitude ( BigDecimal . valueOf ( RandomUtils . nextDouble ( 0 , 90 ) ) ) ; obj . getLocation ( ) . getLocality ( ) . setPostalCode ( "13125" ) ; obj . getLocation ( ) . getLocality ( ) . setNeighbourhood ( FACTORY . createLocationStructureLocalityNeighbourhood ( ) ) ; obj . getLocation ( ) . getLocality ( ) . getNeighbourhood ( ) . setId ( BigInteger . ZERO ) ; obj . getLocation ( ) . getLocality ( ) . getNeighbourhood ( ) . setType ( LocationNeighbourhoodType . DISTRICT ) ; obj . getLocation ( ) . getLocality ( ) . getNeighbourhood ( ) . setValue ( "about the neighbourhood" ) ; obj . getLocation ( ) . getLocality ( ) . setThoroughfare ( FACTORY . createLocationStructureLocalityThoroughfare ( ) ) ; obj . getLocation ( ) . getLocality ( ) . getThoroughfare ( ) . setDisplay ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . getLocation ( ) . getLocality ( ) . getThoroughfare ( ) . setValue ( "about thoroughfare" ) ; obj . getLocation ( ) . setSubAdministrativeArea ( FACTORY . createLocationStructureSubAdministrativeArea ( ) ) ; obj . getLocation ( ) . getSubAdministrativeArea ( ) . setCode ( RandomStringUtils . random ( 5 ) ) ; obj . getLocation ( ) . getSubAdministrativeArea ( ) . setValue ( "Berlin" ) ; obj . setPictures ( FACTORY . createFeedPropertiesPropertyPictures ( ) ) ; obj . getPictures ( ) . getPictureUrlAndPicture ( ) . add ( createPicture ( ) ) ; obj . getPictures ( ) . getPictureUrlAndPicture ( ) . add ( createPicture ( ) ) ; obj . getPictures ( ) . getPictureUrlAndPicture ( ) . add ( createPicture ( ) ) ; obj . setPropertyType ( FACTORY . createProptype ( ) ) ; obj . getPropertyType ( ) . setBusinessType ( FACTORY . createBusinessElement ( ) ) ; obj . getPropertyType ( ) . getBusinessType ( ) . setCategory ( BusinessElement . BusinessElementCategory . IMMOBILE ) ; obj . getPropertyType ( ) . getBusinessType ( ) . setValue ( PropertyTypeBusiness . ALTRO ) ; obj . getPropertyType ( ) . setTerrains ( FACTORY . createTerrains ( ) ) ; obj . getPropertyType ( ) . getTerrains ( ) . getTerrain ( ) . add ( TerrainType . SEMINATIVO ) ; obj . getPropertyType ( ) . setType ( PropertyTypeSimple . CASA_INDIPENDENTE ) ; obj . setTransactionType ( FACTORY . createTransactionType ( ) ) ; obj . getTransactionType ( ) . setAuction ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . getTransactionType ( ) . setOwnership ( OwnershipType . PARZIALE ) ; obj . getTransactionType ( ) . setValue ( "notes about transaction" ) ; obj . setVideos ( FACTORY . createFeedPropertiesPropertyVideos ( ) ) ; obj . getVideos ( ) . getVideo ( ) . add ( createVideo ( ) ) ; obj . getVideos ( ) . getVideo ( ) . add ( createVideo ( ) ) ; return obj ; }


Input: Create a { @link PictureProject } with some example data . [CODESPLIT] protected static PictureProject createPicture ( ) { PictureProject pic = FACTORY . createPictureProject ( ) ; pic . setPosition ( BigInteger . valueOf ( RandomUtils . nextLong ( 0 , 100 ) ) ) ; pic . setValue ( "image-" + RandomUtils . nextInt ( 0 , 999 ) + ".jpg" ) ; return pic ; }


Input: Create a { @link PictureExtended } with some example data . [CODESPLIT] protected static PictureExtended createPictureExtended ( ) { PictureExtended pic = FACTORY . createPictureExtended ( ) ; pic . setPosition ( BigInteger . valueOf ( RandomUtils . nextLong ( 0 , 100 ) ) ) ; pic . setValue ( "image-" + RandomUtils . nextInt ( 0 , 999 ) + ".jpg" ) ; pic . setUrl ( "http://mywebsite.org/" + pic . getValue ( ) ) ; return pic ; }


Input: Create a { @link VideoProject } with some example data . [CODESPLIT] protected static VideoProject createVideo ( ) { VideoProject video = FACTORY . createVideoProject ( ) ; video . setType ( VideoType . LOCAL ) ; video . setValue ( "video-" + RandomUtils . nextInt ( 0 , 999 ) + ".mp4" ) ; return video ; }


Input: Generate a random string with ASCII letters and digits . [CODESPLIT] public static String random ( int length ) { return new RandomStringGenerator . Builder ( ) . filteredBy ( NUMBERS , LETTERS ) . build ( ) . generate ( length ) ; }


Input: Generate a random string with ASCII letters . [CODESPLIT] public static String randomLetters ( int length ) { return new RandomStringGenerator . Builder ( ) . filteredBy ( LETTERS ) . build ( ) . generate ( length ) ; }


Input: Generate a random string with ASCII digits . [CODESPLIT] public static String randomNumeric ( int length ) { return new RandomStringGenerator . Builder ( ) . filteredBy ( NUMBERS ) . build ( ) . generate ( length ) ; }


Input: Gets the value of the wohnungKategorie property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:52:47+02:00" , comments = "JAXB RI v2.2.11" ) public WohnungKategorienTyp getWohnungKategorie ( ) { if ( wohnungKategorie == null ) { return WohnungKategorienTyp . KEINE_ANGABE ; } else { return wohnungKategorie ; } }


Input: Sets the value of the benutzer property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:55:50+02:00" , comments = "JAXB RI v2.2.11" ) public void setBENUTZER ( WIS . BENUTZER value ) { this . benutzer = value ; }


Input: Sets the value of the objekte property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:55:50+02:00" , comments = "JAXB RI v2.2.11" ) public void setOBJEKTE ( WIS . OBJEKTE value ) { this . objekte = value ; }


Input: Gets the value of the feed property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:41:42+02:00" , comments = "JAXB RI v2.2.11" ) public List < Feedindex . Feed > getFeed ( ) { if ( feed == null ) { feed = new ArrayList < Feedindex . Feed > ( ) ; } return this . feed ; }


Input: Sets the value of the moeb property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:54:50+02:00" , comments = "JAXB RI v2.2.11" ) public void setMoeb ( Moebliert . Moeb value ) { this . moeb = value ; }


Input: Gets the value of the serviceleistungen property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:50:55+02:00" , comments = "JAXB RI v2.2.11" ) public List < Serviceleistungen > getServiceleistungen ( ) { if ( serviceleistungen == null ) { serviceleistungen = new ArrayList < Serviceleistungen > ( ) ; } return this . serviceleistungen ; }


Input: Creates a { @link Is24XmlDocument } from a { @link ImmobilienTransferTyp } object . [CODESPLIT] public static Is24XmlDocument newDocument ( ImmobilienTransferTyp transfer ) throws ParserConfigurationException , JAXBException { return newDocument ( Is24XmlUtils . getFactory ( ) . createIS24ImmobilienTransfer ( transfer ) ) ; }


Input: Creates a { @link Is24XmlDocument } from a { @link ImmobilienTransferTyp } object . [CODESPLIT] public static Is24XmlDocument newDocument ( IS24ImmobilienTransfer transfer ) throws ParserConfigurationException , JAXBException { Document document = XmlUtils . newDocument ( ) ; Is24XmlUtils . createMarshaller ( "UTF-8" , true ) . marshal ( transfer , document ) ; return new Is24XmlDocument ( document ) ; }


Input: Creates a { @link ImmobilienTransferTyp } object from the contained { @link Document } . [CODESPLIT] @ Override public ImmobilienTransferTyp toObject ( ) throws JAXBException { return ( ( IS24ImmobilienTransfer ) Is24XmlUtils . createUnmarshaller ( ) . unmarshal ( this . getDocument ( ) ) ) . getValue ( ) ; }


Input: Sets the value of the subAdministrativeArea property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:48:12+02:00" , comments = "JAXB RI v2.2.11" ) public void setSubAdministrativeArea ( LocationStructure . SubAdministrativeArea value ) { this . subAdministrativeArea = value ; }


Input: Sets the value of the city property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:48:12+02:00" , comments = "JAXB RI v2.2.11" ) public void setCity ( LocationStructure . City value ) { this . city = value ; }


Input: Sets the value of the locality property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:48:12+02:00" , comments = "JAXB RI v2.2.11" ) public void setLocality ( LocationStructure . Locality value ) { this . locality = value ; }


Input: Downgrade an OpenImmo document from version 1 . 2 . 1 to 1 . 2 . 0 . [CODESPLIT] @ Override public void downgradeToPreviousVersion ( OpenImmoDocument doc ) { doc . setDocumentVersion ( OpenImmoVersion . V1_2_0 ) ; if ( doc instanceof OpenImmoTransferDocument ) { try { this . removeObjektartZusatzElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't remove <objektart_zusatz> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } try { this . downgradeEnergiepassElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't downgrade <energiepass> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } try { this . downgradeHausElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't downgrade <haus> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } } try { this . downgradeXmlNamespace ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't downgrade the XML namespace!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } }


Input: Upgrade an OpenImmo document from version 1 . 2 . 0 to 1 . 2 . 1 . [CODESPLIT] @ Override @ SuppressWarnings ( "Duplicates" ) public void upgradeFromPreviousVersion ( OpenImmoDocument doc ) { doc . setDocumentVersion ( OpenImmoVersion . V1_2_1 ) ; if ( doc instanceof OpenImmoTransferDocument ) { try { this . upgradeEnergiepassElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't upgrade <energiepass> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } } try { this . upgradeXmlNamespace ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't upgrade the XML namespace!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } }


Input: Downgrade &lt ; energiepass&gt ; elements to OpenImmo 1 . 2 . 0 . <p > The &lt ; mitwarmwasser&gt ; child element of the &lt ; energiepass&gt ; element is not available in version 1 . 2 . 0 . <p > The &lt ; energieverbrauchkennwert&gt ; &lt ; endenergiebedarf&gt ; child elements of the &lt ; energiepass&gt ; element are moved into &lt ; energiebedarf&gt ; and &lt ; skala&gt ; in version 1 . 2 . 0 . [CODESPLIT] protected void downgradeEnergiepassElements ( Document doc ) throws JaxenException { List nodes = XmlUtils . newXPath ( "/io:openimmo/io:anbieter/io:immobilie/io:zustand_angaben/io:energiepass" , doc ) . selectNodes ( doc ) ; for ( Object item : nodes ) { Element parentNode = ( Element ) item ; boolean skalaProcessed = false ; String artValue = XmlUtils . newXPath ( "io:art/text()" , doc ) . stringValueOf ( parentNode ) ; List childNodes = XmlUtils . newXPath ( "io:mitwarmwasser" , doc ) . selectNodes ( parentNode ) ; for ( Object child : childNodes ) { Node childNode = ( Node ) child ; childNode . getParentNode ( ) . removeChild ( childNode ) ; } childNodes = XmlUtils . newXPath ( "io:energieverbrauchkennwert" , doc ) . selectNodes ( parentNode ) ; for ( Object childItem : childNodes ) { Node childNode = ( Node ) childItem ; String childValue = StringUtils . trimToNull ( childNode . getTextContent ( ) ) ; if ( ! skalaProcessed && "VERBRAUCH" . equalsIgnoreCase ( artValue ) && childValue != null ) { skalaProcessed = true ; Element skalaNode = doc . createElementNS ( OpenImmoUtils . OLD_NAMESPACE , "skala" ) ; skalaNode . setAttribute ( "type" , "ZAHL" ) ; skalaNode . setTextContent ( childValue ) ; parentNode . appendChild ( skalaNode ) ; } childNode . getParentNode ( ) . removeChild ( childNode ) ; } childNodes = XmlUtils . newXPath ( "io:endenergiebedarf" , doc ) . selectNodes ( parentNode ) ; for ( Object childItem : childNodes ) { Node childNode = ( Node ) childItem ; String childValue = StringUtils . trimToNull ( childNode . getTextContent ( ) ) ; if ( ! skalaProcessed && "BEDARF" . equalsIgnoreCase ( artValue ) && childValue != null ) { skalaProcessed = true ; Element skalaNode = doc . createElementNS ( OpenImmoUtils . OLD_NAMESPACE , "skala" ) ; skalaNode . setAttribute ( "type" , "ZAHL" ) ; skalaNode . setTextContent ( childValue ) ; parentNode . appendChild ( skalaNode ) ; Element newNode = doc . createElementNS ( OpenImmoUtils . OLD_NAMESPACE , "energiebedarf" ) ; newNode . setTextContent ( childValue ) ; parentNode . appendChild ( newNode ) ; } childNode . getParentNode ( ) . removeChild ( childNode ) ; } } }


Input: Upgrade &lt ; energiepass&gt ; elements to OpenImmo 1 . 2 . 1 . <p > Make sure that a valid value for &lt ; art&gt ; is used . <p > Remove unsupported &lt ; heizwert&gt ; element . <p > Replace &lt ; energiebedarf&gt ; &lt ; skala&gt ; with &lt ; energieverbrauchkennwert&gt ; or &lt ; endenergiebedarf&gt ; according to the provided &lt ; art&gt ; . [CODESPLIT] protected void upgradeEnergiepassElements ( Document doc ) throws JaxenException { List nodes = XmlUtils . newXPath ( "/io:openimmo/io:anbieter/io:immobilie/io:zustand_angaben/io:energiepass" , doc ) . selectNodes ( doc ) ; for ( Object item : nodes ) { Element parentNode = ( Element ) item ; String energiebedarfValue = null ; String skalaValue = null ; Element artNode = ( Element ) XmlUtils . newXPath ( "io:art" , doc ) . selectSingleNode ( parentNode ) ; String artValue = ( artNode != null ) ? StringUtils . trimToNull ( artNode . getTextContent ( ) ) : null ; List childNodes = XmlUtils . newXPath ( "io:heizwert" , doc ) . selectNodes ( parentNode ) ; for ( Object childItem : childNodes ) { Node childNode = ( Node ) childItem ; childNode . getParentNode ( ) . removeChild ( childNode ) ; } childNodes = XmlUtils . newXPath ( "io:energiebedarf" , doc ) . selectNodes ( parentNode ) ; for ( Object childItem : childNodes ) { Node childNode = ( Node ) childItem ; if ( energiebedarfValue == null ) energiebedarfValue = StringUtils . trimToNull ( childNode . getTextContent ( ) ) ; childNode . getParentNode ( ) . removeChild ( childNode ) ; } childNodes = XmlUtils . newXPath ( "io:skala" , doc ) . selectNodes ( parentNode ) ; for ( Object childItem : childNodes ) { Element childNode = ( Element ) childItem ; if ( skalaValue == null && "ZAHL" . equalsIgnoreCase ( childNode . getAttribute ( "type" ) ) ) skalaValue = StringUtils . trimToNull ( childNode . getTextContent ( ) ) ; childNode . getParentNode ( ) . removeChild ( childNode ) ; } if ( artNode != null && "VERBRAUCH" . equalsIgnoreCase ( artValue ) ) { artNode . setTextContent ( "VERBRAUCH" ) ; String value = skalaValue ; if ( value != null ) { Element newNode = doc . createElementNS ( StringUtils . EMPTY , "energieverbrauchkennwert" ) ; newNode . setTextContent ( value ) ; parentNode . appendChild ( newNode ) ; } } else if ( artNode != null && "BEDARF" . equalsIgnoreCase ( artValue ) ) { artNode . setTextContent ( "BEDARF" ) ; String value = ( energiebedarfValue != null ) ? energiebedarfValue : skalaValue ; if ( value != null ) { Element newNode = doc . createElementNS ( StringUtils . EMPTY , "endenergiebedarf" ) ; newNode . setTextContent ( value ) ; parentNode . appendChild ( newNode ) ; } } } }


Input: Sets the value of the miete property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:52:47+02:00" , comments = "JAXB RI v2.2.11" ) public void setMiete ( VermarktungGewerbeTyp2 . Miete value ) { this . miete = value ; }


Input: Sets the value of the kauf property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:52:47+02:00" , comments = "JAXB RI v2.2.11" ) public void setKauf ( JAXBElement < Object > value ) { this . kauf = value ; }


Input: Sets the value of the landTyp property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:54:50+02:00" , comments = "JAXB RI v2.2.11" ) public void setLandTyp ( LandUndForstwirtschaft . LandTyp value ) { this . landTyp = value ; }


Input: Gets the value of the field property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:42:33+02:00" , comments = "JAXB RI v2.2.11" ) public List < MetaDataType . FIELD > getFIELD ( ) { if ( field == null ) { field = new ArrayList < MetaDataType . FIELD > ( ) ; } return this . field ; }


Input: Start the example application . [CODESPLIT] @ SuppressWarnings ( "Duplicates" ) public static void main ( String [ ] args ) { // init logging PropertyConfigurator . configure ( Is24XmlWritingExample . class . getResource ( PACKAGE + "/log4j.properties" ) ) ; // create a ImmobilienTransferTyp object with some example data // this object corresponds to the <IS24ImmobilienTransfer> root element in XML ImmobilienTransferTyp transfer = FACTORY . createImmobilienTransferTyp ( ) ; transfer . setEmailBeiFehler ( "test@test.org" ) ; transfer . setErstellerSoftware ( "OpenEstate-IO" ) ; transfer . setErstellerSoftwareVersion ( "1.4" ) ; transfer . setAnbieter ( createAnbieter ( ) ) ; // convert the ImmobilienTransferTyp object into a XML document Is24XmlDocument doc = null ; try { doc = Is24XmlDocument . newDocument ( transfer ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't create XML document!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; System . exit ( 1 ) ; } // write XML document into a java.io.File try { write ( doc , File . createTempFile ( "output-" , ".xml" ) ) ; } catch ( IOException ex ) { LOGGER . error ( "Can't create temporary file!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; System . exit ( 1 ) ; } // write XML document into a java.io.OutputStream write ( doc , new NullOutputStream ( ) ) ; // write XML document into a java.io.Writer write ( doc , new NullWriter ( ) ) ; // write XML document into a string and send it to the console writeToConsole ( doc ) ; }


Input: Create an { @link Anbieter } with some example data . [CODESPLIT] protected static Anbieter createAnbieter ( ) { // create an example agency Anbieter anbieter = FACTORY . createImmobilienTransferTypAnbieter ( ) ; anbieter . setScoutKundenID ( "123456" ) ; // add some real estates to the agency anbieter . getImmobilie ( ) . add ( createImmobilieHausKauf ( ) ) ; anbieter . getImmobilie ( ) . add ( createImmobilieHausKauf ( ) ) ; anbieter . getImmobilie ( ) . add ( createImmobilieHausMiete ( ) ) ; anbieter . getImmobilie ( ) . add ( createImmobilieHausMiete ( ) ) ; return anbieter ; }


Input: Create an { @link HausKauf } with some example data . [CODESPLIT] protected static HausKauf createImmobilieHausKauf ( ) { // create an example real estate HausKauf . Type obj = FACTORY . createHausKaufType ( ) ; initImmobilie ( obj ) ; obj . setAlsFerienwohnungGeeignet ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . setAnzahlBadezimmer ( RandomUtils . nextLong ( 1 , 5 ) ) ; obj . setAnzahlGaragenStellplaetze ( RandomUtils . nextLong ( 0 , 3 ) ) ; obj . setAnzahlSchlafzimmer ( RandomUtils . nextLong ( 1 , 5 ) ) ; obj . setAusstattungsqualitaet ( AusstattungsqualitaetsTyp . LUXUS ) ; obj . setBarrierefrei ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . setBaujahr ( RandomUtils . nextLong ( 1900 , 2010 ) ) ; obj . setBauphase ( BauphaseTyp . HAUS_FERTIG_GESTELLT ) ; obj . setDenkmalschutzobjekt ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . setEtagenzahl ( RandomUtils . nextLong ( 1 , 10 ) ) ; obj . setFreiAb ( "notes about availability" ) ; obj . setGaesteWC ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . setGrundstuecksFlaeche ( BigDecimal . valueOf ( RandomUtils . nextDouble ( 100 , 1500 ) ) ) ; obj . setHausKategorie ( HausKategorienTyp . MEHRFAMILIENHAUS ) ; obj . setHeizungsart ( HeizungsartTyp . ETAGENHEIZUNG ) ; obj . setJahrLetzteModernisierung ( RandomUtils . nextLong ( 1980 , 2000 ) ) ; obj . setKeller ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . setMitEinliegerwohnung ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . setNutzflaeche ( BigDecimal . valueOf ( RandomUtils . nextDouble ( 100 , 1000 ) ) ) ; obj . setObjektzustand ( ObjektZustandTyp . NEUWERTIG ) ; obj . setParkplatz ( StellplatzKategorieTyp . TIEFGARAGE ) ; obj . setRollstuhlgerecht ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . setVermietet ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . setWohnflaeche ( BigDecimal . valueOf ( RandomUtils . nextDouble ( 50 , 500 ) ) ) ; obj . setZimmer ( BigDecimal . valueOf ( RandomUtils . nextDouble ( 1 , 10 ) ) ) ; obj . setBefeuerungsArt ( FACTORY . createBefeuerungsArtTyp ( ) ) ; obj . getBefeuerungsArt ( ) . setOel ( FACTORY . createBefeuerungsArtTypOel ( Boolean . TRUE ) ) ; obj . getBefeuerungsArt ( ) . setGas ( FACTORY . createBefeuerungsArtTypGas ( Boolean . TRUE ) ) ; obj . setEnergieausweis ( FACTORY . createEnergieausweisTyp ( ) ) ; obj . getEnergieausweis ( ) . setEnergieausweistyp ( EnergieausweistypTyp . ENERGIEVERBRAUCHSKENNWERT ) ; obj . getEnergieausweis ( ) . setEnergieverbrauchskennwert ( BigDecimal . valueOf ( RandomUtils . nextDouble ( 50 , 500 ) ) ) ; obj . getEnergieausweis ( ) . setWarmwasserEnthalten ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . setKaufpreise ( FACTORY . createVermarktungWohnKaufTyp ( ) ) ; obj . getKaufpreise ( ) . setKaufpreis ( BigDecimal . valueOf ( RandomUtils . nextDouble ( 100000 , 9999999 ) ) ) ; obj . getKaufpreise ( ) . setMieteinnahmenProMonat ( BigDecimal . valueOf ( RandomUtils . nextDouble ( 5000 , 50000 ) ) ) ; obj . getKaufpreise ( ) . setStellplatzKaufpreis ( BigDecimal . valueOf ( RandomUtils . nextDouble ( 1000 , 10000 ) ) ) ; obj . getKaufpreise ( ) . setWohngeld ( BigDecimal . valueOf ( RandomUtils . nextDouble ( 500 , 5000 ) ) ) ; return FACTORY . createHausKauf ( obj ) ; }


Input: Create an { @link HausMiete } with some example data . [CODESPLIT] protected static HausMiete createImmobilieHausMiete ( ) { // create an example real estate HausMiete . Type obj = FACTORY . createHausMieteType ( ) ; initImmobilie ( obj ) ; obj . setAnzahlBadezimmer ( RandomUtils . nextLong ( 1 , 5 ) ) ; obj . setAnzahlGaragenStellplaetze ( RandomUtils . nextLong ( 0 , 3 ) ) ; obj . setAnzahlSchlafzimmer ( RandomUtils . nextLong ( 1 , 5 ) ) ; obj . setAusstattungsqualitaet ( AusstattungsqualitaetsTyp . GEHOBEN ) ; obj . setBarrierefrei ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . setBaujahr ( RandomUtils . nextLong ( 1900 , 2010 ) ) ; obj . setBetreutesWohnen ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . setEinbaukueche ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . setEtagenzahl ( RandomUtils . nextLong ( 1 , 10 ) ) ; obj . setFreiAb ( "notes about availability" ) ; obj . setGaesteWC ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . setGrundstuecksFlaeche ( BigDecimal . valueOf ( RandomUtils . nextDouble ( 100 , 1500 ) ) ) ; obj . setHausKategorie ( HausKategorienTyp . EINFAMILIENHAUS ) ; obj . setHaustiere ( GenehmigungTyp . NACH_VEREINBARUNG ) ; obj . setHeizungsart ( HeizungsartTyp . ZENTRALHEIZUNG ) ; obj . setJahrLetzteModernisierung ( RandomUtils . nextLong ( 1980 , 2000 ) ) ; obj . setKeller ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . setNutzflaeche ( BigDecimal . valueOf ( RandomUtils . nextDouble ( 150 , 500 ) ) ) ; obj . setObjektzustand ( ObjektZustandTyp . GEPFLEGT ) ; obj . setParkplatz ( StellplatzKategorieTyp . CARPORT ) ; obj . setRollstuhlgerecht ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . setWohnflaeche ( BigDecimal . valueOf ( RandomUtils . nextDouble ( 50 , 300 ) ) ) ; obj . setZimmer ( BigDecimal . valueOf ( RandomUtils . nextDouble ( 1 , 5 ) ) ) ; obj . setBefeuerungsArt ( FACTORY . createBefeuerungsArtTyp ( ) ) ; obj . getBefeuerungsArt ( ) . setErdwaerme ( FACTORY . createBefeuerungsArtTypErdwaerme ( Boolean . TRUE ) ) ; obj . getBefeuerungsArt ( ) . setPelletheizung ( FACTORY . createBefeuerungsArtTypPelletheizung ( Boolean . TRUE ) ) ; obj . setEnergieausweis ( FACTORY . createEnergieausweisTyp ( ) ) ; obj . getEnergieausweis ( ) . setEnergieausweistyp ( EnergieausweistypTyp . ENERGIEVERBRAUCHSKENNWERT ) ; obj . getEnergieausweis ( ) . setEnergieverbrauchskennwert ( BigDecimal . valueOf ( RandomUtils . nextDouble ( 50 , 500 ) ) ) ; obj . getEnergieausweis ( ) . setWarmwasserEnthalten ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . setMietpreise ( FACTORY . createVermarktungWohnMieteTyp ( ) ) ; obj . getMietpreise ( ) . setHeizkosten ( BigDecimal . valueOf ( RandomUtils . nextDouble ( 100 , 500 ) ) ) ; obj . getMietpreise ( ) . setHeizkostenInWarmmieteEnthalten ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . getMietpreise ( ) . setKaltmiete ( BigDecimal . valueOf ( RandomUtils . nextDouble ( 150 , 1500 ) ) ) ; obj . getMietpreise ( ) . setKaution ( "notes about deposit" ) ; obj . getMietpreise ( ) . setNebenkosten ( BigDecimal . valueOf ( RandomUtils . nextDouble ( 50 , 500 ) ) ) ; obj . getMietpreise ( ) . setStellplatzMiete ( BigDecimal . valueOf ( RandomUtils . nextDouble ( 50 , 500 ) ) ) ; obj . getMietpreise ( ) . setWarmmiete ( BigDecimal . valueOf ( RandomUtils . nextDouble ( 250 , 2500 ) ) ) ; return FACTORY . createHausMiete ( obj ) ; }


Input: Create an instance of { @link Feed . Projects . Project . Lots . Lot } [CODESPLIT] public Feed . Projects . Project . Lots . Lot createFeedProjectsProjectLotsLot ( ) { return new Feed . Projects . Project . Lots . Lot ( ) ; }


Input: Create an instance of { @link Feed . Projects . Project . Agent . SalesOffice } [CODESPLIT] public Feed . Projects . Project . Agent . SalesOffice createFeedProjectsProjectAgentSalesOffice ( ) { return new Feed . Projects . Project . Agent . SalesOffice ( ) ; }