From c3c6bb5831d402c42424bcc084e0fd8eced9140d Mon Sep 17 00:00:00 2001 From: vovasty Date: Thu, 5 Mar 2009 17:05:41 +0300 Subject: [PATCH] * removed streets from dictionary * added prices and currency into editing --- .../java/ru/rentdom/components/HousingList.java | 38 +++++++++++++++++- .../java/ru/rentdom/entities/coords/Street.java | 43 --------------------- .../main/java/ru/rentdom/entities/coords/Town.java | 11 ------ .../java/ru/rentdom/entities/housing/Housing.java | 12 +++--- .../main/java/ru/rentdom/pages/cabinet/Edit.java | 6 --- .../ru/rentdom/services/coords/CoordsImport.java | 8 +--- .../ru/rentdom/services/coords/CoordsService.java | 8 ---- .../ru/rentdom/components/HousingList.properties | 2 + .../ru/rentdom/components/HousingList.tml | 6 +-- rentdom-web/src/main/webapp/admin/Template.xls | Bin 7168 -> 16384 bytes rentdom-web/src/main/webapp/cabinet/Edit.tml | 8 +++- 11 files changed, 54 insertions(+), 88 deletions(-) delete mode 100644 rentdom-web/src/main/java/ru/rentdom/entities/coords/Street.java create mode 100644 rentdom-web/src/main/resources/ru/rentdom/components/HousingList.properties rewrite rentdom-web/src/main/webapp/admin/Template.xls (86%) diff --git a/rentdom-web/src/main/java/ru/rentdom/components/HousingList.java b/rentdom-web/src/main/java/ru/rentdom/components/HousingList.java index 80b5f13..d85e4db 100644 --- a/rentdom-web/src/main/java/ru/rentdom/components/HousingList.java +++ b/rentdom-web/src/main/java/ru/rentdom/components/HousingList.java @@ -1,23 +1,59 @@ package ru.rentdom.components; +import java.text.DecimalFormat; +import java.text.DecimalFormatSymbols; import java.util.List; import org.apache.tapestry5.annotations.Parameter; import org.apache.tapestry5.annotations.Property; +import org.apache.tapestry5.ioc.Messages; +import org.apache.tapestry5.ioc.annotations.Inject; import ru.rentdom.entities.housing.Housing; +import ru.rentdom.services.coords.CoordsService; public class HousingList { + private DecimalFormat priceFormat=null; + @Parameter(required=true, allowNull=false) @Property(write=false) private List housings; - @SuppressWarnings("unused") @Property private Housing housing; + @Inject + private CoordsService coordsService; + + @Inject + private Messages messages; + public boolean isEmptyList() { return housings.size()==0; } + + public DecimalFormat getPriceFormat() + { + if (priceFormat==null) + { + DecimalFormatSymbols dfs=new DecimalFormatSymbols(); + dfs.setGroupingSeparator(' '); + priceFormat = new DecimalFormat("###,###", dfs); + } + return priceFormat; + } + + public String getPrice() + { + return getPriceFormat().format(housing.getPrice())+" "+housing.getCurrency(); + } + + public String getMetroOrDistrict() + { + if (coordsService.hasMetro(housing.getTown())) + return messages.format("metro", housing.getMetroStation().getName()); + else + return messages.format("distrinc", housing.getDistrict().getName()); + } } diff --git a/rentdom-web/src/main/java/ru/rentdom/entities/coords/Street.java b/rentdom-web/src/main/java/ru/rentdom/entities/coords/Street.java deleted file mode 100644 index a663e94..0000000 --- a/rentdom-web/src/main/java/ru/rentdom/entities/coords/Street.java +++ /dev/null @@ -1,43 +0,0 @@ -package ru.rentdom.entities.coords; - -import java.util.Set; - -import javax.persistence.CascadeType; -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.ManyToOne; -import javax.persistence.OneToMany; -import javax.persistence.Table; - -import ru.rentdom.entities.housing.Housing; - -@Entity(name = "street") -@Table(name = "streets") -public class Street extends Coord{ - private static final long serialVersionUID = -4821414637331301222L; - - private Town town; - private Set housings; - - public Street(){super();} - - public Street(String name, Town town) { - super(name); - this.town = town; - } - @ManyToOne(optional=false, fetch=FetchType.LAZY) - public Town getTown() { - return town; - } - public void setTown(Town town) { - this.town = town; - } - - @OneToMany(mappedBy="street", fetch=FetchType.LAZY, cascade=CascadeType.ALL) - public Set getHousings() { - return housings; - } - public void setHousings(Set housings) { - this.housings = housings; - } -} diff --git a/rentdom-web/src/main/java/ru/rentdom/entities/coords/Town.java b/rentdom-web/src/main/java/ru/rentdom/entities/coords/Town.java index 228db72..9b7630f 100644 --- a/rentdom-web/src/main/java/ru/rentdom/entities/coords/Town.java +++ b/rentdom-web/src/main/java/ru/rentdom/entities/coords/Town.java @@ -19,7 +19,6 @@ public class Town extends Coord{ private static final long serialVersionUID = -6422128437415734774L; private Country country; - private List streets; private List metroStations; private Set housings; @@ -41,16 +40,6 @@ public class Town extends Coord{ @OneToMany(mappedBy="town", fetch=FetchType.LAZY, cascade=CascadeType.ALL) @OrderBy("name ASC") - public List getStreets() { - return streets; - } - - public void setStreets(List streets) { - this.streets = streets; - } - - @OneToMany(mappedBy="town", fetch=FetchType.LAZY, cascade=CascadeType.ALL) - @OrderBy("name ASC") public List getMetroStations() { return metroStations; } diff --git a/rentdom-web/src/main/java/ru/rentdom/entities/housing/Housing.java b/rentdom-web/src/main/java/ru/rentdom/entities/housing/Housing.java index e4e1964..b83f377 100644 --- a/rentdom-web/src/main/java/ru/rentdom/entities/housing/Housing.java +++ b/rentdom-web/src/main/java/ru/rentdom/entities/housing/Housing.java @@ -13,7 +13,6 @@ import net.aramzamzam.commons.hibernate.entities.BasicEntity; import ru.rentdom.entities.User; import ru.rentdom.entities.coords.District; import ru.rentdom.entities.coords.MetroStation; -import ru.rentdom.entities.coords.Street; import ru.rentdom.entities.coords.Town; import ru.rentdom.utils.HousingType; @@ -22,7 +21,7 @@ import ru.rentdom.utils.HousingType; public class Housing extends BasicEntity { private static final long serialVersionUID = -4821414637331301222L; - private Street street; + private String address; private MetroStation metroStation; private District district; private Town town; @@ -35,12 +34,11 @@ public class Housing extends BasicEntity { private Integer price; private String currency; - @ManyToOne(optional=false) - public Street getStreet() { - return street; + public String getAddress() { + return address; } - public void setStreet(Street street) { - this.street = street; + public void setAddress(String address) { + this.address = address; } @ManyToOne(optional=true) diff --git a/rentdom-web/src/main/java/ru/rentdom/pages/cabinet/Edit.java b/rentdom-web/src/main/java/ru/rentdom/pages/cabinet/Edit.java index 0de5553..3228988 100644 --- a/rentdom-web/src/main/java/ru/rentdom/pages/cabinet/Edit.java +++ b/rentdom-web/src/main/java/ru/rentdom/pages/cabinet/Edit.java @@ -18,7 +18,6 @@ import org.apache.tapestry5.ioc.annotations.Inject; import ru.rentdom.entities.coords.District; import ru.rentdom.entities.coords.MetroStation; -import ru.rentdom.entities.coords.Street; import ru.rentdom.entities.coords.Town; import ru.rentdom.entities.housing.Housing; import ru.rentdom.services.coords.CoordsService; @@ -57,10 +56,6 @@ public class Edit extends AbstractCabinetPage{ @InjectSelectionModel(labelField = "name", idField = "id") private List metros; - @SuppressWarnings("unused") - @InjectSelectionModel(labelField = "name", idField = "id") - private List streets; - @Inject private HousingService housingService; @@ -76,7 +71,6 @@ public class Edit extends AbstractCabinetPage{ housing=housing; districts=coordsService.findAllDistricts(town); metros=coordsService.findAllMetroStations(town); - streets=coordsService.findAllStreets(town); activeBlock=blockEditor; } diff --git a/rentdom-web/src/main/java/ru/rentdom/services/coords/CoordsImport.java b/rentdom-web/src/main/java/ru/rentdom/services/coords/CoordsImport.java index ece9f7a..4ce31cc 100644 --- a/rentdom-web/src/main/java/ru/rentdom/services/coords/CoordsImport.java +++ b/rentdom-web/src/main/java/ru/rentdom/services/coords/CoordsImport.java @@ -12,7 +12,6 @@ import ru.rentdom.entities.coords.Coord; import ru.rentdom.entities.coords.Country; import ru.rentdom.entities.coords.District; import ru.rentdom.entities.coords.MetroStation; -import ru.rentdom.entities.coords.Street; import ru.rentdom.entities.coords.Town; import dk.eobjects.metamodel.DataContext; import dk.eobjects.metamodel.DataContextFactory; @@ -42,15 +41,13 @@ public class CoordsImport { Column countryColumn = table.getColumnByName("country"); Column townColumn = table.getColumnByName("town"); Column districtColumn = table.getColumnByName("district"); - Column streetColumn = table.getColumnByName("street"); Column metroColumn = table.getColumnByName("metro"); - Query q = new Query().select(orderColumn, countryColumn, townColumn, districtColumn, streetColumn, metroColumn).from(table); + Query q = new Query().select(orderColumn, countryColumn, townColumn, districtColumn, metroColumn).from(table); DataSet dataSet = dataContext.executeQuery(q); Map countries=new HashMap(); Map towns=new HashMap(); Map districts=new HashMap(); - Map streets=new HashMap(); Map metroStations=new HashMap(); Country country=new Country();; @@ -60,7 +57,6 @@ public class CoordsImport { String sCountry=((String) dataSet.getRow().getValue(countryColumn)).trim(); String sTown=((String) dataSet.getRow().getValue(townColumn)).trim(); String sDistrict=((String) dataSet.getRow().getValue(districtColumn)).trim(); - String sStreet=((String) dataSet.getRow().getValue(streetColumn)).trim(); String sMetro=((String) dataSet.getRow().getValue(metroColumn)).trim(); if (!sCountry.isEmpty() && !sCountry.equalsIgnoreCase((country.getName()))) @@ -93,8 +89,6 @@ public class CoordsImport { if (!sDistrict.isEmpty()) allocate(getKey(country.getName(), town.getName(), sDistrict), new District(sDistrict, town), districts); - if (!sStreet.isEmpty()) - allocate(getKey(country.getName(), town.getName(), sStreet), new Street(sStreet, town), streets); if (!sMetro.isEmpty()) allocate(getKey(country.getName(), town.getName(), sMetro), new MetroStation(sMetro, town), metroStations); diff --git a/rentdom-web/src/main/java/ru/rentdom/services/coords/CoordsService.java b/rentdom-web/src/main/java/ru/rentdom/services/coords/CoordsService.java index e561d21..c5451c5 100644 --- a/rentdom-web/src/main/java/ru/rentdom/services/coords/CoordsService.java +++ b/rentdom-web/src/main/java/ru/rentdom/services/coords/CoordsService.java @@ -8,7 +8,6 @@ import ru.rentdom.dao.CoordsDAO; import ru.rentdom.entities.coords.Coord; import ru.rentdom.entities.coords.District; import ru.rentdom.entities.coords.MetroStation; -import ru.rentdom.entities.coords.Street; import ru.rentdom.entities.coords.Town; public class CoordsService { @@ -38,13 +37,6 @@ public class CoordsService { return coordsDao.findByExample(district,true); } - public List findAllStreets(Town town) - { - Street street=new Street(); - street.setTown(town); - return coordsDao.findByExample(street,true); - } - public List findAllMetroStations(Town town) { MetroStation metroStation=new MetroStation(); diff --git a/rentdom-web/src/main/resources/ru/rentdom/components/HousingList.properties b/rentdom-web/src/main/resources/ru/rentdom/components/HousingList.properties new file mode 100644 index 0000000..a3ccfb0 --- /dev/null +++ b/rentdom-web/src/main/resources/ru/rentdom/components/HousingList.properties @@ -0,0 +1,2 @@ +metro=\u043c. %1$s +district=\u0440-\u043d. %1$s \ No newline at end of file diff --git a/rentdom-web/src/main/resources/ru/rentdom/components/HousingList.tml b/rentdom-web/src/main/resources/ru/rentdom/components/HousingList.tml index cebcbc0..39d45af 100644 --- a/rentdom-web/src/main/resources/ru/rentdom/components/HousingList.tml +++ b/rentdom-web/src/main/resources/ru/rentdom/components/HousingList.tml @@ -9,15 +9,15 @@
- +

${housing.rooms}-комнатная квартира

-

4 500 руб. за сутки

-

м. Коньково,
ул.Островитянова, д.18

+

${price} за сутки

+

${metroOrDistrict},
${housing.address}

diff --git a/rentdom-web/src/main/webapp/admin/Template.xls b/rentdom-web/src/main/webapp/admin/Template.xls dissimilarity index 86% index 0cf9a0b24f72800d36c0e4868e144946e25969f5..64dc1ccf93f5b7fa2859d56ffa5e6c07d8f54029 100644 GIT binary patch literal 16384 zcwX(BU5H&*701^(_k7;(?|WyG=(VAsX<86}RoSfO&( z%|2`Gwf9-S{dM-eN%r~8uNxPid3N??d7UgtL9UEr38s7w(%UAPx}bbKR&%1aA&ql+ zOGzAIA_HIk-dPKE4t2g?7FT}ay@0F8pO7AqPs-g#&mSG!{`m2ej|>jnch}(j?pxk{ z%dLYqPY#0qig(n}HtfUIk?+D&l^JVQ)2=PM{@Cg~pVUOjLr&FsVDT5*7t%HR5qH_@ zea)^n*tIGe@j1Ka59Zk=v+|;@-_L*DNfx;89FQ||N{-4SZ))jID~;rNHz}<;hvg(n z&f|I(wT`3SK;DPkIV7$BN2@=H_Qv&JypH-8rERrd9S=kPWjodZ@Qk;hlR1~#xOA59D1f(!_c%0#dLe< zkH3K(Z^5EqbCgS$F2T@9W6|%pv1VWl)s1Fs37wrIOg#OX=Dk$dE5)f$8AUb629dR#){qI+%FH|>DL`$fIVX%HzR!zJHs*T z6elpN1n6 z=LGhlPg#lXM`!ikN3AhuP$v*);4OIv@LBNQ?;+H7Z_!)!=8)ZoE6TT8`J%TQS%iBB zvU^c>hqni=CB0=UN|wDNcFU61seAXrvE=PXTJ{clHN9;PrHjbiEN{oH2a%S&UEU#F z=e?3R+faA6p%&m?fLozuaXL_QX?-P3?m;hS;m}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