Wao-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
April 2013
- 2 participants
- 14 discussions
Author: bleny
Date: 2013-04-19 18:51:52 +0200 (Fri, 19 Apr 2013)
New Revision: 1647
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1647
Log:
use i18n snapshot
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2013-04-11 12:32:25 UTC (rev 1646)
+++ trunk/pom.xml 2013-04-19 16:51:52 UTC (rev 1647)
@@ -337,7 +337,7 @@
<license.licenseName>agpl_v3</license.licenseName>
<!-- libraries version -->
- <nuitonI18nVersion>2.5</nuitonI18nVersion>
+ <nuitonI18nVersion>2.5.1-SNAPSHOT</nuitonI18nVersion>
<nuitonUtilsVersion>2.6.12</nuitonUtilsVersion>
<nuitonCsvVersion>2.6.12.1</nuitonCsvVersion>
<nuitonWebVersion>1.10</nuitonWebVersion>
1
0
11 Apr '13
Author: bleny
Date: 2013-04-11 14:32:25 +0200 (Thu, 11 Apr 2013)
New Revision: 1646
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1646
Log:
fixes #1967 WAO OBSVENTE : saisir plusieurs quartiers maritime par ligne du plan
Added:
trunk/wao-business/src/main/java/fr/ifremer/wao/io/csv2/models/operations/DistrictNamesFormatter.java
trunk/wao-business/src/main/java/fr/ifremer/wao/io/csv2/models/operations/DistrictsParserFormatter.java
Removed:
trunk/wao-business/src/main/java/fr/ifremer/wao/io/csv2/models/operations/DistrictParserFormatter.java
trunk/wao-business/src/main/java/fr/ifremer/wao/io/csv2/models/operations/SampleRowDistrictNameGetter.java
Modified:
trunk/wao-business/src/main/java/fr/ifremer/wao/PostgresMigrationCallback.java
trunk/wao-business/src/main/java/fr/ifremer/wao/WaoMigrationCallBack.java
trunk/wao-business/src/main/java/fr/ifremer/wao/bean/SamplingFilterValuesImpl.java
trunk/wao-business/src/main/java/fr/ifremer/wao/entity/SampleRowDAOImpl.java
trunk/wao-business/src/main/java/fr/ifremer/wao/entity/SampleRowImpl.java
trunk/wao-business/src/main/java/fr/ifremer/wao/entity/SampleRowLogImpl.java
trunk/wao-business/src/main/java/fr/ifremer/wao/io/csv2/models/BoatImportExportModel.java
trunk/wao-business/src/main/java/fr/ifremer/wao/io/csv2/models/ObsDebSamplingPlanImportExportModel.java
trunk/wao-business/src/main/java/fr/ifremer/wao/io/csv2/models/ObsMerObsVenteSamplingPlanImportExportModel.java
trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceSamplingImpl.java
trunk/wao-business/src/main/xmi/wao.zargo
trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/SampleRowForm.java
trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/SamplingPlan.java
trunk/wao-ui/src/main/resources/i18n/wao-ui_en_GB.properties
trunk/wao-ui/src/main/resources/i18n/wao-ui_fr_FR.properties
trunk/wao-ui/src/main/webapp/SampleRowForm.tml
trunk/wao-ui/src/main/webapp/SamplingPlan.tml
Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/PostgresMigrationCallback.java
===================================================================
--- trunk/wao-business/src/main/java/fr/ifremer/wao/PostgresMigrationCallback.java 2013-04-08 14:04:19 UTC (rev 1645)
+++ trunk/wao-business/src/main/java/fr/ifremer/wao/PostgresMigrationCallback.java 2013-04-11 12:32:25 UTC (rev 1646)
@@ -1179,4 +1179,27 @@
}
+ @Override
+ protected void addMultiplicityBetweenSampleRowsAndTerrestrialLocations_3_4(List<String> queries) {
+
+ queries.add("CREATE TABLE SampleRow_TerrestrialLocations ( "
+ + " sampleRow character varying(255) NOT NULL, "
+ + " terrestrialLocations character varying(255) NOT NULL, "
+ + " CONSTRAINT sampleRowForeignKey FOREIGN KEY (sampleRow) "
+ + " REFERENCES SampleRow (topiaId) MATCH SIMPLE "
+ + " ON UPDATE NO ACTION ON DELETE NO ACTION, "
+ + " CONSTRAINT terrestrialLocationsForeignKey FOREIGN KEY (terrestrialLocations) "
+ + " REFERENCES TerrestrialLocation (topiaId) MATCH SIMPLE "
+ + " ON UPDATE NO ACTION ON DELETE NO ACTION "
+ + "); "
+ );
+
+ queries.add("INSERT INTO SampleRow_TerrestrialLocations (sampleRow, terrestrialLocations) "
+ + " SELECT sr.topiaId, sr.terrestrialLocation "
+ + " FROM SampleRow sr "
+ + " WHERE sr.terrestrialLocation IS NOT NULL ");
+
+ queries.add("ALTER TABLE SampleRow DROP COLUMN terrestrialLocation");
+
+ }
}
Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/WaoMigrationCallBack.java
===================================================================
--- trunk/wao-business/src/main/java/fr/ifremer/wao/WaoMigrationCallBack.java 2013-04-08 14:04:19 UTC (rev 1645)
+++ trunk/wao-business/src/main/java/fr/ifremer/wao/WaoMigrationCallBack.java 2013-04-11 12:32:25 UTC (rev 1646)
@@ -192,7 +192,8 @@
VersionUtil.valueOf("3.1"),
VersionUtil.valueOf("3.2"),
VersionUtil.valueOf("3.3"),
- VersionUtil.valueOf("3.3.2")
+ VersionUtil.valueOf("3.3.2"),
+ VersionUtil.valueOf("3.4")
};
@Override
@@ -655,4 +656,20 @@
}
protected abstract void addUniqueConstraintOnAllegroWallet_3_3_2(TopiaContextImplementor tx, List<String> queries) throws TopiaException;
+
+ public void migrateTo_3_4(TopiaContextImplementor tx,
+ boolean showSql,
+ boolean showProgression) throws TopiaException {
+
+ List<String> queries = new LinkedList<String>();
+
+ addMultiplicityBetweenSampleRowsAndTerrestrialLocations_3_4(queries);
+
+ String[] strings = queries.toArray(new String[queries.size()]);
+ executeSQL(tx, showSql, showProgression, strings);
+
+ }
+
+ protected abstract void addMultiplicityBetweenSampleRowsAndTerrestrialLocations_3_4(List<String> queries);
+
}
Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/bean/SamplingFilterValuesImpl.java
===================================================================
--- trunk/wao-business/src/main/java/fr/ifremer/wao/bean/SamplingFilterValuesImpl.java 2013-04-08 14:04:19 UTC (rev 1645)
+++ trunk/wao-business/src/main/java/fr/ifremer/wao/bean/SamplingFilterValuesImpl.java 2013-04-11 12:32:25 UTC (rev 1646)
@@ -148,7 +148,7 @@
}
}
if (ObsProgram.OBSVENTE.equals(obsProgram)) {
- addTerrestrialDistricts(sampleRow.getTerrestrialLocation());
+ addAllTerrestrialDistricts(sampleRow.getTerrestrialLocations());
}
}
addSampleRows(sampleRow);
Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/entity/SampleRowDAOImpl.java
===================================================================
--- trunk/wao-business/src/main/java/fr/ifremer/wao/entity/SampleRowDAOImpl.java 2013-04-08 14:04:19 UTC (rev 1645)
+++ trunk/wao-business/src/main/java/fr/ifremer/wao/entity/SampleRowDAOImpl.java 2013-04-11 12:32:25 UTC (rev 1646)
@@ -159,7 +159,8 @@
}
if (filter.getTerrestrialDistrict() != null) {
- query.addEquals(SampleRow.PROPERTY_TERRESTRIAL_LOCATION, filter.getTerrestrialDistrict());
+ query.addInElements(":terrestrialDistrict", SampleRow.PROPERTY_TERRESTRIAL_LOCATIONS);
+ query.addParam("terrestrialDistrict", filter.getTerrestrialDistrict());
}
if (filter.getObservationUnit() != null) {
@@ -179,13 +180,14 @@
}
if (filter.getRegionIfremer() != null) {
- String regionIfremerProperty;
if (filter.getExpectedObservationType() == ObservationType.FIELD_WORK_OBSERVATION) {
- regionIfremerProperty = SampleRow.PROPERTY_OBSERVATION_UNIT + "." + TerrestrialDivision.PROPERTY_REGION_IFREMER;
+ query.addEquals(
+ SampleRow.PROPERTY_OBSERVATION_UNIT + "." + TerrestrialDivision.PROPERTY_REGION_IFREMER,
+ filter.getRegionIfremer());
} else {
- regionIfremerProperty = SampleRow.PROPERTY_TERRESTRIAL_LOCATION;
+ query.addInElements(":regionIfremer", SampleRow.PROPERTY_TERRESTRIAL_LOCATIONS);
+ query.addParam("regionIfremer", filter.getRegionIfremer());
}
- query.addEquals(regionIfremerProperty, filter.getRegionIfremer());
}
if (filter.getSampleRowObserver() != null) {
Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/entity/SampleRowImpl.java
===================================================================
--- trunk/wao-business/src/main/java/fr/ifremer/wao/entity/SampleRowImpl.java 2013-04-08 14:04:19 UTC (rev 1645)
+++ trunk/wao-business/src/main/java/fr/ifremer/wao/entity/SampleRowImpl.java 2013-04-11 12:32:25 UTC (rev 1646)
@@ -28,6 +28,7 @@
import fr.ifremer.wao.bean.ObsProgram;
import fr.ifremer.wao.bean.ObservationType;
import fr.ifremer.wao.bean.SamplingStrategy;
+import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DurationFormatUtils;
@@ -490,6 +491,22 @@
}
@Override
+ public void setTerrestrialLocation(TerrestrialLocation terrestrialLocation) {
+ clearTerrestrialLocations();
+ addTerrestrialLocations(terrestrialLocation);
+ }
+
+ @Override
+ public TerrestrialLocation getTerrestrialLocation() {
+ TerrestrialLocation terrestrialLocation = null;
+ if ( ! isTerrestrialLocationsEmpty()) {
+ terrestrialLocation = (TerrestrialLocation)
+ CollectionUtils.get(getTerrestrialLocations(), 0);
+ }
+ return terrestrialLocation;
+ }
+
+ @Override
public String toString() {
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append(getCode()).append(" (").append(getObsProgram());
Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/entity/SampleRowLogImpl.java
===================================================================
--- trunk/wao-business/src/main/java/fr/ifremer/wao/entity/SampleRowLogImpl.java 2013-04-08 14:04:19 UTC (rev 1645)
+++ trunk/wao-business/src/main/java/fr/ifremer/wao/entity/SampleRowLogImpl.java 2013-04-11 12:32:25 UTC (rev 1646)
@@ -26,7 +26,6 @@
import fr.ifremer.wao.WaoUtils;
import fr.ifremer.wao.bean.ObsProgram;
-import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.nuiton.util.DateUtil;
@@ -196,10 +195,46 @@
}
protected void compareTerrestrialLocations() {
- if (ObjectUtils.notEqual(oldRow.getTerrestrialLocation(), newRow.getTerrestrialLocation())) {
- addChange("Le lieu est passé de " + oldRow.getTerrestrialLocation().getDescription()
- + " à " + newRow.getTerrestrialLocation().getDescription());
+ Collection<TerrestrialLocation> oldTerrestrialLocations;
+ if (oldRow == null) {
+ oldTerrestrialLocations = Collections.emptyList();
+ } else {
+ oldTerrestrialLocations = oldRow.getTerrestrialLocations();
}
+ Collection<TerrestrialLocation> newTerrestrialLocations = newRow.getTerrestrialLocations();
+
+ // Lists for boats by status
+ List<String> removedTerrestrialLocations = new ArrayList<String>();
+ List<String> keptTerrestrialLocations = new ArrayList<String>();
+ List<String> addedTerrestrialLocations = new ArrayList<String>();
+
+ // filling the three lists
+ for (TerrestrialLocation oldTerrestrialLocation : oldTerrestrialLocations) {
+ if ( ! newTerrestrialLocations.contains(oldTerrestrialLocation)) {
+ removedTerrestrialLocations.add(oldTerrestrialLocation.getCode());
+ }
+ }
+ for (TerrestrialLocation newTerrestrialLocation : newTerrestrialLocations) {
+ if (oldTerrestrialLocations.contains(newTerrestrialLocation)) {
+ keptTerrestrialLocations.add(newTerrestrialLocation.getCode());
+ } else {
+ addedTerrestrialLocations.add(newTerrestrialLocation.getCode());
+ }
+ }
+
+ // using the three list to add info
+ if ( ! removedTerrestrialLocations.isEmpty()) {
+ addChange("Les quartiers maritimes suivants ont été dissociées : " +
+ StringUtils.join(removedTerrestrialLocations, ", "));
+ }
+// if ( ! keptTerrestrialLocations.isEmpty()) {
+// addChange("Les quartiers maritimes suivants sont toujours associées : " +
+// StringUtils.join(keptTerrestrialLocations, ", "));
+// }
+ if ( ! addedTerrestrialLocations.isEmpty()) {
+ addChange("Les quartiers maritimes ont été ajoutées : " +
+ StringUtils.join(addedTerrestrialLocations, ", "));
+ }
}
protected void compareCompanies() {
Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/io/csv2/models/BoatImportExportModel.java
===================================================================
--- trunk/wao-business/src/main/java/fr/ifremer/wao/io/csv2/models/BoatImportExportModel.java 2013-04-08 14:04:19 UTC (rev 1645)
+++ trunk/wao-business/src/main/java/fr/ifremer/wao/io/csv2/models/BoatImportExportModel.java 2013-04-11 12:32:25 UTC (rev 1646)
@@ -29,7 +29,7 @@
import fr.ifremer.wao.entity.ShipOwnerImpl;
import fr.ifremer.wao.entity.TerrestrialLocation;
import fr.ifremer.wao.io.csv2.models.operations.BoatImmatriculationParserFormatter;
-import fr.ifremer.wao.io.csv2.models.operations.DistrictParserFormatter;
+import fr.ifremer.wao.io.csv2.models.operations.DistrictsParserFormatter;
import fr.ifremer.wao.io.csv2.models.operations.PortParserFormatter;
import org.apache.commons.lang3.StringUtils;
import org.nuiton.util.csv.Common;
@@ -131,7 +131,7 @@
// boat district
modelBuilder.newColumnForImportExport("QUARTIER_CODE",
Boat.PROPERTY_DISTRICT,
- new DistrictParserFormatter(districts));
+ new DistrictsParserFormatter(districts));
// port of registry
modelBuilder.newColumnForImportExport("PORT_CODE",
Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/io/csv2/models/ObsDebSamplingPlanImportExportModel.java
===================================================================
--- trunk/wao-business/src/main/java/fr/ifremer/wao/io/csv2/models/ObsDebSamplingPlanImportExportModel.java 2013-04-08 14:04:19 UTC (rev 1645)
+++ trunk/wao-business/src/main/java/fr/ifremer/wao/io/csv2/models/ObsDebSamplingPlanImportExportModel.java 2013-04-11 12:32:25 UTC (rev 1646)
@@ -262,7 +262,7 @@
} else if (observationType == ObservationType.PHONE_CALL) {
modelBuilder.newColumnForImportExport(
"REGION_IFREMER",
- SampleRow.PROPERTY_TERRESTRIAL_LOCATION,
+ "terrestrialLocation",
new RegionParserFormatter(allRegions));
modelBuilder.newColumnForImportExport(
"OBSERVATION_DATE",
Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/io/csv2/models/ObsMerObsVenteSamplingPlanImportExportModel.java
===================================================================
--- trunk/wao-business/src/main/java/fr/ifremer/wao/io/csv2/models/ObsMerObsVenteSamplingPlanImportExportModel.java 2013-04-08 14:04:19 UTC (rev 1645)
+++ trunk/wao-business/src/main/java/fr/ifremer/wao/io/csv2/models/ObsMerObsVenteSamplingPlanImportExportModel.java 2013-04-11 12:32:25 UTC (rev 1646)
@@ -212,8 +212,8 @@
if (obsProgram == ObsProgram.OBSVENTE) {
modelBuilder.newColumnForImportExport("PLAN_STRATEGIE", "samplingStrategy", new Common.ToStringParserFormatter<SamplingStrategy>(SamplingStrategy.values()));
- modelBuilder.newColumnForImportExport("PLAN_LIEU_CODE", SampleRow.PROPERTY_TERRESTRIAL_LOCATION, new DistrictParserFormatter(terrestrialDistricts));
- modelBuilder.newColumnForExport("PLAN_LIEU_NOM", new SampleRowDistrictNameGetter());
+ modelBuilder.newColumnForImportExport("PLAN_LIEU_CODE", SampleRow.PROPERTY_TERRESTRIAL_LOCATIONS, new DistrictsParserFormatter(terrestrialDistricts));
+ modelBuilder.newColumnForExport("PLAN_LIEU_NOM", SampleRow.PROPERTY_TERRESTRIAL_LOCATIONS, new DistrictNamesFormatter());
modelBuilder.newIgnoredColumn("PLAN_LIEU_NOM");
modelBuilder.newColumnForImportExport("PLAN_LIEU_COMMENT", SampleRow.PROPERTY_TERRESTRIAL_LOCATION_INFOS);
}
Copied: trunk/wao-business/src/main/java/fr/ifremer/wao/io/csv2/models/operations/DistrictNamesFormatter.java (from rev 1644, trunk/wao-business/src/main/java/fr/ifremer/wao/io/csv2/models/operations/SampleRowDistrictNameGetter.java)
===================================================================
--- trunk/wao-business/src/main/java/fr/ifremer/wao/io/csv2/models/operations/DistrictNamesFormatter.java (rev 0)
+++ trunk/wao-business/src/main/java/fr/ifremer/wao/io/csv2/models/operations/DistrictNamesFormatter.java 2013-04-11 12:32:25 UTC (rev 1646)
@@ -0,0 +1,47 @@
+/*
+ * #%L
+ * Wao :: Business
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+package fr.ifremer.wao.io.csv2.models.operations;
+
+import com.google.common.base.Joiner;
+import fr.ifremer.wao.entity.TerrestrialLocation;
+import org.nuiton.util.csv.ValueFormatter;
+
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
+
+public class DistrictNamesFormatter implements ValueFormatter<Collection<TerrestrialLocation>> {
+
+ @Override
+ public String format(Collection<TerrestrialLocation> terrestrialLocations) {
+ List<String> districtNames = new LinkedList<String>();
+ if (terrestrialLocations != null) {
+ for (TerrestrialLocation terrestrialLocation : terrestrialLocations) {
+ districtNames.add(terrestrialLocation.getDistrictName());
+ }
+ }
+ String value = Joiner.on(", ").join(districtNames);
+ return value;
+ }
+}
Deleted: trunk/wao-business/src/main/java/fr/ifremer/wao/io/csv2/models/operations/DistrictParserFormatter.java
===================================================================
--- trunk/wao-business/src/main/java/fr/ifremer/wao/io/csv2/models/operations/DistrictParserFormatter.java 2013-04-08 14:04:19 UTC (rev 1645)
+++ trunk/wao-business/src/main/java/fr/ifremer/wao/io/csv2/models/operations/DistrictParserFormatter.java 2013-04-11 12:32:25 UTC (rev 1646)
@@ -1,71 +0,0 @@
-/*
- * #%L
- * Wao :: Business
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2009 - 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-package fr.ifremer.wao.io.csv2.models.operations;
-
-import fr.ifremer.wao.WaoUtils;
-import fr.ifremer.wao.entity.TerrestrialLocation;
-import org.nuiton.util.csv.ValueParserFormatter;
-
-import java.text.ParseException;
-import java.util.List;
-import java.util.Map;
-
-public class DistrictParserFormatter implements ValueParserFormatter<TerrestrialLocation> {
-
- protected Map<String, TerrestrialLocation> indexedDistricts;
-
- public DistrictParserFormatter(List<TerrestrialLocation> districts) {
- if (districts != null) {
- for (TerrestrialLocation district : districts) {
- if ( ! district.isDistrict()) {
- throw new IllegalArgumentException();
- }
- }
- indexedDistricts = WaoUtils.projectPropertyUnique(districts, TerrestrialLocation.PROPERTY_DISTRICT_CODE);
- }
- }
-
- @Override
- public String format(TerrestrialLocation district) {
- String districtCode = "";
- if (district != null) {
- districtCode = district.getDistrictCode();
- }
- return districtCode;
- }
-
- @Override
- public TerrestrialLocation parse(String value) throws ParseException {
- String trimmedValue = value.trim();
- if (trimmedValue.isEmpty()) {
- throw new IllegalArgumentException(WaoUtils._("wao.import.contact.failure.districtMissing"));
- }
- TerrestrialLocation district = indexedDistricts.get(trimmedValue);
- if (district == null) {
- throw new IllegalArgumentException(WaoUtils._("wao.import.contact.failure.wrongDistrict", value));
- }
- return district;
- }
-
-}
Copied: trunk/wao-business/src/main/java/fr/ifremer/wao/io/csv2/models/operations/DistrictsParserFormatter.java (from rev 1644, trunk/wao-business/src/main/java/fr/ifremer/wao/io/csv2/models/operations/DistrictParserFormatter.java)
===================================================================
--- trunk/wao-business/src/main/java/fr/ifremer/wao/io/csv2/models/operations/DistrictsParserFormatter.java (rev 0)
+++ trunk/wao-business/src/main/java/fr/ifremer/wao/io/csv2/models/operations/DistrictsParserFormatter.java 2013-04-11 12:32:25 UTC (rev 1646)
@@ -0,0 +1,81 @@
+/*
+ * #%L
+ * Wao :: Business
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2009 - 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+package fr.ifremer.wao.io.csv2.models.operations;
+
+import com.google.common.base.Splitter;
+import fr.ifremer.wao.WaoUtils;
+import fr.ifremer.wao.entity.TerrestrialLocation;
+import org.apache.commons.lang3.StringUtils;
+import org.nuiton.util.csv.ValueParserFormatter;
+
+import java.text.ParseException;
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+public class DistrictsParserFormatter implements ValueParserFormatter<Collection<TerrestrialLocation>> {
+
+ protected Map<String, TerrestrialLocation> indexedDistricts;
+
+ public DistrictsParserFormatter(List<TerrestrialLocation> districts) {
+ if (districts != null) {
+ for (TerrestrialLocation district : districts) {
+ if ( ! district.isDistrict()) {
+ throw new IllegalArgumentException();
+ }
+ }
+ indexedDistricts = WaoUtils.projectPropertyUnique(districts, TerrestrialLocation.PROPERTY_DISTRICT_CODE);
+ }
+ }
+
+ @Override
+ public String format(Collection<TerrestrialLocation> districts) {
+ List<String> districtCodes = new LinkedList<String>();
+ if (districts != null) {
+ for (TerrestrialLocation district : districts) {
+ districtCodes.add(district.getDistrictCode());
+ }
+ }
+ String value = StringUtils.join(districtCodes, ", ");
+ return value;
+ }
+
+ @Override
+ public Collection<TerrestrialLocation> parse(String value) throws ParseException {
+ if (StringUtils.isBlank(value)) {
+ throw new IllegalArgumentException(WaoUtils._("wao.import.contact.failure.districtMissing"));
+ }
+ Iterable<String> districtCodes = Splitter.on(',').trimResults().split(value);
+ Collection<TerrestrialLocation> districts = new LinkedList<TerrestrialLocation>();
+ for (String districtCode : districtCodes) {
+ TerrestrialLocation district = indexedDistricts.get(districtCode);
+ if (district == null) {
+ throw new IllegalArgumentException(WaoUtils._("wao.import.contact.failure.wrongDistrict", value));
+ }
+ }
+ return districts;
+ }
+
+}
Deleted: trunk/wao-business/src/main/java/fr/ifremer/wao/io/csv2/models/operations/SampleRowDistrictNameGetter.java
===================================================================
--- trunk/wao-business/src/main/java/fr/ifremer/wao/io/csv2/models/operations/SampleRowDistrictNameGetter.java 2013-04-08 14:04:19 UTC (rev 1645)
+++ trunk/wao-business/src/main/java/fr/ifremer/wao/io/csv2/models/operations/SampleRowDistrictNameGetter.java 2013-04-11 12:32:25 UTC (rev 1646)
@@ -1,40 +0,0 @@
-/*
- * #%L
- * Wao :: Business
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2009 - 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-package fr.ifremer.wao.io.csv2.models.operations;
-
-import fr.ifremer.wao.entity.SampleRow;
-import fr.ifremer.wao.entity.TerrestrialLocation;
-import org.nuiton.util.csv.ValueGetter;
-
-public class SampleRowDistrictNameGetter implements ValueGetter<SampleRow, String> {
-
- @Override
- public String get(SampleRow sampleRow) throws Exception {
- String districtName = "";
- if (sampleRow.getTerrestrialLocation() != null) {
- districtName = sampleRow.getTerrestrialLocation().getDistrictName();
- }
- return districtName;
- }
-}
Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceSamplingImpl.java
===================================================================
--- trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceSamplingImpl.java 2013-04-08 14:04:19 UTC (rev 1645)
+++ trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceSamplingImpl.java 2013-04-11 12:32:25 UTC (rev 1646)
@@ -372,7 +372,7 @@
SampleRow.PROPERTY_GROUP_NAME,
SampleRow.PROPERTY_OBSERVERS,
SampleRow.PROPERTY_OBSERVATION_UNIT,
- SampleRow.PROPERTY_TERRESTRIAL_LOCATION,
+ SampleRow.PROPERTY_TERRESTRIAL_LOCATIONS,
SampleRow.PROPERTY_BOAT,
SampleRow.PROPERTY_BLANK_ROW);
} else {
@@ -403,7 +403,7 @@
} else if (ObsProgram.OBSVENTE.equals(row.getObsProgram())) {
sampleRowBinderModelBuilder.addSimpleProperties(
SampleRow.PROPERTY_SAMPLING_STRATEGY_ORDINAL,
- SampleRow.PROPERTY_TERRESTRIAL_LOCATION,
+ SampleRow.PROPERTY_TERRESTRIAL_LOCATIONS,
SampleRow.PROPERTY_TERRESTRIAL_LOCATION_INFOS);
}
}
Modified: trunk/wao-business/src/main/xmi/wao.zargo
===================================================================
(Binary files differ)
Modified: trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/SampleRowForm.java
===================================================================
--- trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/SampleRowForm.java 2013-04-08 14:04:19 UTC (rev 1645)
+++ trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/SampleRowForm.java 2013-04-11 12:32:25 UTC (rev 1646)
@@ -185,9 +185,6 @@
immatriculations = getSampleRow().getMainElligibleBoatsAsString();
- if (getSampleRow().getTerrestrialLocation() != null) {
- terrestrialLocationId = getSampleRow().getTerrestrialLocation().getTopiaId();
- }
}
public boolean showObsVente() {
@@ -377,20 +374,10 @@
edited = true;
}
- /*************************** TERRESTRIAL LOCATION *************************/
-
- private GenericSelectModel<TerrestrialLocation> terrestrialLocationSelectModel;
-
- @Property
- private String terrestrialLocationId;
-
- public GenericSelectModel<TerrestrialLocation> getTerrestrialLocationSelectModel() {
- if (terrestrialLocationSelectModel == null) {
- List<TerrestrialLocation> locations = serviceReferential.getAllTerrestrialDistricts(new SamplingFilterImpl());
- terrestrialLocationSelectModel = new GenericSelectModel<TerrestrialLocation>(locations, TerrestrialLocation.class,
- TerrestrialLocation.PROPERTY_DISTRICT_NAME, TerrestrialLocation.TOPIA_ID, propertyAccess);
- }
- return terrestrialLocationSelectModel;
+ public List<TerrestrialLocation> getDistricts() {
+ List<TerrestrialLocation> districts =
+ serviceReferential.getAllTerrestrialDistricts(new SamplingFilterImpl());
+ return districts;
}
/*************************** PROGRAM & MONTHS *****************************/
@@ -731,11 +718,6 @@
// TODO 20110406 bleny move validation of ObsMer/ObsVente in ServiceSampling#validateSampleRow()
- if (StringUtils.isNotEmpty(terrestrialLocationId)) {
- getSampleRow().setTerrestrialLocation(
- getTerrestrialLocationSelectModel().findObject(terrestrialLocationId));
- }
-
// remove sampleMonths with "-1" as value, it should be removed
// to mean that no observation should be done this month
List<SampleMonth> sampleMonths = new ArrayList<SampleMonth>();
@@ -864,6 +846,12 @@
sampleRowForm.recordError("Pour ce choix de stratégie d'échantillonnage, il faut préciser les espèces cibles");
}
}
+
+ if (sampleRow.getObsProgram() == ObsProgram.OBSVENTE) {
+ if (CollectionUtils.isEmpty(sampleRow.getTerrestrialLocations())) {
+ sampleRowForm.recordError("Il faut préciser au moins un quartier maritime");
+ }
+ }
}
} catch (WaoBusinessException eee) {
sampleRowForm.recordError(eee.getMessage());
Modified: trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/SamplingPlan.java
===================================================================
--- trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/SamplingPlan.java 2013-04-08 14:04:19 UTC (rev 1645)
+++ trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/SamplingPlan.java 2013-04-11 12:32:25 UTC (rev 1646)
@@ -35,6 +35,7 @@
import fr.ifremer.wao.entity.FishingZone;
import fr.ifremer.wao.entity.SampleMonth;
import fr.ifremer.wao.entity.SampleRow;
+import fr.ifremer.wao.entity.TerrestrialLocation;
import fr.ifremer.wao.service.ServiceSampling;
import fr.ifremer.wao.ui.components.Layout;
import fr.ifremer.wao.ui.components.SamplingFilterComponent;
@@ -571,6 +572,9 @@
return result;
}
+ @Property
+ private TerrestrialLocation terrestrialLocation;
+
/** ------------------------- HTML & STYLE ----------------------------- **/
@Property
Modified: trunk/wao-ui/src/main/resources/i18n/wao-ui_en_GB.properties
===================================================================
--- trunk/wao-ui/src/main/resources/i18n/wao-ui_en_GB.properties 2013-04-08 14:04:19 UTC (rev 1645)
+++ trunk/wao-ui/src/main/resources/i18n/wao-ui_en_GB.properties 2013-04-11 12:32:25 UTC (rev 1646)
@@ -159,6 +159,7 @@
wao.ui.field.SampleRow.species=Species
wao.ui.field.SampleRow.terrestrialLocation=Maritime district
wao.ui.field.SampleRow.terrestrialLocationInfos=Terrestrial Location Infos
+wao.ui.field.SampleRow.terrestrialLocations=Maritimes districts
wao.ui.field.TerrestrialDivision.regionIfremer=Ifremer region
wao.ui.field.TerrestrialDivision.skillZone=Skill zone
wao.ui.field.TerrestrialDivision.subPopulation=Sub-population
Modified: trunk/wao-ui/src/main/resources/i18n/wao-ui_fr_FR.properties
===================================================================
--- trunk/wao-ui/src/main/resources/i18n/wao-ui_fr_FR.properties 2013-04-08 14:04:19 UTC (rev 1645)
+++ trunk/wao-ui/src/main/resources/i18n/wao-ui_fr_FR.properties 2013-04-11 12:32:25 UTC (rev 1646)
@@ -155,6 +155,7 @@
wao.ui.field.SampleRow.species=Espèces cibles
wao.ui.field.SampleRow.terrestrialLocation=Quartier maritime
wao.ui.field.SampleRow.terrestrialLocationInfos=Autre(s) info(s)
+wao.ui.field.SampleRow.terrestrialLocations=Quartiers maritimes
wao.ui.field.TerrestrialDivision.regionIfremer=Région Ifremer
wao.ui.field.TerrestrialDivision.skillZone=Zone de compétence
wao.ui.field.TerrestrialDivision.subPopulation=Sous-population
Modified: trunk/wao-ui/src/main/webapp/SampleRowForm.tml
===================================================================
--- trunk/wao-ui/src/main/webapp/SampleRowForm.tml 2013-04-08 14:04:19 UTC (rev 1645)
+++ trunk/wao-ui/src/main/webapp/SampleRowForm.tml 2013-04-11 12:32:25 UTC (rev 1646)
@@ -198,13 +198,15 @@
<p:else> <!-- edit -->
<div class="select">
<label for="terrestrialLocation">
- ${message:wao.ui.field.SampleRow.terrestrialLocation}
+ ${message:wao.ui.field.SampleRow.terrestrialLocations}
</label>
- <input t:id="terrestrialLocation"
- t:type="select"
- t:model="terrestrialLocationSelectModel"
- t:value="terrestrialLocationId"
- t:validate="required" />
+ <t:topiaEntitySelector t:id="terrestrialLocation"
+ t:multiple="true"
+ t:clazzName="TerrestrialLocation"
+ t:labelPropertyName="districtName"
+ t:values="districts"
+ t:selectedValues="sampleRow.terrestrialLocations"
+ size="6"/>
</div>
<div class="select">
<label for="terrestrialLocationInfos">
Modified: trunk/wao-ui/src/main/webapp/SamplingPlan.tml
===================================================================
--- trunk/wao-ui/src/main/webapp/SamplingPlan.tml 2013-04-08 14:04:19 UTC (rev 1645)
+++ trunk/wao-ui/src/main/webapp/SamplingPlan.tml 2013-04-11 12:32:25 UTC (rev 1646)
@@ -111,7 +111,7 @@
<t:if t:test="fullView">
<td>${message:wao.ui.samplingPlan.fishingZoneInfo}</td>
<t:if test="user.obsVente">
- <td>${message:wao.ui.entity.TerrestrialLocation}<br />${message:wao.ui.field.SampleRow.terrestrialLocation}</td>
+ <td>${message:wao.ui.entity.TerrestrialLocation}<br />${message:wao.ui.field.SampleRow.terrestrialLocations}</td>
<td>${message:wao.ui.entity.TerrestrialLocation}<br />${message:wao.ui.field.SampleRow.terrestrialLocationInfos}</td>
</t:if>
<td>${message:wao.ui.misc.METIER}<br />${message:wao.ui.field.SampleRow.dCF5Code}</td>
@@ -124,7 +124,7 @@
<td>${message:wao.ui.field.SampleRow.periodEnd}</td>
<p:else>
<t:if test="user.obsVente">
- <td>${message:wao.ui.entity.TerrestrialLocation}<br />${message:wao.ui.field.SampleRow.terrestrialLocation}</td>
+ <td>${message:wao.ui.entity.TerrestrialLocation}<br />${message:wao.ui.field.SampleRow.terrestrialLocations}</td>
<td>${message:wao.ui.entity.TerrestrialLocation}<br />${message:wao.ui.field.SampleRow.terrestrialLocationInfos}</td>
</t:if>
<td>${message:wao.ui.misc.METIER}<br />${message:wao.ui.field.SampleRow.dCF5Code}</td>
@@ -196,10 +196,12 @@
<td>${row.fishingZonesInfos}</td>
<t:if test="user.obsVente">
<td>
- <t:if test="row.terrestrialLocation">
- <span t:type="ck/Tooltip" title="Infos" t:value="${row.terrestrialLocation.description}" t:effect="appear">
- ${row.terrestrialLocation.districtName}
- </span>
+ <t:if test="row.terrestrialLocations">
+ <t:loop source="row.terrestrialLocations" value="terrestrialLocation">
+ <span t:type="ck/Tooltip" title="Infos" t:value="${terrestrialLocation.description}" t:effect="appear">
+ ${terrestrialLocation.districtName}
+ </span>
+ </t:loop>
</t:if>
</td>
<td>
@@ -228,10 +230,12 @@
</td>
<t:if test="user.obsVente">
<td>
- <t:if test="row.terrestrialLocation">
- <span t:type="ck/Tooltip" title="Infos" t:value="${row.terrestrialLocation.description}" t:effect="appear">
- ${row.terrestrialLocation.districtName}
- </span>
+ <t:if test="row.terrestrialLocations">
+ <t:loop source="row.terrestrialLocations" value="terrestrialLocation">
+ <span t:type="ck/Tooltip" title="Infos" t:value="${terrestrialLocation.description}" t:effect="appear">
+ ${terrestrialLocation.districtName}
+ </span>
+ </t:loop>
</t:if>
</td>
<td>
1
0
Author: bleny
Date: 2013-04-08 16:04:19 +0200 (Mon, 08 Apr 2013)
New Revision: 1645
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1645
Log:
breaking build using last i18n version
Modified:
trunk/pom.xml
trunk/wao-business/pom.xml
trunk/wao-ui/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2013-04-08 13:54:26 UTC (rev 1644)
+++ trunk/pom.xml 2013-04-08 14:04:19 UTC (rev 1645)
@@ -337,7 +337,7 @@
<license.licenseName>agpl_v3</license.licenseName>
<!-- libraries version -->
- <nuitonI18nVersion>2.4.1</nuitonI18nVersion>
+ <nuitonI18nVersion>2.5</nuitonI18nVersion>
<nuitonUtilsVersion>2.6.12</nuitonUtilsVersion>
<nuitonCsvVersion>2.6.12.1</nuitonCsvVersion>
<nuitonWebVersion>1.10</nuitonWebVersion>
@@ -405,7 +405,7 @@
<plugin>
<groupId>org.nuiton.i18n</groupId>
- <artifactId>maven-i18n-plugin</artifactId>
+ <artifactId>i18n-maven-plugin</artifactId>
<version>${nuitonI18nVersion}</version>
</plugin>
Modified: trunk/wao-business/pom.xml
===================================================================
--- trunk/wao-business/pom.xml 2013-04-08 13:54:26 UTC (rev 1644)
+++ trunk/wao-business/pom.xml 2013-04-08 14:04:19 UTC (rev 1645)
@@ -202,7 +202,7 @@
</plugin>
<plugin>
<groupId>org.nuiton.i18n</groupId>
- <artifactId>maven-i18n-plugin</artifactId>
+ <artifactId>i18n-maven-plugin</artifactId>
<executions>
<execution>
<configuration>
Modified: trunk/wao-ui/pom.xml
===================================================================
--- trunk/wao-ui/pom.xml 2013-04-08 13:54:26 UTC (rev 1644)
+++ trunk/wao-ui/pom.xml 2013-04-08 14:04:19 UTC (rev 1645)
@@ -175,7 +175,7 @@
<plugins>
<plugin>
<groupId>org.nuiton.i18n</groupId>
- <artifactId>maven-i18n-plugin</artifactId>
+ <artifactId>i18n-maven-plugin</artifactId>
<executions>
<execution>
<id>parse Tapestry</id>
1
0
Author: bleny
Date: 2013-04-08 15:54:26 +0200 (Mon, 08 Apr 2013)
New Revision: 1644
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1644
Log:
update versions in dependencyManagement
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2013-03-01 17:12:00 UTC (rev 1643)
+++ trunk/pom.xml 2013-04-08 13:54:26 UTC (rev 1644)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom4redmine</artifactId>
- <version>3.4.7</version>
+ <version>3.4.9</version>
</parent>
<groupId>fr.ifremer</groupId>
@@ -27,7 +27,7 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-email</artifactId>
- <version>1.3</version>
+ <version>1.3.1</version>
</dependency>
<dependency>
<groupId>org.nuiton</groupId>
@@ -44,7 +44,7 @@
<dependency>
<groupId>org.nuiton</groupId>
<artifactId>nuiton-csv</artifactId>
- <version>${nuitonUtilsVersion}</version>
+ <version>${nuitonCsvVersion}</version>
</dependency>
<dependency>
<groupId>org.nuiton.i18n</groupId>
@@ -215,7 +215,7 @@
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
- <version>1.3.170</version>
+ <version>1.3.171</version>
</dependency>
<dependency>
<groupId>postgresql</groupId>
@@ -338,14 +338,15 @@
<!-- libraries version -->
<nuitonI18nVersion>2.4.1</nuitonI18nVersion>
- <nuitonUtilsVersion>2.6.9</nuitonUtilsVersion>
+ <nuitonUtilsVersion>2.6.12</nuitonUtilsVersion>
+ <nuitonCsvVersion>2.6.12.1</nuitonCsvVersion>
<nuitonWebVersion>1.10</nuitonWebVersion>
<topiaVersion>2.7.1</topiaVersion>
<eugeneVersion>2.6.1</eugeneVersion>
<tapestryVersion>5.2.5</tapestryVersion>
<hibernateVersion>3.6.10.Final</hibernateVersion>
<jaxbVersion>2.2.7-b58</jaxbVersion>
- <slf4jVersion>1.7.2</slf4jVersion>
+ <slf4jVersion>1.7.5</slf4jVersion>
</properties>
<!-- ************************************************************* -->
1
0