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


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


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


Input: Downgrade an OpenImmo document from version 1 . 2 . 0 to 1 . 1 . [CODESPLIT] @ Override public void downgradeToPreviousVersion ( OpenImmoDocument doc ) { doc . setDocumentVersion ( OpenImmoVersion . V1_1 ) ; if ( doc instanceof OpenImmoTransferDocument ) { try { this . downgradeUebertragungElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't downgrade <uebertragung> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } try { this . removeUserDefinedExtendElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't remove <user_defined_extend> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } try { this . removeAnbieterChildElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't remove unsupported children of <anbieter> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } try { this . removeBieterverfahrenElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't remove <bieterverfahren> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } try { this . removeBewertungElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't remove <bewertung> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } try { this . removeGeoChildElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't remove unsupported children of <geo> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } try { this . removeHeizkostenEnthaltenElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't remove <heizkosten_enthalten> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } try { this . removeAusstattungChildElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't remove unsupported children of <ausstattung> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } try { this . removeEnergiepassElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't remove <energiepass> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } try { this . downgradeMieteinnahmenElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't downgrade <mieteinnahmen_ist> and <mieteinnahmen_soll> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } try { this . downgradeBefeuerungElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't downgrade <befeuerung> 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 ) ; } } }


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


Input: Downgrade &lt ; mieteinnahmen_ist&gt ; &lt ; mieteinnahmen_soll&gt ; elements to OpenImmo 1 . 1 . <p > The periode attribute of the &lt ; mieteinnahmen_ist&gt ; and &lt ; mieteinnahmen_soll&gt ; elements is not available in version 1 . 1 . <p > Any occurences of these values is removed . <p > The numeric value within the &lt ; mieteinnahmen_ist&gt ; and &lt ; mieteinnahmen_soll&gt ; elements is converted according to the value of the periode attribute . [CODESPLIT] protected void downgradeMieteinnahmenElements ( Document doc ) throws JaxenException { List nodes = XmlUtils . newXPath ( "/io:openimmo/io:anbieter/io:immobilie/io:preise/io:mieteinnahmen_ist[@periode] |" + "/io:openimmo/io:anbieter/io:immobilie/io:preise/io:mieteinnahmen_soll[@periode]" , doc ) . selectNodes ( doc ) ; for ( Object item : nodes ) { Element node = ( Element ) item ; String value = StringUtils . trimToNull ( node . getTextContent ( ) ) ; Double numericValue = null ; try { numericValue = ( value != null ) ? DatatypeConverter . parseDouble ( value ) : null ; } catch ( Exception ex ) { String tagName = node . getTagName ( ) ; LOGGER . warn ( "Can't parse <" + tagName + ">" + value + "</" + tagName + "> as number!" ) ; LOGGER . warn ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } if ( numericValue != null && numericValue > 0 ) { String periode = StringUtils . trimToNull ( node . getAttribute ( "periode" ) ) ; if ( "MONAT" . equalsIgnoreCase ( periode ) ) { node . setTextContent ( DatatypeConverter . printDouble ( numericValue * 12 ) ) ; } else if ( "WOCHE" . equalsIgnoreCase ( periode ) ) { node . setTextContent ( DatatypeConverter . printDouble ( numericValue * 52 ) ) ; } else if ( "TAG" . equalsIgnoreCase ( periode ) ) { node . setTextContent ( DatatypeConverter . printDouble ( numericValue * 365 ) ) ; } } node . removeAttribute ( "periode" ) ; } }


Input: Remove unsupported children from all &lt ; ausstattung&gt ; elements . <p > OpenImmo 1 . 1 does not support the following children for &lt ; ausstattung&gt ; elements : &lt ; dvbt&gt ; &lt ; breitband_zugang&gt ; &lt ; umts_empfang&gt ; &lt ; abstellraum&gt ; &lt ; fahrradraum&gt ; &lt ; rolladen&gt ; <p > These elements are removed by this function . [CODESPLIT] protected void removeAusstattungChildElements ( Document doc ) throws JaxenException { List nodes = XmlUtils . newXPath ( "/io:openimmo/io:anbieter/io:immobilie/io:ausstattung/io:dvbt | " + "/io:openimmo/io:anbieter/io:immobilie/io:ausstattung/io:breitband_zugang | " + "/io:openimmo/io:anbieter/io:immobilie/io:ausstattung/io:umts_empfang | " + "/io:openimmo/io:anbieter/io:immobilie/io:ausstattung/io:abstellraum | " + "/io:openimmo/io:anbieter/io:immobilie/io:ausstattung/io:fahrradraum | " + "/io:openimmo/io:anbieter/io:immobilie/io:ausstattung/io:rolladen" , doc ) . selectNodes ( doc ) ; for ( Object item : nodes ) { Element node = ( Element ) item ; Element parentNode = ( Element ) node . getParentNode ( ) ; parentNode . removeChild ( node ) ; } }


Input: Upgrade &lt ; mieteinnahmen_ist&gt ; &lt ; mieteinnahmen_soll&gt ; elements to OpenImmo 1 . 2 . 0 . <p > The periode attribute with the value JAHR is added to any &lt ; mieteinnahmen_ist&gt ; and &lt ; mieteinnahmen_soll&gt ; elements . [CODESPLIT] protected void upgradeMieteinnahmenElements ( Document doc ) throws JaxenException { List nodes = XmlUtils . newXPath ( "/io:openimmo/io:anbieter/io:immobilie/io:preise/io:mieteinnahmen_ist |" + "/io:openimmo/io:anbieter/io:immobilie/io:preise/io:mieteinnahmen_soll" , doc ) . selectNodes ( doc ) ; for ( Object item : nodes ) { Element node = ( Element ) item ; node . setAttribute ( "periode" , "JAHR" ) ; } }


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


Input: Sets the value of the gastgewTyp 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 setGastgewTyp ( Gastgewerbe . GastgewTyp value ) { this . gastgewTyp = value ; }


Input: Sets the value of the platzart 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 setPlatzart ( StpSonstige . Platzart value ) { this . platzart = value ; }


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


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


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


Input: Gets the value of the image property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T01:43:04+02:00" , comments = "JAXB RI v2.2.11" ) public List < ImagesType . Image > getImage ( ) { if ( image == null ) { image = new ArrayList < ImagesType . Image > ( ) ; } return this . image ; }


Input: Start the example application . [CODESPLIT] @ SuppressWarnings ( "Duplicates" ) public static void main ( String [ ] args ) { // init logging PropertyConfigurator . configure ( CasaItWritingExample . class . getResource ( PACKAGE + "/log4j.properties" ) ) ; // create a Container object with some example data // this object corresponds to the <container> root element in XML Container container = FACTORY . createContainer ( ) ; container . setRealestateitems ( FACTORY . createContainerRealestateitems ( ) ) ; // append some example objects to the Container object container . getRealestateitems ( ) . getRealestate ( ) . add ( createRealestate ( ) ) ; container . getRealestateitems ( ) . getRealestate ( ) . add ( createRealestate ( ) ) ; container . getRealestateitems ( ) . getRealestate ( ) . add ( createRealestate ( ) ) ; // convert the Container object into a XML document CasaItDocument doc = null ; try { doc = CasaItDocument . newDocument ( container ) ; } 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 Realestate } with some example data . [CODESPLIT] protected static Realestate createRealestate ( ) { // create an example real estate Realestate obj = FACTORY . createContainerRealestateitemsRealestate ( ) ; obj . setAction ( BigInteger . ONE ) ; obj . setAgencycode ( 0 ) ; obj . setBathrooms ( BigInteger . valueOf ( RandomUtils . nextLong ( 1 , 5 ) ) ) ; obj . setCondition ( BigInteger . ONE ) ; obj . setContracttype ( BigInteger . ONE ) ; obj . setFloor ( BigInteger . valueOf ( RandomUtils . nextLong ( 1 , 5 ) ) ) ; obj . setHasbalcony ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . setHasterrace ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . setHeatingtype ( BigInteger . ONE ) ; obj . setHousetypology ( BigInteger . ONE ) ; obj . setOccupationstate ( BigInteger . ONE ) ; obj . setRealestatetype ( BigInteger . ONE ) ; obj . setReference ( RandomStringUtils . random ( 5 ) ) ; obj . setReferenceID ( RandomUtils . nextInt ( 1 , 1000 ) ) ; obj . setRooms ( BigInteger . valueOf ( RandomUtils . nextLong ( 1 , 10 ) ) ) ; obj . setSize ( BigInteger . valueOf ( RandomUtils . nextLong ( 50 , 5000 ) ) ) ; obj . setAddress ( FACTORY . createContainerRealestateitemsRealestateAddress ( ) ) ; obj . getAddress ( ) . setCity ( "Berlin" ) ; obj . getAddress ( ) . setNumber ( "123" ) ; obj . getAddress ( ) . setStreet ( "example street" ) ; obj . getAddress ( ) . setZip ( "12345" ) ; obj . getAddress ( ) . setZone ( "Berlin" ) ; obj . setBox ( FACTORY . createContainerRealestateitemsRealestateBox ( ) ) ; obj . getBox ( ) . setSize ( BigInteger . valueOf ( RandomUtils . nextLong ( 50 , 1000 ) ) ) ; obj . getBox ( ) . setType ( BigInteger . ONE ) ; obj . setBuilding ( FACTORY . createContainerRealestateitemsRealestateBuilding ( ) ) ; obj . getBuilding ( ) . setAge ( BigInteger . valueOf ( RandomUtils . nextLong ( 5 , 50 ) ) ) ; obj . getBuilding ( ) . setExpenses ( BigDecimal . valueOf ( RandomUtils . nextDouble ( 1000 , 1000000 ) ) ) ; obj . getBuilding ( ) . setHaslift ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . getBuilding ( ) . setTotalfloors ( BigInteger . valueOf ( RandomUtils . nextLong ( 1 , 5 ) ) ) ; obj . getBuilding ( ) . setUnits ( BigInteger . ONE ) ; obj . setConfiguration ( FACTORY . createContainerRealestateitemsRealestateConfiguration ( ) ) ; obj . getConfiguration ( ) . setIsaddressvisibleonsite ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . getConfiguration ( ) . setIsmapvisible ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . getConfiguration ( ) . setIsrealestatevisibleonmap ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; obj . setDescription ( FACTORY . createContainerRealestateitemsRealestateDescription ( ) ) ; obj . getDescription ( ) . setValue ( "a nice little description for the object" ) ; obj . setGarden ( FACTORY . createContainerRealestateitemsRealestateGarden ( ) ) ; obj . getGarden ( ) . setSize ( BigInteger . valueOf ( RandomUtils . nextLong ( 10 , 100 ) ) ) ; obj . getGarden ( ) . setType ( BigInteger . ONE ) ; obj . setGooglemapcoordinate ( FACTORY . createContainerRealestateitemsRealestateGooglemapcoordinate ( ) ) ; obj . getGooglemapcoordinate ( ) . setLatitude ( BigDecimal . valueOf ( RandomUtils . nextDouble ( 0 , 90 ) ) ) ; obj . getGooglemapcoordinate ( ) . setLatitudemapcenter ( BigDecimal . valueOf ( RandomUtils . nextDouble ( 0 , 90 ) ) ) ; obj . getGooglemapcoordinate ( ) . setLongitude ( BigDecimal . valueOf ( RandomUtils . nextDouble ( 0 , 90 ) ) ) ; obj . getGooglemapcoordinate ( ) . setLongitudemapcenter ( BigDecimal . valueOf ( RandomUtils . nextDouble ( 0 , 90 ) ) ) ; obj . getGooglemapcoordinate ( ) . setMapzoom ( 10 ) ; obj . setImages ( FACTORY . createContainerRealestateitemsRealestateImages ( ) ) ; obj . getImages ( ) . getAdvertismentimage ( ) . add ( createAdvertismentimage ( ) ) ; obj . getImages ( ) . getAdvertismentimage ( ) . add ( createAdvertismentimage ( ) ) ; obj . getImages ( ) . getAdvertismentimage ( ) . add ( createAdvertismentimage ( ) ) ; obj . setPrice ( FACTORY . createContainerRealestateitemsRealestatePrice ( ) ) ; obj . getPrice ( ) . setMax ( BigDecimal . valueOf ( RandomUtils . nextDouble ( 1000 , 1000000 ) ) ) ; obj . getPrice ( ) . setMin ( BigDecimal . valueOf ( RandomUtils . nextDouble ( 1000 , 1000000 ) ) ) ; obj . getPrice ( ) . setValue ( BigDecimal . valueOf ( RandomUtils . nextDouble ( 1000 , 1000000 ) ) ) ; return obj ; }


Input: Create an { @link Advertismentimage } with some example data . [CODESPLIT] protected static Advertismentimage createAdvertismentimage ( ) { Advertismentimage img = FACTORY . createContainerRealestateitemsRealestateImagesAdvertismentimage ( ) ; img . setImagetype ( "image/jpeg" ) ; img . setPath ( "image-" + RandomStringUtils . randomNumeric ( 3 ) + ".jpg" ) ; return img ; }


Input: Sets the value of the priceType property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:41:42+02:00" , comments = "JAXB RI v2.2.11" ) public void setPriceType ( OverseasSaleAdType . PriceType value ) { this . priceType = value ; }


Input: Sets the value of the newDevelopmentAvailability property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:41:42+02:00" , comments = "JAXB RI v2.2.11" ) public void setNewDevelopmentAvailability ( java . lang . String value ) { this . newDevelopmentAvailability = value ; }


Input: Sets the value of the directions property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:41:42+02:00" , comments = "JAXB RI v2.2.11" ) public void setDirections ( java . lang . String value ) { this . directions = value ; }


Input: Sets the value of the co2Rating property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:41:42+02:00" , comments = "JAXB RI v2.2.11" ) public void setCo2Rating ( java . lang . String value ) { this . co2Rating = value ; }


Input: Sets the value of the energyRating property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:41:42+02:00" , comments = "JAXB RI v2.2.11" ) public void setEnergyRating ( java . lang . String value ) { this . energyRating = value ; }


Input: Sets the value of the viewingDetails property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:41:42+02:00" , comments = "JAXB RI v2.2.11" ) public void setViewingDetails ( java . lang . String value ) { this . viewingDetails = value ; }


Input: Sets the value of the propertyStatus property . [CODESPLIT] @ Generated ( value = "com.sun.tools.xjc.Driver" , date = "2018-10-12T02:41:42+02:00" , comments = "JAXB RI v2.2.11" ) public void setPropertyStatus ( OverseasSaleAdType . PropertyStatus value ) { this . propertyStatus = value ; }


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


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


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


Input: Read an { @link InputStream } into a { @link CasaItDocument } and print some of its content to console . [CODESPLIT] protected static void read ( InputStream xmlInputStream ) throws SAXException , IOException , ParserConfigurationException , JAXBException { LOGGER . info ( "process example file" ) ; CasaItDocument doc = CasaItUtils . createDocument ( xmlInputStream ) ; if ( doc == null ) { LOGGER . warn ( "> provided XML is not supported" ) ; } else { printToConsole ( doc ) ; } }


Input: Print some content of a { @link CasaItDocument } to console . [CODESPLIT] protected static void printToConsole ( CasaItDocument doc ) throws JAXBException { Container container = doc . toObject ( ) ; // process real estates if ( container . getRealestateitems ( ) != null ) { for ( Container . Realestateitems . Realestate obj : container . getRealestateitems ( ) . getRealestate ( ) ) { // get object nr String objectNr = StringUtils . trimToNull ( obj . getReference ( ) ) ; if ( objectNr == null ) objectNr = "???" ; // get object title String objectTitle = ( obj . getDescription ( ) != null ) ? StringUtils . trimToNull ( obj . getDescription ( ) . getValue ( ) ) : null ; if ( objectTitle == null ) objectTitle = "???" ; // print object information to console LOGGER . info ( "> found object '" + objectNr + "' " + "with title '" + objectTitle + "'" ) ; } } }


Input: Sets the value of the type 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 setType ( BoxProject . BoxProjectType value ) { this . type = value ; }


Input: Sets the value of the bebaubarAttr 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 setBebaubarAttr ( BebaubarNach . BebaubarAttr value ) { this . bebaubarAttr = value ; }


Input: Downgrade an OpenImmo document from version 1 . 2 . 4 to 1 . 2 . 3 . [CODESPLIT] @ Override public void downgradeToPreviousVersion ( OpenImmoDocument doc ) { doc . setDocumentVersion ( OpenImmoVersion . V1_2_3 ) ; // downgrade a feedback document if ( doc instanceof OpenImmoFeedbackDocument ) { try { this . removeFeedbackVersionElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't remove unsupported <version> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } try { this . removeFeedbackInteressentChildElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't remove unsupported children of <interessent> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } } // downgrade a transfer document else if ( doc instanceof OpenImmoTransferDocument ) { try { this . removePreiseChildElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't remove unsupported children of <preise> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } try { this . removeWintergartenElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't remove unsupported <wintergarten> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } try { this . downgradeEnergietypElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't downgrade <energietyp> 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 . downgradeAnhangElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't downgrade <anhang> 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 . downgradeGrundstueckElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't downgrade <grundstueck> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } try { this . downgradeLandUndForstwirtschaftElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't downgrade <land_und_forstwirtschaft> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } try { this . downgradeParkenElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't downgrade <parken> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } } }


Input: Upgrade an OpenImmo document from version 1 . 2 . 3 to 1 . 2 . 4 . [CODESPLIT] @ Override public void upgradeFromPreviousVersion ( OpenImmoDocument doc ) { doc . setDocumentVersion ( OpenImmoVersion . V1_2_4 ) ; if ( doc instanceof OpenImmoTransferDocument ) { try { this . upgradeAnzahlBalkonTerrassenElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't upgrade <anzahl_balkon_terrassen> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } try { this . upgradeAnhangElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't upgrade <anhang> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } try { this . upgradeSonstigeElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't upgrade <sonstige> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } } }


Input: Downgrade &lt ; anhang&gt ; elements to OpenImmo 1 . 2 . 3 . <p > The options QRCODE FILM FILMLINK for the gruppe attribute of &lt ; anhang&gt ; elements are not available in version 1 . 2 . 3 . <p > The option REMOTE for the location attribute of &lt ; anhang&gt ; elements is not available in version 1 . 2 . 3 . <p > The the child element &lt ; check&gt ; of &lt ; anhang&gt ; elements is not available in version 1 . 2 . 3 . [CODESPLIT] protected void downgradeAnhangElements ( Document doc ) throws JaxenException { List nodes = XmlUtils . newXPath ( "/io:openimmo/io:anbieter/io:anhang | " + "/io:openimmo/io:anbieter/io:immobilie/io:anhaenge/io:anhang" , doc ) . selectNodes ( doc ) ; for ( Object item : nodes ) { Element node = ( Element ) item ; String value = StringUtils . trimToNull ( node . getAttribute ( "gruppe" ) ) ; if ( "QRCODE" . equalsIgnoreCase ( value ) ) node . removeAttribute ( "gruppe" ) ; else if ( "FILM" . equalsIgnoreCase ( value ) ) node . removeAttribute ( "gruppe" ) ; else if ( "FILMLINK" . equalsIgnoreCase ( value ) ) node . removeAttribute ( "gruppe" ) ; value = StringUtils . trimToNull ( node . getAttribute ( "location" ) ) ; if ( "REMOTE" . equalsIgnoreCase ( value ) ) node . setAttribute ( "location" , "EXTERN" ) ; List childNodes = XmlUtils . newXPath ( "io:check" , doc ) . selectNodes ( node ) ; for ( Object childItem : childNodes ) { node . removeChild ( ( Node ) childItem ) ; } } }


Input: Remove unsupported children from all &lt ; interessent&gt ; elements in feedback XML . <p > OpenImmo 1 . 2 . 3 does not support more then one &lt ; bevorzugt&gt ; &lt ; wunsch&gt ; elements in feedback XML . [CODESPLIT] @ SuppressWarnings ( "Duplicates" ) protected void removeFeedbackInteressentChildElements ( Document doc ) throws JaxenException { List nodes = XmlUtils . newXPath ( "/io:openimmo_feedback/io:objekt/io:interessent" , doc ) . selectNodes ( doc ) ; for ( Object item : nodes ) { Element parentNode = ( Element ) item ; boolean bevorzugtPassed = false ; boolean wunschPassed = false ; List childNodes = XmlUtils . newXPath ( "io:bevorzugt" , doc ) . selectNodes ( parentNode ) ; for ( Object childItem : childNodes ) { Element node = ( Element ) childItem ; if ( ! bevorzugtPassed ) bevorzugtPassed = true ; else parentNode . removeChild ( node ) ; } childNodes = XmlUtils . newXPath ( "io:wunsch" , doc ) . selectNodes ( parentNode ) ; for ( Object childItem : childNodes ) { Element node = ( Element ) childItem ; if ( ! wunschPassed ) wunschPassed = true ; else parentNode . removeChild ( node ) ; } } }


Input: Upgrade &lt ; anhang&gt ; elements to OpenImmo 1 . 2 . 4 . <p > The option REMOTE for the location attribute of &lt ; anhang&gt ; elements is introduced with OpenImmo 1 . 2 . 4 . <p > If the &lt ; pfad&gt ; element of an &lt ; anhang&gt ; element contains an URL ( beginning with http : // / https : // / ftp : // / ftps : // ) the value of the location attribute is changed to REMOTE . [CODESPLIT] protected void upgradeAnhangElements ( Document doc ) throws JaxenException { List nodes = XmlUtils . newXPath ( "/io:openimmo/io:anbieter/io:anhang/io:daten/io:pfad | " + "/io:openimmo/io:anbieter/io:immobilie/io:anhaenge/io:anhang/io:daten/io:pfad" , doc ) . selectNodes ( doc ) ; for ( Object item : nodes ) { Element node = ( Element ) item ; Element parentNode = ( Element ) node . getParentNode ( ) . getParentNode ( ) ; String value = StringUtils . trimToEmpty ( node . getTextContent ( ) ) . toLowerCase ( ) ; if ( value . startsWith ( "http://" ) ) parentNode . setAttribute ( "location" , "REMOTE" ) ; else if ( value . startsWith ( "https://" ) ) parentNode . setAttribute ( "location" , "REMOTE" ) ; else if ( value . startsWith ( "ftp://" ) ) parentNode . setAttribute ( "location" , "REMOTE" ) ; else if ( value . startsWith ( "ftps://" ) ) parentNode . setAttribute ( "location" , "REMOTE" ) ; } }


Input: Upgrade &lt ; anzahl_balkon_terrassen&gt ; elements to OpenImmo 1 . 2 . 4 . <p > The &lt ; anzahl_balkon_terrassen&gt ; is not supported anymore in version 1 . 2 . 4 . The element is replaced by &lt ; anzahl_balkone&gt ; and &lt ; anzahl_terrassen&gt ; . <p > Any &lt ; anzahl_balkon_terrassen&gt ; element is removed . Its content is copied into &lt ; anzahl_balkone&gt ; if this element is not already present . [CODESPLIT] protected void upgradeAnzahlBalkonTerrassenElements ( Document doc ) throws JaxenException { List nodes = XmlUtils . newXPath ( "/io:openimmo/io:anbieter/io:immobilie/io:flaechen/io:anzahl_balkon_terrassen" , doc ) . selectNodes ( doc ) ; for ( Object item : nodes ) { Element node = ( Element ) item ; Element parentNode = ( Element ) node . getParentNode ( ) ; String value = StringUtils . trimToNull ( node . getTextContent ( ) ) ; if ( value != null ) { Element newNode = ( Element ) XmlUtils . newXPath ( "io:anzahl_balkone" , doc ) . selectSingleNode ( parentNode ) ; if ( newNode == null ) { newNode = doc . createElementNS ( StringUtils . EMPTY , "anzahl_balkone" ) ; newNode . setTextContent ( value ) ; parentNode . appendChild ( newNode ) ; } else if ( StringUtils . isBlank ( newNode . getTextContent ( ) ) ) { newNode . setTextContent ( value ) ; } } parentNode . removeChild ( node ) ; } }


Input: Upgrade &lt ; sonstige&gt ; elements to OpenImmo 1 . 2 . 4 . <p > The options GARAGEN PARKFLACHE for the sonstige_typ attribute of &lt ; sonstige&gt ; elements were removed with OpenImmo 1 . 2 . 4 . <p > For any occurence of these values the corresponding &lt ; sonstige&gt ; element is replaced with a &lt ; parken&gt ; element . [CODESPLIT] protected void upgradeSonstigeElements ( Document doc ) throws JaxenException { List nodes = XmlUtils . newXPath ( "/io:openimmo/io:anbieter/io:immobilie/io:objektkategorie/io:objektart/io:sonstige[@sonstige_typ]" , doc ) . selectNodes ( doc ) ; for ( Object item : nodes ) { Element node = ( Element ) item ; String value = StringUtils . trimToNull ( node . getAttribute ( "sonstige_typ" ) ) ; if ( "GARAGEN" . equalsIgnoreCase ( value ) || "PARKFLACHE" . equalsIgnoreCase ( value ) ) { Element parentNode = ( Element ) node . getParentNode ( ) ; parentNode . removeChild ( node ) ; Element newNode = doc . createElementNS ( StringUtils . EMPTY , "parken" ) ; newNode . setAttribute ( "parken_typ" , "STELLPLATZ" ) ; parentNode . appendChild ( newNode ) ; } } }


Input: Sets the value of the parkenTyp 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 setParkenTyp ( Parken . ParkenTyp value ) { this . parkenTyp = value ; }


Input: Sets the value of the location 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 setLocation ( Foto . Location value ) { this . location = value ; }


Input: Creates a { @link OpenImmoFeedbackDocument } from a { @link OpenimmoFeedback } object . [CODESPLIT] public static OpenImmoFeedbackDocument newDocument ( OpenimmoFeedback feedback ) throws ParserConfigurationException , JAXBException { if ( StringUtils . isBlank ( feedback . getVersion ( ) ) ) feedback . setVersion ( OpenImmoUtils . VERSION . toReadableVersion ( ) ) ; Document document = XmlUtils . newDocument ( ) ; OpenImmoUtils . createMarshaller ( "UTF-8" , true ) . marshal ( feedback , document ) ; return new OpenImmoFeedbackDocument ( document ) ; }


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


Input: Creates a { @link KyeroDocument } from a { @link Root } object . [CODESPLIT] public static KyeroDocument newDocument ( Root root ) throws ParserConfigurationException , JAXBException { if ( root . getKyero ( ) == null ) root . setKyero ( KyeroUtils . getFactory ( ) . createKyeroType ( ) ) ; if ( StringUtils . isBlank ( root . getKyero ( ) . getFeedVersion ( ) ) ) root . getKyero ( ) . setFeedVersion ( KyeroUtils . VERSION . toXmlVersion ( ) ) ; Document document = XmlUtils . newDocument ( ) ; KyeroUtils . createMarshaller ( "UTF-8" , true ) . marshal ( root , document ) ; return new KyeroDocument ( document ) ; }


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


Input: Sets the value of the alterAttr 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 setAlterAttr ( Alter . AlterAttr value ) { this . alterAttr = value ; }


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


Input: Sets the value of the freizeitTyp 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 setFreizeitTyp ( FreizeitimmobilieGewerblich . FreizeitTyp value ) { this . freizeitTyp = value ; }


Input: Sets the value of the telefonart 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 setTelefonart ( TelSonstige . Telefonart value ) { this . telefonart = value ; }


Input: Read a { @link InputStream } into an { @link ImmoXmlDocument } and print some of its content to console . [CODESPLIT] protected static void read ( InputStream xmlInputStream ) throws SAXException , IOException , ParserConfigurationException , JAXBException { LOGGER . info ( "process example file" ) ; ImmoXmlDocument doc = ImmoXmlUtils . createDocument ( xmlInputStream ) ; if ( doc == null ) { LOGGER . warn ( "> provided XML is not supported" ) ; } else { printToConsole ( doc ) ; } }


Input: Print some content of an { @link ImmoXmlDocument } to console . [CODESPLIT] @ SuppressWarnings ( "Duplicates" ) protected static void printToConsole ( ImmoXmlDocument doc ) throws JAXBException { LOGGER . info ( "> process document in version " + doc . getDocumentVersion ( ) ) ; Immoxml immoxml = doc . toObject ( ) ; // process agencies in the document for ( Anbieter anbieter : immoxml . getAnbieter ( ) ) { LOGGER . info ( ">> found agency '" + anbieter . getAnbieternr ( ) + "'" ) ; // process real estates of the agency for ( Immobilie immobilie : anbieter . getImmobilie ( ) ) { // get object nr String objectNr = ( immobilie . getVerwaltungTechn ( ) != null ) ? immobilie . getVerwaltungTechn ( ) . getObjektnrIntern ( ) : "???" ; // get object title String objectTitle = ( immobilie . getFreitexte ( ) != null ) ? immobilie . getFreitexte ( ) . getObjekttitel ( ) : "???" ; // print object information to console LOGGER . info ( ">>> found object '" + objectNr + "' " + "with title '" + objectTitle + "'" ) ; } } }


Input: Sets the value of the emailart 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 setEmailart ( EmailSonstige . Emailart value ) { this . emailart = value ; }


Input: Creates a record according to the object category that is provided in a { @link CSVRecord } . [CODESPLIT] public static Is24CsvRecord createRecord ( CSVRecord record ) { Immobilienart art = Is24CsvRecord . getImmobilienart ( record ) ; if ( Immobilienart . ANLAGE . equals ( art ) ) return Anlageobjekt . newRecord ( record ) ; else if ( Immobilienart . GEWERBE_BUERO_PRAXEN . equals ( art ) ) return GewerbeBueroPraxis . newRecord ( record ) ; else if ( Immobilienart . GEWERBE_EINZELHANDEL . equals ( art ) ) return GewerbeEinzelhandel . newRecord ( record ) ; else if ( Immobilienart . GEWERBE_GASTRONOMIE_HOTEL . equals ( art ) ) return GewerbeGastronomieHotel . newRecord ( record ) ; else if ( Immobilienart . GEWERBE_HALLE_PRODUKTION . equals ( art ) ) return GewerbeHalleProduktion . newRecord ( record ) ; else if ( Immobilienart . GEWERBE_SONSTIGES . equals ( art ) ) return GewerbeSonstiges . newRecord ( record ) ; else if ( Immobilienart . HAUS_KAUF . equals ( art ) ) return HausKauf . newRecord ( record ) ; else if ( Immobilienart . HAUS_MIETE . equals ( art ) ) return HausMiete . newRecord ( record ) ; else if ( Immobilienart . STELLPLATZ_KAUF . equals ( art ) ) return StellplatzKauf . newRecord ( record ) ; else if ( Immobilienart . STELLPLATZ_MIETE . equals ( art ) ) return StellplatzMiete . newRecord ( record ) ; else if ( Immobilienart . WOHNEN_AUF_ZEIT . equals ( art ) ) return WohnenAufZeit . newRecord ( record ) ; else if ( Immobilienart . WOHNUNG_KAUF . equals ( art ) ) return WohnungKauf . newRecord ( record ) ; else if ( Immobilienart . WOHNUNG_MIETE . equals ( art ) ) return WohnungMiete . newRecord ( record ) ; // Immobilienart für Grundstücke wird abhängig zur Objektkategorie erzeugt else if ( Immobilienart . GRUNDSTUECKE . equals ( art ) ) { ObjektkategorieGrundstueck cat = Grundstueck . getObjektkategorie ( record ) ; if ( ObjektkategorieGrundstueck . WOHNEN . equals ( cat ) ) return GrundstueckWohnen . newRecord ( record ) ; else return GrundstueckGewerbe . newRecord ( record ) ; } LOGGER . warn ( "Unsupported 'Immobilienart' value: " + record . get ( Is24CsvRecord . FIELD_IMMOBILIENART ) ) ; return null ; }


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


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


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


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


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


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


Input: Helper method to create a &lt ; user_defined_simplefield&gt ; element with a feldname attribute and a string value . [CODESPLIT] @ SuppressWarnings ( "Duplicates" ) public static Element createUserDefinedSimplefield ( Document doc , String name , String value ) { Element root = XmlUtils . getRootElement ( doc ) ; Element node = doc . createElementNS ( root . getNamespaceURI ( ) , "user_defined_simplefield" ) ; node . setAttribute ( "feldname" , name ) ; node . setTextContent ( value ) ; return node ; }


Input: Gets the value of the fehler 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 < Fehlerliste . Fehler > getFehler ( ) { if ( fehler == null ) { fehler = new ArrayList < Fehlerliste . Fehler > ( ) ; } return this . fehler ; }


Input: Sets the value of the erbpacht 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 setErbpacht ( JAXBElement < VermarktungGrundstueckGewerbeTyp . Erbpacht > value ) { this . erbpacht = value ; }


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 ( JAXBElement < VermarktungGrundstueckGewerbeTyp . Miete > value ) { this . miete = value ; }


Input: Read a { @link File } into a { @link FilemakerResultDocument } or { @link FilemakerLayoutDocument } 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 ; } FilemakerDocument doc = FilemakerUtils . createDocument ( xmlFile ) ; if ( doc == null ) { LOGGER . warn ( "> provided XML is not supported" ) ; } else if ( doc . isResult ( ) ) { printToConsole ( ( FilemakerResultDocument ) doc ) ; } else if ( doc . isLayout ( ) ) { printToConsole ( ( FilemakerLayoutDocument ) doc ) ; } else { LOGGER . warn ( "> unsupported type of document: " + doc . getClass ( ) . getName ( ) ) ; } }


Input: Read a { @link InputStream } into a { @link FilemakerResultDocument } or { @link FilemakerLayoutDocument } 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" ) ; FilemakerDocument doc = FilemakerUtils . createDocument ( xmlInputStream ) ; if ( doc == null ) { LOGGER . warn ( "> provided XML is not supported" ) ; } else if ( doc . isResult ( ) ) { printToConsole ( ( FilemakerResultDocument ) doc ) ; } else if ( doc . isLayout ( ) ) { printToConsole ( ( FilemakerLayoutDocument ) doc ) ; } else { LOGGER . warn ( "> unsupported type of document: " + doc . getClass ( ) . getName ( ) ) ; } }


Input: Print some content of a { @link FilemakerLayoutDocument } to console . [CODESPLIT] protected static void printToConsole ( FilemakerLayoutDocument doc ) throws JAXBException { LOGGER . info ( "> process layout document" ) ; FMPXMLLAYOUT layout = doc . toObject ( ) ; LOGGER . info ( "> error code      : " + layout . getERRORCODE ( ) ) ; if ( layout . getPRODUCT ( ) != null ) { LOGGER . info ( "> product name    : " + layout . getPRODUCT ( ) . getNAME ( ) ) ; LOGGER . info ( "> product version : " + layout . getPRODUCT ( ) . getVERSION ( ) ) ; LOGGER . info ( "> product build   : " + layout . getPRODUCT ( ) . getBUILD ( ) ) ; } if ( layout . getLAYOUT ( ) != null ) { LOGGER . info ( "> database name   : " + layout . getLAYOUT ( ) . getDATABASE ( ) ) ; LOGGER . info ( "> database layout : " + layout . getLAYOUT ( ) . getNAME ( ) ) ; for ( LayoutType . FIELD field : layout . getLAYOUT ( ) . getFIELD ( ) ) { LOGGER . info ( "> database field  : " + field . getNAME ( ) + " / " + field . getSTYLE ( ) . getTYPE ( ) + " / " + field . getSTYLE ( ) . getVALUELIST ( ) ) ; } } if ( layout . getVALUELISTS ( ) != null ) { for ( ValueListsType . VALUELIST valueList : layout . getVALUELISTS ( ) . getVALUELIST ( ) ) { LOGGER . info ( "> database values : " + valueList . getNAME ( ) ) ; for ( String value : valueList . getVALUE ( ) ) { LOGGER . info ( ">> " + value ) ; } } } }


Input: Print some content of a { @link FilemakerResultDocument } to console . [CODESPLIT] protected static void printToConsole ( FilemakerResultDocument doc ) throws JAXBException { LOGGER . info ( "> process result document" ) ; FMPXMLRESULT result = doc . toObject ( ) ; LOGGER . info ( "> error code       : " + result . getERRORCODE ( ) ) ; if ( result . getPRODUCT ( ) != null ) { LOGGER . info ( "> product name     : " + result . getPRODUCT ( ) . getNAME ( ) ) ; LOGGER . info ( "> product version  : " + result . getPRODUCT ( ) . getVERSION ( ) ) ; LOGGER . info ( "> product build    : " + result . getPRODUCT ( ) . getBUILD ( ) ) ; } if ( result . getDATABASE ( ) != null ) { LOGGER . info ( "> database name    : " + result . getDATABASE ( ) . getNAME ( ) ) ; LOGGER . info ( "> database layout  : " + result . getDATABASE ( ) . getLAYOUT ( ) ) ; LOGGER . info ( "> database date    : " + result . getDATABASE ( ) . getDATEFORMAT ( ) ) ; LOGGER . info ( "> database time    : " + result . getDATABASE ( ) . getTIMEFORMAT ( ) ) ; LOGGER . info ( "> database records : " + result . getDATABASE ( ) . getRECORDS ( ) ) ; } if ( result . getMETADATA ( ) != null ) { for ( MetaDataType . FIELD field : result . getMETADATA ( ) . getFIELD ( ) ) { LOGGER . info ( "> database field   : " + field . getNAME ( ) ) ; LOGGER . info ( ">> type : " + field . getTYPE ( ) ) ; LOGGER . info ( ">> max repeat : " + field . getMAXREPEAT ( ) ) ; } } if ( result . getRESULTSET ( ) != null ) { LOGGER . info ( "> result set found  : " + result . getRESULTSET ( ) . getFOUND ( ) ) ; for ( ResultSetType . ROW row : result . getRESULTSET ( ) . getROW ( ) ) { LOGGER . info ( "> result set row    : " + row . getRECORDID ( ) + " / " + row . getMODID ( ) ) ; for ( ResultSetType . ROW . COL col : row . getCOL ( ) ) { for ( String data : col . getDATA ( ) ) { LOGGER . info ( ">> " + data ) ; } } } } }


Input: Gets the value of the stpSonstige 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 < StpSonstige > getStpSonstige ( ) { if ( stpSonstige == null ) { stpSonstige = new ArrayList < StpSonstige > ( ) ; } return this . stpSonstige ; }


Input: Gets the value of the valuelist 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 < ValueListsType . VALUELIST > getVALUELIST ( ) { if ( valuelist == null ) { valuelist = new ArrayList < ValueListsType . VALUELIST > ( ) ; } return this . valuelist ; }


Input: Sets the value of the minDauer 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 setMinDauer ( MinMietdauer . MinDauer value ) { this . minDauer = value ; }


Input: Sets the value of the zinsTyp 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 setZinsTyp ( ZinshausRenditeobjekt . ZinsTyp value ) { this . zinsTyp = value ; }


Input: Gets the value of the photo 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 < URI > getPhoto ( ) { if ( photo == null ) { photo = new ArrayList < URI > ( ) ; } return this . photo ; }


Input: Read a { @link InputStream } into a { @link WisItDocument } and print some of its content to console . [CODESPLIT] protected static void read ( InputStream xmlInputStream ) throws SAXException , IOException , ParserConfigurationException , JAXBException { LOGGER . info ( "process example file" ) ; WisItDocument doc = WisItUtils . createDocument ( xmlInputStream ) ; if ( doc == null ) { LOGGER . warn ( "> provided XML is not supported" ) ; } else { printToConsole ( doc ) ; } }


Input: Print some content of a { @link WisItDocument } to console . [CODESPLIT] protected static void printToConsole ( WisItDocument doc ) throws JAXBException { WIS wis = doc . toObject ( ) ; // process objects if ( wis . getOBJEKTE ( ) != null ) { for ( ObjectType obj : wis . getOBJEKTE ( ) . getOBJEKT ( ) ) { // get object nr String objectNr = StringUtils . trimToNull ( obj . getID ( ) ) ; if ( objectNr == null ) objectNr = "???" ; // get object description String objectInfo = StringUtils . trimToNull ( obj . getINFODE ( ) ) ; if ( objectInfo == null ) objectInfo = obj . getINFOIT ( ) ; if ( objectInfo == null ) objectInfo = "???" ; // print object information to console LOGGER . info ( "> found object '" + objectNr + "' " + "with title '" + objectInfo + "'" ) ; } } }


Input: Sets the value of the metadata 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 setMetadata ( Feed . Metadata value ) { this . metadata = value ; }


Input: Sets the value of the projects 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 setProjects ( Feed . Projects value ) { this . projects = value ; }


Input: Sets the value of the properties 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 setProperties ( Feed . Properties value ) { this . properties = value ; }


Input: Start the example application . [CODESPLIT] @ SuppressWarnings ( "Duplicates" ) public static void main ( String [ ] args ) { // init logging PropertyConfigurator . configure ( DaftIeWritingExample . class . getResource ( PACKAGE + "/log4j.properties" ) ) ; // create a Daft object with some example data // this object corresponds to the <daft> root element in XML Daft daft = FACTORY . createDaft ( ) ; // append some example objects for rent to the Daft object daft . setOverseasRental ( FACTORY . createDaftOverseasRental ( ) ) ; daft . getOverseasRental ( ) . getOverseasRentalAd ( ) . add ( createAdForRent ( ) ) ; daft . getOverseasRental ( ) . getOverseasRentalAd ( ) . add ( createAdForRent ( ) ) ; // append some example objects for sale to the Daft object daft . setOverseasSales ( FACTORY . createDaftOverseasSales ( ) ) ; daft . getOverseasSales ( ) . getOverseasSaleAd ( ) . add ( createAdForSale ( ) ) ; daft . getOverseasSales ( ) . getOverseasSaleAd ( ) . add ( createAdForSale ( ) ) ; daft . getOverseasSales ( ) . getOverseasSaleAd ( ) . add ( createAdForSale ( ) ) ; // convert the Daft object into a XML document DaftIeDocument doc = null ; try { doc = DaftIeDocument . newDocument ( daft ) ; } 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 OverseasRentalAdType } with some example data . [CODESPLIT] @ SuppressWarnings ( "CatchMayIgnoreException" ) protected static OverseasRentalAdType createAdForRent ( ) { // create an example real estate for rent OverseasRentalAdType ad = FACTORY . createOverseasRentalAdType ( ) ; ad . setAddress ( "Beispielstraße 123") ;  ad . setAgentId ( "123" ) ; ad . setArea ( "Berlin" ) ; ad . setAvailableFrom ( Calendar . getInstance ( ) ) ; ad . setBathroomNumber ( BigInteger . valueOf ( RandomUtils . nextInt ( 0 , 5 ) ) ) ; ad . setBedroomNumber ( BigInteger . valueOf ( RandomUtils . nextInt ( 0 , 5 ) ) ) ; ad . setCableTelevision ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; ad . setCcEmail ( "test@openestate.org" ) ; ad . setCommercialType ( CommercialType . LAND ) ; ad . setContactName ( "Max Mustermann" ) ; ad . setCountry ( "DE" ) ; ad . setDescription ( "A description about the property." ) ; ad . setDishwasher ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; ad . setDoubleBeds ( BigInteger . valueOf ( RandomUtils . nextInt ( 0 , 5 ) ) ) ; ad . setDryer ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; ad . setExternalId ( String . valueOf ( RandomUtils . nextInt ( 1 , 1000 ) ) ) ; ad . setFurnished ( OverseasRentalAdType . Furnished . FURNISHED ) ; ad . setHouseType ( HouseType . TOWNHOUSE ) ; ad . setLease ( BigInteger . valueOf ( RandomUtils . nextInt ( 100 , 1000 ) ) ) ; ad . setMainEmail ( "test@openstate.org" ) ; ad . setMicrowave ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; ad . setNumberPeople ( BigInteger . valueOf ( RandomUtils . nextInt ( 0 , 5 ) ) ) ; ad . setPhone1 ( "030/123456" ) ; ad . setPhone2 ( "030/123457" ) ; ad . setPhoneInfo ( "Some information about contacts via phone." ) ; ad . setPropertyType ( PropertyType . HOUSE ) ; ad . setRegion ( "Berlin" ) ; ad . setRent ( BigInteger . valueOf ( RandomUtils . nextInt ( 100 , 1000 ) ) ) ; ad . setRentCollectionPeriod ( OverseasRentalAdType . RentPeriod . MONTHLY ) ; ad . setSingleBeds ( BigInteger . valueOf ( RandomUtils . nextInt ( 0 , 5 ) ) ) ; ad . setTwinBeds ( BigInteger . valueOf ( RandomUtils . nextInt ( 0 , 5 ) ) ) ; ad . setWashingMachine ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; // add some features ad . setFeatures ( FACTORY . createFeaturesType ( ) ) ; ad . getFeatures ( ) . getFeature ( ) . add ( "another feature" ) ; ad . getFeatures ( ) . getFeature ( ) . add ( "some more feature" ) ; // add some photos ad . setPhotos ( FACTORY . createPhotosType ( ) ) ; try { ad . getPhotos ( ) . getPhoto ( ) . add ( new URI ( "http://www.mywebsite.org/image1.jpg" ) ) ; ad . getPhotos ( ) . getPhoto ( ) . add ( new URI ( "http://www.mywebsite.org/image2.jpg" ) ) ; ad . getPhotos ( ) . getPhoto ( ) . add ( new URI ( "http://www.mywebsite.org/image3.jpg" ) ) ; } catch ( URISyntaxException ex ) { } return ad ; }


Input: Create an { @link OverseasRentalAdType } with some example data . [CODESPLIT] @ SuppressWarnings ( "CatchMayIgnoreException" ) protected static OverseasSaleAdType createAdForSale ( ) { // create an example real estate for sale OverseasSaleAdType ad = FACTORY . createOverseasSaleAdType ( ) ; ad . setAcres ( BigDecimal . valueOf ( RandomUtils . nextDouble ( 10 , 1000 ) ) ) ; ad . setAddress ( "Beispielstraße 123") ;  ad . setAgentId ( "123" ) ; ad . setArea ( "Berlin" ) ; ad . setBathroomNumber ( BigInteger . valueOf ( RandomUtils . nextInt ( 0 , 5 ) ) ) ; ad . setBedroomNumber ( BigInteger . valueOf ( RandomUtils . nextInt ( 0 , 5 ) ) ) ; ad . setCcEmail ( "test@openestate.org" ) ; ad . setCo2Rating ( "some notes about CO2 rating" ) ; ad . setCommercialType ( CommercialType . SHOP ) ; ad . setContactName ( "Max Mustermann" ) ; ad . setCountry ( "DE" ) ; ad . setDescription ( "A description about the property." ) ; ad . setDirections ( "some notes about directions" ) ; ad . setEnergyRating ( "some notes about energy rating" ) ; ad . setExternalId ( String . valueOf ( RandomUtils . nextInt ( 1 , 1000 ) ) ) ; ad . setHouseType ( HouseType . DETACHED ) ; ad . setIsNewDevelopment ( RandomUtils . nextInt ( 0 , 2 ) == 1 ) ; ad . setMainEmail ( "test@openstate.org" ) ; ad . setNewDevelopmentAvailability ( "some notes about development" ) ; ad . setPhone1 ( "030/123456" ) ; ad . setPhone2 ( "030/123457" ) ; ad . setPhoneInfo ( "Some information about contacts via phone." ) ; ad . setPrice ( BigInteger . valueOf ( RandomUtils . nextInt ( 100 , 1000000 ) ) ) ; ad . setPriceType ( OverseasSaleAdType . PriceType . REGION ) ; ad . setPropertyStatus ( OverseasSaleAdType . PropertyStatus . FOR_SALE ) ; ad . setPropertyType ( PropertyType . HOUSE ) ; ad . setRegion ( "Berlin" ) ; ad . setSquareMetres ( BigDecimal . valueOf ( RandomUtils . nextDouble ( 10 , 1000 ) ) ) ; ad . setUnitsAvailable ( BigInteger . valueOf ( RandomUtils . nextInt ( 1 , 50 ) ) ) ; ad . setViewingDetails ( "some notes about viewing details" ) ; // add some features ad . setFeatures ( FACTORY . createFeaturesType ( ) ) ; ad . getFeatures ( ) . getFeature ( ) . add ( "another feature" ) ; ad . getFeatures ( ) . getFeature ( ) . add ( "some more feature" ) ; // add some pdf documents ad . setPdfs ( FACTORY . createPdfsType ( ) ) ; try { ad . getPdfs ( ) . getPdf ( ) . add ( new URI ( "http://www.mywebsite.org/document1.pdf" ) ) ; ad . getPdfs ( ) . getPdf ( ) . add ( new URI ( "http://www.mywebsite.org/document2.pdf" ) ) ; } catch ( URISyntaxException ex ) { } // add some photos ad . setPhotos ( FACTORY . createPhotosType ( ) ) ; try { ad . getPhotos ( ) . getPhoto ( ) . add ( new URI ( "http://www.mywebsite.org/image1.jpg" ) ) ; ad . getPhotos ( ) . getPhoto ( ) . add ( new URI ( "http://www.mywebsite.org/image2.jpg" ) ) ; ad . getPhotos ( ) . getPhoto ( ) . add ( new URI ( "http://www.mywebsite.org/image3.jpg" ) ) ; } catch ( URISyntaxException ex ) { } return ad ; }


Input: Write a { @link DaftIeDocument } into a { @link File } . [CODESPLIT] @ SuppressWarnings ( "Duplicates" ) protected static void write ( DaftIeDocument doc , File file ) { LOGGER . info ( "writing document with version " + doc . getDocumentVersion ( ) ) ; try { doc . toXml ( file , PRETTY_PRINT ) ; LOGGER . info ( "> written to: " + file . getAbsolutePath ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't write document into a file!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; System . exit ( 1 ) ; } }


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


Input: Downgrade a Kyero document from version 3 . [CODESPLIT] @ Override public void downgradeToPreviousVersion ( KyeroDocument doc ) { doc . setDocumentVersion ( KyeroVersion . V2_1 ) ; try { this . downgradeNewBuildElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't downgrade <new_build> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } try { this . downgradeTypeElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't downgrade <type> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } try { this . downgradeUrlElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't downgrade <url> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } try { this . removeLocationElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't remove <location> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } try { this . removeEnergyRatingElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't remove <energy_rating> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } try { this . removeNotesElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't remove <notes> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } try { this . removeUnsupportedLanguageElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't remove unsupported translation elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } }


Input: Upgrade a Kyero document to version 3 . [CODESPLIT] @ Override public void upgradeFromPreviousVersion ( KyeroDocument doc ) { doc . setDocumentVersion ( KyeroVersion . V3 ) ; try { this . removeCustomElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't remove <custom> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } try { this . upgradeNewBuildElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't upgrade <new_build> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } try { this . upgradeTypeElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't upgrade <type> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } try { this . upgradeCurrencyElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't upgrade <currency> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } try { this . upgradeUrlElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't upgrade <url> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } }


Input: Downgrade &lt ; new_build&gt ; elements to Kyero 2 . 1 . <p > The &lt ; new_build&gt ; elements are not available in version 2 . 1 . Instead the value new_build is used in the &lt ; price_freq&gt ; element . <p > Any &lt ; new_build&gt ; elements are removed . If its value is set to 1 then &lt ; price_freq&gt ; sale&lt ; / price_freq&gt ; is converted to &lt ; price_freq&gt ; new_build&lt ; / price_freq&gt ; [CODESPLIT] protected void downgradeNewBuildElements ( Document doc ) throws JaxenException { List nodes = XmlUtils . newXPath ( "/io:root/io:property/io:new_build" , doc ) . selectNodes ( doc ) ; for ( Object item : nodes ) { Element node = ( Element ) item ; Element parentNode = ( Element ) node . getParentNode ( ) ; String value = StringUtils . trimToNull ( node . getTextContent ( ) ) ; if ( "1" . equals ( value ) ) { Element priceFreqNode = ( Element ) XmlUtils . newXPath ( "io:price_freq" , doc ) . selectSingleNode ( parentNode ) ; if ( priceFreqNode == null ) { priceFreqNode = doc . createElementNS ( KyeroUtils . NAMESPACE , "price_freq" ) ; priceFreqNode . setTextContent ( "new_build" ) ; parentNode . appendChild ( priceFreqNode ) ; } else if ( "sale" . equalsIgnoreCase ( priceFreqNode . getTextContent ( ) ) ) { priceFreqNode . setTextContent ( "new_build" ) ; } } parentNode . removeChild ( node ) ; } }


Input: Downgrade &lt ; type&gt ; elements to Kyero 2 . 1 . <p > The &lt ; type&gt ; elements require a &lt ; en&gt ; child element in version 2 . 1 . <p > An &lt ; en&gt ; child element is created for any &lt ; type&gt ; element . [CODESPLIT] protected void downgradeTypeElements ( Document doc ) throws JaxenException { List nodes = XmlUtils . newXPath ( "/io:root/io:property/io:type" , doc ) . selectNodes ( doc ) ; for ( Object item : nodes ) { Element node = ( Element ) item ; String value = StringUtils . trimToNull ( node . getTextContent ( ) ) ; node . setTextContent ( null ) ; Element childNode = doc . createElementNS ( KyeroUtils . NAMESPACE , "en" ) ; childNode . setTextContent ( value ) ; node . appendChild ( childNode ) ; } }


Input: Downgrade &lt ; url&gt ; elements to Kyero 2 . 1 . <p > The &lt ; url&gt ; elements only support a simple text value in version 2 . 1 . Version 3 allows different URL s for different languages . <p > Any children of &lt ; url&gt ; elements are removed . The english URL or the first found URL is copied as simple value into the &lt ; url&gt ; element . [CODESPLIT] @ SuppressWarnings ( "Duplicates" ) protected void downgradeUrlElements ( Document doc ) throws JaxenException { List nodes = XmlUtils . newXPath ( "/io:root/io:property/io:url" , doc ) . selectNodes ( doc ) ; for ( Object item : nodes ) { Element node = ( Element ) item ; String enUrlValue = null ; String fallbackUrlValue = null ; List childNodes = XmlUtils . newXPath ( "*" , doc ) . selectNodes ( node ) ; for ( Object childItem : childNodes ) { Element langNode = ( Element ) childItem ; if ( "en" . equalsIgnoreCase ( langNode . getLocalName ( ) ) ) enUrlValue = StringUtils . trimToNull ( langNode . getTextContent ( ) ) ; else if ( fallbackUrlValue == null ) fallbackUrlValue = StringUtils . trimToNull ( langNode . getTextContent ( ) ) ; node . removeChild ( langNode ) ; } node . setTextContent ( ( enUrlValue != null ) ? enUrlValue : fallbackUrlValue ) ; } }


Input: Remove elements with translations in unsupported languages . <p > Kyero 2 . 1 does only support translation in &lt ; title&gt ; ( for images ) &lt ; desc&gt ; ( for properties ) elements for en es de nl fr . [CODESPLIT] protected void removeUnsupportedLanguageElements ( Document doc ) throws JaxenException { String [ ] unsupportedLanguages = new String [ ] { "ar" , "bg" , "ca" , "cs" , "da" , "el" , "et" , "fa" , "fi" , "he" , "hi" , "hu" , "id" , "it" , "ja" , "ko" , "lt" , "lv" , "no" , "pl" , "pt" , "ro" , "ru" , "sk" , "sl" , "sv" , "th" , "tr" , "uk" , "vi" , "zh" , } ; List nodes = XmlUtils . newXPath ( "/io:root/io:property/io:desc | " + "/io:root/io:property/io:images/io:image/io:title" , doc ) . selectNodes ( doc ) ; for ( Object item : nodes ) { Element node = ( Element ) item ; List childNodes = XmlUtils . newXPath ( "*" , doc ) . selectNodes ( node ) ; for ( Object childItem : childNodes ) { Element langNode = ( Element ) childItem ; String lang = langNode . getLocalName ( ) . toLowerCase ( ) ; if ( ArrayUtils . contains ( unsupportedLanguages , lang ) ) { node . removeChild ( langNode ) ; } } } }


Input: Upgrade &lt ; new_build&gt ; elements for Kyero 3 . <p > The &lt ; new_build&gt ; elements are not available in version 2 . 1 . Instead the value new_build is used in the &lt ; price_freq&gt ; element . <p > Any occurrences of &lt ; price_freq&gt ; new_build&lt ; / price_freq&gt ; is replaced by &lt ; price_freq&gt ; sale&lt ; / price_freq&gt ; and &lt ; new_build&gt ; 1&lt ; / new_build&gt ; is added to the property . [CODESPLIT] protected void upgradeNewBuildElements ( Document doc ) throws JaxenException { List nodes = XmlUtils . newXPath ( "/io:root/io:property/io:price_freq" , doc ) . selectNodes ( doc ) ; for ( Object item : nodes ) { Element node = ( Element ) item ; Element parentNode = ( Element ) node . getParentNode ( ) ; if ( ! "new_build" . equalsIgnoreCase ( node . getTextContent ( ) ) ) continue ; node . setTextContent ( "sale" ) ; Element newBuildNode = doc . createElementNS ( KyeroUtils . NAMESPACE , "new_build" ) ; newBuildNode . setTextContent ( "1" ) ; parentNode . appendChild ( newBuildNode ) ; } }


Input: Creates a { @link WisItDocument } from a { @link WIS } object . [CODESPLIT] public static WisItDocument newDocument ( WIS wis ) throws ParserConfigurationException , JAXBException { if ( wis . getOBJEKTE ( ) == null ) wis . setOBJEKTE ( WisItUtils . getFactory ( ) . createWISOBJEKTE ( ) ) ; wis . getOBJEKTE ( ) . setANZAHL ( BigInteger . valueOf ( wis . getOBJEKTE ( ) . getOBJEKT ( ) . size ( ) ) ) ; Document document = XmlUtils . newDocument ( ) ; WisItUtils . createMarshaller ( "UTF-8" , true ) . marshal ( wis , document ) ; return new WisItDocument ( document ) ; }


Input: Print some content of an { @link Is24CsvParser } to console . [CODESPLIT] protected static void printToConsole ( Is24CsvParser parser ) { // process records while ( parser . hasNext ( ) ) { Is24CsvRecord record = parser . next ( ) ; // get object nr String objectNr = record . getAnbieterObjektId ( ) ; if ( objectNr == null ) objectNr = "???" ; // get object title String objectTitle = record . getUeberschrift ( ) ; if ( objectTitle == null ) objectTitle = "???" ; // print object information to console LOGGER . info ( "> found object '" + objectNr + "' " + "with title '" + objectTitle + "'" ) ; } }


Input: Creates a { @link ImmobiliareItDocument } from a { @link Feed } object . [CODESPLIT] public static ImmobiliareItDocument newDocument ( Feed feed ) throws ParserConfigurationException , JAXBException { if ( feed . getVersion ( ) == null ) feed . setVersion ( Version . V2_5 ) ; Document document = XmlUtils . newDocument ( ) ; ImmobiliareItUtils . createMarshaller ( "UTF-8" , true ) . marshal ( feed , document ) ; return new ImmobiliareItDocument ( document ) ; }


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


Input: Downgrade an OpenImmo document from version 1 . 2 . 2 to 1 . 2 . 1 . [CODESPLIT] @ Override public void downgradeToPreviousVersion ( OpenImmoDocument doc ) { doc . setDocumentVersion ( OpenImmoVersion . V1_2_1 ) ; if ( doc instanceof OpenImmoTransferDocument ) { try { this . downgradeUebertragungElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't downgrade <uebertragung> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } try { this . removeVersteigerungElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't remove <versteigerung> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } try { this . removeProvisionspflichtigElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't remove <provisionspflichtig> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } try { this . removeAusstattungChildElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't remove unsupported children of <ausstattung> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } try { this . downgradeObjektartElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't downgrade <objektart> 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 . downgradeBodenElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't downgrade <boden> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } try { this . downgradeBefeuerungElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't downgrade <befeuerung> 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 . downgradeGrundstueckElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't downgrade <grundstueck> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } try { this . downgradeBueroPraxenElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't downgrade <buero_praxen> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } try { this . downgradeEinzelhandelElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't downgrade <einzelhandel> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } try { this . downgradeGastgewerbeElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't downgrade <gastgewerbe> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } try { this . downgradeHallenLagerProdElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't downgrade <hallen_lager_prod> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } try { this . downgradeLandUndForstwirtschaftElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't downgrade <land_und_forstwirtschaft> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } try { this . downgradeFreizeitimmobilieGewerblichElements ( doc . getDocument ( ) ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't downgrade <freizeitimmobilie_gewerblich> elements!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; } } }


Input: Downgrade &lt ; objektart&gt ; elements to OpenImmo 1 . 2 . 1 . <p > The &lt ; objektart&gt ; element does only allow the same type of child element in version 1 . 2 . 1 . <p > Any child type that differs from the first child type is removed . [CODESPLIT] protected void downgradeObjektartElements ( Document doc ) throws JaxenException { List nodes = XmlUtils . newXPath ( "/io:openimmo/io:anbieter/io:immobilie/io:objektkategorie/io:objektart" , doc ) . selectNodes ( doc ) ; for ( Object item : nodes ) { Element parentNode = ( Element ) item ; String type = null ; List childNodes = XmlUtils . newXPath ( "*" , doc ) . selectNodes ( parentNode ) ; for ( Object childItem : childNodes ) { Element node = ( Element ) childItem ; if ( type == null ) { //LOGGER.debug( "PRIMARY TYPE: " + node.getLocalName() ); type = node . getLocalName ( ) ; } else if ( ! type . equalsIgnoreCase ( node . getLocalName ( ) ) ) { //LOGGER.debug( "REMOVE SECONDARY TYPE: " + node.getLocalName() ); parentNode . removeChild ( node ) ; } } } }


Input: Upgrade &lt ; energiepass&gt ; elements to OpenImmo 1 . 2 . 2 . <p > The &lt ; art&gt ; child element of the &lt ; energiepass&gt ; element is renamed to &lt ; epart&gt ; in version 1 . 2 . 2 . [CODESPLIT] protected void upgradeEnergiepassElements ( Document doc ) throws JaxenException { List nodes = XmlUtils . newXPath ( "/io:openimmo/io:anbieter/io:immobilie/io:zustand_angaben/io:energiepass/io:art" , doc ) . selectNodes ( doc ) ; for ( Object item : nodes ) { Element node = ( Element ) item ; Element parentNode = ( Element ) node . getParentNode ( ) ; Element newNode = doc . createElementNS ( StringUtils . EMPTY , "epart" ) ; newNode . setTextContent ( node . getTextContent ( ) ) ; parentNode . replaceChild ( newNode , node ) ; } }


Input: Gets the value of the immobilie 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 < Immobilie > getImmobilie ( ) { if ( immobilie == null ) { immobilie = new ArrayList < Immobilie > ( ) ; } return this . immobilie ; }


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


Input: Gets the value of the objekt 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 < Objekt > getObjekt ( ) { if ( objekt == null ) { objekt = new ArrayList < Objekt > ( ) ; } return this . objekt ; }


Input: Gets the value of the fehlerliste 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 < Fehlerliste > getFehlerliste ( ) { if ( fehlerliste == null ) { fehlerliste = new ArrayList < Fehlerliste > ( ) ; } return this . fehlerliste ; }


Input: Gets the value of the status 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 < Status > getStatus ( ) { if ( status == null ) { status = new ArrayList < Status > ( ) ; } return this . status ; }


Input: Sets the value of the sonstigeTyp 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 setSonstigeTyp ( Sonstige . SonstigeTyp value ) { this . sonstigeTyp = value ; }


Input: Sets the value of the distanzZu 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 setDistanzZu ( Distanzen . DistanzZu value ) { this . distanzZu = value ; }


Input: Gets the value of the distanzen 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 < Distanzen > getDistanzen ( ) { if ( distanzen == null ) { distanzen = new ArrayList < Distanzen > ( ) ; } return this . distanzen ; }


Input: Gets the value of the distanzenSport 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 < DistanzenSport > getDistanzenSport ( ) { if ( distanzenSport == null ) { distanzenSport = new ArrayList < DistanzenSport > ( ) ; } return this . distanzenSport ; }


Input: ------------------------------------------ [CODESPLIT] public Response setnx ( Object key , Object val ) { return req ( Cmd . setnx , bytes ( key ) , bytes ( val ) ) ; }


Input: 指定配置生成一个单连接的客户端 [CODESPLIT] public static final SSDB simple ( String host , int port , int timeout ) { return new SimpleClient ( host , port , timeout ) ; }


Input: 指定配置生成一个使用连接池的客户端 [CODESPLIT] public static final SSDB pool ( String host , int port , int timeout , Object config ) { return pool ( host , port , timeout , config , null ) ; }


Input: 指定配置生成一个使用连接池的客户端 [CODESPLIT] public static final SSDB pool ( String host , int port , int timeout , Object config , byte [ ] auth ) { return new SimpleClient ( _pool ( host , port , timeout , config , auth ) ) ; }


Input: 按指定配置生成master / slave且使用连接池的客户端 [CODESPLIT] public static final SSDB replication ( String masterHost , int masterPort , String slaveHost , int slavePort , int timeout , Object config ) { return replication ( masterHost , masterPort , slaveHost , slavePort , timeout , config , null , null ) ; }


Input: 按指定配置生成master / slave且使用连接池的客户端 [CODESPLIT] public static final SSDB replication ( String masterHost , int masterPort , String slaveHost , int slavePort , int timeout , Object config , byte [ ] masterAuth , byte [ ] slaveAuth ) { PoolSSDBStream master = _pool ( masterHost , masterPort , timeout , config , masterAuth ) ; PoolSSDBStream slave = _pool ( slaveHost , slavePort , timeout , config , slaveAuth ) ; return new SimpleClient ( new ReplicationSSDMStream ( master , slave ) ) ; }


Input: 按ssdb的通信协议写入一个Block <p > < / p > <b > 如果本方法抛异常 应立即关闭输出流< / b > [CODESPLIT] public static void writeBlock ( OutputStream out , byte [ ] data ) throws IOException { if ( data == null ) data = EMPTY_ARG ; out . write ( Integer . toString ( data . length ) . getBytes ( ) ) ; out . write ( ' ' ) ; out . write ( data ) ; out . write ( ' ' ) ; }


Input: 向输出流发送一个命令及其参数 <p > < / p > <b > 如果本方法抛异常 应立即关闭输出流< / b > [CODESPLIT] public static void sendCmd ( OutputStream out , Cmd cmd , byte [ ] ... vals ) throws IOException { SSDBs . writeBlock ( out , cmd . bytes ( ) ) ; for ( byte [ ] bs : vals ) { SSDBs . writeBlock ( out , bs ) ; } out . write ( ' ' ) ; out . flush ( ) ; }


Input: 从输入流读取一个响应 <p > < / p > <b > 如果本方法抛异常 应立即关闭输入流< / b > [CODESPLIT] public static Response readResp ( InputStream in ) throws IOException { Response resp = respFactory . make ( ) ; byte [ ] data = SSDBs . readBlock ( in ) ; if ( data == null ) throw new SSDBException ( "protocol error. unexpect \\n" ) ; resp . stat = new String ( data ) ; while ( true ) { data = SSDBs . readBlock ( in ) ; if ( data == null ) break ; resp . datas . add ( data ) ; } return resp ; }


Input: 判断class是否实现了接口类 [CODESPLIT] public static boolean isContainsInterface ( Class < ? > clazz , Class < ? > interfaceClass ) { Class < ? > [ ] interfaces = clazz . getInterfaces ( ) ; for ( int i = 0 ; i < interfaces . length ; i ++ ) { Class < ? > class1 = interfaces [ i ] ; if ( class1 == interfaceClass ) { return true ; } } return false ; }


Input: 获取该class所表示的父类的泛型数组 <br > 例如如下定义中： [CODESPLIT] public static Type [ ] getGenericTypes ( Class < ? > clazz ) { Type mySuperClass = clazz . getGenericSuperclass ( ) ; System . out . println ( mySuperClass ) ; System . out . println ( mySuperClass . getClass ( ) ) ; Type [ ] types = ( ( ParameterizedType ) mySuperClass ) . getActualTypeArguments ( ) ; for ( int i = 0 ; i < types . length ; i ++ ) { Type type = types [ i ] ; System . out . println ( type ) ; } return types ; }


Input: 获取Class类的所有字段名 <br > 2013 - 10 - 21 下午5 : 19 : 48 [CODESPLIT] public static String [ ] getClassFields ( Class < ? > clazz ) { Field [ ] fields = clazz . getDeclaredFields ( ) ; int length = fields . length ; String [ ] fieldNames = new String [ length ] ; for ( int i = 0 ; i < length ; i ++ ) { Field field = fields [ i ] ; fieldNames [ i ] = field . getName ( ) ; } return fieldNames ; }


Input: 获取Class类的所有非静态字段名 <br > 2013 - 10 - 21 下午5 : 19 : 48 [CODESPLIT] public static Collection < String > getUnstaticClassFieldNameCollection ( Class < ? > clazz ) { if ( clazz == null ) { throw new NullPointerException ( "传入的clazz为空对象！");   } Field [ ] fields = clazz . getDeclaredFields ( ) ; int length = fields . length ; Collection < String > fieldNames = new ArrayList < String > ( ) ; for ( int i = 0 ; i < length ; i ++ ) { Field field = fields [ i ] ; if ( ! Modifier . isStatic ( field . getModifiers ( ) ) ) { fieldNames . add ( field . getName ( ) ) ; } } return fieldNames ; }


Input: 获取Class类的所有字段名 <br > 2013 - 10 - 21 下午5 : 19 : 48 [CODESPLIT] public static String [ ] getClassSimpleFields ( Class < ? > clazz ) { Field [ ] fields = clazz . getDeclaredFields ( ) ; int length = fields . length ; Collection < Field > fieldCollection = new ArrayList < Field > ( ) ; for ( int i = 0 ; i < length ; i ++ ) { Field field = fields [ i ] ; if ( isSimpleType ( field ) ) { fieldCollection . add ( field ) ; } } String [ ] fieldNames = new String [ fieldCollection . size ( ) ] ; int i = 0 ; for ( Iterator iterator = fieldCollection . iterator ( ) ; iterator . hasNext ( ) ; ) { Field field = ( Field ) iterator . next ( ) ; fieldNames [ i ] = field . getName ( ) ; i ++ ; } return fieldNames ; }


Input: 根据get方法获取字段名 [CODESPLIT] public static String getFieldNameByGetMethod ( Method method ) { Assert . notNull ( method ) ; String methodName = method . getName ( ) ; EntityHelper . print ( methodName ) ; if ( methodName . startsWith ( "get" ) ) { String name = methodName . substring ( 3 , 4 ) . toLowerCase ( ) + methodName . substring ( 4 ) ; return name ; } return null ; }


Input: 获取Class类的单例，如果其他类不是使用的该方法，那么必定造成对象引用不一致！因此一定要检查每个对象的构造方式是否一致都是使用本方法来构造 <br > 2013 - 10 - 21 上午11 : 22 : 55 [CODESPLIT] public static final < T > T getSingleton ( Class < T > clazz , Object ... args ) throws Exception { T instance = null ; synchronized ( LOCK ) { instance = ( T ) singletonMap . get ( clazz ) ; if ( instance == null ) { Constructor < ? > constructor = null ; try { constructor = getConstructor ( clazz , args ) ; } catch ( SecurityException e1 ) { } catch ( NoSuchMethodException e1 ) { } if ( constructor != null ) { try { instance = ( T ) constructor . newInstance ( args ) ; } catch ( IllegalArgumentException e ) { } catch ( InstantiationException e ) { } catch ( IllegalAccessException e ) { } catch ( InvocationTargetException e ) { e . printStackTrace ( ) ; } } if ( instance == null ) { Constructor < ? > [ ] constructors = clazz . getConstructors ( ) ; for ( int i = 0 ; i < constructors . length ; i ++ ) { Constructor < ? > constructorVar = constructors [ i ] ; try { instance = ( T ) constructorVar . newInstance ( args ) ; } catch ( IllegalArgumentException e ) { } catch ( InstantiationException e ) { } catch ( IllegalAccessException e ) { } catch ( InvocationTargetException e ) { } } } if ( instance == null ) { throw new NoSuchMethodException ( "无法初始化对象: " + clazz + ";  检 传入的参数 否 合");   } } singletonMap . put ( clazz , instance ) ; } return instance ; }


Input: 根据传入的给予构造参数的传入值获取构造方法 <br > 2013 - 10 - 21 上午11 : 03 : 13 [CODESPLIT] public static Constructor < ? > getConstructor ( Class < ? > clazz , Object ... args ) throws SecurityException , NoSuchMethodException { Constructor < ? > constructor = null ; int length = args . length ; Class < ? > [ ] classes = new Class < ? > [ length ] ; for ( int i = 0 ; i < length ; i ++ ) { Object object = args [ i ] ; classes [ i ] = object . getClass ( ) ; } constructor = clazz . getConstructor ( classes ) ; return constructor ; }


Input: 根据Class类、方法名和传入的参数，获取对应的方法对象 <br > 2013 - 10 - 21 下午4 : 49 : 19 [CODESPLIT] public static Method getMethod ( Class < ? extends Object > clazz , String methodName , Object ... args ) throws SecurityException , NoSuchMethodException { Method method = null ; int length = args . length ; Class < ? > [ ] classes = new Class < ? > [ length ] ; for ( int i = 0 ; i < length ; i ++ ) { Object object = args [ i ] ; classes [ i ] = object . getClass ( ) ; } try { method = clazz . getDeclaredMethod ( methodName , classes ) ; } catch ( Exception e ) { } if ( method == null && args . length > 0 ) { Method [ ] methods = clazz . getDeclaredMethods ( ) ; for ( int i = 0 ; i < methods . length ; i ++ ) { Method methodVar = methods [ i ] ; Class < ? > [ ] types = methodVar . getParameterTypes ( ) ; boolean isThisMethod = false ; if ( types . length == args . length ) { isThisMethod = true ; for ( int j = 0 ; j < types . length && isThisMethod ; j ++ ) { Class < ? > type = types [ j ] ; Object parameter = args [ j ] ; if ( ! typeEquals ( type , parameter ) ) { isThisMethod = false ; } } } if ( isThisMethod ) { method = methodVar ; break ; } } } return method ; }


Input: 根据字段获取Class类的get方法 <br > 2013 - 10 - 21 下午12 : 05 : 53 [CODESPLIT] public static Method getMethodOfBeanByField ( Class < ? > clazz , Field field ) { Method method = prefixMethodOfBeanByField ( "get" , clazz , field ) ; if ( method == null && ( field . getType ( ) . equals ( Boolean . class ) || field . getType ( ) . equals ( boolean . class ) ) ) { method = prefixMethodOfBeanByField ( "is" , clazz , field ) ; } return method ; }


Input: 根据字段获取Class类的set方法 <br > 2013 - 10 - 21 下午12 : 05 : 53 [CODESPLIT] public static Method setMethodOfBeanByField ( Class < ? > clazz , Field field ) { return prefixMethodOfBeanByField ( "set" , clazz , field , field . getType ( ) ) ; }


Input: 根据字段获取Class类的set方法 <br > 2013 - 10 - 21 下午12 : 05 : 53 [CODESPLIT] public static Method prefixMethodOfBeanByField ( String prefix , Class < ? > clazz , Field field , Class < ? > ... argTypes ) { Method method = null ; String fieldName = field . getName ( ) ; StringBuilder builder = new StringBuilder ( prefix ) ; builder . append ( fieldName . substring ( 0 , 1 ) . toUpperCase ( ) ) ; builder . append ( fieldName . substring ( 1 , fieldName . length ( ) ) ) ; String methodName = builder . toString ( ) ; try { method = clazz . getDeclaredMethod ( methodName , argTypes ) ; } catch ( SecurityException e ) { } catch ( NoSuchMethodException e ) { } return method ; }


Input: 获取类的所有超类 <br > 2013 - 9 - 15 下午8 : 16 : 21 [CODESPLIT] public static Collection < Class > getAllSuperClassesOfClass ( Class clazz ) { Collection < Class > classes = new LinkedHashSet < Class > ( ) ; classes . add ( clazz ) ; Class superClass = clazz . getSuperclass ( ) ; while ( superClass != null ) { classes . add ( superClass ) ; superClass = superClass . getSuperclass ( ) ; } return classes ; }


Input: 简单的ToString方法，只会查找简单类型的数据 <br > 2013 - 8 - 14 下午3 : 42 : 01 [CODESPLIT] public static String simpleReflectToString ( Object object ) { if ( object == null ) { return null ; } Class clazz = object . getClass ( ) ; Class superClazz = clazz . getSuperclass ( ) ; StringBuilder builder = new StringBuilder ( clazz . getName ( ) ) ; builder . append ( "@" ) ; builder . append ( Integer . toHexString ( object . hashCode ( ) ) ) ; builder . append ( "[" ) ; Method [ ] methods = clazz . getDeclaredMethods ( ) ; for ( int i = 0 ; i < methods . length ; i ++ ) { Method method = methods [ i ] ; if ( ! isSimpleType ( method . getReturnType ( ) ) ) { continue ; } String methodName = method . getName ( ) ; if ( methodName . startsWith ( "get" ) && ! Modifier . isStatic ( method . getModifiers ( ) ) && Modifier . isPublic ( method . getModifiers ( ) ) ) { try { Object value = method . invoke ( object ) ; String propertyName = methodName . substring ( 3 , 4 ) . toLowerCase ( ) + methodName . substring ( 4 ) ; builder . append ( propertyName ) ; builder . append ( "=" ) ; if ( value == null ) { builder . append ( "<null>" ) ; } else { if ( value . getClass ( ) . isArray ( ) ) { int arraysuperLength = Array . getLength ( value ) ; builder . append ( "{" ) ; for ( int j = 0 ; j < arraysuperLength ; j ++ ) { Object object2 = Array . get ( value , j ) ; builder . append ( object2 . toString ( ) ) ; if ( j < arraysuperLength - 1 ) { builder . append ( ", " ) ; } } builder . append ( "}" ) ; } else { builder . append ( value . toString ( ) ) ; } } builder . append ( ", " ) ; } catch ( IllegalArgumentException e ) { } catch ( IllegalAccessException e ) { } catch ( InvocationTargetException e ) { } } } if ( builder . toString ( ) . contains ( ", " ) ) { builder . replace ( builder . length ( ) - 2 , builder . length ( ) , "" ) ; } builder . append ( "]" ) ; return builder . toString ( ) ; }


Input: 比较两个数组 [CODESPLIT] public static boolean arrayEquals ( Object one , Object anotherOne ) { if ( one == null || anotherOne == null ) { return false ; } else if ( ! one . getClass ( ) . equals ( anotherOne . getClass ( ) ) || ! one . getClass ( ) . isArray ( ) ) { return false ; } else if ( Array . getLength ( one ) != Array . getLength ( anotherOne ) ) { return false ; } return arrayHashCode ( one ) == arrayHashCode ( anotherOne ) ; }


Input: 根据类名获取首字母消息的名称 <br > 2014年2月25日 下午3 : 25 : 46 [CODESPLIT] public static String getClassToBeanName ( Class < ? > clazz ) { String simpleName = clazz . getSimpleName ( ) ; String firstWord = simpleName . substring ( 0 , 1 ) . toLowerCase ( ) ; String otherWords = simpleName . substring ( 1 ) ; return firstWord + otherWords ; }


Input: <p > Delegates to { @link #detectCodepage ( java . io . InputStream int ) } with a buffered input stream of size 10 ( 8 needed as maximum ) . < / p > [CODESPLIT] public Charset detectCodepage ( URL url ) throws IOException { Charset result ; BufferedInputStream in = new BufferedInputStream ( url . openStream ( ) ) ; result = this . detectCodepage ( in , Integer . MAX_VALUE ) ; in . close ( ) ; return result ; }


Input: 读取属性文件 [CODESPLIT] public static Map < String , String > readProperties ( File propertiesFile ) { if ( ! propertiesFile . exists ( ) ) { return null ; } InputStream inputStream = null ; try { inputStream = new FileInputStream ( propertiesFile ) ; return readProperties ( inputStream ) ; } catch ( FileNotFoundException e ) { e . printStackTrace ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } finally { if ( inputStream != null ) { try { inputStream . close ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } } } return null ; }


Input: Return the { @link javax . xml . stream . XMLStreamReader } for the given StAX Source . [CODESPLIT] public static XMLStreamReader getXMLStreamReader ( Source source ) { if ( source instanceof StAXSource ) { return ( ( StAXSource ) source ) . getXMLStreamReader ( ) ; } else if ( source instanceof StaxSource ) { return ( ( StaxSource ) source ) . getXMLStreamReader ( ) ; } else { throw new IllegalArgumentException ( "Source '" + source + "' is neither StaxSource nor StAXSource" ) ; } }


Input: Return the { @link javax . xml . stream . XMLEventReader } for the given StAX Source . [CODESPLIT] public static XMLEventReader getXMLEventReader ( Source source ) { if ( source instanceof StAXSource ) { return ( ( StAXSource ) source ) . getXMLEventReader ( ) ; } else if ( source instanceof StaxSource ) { return ( ( StaxSource ) source ) . getXMLEventReader ( ) ; } else { throw new IllegalArgumentException ( "Source '" + source + "' is neither StaxSource nor StAXSource" ) ; } }


Input: Return the { @link javax . xml . stream . XMLStreamWriter } for the given StAX Result . [CODESPLIT] public static XMLStreamWriter getXMLStreamWriter ( Result result ) { if ( result instanceof StAXResult ) { return ( ( StAXResult ) result ) . getXMLStreamWriter ( ) ; } else if ( result instanceof StaxResult ) { return ( ( StaxResult ) result ) . getXMLStreamWriter ( ) ; } else { throw new IllegalArgumentException ( "Result '" + result + "' is neither StaxResult nor StAXResult" ) ; } }


Input: Return the { @link javax . xml . stream . XMLEventWriter } for the given StAX Result . [CODESPLIT] public static XMLEventWriter getXMLEventWriter ( Result result ) { if ( result instanceof StAXResult ) { return ( ( StAXResult ) result ) . getXMLEventWriter ( ) ; } else if ( result instanceof StaxResult ) { return ( ( StaxResult ) result ) . getXMLEventWriter ( ) ; } else { throw new IllegalArgumentException ( "Result '" + result + "' is neither StaxResult nor StAXResult" ) ; } }


Input: 生成密钥对 [CODESPLIT] private static void generateKeyPair ( ) throws Exception { //        /** RSA算法要求有一个可信任的随机数源 */ //        SecureRandom secureRandom = new SecureRandom(); /** 为RSA算法创建一个KeyPairGenerator对象 */ KeyPairGenerator keyPairGenerator = KeyPairGenerator . getInstance ( ALGORITHM ) ; /** 利用上面的随机数据源初始化这个KeyPairGenerator对象 */ //        keyPairGenerator.initialize(KEYSIZE, secureRandom); keyPairGenerator . initialize ( KEYSIZE ) ; /** 生成密匙对 */ KeyPair keyPair = keyPairGenerator . generateKeyPair ( ) ; /** 得到公钥 */ Key publicKey = keyPair . getPublic ( ) ; /** 得到私钥 */ Key privateKey = keyPair . getPrivate ( ) ; ObjectOutputStream oos1 = null ; ObjectOutputStream oos2 = null ; try { /** 用对象流将生成的密钥写入文件 */ oos1 = new ObjectOutputStream ( new FileOutputStream ( PUBLIC_KEY_FILE ) ) ; oos2 = new ObjectOutputStream ( new FileOutputStream ( PRIVATE_KEY_FILE ) ) ; oos1 . writeObject ( publicKey ) ; oos2 . writeObject ( privateKey ) ; } catch ( Exception e ) { throw e ; } finally { /** 清空缓存，关闭文件输出流 */ oos1 . close ( ) ; oos2 . close ( ) ; } }


Input: 加密方法 [CODESPLIT] private static String encrypt ( String source ) throws Exception { generateKeyPair ( ) ; Key publicKey ; ObjectInputStream ois = null ; try { /** 将文件中的公钥对象读出 */ ois = new ObjectInputStream ( new FileInputStream ( PUBLIC_KEY_FILE ) ) ; publicKey = ( Key ) ois . readObject ( ) ; } catch ( Exception e ) { throw e ; } finally { ois . close ( ) ; } /** 得到Cipher对象来实现对源数据的RSA加密 */ Cipher cipher = Cipher . getInstance ( ALGORITHM ) ; cipher . init ( Cipher . ENCRYPT_MODE , publicKey ) ; byte [ ] b = source . getBytes ( ) ; /** 执行加密操作 */ byte [ ] b1 = cipher . doFinal ( b ) ; BASE64Encoder encoder = new BASE64Encoder ( ) ; return encoder . encode ( b1 ) ; }


Input: 解密算法 [CODESPLIT] private static String decrypt ( String cryptograph ) throws Exception { Key privateKey ; ObjectInputStream ois = null ; try { /** 将文件中的私钥对象读出 */ ois = new ObjectInputStream ( new FileInputStream ( PRIVATE_KEY_FILE ) ) ; privateKey = ( Key ) ois . readObject ( ) ; } catch ( Exception e ) { throw e ; } finally { ois . close ( ) ; } /** 得到Cipher对象对已用公钥加密的数据进行RSA解密 */ Cipher cipher = Cipher . getInstance ( ALGORITHM ) ; cipher . init ( Cipher . DECRYPT_MODE , privateKey ) ; BASE64Decoder decoder = new BASE64Decoder ( ) ; byte [ ] b1 = decoder . decodeBuffer ( cryptograph ) ; /** 执行解密操作 */ byte [ ] b = cipher . doFinal ( b1 ) ; return new String ( b ) ; }


Input: 生成密钥对 [CODESPLIT] public KeyPair generatorKeyPair ( String algorithm , int keySize ) throws NoSuchAlgorithmException { /** 为RSA算法创建一个KeyPairGenerator对象 */ KeyPairGenerator keyPairGenerator = KeyPairGenerator . getInstance ( algorithm ) ; /** 利用上面的随机数据源初始化这个KeyPairGenerator对象 */ //        keyPairGenerator.initialize(KEYSIZE, secureRandom); keyPairGenerator . initialize ( keySize ) ; /** 生成密匙对 */ KeyPair keyPair = keyPairGenerator . generateKeyPair ( ) ; return keyPair ; }


Input: 解密算法 [CODESPLIT] public String decrypt ( String cryptograph , KeyPair keyPair ) throws Exception { return decrypt ( cryptograph , keyPair . getPrivate ( ) ) ; }


Input: Check whether the given exception is compatible with the exceptions declared in a throws clause . [CODESPLIT] public static boolean isCompatibleWithThrowsClause ( Throwable ex , Class < ? > [ ] declaredExceptions ) { if ( ! isCheckedException ( ex ) ) { return true ; } if ( declaredExceptions != null ) { int i = 0 ; while ( i < declaredExceptions . length ) { if ( declaredExceptions [ i ] . isAssignableFrom ( ex . getClass ( ) ) ) { return true ; } i ++ ; } } return false ; }


Input: 将对象序列化到文件 [CODESPLIT] public static File writeObjectToFile ( File folder , Serializable serializable ) throws IOException { Assert . notNull ( folder , "文件夹不能为空");   if ( ! folder . exists ( ) ) { folder . mkdirs ( ) ; } Assert . isTrue ( folder . isDirectory ( ) , folder + "不是文件夹");   File file = new File ( folder , System . currentTimeMillis ( ) + nextIndex ( ) + "" ) ; ObjectOutputStream outputStream = new ObjectOutputStream ( new FileOutputStream ( file ) ) ; outputStream . writeObject ( serializable ) ; outputStream . flush ( ) ; outputStream . close ( ) ; return file ; }


Input: 返回固定长度的 [CODESPLIT] private static String nextIndex ( ) { String rs = "" ; synchronized ( SerializeHelper . class ) { rs += ++ index < 0 ? - index : index ; int least = 3 - rs . length ( ) ; for ( int i = 0 ; i < least ; i ++ ) { rs = "0" + rs ; } return rs ; } }