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
- 2352 discussions
r1753 - in trunk: wao-persistence/src/main/java/fr/ifremer/wao wao-services/src/main/java/fr/ifremer/wao/services/service wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer wao-web/src/main/resources/i18n wao-web/src/main/webapp/WEB-INF/content/obsmer
by tchemit@users.forge.codelutin.com 25 Mar '14
by tchemit@users.forge.codelutin.com 25 Mar '14
25 Mar '14
Author: tchemit
Date: 2014-03-25 19:39:11 +0100 (Tue, 25 Mar 2014)
New Revision: 1753
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1753
Log:
refs-40 #4483 (continue ui)
Modified:
trunk/wao-persistence/src/main/java/fr/ifremer/wao/SampleRowsFilter.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlan.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanBuilder.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanService.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/SampleRowsFilterValues.java
trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/SamplingPlanAction.java
trunk/wao-web/src/main/resources/i18n/wao-web_en_GB.properties
trunk/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties
trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp
Modified: trunk/wao-persistence/src/main/java/fr/ifremer/wao/SampleRowsFilter.java
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/SampleRowsFilter.java 2014-03-25 17:50:13 UTC (rev 1752)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/SampleRowsFilter.java 2014-03-25 18:39:11 UTC (rev 1753)
@@ -67,9 +67,6 @@
protected Set<String> orderByArguments;
- //FIXME Remove this
- protected boolean estimatedTides;
-
public ObsProgram getObsProgram() {
return obsProgram;
}
@@ -174,14 +171,6 @@
this.orderByArguments = orderByArguments;
}
- public boolean isEstimatedTides() {
- return estimatedTides;
- }
-
- public void setEstimatedTides(boolean estimatedTides) {
- this.estimatedTides = estimatedTides;
- }
-
public Set<String> getSampleRowIds() {
return sampleRowIds;
}
Modified: trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java 2014-03-25 17:50:13 UTC (rev 1752)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java 2014-03-25 18:39:11 UTC (rev 1753)
@@ -81,6 +81,14 @@
return ordinals;
}
+ protected static final SimpleDateFormat dateFormat = new SimpleDateFormat("MM/yyyy");
+
+ public static boolean isCurrentMonth(Date month) {
+ String currentStr = dateFormat.format(new Date());
+ String monthStr = dateFormat.format(month);
+ return currentStr.equals(monthStr);
+ }
+
/**
* Wrapper on {@link org.apache.commons.collections4.CollectionUtils#isEqualCollection(java.util.Collection, java.util.Collection)}
* that handles null values.
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlan.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlan.java 2014-03-25 17:50:13 UTC (rev 1752)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlan.java 2014-03-25 18:39:11 UTC (rev 1753)
@@ -21,13 +21,13 @@
* #L%
*/
+import fr.ifremer.wao.WaoUtils;
import fr.ifremer.wao.entity.FishingZone;
import fr.ifremer.wao.entity.SampleMonth;
import fr.ifremer.wao.entity.SampleRow;
import java.io.Serializable;
import java.text.NumberFormat;
-import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
@@ -42,7 +42,7 @@
/**
* All facades of the sampling plan.
*/
- protected List<ObsMerSamplingPlanFacadePart> facades;
+ protected Collection<ObsMerSamplingPlanFacadePart> facades;
/**
* Statistics over the plan by month.
@@ -93,7 +93,7 @@
protected SampleRowsFilterValues filterValues;
public ObsMerSamplingPlan(List<Date> months,
- List<ObsMerSamplingPlanFacadePart> facadeParts,
+ Collection<ObsMerSamplingPlanFacadePart> facadeParts,
Map<Date, ObsMerSamplingPlanStatistics> statisticsMap,
Integer highTotalExpected,
Integer highTotalReal,
@@ -228,7 +228,6 @@
public Iterator<ObsMerSamplingPlanSectorPart> iterator() {
return sectors.iterator();
}
-
}
/**
@@ -258,7 +257,7 @@
}
}
- protected static final SimpleDateFormat dateFormat = new SimpleDateFormat("MM/yyyy");
+// protected static final SimpleDateFormat dateFormat = new SimpleDateFormat("MM/yyyy");
/**
* Created on 3/24/14.
@@ -372,21 +371,15 @@
public boolean hasNbTidesReal(Date month) {
Date current = new Date();
- boolean validMonth = month.before(current) || isCurrentMonth(month);
+ boolean validMonth = month.before(current) || WaoUtils.isCurrentMonth(month);
return validMonth && getNbTidesReal(month) != null;
}
public boolean hasNbTidesEstimated(Date month) {
Date current = new Date();
- boolean validMonth = month.before(current) || isCurrentMonth(month);
+ boolean validMonth = month.before(current) || WaoUtils.isCurrentMonth(month);
return validMonth && getNbTidesEstimated(month) != null;
}
-
- public boolean isCurrentMonth(Date month) {
- String currentStr = dateFormat.format(new Date());
- String monthStr = dateFormat.format(month);
- return currentStr.equals(monthStr);
- }
}
public static class ObsMerSamplingPlanStatistics implements Serializable {
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanBuilder.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanBuilder.java 2014-03-25 17:50:13 UTC (rev 1752)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanBuilder.java 2014-03-25 18:39:11 UTC (rev 1753)
@@ -21,6 +21,8 @@
* #L%
*/
+import com.google.common.base.Function;
+import com.google.common.collect.Ordering;
import fr.ifremer.wao.SampleRowsFilter;
import fr.ifremer.wao.entity.SampleRow;
import org.apache.commons.lang3.mutable.MutableDouble;
@@ -28,9 +30,9 @@
import org.apache.commons.lang3.mutable.MutableLong;
import org.nuiton.util.PeriodDates;
+import java.util.ArrayList;
+import java.util.Collection;
import java.util.Date;
-import java.util.LinkedHashMap;
-import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
@@ -64,7 +66,7 @@
/**
* Dictionnary of facades indexed by their facade name.
*/
- protected LinkedHashMap<String, FacadeContext> facadeMap;
+ protected Map<String, FacadeContext> facadeMap;
/**
* To compute the high total expected.
@@ -132,7 +134,7 @@
public ObsMerSamplingPlanBuilder(SampleRowsFilter sampleRowsFilter) {
this.sampleRowsFilter = sampleRowsFilter;
this.sampleRowsFilterValues = new SampleRowsFilterValues();
- this.facadeMap = new LinkedHashMap<>();
+ this.facadeMap = new TreeMap<>();
this.highTotalExpected = new MutableInt();
this.highTotalReal = new MutableInt();
this.highTotalEstimated = new MutableInt();
@@ -190,18 +192,27 @@
public ObsMerSamplingPlan toPlan() {
- LinkedList<ObsMerSamplingPlan.ObsMerSamplingPlanFacadePart> facadeParts = new LinkedList<>();
+ // Get facade parts
+ Collection<ObsMerSamplingPlan.ObsMerSamplingPlanFacadePart> facadeParts = new ArrayList<>();
for (FacadeContext facadeContext : facadeMap.values()) {
ObsMerSamplingPlan.ObsMerSamplingPlanFacadePart facadePart = facadeContext.toBean();
facadeParts.add(facadePart);
}
- TreeMap<Date, ObsMerSamplingPlan.ObsMerSamplingPlanStatistics> statisticsMap = new TreeMap<>();
+ // Sort them
+ Collection<ObsMerSamplingPlan.ObsMerSamplingPlanFacadePart> sortedFacades = Ordering.natural().onResultOf(new Function<ObsMerSamplingPlan.ObsMerSamplingPlanFacadePart, String>() {
+ public String apply(ObsMerSamplingPlan.ObsMerSamplingPlanFacadePart input) {
+ return input.getFacade();
+ }
+ }).immutableSortedCopy(facadeParts);
+
+ // Get statistics
+ Map<Date, ObsMerSamplingPlan.ObsMerSamplingPlanStatistics> statisticsMap = new TreeMap<>();
for (Date month : months) {
MutableInt totalExpected = totalExpectedForMonths.get(month);
MutableInt totalReal = totalRealForMonths.get(month);
- MutableInt totalEstimated= totalEstimatedForMonths.get(month);
+ MutableInt totalEstimated = totalEstimatedForMonths.get(month);
ObsMerSamplingPlan.ObsMerSamplingPlanStatistics planStatistics =
new ObsMerSamplingPlan.ObsMerSamplingPlanStatistics(totalExpected == null ? null : totalExpected.toInteger(),
totalReal == null ? null : totalReal.toInteger(),
@@ -210,7 +221,7 @@
}
ObsMerSamplingPlan result = new ObsMerSamplingPlan(months,
- facadeParts,
+ sortedFacades,
statisticsMap,
highTotalExpected.toInteger(),
highTotalReal.toInteger(),
@@ -242,7 +253,7 @@
if (estimated != null) {
- MutableInt total = totalEstimatedForMonths.get(month);
+ MutableInt total = totalEstimatedForMonths.get(month);
if (total == null) {
total = new MutableInt();
totalEstimatedForMonths.put(month, total);
@@ -267,11 +278,11 @@
protected String facade;
- protected LinkedHashMap<String, ServiceContext> sectorMap;
+ protected Map<String, ServiceContext> sectorMap;
protected FacadeContext(String facade) {
this.facade = facade;
- this.sectorMap = new LinkedHashMap<>();
+ this.sectorMap = new TreeMap<>();
}
protected ServiceContext getOrAddSectorContext(String sectors) {
@@ -287,13 +298,20 @@
protected ObsMerSamplingPlan.ObsMerSamplingPlanFacadePart toBean() {
- LinkedList<ObsMerSamplingPlan.ObsMerSamplingPlanSectorPart> sectorParts = new LinkedList<>();
+ // get sector parts
+ Collection<ObsMerSamplingPlan.ObsMerSamplingPlanSectorPart> sectorParts = new ArrayList<>();
for (ServiceContext serviceContext : sectorMap.values()) {
ObsMerSamplingPlan.ObsMerSamplingPlanSectorPart sectorPart = serviceContext.toBean();
sectorParts.add(sectorPart);
}
+ // sort them
+ Collection<ObsMerSamplingPlan.ObsMerSamplingPlanSectorPart> sortedSectors = Ordering.natural().onResultOf(new Function<ObsMerSamplingPlan.ObsMerSamplingPlanSectorPart, String>() {
+ public String apply(ObsMerSamplingPlan.ObsMerSamplingPlanSectorPart input) {
+ return input.getSectors();
+ }
+ }).immutableSortedCopy(sectorParts);
ObsMerSamplingPlan.ObsMerSamplingPlanFacadePart result =
- new ObsMerSamplingPlan.ObsMerSamplingPlanFacadePart(facade, sectorParts);
+ new ObsMerSamplingPlan.ObsMerSamplingPlanFacadePart(facade, sortedSectors);
return result;
}
}
@@ -302,11 +320,11 @@
protected String sectors;
- protected LinkedList<ObsMerSamplingPlan.ObsMerSamplingPlanSampleRowPart> rows;
+ protected Collection<ObsMerSamplingPlan.ObsMerSamplingPlanSampleRowPart> rows;
protected ServiceContext(String sectors) {
this.sectors = sectors;
- rows = new LinkedList<>();
+ rows = new ArrayList<>();
}
protected ObsMerSamplingPlan.ObsMerSamplingPlanSampleRowPart addSampleRow(SampleRow row,
@@ -326,8 +344,13 @@
protected ObsMerSamplingPlan.ObsMerSamplingPlanSectorPart toBean() {
+ Collection<ObsMerSamplingPlan.ObsMerSamplingPlanSampleRowPart> sortedRows = Ordering.natural().onResultOf(new Function<ObsMerSamplingPlan.ObsMerSamplingPlanSampleRowPart, String>() {
+ public String apply(ObsMerSamplingPlan.ObsMerSamplingPlanSampleRowPart input) {
+ return input.getSampleRow().getCode();
+ }
+ }).immutableSortedCopy(rows);
ObsMerSamplingPlan.ObsMerSamplingPlanSectorPart result =
- new ObsMerSamplingPlan.ObsMerSamplingPlanSectorPart(sectors, rows);
+ new ObsMerSamplingPlan.ObsMerSamplingPlanSectorPart(sectors, sortedRows);
return result;
}
}
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanService.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanService.java 2014-03-25 17:50:13 UTC (rev 1752)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanService.java 2014-03-25 18:39:11 UTC (rev 1753)
@@ -28,12 +28,15 @@
import com.google.common.collect.Iterables;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
+import fr.ifremer.wao.ContactsFilter;
import fr.ifremer.wao.SampleRowsFilter;
import fr.ifremer.wao.WaoTechnicalException;
import fr.ifremer.wao.entity.Boat;
import fr.ifremer.wao.entity.Boats;
import fr.ifremer.wao.entity.Company;
import fr.ifremer.wao.entity.CompanyTopiaDao;
+import fr.ifremer.wao.entity.Contact;
+import fr.ifremer.wao.entity.ContactState;
import fr.ifremer.wao.entity.DCF5Code;
import fr.ifremer.wao.entity.ElligibleBoat;
import fr.ifremer.wao.entity.ElligibleBoatImpl;
@@ -64,6 +67,7 @@
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateUtils;
+import org.apache.commons.lang3.tuple.Pair;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.csv.Export;
@@ -79,6 +83,7 @@
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Calendar;
+import java.util.Collection;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.HashSet;
@@ -373,10 +378,10 @@
List<SampleRow> sampleRows = dao.findAll(sampleRowsFilter);
ObsMerSamplingPlanBuilder builder = new ObsMerSamplingPlanBuilder(sampleRowsFilter);
for (SampleRow sampleRow : sampleRows) {
- //TODO Compute see ServiceSamplingImpl#executeGetObservationTimesInDays
- Double observationTimesInDaysExpected = 0d;
- Long observationTimesInDaysReal = 0l;
- Long observationTimesInDaysEstimated = 0l;
+ Double observationTimesInDaysExpected = getObservationTimesInDayExpected(sampleRow);
+ Pair<Long, Long> realAndEstimated = getObservationTimesInDayRealAndEstimated(sampleRowsFilter, sampleRow);
+ Long observationTimesInDaysReal = realAndEstimated.getLeft();
+ Long observationTimesInDaysEstimated = realAndEstimated.getRight();
builder.addSampleRow(sampleRow,
observationTimesInDaysExpected,
observationTimesInDaysReal,
@@ -562,4 +567,70 @@
}
+ protected double getObservationTimesInDayExpected(SampleRow sampleRow) {
+ double expected;
+
+ // On prend le nombre d'observation prévue pour cette ligne du plan
+ // c'est à dire la somme des nombres d'observations prévues pour
+ // chaque mois.
+ int expectedObservationCount = 0;
+ for (SampleMonth sampleMonth : sampleRow.getSampleMonth()) {
+ expectedObservationCount += sampleMonth.getExpectedTidesValue();
+ }
+ // le prévisionnel est égal au nombre d'observations attendues ×
+ // le nombre de jours moyen d'une observation
+ expected = expectedObservationCount * sampleRow.getAverageTideTime();
+ return expected;
+ }
+
+ protected Pair<Long, Long> getObservationTimesInDayRealAndEstimated(SampleRowsFilter sampleRowFilter,
+ SampleRow sampleRow) {
+
+ // D'abord, on a besoin de récupérer toutes les observations réalisées
+ // pour cette ligne du plan
+
+ ContactsFilter contactFilter = new ContactsFilter();
+
+ sampleRowFilter.setSampleRowIds(ImmutableSet.of(sampleRow.getTopiaId()));
+ contactFilter.setFilterOnObservationBeginDate(true);
+ contactFilter.setPeriodFrom(sampleRowFilter.getPeriodFrom());
+ contactFilter.setPeriodTo(sampleRowFilter.getPeriodTo());
+
+ contactFilter.setSampleRowFilter(sampleRowFilter);
+ contactFilter.setContactStates(ImmutableSet.of(ContactState.OBSERVATION_DONE));
+ // on exclue les contacts qui sont invalidés par le programme
+ contactFilter.setProgramAcceptations(Sets.newHashSet(true, null));
+ // on exclue les contacts invalidés par la société
+ contactFilter.setCompanyAcceptations(Sets.newHashSet(true, null));
+
+ Collection<Contact> contacts = getContactDao().findAll(contactFilter);
+
+ final double minutesPerDay = 24 * 60;
+ // Pour calculer le temps passé, on prend pour chaque observation
+ // le temps qui a vraiment été passé en mer.
+
+ // temps de mer réalisé par ligne du plan = somme [arrondi-supérieur (nb d'heures total de la marée/ 24)]
+ long real = 0;
+ long estimated = 0;
+ for (Contact contact : contacts) {
+ double actualInMinutes = DateUtil.getDifferenceInMinutes(
+ contact.getObservationBeginDate(),
+ contact.getObservationEndDate());
+ Boolean validationCompany = contact.getValidationCompany();
+
+ double contactInDays = Math.ceil(actualInMinutes / minutesPerDay);
+
+ if (validationCompany != null) {
+ // real observation
+ real += contactInDays;
+ }
+ // estimated observation
+ estimated += contactInDays;
+ }
+
+ sampleRowFilter.setSampleRowIds(null);
+
+ return Pair.of(real, estimated);
+ }
+
}
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/SampleRowsFilterValues.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/SampleRowsFilterValues.java 2014-03-25 17:50:13 UTC (rev 1752)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/SampleRowsFilterValues.java 2014-03-25 18:39:11 UTC (rev 1753)
@@ -17,6 +17,8 @@
*/
public class SampleRowsFilterValues implements Serializable {
+ private static final long serialVersionUID = 1L;
+
protected Set<String> fishingZoneFacadeNames = new HashSet<>();
protected Set<String> fishingZoneSectorNames = new HashSet<>();
Modified: trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/SamplingPlanAction.java
===================================================================
--- trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/SamplingPlanAction.java 2014-03-25 17:50:13 UTC (rev 1752)
+++ trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/SamplingPlanAction.java 2014-03-25 18:39:11 UTC (rev 1753)
@@ -29,10 +29,12 @@
public class SamplingPlanAction extends WaoJspActionSupport implements Preparable {
- protected ObsMerSamplingPlanService service;
+ private static final long serialVersionUID = 1L;
- protected SampleRowsFilter filter;
+ protected transient ObsMerSamplingPlanService service;
+ protected transient SampleRowsFilter filter;
+
protected ObsMerSamplingPlan samplingPlan;
public void setService(ObsMerSamplingPlanService service) {
Modified: trunk/wao-web/src/main/resources/i18n/wao-web_en_GB.properties
===================================================================
--- trunk/wao-web/src/main/resources/i18n/wao-web_en_GB.properties 2014-03-25 17:50:13 UTC (rev 1752)
+++ trunk/wao-web/src/main/resources/i18n/wao-web_en_GB.properties 2014-03-25 18:39:11 UTC (rev 1753)
@@ -329,6 +329,7 @@
wao.ui.misc.companies=Companies
wao.ui.misc.createdOnF=Created on
wao.ui.misc.creating=Creating...
+wao.ui.misc.day=d.
wao.ui.misc.dayOfWeek=Day
wao.ui.misc.export=Export
wao.ui.misc.export.longTitle=CSV export
@@ -355,6 +356,7 @@
wao.ui.misc.refused=Refused
wao.ui.misc.since=since
wao.ui.misc.total=Total
+wao.ui.misc.totals=Totals
wao.ui.misc.undefined=Undefined
wao.ui.misc.validated=Validated
wao.ui.misc.week=Week
Modified: trunk/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties
===================================================================
--- trunk/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties 2014-03-25 17:50:13 UTC (rev 1752)
+++ trunk/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties 2014-03-25 18:39:11 UTC (rev 1753)
@@ -329,6 +329,7 @@
wao.ui.misc.companies=Sociétés
wao.ui.misc.createdOnF=Créée le
wao.ui.misc.creating=En cours de création
+wao.ui.misc.day=j.
wao.ui.misc.dayOfWeek=Jour
wao.ui.misc.export=Export
wao.ui.misc.export.longTitle=Export CSV
@@ -355,6 +356,7 @@
wao.ui.misc.refused=Réfusé
wao.ui.misc.since=depuis le
wao.ui.misc.total=Total
+wao.ui.misc.totals=Totaux
wao.ui.misc.undefined=Non-défini
wao.ui.misc.validated=Validé
wao.ui.misc.week=Semaine
Modified: trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp
===================================================================
--- trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp 2014-03-25 17:50:13 UTC (rev 1752)
+++ trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp 2014-03-25 18:39:11 UTC (rev 1753)
@@ -27,6 +27,12 @@
<title>
<s:text name="wao.ui.page.SamplingPlan.title" />
</title>
+
+ <style>
+ .currentMonth{
+ background-color: yellow;
+ }
+ </style>
</head>
<h1>
@@ -137,19 +143,19 @@
<td><s:text name="wao.ui.field.SampleRow.code"/></td>
<td><s:text name="wao.ui.samplingPlan.program"/></td>
<s:if test="fullView">
- <td><s:text name="wao.ui.entity.Company"/></td>
+ <td class="only-visible-fullview"><s:text name="wao.ui.entity.Company"/></td>
</s:if>
<td><s:text name="wao.ui.entity.FishingZone"/></td>
<s:if test="fullView">
- <td><s:text name="wao.ui.samplingPlan.fishingZoneInfo"/></td>
- <td><s:text name="wao.ui.misc.METIER"/> <br/> <s:text name="wao.ui.field.SampleRow.dCF5Code"/></td>
- <td><s:text name="wao.ui.misc.METIER"/> <br/> <s:text name="wao.ui.field.SampleRow.meshSize"/></td>
- <td><s:text name="wao.ui.misc.METIER"/> <br/> <s:text name="wao.ui.field.SampleRow.size"/></td>
- <td><s:text name="wao.ui.misc.METIER"/> <br/> <s:text name="wao.ui.field.SampleRow.other"/></td>
- <td><s:text name="wao.ui.misc.METIER"/> <br/> <s:text name="wao.ui.field.SampleRow.libelle"/></td>
- <td><s:text name="wao.ui.misc.METIER"/> <br/> <s:text name="wao.ui.field.SampleRow.species"/></td>
- <td><s:text name="wao.ui.field.SampleRow.periodBegin"/></td>
- <td><s:text name="wao.ui.field.SampleRow.periodEnd"/></td>
+ <td class="only-visible-fullview"><s:text name="wao.ui.samplingPlan.fishingZoneInfo"/></td>
+ <td class="only-visible-fullview"><s:text name="wao.ui.misc.METIER"/> <br/> <s:text name="wao.ui.field.SampleRow.dCF5Code"/></td>
+ <td class="only-visible-fullview"><s:text name="wao.ui.misc.METIER"/> <br/> <s:text name="wao.ui.field.SampleRow.meshSize"/></td>
+ <td class="only-visible-fullview"><s:text name="wao.ui.misc.METIER"/> <br/> <s:text name="wao.ui.field.SampleRow.size"/></td>
+ <td class="only-visible-fullview"><s:text name="wao.ui.misc.METIER"/> <br/> <s:text name="wao.ui.field.SampleRow.other"/></td>
+ <td class="only-visible-fullview"><s:text name="wao.ui.misc.METIER"/> <br/> <s:text name="wao.ui.field.SampleRow.libelle"/></td>
+ <td class="only-visible-fullview"><s:text name="wao.ui.misc.METIER"/> <br/> <s:text name="wao.ui.field.SampleRow.species"/></td>
+ <td class="only-visible-fullview"><s:text name="wao.ui.field.SampleRow.periodBegin"/></td>
+ <td class="only-visible-fullview"><s:text name="wao.ui.field.SampleRow.periodEnd"/></td>
</s:if>
<s:else>
<td><s:text name="wao.ui.misc.METIER"/> <br/> <s:text name="wao.ui.field.SampleRow.dCF5Code"/></td>
@@ -158,7 +164,7 @@
<!-- Months columns -->
<s:iterator value="samplingPlan.months" var="month">
- <td><s:property value="%{formatMonth(#month)}"/></td>
+ <td<s:if test="@fr.ifremer.wao.WaoUtils@isCurrentMonth(#month)"> class="current-month"</s:if>><s:property value="%{formatMonth(#month)}"/></td>
</s:iterator>
<td><s:text name="wao.ui.misc.total"/></td>
<!-- Other columns -->
@@ -175,55 +181,45 @@
</thead>
<tbody>
- <s:if test="fullView">
- </s:if>
- <s:else>
- </s:else>
-
<%--Iterate on Facades--%>
<s:iterator value="samplingPlan" var="samplingPlanFacade">
<tr>
- <td colspan="${nbColumnsTotal}">FACADE <s:property value="%{#samplingPlanFacade.facade}"/></td>
+ <td colspan="${nbColumnsTotal}" class="facade"><s:property value="%{#samplingPlanFacade.facade}"/></td>
</tr>
<%--Iterate on Sectors --%>
<s:iterator value="samplingPlanFacade" var="samplingPlanSector">
<tr>
- <td colspan="${nbColumnsTotal}">SECTOR <s:property value="%{#samplingPlanSector.sectors}"/></td>
+ <td colspan="${nbColumnsTotal}" class="sector"><s:property value="%{#samplingPlanSector.sectors}"/></td>
</tr>
<%--Iterate on SampleRows --%>
<s:iterator value="samplingPlanSector" var="samplingPlanRow">
<s:set var="sampleRow" value="%{#samplingPlanRow.sampleRow}"/>
<tr<s:if test="sampleRowToHighlightId.equals(#sampleRow.topiaId)"> class="highlight"</s:if>>
<th>
- <s:url action="edit-sample-row!input" id="changePeriodUrl">
- <s:param name="sampleRowId" value="sampleRow.topiaId" />
- </s:url>
- <s:a class="btn" href="%{changePeriodUrl}" title="Changer les dates de la période par rapport à celles de la ligne">
- <s:property value="#sampleRow.code" />
- </s:a>
+ <s:property value="#sampleRow.code" />
</th>
<td><s:property value="#sampleRow.programName" /></td>
<s:if test="fullView">
- <td>CompanyName</td>
- <td><s:property value="#samplingPlanRow.fishingZones" /></td>
- <td><s:property value="#sampleRow.fishingZonesInfos" /></td>
- <td>
+ <td class="only-visible-fullview"><s:property value="#sampleRow.company.name" /></td>
+ <td class="only-visible-fullview"><s:property value="#samplingPlanRow.fishingZones" /></td>
+ <td class="only-visible-fullview"><s:property value="#sampleRow.fishingZonesInfos" /></td>
+ <td class="only-visible-fullview">
<s:iterator value="sampleRow.dcf5code" var="dcf5code">
<span>
<s:property />
</span>
</s:iterator>
</td>
- <td><s:property value="#sampleRow.profession.meshSize" /></td>
- <td><s:property value="#sampleRow.profession.size" /></td>
- <td><s:property value="#sampleRow.profession.other" /></td>
- <td><s:property value="#sampleRow.profession.libelle" /></td>
- <td><s:property value="#sampleRow.profession.species" /></td>
- <td><s:property value="%{formatMonth(#sampleRow.periodBegin)}" /></td>
- <td><s:property value="%{formatMonth(#sampleRow.periodEnd)}" /></td>
+ <td class="only-visible-fullview"><s:property value="#sampleRow.profession.meshSize" /></td>
+ <td class="only-visible-fullview"><s:property value="#sampleRow.profession.size" /></td>
+ <td class="only-visible-fullview"><s:property value="#sampleRow.profession.other" /></td>
+ <td class="only-visible-fullview"><s:property value="#sampleRow.profession.libelle" /></td>
+ <td class="only-visible-fullview"><s:property value="#sampleRow.profession.species" /></td>
+ <td class="only-visible-fullview"><s:property value="%{formatMonth(#sampleRow.periodBegin)}" /></td>
+ <td class="only-visible-fullview"><s:property value="%{formatMonth(#sampleRow.periodEnd)}" /></td>
</s:if>
<s:else>
- <td>FishingZones</td>
+ <td><s:property value="#samplingPlanRow.fishingZones" /></td>
<td>
<s:iterator value="sampleRow.dcf5code" var="dcf5code">
<span>
@@ -235,14 +231,12 @@
</s:else>
<!-- Months columns -->
<s:iterator value="samplingPlan.months" var="month">
- <td>
+ <td<s:if test="@fr.ifremer.wao.WaoUtils@isCurrentMonth(#month)"> class="current-month"</s:if>>
<s:property value="%{#samplingPlanRow.getNbTidesExpected(#month)}"/>
- <s:if test="displayTidesReal">
- <span>
- <em>(<s:property value="%{#samplingPlanRow.getNbTidesReal(#month)}"/>)
- </em>
- </span>
- </s:if>
+ <span class="display-tides-real">
+ <em>(<s:property value="%{#samplingPlanRow.getNbTidesReal(#month)}"/>)
+ </em>
+ </span>
</td>
</s:iterator>
<td>
@@ -256,9 +250,9 @@
</span>
</td>
<td>
- <s:property value="#samplingPlanRow.observationTimesInDaysExpected" /> j.
+ <s:property value="#samplingPlanRow.observationTimesInDaysExpected" /> <s:text name="wao.ui.misc.day"/>
<span>
- <em>(<s:property value="#samplingPlanRow.observationTimesInDaysReal" /> j.)</em>
+ <em>(<s:property value="#samplingPlanRow.observationTimesInDaysReal" /> <s:text name="wao.ui.misc.day"/>)</em>
</span>
</td>
<td><s:property value="#sampleRow.averageTideTime" /></td>
@@ -342,7 +336,36 @@
</todby>
<tfoot>
-
+ <td colspan="${nbColumnsForProfession}">
+ <s:text name="wao.ui.misc.totals" />
+ </td>
+ <!-- Months columns -->
+ <s:iterator value="samplingPlan.months" var="month">
+ <td<s:if test="@fr.ifremer.wao.WaoUtils@isCurrentMonth(#month)"> class="current-month"</s:if>>
+ <s:property value="samplingPlan.getTotalExpectedForMonth(#month)"/>
+ <span class="display-tides-real">
+ <span>
+ <em>(<s:property value="samplingPlan.getTotalRealForMonth(#month)"/>)</em>
+ </span>
+ <br/>
+ <s:property value="samplingPlan.getRatioForMonth(#month)"/>
+ </span>
+ </td>
+ </s:iterator>
+ <td>
+ <s:property value="#samplingPlan.highTotalExpected" />
+ <s:if test="!authenticatedWaoUser.guest">
+ <em>(<s:property value="samplingPlan.highTotalReal" />)</em>
+ <strong><s:property value="samplingPlan.highTotalRatio" /></strong>
+ </s:if>
+ </td>
+ <td>
+ <s:property value="samplingPlan.observationTimesInDaysTotalExpected" /> <s:text name="wao.ui.misc.day"/>
+ <span>
+ <em>(<s:property value="samplingPlan.observationTimesInDaysTotalReal"/> <s:text name="wao.ui.misc.day"/>)</em>
+ </span>
+ </td>
+ <td colspan="${nbColumnsForOther}"> </td>
</tfoot>
</table>
1
0
25 Mar '14
Jenkins build became unstable: wao-ci » Wao :: Services #48
by admin+ci-codelutin.com@codelutin.com 25 Mar '14
by admin+ci-codelutin.com@codelutin.com 25 Mar '14
25 Mar '14
25 Mar '14
Author: bleny
Date: 2014-03-25 18:50:13 +0100 (Tue, 25 Mar 2014)
New Revision: 1752
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1752
Log:
fix test by fixing imported sampling plan
Modified:
trunk/wao-services/src/test/resources/import/echantillonnage.csv
Modified: trunk/wao-services/src/test/resources/import/echantillonnage.csv
===================================================================
--- trunk/wao-services/src/test/resources/import/echantillonnage.csv 2014-03-25 17:42:12 UTC (rev 1751)
+++ trunk/wao-services/src/test/resources/import/echantillonnage.csv 2014-03-25 17:50:13 UTC (rev 1752)
@@ -1,14 +1,14 @@
"PLAN_CODE";"SOCIETE_NOM";"PECHE_DIVISION";"PECHE_AUTRE";"METIER_CODE_DCF5";"METIER_MAILLAGE";"METIER_TAILLE";"METIER_AUTRE";"METIER_LIBELLE";"METIER_ESPECES";"PROGRAMME_CODE";"PROGRAMME_DEBUT";"PROGRAMME_FIN";"12/2009";"01/2010";"02/2010";"03/2010";"04/2010";"05/2010";"06/2010";"07/2010";"08/2010";"09/2010";"10/2010";"11/2010";"12/2010";"01/2011";"02/2011";"03/2011";"PLAN_DUREE_MOY";"PLAN_NB_OBSERV";"PLAN_COMMENT";"TAUX_COUVERTURE_APPLIQUE"
"2010_M0001";"Ifremer";"IId,I";;"DRB_ALG";;;;;;"MA-2009";"03/2010";"01/2011";;;;0;0;0;0;0;0;0;2;0;0;4;;;"1.5";1;"Un petit commentaire";5
"2010_M0002";"Ifremer";"IId";;"DRH_CAT,DRH_CRU";;;;"Fileyage";"poissons tubes";"MANY";"01/2008";"12/2008";;20;0;0;21;0;0;21;0;0;21;0;0;;;;1;1;;5
-"2010_M0003";;"IId,IV";;"DRH";;;;"balottage en plein air";"divers choses visqueuses";"MA-2009";"03/2010";"01/2011";;;;0;22;0;0;25;0;0;21;0;0;25;;;2;1;;5
-"2009_M0001";;"IId,IV";;"GTR_DEF,GNS_DEF";"110-119";;;"Fileyage à poissons tubes";"poissons plats";"PPP2010";"12/2009";"10/2010";0;1;1;1;2;1;1;1;1;1;2;;;;;;1;1;;5
-"2009_M0002";;"IId";;"GTR_DEF,GNS_DEF";"9888-99";;;"Fileyage à sirènes ";"nymphes";"PPP2010";"12/2009";"10/2010";1;1;1;2;3;4;4;4;4;3;3;;;;;;1;1;;10
+"2010_M0003";"Ifremer";"IId,IV";;"DRH";;;;"balottage en plein air";"divers choses visqueuses";"MA-2009";"03/2010";"01/2011";;;;0;22;0;0;25;0;0;21;0;0;25;;;2;1;;5
+"2009_M0001";"Ifremer";"IId,IV";;"GTR_DEF,GNS_DEF";"110-119";;;"Fileyage à poissons tubes";"poissons plats";"PPP2010";"12/2009";"10/2010";0;1;1;1;2;1;1;1;1;1;2;;;;;;1;1;;5
+"2009_M0002";"Ifremer";"IId";;"GTR_DEF,GNS_DEF";"9888-99";;;"Fileyage à sirènes ";"nymphes";"PPP2010";"12/2009";"10/2010";1;1;1;2;3;4;4;4;4;3;3;;;;;;1;1;;10
"2009_M0003";"Ifremer";"IV";;"GTR_MOL,GNS";;;;"Fileyages à baleines à bosse";"chameaux";"PPP2010";"12/2009";"10/2010";2;2;2;2;2;2;2;2;2;2;4;;;;;;1;1;;10
-"2009_M0004";;"IId";;"PTB_ALG";">=190";">18";;"Chalutage de fond machiavélique";"gadidés; divers";"PPP2010";"12/2009";"10/2010";1;1;1;1;1;1;1;1;1;1;2;;;;;;3;2;;10
-"2009_M0005";;"IId";;"PTB_ALG";"70-1100";">1140";;"Plongeur de fond sous-marin";"gadidés; divers";"PPP2010";"12/2009";"10/2010";1;1;1;1;1;1;1;1;1;1;2;;;;;;3;2;;10
+"2009_M0004";"Ifremer";"IId";;"PTB_ALG";">=190";">18";;"Chalutage de fond machiavélique";"gadidés; divers";"PPP2010";"12/2009";"10/2010";1;1;1;1;1;1;1;1;1;1;2;;;;;;3;2;;10
+"2009_M0005";"Ifremer";"IId";;"PTB_ALG";"70-1100";">1140";;"Plongeur de fond sous-marin";"gadidés; divers";"PPP2010";"12/2009";"10/2010";1;1;1;1;1;1;1;1;1;1;2;;;;;;3;2;;10
"2009_M0006";"OCEANET";"I,IV";;"DRB_DEF";"70-1100";">1140";;"Leon";"poissons plats";"PPP2010";"12/2009";"10/2010";0;1;0;1;0;1;2;2;2;2;1;;;;;;3;2;;
"2010_M0004";"Ifremer";"IId,IV";;"PTB_DEF,PTB_ALG,DRH";;;;"Chalutage de fond";"gadidés; poissons plats; divers";"BLOB";"01/2010";"12/2010";;3;0;0;3;0;0;3;0;0;3;0;0;;;;3;1;;
-"2010_M0005";;"IId";;"DRB";;;;"Kamoulox";"merlu; poissons cerises; divers";"MA-2009";"03/2010";"01/2011";;;;0;5;0;0;5;0;0;6;0;0;3;;;3;1;;15
-"2010_M0010";;"I,IV";;"DRB";"70-1100";;;"Kamoulox";"merlu; poissons pommes; divers";"MA-2009";"03/2010";"01/2011";;;;0;5;0;0;5;0;0;6;0;0;3;;;3;1;;15
-"2010_M0011";;"I,IV";;"DRB_ANA";"70-1100";;;"Troubidou";"merlu; poissons cerises";"MA-2009";"03/2010";"01/2011";;;;0;5;0;0;5;0;0;6;0;0;3;;;3;1;;
+"2010_M0005";"OCEANET";"IId";;"DRB";;;;"Kamoulox";"merlu; poissons cerises; divers";"MA-2009";"03/2010";"01/2011";;;;0;5;0;0;5;0;0;6;0;0;3;;;3;1;;15
+"2010_M0010";"OCEANET";"I,IV";;"DRB";"70-1100";;;"Kamoulox";"merlu; poissons pommes; divers";"MA-2009";"03/2010";"01/2011";;;;0;5;0;0;5;0;0;6;0;0;3;;;3;1;;15
+"2010_M0011";"OCEANET";"I,IV";;"DRB_ANA";"70-1100";;;"Troubidou";"merlu; poissons cerises";"MA-2009";"03/2010";"01/2011";;;;0;5;0;0;5;0;0;6;0;0;3;;;3;1;;
1
0
r1751 - in trunk/wao-web/src/main: resources/fr/ifremer/wao resources/i18n webapp/WEB-INF/content/obsmer
by bleny@users.forge.codelutin.com 25 Mar '14
by bleny@users.forge.codelutin.com 25 Mar '14
25 Mar '14
Author: bleny
Date: 2014-03-25 18:42:12 +0100 (Tue, 25 Mar 2014)
New Revision: 1751
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1751
Log:
refs #4483 introduce SampleRowsFilterValues filter in plain old struts jsp
Added:
trunk/wao-web/src/main/resources/fr/ifremer/wao/SampleRowsFilter-conversion.properties
Modified:
trunk/wao-web/src/main/resources/i18n/wao-web_en_GB.properties
trunk/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties
trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp
Added: trunk/wao-web/src/main/resources/fr/ifremer/wao/SampleRowsFilter-conversion.properties
===================================================================
--- trunk/wao-web/src/main/resources/fr/ifremer/wao/SampleRowsFilter-conversion.properties (rev 0)
+++ trunk/wao-web/src/main/resources/fr/ifremer/wao/SampleRowsFilter-conversion.properties 2014-03-25 17:42:12 UTC (rev 1751)
@@ -0,0 +1,2 @@
+periodFrom=fr.ifremer.wao.web.action.MonthConverter
+periodTo=fr.ifremer.wao.web.action.MonthConverter
Modified: trunk/wao-web/src/main/resources/i18n/wao-web_en_GB.properties
===================================================================
--- trunk/wao-web/src/main/resources/i18n/wao-web_en_GB.properties 2014-03-25 17:22:15 UTC (rev 1750)
+++ trunk/wao-web/src/main/resources/i18n/wao-web_en_GB.properties 2014-03-25 17:42:12 UTC (rev 1751)
@@ -59,7 +59,7 @@
wao.ui.action.refresh=Refresh
wao.ui.action.refuseContact=Refuse contact
wao.ui.action.remove=Remove
-wao.ui.action.reset=Remettre à zéro
+wao.ui.action.reset=Reset
wao.ui.action.resetFields=Reset form
wao.ui.action.revert=Revert
wao.ui.action.runExport=Run export
Modified: trunk/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties
===================================================================
--- trunk/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties 2014-03-25 17:22:15 UTC (rev 1750)
+++ trunk/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties 2014-03-25 17:42:12 UTC (rev 1751)
@@ -59,7 +59,7 @@
wao.ui.action.refresh=Rafraîchir
wao.ui.action.refuseContact=Refuser le contact
wao.ui.action.remove=Retirer
-wao.ui.action.reset=Reset
+wao.ui.action.reset=Remettre à zéro
wao.ui.action.resetFields=Remettre le formulaire à zéro
wao.ui.action.revert=Annuler
wao.ui.action.runExport=Lancer l'export
Modified: trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp
===================================================================
--- trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp 2014-03-25 17:22:15 UTC (rev 1750)
+++ trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp 2014-03-25 17:42:12 UTC (rev 1751)
@@ -42,6 +42,16 @@
<s:form method="GET">
+ <s:textfield name="filter.periodFrom"
+ label="%{getText('wao.ui.form.periodFrom')}"
+ placeholder="04/2014"
+ cssClass="input-small" />
+
+ <s:textfield name="filter.periodTo"
+ label="%{getText('wao.ui.form.period.to')}"
+ placeholder="03/2015"
+ cssClass="input-small" />
+
<s:select name="filter.companyIds"
label="%{getText('wao.ui.entity.Company')}"
list="samplingPlan.filterValues.companies"
@@ -54,6 +64,37 @@
multiple="true"
cssClass="input-xxlarge" />
+ <s:select name="filter.fishingZoneFacadeNames"
+ label="%{getText('wao.ui.field.FishingZone.facadeName')}"
+ list="samplingPlan.filterValues.fishingZoneFacadeNames"
+ multiple="true"
+ cssClass="input-xxlarge" />
+
+ <s:select name="filter.fishingZoneSectorNames"
+ label="%{getText('wao.ui.field.FishingZone.sectorName')}"
+ list="samplingPlan.filterValues.fishingZoneSectorNames"
+ multiple="true"
+ cssClass="input-xxlarge" />
+
+ <s:select name="filter.sampleRowCodes"
+ label="%{getText('wao.ui.field.SampleRow.code')}"
+ list="samplingPlan.filterValues.sampleRowCodes"
+ multiple="true"
+ cssClass="input-xxlarge" />
+
+ <s:select name="filter.fishingGearDcfIds"
+ label="%{getText('wao.ui.entity.fishingGearDCF')}"
+ list="samplingPlan.filterValues.fishingGearDcfs"
+ value="%getText(#value)"
+ multiple="true"
+ cssClass="input-xxlarge" />
+
+ <s:select name="filter.targetSpeciesDcfIds"
+ label="%{getText('wao.ui.entity.targetSpeciesDCF')}"
+ list="samplingPlan.filterValues.targetSpeciesDcfs"
+ multiple="true"
+ cssClass="input-xxlarge" />
+
<s:url action="sampling-plan" id="samplingPlanUrl" />
<s:a href="%{samplingPlanUrl}" cssClass="btn">
<i class="icon-reset"></i> <s:text name="wao.ui.action.reset" />
1
0
r1750 - in trunk: wao-persistence/src/main/java/fr/ifremer/wao wao-persistence/src/main/java/fr/ifremer/wao/entity wao-services/src/main/java/fr/ifremer/wao/services/service wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer wao-web/src/main/resources/i18n wao-web/src/main/webapp/WEB-INF/content/obsmer
by bleny@users.forge.codelutin.com 25 Mar '14
by bleny@users.forge.codelutin.com 25 Mar '14
25 Mar '14
Author: bleny
Date: 2014-03-25 18:22:15 +0100 (Tue, 25 Mar 2014)
New Revision: 1750
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1750
Log:
refs #4483 introduce SampleRowsFilterValues start filter form ui
Added:
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/SampleRowsFilterValues.java
Modified:
trunk/wao-persistence/src/main/java/fr/ifremer/wao/ContactsFilter.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/SampleRowsFilter.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ContactTopiaDao.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SampleRowTopiaDao.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlan.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanBuilder.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanService.java
trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/SamplingPlanAction.java
trunk/wao-web/src/main/resources/i18n/wao-web_en_GB.properties
trunk/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties
trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp
Modified: trunk/wao-persistence/src/main/java/fr/ifremer/wao/ContactsFilter.java
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/ContactsFilter.java 2014-03-25 17:16:52 UTC (rev 1749)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/ContactsFilter.java 2014-03-25 17:22:15 UTC (rev 1750)
@@ -5,6 +5,7 @@
import fr.ifremer.wao.entity.ObservationType;
import fr.ifremer.wao.entity.ObservedDataControl;
import fr.ifremer.wao.entity.SamplingStrategy;
+import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import java.util.Date;
import java.util.Set;
@@ -13,10 +14,22 @@
protected SampleRowsFilter sampleRowFilter;
+ /**
+ * Filter contact on {@link fr.ifremer.wao.entity.Contact#getCreationDate()} or on
+ * {@link fr.ifremer.wao.entity.Contact#getObservationBeginDate()} according to
+ * {@link #isFilterOnObservationBeginDate()} flag.
+ */
protected Date periodFrom;
+ /**
+ * Filter contact on {@link fr.ifremer.wao.entity.Contact#getCreationDate()} or on
+ * {@link fr.ifremer.wao.entity.Contact#getObservationBeginDate()} according to
+ * {@link #isFilterOnObservationBeginDate()} flag.
+ */
protected Date periodTo;
+ protected Set<String> contactIds;
+
protected Set<ContactState> contactStates;
protected Set<DataReliability> dataReliabilities;
@@ -224,4 +237,18 @@
public void setSortedByBoardingDate(boolean sortedByBoardingDate) {
this.sortedByBoardingDate = sortedByBoardingDate;
}
+
+ public Set<String> getContactIds() {
+ return contactIds;
+ }
+
+ public void setContactIds(Set<String> contactIds) {
+ this.contactIds = contactIds;
+ }
+
+ @Override
+ public String toString() {
+ return ReflectionToStringBuilder.reflectionToString(this);
+ }
+
}
Modified: trunk/wao-persistence/src/main/java/fr/ifremer/wao/SampleRowsFilter.java
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/SampleRowsFilter.java 2014-03-25 17:16:52 UTC (rev 1749)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/SampleRowsFilter.java 2014-03-25 17:22:15 UTC (rev 1750)
@@ -22,20 +22,29 @@
*/
import fr.ifremer.wao.entity.ObsProgram;
-import fr.ifremer.wao.entity.ObservationType;
import fr.ifremer.wao.entity.SamplingStrategy;
+import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import java.util.Date;
+import java.util.Objects;
import java.util.Set;
public class SampleRowsFilter {
protected ObsProgram obsProgram;
- protected ObservationType expectedObservationType;
+ protected Set<String> sampleRowIds;
+ /** Filter sample rows on sample month.
+ *
+ * To matches the filter, the sample row must have at least one sample month after this date.
+ */
protected Date periodFrom;
+ /** Filter sample rows on sample month.
+ *
+ * To matches the filter, the sample row must have at least one sample month before this date.
+ */
protected Date periodTo;
protected Set<String> fishingZoneFacadeNames;
@@ -54,16 +63,6 @@
protected Set<String> terrestrialDistrictIds;
- protected Set<String> observationUnitIds;
-
- protected Set<String> observerIds;
-
- protected Set<String> subPopulationCodes;
-
- protected Set<String> skillZoneCodes;
-
- protected Set<String> regionIfremerIds;
-
protected Set<String> companyIds;
protected Set<String> orderByArguments;
@@ -79,14 +78,6 @@
this.obsProgram = obsProgram;
}
- public ObservationType getExpectedObservationType() {
- return expectedObservationType;
- }
-
- public void setExpectedObservationType(ObservationType expectedObservationType) {
- this.expectedObservationType = expectedObservationType;
- }
-
public Date getPeriodFrom() {
return periodFrom;
}
@@ -167,67 +158,84 @@
this.terrestrialDistrictIds = terrestrialDistrictIds;
}
- public Set<String> getObservationUnitIds() {
- return observationUnitIds;
+ public Set<String> getCompanyIds() {
+ return companyIds;
}
- public void setObservationUnitIds(Set<String> observationUnitIds) {
- this.observationUnitIds = observationUnitIds;
+ public void setCompanyIds(Set<String> companyIds) {
+ this.companyIds = companyIds;
}
- public Set<String> getObserverIds() {
- return observerIds;
+ public Set<String> getOrderByArguments() {
+ return orderByArguments;
}
- public void setObserverIds(Set<String> observerIds) {
- this.observerIds = observerIds;
+ public void setOrderByArguments(Set<String> orderByArguments) {
+ this.orderByArguments = orderByArguments;
}
- public Set<String> getSubPopulationCodes() {
- return subPopulationCodes;
+ public boolean isEstimatedTides() {
+ return estimatedTides;
}
- public void setSubPopulationCodes(Set<String> subPopulationCodes) {
- this.subPopulationCodes = subPopulationCodes;
+ public void setEstimatedTides(boolean estimatedTides) {
+ this.estimatedTides = estimatedTides;
}
- public Set<String> getSkillZoneCodes() {
- return skillZoneCodes;
+ public Set<String> getSampleRowIds() {
+ return sampleRowIds;
}
- public void setSkillZoneCodes(Set<String> skillZoneCodes) {
- this.skillZoneCodes = skillZoneCodes;
+ public void setSampleRowIds(Set<String> sampleRowIds) {
+ this.sampleRowIds = sampleRowIds;
}
- public Set<String> getRegionIfremerIds() {
- return regionIfremerIds;
- }
+ @Override
+ public boolean equals(Object o) {
- public void setRegionIfremerIds(Set<String> regionIfremerIds) {
- this.regionIfremerIds = regionIfremerIds;
- }
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
- public Set<String> getCompanyIds() {
- return companyIds;
- }
+ SampleRowsFilter that = (SampleRowsFilter) o;
- public void setCompanyIds(Set<String> companyIds) {
- this.companyIds = companyIds;
- }
+ boolean equals = obsProgram.equals(that.obsProgram)
+ && Objects.equals(periodFrom, that.periodFrom)
+ && Objects.equals(periodTo, that.periodTo)
+ && WaoUtils.isEqualCollection(sampleRowIds, that.sampleRowIds)
+ && WaoUtils.isEqualCollection(fishingZoneFacadeNames, that.fishingZoneFacadeNames)
+ && WaoUtils.isEqualCollection(fishingZoneSectorNames, that.fishingZoneSectorNames)
+ && WaoUtils.isEqualCollection(sampleRowCodes, that.sampleRowCodes)
+ && WaoUtils.isEqualCollection(programNames, that.programNames)
+ && WaoUtils.isEqualCollection(fishingGearDcfIds, that.fishingGearDcfIds)
+ && WaoUtils.isEqualCollection(targetSpeciesDcfIds, that.targetSpeciesDcfIds)
+ && WaoUtils.isEqualCollection(samplingStrategies, that.samplingStrategies)
+ && WaoUtils.isEqualCollection(terrestrialDistrictIds, that.terrestrialDistrictIds)
+ && WaoUtils.isEqualCollection(companyIds, that.companyIds)
+ && WaoUtils.isEqualCollection(orderByArguments, that.orderByArguments);
- public Set<String> getOrderByArguments() {
- return orderByArguments;
+ return equals;
+
}
- public void setOrderByArguments(Set<String> orderByArguments) {
- this.orderByArguments = orderByArguments;
+ @Override
+ public int hashCode() {
+ int hashCode = obsProgram.hashCode();
+ hashCode = 31 * hashCode + (sampleRowIds == null ? 0 : sampleRowIds.size());
+ hashCode = 31 * hashCode + (fishingZoneFacadeNames == null ? 0 : fishingZoneFacadeNames.size());
+ hashCode = 31 * hashCode + (fishingZoneSectorNames == null ? 0 : fishingZoneSectorNames.size());
+ hashCode = 31 * hashCode + (sampleRowCodes == null ? 0 : sampleRowCodes.size());
+ hashCode = 31 * hashCode + (programNames == null ? 0 : programNames.size());
+ hashCode = 31 * hashCode + (fishingGearDcfIds == null ? 0 : fishingGearDcfIds.size());
+ hashCode = 31 * hashCode + (targetSpeciesDcfIds == null ? 0 : targetSpeciesDcfIds.size());
+ hashCode = 31 * hashCode + (samplingStrategies == null ? 0 : samplingStrategies.size());
+ hashCode = 31 * hashCode + (terrestrialDistrictIds == null ? 0 : terrestrialDistrictIds.size());
+ hashCode = 31 * hashCode + (companyIds == null ? 0 : companyIds.size());
+ return hashCode;
}
- public boolean isEstimatedTides() {
- return estimatedTides;
+ @Override
+ public String toString() {
+ return ReflectionToStringBuilder.reflectionToString(this);
}
- public void setEstimatedTides(boolean estimatedTides) {
- this.estimatedTides = estimatedTides;
- }
}
Modified: trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java 2014-03-25 17:16:52 UTC (rev 1749)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java 2014-03-25 17:22:15 UTC (rev 1750)
@@ -22,6 +22,7 @@
*/
import fr.ifremer.wao.entity.ObsProgram;
+import org.apache.commons.collections4.CollectionUtils;
import java.text.DateFormat;
import java.text.ParseException;
@@ -80,4 +81,26 @@
return ordinals;
}
+ /**
+ * Wrapper on {@link org.apache.commons.collections4.CollectionUtils#isEqualCollection(java.util.Collection, java.util.Collection)}
+ * that handles null values.
+ */
+ public static boolean isEqualCollection(Collection<?> a, Collection<?> b) {
+ boolean isEqualCollection;
+ if (a == null) {
+ if (b == null) {
+ isEqualCollection = true;
+ } else {
+ isEqualCollection = false;
+ }
+ } else {
+ if (b == null) {
+ isEqualCollection = false;
+ } else {
+ isEqualCollection = CollectionUtils.isEqualCollection(a, b);
+ }
+ }
+ return isEqualCollection;
+ }
+
}
Modified: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ContactTopiaDao.java
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ContactTopiaDao.java 2014-03-25 17:16:52 UTC (rev 1749)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ContactTopiaDao.java 2014-03-25 17:22:15 UTC (rev 1750)
@@ -8,6 +8,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.topia.persistence.HqlAndParametersBuilder;
+import org.nuiton.topia.persistence.TopiaEntity;
import java.util.Collection;
import java.util.List;
@@ -63,6 +64,10 @@
query.addWhereClause("c." + periodProperty + " <= :periodTo", ImmutableMap.of("periodTo", (Object) filter.getPeriodTo()));
}
+ if (CollectionUtils.isNotEmpty(filter.getContactIds())) {
+ query.addIn(TopiaEntity.PROPERTY_TOPIA_ID, filter.getContactIds());
+ }
+
if (CollectionUtils.isNotEmpty(filter.getContactStates())) {
Collection<Integer> contactStateOrdinals = WaoUtils.toOrdinals(filter.getContactStates());
query.addIn(Contact.PROPERTY_STATE, contactStateOrdinals);
@@ -128,7 +133,7 @@
}
if (log.isTraceEnabled()) {
- log.trace("query to filter contacts " + query.getHql() + " " + query.getHqlParameters());
+ log.trace("query to filter contacts for " + filter + " is " + query.getHql() + " " + query.getHqlParameters());
}
return query;
Modified: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SampleRowTopiaDao.java
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SampleRowTopiaDao.java 2014-03-25 17:16:52 UTC (rev 1749)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SampleRowTopiaDao.java 2014-03-25 17:22:15 UTC (rev 1750)
@@ -31,6 +31,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.topia.persistence.HqlAndParametersBuilder;
+import org.nuiton.topia.persistence.TopiaEntity;
import java.util.Calendar;
import java.util.Date;
@@ -76,8 +77,8 @@
query.addEquals(SampleRow.PROPERTY_OBS_PROGRAM_ORDINAL, obsProgram.ordinal());
- if (filter.getExpectedObservationType() != null) {
- query.addEquals(SampleRow.PROPERTY_OBSERVATION_TYPE_ORDINAL, filter.getExpectedObservationType().ordinal());
+ if (CollectionUtils.isNotEmpty(filter.getSampleRowIds())) {
+ query.addIn(TopiaEntity.PROPERTY_TOPIA_ID, filter.getSampleRowIds());
}
if (filter.getPeriodFrom() != null) {
@@ -114,47 +115,6 @@
query.addIn(SampleRow.PROPERTY_SAMPLING_STRATEGY_ORDINAL, WaoUtils.toOrdinals(filter.getSamplingStrategies()));
}
- if (CollectionUtils.isNotEmpty(filter.getObservationUnitIds())) {
- query.addTopiaIdIn(SampleRow.PROPERTY_OBSERVATION_UNIT, filter.getObservationUnitIds());
- }
-
- if (CollectionUtils.isNotEmpty(filter.getSubPopulationCodes())) {
- query.addTopiaIdIn(
- SampleRow.PROPERTY_OBSERVATION_UNIT + "." + TerrestrialDivision.PROPERTY_SUB_POPULATION_CODE,
- filter.getSubPopulationCodes());
- }
-
- if (CollectionUtils.isNotEmpty(filter.getSkillZoneCodes())) {
- query.addTopiaIdIn(
- SampleRow.PROPERTY_OBSERVATION_UNIT + "." + TerrestrialDivision.PROPERTY_SKILL_ZONE_CODE,
- filter.getSkillZoneCodes());
- }
-
- if (CollectionUtils.isNotEmpty(filter.getSkillZoneCodes())) {
- query.addTopiaIdIn(
- SampleRow.PROPERTY_OBSERVATION_UNIT + "." + TerrestrialDivision.PROPERTY_SKILL_ZONE_CODE,
- filter.getSkillZoneCodes());
- }
-
- if (CollectionUtils.isNotEmpty(filter.getRegionIfremerIds())) {
- Preconditions.checkNotNull(filter.getExpectedObservationType(), "expected observation type needed");
- if (filter.getExpectedObservationType().isFieldWorkObservation()) {
- query.addTopiaIdIn(
- SampleRow.PROPERTY_OBSERVATION_UNIT + "." + TerrestrialDivision.PROPERTY_REGION_IFREMER,
- filter.getRegionIfremerIds());
- } else {
- query.addWhereClause(
- "sr.topiaId in (select sr2.topiaId from fr.ifremer.wao.entity.SampleRowImpl as sr2 join sr2.terrestrialLocations as regionIfremer where regionIfremer.topiaId in (:regionIfremerIds))",
- ImmutableMap.of("regionIfremerIds", (Object) filter.getRegionIfremerIds()));
- }
- }
-
- if (CollectionUtils.isNotEmpty(filter.getObserverIds())) {
- query.addWhereClause(
- "sr.topiaId in (select sr2.topiaId from fr.ifremer.wao.entity.SampleRowImpl as sr2 join sr2.observers as observer where observer.topiaId in (:observerIds))",
- ImmutableMap.<String, Object>of("observerIds", filter.getObserverIds()));
- }
-
if (CollectionUtils.isNotEmpty(filter.getTerrestrialDistrictIds())) {
query.addWhereClause(
"sr.topiaId in (select sr2.topiaId from fr.ifremer.wao.entity.SampleRowImpl as sr2 join sr2.terrestrialLocations as terrestrialDistrict where terrestrialDistrict.topiaId in (:terrestrialDistrictIds))",
@@ -186,7 +146,7 @@
}
if (log.isTraceEnabled()) {
- log.trace("query to filter sample rows " + query.getHql() + " " + query.getHqlParameters());
+ log.trace("query to filter sample rows for " + filter + " is " + query.getHql() + " " + query.getHqlParameters());
}
return query;
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlan.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlan.java 2014-03-25 17:16:52 UTC (rev 1749)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlan.java 2014-03-25 17:22:15 UTC (rev 1750)
@@ -90,6 +90,8 @@
*/
protected List<Date> months;
+ protected SampleRowsFilterValues filterValues;
+
public ObsMerSamplingPlan(List<Date> months,
List<ObsMerSamplingPlanFacadePart> facadeParts,
Map<Date, ObsMerSamplingPlanStatistics> statisticsMap,
@@ -98,7 +100,8 @@
Integer highTotalEstimated,
Double observationTimesInDaysTotalExpected,
Long observationTimesInDaysTotalReal,
- Long observationTimesInDaysTotalEstimated) {
+ Long observationTimesInDaysTotalEstimated,
+ SampleRowsFilterValues filterValues) {
this.months = months;
this.facades = facadeParts;
this.statisticsMap = statisticsMap;
@@ -108,6 +111,7 @@
this.highTotalReal = highTotalReal;
this.highTotalEstimated = highTotalEstimated;
this.observationTimesInDaysTotalEstimated = observationTimesInDaysTotalEstimated;
+ this.filterValues = filterValues;
}
//FIXME Remove this
@@ -187,6 +191,10 @@
return ratio;
}
+ public SampleRowsFilterValues getFilterValues() {
+ return filterValues;
+ }
+
/**
* All sectors part for a given facade.
* <p/>
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanBuilder.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanBuilder.java 2014-03-25 17:16:52 UTC (rev 1749)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanBuilder.java 2014-03-25 17:22:15 UTC (rev 1750)
@@ -52,6 +52,11 @@
protected SampleRowsFilter sampleRowsFilter;
/**
+ * Bean to hold all values that user can select to fill {@link fr.ifremer.wao.SampleRowsFilter}.
+ */
+ protected SampleRowsFilterValues sampleRowsFilterValues;
+
+ /**
* List of month computed from the filter.
*/
protected List<Date> months;
@@ -126,6 +131,7 @@
public ObsMerSamplingPlanBuilder(SampleRowsFilter sampleRowsFilter) {
this.sampleRowsFilter = sampleRowsFilter;
+ this.sampleRowsFilterValues = new SampleRowsFilterValues();
this.facadeMap = new LinkedHashMap<>();
this.highTotalExpected = new MutableInt();
this.highTotalReal = new MutableInt();
@@ -177,6 +183,8 @@
observationTimesInDaysTotalReal.add(observationTimesInDaysReal);
observationTimesInDaysTotalEstimated.add(observationTimesInDaysEstimated);
+ sampleRowsFilterValues.addSampleRow(sampleRow);
+
return this;
}
@@ -209,7 +217,8 @@
highTotalEstimated.toInteger(),
observationTimesInDaysTotalExpected.toDouble(),
observationTimesInDaysTotalReal.toLong(),
- observationTimesInDaysTotalEstimated.toLong());
+ observationTimesInDaysTotalEstimated.toLong(),
+ sampleRowsFilterValues);
return result;
}
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanService.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanService.java 2014-03-25 17:16:52 UTC (rev 1749)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanService.java 2014-03-25 17:22:15 UTC (rev 1750)
@@ -460,11 +460,6 @@
newFilter.setCompanyIds(Sets.newHashSet(authenticatedWaoUser.getCompany().getTopiaId()));
}
- if (obsProgram.isObsDeb() && authenticatedWaoUser.isObserver()) {
- // observer can only see the row he has been associated
- newFilter.setObserverIds(Sets.newHashSet(authenticatedWaoUser.getWaoUser().getTopiaId()));
- }
-
return newFilter;
}
Added: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/SampleRowsFilterValues.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/SampleRowsFilterValues.java (rev 0)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/SampleRowsFilterValues.java 2014-03-25 17:22:15 UTC (rev 1750)
@@ -0,0 +1,99 @@
+package fr.ifremer.wao.services.service;
+
+import fr.ifremer.wao.entity.DCF5Code;
+import fr.ifremer.wao.entity.FishingZone;
+import fr.ifremer.wao.entity.SampleRow;
+import fr.ifremer.wao.entity.SamplingStrategy;
+import fr.ifremer.wao.entity.TerrestrialLocation;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Bean to hold all values that user can select to fill {@link fr.ifremer.wao.SampleRowsFilter}.
+ */
+public class SampleRowsFilterValues implements Serializable {
+
+ protected Set<String> fishingZoneFacadeNames = new HashSet<>();
+
+ protected Set<String> fishingZoneSectorNames = new HashSet<>();
+
+ protected Set<String> sampleRowCodes = new HashSet<>();
+
+ protected Set<String> programNames = new HashSet<>();
+
+ protected Map<String, String> companies = new HashMap<>();
+
+ protected Set<SamplingStrategy> samplingStrategies = new HashSet<>();
+
+ protected Map<String, String> terrestrialDistricts = new HashMap<>();
+
+ /** Values are the i18n keys. */
+ protected Map<String, String> fishingGearDcfs = new HashMap<>();
+
+ /** Values are the i18n keys. */
+ protected Map<String, String> targetSpeciesDcfs = new HashMap<>();
+
+ public void addSampleRow(SampleRow sampleRow) {
+ for (FishingZone fishingZone : sampleRow.getFishingZone()) {
+ fishingZoneFacadeNames.add(fishingZone.getFacadeName());
+ fishingZoneSectorNames.add(fishingZone.getSectorName());
+ }
+ sampleRowCodes.add(sampleRow.getCode());
+ programNames.add(sampleRow.getProgramName());
+ companies.put(sampleRow.getCompany().getTopiaId(), sampleRow.getCompany().getName());
+ samplingStrategies.add(sampleRow.getSamplingStrategy());
+ if (sampleRow.getObsProgram().isObsVente()) {
+ TerrestrialLocation terrestrialDistrict = sampleRow.getTerrestrialLocation();
+ terrestrialDistricts.put(terrestrialDistrict.getTopiaId(), terrestrialDistrict.getDescription());
+ }
+ for (DCF5Code dcf5Code : sampleRow.getdCF5Code()) {
+ String i18nKey = "fr.ifremer.wao.entity.FishingGearDCF." + dcf5Code.getFishingGearDCF().getCode();
+ fishingGearDcfs.put(dcf5Code.getFishingGearDCF().getTopiaId(), i18nKey);
+ if (dcf5Code.getTargetSpeciesDCF() != null) {
+ i18nKey = "fr.ifremer.wao.entity.TargetSpeciesDCF." + dcf5Code.getTargetSpeciesDCF().getCode();
+ targetSpeciesDcfs.put(dcf5Code.getTargetSpeciesDCF().getTopiaId(), i18nKey);
+ }
+ }
+ }
+
+ public Set<String> getFishingZoneFacadeNames() {
+ return fishingZoneFacadeNames;
+ }
+
+ public Set<String> getFishingZoneSectorNames() {
+ return fishingZoneSectorNames;
+ }
+
+ public Set<String> getSampleRowCodes() {
+ return sampleRowCodes;
+ }
+
+ public Set<String> getProgramNames() {
+ return programNames;
+ }
+
+ public Map<String, String> getCompanies() {
+ return companies;
+ }
+
+ public Set<SamplingStrategy> getSamplingStrategies() {
+ return samplingStrategies;
+ }
+
+ public Map<String, String> getTerrestrialDistricts() {
+ return terrestrialDistricts;
+ }
+
+ public Map<String, String> getFishingGearDcfs() {
+ return fishingGearDcfs;
+ }
+
+ public Map<String, String> getTargetSpeciesDcfs() {
+ return targetSpeciesDcfs;
+ }
+
+}
Modified: trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/SamplingPlanAction.java
===================================================================
--- trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/SamplingPlanAction.java 2014-03-25 17:16:52 UTC (rev 1749)
+++ trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/SamplingPlanAction.java 2014-03-25 17:22:15 UTC (rev 1750)
@@ -21,29 +21,41 @@
* #L%
*/
+import com.opensymphony.xwork2.Preparable;
import fr.ifremer.wao.SampleRowsFilter;
-import fr.ifremer.wao.entity.SampleRow;
import fr.ifremer.wao.services.service.ObsMerSamplingPlan;
import fr.ifremer.wao.services.service.ObsMerSamplingPlanService;
import fr.ifremer.wao.web.WaoJspActionSupport;
-import java.util.List;
+public class SamplingPlanAction extends WaoJspActionSupport implements Preparable {
-public class SamplingPlanAction extends WaoJspActionSupport {
-
protected ObsMerSamplingPlanService service;
+ protected SampleRowsFilter filter;
+
protected ObsMerSamplingPlan samplingPlan;
public void setService(ObsMerSamplingPlanService service) {
this.service = service;
}
+ public SampleRowsFilter getFilter() {
+ if (filter == null) {
+ prepare();
+ }
+ return filter;
+ }
+
@Override
+ public void prepare() {
+
+ filter = service.newSampleRowsFilter(getAuthenticatedWaoUser());
+
+ }
+
+ @Override
public String execute() {
- SampleRowsFilter filter = service.newSampleRowsFilter(getAuthenticatedWaoUser());
-
samplingPlan = service.getSamplingPlan(filter);
return SUCCESS;
@@ -53,12 +65,8 @@
return samplingPlan;
}
- public List<SampleRow> getSamplingPlanRows() {
- return samplingPlan.getRows();
- }
-
-
public String getSampleRowToHighlightId() {
return getSession().getSampleRowToHighlightId();
}
+
}
Modified: trunk/wao-web/src/main/resources/i18n/wao-web_en_GB.properties
===================================================================
--- trunk/wao-web/src/main/resources/i18n/wao-web_en_GB.properties 2014-03-25 17:16:52 UTC (rev 1749)
+++ trunk/wao-web/src/main/resources/i18n/wao-web_en_GB.properties 2014-03-25 17:22:15 UTC (rev 1750)
@@ -59,6 +59,7 @@
wao.ui.action.refresh=Refresh
wao.ui.action.refuseContact=Refuse contact
wao.ui.action.remove=Remove
+wao.ui.action.reset=Remettre à zéro
wao.ui.action.resetFields=Reset form
wao.ui.action.revert=Revert
wao.ui.action.runExport=Run export
Modified: trunk/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties
===================================================================
--- trunk/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties 2014-03-25 17:16:52 UTC (rev 1749)
+++ trunk/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties 2014-03-25 17:22:15 UTC (rev 1750)
@@ -59,6 +59,7 @@
wao.ui.action.refresh=Rafraîchir
wao.ui.action.refuseContact=Refuser le contact
wao.ui.action.remove=Retirer
+wao.ui.action.reset=Reset
wao.ui.action.resetFields=Remettre le formulaire à zéro
wao.ui.action.revert=Annuler
wao.ui.action.runExport=Lancer l'export
Modified: trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp
===================================================================
--- trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp 2014-03-25 17:16:52 UTC (rev 1749)
+++ trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp 2014-03-25 17:22:15 UTC (rev 1750)
@@ -33,11 +33,6 @@
<s:text name="wao.ui.page.SamplingPlan.title" />
</h1>
- <s:url action="export-sampling-plan" id="exportSamplingPlanUrl" />
- <s:a href="%{exportSamplingPlanUrl}" cssClass="btn">
- <i class="icon-download"></i> <s:text name="wao.ui.action.csvExport" />
- </s:a>
-
<s:if test="authenticatedWaoUser.authorizedToEditSamplingPlan">
<s:url action="edit-sample-row!input" id="createSampleRow" />
<s:a href="%{createSampleRow}" cssClass="btn">
@@ -45,6 +40,35 @@
</s:a>
</s:if>
+ <s:form method="GET">
+
+ <s:select name="filter.companyIds"
+ label="%{getText('wao.ui.entity.Company')}"
+ list="samplingPlan.filterValues.companies"
+ multiple="true"
+ cssClass="input-xxlarge" />
+
+ <s:select name="filter.programNames"
+ label="%{getText('wao.ui.field.SampleRow.programName')}"
+ list="samplingPlan.filterValues.programNames"
+ multiple="true"
+ cssClass="input-xxlarge" />
+
+ <s:url action="sampling-plan" id="samplingPlanUrl" />
+ <s:a href="%{samplingPlanUrl}" cssClass="btn">
+ <i class="icon-reset"></i> <s:text name="wao.ui.action.reset" />
+ </s:a>
+
+ <s:submit type="button" cssClass="btn">
+ <i class="icon-filter"></i> <s:text name="wao.ui.action.filter" />
+ </s:submit>
+
+ <s:submit action="export-sampling-plan" type="button" cssClass="btn">
+ <i class="icon-download"></i> <s:text name="wao.ui.action.csvExport" />
+ </s:submit>
+
+ </s:form>
+
<s:set var="estimatedTides" value="true"/>
<s:set var="fullView" value="true"/>
<s:set var="displayTidesReal" value="true"/>
1
0
r1749 - trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity
by tchemit@users.forge.codelutin.com 25 Mar '14
by tchemit@users.forge.codelutin.com 25 Mar '14
25 Mar '14
Author: tchemit
Date: 2014-03-25 18:16:52 +0100 (Tue, 25 Mar 2014)
New Revision: 1749
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1749
Log:
use diamonds
Modified:
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ContactImpl.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ContactState.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SampleRowImpl.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SampleRowLogImpl.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/UserRole.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/WaoUserImpl.java
Modified: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ContactImpl.java
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ContactImpl.java 2014-03-25 17:16:23 UTC (rev 1748)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ContactImpl.java 2014-03-25 17:16:52 UTC (rev 1749)
@@ -169,7 +169,7 @@
@Override
public List<WaoUser> getAllObservers() {
- List<WaoUser> allObservers = new LinkedList<WaoUser>();
+ List<WaoUser> allObservers = new LinkedList<>();
if (getMainObserver() != null) {
allObservers.add(getMainObserver());
}
Modified: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ContactState.java
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ContactState.java 2014-03-25 17:16:23 UTC (rev 1748)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ContactState.java 2014-03-25 17:16:52 UTC (rev 1749)
@@ -131,7 +131,7 @@
}
public static List<ContactState> getAllowedStates(ObsProgram obsProgram) {
- List<ContactState> allowedStates = new ArrayList<ContactState>();
+ List<ContactState> allowedStates = new ArrayList<>();
for (ContactState contactState : values()) {
if (contactState.isAllowed(obsProgram)) {
allowedStates.add(contactState);
Modified: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SampleRowImpl.java
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SampleRowImpl.java 2014-03-25 17:16:23 UTC (rev 1748)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SampleRowImpl.java 2014-03-25 17:16:52 UTC (rev 1749)
@@ -83,7 +83,7 @@
*/
@Override
public String getSectors() {
- Set<String> sectorNames = new LinkedHashSet<String>();
+ Set<String> sectorNames = new LinkedHashSet<>();
for (FishingZone fishingZone : getFishingZone()) {
sectorNames.add(fishingZone.getSectorName());
}
@@ -172,7 +172,7 @@
setdCF5Code(null);
} else {
String[] splitCodes = codes.split(separatorRegex);
- List<DCF5Code> dcfFives = new ArrayList<DCF5Code>(splitCodes.length);
+ List<DCF5Code> dcfFives = new ArrayList<>(splitCodes.length);
for (String code : splitCodes) {
String[] codeParts = code.split("_");
DCF5Code dcfFive = new DCF5CodeImpl();
Modified: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SampleRowLogImpl.java
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SampleRowLogImpl.java 2014-03-25 17:16:23 UTC (rev 1748)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SampleRowLogImpl.java 2014-03-25 17:16:52 UTC (rev 1749)
@@ -112,9 +112,9 @@
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>();
+ List<String> removedTerrestrialLocations = new ArrayList<>();
+ List<String> keptTerrestrialLocations = new ArrayList<>();
+ List<String> addedTerrestrialLocations = new ArrayList<>();
// filling the three lists
for (TerrestrialLocation oldTerrestrialLocation : oldTerrestrialLocations) {
@@ -155,9 +155,9 @@
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>();
+ List<String> removedTerrestrialLocations = new ArrayList<>();
+ List<String> keptTerrestrialLocations = new ArrayList<>();
+ List<String> addedTerrestrialLocations = new ArrayList<>();
// filling the three lists
for (TerrestrialLocation oldTerrestrialLocation : oldTerrestrialLocations) {
@@ -314,9 +314,9 @@
List<ElligibleBoat> newEligibleBoats = newRow.getElligibleBoat();
// Lists for boats by status
- List<Integer> noLongerEligibleBoats = new ArrayList<Integer>();
- List<Integer> stillEligibleBoats = new ArrayList<Integer>();
- List<Integer> newlyEligibleBoats = new ArrayList<Integer>();
+ List<Integer> noLongerEligibleBoats = new ArrayList<>();
+ List<Integer> stillEligibleBoats = new ArrayList<>();
+ List<Integer> newlyEligibleBoats = new ArrayList<>();
// filling the three lists
for (ElligibleBoat oldEligibleBoat : oldEligibleBoats) {
@@ -359,9 +359,9 @@
List<FishingZone> newFishingZones = newRow.getFishingZone();
// Lists for boats by status
- List<String> removedZones = new ArrayList<String>();
- List<String> keptZones = new ArrayList<String>();
- List<String> addedZones = new ArrayList<String>();
+ List<String> removedZones = new ArrayList<>();
+ List<String> keptZones = new ArrayList<>();
+ List<String> addedZones = new ArrayList<>();
// filling the three lists
for (FishingZone oldFishingZone : oldFishingZones) {
@@ -417,8 +417,8 @@
newObservers = Collections.emptyList();
}
- List<String> removedObservers = new LinkedList<String>();
- List<String> addedObservers = new LinkedList<String>();
+ List<String> removedObservers = new LinkedList<>();
+ List<String> addedObservers = new LinkedList<>();
for (WaoUser oldObserver : oldObservers) {
if ( ! newObservers.contains(oldObserver)) {
Modified: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/UserRole.java
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/UserRole.java 2014-03-25 17:16:23 UTC (rev 1748)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/UserRole.java 2014-03-25 17:16:52 UTC (rev 1749)
@@ -78,7 +78,7 @@
* @return roles that the user can affect
*/
public static List<UserRole> getAllowedRoles(ObsProgram obsProgram, UserRole userRole) {
- List<UserRole> allowedRoles = new ArrayList<UserRole>();
+ List<UserRole> allowedRoles = new ArrayList<>();
allowedRoles.add(UserRole.COORDINATOR);
allowedRoles.add(UserRole.OBSERVER);
if (userRole.equals(UserRole.ADMIN)) {
Modified: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/WaoUserImpl.java
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/WaoUserImpl.java 2014-03-25 17:16:23 UTC (rev 1748)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/WaoUserImpl.java 2014-03-25 17:16:52 UTC (rev 1749)
@@ -72,7 +72,7 @@
@Override
public List<UserProfile> getUserProfile(ObsProgram obsProgram) {
- List<UserProfile> userProfiles = new ArrayList<UserProfile>();
+ List<UserProfile> userProfiles = new ArrayList<>();
if (getUserProfile() != null) {
for (UserProfile userProfile : getUserProfile()) {
if (userProfile.getObsProgram().equals(obsProgram)) {
1
0
r1748 - trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity
by tchemit@users.forge.codelutin.com 25 Mar '14
by tchemit@users.forge.codelutin.com 25 Mar '14
25 Mar '14
Author: tchemit
Date: 2014-03-25 18:16:23 +0100 (Tue, 25 Mar 2014)
New Revision: 1748
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1748
Log:
fix NPE
Modified:
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ContactTopiaDao.java
Modified: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ContactTopiaDao.java
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ContactTopiaDao.java 2014-03-25 15:41:42 UTC (rev 1747)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ContactTopiaDao.java 2014-03-25 17:16:23 UTC (rev 1748)
@@ -1,7 +1,7 @@
package fr.ifremer.wao.entity;
import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Sets;
import fr.ifremer.wao.ContactsFilter;
import fr.ifremer.wao.WaoUtils;
import org.apache.commons.collections4.CollectionUtils;
@@ -104,15 +104,15 @@
}
if (filter.isCommentDefinedOnly()) {
- query.addNotIn(Contact.PROPERTY_COMMENT, ImmutableSet.of("", null));
+ query.addNotIn(Contact.PROPERTY_COMMENT, Sets.newHashSet("", null));
}
if (filter.isCommentCompanyDefinedOnly()) {
- query.addNotIn(Contact.PROPERTY_COMMENT_COORDINATOR, ImmutableSet.of("", null));
+ query.addNotIn(Contact.PROPERTY_COMMENT_COORDINATOR, Sets.newHashSet("", null));
}
if (filter.isCommentAdminDefinedOnly()) {
- query.addNotIn(Contact.PROPERTY_COMMENT_ADMIN, ImmutableSet.of("", null));
+ query.addNotIn(Contact.PROPERTY_COMMENT_ADMIN, Sets.newHashSet("", null));
}
if (CollectionUtils.isNotEmpty(filter.getCompanyAcceptations())) {
1
0
r1747 - in trunk: . wao-services/src/main/java/fr/ifremer/wao/services/service wao-web/src/main/java/fr/ifremer/wao/web wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer wao-web/src/main/resources/i18n wao-web/src/main/webapp/WEB-INF/content/obsmer
by tchemit@users.forge.codelutin.com 25 Mar '14
by tchemit@users.forge.codelutin.com 25 Mar '14
25 Mar '14
Author: tchemit
Date: 2014-03-25 16:41:42 +0100 (Tue, 25 Mar 2014)
New Revision: 1747
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1747
Log:
refs-30 #4483 (begin of ui)
Modified:
trunk/
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlan.java
trunk/wao-web/src/main/java/fr/ifremer/wao/web/WaoJspActionSupport.java
trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/SamplingPlanAction.java
trunk/wao-web/src/main/resources/i18n/wao-web_en_GB.properties
trunk/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties
trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp
Property changes on: trunk
___________________________________________________________________
Modified: svn:ignore
- *.idea
*.iml
target
+ *.idea
*.iml
target
atlassian-ide-plugin.xml
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlan.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlan.java 2014-03-25 14:26:47 UTC (rev 1746)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlan.java 2014-03-25 15:41:42 UTC (rev 1747)
@@ -21,6 +21,7 @@
* #L%
*/
+import fr.ifremer.wao.entity.FishingZone;
import fr.ifremer.wao.entity.SampleMonth;
import fr.ifremer.wao.entity.SampleRow;
@@ -341,6 +342,14 @@
return result;
}
+ public String getFishingZones() {
+ String result = "";
+ for (FishingZone zone : sampleRow.getFishingZone()) {
+ result += zone.getDistrictCode() + ", ";
+ }
+ return result.substring(0, result.length() - 2);
+ }
+
public Double getObservationTimesInDaysExpected() {
return observationTimesInDaysExpected;
}
Modified: trunk/wao-web/src/main/java/fr/ifremer/wao/web/WaoJspActionSupport.java
===================================================================
--- trunk/wao-web/src/main/java/fr/ifremer/wao/web/WaoJspActionSupport.java 2014-03-25 14:26:47 UTC (rev 1746)
+++ trunk/wao-web/src/main/java/fr/ifremer/wao/web/WaoJspActionSupport.java 2014-03-25 15:41:42 UTC (rev 1747)
@@ -24,6 +24,8 @@
import fr.ifremer.wao.entity.ObsProgram;
import fr.ifremer.wao.services.AuthenticatedWaoUser;
+import java.util.Date;
+
public class WaoJspActionSupport extends WaoActionSupport {
protected WaoSession getSession() {
@@ -58,4 +60,8 @@
return getText(enumeration.getClass().getSimpleName() + "." + enumeration.name());
}
+ public String formatMonth(Date date) {
+ return t("wao.ui.misc.month", date);
+ }
+
}
Modified: trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/SamplingPlanAction.java
===================================================================
--- trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/SamplingPlanAction.java 2014-03-25 14:26:47 UTC (rev 1746)
+++ trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/SamplingPlanAction.java 2014-03-25 15:41:42 UTC (rev 1747)
@@ -47,13 +47,17 @@
samplingPlan = service.getSamplingPlan(filter);
return SUCCESS;
+ }
+ public ObsMerSamplingPlan getSamplingPlan() {
+ return samplingPlan;
}
- public List<SampleRow> getSamplingPlan() {
+ public List<SampleRow> getSamplingPlanRows() {
return samplingPlan.getRows();
}
+
public String getSampleRowToHighlightId() {
return getSession().getSampleRowToHighlightId();
}
Modified: trunk/wao-web/src/main/resources/i18n/wao-web_en_GB.properties
===================================================================
--- trunk/wao-web/src/main/resources/i18n/wao-web_en_GB.properties 2014-03-25 14:26:47 UTC (rev 1746)
+++ trunk/wao-web/src/main/resources/i18n/wao-web_en_GB.properties 2014-03-25 15:41:42 UTC (rev 1747)
@@ -338,6 +338,7 @@
wao.ui.misc.information=Information
wao.ui.misc.infosAbout=Infos about %s
wao.ui.misc.logFile.description=Show log file for %s
+wao.ui.misc.month=%1$tm-%1$tY
wao.ui.misc.no=no
wao.ui.misc.noComment=no comment
wao.ui.misc.notValidated=Not validated
Modified: trunk/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties
===================================================================
--- trunk/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties 2014-03-25 14:26:47 UTC (rev 1746)
+++ trunk/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties 2014-03-25 15:41:42 UTC (rev 1747)
@@ -338,6 +338,7 @@
wao.ui.misc.information=Informations
wao.ui.misc.infosAbout=Informations sur %s
wao.ui.misc.logFile.description=Afficher le fichier de log de %s
+wao.ui.misc.month=%1$tm/%1$tY
wao.ui.misc.no=Non
wao.ui.misc.noComment=aucun commentaire
wao.ui.misc.notValidated=Non validé
Modified: trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp
===================================================================
--- trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp 2014-03-25 14:26:47 UTC (rev 1746)
+++ trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp 2014-03-25 15:41:42 UTC (rev 1747)
@@ -45,85 +45,236 @@
</s:a>
</s:if>
+<s:set var="estimatedTides" value="true"/>
+<s:set var="fullView" value="true"/>
+<s:set var="displayTidesReal" value="true"/>
+
+<s:set var="nbColumnsForProfession" value="%{#fullView ? 13 : 5}"/>
+<s:set var="nbColumnsForMonths" value="%{samplingPlan.months.size() + 1}"/>
+<s:set var="nbColumnsForOther" value="6"/>
+<s:set var="nbColumnsTotal" value="%{#nbColumnsForProfession + #nbColumnsForMonths + #nbColumnsForOther}"/>
+
<table class="large-table table-hover">
<thead>
- <th>
- <s:text name="wao.ui.field.SampleRow.code" />
+ <tr>
+ <th colspan="${nbColumnsForProfession}"> <s:text name="wao.ui.samplingPlan.sampledProfessions" /></th>
+ <th colspan="${nbColumnsForMonths}">
+ <s:text name="wao.ui.samplingPlan.effort" />
+
+ [ <s:text name="wao.ui.samplingPlan.expected"/> <em>
+ ( <s:text name="wao.ui.samplingPlan.actual" />
+ <s:if test="estimatedTides"> + <s:text name="wao.ui.samplingPlan.estimated" /> </s:if>)</em> ]
</th>
+ <th colspan="${nbColumnsForOther}"><s:text name="wao.ui.misc.others" /></th>
+ </tr>
+ <tr>
+ <!-- Profession columns -->
+ <td><s:text name="wao.ui.field.SampleRow.code"/></td>
+ <td><s:text name="wao.ui.samplingPlan.program"/></td>
+<s:if test="fullView">
+ <td><s:text name="wao.ui.entity.Company"/></td>
+</s:if>
+ <td><s:text name="wao.ui.entity.FishingZone"/></td>
+<s:if test="fullView">
+ <td><s:text name="wao.ui.samplingPlan.fishingZoneInfo"/></td>
+ <td><s:text name="wao.ui.misc.METIER"/> <br/> <s:text name="wao.ui.field.SampleRow.dCF5Code"/></td>
+ <td><s:text name="wao.ui.misc.METIER"/> <br/> <s:text name="wao.ui.field.SampleRow.meshSize"/></td>
+ <td><s:text name="wao.ui.misc.METIER"/> <br/> <s:text name="wao.ui.field.SampleRow.size"/></td>
+ <td><s:text name="wao.ui.misc.METIER"/> <br/> <s:text name="wao.ui.field.SampleRow.other"/></td>
+ <td><s:text name="wao.ui.misc.METIER"/> <br/> <s:text name="wao.ui.field.SampleRow.libelle"/></td>
+ <td><s:text name="wao.ui.misc.METIER"/> <br/> <s:text name="wao.ui.field.SampleRow.species"/></td>
+ <td><s:text name="wao.ui.field.SampleRow.periodBegin"/></td>
+ <td><s:text name="wao.ui.field.SampleRow.periodEnd"/></td>
+</s:if>
+<s:else>
+ <td><s:text name="wao.ui.misc.METIER"/> <br/> <s:text name="wao.ui.field.SampleRow.dCF5Code"/></td>
+ <td><s:text name="wao.ui.misc.METIER"/> <br/> <s:text name="wao.ui.field.SampleRow.libelle"/></td>
+</s:else>
+
+ <!-- Months columns -->
+ <s:iterator value="samplingPlan.months" var="month">
+ <td><s:property value="%{formatMonth(#month)}"/></td>
+ </s:iterator>
+ <td><s:text name="wao.ui.misc.total"/></td>
+ <!-- Other columns -->
+ <td>
+ <s:text name="wao.ui.samplingPlan.observationTimesInDays"/>
+ [ <s:text name="wao.ui.samplingPlan.expected"/><em>(<s:text name="wao.ui.samplingPlan.actual"/><s:if test="estimatedTides"> + <s:text name="wao.ui.samplingPlan.estimated"/></s:if>)</em> ]
+ </td>
+ <td><s:text name="wao.ui.samplingPlan.averageTideTime"/></td>
+ <td><s:text name="wao.ui.samplingPlan.nbObservants"/></td>
+ <td><s:text name="wao.ui.field.SampleRow.appliedCoverageRate"/></td>
+ <td><s:text name="wao.ui.misc.comment"/></td>
+ <td><s:text name="wao.ui.samplingPlan.actions"/></td>
+ </tr>
+ </thead>
+ <tbody>
+
+ <s:if test="fullView">
+ </s:if>
+ <s:else>
+ </s:else>
+
+<%--Iterate on Facades--%>
+<s:iterator value="samplingPlan" var="samplingPlanFacade">
+ <tr>
+ <td colspan="${nbColumnsTotal}">FACADE <s:property value="%{#samplingPlanFacade.facade}"/></td>
+ </tr>
+<%--Iterate on Sectors --%>
+<s:iterator value="samplingPlanFacade" var="samplingPlanSector">
+ <tr>
+ <td colspan="${nbColumnsTotal}">SECTOR <s:property value="%{#samplingPlanSector.sectors}"/></td>
+ </tr>
+<%--Iterate on SampleRows --%>
+<s:iterator value="samplingPlanSector" var="samplingPlanRow">
+<s:set var="sampleRow" value="%{#samplingPlanRow.sampleRow}"/>
+ <tr<s:if test="sampleRowToHighlightId.equals(#sampleRow.topiaId)"> class="highlight"</s:if>>
<th>
- <s:text name="wao.ui.actions" />
+ <s:url action="edit-sample-row!input" id="changePeriodUrl">
+ <s:param name="sampleRowId" value="sampleRow.topiaId" />
+ </s:url>
+ <s:a class="btn" href="%{changePeriodUrl}" title="Changer les dates de la période par rapport à celles de la ligne">
+ <s:property value="#sampleRow.code" />
+ </s:a>
</th>
- </thead>
- <tbody>
- <s:iterator value="samplingPlan" var="sampleRow">
- <tr<s:if test="sampleRowToHighlightId.equals(topiaId)"> class="highlight"</s:if>>
- <th>
- <s:property value="code" />
- </th>
- <td class="actions">
- <div class="dropdown">
- <a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
- <s:text name="wao.ui.actions" />
- <b class="caret"></b>
- </a>
- <ul class="dropdown-menu">
- <s:if test="authenticatedWaoUser.authorizedToEditSamplingPlan">
- <li>
- <s:url action="edit-sample-row!input" id="editSampleRowUrl">
- <s:param name="sampleRowId" value="topiaId" />
- </s:url>
- <s:a href="%{editSampleRowUrl}">
- <i class="icon-edit"></i> <s:text name="wao.ui.action.edit" />
- </s:a>
- </li>
- <li>
- <s:url action="delete-sample-row" id="deleteSampleRowUrl">
- <s:param name="companyId" value="topiaId" />
- </s:url>
- <s:a href="%{deleteSampleRowUrl}">
- <i class="icon-trash"></i> <s:text name="wao.ui.action.delete" />
- </s:a>
- </li>
- </s:if>
- <li>
- <s:url action="sample-row-log" id="sampleRowLogUrl">
- <s:param name="sampleRowId" value="topiaId" />
- </s:url>
- <s:a href="%{sampleRowLogUrl}">
- <i class="icon-time"></i> <s:text name="wao.ui.action.viewSampleRowLog" />
- </s:a>
- </li>
- <li>
- <s:url action="boats" id="viewElligibleBoatsUrl">
- <s:param name="sampleRowIds" value="topiaId" />
- </s:url>
- <s:a href="%{viewElligibleBoatsUrl}">
- <s:text name="wao.ui.action.viewElligibleBoats" />
- </s:a>
- </li>
- <li>
- <s:url action="contacts" id="viewAssociatedContactsUrl">
- <s:param name="sampleRowIds" value="topiaId" />
- </s:url>
- <s:a href="%{viewAssociatedContactsUrl}">
- <s:text name="wao.ui.action.viewAssociatedContacts" />
- </s:a>
- </li>
- <s:if test="authenticatedWaoUser.authorizedToCreateContact">
- <li>
- <s:url action="contacts" id="createAssociatedContactUrl">
- <s:param name="sampleRowIds" value="topiaId" />
- </s:url>
- <s:a href="%{createAssociatedContactUrl}">
- <i class="icon-add"></i> <s:text name="wao.ui.action.createAssociatedContact" />
- </s:a>
- </li>
- </s:if>
- </ul>
- </div>
- </td>
- </tr>
- </s:iterator>
+ <td><s:property value="#sampleRow.programName" /></td>
+<s:if test="fullView">
+ <td>CompanyName</td>
+ <td><s:property value="#samplingPlanRow.fishingZones" /></td>
+ <td><s:property value="#sampleRow.fishingZonesInfos" /></td>
+ <td>
+ <s:iterator value="sampleRow.dcf5code" var="dcf5code">
+ <span>
+ <s:property />
+ </span>
+ </s:iterator>
+ </td>
+ <td><s:property value="#sampleRow.profession.meshSize" /></td>
+ <td><s:property value="#sampleRow.profession.size" /></td>
+ <td><s:property value="#sampleRow.profession.other" /></td>
+ <td><s:property value="#sampleRow.profession.libelle" /></td>
+ <td><s:property value="#sampleRow.profession.species" /></td>
+ <td><s:property value="%{formatMonth(#sampleRow.periodBegin)}" /></td>
+ <td><s:property value="%{formatMonth(#sampleRow.periodEnd)}" /></td>
+</s:if>
+<s:else>
+ <td>FishingZones</td>
+ <td>
+ <s:iterator value="sampleRow.dcf5code" var="dcf5code">
+ <span>
+ <s:property />
+ </span>
+ </s:iterator>
+ <s:property value="#sampleRow.professionDescriptionWithoutDCF5" />
+ </td>
+</s:else>
+ <!-- Months columns -->
+<s:iterator value="samplingPlan.months" var="month">
+ <td>
+ <s:property value="%{#samplingPlanRow.getNbTidesExpected(#month)}"/>
+ <s:if test="displayTidesReal">
+ <span>
+ <em>(<s:property value="%{#samplingPlanRow.getNbTidesReal(#month)}"/>)
+ </em>
+ </span>
+ </s:if>
+ </td>
+</s:iterator>
+ <td>
+ <span>
+ <s:property value="#sampleRow.totalTidesExpected" />
+ <s:if test="!authenticatedWaoUser.guest">
+ <em>(<s:property value="#sampleRow.totalTidesReal" />)</em>
+ <br/>
+ <strong><s:property value="#samplingPlanRow.totalPercentage" /></strong>
+ </s:if>
+ </span>
+ </td>
+ <td>
+ <s:property value="#samplingPlanRow.observationTimesInDaysExpected" /> j.
+ <span>
+ <em>(<s:property value="#samplingPlanRow.observationTimesInDaysReal" /> j.)</em>
+ </span>
+ </td>
+ <td><s:property value="#sampleRow.averageTideTime" /></td>
+ <td><s:property value="#sampleRow.nbObservants" /></td>
+ <td>
+ <s:if test="sampleRow.appliedCoverageRate">
+ <s:property value="#sampleRow.appliedCoverageRate" /> %
+ </s:if>
+ </td>
+ <td><s:property value="#sampleRow.comment" /></td>
+
+ <td class="actions">
+ <div class="dropdown">
+ <a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
+ <s:text name="wao.ui.actions" />
+ <b class="caret"></b>
+ </a>
+ <ul class="dropdown-menu">
+ <s:if test="authenticatedWaoUser.authorizedToEditSamplingPlan">
+ <li>
+ <s:url action="edit-sample-row!input" id="editSampleRowUrl">
+ <s:param name="sampleRowId" value="sampleRow.topiaId" />
+ </s:url>
+ <s:a href="%{editSampleRowUrl}">
+ <i class="icon-edit"></i> <s:text name="wao.ui.action.edit" />
+ </s:a>
+ </li>
+ <li>
+ <s:url action="delete-sample-row" id="deleteSampleRowUrl">
+ <s:param name="companyId" value="sampleRow.topiaId" />
+ </s:url>
+ <s:a href="%{deleteSampleRowUrl}">
+ <i class="icon-trash"></i> <s:text name="wao.ui.action.delete" />
+ </s:a>
+ </li>
+ </s:if>
+ <li>
+ <s:url action="sample-row-log" id="sampleRowLogUrl">
+ <s:param name="sampleRowId" value="sampleRow.topiaId" />
+ </s:url>
+ <s:a href="%{sampleRowLogUrl}">
+ <i class="icon-time"></i> <s:text name="wao.ui.action.viewSampleRowLog" />
+ </s:a>
+ </li>
+ <li>
+ <s:url action="boats" id="viewElligibleBoatsUrl">
+ <s:param name="sampleRowIds" value="sampleRow.topiaId" />
+ </s:url>
+ <s:a href="%{viewElligibleBoatsUrl}">
+ <s:text name="wao.ui.action.viewElligibleBoats" />
+ </s:a>
+ </li>
+ <li>
+ <s:url action="contacts" id="viewAssociatedContactsUrl">
+ <s:param name="sampleRowIds" value="sampleRow.topiaId" />
+ </s:url>
+ <s:a href="%{viewAssociatedContactsUrl}">
+ <s:text name="wao.ui.action.viewAssociatedContacts" />
+ </s:a>
+ </li>
+ <s:if test="authenticatedWaoUser.authorizedToCreateContact">
+ <li>
+ <s:url action="contacts" id="createAssociatedContactUrl">
+ <s:param name="sampleRowIds" value="sampleRow.topiaId" />
+ </s:url>
+ <s:a href="%{createAssociatedContactUrl}">
+ <i class="icon-add"></i> <s:text name="wao.ui.action.createAssociatedContact" />
+ </s:a>
+ </li>
+ </s:if>
+ </ul>
+ </div>
+ </td>
+ </tr>
+<%--Iterate on SampleRows --%>
+</s:iterator>
+<%--Iterate on Sectors --%>
+</s:iterator>
+<%--Iterate on Facades--%>
+</s:iterator>
+
</todby>
<tfoot>
1
0
r1746 - trunk/wao-services/src/main/java/fr/ifremer/wao/services/service
by tchemit@users.forge.codelutin.com 25 Mar '14
by tchemit@users.forge.codelutin.com 25 Mar '14
25 Mar '14
Author: tchemit
Date: 2014-03-25 15:26:47 +0100 (Tue, 25 Mar 2014)
New Revision: 1746
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1746
Log:
refs #4483 (add estimated, expected and real values)
Modified:
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlan.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanBuilder.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanService.java
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlan.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlan.java 2014-03-25 14:18:40 UTC (rev 1745)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlan.java 2014-03-25 14:26:47 UTC (rev 1746)
@@ -49,18 +49,24 @@
protected Map<Date, ObsMerSamplingPlanStatistics> statisticsMap;
/**
- * Total of observation times in days planned.
+ * Total of observation times in days expected.
* FIXME Voir si on doit garder un *D*ouble
*/
- protected Double observationTimesInDaysTotalPlanned;
+ protected Double observationTimesInDaysTotalExpected;
/**
- * Total of observation times in days actual.
+ * Total of observation times in days real.
* FIXME Voir si on doit garder un *L*ong
*/
- protected Long observationTimesInDaysTotalActual;
+ protected Long observationTimesInDaysTotalReal;
/**
+ * Total of observation times in days estimated.
+ * FIXME Voir si on doit garder un *L*ong
+ */
+ protected Long observationTimesInDaysTotalEstimated;
+
+ /**
* ?
* FIXME Voir si on doit garder un *I*integer
*/
@@ -73,6 +79,12 @@
protected Integer highTotalReal;
/**
+ * ?
+ * FIXME Voir si on doit garder un *I*integer
+ */
+ protected Integer highTotalEstimated;
+
+ /**
* List of month used by sample rows.
*/
protected List<Date> months;
@@ -82,15 +94,19 @@
Map<Date, ObsMerSamplingPlanStatistics> statisticsMap,
Integer highTotalExpected,
Integer highTotalReal,
- Double observationTimesInDaysTotalPlanned,
- Long observationTimesInDaysTotalActual) {
+ Integer highTotalEstimated,
+ Double observationTimesInDaysTotalExpected,
+ Long observationTimesInDaysTotalReal,
+ Long observationTimesInDaysTotalEstimated) {
this.months = months;
this.facades = facadeParts;
this.statisticsMap = statisticsMap;
- this.observationTimesInDaysTotalPlanned = observationTimesInDaysTotalPlanned;
- this.observationTimesInDaysTotalActual = observationTimesInDaysTotalActual;
+ this.observationTimesInDaysTotalExpected = observationTimesInDaysTotalExpected;
+ this.observationTimesInDaysTotalReal = observationTimesInDaysTotalReal;
this.highTotalExpected = highTotalExpected;
this.highTotalReal = highTotalReal;
+ this.highTotalEstimated = highTotalEstimated;
+ this.observationTimesInDaysTotalEstimated = observationTimesInDaysTotalEstimated;
}
//FIXME Remove this
@@ -115,14 +131,18 @@
return months;
}
- public Double getObservationTimesInDaysTotalPlanned() {
- return observationTimesInDaysTotalPlanned;
+ public Double getObservationTimesInDaysTotalExpected() {
+ return observationTimesInDaysTotalExpected;
}
- public Long getObservationTimesInDaysTotalActual() {
- return observationTimesInDaysTotalActual;
+ public Long getObservationTimesInDaysTotalReal() {
+ return observationTimesInDaysTotalReal;
}
+ public Long getObservationTimesInDaysTotalEstimated() {
+ return observationTimesInDaysTotalEstimated;
+ }
+
public Integer getTotalExpectedForMonth(Date month) {
Integer result = statisticsMap.get(month).getTotalExpected();
return result;
@@ -133,6 +153,12 @@
return result;
}
+ public Integer getTotalEstimatedForMonth(Date month) {
+ Integer result = statisticsMap.get(month).getTotalEstimated();
+ return result;
+ }
+
+ //TODO Move this in UI?
public String getRatioForMonth(Date month) {
String result = statisticsMap.get(month).getRatioForMonth();
return result;
@@ -146,6 +172,11 @@
return highTotalReal;
}
+ public Integer getHighTotalEstimated() {
+ return highTotalEstimated;
+ }
+
+ //TODO Move this in UI?
public String getHighTotalRatio() {
String ratio = "";
if (highTotalExpected > 0) {
@@ -236,26 +267,35 @@
protected SampleRow sampleRow;
/**
- * Times of observation days planned.
+ * Expected Times of observation days.
* <p/>
* FIXME Voir si on doit garder un *D*ouble
*/
- protected Double observationTimesInDaysPlanned;
+ protected Double observationTimesInDaysExpected;
/**
- * Actual times of observation in days.
+ * Real times of observation in days.
* <p/>
- * FIXME Voir si on doit garder un *D*ouble
+ * FIXME Voir si on doit garder un *L*long
*/
- protected Long observationTimesInDaysActual;
+ protected Long observationTimesInDaysReal;
+ /**
+ * Estimated times of observation in days.
+ * <p/>
+ * FIXME Voir si on doit garder un *L*long
+ */
+ protected Long observationTimesInDaysEstimated;
+
public ObsMerSamplingPlanSampleRowPart(SampleRow sampleRow,
- Double observationTimesInDaysPlanned,
- Long observationTimesInDaysActual) {
+ Double observationTimesInDaysExpected,
+ Long observationTimesInDaysReal,
+ Long observationTimesInDaysEstimated) {
this.sampleRow = sampleRow;
- this.observationTimesInDaysPlanned = observationTimesInDaysPlanned;
- this.observationTimesInDaysActual = observationTimesInDaysActual;
+ this.observationTimesInDaysExpected = observationTimesInDaysExpected;
+ this.observationTimesInDaysReal = observationTimesInDaysReal;
+ this.observationTimesInDaysEstimated = observationTimesInDaysEstimated;
}
public SampleRow getSampleRow() {
@@ -271,18 +311,24 @@
return result;
}
- public Integer getNbTidesReal(Date month, boolean estimatedTides) {
+ public Integer getNbTidesReal(Date month) {
Integer result = null;
SampleMonth sampleMonth = sampleRow.getSampleMonth(month);
if (sampleMonth != null) {
- // result = getFilter().getEstimatedTides() ?
- result = estimatedTides ?
- sampleMonth.getEstimatedTidesValue() :
- sampleMonth.getRealTidesValue();
+ result = sampleMonth.getRealTidesValue();
}
return result;
}
+ public Integer getNbTidesEstimated(Date month) {
+ Integer result = null;
+ SampleMonth sampleMonth = sampleRow.getSampleMonth(month);
+ if (sampleMonth != null) {
+ result = sampleMonth.getEstimatedTidesValue();
+ }
+ return result;
+ }
+
//FIXME Move this in ui ?
public String getTotalPercentage() {
String result;
@@ -295,20 +341,30 @@
return result;
}
- public Double getObservationTimesInDaysPlanned() {
- return observationTimesInDaysPlanned;
+ public Double getObservationTimesInDaysExpected() {
+ return observationTimesInDaysExpected;
}
- public Long getObservationTimesInDaysActual() {
- return observationTimesInDaysActual;
+ public Long getObservationTimesInDaysReal() {
+ return observationTimesInDaysReal;
}
- public boolean hasNbTidesReal(Date month, boolean estimatedTides) {
+ public Long getObservationTimesInDaysEstimated() {
+ return observationTimesInDaysEstimated;
+ }
+
+ public boolean hasNbTidesReal(Date month) {
Date current = new Date();
boolean validMonth = month.before(current) || isCurrentMonth(month);
- return validMonth && getNbTidesReal(month, estimatedTides) != null;
+ return validMonth && getNbTidesReal(month) != null;
}
+ public boolean hasNbTidesEstimated(Date month) {
+ Date current = new Date();
+ boolean validMonth = month.before(current) || isCurrentMonth(month);
+ return validMonth && getNbTidesEstimated(month) != null;
+ }
+
public boolean isCurrentMonth(Date month) {
String currentStr = dateFormat.format(new Date());
String monthStr = dateFormat.format(month);
@@ -334,9 +390,19 @@
*/
protected Integer totalReal;
- public ObsMerSamplingPlanStatistics(Integer totalExpected, Integer totalReal) {
+ /**
+ * Total of estimated tides.
+ * <p/>
+ * FIXME Voir si on doit garder un *I*nteger
+ */
+ protected Integer totalEstimated;
+
+ public ObsMerSamplingPlanStatistics(Integer totalExpected,
+ Integer totalReal,
+ Integer totalEstimated) {
this.totalExpected = totalExpected;
this.totalReal = totalReal;
+ this.totalEstimated = totalEstimated;
}
public Integer getTotalExpected() {
@@ -347,6 +413,10 @@
return totalReal;
}
+ public Integer getTotalEstimated() {
+ return totalEstimated;
+ }
+
//FIXME Move this in ui ?
public String getRatioForMonth() {
String ratio = "-";
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanBuilder.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanBuilder.java 2014-03-25 14:18:40 UTC (rev 1745)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanBuilder.java 2014-03-25 14:26:47 UTC (rev 1746)
@@ -76,18 +76,32 @@
protected MutableInt highTotalReal;
/**
- * To compute the total of planned observation times in days.
+ * To compute the high total estimated.
*
- * @see ObsMerSamplingPlan#observationTimesInDaysTotalPlanned
+ * @see ObsMerSamplingPlan#highTotalEstimated
*/
- protected MutableDouble observationTimesInDaysTotalPlanned;
+ protected MutableInt highTotalEstimated;
/**
+ * To compute the total of expected observation times in days.
+ *
+ * @see ObsMerSamplingPlan#observationTimesInDaysTotalExpected
+ */
+ protected MutableDouble observationTimesInDaysTotalExpected;
+
+ /**
+ * To compute the total of estimated observation times in days.
+ *
+ * @see ObsMerSamplingPlan#observationTimesInDaysTotalEstimated
+ */
+ protected MutableLong observationTimesInDaysTotalEstimated;
+
+ /**
* To compute the total of actual observation times in days.
*
- * @see ObsMerSamplingPlan#observationTimesInDaysTotalActual
+ * @see ObsMerSamplingPlan#observationTimesInDaysTotalReal
*/
- protected MutableLong observationTimesInDaysTotalActual;
+ protected MutableLong observationTimesInDaysTotalReal;
/**
* To compute by month the total of expected tides.
@@ -97,6 +111,13 @@
protected Map<Date, MutableInt> totalExpectedForMonths;
/**
+ * To compute by month the total of expected tides.
+ *
+ * @see ObsMerSamplingPlan.ObsMerSamplingPlanStatistics#totalEstimated
+ */
+ protected Map<Date, MutableInt> totalEstimatedForMonths;
+
+ /**
* To compute by month the total of real tides.
*
* @see ObsMerSamplingPlan.ObsMerSamplingPlanStatistics#totalReal
@@ -108,10 +129,13 @@
this.facadeMap = new LinkedHashMap<>();
this.highTotalExpected = new MutableInt();
this.highTotalReal = new MutableInt();
- this.observationTimesInDaysTotalPlanned = new MutableDouble();
- this.observationTimesInDaysTotalActual = new MutableLong();
+ this.highTotalEstimated = new MutableInt();
+ this.observationTimesInDaysTotalExpected = new MutableDouble();
+ this.observationTimesInDaysTotalReal = new MutableLong();
+ this.observationTimesInDaysTotalEstimated = new MutableLong();
this.totalExpectedForMonths = new TreeMap<>();
this.totalRealForMonths = new TreeMap<>();
+ this.totalEstimatedForMonths = new TreeMap<>();
PeriodDates periodDates = new PeriodDates(sampleRowsFilter.getPeriodFrom(),
sampleRowsFilter.getPeriodTo());
@@ -119,8 +143,9 @@
}
public ObsMerSamplingPlanBuilder addSampleRow(SampleRow sampleRow,
- Double observationTimesInDaysPlanned,
- Long observationTimesInDaysActual) {
+ Double observationTimesInDaysExpected,
+ Long observationTimesInDaysReal,
+ Long observationTimesInDaysEstimated) {
String facade = sampleRow.getFacade();
FacadeContext facadeContext = facadeMap.get(facade);
@@ -140,15 +165,17 @@
// add sample row
ObsMerSamplingPlan.ObsMerSamplingPlanSampleRowPart sampleRowPart =
sectorPart.addSampleRow(sampleRow,
- observationTimesInDaysPlanned,
- observationTimesInDaysActual);
+ observationTimesInDaysExpected,
+ observationTimesInDaysReal,
+ observationTimesInDaysEstimated);
// update totals
updateTotals(sampleRowPart);
// Sum total observation times in days
- observationTimesInDaysTotalPlanned.add(observationTimesInDaysPlanned);
- observationTimesInDaysTotalActual.add(observationTimesInDaysActual);
+ observationTimesInDaysTotalExpected.add(observationTimesInDaysExpected);
+ observationTimesInDaysTotalReal.add(observationTimesInDaysReal);
+ observationTimesInDaysTotalEstimated.add(observationTimesInDaysEstimated);
return this;
}
@@ -166,9 +193,11 @@
MutableInt totalExpected = totalExpectedForMonths.get(month);
MutableInt totalReal = totalRealForMonths.get(month);
+ MutableInt totalEstimated= totalEstimatedForMonths.get(month);
ObsMerSamplingPlan.ObsMerSamplingPlanStatistics planStatistics =
new ObsMerSamplingPlan.ObsMerSamplingPlanStatistics(totalExpected == null ? null : totalExpected.toInteger(),
- totalReal == null ? null : totalReal.toInteger());
+ totalReal == null ? null : totalReal.toInteger(),
+ totalEstimated == null ? null : totalEstimated.toInteger());
statisticsMap.put(month, planStatistics);
}
@@ -177,8 +206,10 @@
statisticsMap,
highTotalExpected.toInteger(),
highTotalReal.toInteger(),
- observationTimesInDaysTotalPlanned.toDouble(),
- observationTimesInDaysTotalActual.toLong());
+ highTotalEstimated.toInteger(),
+ observationTimesInDaysTotalExpected.toDouble(),
+ observationTimesInDaysTotalReal.toLong(),
+ observationTimesInDaysTotalEstimated.toLong());
return result;
}
@@ -186,27 +217,39 @@
for (Date month : months) {
Integer expected = sampleRowPart.getNbTidesExpected(month);
- Integer real = sampleRowPart.getNbTidesReal(month, sampleRowsFilter.isEstimatedTides());
+ Integer real = sampleRowPart.getNbTidesReal(month);
+ Integer estimated = sampleRowPart.getNbTidesEstimated(month);
if (expected != null) {
- MutableInt totalExpected = totalExpectedForMonths.get(month);
- if (totalExpected == null) {
- totalExpected = new MutableInt();
- totalExpectedForMonths.put(month, totalExpected);
+ MutableInt total = totalExpectedForMonths.get(month);
+ if (total == null) {
+ total = new MutableInt();
+ totalExpectedForMonths.put(month, total);
}
- totalExpected.add(expected);
- highTotalExpected.add(totalExpected);
+ total.add(expected);
+ highTotalExpected.add(total);
}
+ if (estimated != null) {
+
+ MutableInt total = totalEstimatedForMonths.get(month);
+ if (total == null) {
+ total = new MutableInt();
+ totalEstimatedForMonths.put(month, total);
+ }
+ total.add(expected);
+ highTotalEstimated.add(total);
+ }
+
if (real != null) {
- MutableInt totalReal = totalRealForMonths.get(month);
- if (totalReal == null) {
- totalReal = new MutableInt();
- totalRealForMonths.put(month, totalReal);
+ MutableInt total = totalRealForMonths.get(month);
+ if (total == null) {
+ total = new MutableInt();
+ totalRealForMonths.put(month, total);
}
- totalReal.add(real);
- highTotalReal.add(totalReal);
+ total.add(real);
+ highTotalReal.add(total);
}
}
}
@@ -258,13 +301,15 @@
}
protected ObsMerSamplingPlan.ObsMerSamplingPlanSampleRowPart addSampleRow(SampleRow row,
- Double observationTimesInDaysPlanned,
- Long observationTimesInDaysActual) {
+ Double observationTimesInDaysExpected,
+ Long observationTimesInDaysReal,
+ Long observationTimesInDaysEstimated) {
ObsMerSamplingPlan.ObsMerSamplingPlanSampleRowPart rowPart =
new ObsMerSamplingPlan.ObsMerSamplingPlanSampleRowPart(row,
- observationTimesInDaysPlanned,
- observationTimesInDaysActual);
+ observationTimesInDaysExpected,
+ observationTimesInDaysReal,
+ observationTimesInDaysEstimated);
rows.add(rowPart);
return rowPart;
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanService.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanService.java 2014-03-25 14:18:40 UTC (rev 1745)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanService.java 2014-03-25 14:26:47 UTC (rev 1746)
@@ -374,11 +374,13 @@
ObsMerSamplingPlanBuilder builder = new ObsMerSamplingPlanBuilder(sampleRowsFilter);
for (SampleRow sampleRow : sampleRows) {
//TODO Compute see ServiceSamplingImpl#executeGetObservationTimesInDays
- Double observationTimesInDaysPlanned = 0d;
- Long observationTimesInDaysActual = 0l;
+ Double observationTimesInDaysExpected = 0d;
+ Long observationTimesInDaysReal = 0l;
+ Long observationTimesInDaysEstimated = 0l;
builder.addSampleRow(sampleRow,
- observationTimesInDaysPlanned,
- observationTimesInDaysActual);
+ observationTimesInDaysExpected,
+ observationTimesInDaysReal,
+ observationTimesInDaysEstimated);
}
ObsMerSamplingPlan result = builder.toPlan();
1
0