Examples/src/main/java/org/openestate/io/examples/TrovitWritingExample.java
@SuppressWarnings("CatchMayIgnoreException")
    protected static AdType createAd() {
        // create an example real estate
        AdType ad = FACTORY.createAdType();
        ad.setAddress("object address");
        ad.setAgency("name of the agency");
        ad.setBathrooms(BigDecimal.valueOf(RandomUtils.nextDouble(0, 5)));
        ad.setByOwner(RandomUtils.nextInt(0, 2) == 1);
        ad.setCity("name of the city");
        ad.setCityArea("name of the district");
        ad.setCondition("some notes about the condition");
        ad.setContactEmail("test@mywebsite.org");
        ad.setContactName("John Smith");
        ad.setContactTelephone("0049301234567");
        ad.setContent("some more descriptions");
        ad.setCountry("DE");
        ad.setDate(Calendar.getInstance());
        ad.setEcoScore("A");
        ad.setExpirationDate(Calendar.getInstance());
        ad.setFloorNumber("number of floors");
        ad.setForeclosure(RandomUtils.nextInt(0, 2) == 1);
        ad.setForeclosureType(ForeclosureTypeValue.values()[RandomUtils.nextInt(0, ForeclosureTypeValue.values().length)]);
        ad.setId(RandomStringUtils.random(5));
        ad.setIsFurnished(RandomUtils.nextInt(0, 2) == 1);
        ad.setIsNew(RandomUtils.nextInt(0, 2) == 1);
        ad.setIsRentToOwn(RandomUtils.nextInt(0, 2) == 1);
        ad.setLatitude(BigDecimal.valueOf(RandomUtils.nextDouble(0, 180) - 90));
        ad.setLongitude(BigDecimal.valueOf(RandomUtils.nextDouble(0, 360) - 180));
        ad.setMlsDatabase("notes about mls database");
        ad.setNeighborhood("notes about the neighborhood");
        ad.setOrientation(OrientationValue.values()[RandomUtils.nextInt(0, OrientationValue.values().length)]);
        ad.setParking(RandomUtils.nextInt(0, 2) == 1);
        ad.setPostcode("postcode");
        ad.setPropertyType("notes about the property type");
        ad.setRegion("notes about the region");
        ad.setRooms(BigDecimal.valueOf(RandomUtils.nextDouble(1, 10)));
        ad.setTitle("title of the object");
        ad.setType(TypeValue.values()[RandomUtils.nextInt(0, TypeValue.values().length)]);
        ad.setYear(BigInteger.valueOf(RandomUtils.nextInt(1700, 2017)));

        ad.setFloorArea(FACTORY.createFloorAreaType());
        ad.getFloorArea().setUnit(AreaUnitValue.values()[RandomUtils.nextInt(0, AreaUnitValue.values().length)]);
        ad.getFloorArea().setValue(BigInteger.valueOf(RandomUtils.nextInt(10, 10000)));

        ad.setPictures(FACTORY.createAdTypePictures());
        ad.getPictures().getPicture().add(createPicture(0));
        ad.getPictures().getPicture().add(createPicture(1));
        ad.getPictures().getPicture().add(createPicture(2));

        ad.setPlotArea(FACTORY.createPlotAreaType());
        ad.getPlotArea().setUnit(AreaUnitValue.values()[RandomUtils.nextInt(0, AreaUnitValue.values().length)]);
        ad.getPlotArea().setValue(BigInteger.valueOf(RandomUtils.nextInt(10, 10000)));

        ad.setPrice(FACTORY.createPriceType());
        ad.getPrice().setPeriod(PricePeriodValue.values()[RandomUtils.nextInt(0, PricePeriodValue.values().length)]);
        ad.getPrice().setValue(BigDecimal.valueOf(RandomUtils.nextDouble(100, 2000)).setScale(2, RoundingMode.HALF_EVEN));

        try {
            ad.setUrl(new URI("http://mywebsite.org/"));
            ad.setMobileUrl(new URI("http://mobile.mywebsite.org/"));
            ad.setVirtualTour(new URI("http://tour.mywebsite.org/"));
        } catch (URISyntaxException ex) {
        }

        return ad;
    }
@SuppressWarnings("CatchMayIgnoreException")
    protected static AdType createAd() {
        // create an example real estate
        AdType ad = FACTORY.createAdType();
        ad.setAddress("object address");
        ad.setAgency("name of the agency");
        ad.setBathrooms(BigDecimal.valueOf(RandomUtils.nextDouble(0, 5)));
        ad.setByOwner(RandomUtils.nextInt(0, 2) == 1);
        ad.setCity("name of the city");
        ad.setCityArea("name of the district");
        ad.setCondition("some notes about the condition");
        ad.setContactEmail("test@mywebsite.org");
        ad.setContactName("John Smith");
        ad.setContactTelephone("0049301234567");
        ad.setContent("some more descriptions");
        ad.setCountry("DE");
        ad.setDate(Calendar.getInstance());
        ad.setEcoScore("A");
        ad.setExpirationDate(Calendar.getInstance());
        ad.setFloorNumber("number of floors");
        ad.setForeclosure(RandomUtils.nextInt(0, 2) == 1);
        ad.setForeclosureType(ForeclosureTypeValue.values()[RandomUtils.nextInt(0, ForeclosureTypeValue.values().length)]);
        ad.setId(RandomStringUtils.random(5));
        ad.setIsFurnished(RandomUtils.nextInt(0, 2) == 1);
        ad.setIsNew(RandomUtils.nextInt(0, 2) == 1);
        ad.setIsRentToOwn(RandomUtils.nextInt(0, 2) == 1);
        ad.setLatitude(BigDecimal.valueOf(RandomUtils.nextDouble(0, 180) - 90));
        ad.setLongitude(BigDecimal.valueOf(RandomUtils.nextDouble(0, 360) - 180));
        ad.setMlsDatabase("notes about mls database");
        ad.setNeighborhood("notes about the neighborhood");
        ad.setOrientation(OrientationValue.values()[RandomUtils.nextInt(0, OrientationValue.values().length)]);
        ad.setParking(RandomUtils.nextInt(0, 2) == 1);
        ad.setPostcode("postcode");
        ad.setPropertyType("notes about the property type");
        ad.setRegion("notes about the region");
        ad.setRooms(BigDecimal.valueOf(RandomUtils.nextDouble(1, 10)));
        ad.setTitle("title of the object");
        ad.setType(TypeValue.values()[RandomUtils.nextInt(0, TypeValue.values().length)]);
        ad.setYear(BigInteger.valueOf(RandomUtils.nextInt(1700, 2017)));

        ad.setFloorArea(FACTORY.createFloorAreaType());
        ad.getFloorArea().setUnit(AreaUnitValue.values()[RandomUtils.nextInt(0, AreaUnitValue.values().length)]);
        ad.getFloorArea().setValue(BigInteger.valueOf(RandomUtils.nextInt(10, 10000)));

        ad.setPictures(FACTORY.createAdTypePictures());
        ad.getPictures().getPicture().add(createPicture(0));
        ad.getPictures().getPicture().add(createPicture(1));
        ad.getPictures().getPicture().add(createPicture(2));

        ad.setPlotArea(FACTORY.createPlotAreaType());
        ad.getPlotArea().setUnit(AreaUnitValue.values()[RandomUtils.nextInt(0, AreaUnitValue.values().length)]);
        ad.getPlotArea().setValue(BigInteger.valueOf(RandomUtils.nextInt(10, 10000)));

        ad.setPrice(FACTORY.createPriceType());
        ad.getPrice().setPeriod(PricePeriodValue.values()[RandomUtils.nextInt(0, PricePeriodValue.values().length)]);
        ad.getPrice().setValue(BigDecimal.valueOf(RandomUtils.nextDouble(100, 2000)).setScale(2, RoundingMode.HALF_EVEN));

        try {
            ad.setUrl(new URI("http://mywebsite.org/"));
            ad.setMobileUrl(new URI("http://mobile.mywebsite.org/"));
            ad.setVirtualTour(new URI("http://tour.mywebsite.org/"));
        } catch (URISyntaxException ex) {
        }

        return ad;
    }
Create an {@link AdType} with some example data.

@return created example object