Examples/src/main/java/org/openestate/io/examples/ImmobiliareItWritingExample.java
protected static Property createProperty() {
        // create an example real estate for rent
        Property obj = FACTORY.createFeedPropertiesProperty();
        obj.setBuildingStatus(Status.ABITABILE);
        obj.setCategory(Category.COMMERCIALE);
        obj.setDateExpiration(Calendar.getInstance());
        obj.setDateUpdated(Calendar.getInstance());
        obj.setOperation(Operation.WRITE);
        obj.setUniqueId(RandomStringUtils.random(5));

        obj.setAgent(FACTORY.createFeedPropertiesPropertyAgent());
        obj.getAgent().setEmail("agency@test.org");
        obj.getAgent().setOfficeName("agency name");

        obj.setBlueprints(FACTORY.createFeedPropertiesPropertyBlueprints());
        obj.getBlueprints().getBlueprint().add(createPictureExtended());
        obj.getBlueprints().getBlueprint().add(createPictureExtended());
        obj.getBlueprints().getBlueprint().add(createPictureExtended());

        obj.setBuilding(FACTORY.createBuilding());
        obj.getBuilding().setCategory(Category.COMMERCIALE);
        obj.getBuilding().setClazz(Clazz.SIGNORILE);
        obj.getBuilding().setDetail(PropertyTypeBusiness.ALBERGO);
        obj.getBuilding().setStatus(Status.DISCRETO);
        obj.getBuilding().setType(PropertyType.APPARTAMENTO);

        obj.setExtraFeatures(FACTORY.createFeedPropertiesPropertyExtraFeatures());
        obj.getExtraFeatures().setAirConditioning(RandomUtils.nextInt(0, 2) == 1);
        obj.getExtraFeatures().setBalcony(RandomUtils.nextInt(0, 2) == 1);
        obj.getExtraFeatures().setBathrooms(BigInteger.valueOf(RandomUtils.nextLong(1, 5)));
        obj.getExtraFeatures().setBeamHeight(BigInteger.valueOf(RandomUtils.nextLong(1, 10)));
        obj.getExtraFeatures().setBedrooms(BigInteger.valueOf(RandomUtils.nextLong(1, 5)));
        obj.getExtraFeatures().setBuildYear(RandomUtils.nextInt(1900, 2000));
        obj.getExtraFeatures().setDocDescription("some descriptions");
        obj.getExtraFeatures().setDocSpecification("some specifications");
        obj.getExtraFeatures().setElevator(RandomUtils.nextInt(0, 2) == 1);
        obj.getExtraFeatures().setFloorplannerUrl("http://floorplanner-url.it/");
        obj.getExtraFeatures().setFreeConditions("free conditions");
        obj.getExtraFeatures().setFurniture(Furniture.PARZIALMENTE_ARREDATO);
        obj.getExtraFeatures().setGarden(Garden.NESSUNO);
        obj.getExtraFeatures().setHeating(Heat.AUTONOMO);
        obj.getExtraFeatures().setKitchen(Kitchen.SEMI_ABITABILE);
        obj.getExtraFeatures().setNet(RandomUtils.nextInt(0, 2) == 1);
        obj.getExtraFeatures().setNumFloors(BigInteger.valueOf(RandomUtils.nextLong(1, 5)));
        obj.getExtraFeatures().setOverheadCrane(YesNoReady.READY);
        obj.getExtraFeatures().setReception(RandomUtils.nextInt(0, 2) == 1);
        obj.getExtraFeatures().setRentContract(Rental.LIBERO);
        obj.getExtraFeatures().setSecurityAlarm(RandomUtils.nextInt(0, 2) == 1);
        obj.getExtraFeatures().setTerrace(RandomUtils.nextInt(0, 2) == 1);
        obj.getExtraFeatures().setVirtualTour("virtual tour");

        obj.getExtraFeatures().setAdditionalCosts(FACTORY.createAdditionalCostsType());
        obj.getExtraFeatures().getAdditionalCosts().setCurrency(Currency.getInstance("EUR"));
        obj.getExtraFeatures().getAdditionalCosts().setValue(BigInteger.valueOf(RandomUtils.nextLong(0, 5000)));

        obj.getExtraFeatures().setExternalArea(FACTORY.createLandSizeType());
        obj.getExtraFeatures().getExternalArea().setUnit(LandSizeUnit.M2);
        obj.getExtraFeatures().getExternalArea().setValue(BigInteger.valueOf(RandomUtils.nextLong(50, 5000)));

        obj.getExtraFeatures().setFloor(FACTORY.createFloor());
        obj.getExtraFeatures().getFloor().setType(Floor.FloorType.INTERMEDIO);
        obj.getExtraFeatures().getFloor().setValue(BigInteger.valueOf(RandomUtils.nextLong(0, 10)));

        obj.getExtraFeatures().setGarage(FACTORY.createBox());
        obj.getExtraFeatures().getGarage().setType(Box.BoxType.POSTO_AUTO);
        obj.getExtraFeatures().getGarage().setValue(BigInteger.valueOf(RandomUtils.nextLong(0, 10)));

        obj.getExtraFeatures().setOfficeSize(FACTORY.createSizeType());
        obj.getExtraFeatures().getOfficeSize().setUnit(SizeUnit.M2);
        obj.getExtraFeatures().getOfficeSize().setValue(BigInteger.valueOf(RandomUtils.nextLong(5, 50)));

        obj.setFeatures(FACTORY.createFeedPropertiesPropertyFeatures());
        obj.getFeatures().setEnergyClass(ClassEnergy.D);
        obj.getFeatures().setRooms(RandomUtils.nextInt(1, 5));

        obj.getFeatures().setEnergyPerformance(FACTORY.createClassEnergyPerformance());
        obj.getFeatures().getEnergyPerformance().setCertified(RandomUtils.nextInt(0, 2) == 1);
        obj.getFeatures().getEnergyPerformance().setUnit(EnergyUnit.KWH_M2ANNO);
        obj.getFeatures().getEnergyPerformance().setValue("energy performance");

        obj.getFeatures().setPrice(FACTORY.createPriceType());
        obj.getFeatures().getPrice().setCurrency(Currency.getInstance("EUR"));
        obj.getFeatures().getPrice().setReserved(RandomUtils.nextInt(0, 2) == 1);
        obj.getFeatures().getPrice().setValue(BigInteger.valueOf(RandomUtils.nextLong(500, 5000000)));

        obj.getFeatures().setSize(FACTORY.createSizeType());
        obj.getFeatures().getSize().setUnit(SizeUnit.M2);
        obj.getFeatures().getSize().setValue(BigInteger.valueOf(RandomUtils.nextLong(50, 5000)));

        obj.setLocation(FACTORY.createLocationStructure());
        obj.getLocation().setAdministrativeArea("administrative area");
        obj.getLocation().setCountryCode("DE");

        obj.getLocation().setCity(FACTORY.createLocationStructureCity());
        obj.getLocation().getCity().setCode(BigInteger.ZERO);
        obj.getLocation().getCity().setValue("Berlin");

        obj.getLocation().setLocality(FACTORY.createLocationStructureLocality());
        obj.getLocation().getLocality().setLatitude(BigDecimal.valueOf(RandomUtils.nextDouble(0, 90)));
        obj.getLocation().getLocality().setLongitude(BigDecimal.valueOf(RandomUtils.nextDouble(0, 90)));
        obj.getLocation().getLocality().setPostalCode("13125");

        obj.getLocation().getLocality().setNeighbourhood(FACTORY.createLocationStructureLocalityNeighbourhood());
        obj.getLocation().getLocality().getNeighbourhood().setId(BigInteger.ZERO);
        obj.getLocation().getLocality().getNeighbourhood().setType(LocationNeighbourhoodType.DISTRICT);
        obj.getLocation().getLocality().getNeighbourhood().setValue("about the neighbourhood");

        obj.getLocation().getLocality().setThoroughfare(FACTORY.createLocationStructureLocalityThoroughfare());
        obj.getLocation().getLocality().getThoroughfare().setDisplay(RandomUtils.nextInt(0, 2) == 1);
        obj.getLocation().getLocality().getThoroughfare().setValue("about thoroughfare");

        obj.getLocation().setSubAdministrativeArea(FACTORY.createLocationStructureSubAdministrativeArea());
        obj.getLocation().getSubAdministrativeArea().setCode(RandomStringUtils.random(5));
        obj.getLocation().getSubAdministrativeArea().setValue("Berlin");

        obj.setPictures(FACTORY.createFeedPropertiesPropertyPictures());
        obj.getPictures().getPictureUrlAndPicture().add(createPicture());
        obj.getPictures().getPictureUrlAndPicture().add(createPicture());
        obj.getPictures().getPictureUrlAndPicture().add(createPicture());

        obj.setPropertyType(FACTORY.createProptype());
        obj.getPropertyType().setBusinessType(FACTORY.createBusinessElement());
        obj.getPropertyType().getBusinessType().setCategory(BusinessElement.BusinessElementCategory.IMMOBILE);
        obj.getPropertyType().getBusinessType().setValue(PropertyTypeBusiness.ALTRO);
        obj.getPropertyType().setTerrains(FACTORY.createTerrains());
        obj.getPropertyType().getTerrains().getTerrain().add(TerrainType.SEMINATIVO);
        obj.getPropertyType().setType(PropertyTypeSimple.CASA_INDIPENDENTE);

        obj.setTransactionType(FACTORY.createTransactionType());
        obj.getTransactionType().setAuction(RandomUtils.nextInt(0, 2) == 1);
        obj.getTransactionType().setOwnership(OwnershipType.PARZIALE);
        obj.getTransactionType().setValue("notes about transaction");

        obj.setVideos(FACTORY.createFeedPropertiesPropertyVideos());
        obj.getVideos().getVideo().add(createVideo());
        obj.getVideos().getVideo().add(createVideo());

        return obj;
    }
protected static Property createProperty() {
        // create an example real estate for rent
        Property obj = FACTORY.createFeedPropertiesProperty();
        obj.setBuildingStatus(Status.ABITABILE);
        obj.setCategory(Category.COMMERCIALE);
        obj.setDateExpiration(Calendar.getInstance());
        obj.setDateUpdated(Calendar.getInstance());
        obj.setOperation(Operation.WRITE);
        obj.setUniqueId(RandomStringUtils.random(5));

        obj.setAgent(FACTORY.createFeedPropertiesPropertyAgent());
        obj.getAgent().setEmail("agency@test.org");
        obj.getAgent().setOfficeName("agency name");

        obj.setBlueprints(FACTORY.createFeedPropertiesPropertyBlueprints());
        obj.getBlueprints().getBlueprint().add(createPictureExtended());
        obj.getBlueprints().getBlueprint().add(createPictureExtended());
        obj.getBlueprints().getBlueprint().add(createPictureExtended());

        obj.setBuilding(FACTORY.createBuilding());
        obj.getBuilding().setCategory(Category.COMMERCIALE);
        obj.getBuilding().setClazz(Clazz.SIGNORILE);
        obj.getBuilding().setDetail(PropertyTypeBusiness.ALBERGO);
        obj.getBuilding().setStatus(Status.DISCRETO);
        obj.getBuilding().setType(PropertyType.APPARTAMENTO);

        obj.setExtraFeatures(FACTORY.createFeedPropertiesPropertyExtraFeatures());
        obj.getExtraFeatures().setAirConditioning(RandomUtils.nextInt(0, 2) == 1);
        obj.getExtraFeatures().setBalcony(RandomUtils.nextInt(0, 2) == 1);
        obj.getExtraFeatures().setBathrooms(BigInteger.valueOf(RandomUtils.nextLong(1, 5)));
        obj.getExtraFeatures().setBeamHeight(BigInteger.valueOf(RandomUtils.nextLong(1, 10)));
        obj.getExtraFeatures().setBedrooms(BigInteger.valueOf(RandomUtils.nextLong(1, 5)));
        obj.getExtraFeatures().setBuildYear(RandomUtils.nextInt(1900, 2000));
        obj.getExtraFeatures().setDocDescription("some descriptions");
        obj.getExtraFeatures().setDocSpecification("some specifications");
        obj.getExtraFeatures().setElevator(RandomUtils.nextInt(0, 2) == 1);
        obj.getExtraFeatures().setFloorplannerUrl("http://floorplanner-url.it/");
        obj.getExtraFeatures().setFreeConditions("free conditions");
        obj.getExtraFeatures().setFurniture(Furniture.PARZIALMENTE_ARREDATO);
        obj.getExtraFeatures().setGarden(Garden.NESSUNO);
        obj.getExtraFeatures().setHeating(Heat.AUTONOMO);
        obj.getExtraFeatures().setKitchen(Kitchen.SEMI_ABITABILE);
        obj.getExtraFeatures().setNet(RandomUtils.nextInt(0, 2) == 1);
        obj.getExtraFeatures().setNumFloors(BigInteger.valueOf(RandomUtils.nextLong(1, 5)));
        obj.getExtraFeatures().setOverheadCrane(YesNoReady.READY);
        obj.getExtraFeatures().setReception(RandomUtils.nextInt(0, 2) == 1);
        obj.getExtraFeatures().setRentContract(Rental.LIBERO);
        obj.getExtraFeatures().setSecurityAlarm(RandomUtils.nextInt(0, 2) == 1);
        obj.getExtraFeatures().setTerrace(RandomUtils.nextInt(0, 2) == 1);
        obj.getExtraFeatures().setVirtualTour("virtual tour");

        obj.getExtraFeatures().setAdditionalCosts(FACTORY.createAdditionalCostsType());
        obj.getExtraFeatures().getAdditionalCosts().setCurrency(Currency.getInstance("EUR"));
        obj.getExtraFeatures().getAdditionalCosts().setValue(BigInteger.valueOf(RandomUtils.nextLong(0, 5000)));

        obj.getExtraFeatures().setExternalArea(FACTORY.createLandSizeType());
        obj.getExtraFeatures().getExternalArea().setUnit(LandSizeUnit.M2);
        obj.getExtraFeatures().getExternalArea().setValue(BigInteger.valueOf(RandomUtils.nextLong(50, 5000)));

        obj.getExtraFeatures().setFloor(FACTORY.createFloor());
        obj.getExtraFeatures().getFloor().setType(Floor.FloorType.INTERMEDIO);
        obj.getExtraFeatures().getFloor().setValue(BigInteger.valueOf(RandomUtils.nextLong(0, 10)));

        obj.getExtraFeatures().setGarage(FACTORY.createBox());
        obj.getExtraFeatures().getGarage().setType(Box.BoxType.POSTO_AUTO);
        obj.getExtraFeatures().getGarage().setValue(BigInteger.valueOf(RandomUtils.nextLong(0, 10)));

        obj.getExtraFeatures().setOfficeSize(FACTORY.createSizeType());
        obj.getExtraFeatures().getOfficeSize().setUnit(SizeUnit.M2);
        obj.getExtraFeatures().getOfficeSize().setValue(BigInteger.valueOf(RandomUtils.nextLong(5, 50)));

        obj.setFeatures(FACTORY.createFeedPropertiesPropertyFeatures());
        obj.getFeatures().setEnergyClass(ClassEnergy.D);
        obj.getFeatures().setRooms(RandomUtils.nextInt(1, 5));

        obj.getFeatures().setEnergyPerformance(FACTORY.createClassEnergyPerformance());
        obj.getFeatures().getEnergyPerformance().setCertified(RandomUtils.nextInt(0, 2) == 1);
        obj.getFeatures().getEnergyPerformance().setUnit(EnergyUnit.KWH_M2ANNO);
        obj.getFeatures().getEnergyPerformance().setValue("energy performance");

        obj.getFeatures().setPrice(FACTORY.createPriceType());
        obj.getFeatures().getPrice().setCurrency(Currency.getInstance("EUR"));
        obj.getFeatures().getPrice().setReserved(RandomUtils.nextInt(0, 2) == 1);
        obj.getFeatures().getPrice().setValue(BigInteger.valueOf(RandomUtils.nextLong(500, 5000000)));

        obj.getFeatures().setSize(FACTORY.createSizeType());
        obj.getFeatures().getSize().setUnit(SizeUnit.M2);
        obj.getFeatures().getSize().setValue(BigInteger.valueOf(RandomUtils.nextLong(50, 5000)));

        obj.setLocation(FACTORY.createLocationStructure());
        obj.getLocation().setAdministrativeArea("administrative area");
        obj.getLocation().setCountryCode("DE");

        obj.getLocation().setCity(FACTORY.createLocationStructureCity());
        obj.getLocation().getCity().setCode(BigInteger.ZERO);
        obj.getLocation().getCity().setValue("Berlin");

        obj.getLocation().setLocality(FACTORY.createLocationStructureLocality());
        obj.getLocation().getLocality().setLatitude(BigDecimal.valueOf(RandomUtils.nextDouble(0, 90)));
        obj.getLocation().getLocality().setLongitude(BigDecimal.valueOf(RandomUtils.nextDouble(0, 90)));
        obj.getLocation().getLocality().setPostalCode("13125");

        obj.getLocation().getLocality().setNeighbourhood(FACTORY.createLocationStructureLocalityNeighbourhood());
        obj.getLocation().getLocality().getNeighbourhood().setId(BigInteger.ZERO);
        obj.getLocation().getLocality().getNeighbourhood().setType(LocationNeighbourhoodType.DISTRICT);
        obj.getLocation().getLocality().getNeighbourhood().setValue("about the neighbourhood");

        obj.getLocation().getLocality().setThoroughfare(FACTORY.createLocationStructureLocalityThoroughfare());
        obj.getLocation().getLocality().getThoroughfare().setDisplay(RandomUtils.nextInt(0, 2) == 1);
        obj.getLocation().getLocality().getThoroughfare().setValue("about thoroughfare");

        obj.getLocation().setSubAdministrativeArea(FACTORY.createLocationStructureSubAdministrativeArea());
        obj.getLocation().getSubAdministrativeArea().setCode(RandomStringUtils.random(5));
        obj.getLocation().getSubAdministrativeArea().setValue("Berlin");

        obj.setPictures(FACTORY.createFeedPropertiesPropertyPictures());
        obj.getPictures().getPictureUrlAndPicture().add(createPicture());
        obj.getPictures().getPictureUrlAndPicture().add(createPicture());
        obj.getPictures().getPictureUrlAndPicture().add(createPicture());

        obj.setPropertyType(FACTORY.createProptype());
        obj.getPropertyType().setBusinessType(FACTORY.createBusinessElement());
        obj.getPropertyType().getBusinessType().setCategory(BusinessElement.BusinessElementCategory.IMMOBILE);
        obj.getPropertyType().getBusinessType().setValue(PropertyTypeBusiness.ALTRO);
        obj.getPropertyType().setTerrains(FACTORY.createTerrains());
        obj.getPropertyType().getTerrains().getTerrain().add(TerrainType.SEMINATIVO);
        obj.getPropertyType().setType(PropertyTypeSimple.CASA_INDIPENDENTE);

        obj.setTransactionType(FACTORY.createTransactionType());
        obj.getTransactionType().setAuction(RandomUtils.nextInt(0, 2) == 1);
        obj.getTransactionType().setOwnership(OwnershipType.PARZIALE);
        obj.getTransactionType().setValue("notes about transaction");

        obj.setVideos(FACTORY.createFeedPropertiesPropertyVideos());
        obj.getVideos().getVideo().add(createVideo());
        obj.getVideos().getVideo().add(createVideo());

        return obj;
    }
Create a {@link Property} with some example data.

@return created example object