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
March 2014
- 3 participants
- 90 discussions
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
r1745 - 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-services/src/test/java/fr/ifremer/wao/services/service
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 15:18:40 +0100 (Tue, 25 Mar 2014)
New Revision: 1745
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1745
Log:
refs #4487 introduce contact filter api
Added:
trunk/wao-persistence/src/main/java/fr/ifremer/wao/ContactsFilter.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ContactTopiaDao.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerContactsService.java
trunk/wao-services/src/test/java/fr/ifremer/wao/services/service/ObsMerContactsServiceTest.java
Added: trunk/wao-persistence/src/main/java/fr/ifremer/wao/ContactsFilter.java
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/ContactsFilter.java (rev 0)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/ContactsFilter.java 2014-03-25 14:18:40 UTC (rev 1745)
@@ -0,0 +1,227 @@
+package fr.ifremer.wao;
+
+import fr.ifremer.wao.entity.ContactState;
+import fr.ifremer.wao.entity.DataReliability;
+import fr.ifremer.wao.entity.ObservationType;
+import fr.ifremer.wao.entity.ObservedDataControl;
+import fr.ifremer.wao.entity.SamplingStrategy;
+
+import java.util.Date;
+import java.util.Set;
+
+public class ContactsFilter {
+
+ protected SampleRowsFilter sampleRowFilter;
+
+ protected Date periodFrom;
+
+ protected Date periodTo;
+
+ protected Set<ContactState> contactStates;
+
+ protected Set<DataReliability> dataReliabilities;
+
+ protected Set<SamplingStrategy> actualSamplingStrategies;
+
+ protected Set<ObservationType> observationTypes;
+
+ protected Set<ObservedDataControl> observedDataControls;
+
+ protected Set<String> observerIds;
+
+ protected Set<String> terrestrialLocationIds;
+
+ protected Set<String> contactStateMotiveIds;
+
+ protected boolean mammalsCaptureOnly;
+
+ protected boolean mammalsObservationOnly;
+
+ protected boolean commentDefinedOnly;
+
+ protected boolean commentAdminDefinedOnly;
+
+ protected boolean commentCompanyDefinedOnly;
+
+ protected Set<Boolean> companyAcceptations;
+
+ protected Set<Boolean> programAcceptations;
+
+ protected Set<Boolean> completeSamplings;
+
+ protected boolean filterOnObservationBeginDate;
+
+ protected boolean sortedByBoardingDate;
+
+ public ContactsFilter() {
+ sampleRowFilter = new SampleRowsFilter();
+ }
+
+ public SampleRowsFilter getSampleRowFilter() {
+ return sampleRowFilter;
+ }
+
+ public void setSampleRowFilter(SampleRowsFilter sampleRowFilter) {
+ this.sampleRowFilter = sampleRowFilter;
+ }
+
+ public Date getPeriodFrom() {
+ return periodFrom;
+ }
+
+ public void setPeriodFrom(Date periodFrom) {
+ this.periodFrom = periodFrom;
+ }
+
+ public Date getPeriodTo() {
+ return periodTo;
+ }
+
+ public void setPeriodTo(Date periodTo) {
+ this.periodTo = periodTo;
+ }
+
+ public Set<ContactState> getContactStates() {
+ return contactStates;
+ }
+
+ public void setContactStates(Set<ContactState> contactStates) {
+ this.contactStates = contactStates;
+ }
+
+ public Set<DataReliability> getDataReliabilities() {
+ return dataReliabilities;
+ }
+
+ public void setDataReliabilities(Set<DataReliability> dataReliabilities) {
+ this.dataReliabilities = dataReliabilities;
+ }
+
+ public Set<SamplingStrategy> getActualSamplingStrategies() {
+ return actualSamplingStrategies;
+ }
+
+ public void setActualSamplingStrategies(Set<SamplingStrategy> actualSamplingStrategies) {
+ this.actualSamplingStrategies = actualSamplingStrategies;
+ }
+
+ public Set<ObservationType> getObservationTypes() {
+ return observationTypes;
+ }
+
+ public void setObservationTypes(Set<ObservationType> observationTypes) {
+ this.observationTypes = observationTypes;
+ }
+
+ public Set<ObservedDataControl> getObservedDataControls() {
+ return observedDataControls;
+ }
+
+ public void setObservedDataControls(Set<ObservedDataControl> observedDataControls) {
+ this.observedDataControls = observedDataControls;
+ }
+
+ public Set<String> getObserverIds() {
+ return observerIds;
+ }
+
+ public void setObserverIds(Set<String> observerIds) {
+ this.observerIds = observerIds;
+ }
+
+ public Set<String> getTerrestrialLocationIds() {
+ return terrestrialLocationIds;
+ }
+
+ public void setTerrestrialLocationIds(Set<String> terrestrialLocationIds) {
+ this.terrestrialLocationIds = terrestrialLocationIds;
+ }
+
+ public Set<String> getContactStateMotiveIds() {
+ return contactStateMotiveIds;
+ }
+
+ public void setContactStateMotiveIds(Set<String> contactStateMotiveIds) {
+ this.contactStateMotiveIds = contactStateMotiveIds;
+ }
+
+ public boolean isMammalsCaptureOnly() {
+ return mammalsCaptureOnly;
+ }
+
+ public void setMammalsCaptureOnly(boolean mammalsCaptureOnly) {
+ this.mammalsCaptureOnly = mammalsCaptureOnly;
+ }
+
+ public boolean isMammalsObservationOnly() {
+ return mammalsObservationOnly;
+ }
+
+ public void setMammalsObservationOnly(boolean mammalsObservationOnly) {
+ this.mammalsObservationOnly = mammalsObservationOnly;
+ }
+
+ public boolean isCommentDefinedOnly() {
+ return commentDefinedOnly;
+ }
+
+ public void setCommentDefinedOnly(boolean commentDefinedOnly) {
+ this.commentDefinedOnly = commentDefinedOnly;
+ }
+
+ public boolean isCommentAdminDefinedOnly() {
+ return commentAdminDefinedOnly;
+ }
+
+ public void setCommentAdminDefinedOnly(boolean commentAdminDefinedOnly) {
+ this.commentAdminDefinedOnly = commentAdminDefinedOnly;
+ }
+
+ public boolean isCommentCompanyDefinedOnly() {
+ return commentCompanyDefinedOnly;
+ }
+
+ public void setCommentCompanyDefinedOnly(boolean commentCompanyDefinedOnly) {
+ this.commentCompanyDefinedOnly = commentCompanyDefinedOnly;
+ }
+
+ public Set<Boolean> getCompanyAcceptations() {
+ return companyAcceptations;
+ }
+
+ public void setCompanyAcceptations(Set<Boolean> companyAcceptations) {
+ this.companyAcceptations = companyAcceptations;
+ }
+
+ public Set<Boolean> getProgramAcceptations() {
+ return programAcceptations;
+ }
+
+ public void setProgramAcceptations(Set<Boolean> programAcceptations) {
+ this.programAcceptations = programAcceptations;
+ }
+
+ public Set<Boolean> getCompleteSamplings() {
+ return completeSamplings;
+ }
+
+ public void setCompleteSamplings(Set<Boolean> completeSamplings) {
+ this.completeSamplings = completeSamplings;
+ }
+
+ public boolean isFilterOnObservationBeginDate() {
+ return filterOnObservationBeginDate;
+ }
+
+ public void setFilterOnObservationBeginDate(boolean filterOnObservationBeginDate) {
+ this.filterOnObservationBeginDate = filterOnObservationBeginDate;
+ }
+
+ public boolean isSortedByBoardingDate() {
+ return sortedByBoardingDate;
+ }
+
+ public void setSortedByBoardingDate(boolean sortedByBoardingDate) {
+ this.sortedByBoardingDate = sortedByBoardingDate;
+ }
+}
Added: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ContactTopiaDao.java
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ContactTopiaDao.java (rev 0)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ContactTopiaDao.java 2014-03-25 14:18:40 UTC (rev 1745)
@@ -0,0 +1,138 @@
+package fr.ifremer.wao.entity;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import fr.ifremer.wao.ContactsFilter;
+import fr.ifremer.wao.WaoUtils;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.topia.persistence.HqlAndParametersBuilder;
+
+import java.util.Collection;
+import java.util.List;
+
+public class ContactTopiaDao extends AbstractContactTopiaDao<Contact> {
+
+ private static final Log log = LogFactory.getLog(ContactTopiaDao.class);
+
+ public List<Contact> findAll(ContactsFilter filter) {
+
+ HqlAndParametersBuilder<Contact> query = toSampleRowHqlAndParametersBuilder(filter);
+
+ if (filter.isSortedByBoardingDate()) {
+ query.setOrderByArguments(Contact.PROPERTY_OBSERVATION_BEGIN_DATE);
+ } else {
+ query.setOrderByArguments(Contact.PROPERTY_CREATION_DATE);
+ }
+
+ List<Contact> all = findAll(query.getHql(), query.getHqlParameters());
+
+ return all;
+
+ }
+
+ protected HqlAndParametersBuilder<Contact> toSampleRowHqlAndParametersBuilder(ContactsFilter filter) {
+
+ HqlAndParametersBuilder<Contact> query = newHqlAndParametersBuilder();
+
+ query.setAlias("c");
+
+ SampleRowTopiaDao sampleRowTopiaDao =
+ topiaDaoSupplier.getDao(SampleRow.class, SampleRowTopiaDao.class);
+ HqlAndParametersBuilder<SampleRow> sampleRowsQuery =
+ sampleRowTopiaDao.toSampleRowHqlAndParametersBuilder(
+ filter.getSampleRowFilter()
+ );
+ query.addWhereClause(
+ "c.sampleRow.topiaId in (select sr.topiaId " + sampleRowsQuery.getHql() + ")",
+ sampleRowsQuery.getHqlParameters());
+
+ String periodProperty;
+ if (filter.isFilterOnObservationBeginDate()) {
+ periodProperty = Contact.PROPERTY_OBSERVATION_BEGIN_DATE;
+ } else {
+ periodProperty = Contact.PROPERTY_CREATION_DATE;
+ }
+
+ if (filter.getPeriodFrom() != null) {
+ query.addWhereClause("c." + periodProperty + " >= :periodFrom", ImmutableMap.of("periodFrom", (Object) filter.getPeriodFrom()));
+ }
+
+ if (filter.getPeriodTo() != null) {
+ query.addWhereClause("c." + periodProperty + " <= :periodTo", ImmutableMap.of("periodTo", (Object) filter.getPeriodTo()));
+ }
+
+ if (CollectionUtils.isNotEmpty(filter.getContactStates())) {
+ Collection<Integer> contactStateOrdinals = WaoUtils.toOrdinals(filter.getContactStates());
+ query.addIn(Contact.PROPERTY_STATE, contactStateOrdinals);
+ }
+
+ if (CollectionUtils.isNotEmpty(filter.getDataReliabilities())) {
+ Collection<Integer> dataReliabilityOrdinals = WaoUtils.toOrdinals(filter.getDataReliabilities());
+ query.addIn(Contact.PROPERTY_DATA_RELIABILITY_ORDINAL, dataReliabilityOrdinals);
+ }
+
+ if (CollectionUtils.isNotEmpty(filter.getActualSamplingStrategies())) {
+ Collection<Integer> actualSamplingStrategyOrdinals = WaoUtils.toOrdinals(filter.getActualSamplingStrategies());
+ query.addIn(Contact.PROPERTY_SAMPLING_STRATEGY_ORDINAL, actualSamplingStrategyOrdinals);
+ }
+
+ if (CollectionUtils.isNotEmpty(filter.getObservedDataControls())) {
+ query.addIn(Contact.PROPERTY_OBSERVED_DATA_CONTROL, filter.getObservedDataControls());
+ }
+
+ if (CollectionUtils.isNotEmpty(filter.getTerrestrialLocationIds())) {
+ query.addTopiaIdIn(Contact.PROPERTY_TERRESTRIAL_LOCATION, filter.getTerrestrialLocationIds());
+ }
+
+ if (CollectionUtils.isNotEmpty(filter.getContactStateMotiveIds())) {
+ query.addTopiaIdIn(Contact.PROPERTY_CONTACT_STATE_MOTIF, filter.getContactStateMotiveIds());
+ }
+
+ if (CollectionUtils.isNotEmpty(filter.getObserverIds())) {
+ String hql = "c.mainObserver.topiaId in (:observerIds) or c.topiaId in (select c2.topiaId from fr.ifremer.wao.entity.ContactImpl as c2 join c2.secondaryObservers as observer where observer.topiaId in (:observerIds))";
+ query.addWhereClause(hql, ImmutableMap.of("observerIds", (Object) filter.getObserverIds()));
+ }
+
+ if (filter.isMammalsObservationOnly()) {
+ query.addEquals(Contact.PROPERTY_MAMMALS_OBSERVATION, true);
+ }
+
+ if (filter.isMammalsCaptureOnly()) {
+ query.addEquals(Contact.PROPERTY_MAMMALS_CAPTURE, true);
+ }
+
+ if (filter.isCommentDefinedOnly()) {
+ query.addNotIn(Contact.PROPERTY_COMMENT, ImmutableSet.of("", null));
+ }
+
+ if (filter.isCommentCompanyDefinedOnly()) {
+ query.addNotIn(Contact.PROPERTY_COMMENT_COORDINATOR, ImmutableSet.of("", null));
+ }
+
+ if (filter.isCommentAdminDefinedOnly()) {
+ query.addNotIn(Contact.PROPERTY_COMMENT_ADMIN, ImmutableSet.of("", null));
+ }
+
+ if (CollectionUtils.isNotEmpty(filter.getCompanyAcceptations())) {
+ query.addIn(Contact.PROPERTY_VALIDATION_COMPANY, filter.getCompanyAcceptations());
+ }
+
+ if (CollectionUtils.isNotEmpty(filter.getProgramAcceptations())) {
+ query.addIn(Contact.PROPERTY_VALIDATION_PROGRAM, filter.getProgramAcceptations());
+ }
+
+ if (CollectionUtils.isNotEmpty(filter.getCompleteSamplings())) {
+ query.addIn(Contact.PROPERTY_COMPLETE_SAMPLING, filter.getCompleteSamplings());
+ }
+
+ if (log.isTraceEnabled()) {
+ log.trace("query to filter contacts " + query.getHql() + " " + query.getHqlParameters());
+ }
+
+ return query;
+
+ }
+
+}
Added: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerContactsService.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerContactsService.java (rev 0)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerContactsService.java 2014-03-25 14:18:40 UTC (rev 1745)
@@ -0,0 +1,70 @@
+package fr.ifremer.wao.services.service;
+
+import com.google.common.collect.ImmutableSet;
+import fr.ifremer.wao.ContactsFilter;
+import fr.ifremer.wao.entity.Boat;
+import fr.ifremer.wao.entity.Contact;
+import fr.ifremer.wao.services.AuthenticatedWaoUser;
+import org.apache.commons.lang3.time.DateUtils;
+
+import java.util.Calendar;
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+
+public class ObsMerContactsService extends WaoServiceSupport {
+
+ public List<Contact> findAll(ContactsFilter filter) {
+
+ List<Contact> all = getContactDao().findAll(filter);
+
+ return all;
+
+ }
+
+ public ContactsFilter newContactFilter(AuthenticatedWaoUser authenticatedWaoUser) {
+
+ ContactsFilter newContactsFilter = new ContactsFilter();
+
+ newContactsFilter.getSampleRowFilter().setObsProgram(authenticatedWaoUser.getObsProgram());
+
+ // DO NOT REMOVE THIS
+ if (authenticatedWaoUser.isCoordinatorOrObserver()) {
+ String authenticatedWaoUserCompanyTopiaId = authenticatedWaoUser.getWaoUser().getCompany().getTopiaId();
+ newContactsFilter.getSampleRowFilter().setCompanyIds(ImmutableSet.of(authenticatedWaoUserCompanyTopiaId));
+ }
+
+ Calendar periodFromCalendar = Calendar.getInstance();
+ periodFromCalendar.setTime(serviceContext.getNow());
+
+ // in the firsts months of a new year go from now to 6 months before
+ // in the rest of the year, just start at the beginning of the current year
+ if (periodFromCalendar.get(Calendar.MONTH) < 3) {
+ periodFromCalendar.add(Calendar.MONTH, -6);
+ } else {
+ periodFromCalendar.set(Calendar.DAY_OF_YEAR, 1);
+ }
+
+ Date periodFrom = periodFromCalendar.getTime();
+ Date periodTo = DateUtils.addYears(periodFromCalendar.getTime(), 1);
+
+ newContactsFilter.setPeriodFrom(periodFrom);
+ newContactsFilter.setPeriodTo(periodTo);
+
+ if (authenticatedWaoUser.isProfessional()) {
+ // Pour le profesionnel, on restreint d'office à la liste des contacts portant sur les bateaux qu'il peut voir
+ Collection<Boat> canReadBoats = authenticatedWaoUser.getWaoUser().getCanReadBoats();
+// FIXME brendan 25/03/14
+// if (CollectionUtils.isEmpty(canReadBoats)) {
+// if (log.isWarnEnabled()) {
+// log.warn("user " + connectedUser.getUser() + " is professional but can't read any boat");
+// }
+// } else {
+// newContactsFilter.getBoatFilter().setBoats(new ArrayList<Boat>(canReadBoats));
+// }
+ }
+
+ return newContactsFilter;
+
+ }
+}
Added: trunk/wao-services/src/test/java/fr/ifremer/wao/services/service/ObsMerContactsServiceTest.java
===================================================================
--- trunk/wao-services/src/test/java/fr/ifremer/wao/services/service/ObsMerContactsServiceTest.java (rev 0)
+++ trunk/wao-services/src/test/java/fr/ifremer/wao/services/service/ObsMerContactsServiceTest.java 2014-03-25 14:18:40 UTC (rev 1745)
@@ -0,0 +1,34 @@
+package fr.ifremer.wao.services.service;
+
+import fr.ifremer.wao.ContactsFilter;
+import fr.ifremer.wao.services.AbstractWaoServiceTest;
+import fr.ifremer.wao.services.ObsMerFixtures;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ObsMerContactsServiceTest extends AbstractWaoServiceTest {
+
+ protected ObsMerContactsService service;
+
+ protected ObsMerFixtures fixtures;
+
+ @Before
+ public void setUp() {
+ service = newService(ObsMerContactsService.class);
+ fixtures = new ObsMerFixtures(newServiceContext());
+ }
+
+ protected boolean isDatabaseWithReferential() {
+ return true;
+ }
+
+ @Test
+ public void testFindAll() {
+
+ ContactsFilter filter = service.newContactFilter(fixtures.admin());
+
+ service.findAll(filter);
+
+ }
+
+}
1
0
r1744 - in trunk/wao-web/src/main/webapp: WEB-INF/content/obsmer css
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 12:53:28 +0100 (Tue, 25 Mar 2014)
New Revision: 1744
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1744
Log:
refs #4483 use dropdown menu for actions in sampling plan
Modified:
trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp
trunk/wao-web/src/main/webapp/css/wao.css
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 11:39:50 UTC (rev 1743)
+++ trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp 2014-03-25 11:53:28 UTC (rev 1744)
@@ -61,65 +61,66 @@
<s:property value="code" />
</th>
<td class="actions">
- <%--
- <td class="actions 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">
- --%>
- <ul>
- <s:if test="authenticatedWaoUser.authorizedToEditSamplingPlan">
+ <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="edit-sample-row!input" id="editSampleRowUrl">
+ <s:url action="sample-row-log" id="sampleRowLogUrl">
<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 href="%{sampleRowLogUrl}">
+ <i class="icon-time"></i> <s:text name="wao.ui.action.viewSampleRowLog" />
</s:a>
</li>
<li>
- <s:url action="delete-sample-row" id="deleteSampleRowUrl">
- <s:param name="companyId" value="topiaId" />
+ <s:url action="boats" id="viewElligibleBoatsUrl">
+ <s:param name="sampleRowIds" value="topiaId" />
</s:url>
- <s:a href="%{deleteSampleRowUrl}">
- <i class="icon-trash"></i> <s:text name="wao.ui.action.delete" />
+ <s:a href="%{viewElligibleBoatsUrl}">
+ <s:text name="wao.ui.action.viewElligibleBoats" />
</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:url action="contacts" id="viewAssociatedContactsUrl">
<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 href="%{viewAssociatedContactsUrl}">
+ <s:text name="wao.ui.action.viewAssociatedContacts" />
</s:a>
</li>
- </s:if>
- </ul>
+ <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>
Modified: trunk/wao-web/src/main/webapp/css/wao.css
===================================================================
--- trunk/wao-web/src/main/webapp/css/wao.css 2014-03-25 11:39:50 UTC (rev 1743)
+++ trunk/wao-web/src/main/webapp/css/wao.css 2014-03-25 11:53:28 UTC (rev 1744)
@@ -18,7 +18,17 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
+
/**
+ * Personnalisation de Bootstrap
+ */
+
+/* On surcharge left: 0px par left: 0% car ça pose problème pour Firefox qui place le menu complètement à gauche de la fenêtre et pas en dessous du bouton */
+.dropdown-menu {
+ left: 0%;
+}
+
+/**
* Le style du layout
*/
@@ -85,11 +95,6 @@
border: solid 1px #aaaaaa;
}
-.large-table * {
- padding: 0px;
- margin: 0px;
-}
-
.large-table li {
list-style-type: none;
}
1
0
r1743 - in trunk/wao-services/src: main/java/fr/ifremer/wao/services/service/csv main/java/fr/ifremer/wao/services/service/csv/operations test/java/fr/ifremer/wao/services
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 12:39:50 +0100 (Tue, 25 Mar 2014)
New Revision: 1743
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1743
Log:
- fix test config
- use diamonds
Modified:
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/BoatGroupImportModel.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/BoatImportExportModel.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/ContactImportExportModel.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/ContactStateMotivesImportModel.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/FishingZoneImportModel.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/ObsDebSamplingPlanImportExportModel.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/RawObsDebCodesImportModel.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/TerrestrialDivisionImportModel.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/TerrestrialLocationImportModel.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/operations/DistrictNamesFormatter.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/operations/DistrictsParserFormatter.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/operations/FishingZonesParserFormatter.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/operations/LocationTypeParserFormatter.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/operations/ObservedDataControlParserFormatter.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/operations/RegionsParser.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/operations/UsersParserFormatter.java
trunk/wao-services/src/test/java/fr/ifremer/wao/services/AbstractWaoServiceTest.java
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/BoatGroupImportModel.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/BoatGroupImportModel.java 2014-03-25 10:57:36 UTC (rev 1742)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/BoatGroupImportModel.java 2014-03-25 11:39:50 UTC (rev 1743)
@@ -40,7 +40,7 @@
protected ModelBuilder<Boat> modelBuilder;
protected void buildModel() {
- modelBuilder = new ModelBuilder<Boat>();
+ modelBuilder = new ModelBuilder<>();
modelBuilder.newColumnForImportExport(
"NAVIRE_IMMATRICULATION",
Boat.PROPERTY_IMMATRICULATION,
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/BoatImportExportModel.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/BoatImportExportModel.java 2014-03-25 10:57:36 UTC (rev 1742)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/BoatImportExportModel.java 2014-03-25 11:39:50 UTC (rev 1743)
@@ -68,7 +68,7 @@
}
protected void buildModel() {
- modelBuilder = new ModelBuilder<Boat>();
+ modelBuilder = new ModelBuilder<>();
modelBuilder.newColumnForImportExport(
"NAVIRE_IMMATRICULATION",
Boat.PROPERTY_IMMATRICULATION,
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/ContactImportExportModel.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/ContactImportExportModel.java 2014-03-25 10:57:36 UTC (rev 1742)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/ContactImportExportModel.java 2014-03-25 11:39:50 UTC (rev 1743)
@@ -93,12 +93,12 @@
@Override
public TerrestrialLocation parse(String code) throws ParseException {
if (indexedLocations == null) {
- indexedLocations = new HashMap<LocationType, Map<String, TerrestrialLocation>>();
+ indexedLocations = new HashMap<>();
for (TerrestrialLocation terrestrialLocation : terrestrialLocations) {
LocationType locationType = terrestrialLocation.getLocationType();
Map<String, TerrestrialLocation> locationsForType = indexedLocations.get(locationType);
if (locationsForType == null) {
- locationsForType = new HashMap<String, TerrestrialLocation>();
+ locationsForType = new HashMap<>();
}
locationsForType.put(terrestrialLocation.getCode(), terrestrialLocation);
indexedLocations.put(locationType, locationsForType);
@@ -176,7 +176,7 @@
}
protected ModelBuilder<Contact> getModel() {
- ModelBuilder<Contact> modelBuilder = new ModelBuilder<Contact>();
+ ModelBuilder<Contact> modelBuilder = new ModelBuilder<>();
modelBuilder.newColumnForImportExport("CONTACT_ID", Contact.TOPIA_ID);
modelBuilder.newColumnForImportExport("CONTACT_DATE_CREATION", Contact.PROPERTY_CREATION_DATE, Common.DAY_TIME);
modelBuilder.newColumnForImportExport("CONTACT_OBSERVATEUR_PRINCIPAL", Contact.PROPERTY_MAIN_OBSERVER, new UserParserFormatter(waoUsers));
@@ -188,7 +188,7 @@
new ValueFormatter<List<WaoUser>>() {
@Override
public String format(List<WaoUser> value) {
- List<String> fullNames = new LinkedList<String>();
+ List<String> fullNames = new LinkedList<>();
for (WaoUser waoUser : value) {
fullNames.add(waoUser.getFullName());
}
@@ -228,7 +228,7 @@
if (obsProgram == ObsProgram.OBSMER) {
modelBuilder.newColumnForImportExport("CONTACT_QUALITE_DONNEE", "dataReliability",
- new Common.ToStringParserFormatter<DataReliability>(DataReliability.values()));
+ new Common.ToStringParserFormatter<>(DataReliability.values()));
modelBuilder.newColumnForImportExport("CONTACT_OBSERVATION_MAMMIFERE", Contact.PROPERTY_MAMMALS_OBSERVATION, Common.BOOLEAN);
modelBuilder.newColumnForImportExport("CONTACT_CAPTURE_ACCIDENTELLE", Contact.PROPERTY_MAMMALS_CAPTURE, Common.BOOLEAN);
modelBuilder.newIgnoredColumn("CONTACT_CAPTURE_ACCIDENTELLE_DETAILS");
@@ -251,7 +251,7 @@
// FIXME 20110606 bleny contact.getTerrestrialLocation() may be null, export will fail
// terrestrial location for both ObsVente and ObsDeb
- ValueGetterSetter<Contact, LocationType> locationTypeGetter = new Common.ValueSaver<Contact, LocationType>();
+ ValueGetterSetter<Contact, LocationType> locationTypeGetter = new Common.ValueSaver<>();
LocationTypeParserFormatter locationTypeParserFormatter = new LocationTypeParserFormatter();
modelBuilder.newMandatoryColumn(
"CONTACT_LIEU_TYPE",
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/ContactStateMotivesImportModel.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/ContactStateMotivesImportModel.java 2014-03-25 10:57:36 UTC (rev 1742)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/ContactStateMotivesImportModel.java 2014-03-25 11:39:50 UTC (rev 1743)
@@ -57,7 +57,7 @@
}
protected void buildModel() {
- modelBuilder = new ModelBuilder<ContactStateMotif>();
+ modelBuilder = new ModelBuilder<>();
modelBuilder.newMandatoryColumn(
"MOTIF_CODE", ContactStateMotif.PROPERTY_CODE);
modelBuilder.newMandatoryColumn(
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/FishingZoneImportModel.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/FishingZoneImportModel.java 2014-03-25 10:57:36 UTC (rev 1742)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/FishingZoneImportModel.java 2014-03-25 11:39:50 UTC (rev 1743)
@@ -57,7 +57,7 @@
@Override
public Iterable<ImportableColumn<FishingZone, Object>> getColumnsForImport() {
- ModelBuilder<FishingZone> modelBuilder = new ModelBuilder<FishingZone>();
+ ModelBuilder<FishingZone> modelBuilder = new ModelBuilder<>();
modelBuilder.newMandatoryColumn("PECHE_DIVISION", FishingZone.PROPERTY_DISTRICT_CODE);
modelBuilder.newMandatoryColumn("PECHE_ZONE", FishingZone.PROPERTY_SECTOR_NAME);
modelBuilder.newMandatoryColumn("PECHE_FACADE", FishingZone.PROPERTY_FACADE_NAME);
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/ObsDebSamplingPlanImportExportModel.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/ObsDebSamplingPlanImportExportModel.java 2014-03-25 10:57:36 UTC (rev 1742)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/ObsDebSamplingPlanImportExportModel.java 2014-03-25 11:39:50 UTC (rev 1743)
@@ -128,7 +128,7 @@
}
protected void buildModel() {
- modelBuilder = new ModelBuilder<SampleRow>();
+ modelBuilder = new ModelBuilder<>();
modelBuilder.newColumnForImportExport(
"PLAN_CODE",
SampleRow.PROPERTY_CODE,
@@ -215,12 +215,12 @@
}
protected void indexObservationUnits(List<TerrestrialDivision> observationUnits) {
- indexedObservationUnits = new HashMap<String, Map<String, TerrestrialDivision>>();
+ indexedObservationUnits = new HashMap<>();
for (TerrestrialDivision terrestrialDivision : observationUnits) {
String regionCode = terrestrialDivision.getRegionIfremer().getRegionIfremerCode();
Map<String, TerrestrialDivision> unitCodesToDivision = indexedObservationUnits.get(regionCode);
if (unitCodesToDivision == null) {
- unitCodesToDivision = new HashMap<String, TerrestrialDivision>();
+ unitCodesToDivision = new HashMap<>();
}
unitCodesToDivision.put(terrestrialDivision.getObservationUnitCode(), terrestrialDivision);
indexedObservationUnits.put(regionCode, unitCodesToDivision);
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/RawObsDebCodesImportModel.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/RawObsDebCodesImportModel.java 2014-03-25 10:57:36 UTC (rev 1742)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/RawObsDebCodesImportModel.java 2014-03-25 11:39:50 UTC (rev 1743)
@@ -59,7 +59,7 @@
}
protected void buildModel() {
- modelBuilder = new ModelBuilder<RawObsDebCode>();
+ modelBuilder = new ModelBuilder<>();
modelBuilder.newMandatoryColumn("CODE", RawObsDebCode.PROPERTY_CODE);
modelBuilder.newMandatoryColumn("NOM", RawObsDebCode.PROPERTY_LABEL);
modelBuilder.newMandatoryColumn("REGION_IFREMER",
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/TerrestrialDivisionImportModel.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/TerrestrialDivisionImportModel.java 2014-03-25 10:57:36 UTC (rev 1742)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/TerrestrialDivisionImportModel.java 2014-03-25 11:39:50 UTC (rev 1743)
@@ -69,7 +69,7 @@
@Override
public Iterable<ImportableColumn<TerrestrialDivision, Object>> getColumnsForImport() {
- ModelBuilder<TerrestrialDivision> modelBuilder = new ModelBuilder<TerrestrialDivision>();
+ ModelBuilder<TerrestrialDivision> modelBuilder = new ModelBuilder<>();
modelBuilder.newMandatoryColumn(
"ID_STRATE",
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/TerrestrialLocationImportModel.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/TerrestrialLocationImportModel.java 2014-03-25 10:57:36 UTC (rev 1742)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/TerrestrialLocationImportModel.java 2014-03-25 11:39:50 UTC (rev 1743)
@@ -73,7 +73,7 @@
@Override
public Iterable<ImportableColumn<TerrestrialLocation, Object>> getColumnsForImport() {
- ModelBuilder<TerrestrialLocation> modelBuilder = new ModelBuilder<TerrestrialLocation>();
+ ModelBuilder<TerrestrialLocation> modelBuilder = new ModelBuilder<>();
modelBuilder.newMandatoryColumn("TLIEU_COD",
new ValueParser<LocationType>() {
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/operations/DistrictNamesFormatter.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/operations/DistrictNamesFormatter.java 2014-03-25 10:57:36 UTC (rev 1742)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/operations/DistrictNamesFormatter.java 2014-03-25 11:39:50 UTC (rev 1743)
@@ -35,7 +35,7 @@
@Override
public String format(Collection<TerrestrialLocation> terrestrialLocations) {
- List<String> districtNames = new LinkedList<String>();
+ List<String> districtNames = new LinkedList<>();
if (terrestrialLocations != null) {
for (TerrestrialLocation terrestrialLocation : terrestrialLocations) {
districtNames.add(terrestrialLocation.getDistrictName());
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/operations/DistrictsParserFormatter.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/operations/DistrictsParserFormatter.java 2014-03-25 10:57:36 UTC (rev 1742)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/operations/DistrictsParserFormatter.java 2014-03-25 11:39:50 UTC (rev 1743)
@@ -52,7 +52,7 @@
@Override
public String format(Collection<TerrestrialLocation> districts) {
- List<String> districtCodes = new LinkedList<String>();
+ List<String> districtCodes = new LinkedList<>();
if (districts != null) {
for (TerrestrialLocation district : districts) {
districtCodes.add(district.getDistrictCode());
@@ -68,7 +68,7 @@
throw new IllegalArgumentException(I18n.t("wao.import.contact.failure.districtMissing"));
}
String[] districtCodes = StringUtils.split(value, ',');
- Collection<TerrestrialLocation> districts = new LinkedList<TerrestrialLocation>();
+ Collection<TerrestrialLocation> districts = new LinkedList<>();
for (String districtCode : districtCodes) {
TerrestrialLocation district = indexedDistricts.get(districtCode.trim());
if (district == null) {
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/operations/FishingZonesParserFormatter.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/operations/FishingZonesParserFormatter.java 2014-03-25 10:57:36 UTC (rev 1742)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/operations/FishingZonesParserFormatter.java 2014-03-25 11:39:50 UTC (rev 1743)
@@ -50,7 +50,7 @@
@Override
public String format(List<FishingZone> fishingZones) {
- List<String> districtCodes = new LinkedList<String>();
+ List<String> districtCodes = new LinkedList<>();
for (FishingZone fishingZone : fishingZones) {
districtCodes.add(fishingZone.getDistrictCode());
}
@@ -62,7 +62,7 @@
if (indexedFishingZones == null) {
indexedFishingZones = Maps.uniqueIndex(fishingZones, FishingZones.getDistrictCode());
}
- List<FishingZone> fishingZones = new LinkedList<FishingZone>();
+ List<FishingZone> fishingZones = new LinkedList<>();
if (StringUtils.isBlank(districtCodes)) {
throw new IllegalArgumentException(I18n.t("wao.import.sampleRow.failure.fishingZoneMissing"));
} else {
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/operations/LocationTypeParserFormatter.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/operations/LocationTypeParserFormatter.java 2014-03-25 10:57:36 UTC (rev 1742)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/operations/LocationTypeParserFormatter.java 2014-03-25 11:39:50 UTC (rev 1743)
@@ -49,7 +49,7 @@
@Override
public LocationType parse(String value) throws ParseException {
if (fromStrings == null) {
- fromStrings = new HashMap<String, LocationType>();
+ fromStrings = new HashMap<>();
fromStrings.put(LocationType.PORT.toString(), LocationType.PORT);
fromStrings.put(LocationType.AUCTION.toString(), LocationType.AUCTION);
}
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/operations/ObservedDataControlParserFormatter.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/operations/ObservedDataControlParserFormatter.java 2014-03-25 10:57:36 UTC (rev 1742)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/operations/ObservedDataControlParserFormatter.java 2014-03-25 11:39:50 UTC (rev 1743)
@@ -43,7 +43,7 @@
ValueParserFormatter<ObservedDataControl> nonNullObservedDataControlParserFormatter;
public ObservedDataControlParserFormatter() {
- List<ObservedDataControl> observedDataControlsValues = new LinkedList<ObservedDataControl>();
+ List<ObservedDataControl> observedDataControlsValues = new LinkedList<>();
Collections.addAll(observedDataControlsValues, ObservedDataControl.values());
observedDataControlsValues.add(null);
StringUtil.ToString<ObservedDataControl> nullableObservedDataControlToString = new StringUtil.ToString<ObservedDataControl>() {
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/operations/RegionsParser.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/operations/RegionsParser.java 2014-03-25 10:57:36 UTC (rev 1742)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/operations/RegionsParser.java 2014-03-25 11:39:50 UTC (rev 1743)
@@ -51,7 +51,7 @@
}
String[] regionCodes = value.split(",");
- List<TerrestrialLocation> regions = new LinkedList<TerrestrialLocation>();
+ List<TerrestrialLocation> regions = new LinkedList<>();
for (String regionCode : regionCodes) {
if ( ! regionCode.isEmpty()) {
TerrestrialLocation region =
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/operations/UsersParserFormatter.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/operations/UsersParserFormatter.java 2014-03-25 10:57:36 UTC (rev 1742)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/operations/UsersParserFormatter.java 2014-03-25 11:39:50 UTC (rev 1743)
@@ -57,7 +57,7 @@
@Override
public List<WaoUser> parse(String value) throws ParseException {
String[] logins = StringUtils.split(value, SEPARATOR);
- List<WaoUser> users = new LinkedList<WaoUser>();
+ List<WaoUser> users = new LinkedList<>();
for (String login : logins) {
String trimmedLogin = login.trim();
WaoUser user = indexedWaoUsers.get(trimmedLogin);
Modified: trunk/wao-services/src/test/java/fr/ifremer/wao/services/AbstractWaoServiceTest.java
===================================================================
--- trunk/wao-services/src/test/java/fr/ifremer/wao/services/AbstractWaoServiceTest.java 2014-03-25 10:57:36 UTC (rev 1742)
+++ trunk/wao-services/src/test/java/fr/ifremer/wao/services/AbstractWaoServiceTest.java 2014-03-25 11:39:50 UTC (rev 1743)
@@ -56,15 +56,16 @@
protected WaoTopiaApplicationContext applicationContext;
- protected List<WaoTopiaPersistenceContext> openedTransactions = new LinkedList<WaoTopiaPersistenceContext>();
+ protected List<WaoTopiaPersistenceContext> openedTransactions = new LinkedList<>();
protected WaoTopiaApplicationContext newApplicationContext(String dataBase) {
- Map<String, String> hibernateH2Config = new HashMap<String, String>();
+ Map<String, String> hibernateH2Config = new HashMap<>();
hibernateH2Config.putAll(getApplicationConfig().getTopiaProperties());
hibernateH2Config.put(Environment.DRIVER, org.h2.Driver.class.getName());
+ hibernateH2Config.put(Environment.DIALECT, org.hibernate.dialect.H2Dialect.class.getName());
hibernateH2Config.put(Environment.USER, "sa");
hibernateH2Config.put(Environment.PASS, "");
1
0
See <http://ci.codelutin.com/jenkins/job/wao-ci/39/changes>
Changes:
[Tony CHEMIT] refs-20 #4483 (add SamplingPlan Builder)
[Tony CHEMIT] add log configuration for tests
[Tony CHEMIT] fix licenses
fix third-parties
fix dependencies
------------------------------------------
[...truncated 206 lines...]
INFO [pool-1-thread-1 for channel] (ObjectModelTransformerToJava.java:998) isInClassPath - Will not generate [fr.ifremer.wao.entity.SampleRowTopiaDao], already found in class-path.
INFO [pool-1-thread-1 for channel] (ObjectModelTransformerToJava.java:998) isInClassPath - Will not generate [fr.ifremer.wao.entity.TerrestrialLocationTopiaDao], already found in class-path.
[INFO] Add compile source root : <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-persistence/target/…>
[INFO] Add resource root :Resource {targetPath: null, filtering: false, FileSet {directory: <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-persistence/target/…,> PatternSet [includes: {}, excludes: {**/*.java}]}}
[INFO]
[INFO] --- i18n-maven-plugin:3.0:parserJava (parseOthersAndGen) @ wao-persistence ---
[INFO] start entry basedir:<http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-persistence/target/…,> includes:[**/*.java]
[INFO] 149 file(s) to process (among 149 files)
[INFO] start entry basedir:<http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-persistence/src/mai…,> includes:[**/*.java]
[INFO] 55 file(s) to process (among 55 files)
[INFO] Parsing is done. [treated file(s) : 10/204](total time:1.751s) ( ~ 8.584ms / file)
[INFO]
[INFO] >>> i18n-maven-plugin:3.0:gen (parseOthersAndGen) @ wao-persistence >>>
[INFO]
[INFO] --- i18n-maven-plugin:3.0:get (get) @ wao-persistence ---
[INFO] config - basedir : <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-persistence/target/…>
[INFO] config - locales : [fr_FR, en_GB]
[INFO] import getter java.getter in 238817ns
[INFO] Copying wao-persistence.properties to <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-persistence/target/…>
[INFO] Copying wao-persistence.properties to <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-persistence/target/…>
[INFO]
[INFO] <<< i18n-maven-plugin:3.0:gen (parseOthersAndGen) @ wao-persistence <<<
[INFO]
[INFO] --- i18n-maven-plugin:3.0:gen (parseOthersAndGen) @ wao-persistence ---
[INFO] config - src basedir : <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-persistence/src/mai…>
[INFO] config - out basedir : <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-persistence/target/…>
[INFO] config - locales : [fr_FR, en_GB]
[INFO] prepare bundle for locale fr_FR
[INFO] merge bundle fr_FR to out
[WARNING] bundle fr_FR contains 1/139 empty entries! (use -Di18n.showEmpty to see these entries)
[INFO] copy bundle fr_FR to src
[INFO] prepare bundle for locale en_GB
[INFO] merge bundle en_GB to out
[WARNING] bundle en_GB contains 3/139 empty entries! (use -Di18n.showEmpty to see these entries)
[INFO] copy bundle en_GB to src
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ wao-persistence ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 6 resources
[INFO] Copying 28 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ wao-persistence ---
[INFO] Compiling 204 source files to <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-persistence/target/…>
[WARNING] <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-persistence/src/mai…>:[75,27] equals(java.lang.Object,java.lang.Object) in org.apache.commons.lang3.ObjectUtils has been deprecated
[WARNING] <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-persistence/target/…>: Some input files use unchecked or unsafe operations.
[WARNING] <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-persistence/target/…>: Recompile with -Xlint:unchecked for details.
[INFO]
[INFO] --- maven-antrun-plugin:1.7:run (generate-surefire-workdir) @ wao-persistence ---
[INFO] Executing tasks
main:
[mkdir] Created dir: <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-persistence/target/…>
[INFO] Executed tasks
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ wao-persistence ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ wao-persistence ---
[INFO] Compiling 1 source file to <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-persistence/target/…>
[INFO]
[INFO] --- maven-surefire-plugin:2.17:test (default-test) @ wao-persistence ---
[INFO] Surefire report directory: <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-persistence/target/…>
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running fr.ifremer.wao.entity.SampleRowLogImplTest
2014/03/25 10:26:14 DEBUG (SampleRowLogImplTest.java:78) testNewSampleRowLog Le nombre d'observateurs est de 0
Le durée moyenne d'une marée est de 0.0
La ligne est sur la période du 03/2011 au 06/2011
Le métier de la ligne est null
2014/03/25 10:26:14 DEBUG (SampleRowLogImplTest.java:94) testCompareSampleRowToItself
2014/03/25 10:26:14 DEBUG (SampleRowLogImplTest.java:118) testModifySampleRow La durée moyenne d'une marée est passé de 0.0 jours à 1.0
La ligne est désormais associée au programme programName
La date de fin est passée de 06/2011 à 07/2011
Les zones de pêches suivantes ont été ajoutées : null - null - IV
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.16 sec - in fr.ifremer.wao.entity.SampleRowLogImplTest
Results :
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0
[JENKINS] Recording test results
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ wao-persistence ---
[INFO] Building jar: <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-persistence/target/…>
[INFO]
[INFO] --- maven-site-plugin:3.3:attach-descriptor (attach-descriptor) @ wao-persistence ---
[JENKINS] Archiving disabled
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Wao :: Services 4.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ wao-services ---
[INFO] Deleting <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-services/target>
[INFO]
[INFO] --- maven-enforcer-plugin:1.3.1:enforce (check-project-files) @ wao-services ---
[INFO]
[INFO] --- i18n-maven-plugin:3.0:parserJava (parseOthersAndGen) @ wao-services ---
[INFO] start entry basedir:<http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-services/src/main/j…,> includes:[**/*.java]
[INFO] 66 file(s) to process (among 66 files)
[INFO] Parsing is done. [treated file(s) : 18/66](total time:213.249ms) ( ~ 3.231ms / file)
[INFO]
[INFO] >>> i18n-maven-plugin:3.0:gen (parseOthersAndGen) @ wao-services >>>
[INFO]
[INFO] --- i18n-maven-plugin:3.0:get (get) @ wao-services ---
[INFO] config - basedir : <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-services/target/gen…>
[INFO] config - locales : [fr_FR, en_GB]
[INFO] import getter java.getter in 135566ns
[INFO] Copying wao-services.properties to <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-services/target/gen…>
[INFO] Copying wao-services.properties to <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-services/target/gen…>
[INFO]
[INFO] <<< i18n-maven-plugin:3.0:gen (parseOthersAndGen) @ wao-services <<<
[INFO]
[INFO] --- i18n-maven-plugin:3.0:gen (parseOthersAndGen) @ wao-services ---
[INFO] config - src basedir : <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-services/src/main/r…>
[INFO] config - out basedir : <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-services/target/gen…>
[INFO] config - locales : [fr_FR, en_GB]
[INFO] prepare bundle for locale fr_FR
[INFO] merge bundle fr_FR to out
[INFO] copy bundle fr_FR to src
[INFO] prepare bundle for locale en_GB
[INFO] merge bundle en_GB to out
[INFO] copy bundle en_GB to src
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ wao-services ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 4 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ wao-services ---
[INFO] Compiling 66 source files to <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-services/target/cla…>
[WARNING] <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-services/src/main/j…>:[173,46] findByEntityClassFqn(java.lang.String) in fr.ifremer.wao.entity.GeneratedReferentialMetaTopiaDao has been deprecated
[WARNING] <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-services/src/main/j…>:[180,68] TOPIA_ID in org.nuiton.topia.persistence.TopiaEntity has been deprecated
[WARNING] <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-services/src/main/j…>: Some input files use unchecked or unsafe operations.
[WARNING] <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-services/src/main/j…>: Recompile with -Xlint:unchecked for details.
[INFO]
[INFO] --- maven-antrun-plugin:1.7:run (generate-surefire-workdir) @ wao-services ---
[INFO] Executing tasks
main:
[mkdir] Created dir: <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-services/target/sur…>
[INFO] Executed tasks
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ wao-services ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 9 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ wao-services ---
[INFO] Compiling 8 source files to <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-services/target/tes…>
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-services/src/test/j…>:[65,63] incompatible types
required: java.util.List<fr.ifremer.wao.entity.SampleRow>
found: fr.ifremer.wao.services.service.ObsMerSamplingPlan
[ERROR] <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-services/src/test/j…>:[70,47] incompatible types
required: java.util.List<fr.ifremer.wao.entity.SampleRow>
found: fr.ifremer.wao.services.service.ObsMerSamplingPlan
[ERROR] <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-services/src/test/j…>:[75,47] incompatible types
required: java.util.List<fr.ifremer.wao.entity.SampleRow>
found: fr.ifremer.wao.services.service.ObsMerSamplingPlan
[ERROR] <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-services/src/test/j…>:[81,47] incompatible types
required: java.util.List<fr.ifremer.wao.entity.SampleRow>
found: fr.ifremer.wao.services.service.ObsMerSamplingPlan
[INFO] 4 errors
[INFO] -------------------------------------------------------------
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Wao ............................................... SUCCESS [ 3.767 s]
[INFO] Wao :: Persistence ................................ SUCCESS [ 13.857 s]
[INFO] Wao :: Services ................................... FAILURE [ 2.112 s]
[INFO] Wao :: Web ........................................ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 21.491 s
[INFO] Finished at: 2014-03-25T10:26:18+01:00
[INFO] Final Memory: 45M/725M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile (default-testCompile) on project wao-services: Compilation failure: Compilation failure:
[ERROR] <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-services/src/test/j…>:[65,63] incompatible types
[ERROR] required: java.util.List<fr.ifremer.wao.entity.SampleRow>
[ERROR] found: fr.ifremer.wao.services.service.ObsMerSamplingPlan
[ERROR] <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-services/src/test/j…>:[70,47] incompatible types
[ERROR] required: java.util.List<fr.ifremer.wao.entity.SampleRow>
[ERROR] found: fr.ifremer.wao.services.service.ObsMerSamplingPlan
[ERROR] <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-services/src/test/j…>:[75,47] incompatible types
[ERROR] required: java.util.List<fr.ifremer.wao.entity.SampleRow>
[ERROR] found: fr.ifremer.wao.services.service.ObsMerSamplingPlan
[ERROR] <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-services/src/test/j…>:[81,47] incompatible types
[ERROR] required: java.util.List<fr.ifremer.wao.entity.SampleRow>
[ERROR] found: fr.ifremer.wao.services.service.ObsMerSamplingPlan
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile (default-testCompile) on project wao-services: Compilation failure
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:108)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
at org.jvnet.hudson.maven3.launcher.Maven31Launcher.main(Maven31Launcher.java:132)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:330)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:238)
at jenkins.maven3.agent.Maven31Main.launch(Maven31Main.java:181)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:134)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:69)
at hudson.remoting.UserRequest.perform(UserRequest.java:118)
at hudson.remoting.UserRequest.perform(UserRequest.java:48)
at hudson.remoting.Request$2.run(Request.java:328)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: org.apache.maven.plugin.compiler.CompilationFailureException: Compilation failure
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:858)
at org.apache.maven.plugin.compiler.TestCompilerMojo.execute(TestCompilerMojo.java:152)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 30 more
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :wao-services
Sending e-mails to: wao-commits(a)list.forge.codelutin.com chemit+codelutin-ci(a)codelutin.com
channel stopped
1
4