List of usage examples for org.apache.commons.lang3 StringUtils abbreviate
public static String abbreviate(final String str, final int maxWidth)
Abbreviates a String using ellipses.
From source file:org.openestate.io.trovit.TrovitUtils.java
public static String printString100(String value) { value = StringUtils.trimToNull(value); if (value == null) throw new IllegalArgumentException("Can't print string value!"); else/*w w w .ja v a2 s . c o m*/ return StringUtils.abbreviate(value, 100); }
From source file:org.openestate.io.trovit.TrovitUtils.java
public static String printString255(String value) { value = StringUtils.trimToNull(value); if (value == null) throw new IllegalArgumentException("Can't print string value!"); else/*from www. j a v a2 s. c om*/ return StringUtils.abbreviate(value, 255); }
From source file:org.openestate.is24.restapi.utils.RandomRealEstateFactory.java
/** * Create a random {@link RealtorContactDetails}. * * @return//from ww w .j a va2 s . c o m * randomly filled {@link RealtorContactDetails} object */ public RealtorContactDetails createRandomContact() { RealtorContactDetails contact = commonFactory.createRealtorContactDetails(); contact.setAdditionName(StringUtils.abbreviate(LOREM.getWords(1, 5), 30)); contact.setAddress(createRandomAddress()); contact.setBusinessCardContact(false); contact.setCellPhoneNumber("+49 160 123456"); contact.setCellPhoneNumberAreaCode("0160"); contact.setCellPhoneNumberCountryCode("+49"); contact.setCellPhoneNumberSubscriber("123456"); contact.setCompany(StringUtils.abbreviate(LOREM.getWords(1, 15), 100)); contact.setCountryCode(getRandomCountryCode()); contact.setDefaultContact(false); contact.setEmail("test@test.org"); //contact.setExternalId( null ); contact.setFaxNumber("+49 30 123457"); contact.setFaxNumberAreaCode("030"); contact.setFaxNumberCountryCode("+49"); contact.setFaxNumberSubscriber("123457"); contact.setFirstname(LOREM.getFirstName()); //contact.setId( null ); contact.setLastname(LOREM.getLastName()); contact.setLocalPartnerContact(false); contact.setOfficeHours(StringUtils.abbreviate(LOREM.getWords(1, 50), 1000)); contact.setPhoneNumber("+49 30 123456"); contact.setPhoneNumberAreaCode("030"); contact.setPhoneNumberCountryCode("+49"); contact.setPhoneNumberSubscriber("123456"); contact.setPosition(StringUtils.abbreviate(LOREM.getWords(1, 15), 100)); //contact.setRealEstateReferenceCount( null ); contact.setSalutation(getRandomSalutationType()); contact.setShowOnProfilePage(false); contact.setTitle(StringUtils.abbreviate(LOREM.getWords(1, 3), 15)); try { contact.setHomepageUrl(new URL("http://test.org")); contact.setPortraitUrl(new URL("http://test.org/portrait.jpg")); } catch (MalformedURLException ex) { LOGGER.warn("Can't write URL!"); LOGGER.warn("> " + ex.getLocalizedMessage(), ex); } return contact; }
From source file:org.openestate.is24.restapi.utils.RandomRealEstateFactory.java
/** * Initialize a {@link RealEstate} object with random values. * * @param realEstate//from w w w . j a va 2s. c om * object to initialize */ public void init(RealEstate realEstate) { realEstate.setAddress(createRandomObjectAddress()); //realEstate.setApiSearchData( value ); //realEstate.setAttachments( value ); //realEstate.setCreationDate( value ); realEstate.setDescriptionNote(StringUtils.abbreviate(LOREM.getParagraphs(2, 10), 2000)); realEstate.setExternalId(String.valueOf(getRandomInt(1000))); realEstate.setFurnishingNote(StringUtils.abbreviate(LOREM.getParagraphs(2, 10), 2000)); realEstate.setGroupNumber(getRandomInt(100)); //realEstate.setId( value ); realEstate.setLastModificationDate(Calendar.getInstance()); realEstate.setLocationNote(StringUtils.abbreviate(LOREM.getParagraphs(2, 10), 2000)); realEstate.setOtherNote(StringUtils.abbreviate(LOREM.getParagraphs(2, 10), 2000)); //realEstate.setPublishChannels( value ); //realEstate.setRealEstateProjectId( value ); realEstate.setRealEstateState(RealEstateState.ACTIVE); //realEstate.setReferencePriceApiCall( value ); //realEstate.setReferencePriceServiceCall( value ); realEstate.setShowAddress(getRandomBoolean()); realEstate.setTitle(StringUtils.abbreviate(LOREM.getTitle(3, 15), 100)); realEstate.setContact(realEstatesFactory.createRealEstateContact()); realEstate.getContact().setExternalId(String.valueOf(getRandomInt(1000))); if (realEstate instanceof ApartmentBuy) initRealEstate((ApartmentBuy) realEstate); else if (realEstate instanceof ApartmentRent) initRealEstate((ApartmentRent) realEstate); else if (realEstate instanceof AssistedLiving) initRealEstate((AssistedLiving) realEstate); else if (realEstate instanceof CompulsoryAuction) initRealEstate((CompulsoryAuction) realEstate); else if (realEstate instanceof FlatShareRoom) initRealEstate((FlatShareRoom) realEstate); else if (realEstate instanceof GarageBuy) initRealEstate((GarageBuy) realEstate); else if (realEstate instanceof GarageRent) initRealEstate((GarageRent) realEstate); else if (realEstate instanceof Gastronomy) initRealEstate((Gastronomy) realEstate); else if (realEstate instanceof HouseBuy) initRealEstate((HouseBuy) realEstate); else if (realEstate instanceof HouseRent) initRealEstate((HouseRent) realEstate); else if (realEstate instanceof HouseType) initRealEstate((HouseType) realEstate); else if (realEstate instanceof Industry) initRealEstate((Industry) realEstate); else if (realEstate instanceof Investment) initRealEstate((Investment) realEstate); else if (realEstate instanceof LivingBuySite) initRealEstate((LivingBuySite) realEstate); else if (realEstate instanceof LivingRentSite) initRealEstate((LivingRentSite) realEstate); else if (realEstate instanceof Office) initRealEstate((Office) realEstate); else if (realEstate instanceof SeniorCare) initRealEstate((SeniorCare) realEstate); else if (realEstate instanceof ShortTermAccommodation) initRealEstate((ShortTermAccommodation) realEstate); else if (realEstate instanceof SpecialPurpose) initRealEstate((SpecialPurpose) realEstate); else if (realEstate instanceof Store) initRealEstate((Store) realEstate); else if (realEstate instanceof TradeSite) initRealEstate((TradeSite) realEstate); }
From source file:org.openestate.is24.restapi.utils.RandomRealEstateFactory.java
/** * Initialize an {@link Wgs84Address} object with random values. * * @param address/*from ww w . ja v a 2s . c o m*/ * object to initialize */ protected void initAddress(Wgs84Address address) { initAddress((Address) address); address.setPreciseHouseNumber(getRandomBoolean()); address.setQuarter(LOREM.getWords(1, 3)); address.setDescription(commonFactory.createWgs84AddressDescription()); address.getDescription().setText(StringUtils.abbreviate(LOREM.getWords(1, 15), 1000)); //address.setGeoHierarchy( commonFactory.createGeoHierarchy() ); //address.getGeoHierarchy().setCity( value ); //address.getGeoHierarchy().setContinent( value ); //address.getGeoHierarchy().setCountry( value ); //address.getGeoHierarchy().setNeighbourhood( value ); //address.getGeoHierarchy().setQuarter( value ); //address.getGeoHierarchy().setRegion( value ); //address.setWgs84Coordinate( commonFactory.createWgs84Coordinate() ); //address.getWgs84Coordinate().setLatitude( value ); //address.getWgs84Coordinate().setLongitude( value ); }
From source file:org.openestate.is24.restapi.utils.RandomRealEstateFactory.java
/** * Initialize an {@link ApartmentBuy} object with random values. * * @param realEstate//from w w w. j a v a 2 s . c om * object to initialize */ protected void initRealEstate(ApartmentBuy realEstate) { realEstate.setApartmentType(getRandomApartmentType()); realEstate.setBalcony(getRandomBoolean()); realEstate.setBuiltInKitchen(getRandomBoolean()); realEstate.setCellar(getRandomYesNotApplicableType()); realEstate.setCertificateOfEligibilityNeeded(getRandomBoolean()); realEstate.setCondition(getRandomRealEstateCondition()); realEstate.setEnergySourcesEnev2014(createRandomEnergySourcesEnev2014()); realEstate.setFloor(getRandomInt(5)); realEstate.setFreeFrom(StringUtils.abbreviate(LOREM.getWords(1, 10), 50)); realEstate.setGarden(getRandomBoolean()); realEstate.setGuestToilet(getRandomYesNotApplicableType()); realEstate.setHandicappedAccessible(getRandomYesNotApplicableType()); realEstate.setHeatingTypeEnev2014(getRandomHeatingTypeEnev2014()); realEstate.setInteriorQuality(getRandomInteriorQuality()); realEstate.setLastRefurbishment(getRandomInt(1990, 2014)); realEstate.setLift(getRandomBoolean()); realEstate.setListed(getRandomYesNotApplicableType()); realEstate.setLivingSpace(getRandomDecimal(20, 300)); realEstate.setNumberOfBathRooms(getRandomInt(1, 10)); realEstate.setNumberOfBedRooms(getRandomInt(1, 10)); realEstate.setNumberOfFloors(getRandomInt(1, 10)); realEstate.setNumberOfParkingSpaces(getRandomInt(1, 10)); realEstate.setNumberOfRooms(getRandomDecimal(1, 10)); realEstate.setParkingSpacePrice(getRandomDecimal(30, 300)); realEstate.setParkingSpaceType(getRandomParkingSpaceType()); realEstate.setRentalIncome(getRandomDecimal(9999, 9999999)); realEstate.setRented(getRandomYesNotApplicableType()); realEstate.setServiceCharge(getRandomDecimal(50, 500)); realEstate.setSummerResidencePractical(getRandomYesNotApplicableType()); realEstate.setUsableFloorSpace(getRandomDecimal(20, 300)); // construction year if (getRandomBoolean()) { realEstate.setConstructionYear(null); realEstate.setConstructionYearUnknown(true); } else { realEstate.setConstructionYear(getRandomInt(1900, 1960)); } // courtage realEstate.setCourtage(commonFactory.createCourtageInfo()); realEstate.getCourtage().setCourtage(StringUtils.abbreviate(LOREM.getWords(1, 5), 100)); realEstate.getCourtage().setCourtageNote(StringUtils.abbreviate(LOREM.getParagraphs(2, 10), 1000)); realEstate.getCourtage().setHasCourtage(YesNoNotApplicableType.YES); // energy certificate for habitation realEstate.setEnergyPerformanceCertificate(true); realEstate.setEnergyCertificate(commonFactory.createEnergyPerformanceCertificate()); // energy certificate for habitation by consumption if (getRandomBoolean()) { realEstate.setBuildingEnergyRatingType(BuildingEnergyRatingType.ENERGY_CONSUMPTION); if (getRandomBoolean()) { realEstate.getEnergyCertificate() .setEnergyCertificateCreationDate(EnergyCertificateCreationDate.BEFORE_01_MAY_2014); realEstate.setEnergyConsumptionContainsWarmWater(getRandomYesNotApplicableType()); realEstate.setThermalCharacteristic(getRandomDecimal(20, 500)); } else { realEstate.getEnergyCertificate() .setEnergyCertificateCreationDate(EnergyCertificateCreationDate.FROM_01_MAY_2014); realEstate.getEnergyCertificate().setEnergyEfficiencyClass(getRandomEnergyEfficiencyClass()); realEstate.setThermalCharacteristic(getRandomDecimal(20, 500)); } } // energy certificate for habitation by demand else { realEstate.setBuildingEnergyRatingType(BuildingEnergyRatingType.ENERGY_REQUIRED); if (getRandomBoolean()) { realEstate.getEnergyCertificate() .setEnergyCertificateCreationDate(EnergyCertificateCreationDate.BEFORE_01_MAY_2014); realEstate.setThermalCharacteristic(getRandomDecimal(20, 500)); } else { realEstate.getEnergyCertificate() .setEnergyCertificateCreationDate(EnergyCertificateCreationDate.FROM_01_MAY_2014); realEstate.getEnergyCertificate().setEnergyEfficiencyClass(getRandomEnergyEfficiencyClass()); realEstate.setThermalCharacteristic(getRandomDecimal(20, 500)); } } // pricing realEstate.setPrice(getDefaultPrice()); realEstate.getPrice().setMarketingType(MarketingType.PURCHASE); realEstate.getPrice().setPriceIntervalType(PriceIntervalType.ONE_TIME_CHARGE); realEstate.getPrice().setValue(getRandomDecimal(10000, 9999999)); }
From source file:org.openestate.is24.restapi.utils.RandomRealEstateFactory.java
/** * Initialize an {@link ApartmentRent} object with random values. * * @param realEstate// ww w. j a v a 2 s . c o m * object to initialize */ protected void initRealEstate(ApartmentRent realEstate) { realEstate.setApartmentType(getRandomApartmentType()); realEstate.setBalcony(getRandomBoolean()); realEstate.setBaseRent(getRandomDecimal(200, 2500)); realEstate.setBuiltInKitchen(getRandomBoolean()); realEstate.setCellar(getRandomYesNotApplicableType()); realEstate.setCertificateOfEligibilityNeeded(getRandomBoolean()); realEstate.setCondition(getRandomRealEstateCondition()); realEstate.setDeposit(StringUtils.abbreviate(LOREM.getWords(1, 10), 50)); realEstate.setEnergySourcesEnev2014(createRandomEnergySourcesEnev2014()); realEstate.setFloor(getRandomInt(5)); realEstate.setFreeFrom(StringUtils.abbreviate(LOREM.getWords(1, 10), 50)); realEstate.setGarden(getRandomBoolean()); realEstate.setGuestToilet(getRandomYesNotApplicableType()); realEstate.setHandicappedAccessible(getRandomYesNotApplicableType()); realEstate.setHeatingCosts(getRandomDecimal(100, 500)); realEstate.setHeatingCostsInServiceCharge(getRandomYesNo()); realEstate.setHeatingTypeEnev2014(getRandomHeatingTypeEnev2014()); realEstate.setInteriorQuality(getRandomInteriorQuality()); realEstate.setLastRefurbishment(getRandomInt(1990, 2014)); realEstate.setLift(getRandomBoolean()); realEstate.setLivingSpace(getRandomDecimal(20, 300)); realEstate.setNumberOfBathRooms(getRandomInt(1, 10)); realEstate.setNumberOfBedRooms(getRandomInt(1, 10)); realEstate.setNumberOfFloors(getRandomInt(1, 10)); realEstate.setNumberOfParkingSpaces(getRandomInt(1, 10)); realEstate.setNumberOfRooms(getRandomDecimal(1, 10)); realEstate.setParkingSpacePrice(getRandomDecimal(30, 300)); realEstate.setParkingSpaceType(getRandomParkingSpaceType()); realEstate.setPetsAllowed(getRandomPetsAllowedType()); realEstate.setServiceCharge(getRandomDecimal(50, 500)); realEstate.setTotalRent(getRandomDecimal(500, 3000)); realEstate.setUsableFloorSpace(getRandomDecimal(20, 300)); realEstate.setUseAsFlatshareRoom(getRandomYesNotApplicableType()); // construction year if (getRandomBoolean()) { realEstate.setConstructionYear(null); realEstate.setConstructionYearUnknown(true); } else { realEstate.setConstructionYear(getRandomInt(1900, 1980)); } // courtage realEstate.setCourtage(commonFactory.createCourtageInfo()); realEstate.getCourtage().setCourtage(StringUtils.abbreviate(LOREM.getWords(1, 5), 100)); realEstate.getCourtage().setCourtageNote(StringUtils.abbreviate(LOREM.getParagraphs(2, 10), 1000)); realEstate.getCourtage().setHasCourtage(YesNoNotApplicableType.YES); // energy certificate for habitation realEstate.setEnergyPerformanceCertificate(true); realEstate.setEnergyCertificate(commonFactory.createEnergyPerformanceCertificate()); // energy certificate for habitation by consumption if (getRandomBoolean()) { realEstate.setBuildingEnergyRatingType(BuildingEnergyRatingType.ENERGY_CONSUMPTION); if (getRandomBoolean()) { realEstate.getEnergyCertificate() .setEnergyCertificateCreationDate(EnergyCertificateCreationDate.BEFORE_01_MAY_2014); realEstate.setEnergyConsumptionContainsWarmWater(getRandomYesNotApplicableType()); realEstate.setThermalCharacteristic(getRandomDecimal(20, 500)); } else { realEstate.getEnergyCertificate() .setEnergyCertificateCreationDate(EnergyCertificateCreationDate.FROM_01_MAY_2014); realEstate.getEnergyCertificate().setEnergyEfficiencyClass(getRandomEnergyEfficiencyClass()); realEstate.setThermalCharacteristic(getRandomDecimal(20, 500)); } } // energy certificate for habitation by demand else { realEstate.setBuildingEnergyRatingType(BuildingEnergyRatingType.ENERGY_REQUIRED); if (getRandomBoolean()) { realEstate.getEnergyCertificate() .setEnergyCertificateCreationDate(EnergyCertificateCreationDate.BEFORE_01_MAY_2014); realEstate.setThermalCharacteristic(getRandomDecimal(20, 500)); } else { realEstate.getEnergyCertificate() .setEnergyCertificateCreationDate(EnergyCertificateCreationDate.FROM_01_MAY_2014); realEstate.getEnergyCertificate().setEnergyEfficiencyClass(getRandomEnergyEfficiencyClass()); realEstate.setThermalCharacteristic(getRandomDecimal(20, 500)); } } // pricing realEstate.setPrice(getDefaultPrice()); realEstate.getPrice().setMarketingType(MarketingType.RENT); realEstate.getPrice().setPriceIntervalType(PriceIntervalType.MONTH); realEstate.getPrice().setValue(getRandomDecimal(200, 9999)); }
From source file:org.openestate.is24.restapi.utils.RandomRealEstateFactory.java
/** * Initialize an {@link AssistedLiving} object with random values. * * @param realEstate/*from ww w . j a v a 2s .c o m*/ * object to initialize */ protected void initRealEstate(AssistedLiving realEstate) { realEstate.setAmbulantNursingServiceAvailable(getRandomYesNotApplicableType()); realEstate.setBalconyAvailable(getRandomBalconyAvailableType()); realEstate.setBarrierFree(getRandomYesNotApplicableType()); realEstate.setBranchEntry(getRandomBoolean()); realEstate.setCleaningServiceAvailable(getRandomYesNotApplicableType()); realEstate.setCommonRoomsAvailable(getRandomYesNotApplicableType()); realEstate.setCookingFacilitiesAvailable(getRandomYesNotApplicableType()); realEstate.setCounselingAvailable(getRandomYesNotApplicableType()); realEstate.setCulturalProgramAvailable(getRandomYesNotApplicableType()); realEstate.setEmergencyCallInRoomAvailable(getRandomYesNotApplicableType()); realEstate.setEnergySourcesEnev2014(createRandomEnergySourcesEnev2014()); realEstate.setFacilityType(getRandomFacilityType()); realEstate.setFitnessAvailable(getRandomYesNotApplicableType()); realEstate.setGardenAvailable(getRandomYesNotApplicableType()); realEstate.setGuestApartmentsAvailable(getRandomYesNotApplicableType()); realEstate.setHandicappedAccessible(getRandomYesNotApplicableType()); realEstate.setHeatingTypeEnev2014(getRandomHeatingTypeEnev2014()); realEstate.setHomeHelpAvailable(getRandomYesNotApplicableType()); realEstate.setLeisureActivitiesAvailable(getRandomYesNotApplicableType()); realEstate.setLivingSpaceFrom(getRandomDecimal(20, 50)); realEstate.setLivingSpaceTo(getRandomDecimal(50, 150)); realEstate.setLoansAvailable(getRandomYesNotApplicableType()); realEstate.setMedicalAssistanceAvailable(getRandomYesNotApplicableType()); realEstate.setNumberOfLookedAfterApartments(getRandomLong(1, 10)); realEstate.setNumberOfNursingPlaces(getRandomLong(1, 10)); realEstate.setNumberOfRoomsFrom(getRandomDecimal(1, 2)); realEstate.setNumberOfRoomsTo(getRandomDecimal(3, 5)); realEstate.setOwnFurniturePossible(getRandomYesNotApplicableType()); realEstate.setParkingAvailable(getRandomYesNotApplicableType()); realEstate.setPetsAllowed(getRandomPetsAllowedType()); realEstate.setPoolAvailable(getRandomYesNotApplicableType()); realEstate.setPublicTransportationAvailable(getRandomYesNotApplicableType()); realEstate.setReceptionManned(getRandomYesNotApplicableType()); realEstate.setReligiousOfferingsAvailable(getRandomYesNotApplicableType()); realEstate.setRestaurantAvailable(getRandomYesNotApplicableType()); realEstate.setSecurity24Hours(getRandomYesNotApplicableType()); realEstate.setShoppingFacilitiesAvailable(getRandomYesNotApplicableType()); realEstate.setShortDescription(StringUtils.abbreviate(LOREM.getWords(3, 15), 200)); realEstate.setTrialLivingPossible(getRandomYesNotApplicableType()); // construction year if (getRandomBoolean()) { realEstate.setConstructionYear(null); realEstate.setConstructionYearUnknown(true); } else { realEstate.setConstructionYear(getRandomLong(1900, 1980)); } // energy certificate for habitation realEstate.setEnergyCertificate(commonFactory.createEnergyPerformanceCertificate()); // energy certificate for habitation by consumption if (getRandomBoolean()) { realEstate.setBuildingEnergyRatingType(BuildingEnergyRatingType.ENERGY_CONSUMPTION); if (getRandomBoolean()) { realEstate.getEnergyCertificate() .setEnergyCertificateCreationDate(EnergyCertificateCreationDate.BEFORE_01_MAY_2014); realEstate.setEnergyConsumptionContainsWarmWater(getRandomYesNotApplicableType()); realEstate.setThermalCharacteristic(getRandomDecimal(20, 500)); } else { realEstate.getEnergyCertificate() .setEnergyCertificateCreationDate(EnergyCertificateCreationDate.FROM_01_MAY_2014); realEstate.getEnergyCertificate().setEnergyEfficiencyClass(getRandomEnergyEfficiencyClass()); realEstate.setThermalCharacteristic(getRandomDecimal(20, 500)); } } // energy certificate for habitation by demand else { realEstate.setBuildingEnergyRatingType(BuildingEnergyRatingType.ENERGY_REQUIRED); if (getRandomBoolean()) { realEstate.getEnergyCertificate() .setEnergyCertificateCreationDate(EnergyCertificateCreationDate.BEFORE_01_MAY_2014); realEstate.setThermalCharacteristic(getRandomDecimal(20, 500)); } else { realEstate.getEnergyCertificate() .setEnergyCertificateCreationDate(EnergyCertificateCreationDate.FROM_01_MAY_2014); realEstate.getEnergyCertificate().setEnergyEfficiencyClass(getRandomEnergyEfficiencyClass()); realEstate.setThermalCharacteristic(getRandomDecimal(20, 500)); } } // pricing for rent if (getRandomBoolean()) { realEstate.setMarketingType(MarketingType.RENT); realEstate.setMinBaseRent(getDefaultPrice()); realEstate.getMinBaseRent().setMarketingType(MarketingType.RENT); realEstate.getMinBaseRent().setPriceIntervalType(PriceIntervalType.MONTH); realEstate.getMinBaseRent().setValue(getRandomDecimal(500, 5000)); } // pricing for purchase else { realEstate.setMarketingType(MarketingType.PURCHASE); realEstate.setMinPurchasePrice(getDefaultPrice()); realEstate.getMinPurchasePrice().setMarketingType(MarketingType.PURCHASE); realEstate.getMinPurchasePrice().setPriceIntervalType(PriceIntervalType.ONE_TIME_CHARGE); realEstate.getMinPurchasePrice().setValue(getRandomDecimal(50000, 999999)); } }
From source file:org.openestate.is24.restapi.utils.RandomRealEstateFactory.java
/** * Initialize a {@link FlatShareRoom} object with random values. * * @param realEstate//from w w w. j a v a2 s. c o m * object to initialize */ protected void initRealEstate(FlatShareRoom realEstate) { realEstate.setAgeOfFlatMatesFrom(getRandomLong(16, 30)); realEstate.setAgeOfFlatMatesTo(getRandomLong(30, 50)); realEstate.setAgeOfRequestedFrom(getRandomLong(16, 30)); realEstate.setAgeOfRequestedTo(getRandomLong(30, 50)); realEstate.setApartmentType(getRandomApartmentType()); realEstate.setBalcony(getRandomYesNotApplicableType()); realEstate.setBarrierFree(getRandomYesNotApplicableType()); realEstate.setBaseRent(getRandomDecimal(200, 1000)); realEstate.setBathHasShower(getRandomYesNotApplicableType()); realEstate.setBathHasTub(getRandomYesNotApplicableType()); realEstate.setBathHasWc(getRandomYesNotApplicableType()); realEstate.setCellar(getRandomYesNotApplicableType()); realEstate.setDeposit(StringUtils.abbreviate(LOREM.getWords(1, 10), 50)); realEstate.setDishwasher(getRandomYesNotApplicableType()); realEstate.setEnergySourcesEnev2014(createRandomEnergySourcesEnev2014()); realEstate.setFlatShareSize(getRandomInt(2, 8)); realEstate.setFloor(getRandomInt(5)); realEstate.setFlooringType(getRandomFlooringType()); realEstate.setFreeFrom(getRandomCalendar()); realEstate.setFreeUntil(getRandomCalendar()); realEstate.setFurnishing(getRandomYesNoNotApplicableType()); realEstate.setGarden(getRandomYesNotApplicableType()); realEstate.setGuestToilet(getRandomYesNotApplicableType()); realEstate.setHeatingCosts(getRandomDecimal(100, 500)); realEstate.setHeatingCostsInServiceCharge(getRandomYesNo()); realEstate.setHeatingTypeEnev2014(getRandomHeatingTypeEnev2014()); realEstate.setInternetConnection(getRandomInternetConnectionType()); realEstate.setLift(getRandomYesNotApplicableType()); realEstate.setMinimumTermOfLease(getRandomLong(1, 12)); realEstate.setNumberOfBathRooms(getRandomLong(1, 10)); realEstate.setNumberOfFemaleFlatMates(getRandomLong(1, 10)); realEstate.setNumberOfFloors(getRandomLong(1, 10)); realEstate.setNumberOfMaleFlatMates(getRandomLong(1, 10)); realEstate.setNumberOfRequestedFlatMates(getRandomLong(1, 10)); realEstate.setNumberOfRooms(getRandomDecimal(1, 10)); realEstate.setOven(getRandomYesNotApplicableType()); realEstate.setParkingSituation(getRandomParkingSituationType()); realEstate.setPetsAllowed(getRandomPetsAllowedType()); realEstate.setRefrigerator(getRandomYesNotApplicableType()); realEstate.setRequestedGender(getRandomFlatMateGenderType()); realEstate.setRoomSize(getRandomDecimal(4, 20)); realEstate.setServiceCharge(getRandomDecimal(50, 500)); realEstate.setSmokingAllowed(getRandomSmokingAllowedType()); realEstate.setStove(getRandomYesNotApplicableType()); realEstate.setTelephoneConnection(getRandomTelephoneConnectionType()); realEstate.setTotalRent(getRandomDecimal(500, 3000)); realEstate.setTotalSpace(getRandomDecimal(40, 250)); realEstate.setTvConnection(getRandomTvConnectionType()); realEstate.setWashingMachine(getRandomYesNotApplicableType()); // construction year if (getRandomBoolean()) { realEstate.setConstructionYear(null); realEstate.setConstructionYearUnknown(true); } else { realEstate.setConstructionYear(getRandomInt(1900, 1980)); } // courtage realEstate.setCourtage(commonFactory.createCourtageInfo()); realEstate.getCourtage().setCourtage(StringUtils.abbreviate(LOREM.getWords(1, 5), 100)); realEstate.getCourtage().setCourtageNote(StringUtils.abbreviate(LOREM.getParagraphs(2, 10), 1000)); realEstate.getCourtage().setHasCourtage(YesNoNotApplicableType.YES); // energy certificate for habitation realEstate.setEnergyCertificate(commonFactory.createEnergyPerformanceCertificate()); // energy certificate for habitation by consumption if (getRandomBoolean()) { realEstate.setBuildingEnergyRatingType(BuildingEnergyRatingType.ENERGY_CONSUMPTION); if (getRandomBoolean()) { realEstate.getEnergyCertificate() .setEnergyCertificateCreationDate(EnergyCertificateCreationDate.BEFORE_01_MAY_2014); realEstate.setEnergyConsumptionContainsWarmWater(getRandomYesNotApplicableType()); realEstate.setThermalCharacteristic(getRandomDecimal(20, 500)); } else { realEstate.getEnergyCertificate() .setEnergyCertificateCreationDate(EnergyCertificateCreationDate.FROM_01_MAY_2014); realEstate.getEnergyCertificate().setEnergyEfficiencyClass(getRandomEnergyEfficiencyClass()); realEstate.setThermalCharacteristic(getRandomDecimal(20, 500)); } } // energy certificate for habitation by demand else { realEstate.setBuildingEnergyRatingType(BuildingEnergyRatingType.ENERGY_REQUIRED); if (getRandomBoolean()) { realEstate.getEnergyCertificate() .setEnergyCertificateCreationDate(EnergyCertificateCreationDate.BEFORE_01_MAY_2014); realEstate.setThermalCharacteristic(getRandomDecimal(20, 500)); } else { realEstate.getEnergyCertificate() .setEnergyCertificateCreationDate(EnergyCertificateCreationDate.FROM_01_MAY_2014); realEstate.getEnergyCertificate().setEnergyEfficiencyClass(getRandomEnergyEfficiencyClass()); realEstate.setThermalCharacteristic(getRandomDecimal(20, 500)); } } }
From source file:org.openestate.is24.restapi.utils.RandomRealEstateFactory.java
/** * Initialize a {@link GarageBuy} object with random values. * * @param realEstate/* w ww . j a va2s . c om*/ * object to initialize */ protected void initRealEstate(GarageBuy realEstate) { realEstate.setCondition(getRandomRealEstateCondition()); realEstate.setConstructionYear(getRandomInt(1900, 1980)); realEstate.setGarageType(getRandomGarageType()); realEstate.setHeightGarage(getRandomDecimal(1, 3)); realEstate.setLastRefurbishment(getRandomLong(1990, 2014)); realEstate.setLengthGarage(getRandomDecimal(3, 6)); realEstate.setUsableFloorSpace(getRandomDecimal(5, 50)); realEstate.setWidthGarage(getRandomDecimal(3, 6)); // courtage realEstate.setCourtage(commonFactory.createCourtageInfo()); realEstate.getCourtage().setCourtage(StringUtils.abbreviate(LOREM.getWords(1, 5), 100)); realEstate.getCourtage().setCourtageNote(StringUtils.abbreviate(LOREM.getParagraphs(2, 10), 1000)); realEstate.getCourtage().setHasCourtage(YesNoNotApplicableType.YES); // pricing realEstate.setPrice(getDefaultPrice()); realEstate.getPrice().setMarketingType(MarketingType.PURCHASE); realEstate.getPrice().setPriceIntervalType(PriceIntervalType.ONE_TIME_CHARGE); realEstate.getPrice().setValue(getRandomDecimal(1000, 9999)); }