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
August 2014
- 3 participants
- 38 discussions
27 Aug '14
Author: bleny
Date: 2014-08-27 17:46:57 +0200 (Wed, 27 Aug 2014)
New Revision: 2228
Url: http://forge.codelutin.com/projects/wao/repository/revisions/2228
Log:
Fusion des corrections effectu?\195?\169es jusqu'en 4.0.9 dans la 4.1
Added:
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactsFilterValuesCacheKey.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/NoEffortDefinedException.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/operations/DayParserFormatter.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/operations/DayTimeParserFormatter.java
Modified:
trunk/
trunk/wao-persistence/src/main/java/fr/ifremer/wao/ContactsFilter.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/ObsProgram.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/AuthenticatedWaoUser.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/DefaultWaoServiceContext.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/WaoApplicationContext.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/WaoServiceContext.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/BoatsFilterValuesCacheKey.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/BoatsService.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactsService.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/SamplingPlanService.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/SynthesisService.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/UpdateContactCommand.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/UpdateWaoUserCommand.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/
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/operations/SampleRowCodeParserFormatter.java
trunk/wao-services/src/main/resources/i18n/wao-services_en_GB.properties
trunk/wao-services/src/main/resources/i18n/wao-services_fr_FR.properties
trunk/wao-services/src/test/java/fr/ifremer/wao/services/FakeWaoApplicationContext.java
trunk/wao-web/src/main/java/fr/ifremer/wao/web/CacheInvalidationTopiaEntityListener.java
trunk/wao-web/src/main/java/fr/ifremer/wao/web/DefaultWaoApplicationContext.java
trunk/wao-web/src/main/java/fr/ifremer/wao/web/WaoInterceptor.java
trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/AbstractImportCsvAction.java
trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/EditContactAction.java
trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/EditSampleRowAction.java
trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/ValidateContactJsonAction.java
trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/administration/EditWaoUserAction.java
trunk/wao-web/src/main/java/fr/ifremer/wao/web/converter/AbstractDateConverter.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/authentication/login.jsp
trunk/wao-web/src/main/webapp/WEB-INF/content/edit-contact-input.jsp
trunk/wao-web/src/main/webapp/WEB-INF/content/edit-sample-row-input.jsp
trunk/wao-web/src/main/webapp/wao.js
Property changes on: trunk
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/wao-4.0-obsvente:2075-2085
+ /branches/wao-4.0-obsvente:2075-2085
/branches/wao-4.0.x:2169-2227
Modified: trunk/wao-persistence/src/main/java/fr/ifremer/wao/ContactsFilter.java
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/ContactsFilter.java 2014-08-27 15:24:12 UTC (rev 2227)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/ContactsFilter.java 2014-08-27 15:46:57 UTC (rev 2228)
@@ -371,22 +371,25 @@
}
}
- public boolean isRealVsEstimated() {
- boolean realVsEstimated;
+ /**
+ * will return null for contacts filter (this field is only for synthesis)
+ */
+ public Boolean getRealVsEstimated() {
+ Boolean realVsEstimated;
if (WaoUtils.isEqualCollection(PROGRAM_ACCEPTATIONS_FOR_REAL_AND_ESTIMATED, getProgramAcceptations())) {
if (WaoUtils.isEqualCollection(COMPANY_ACCEPTATIONS_FOR_REAL, getCompanyAcceptations())) {
realVsEstimated = true;
} else if (WaoUtils.isEqualCollection(COMPANY_ACCEPTATIONS_FOR_ESTIMATED, getCompanyAcceptations())) {
realVsEstimated = false;
} else {
- throw new IllegalStateException();
+ realVsEstimated = null;
}
} else {
if (CollectionUtils.isEmpty(getCompanyAcceptations()) && CollectionUtils.isEmpty(getCompanyAcceptations())) {
// return default value
realVsEstimated = false;
} else {
- throw new IllegalArgumentException();
+ realVsEstimated = null;
}
}
return realVsEstimated;
Modified: trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java 2014-08-27 15:24:12 UTC (rev 2227)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java 2014-08-27 15:46:57 UTC (rev 2228)
@@ -22,10 +22,10 @@
*/
import fr.ifremer.wao.entity.I18nAble;
-import fr.ifremer.wao.entity.ObsProgram;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.nuiton.i18n.I18n;
+import org.nuiton.util.DateUtil;
import java.text.DateFormat;
import java.text.ParseException;
@@ -35,7 +35,6 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
-import java.util.regex.Pattern;
public class WaoUtils {
@@ -59,6 +58,8 @@
protected static final String FRENCH_LANGUAGE = new Locale("fr").getLanguage();
+ protected static final Date WAO_CREATION_DATE = DateUtil.createDate(27, 1, 2010);
+
@Deprecated
public static String formatMonth(Date date) {
return formatDate(date, MONTH_PATTERN);
@@ -118,26 +119,22 @@
return dateFormat.parse(monthYear);
}
- public static Date parseDate(Locale locale, String monthYear) throws ParseException {
+ public static Date parseDate(Locale locale, String date) throws ParseException {
String pattern = I18n.l(locale, "wao.date.parser");
DateFormat dateFormat = new SimpleDateFormat(pattern);
- return dateFormat.parse(monthYear);
+ return dateFormat.parse(date);
}
- public static Date parseDateTime(Locale locale, String monthYear) throws ParseException {
+ public static Date parseDateTime(Locale locale, String dateTime) throws ParseException {
String pattern = I18n.l(locale, "wao.datetime.parser");
DateFormat dateFormat = new SimpleDateFormat(pattern);
- return dateFormat.parse(monthYear);
+ return dateFormat.parse(dateTime);
}
public static String l(Locale locale, I18nAble i18nAble) {
return I18n.l(locale, i18nAble.getI18nKey());
}
- public static Pattern getSampleRowCodePattern(ObsProgram obsProgram) {
- return Pattern.compile("^(\\d{4})_" + obsProgram.getShortCode() + "(\\d{4})$");
- }
-
@Deprecated
public static <T extends Enum> Collection<Integer> toOrdinals(Collection<T> enums) {
List<Integer> ordinals = new LinkedList<>();
@@ -186,4 +183,8 @@
boolean isFrench = FRENCH_LANGUAGE.equals(locale.getLanguage());
return isFrench;
}
+
+ public static boolean isAfterWaoCreation(Date date) {
+ return WAO_CREATION_DATE.before(date);
+ }
}
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-08-27 15:24:12 UTC (rev 2227)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ContactTopiaDao.java 2014-08-27 15:46:57 UTC (rev 2228)
@@ -38,6 +38,7 @@
import org.nuiton.topia.persistence.TopiaEntity;
import org.nuiton.topia.persistence.TopiaQueryBuilderAddCriteriaOrRunQueryStep;
import org.nuiton.topia.persistence.TopiaQueryBuilderRunQueryStep;
+import org.nuiton.util.DateUtil;
import java.util.Arrays;
import java.util.Calendar;
@@ -124,7 +125,8 @@
}
if (filter.getPeriodTo() != null) {
- query.addWhereClause("c." + periodProperty + " <= :periodTo", ImmutableMap.of("periodTo", (Object) filter.getPeriodTo()));
+ Date periodTo = DateUtil.setMaxTimeOfDay(filter.getPeriodTo());
+ query.addWhereClause("c." + periodProperty + " <= :periodTo", ImmutableMap.of("periodTo", (Object) periodTo));
}
if (CollectionUtils.isNotEmpty(filter.getContactIds())) {
Modified: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ObsProgram.java
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ObsProgram.java 2014-08-27 15:24:12 UTC (rev 2227)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ObsProgram.java 2014-08-27 15:46:57 UTC (rev 2228)
@@ -20,6 +20,8 @@
*/
package fr.ifremer.wao.entity;
+import java.util.regex.Pattern;
+
import static org.nuiton.i18n.I18n.n;
public enum ObsProgram implements I18nAble {
@@ -61,4 +63,9 @@
public String getI18nKey() {
return i18nKey;
}
+
+ public Pattern getSampleRowCodePattern() {
+ return Pattern.compile("^(\\d{4})_" + getShortCode() + "(\\d{4})$");
+ }
+
}
Property changes on: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/ObsProgram.java
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/wao-1.5.x/wao-business/src/main/java/fr/ifremer/wao/bean/ObsProgram.java:679-733
+ /branches/wao-1.5.x/wao-business/src/main/java/fr/ifremer/wao/bean/ObsProgram.java:679-733
/branches/wao-4.0.x/wao-persistence/src/main/java/fr/ifremer/wao/entity/ObsProgram.java:2169-2227
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/AuthenticatedWaoUser.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/AuthenticatedWaoUser.java 2014-08-27 15:24:12 UTC (rev 2227)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/AuthenticatedWaoUser.java 2014-08-27 15:46:57 UTC (rev 2228)
@@ -112,7 +112,7 @@
}
public boolean isAuthorizedToActiveUser() {
- return userProfile.isAdmin() && isCanWrite();
+ return (userProfile.isAdmin() || userProfile.isCoordinator()) && isCanWrite();
}
public boolean isAuthorizedToChangeUserCompany() {
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/DefaultWaoServiceContext.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/DefaultWaoServiceContext.java 2014-08-27 15:24:12 UTC (rev 2227)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/DefaultWaoServiceContext.java 2014-08-27 15:46:57 UTC (rev 2228)
@@ -28,6 +28,8 @@
import fr.ifremer.wao.WaoTopiaPersistenceContext;
import fr.ifremer.wao.services.service.BoatsFilterValues;
import fr.ifremer.wao.services.service.BoatsFilterValuesCacheKey;
+import fr.ifremer.wao.services.service.ContactsFilterValues;
+import fr.ifremer.wao.services.service.ContactsFilterValuesCacheKey;
import fr.ifremer.wao.services.service.SamplingPlan;
import fr.ifremer.wao.services.service.SamplingPlanCacheKey;
import fr.ifremer.wao.services.service.Synthesis;
@@ -128,4 +130,9 @@
public Cache<ContactsFilter, Synthesis> getSynthesesCache() {
return waoApplicationContext.getSynthesesCache();
}
+
+ @Override
+ public Cache<ContactsFilterValuesCacheKey, ContactsFilterValues> getContactsFilterValuesCache() {
+ return waoApplicationContext.getContactsFilterValuesCache();
+ }
}
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/WaoApplicationContext.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/WaoApplicationContext.java 2014-08-27 15:24:12 UTC (rev 2227)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/WaoApplicationContext.java 2014-08-27 15:46:57 UTC (rev 2228)
@@ -27,6 +27,8 @@
import fr.ifremer.wao.WaoTopiaPersistenceContext;
import fr.ifremer.wao.services.service.BoatsFilterValues;
import fr.ifremer.wao.services.service.BoatsFilterValuesCacheKey;
+import fr.ifremer.wao.services.service.ContactsFilterValues;
+import fr.ifremer.wao.services.service.ContactsFilterValuesCacheKey;
import fr.ifremer.wao.services.service.SamplingPlan;
import fr.ifremer.wao.services.service.SamplingPlanCacheKey;
import fr.ifremer.wao.services.service.Synthesis;
@@ -60,6 +62,8 @@
Cache<BoatsFilterValuesCacheKey, BoatsFilterValues> getBoatsFilterValuesCache();
+ Cache<ContactsFilterValuesCacheKey, ContactsFilterValues> getContactsFilterValuesCache();
+
Cache<ContactsFilter, Synthesis> getSynthesesCache();
}
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/WaoServiceContext.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/WaoServiceContext.java 2014-08-27 15:24:12 UTC (rev 2227)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/WaoServiceContext.java 2014-08-27 15:46:57 UTC (rev 2228)
@@ -27,6 +27,8 @@
import fr.ifremer.wao.WaoTopiaPersistenceContext;
import fr.ifremer.wao.services.service.BoatsFilterValues;
import fr.ifremer.wao.services.service.BoatsFilterValuesCacheKey;
+import fr.ifremer.wao.services.service.ContactsFilterValues;
+import fr.ifremer.wao.services.service.ContactsFilterValuesCacheKey;
import fr.ifremer.wao.services.service.SamplingPlan;
import fr.ifremer.wao.services.service.SamplingPlanCacheKey;
import fr.ifremer.wao.services.service.Synthesis;
@@ -60,5 +62,7 @@
Cache<BoatsFilterValuesCacheKey, BoatsFilterValues> getBoatsFilterValuesCache();
+ Cache<ContactsFilterValuesCacheKey, ContactsFilterValues> getContactsFilterValuesCache();
+
Cache<ContactsFilter,Synthesis> getSynthesesCache();
}
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/BoatsFilterValuesCacheKey.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/BoatsFilterValuesCacheKey.java 2014-08-27 15:24:12 UTC (rev 2227)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/BoatsFilterValuesCacheKey.java 2014-08-27 15:46:57 UTC (rev 2228)
@@ -23,6 +23,7 @@
import com.google.common.base.Objects;
import com.google.common.base.Optional;
+import fr.ifremer.wao.BoatsFilter;
import fr.ifremer.wao.entity.ObsProgram;
import java.io.Serializable;
@@ -30,16 +31,19 @@
public class BoatsFilterValuesCacheKey implements Serializable {
- protected final Locale locale;
+ protected Locale locale;
- protected final ObsProgram obsProgram;
+ protected ObsProgram obsProgram;
- protected final Optional<String> optionalCompanyId;
+ protected Optional<String> optionalCompanyId;
- public BoatsFilterValuesCacheKey(Locale locale, ObsProgram obsProgram, Optional<String> optionalCompanyId) {
+ protected BoatsFilter boatsFilter;
+
+ public BoatsFilterValuesCacheKey(Locale locale, ObsProgram obsProgram, Optional<String> optionalCompanyId, BoatsFilter boatsFilter) {
this.locale = locale;
this.obsProgram = obsProgram;
this.optionalCompanyId = optionalCompanyId;
+ this.boatsFilter = boatsFilter;
}
@Override
@@ -49,13 +53,14 @@
BoatsFilterValuesCacheKey that = (BoatsFilterValuesCacheKey) o;
boolean equals = Objects.equal(locale, that.locale)
&& Objects.equal(optionalCompanyId, that.optionalCompanyId)
- && Objects.equal(obsProgram, that.obsProgram);
+ && Objects.equal(obsProgram, that.obsProgram)
+ && Objects.equal(boatsFilter, that.boatsFilter);
return equals;
}
@Override
public int hashCode() {
- return Objects.hashCode(locale, optionalCompanyId, obsProgram);
+ return Objects.hashCode(locale, optionalCompanyId, obsProgram, boatsFilter);
}
}
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/BoatsService.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/BoatsService.java 2014-08-27 15:24:12 UTC (rev 2227)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/BoatsService.java 2014-08-27 15:46:57 UTC (rev 2228)
@@ -80,7 +80,8 @@
new BoatsFilterValuesCacheKey(
serviceContext.getLocale(),
authenticatedWaoUser.getObsProgram(),
- optionalCompanyId);
+ optionalCompanyId,
+ filter);
Cache<BoatsFilterValuesCacheKey, BoatsFilterValues> cache =
serviceContext.getBoatsFilterValuesCache();
@@ -147,12 +148,12 @@
BoatTopiaDao dao = getBoatDao();
- List<Boat> sampleRows = dao.findAll(filter);
+ List<Boat> boats = dao.findAll(filter);
ExportModel<Boat> exportModel =
new BoatImportExportModel(getLocale());
- Export<Boat> export = Export.newExport(exportModel, sampleRows);
+ Export<Boat> export = Export.newExport(exportModel, boats);
try {
Copied: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactsFilterValuesCacheKey.java (from rev 2227, branches/wao-4.0.x/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactsFilterValuesCacheKey.java)
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactsFilterValuesCacheKey.java (rev 0)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactsFilterValuesCacheKey.java 2014-08-27 15:46:57 UTC (rev 2228)
@@ -0,0 +1,66 @@
+package fr.ifremer.wao.services.service;
+
+/*
+ * #%L
+ * Wao :: Services
+ * %%
+ * Copyright (C) 2009 - 2014 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+import com.google.common.base.Objects;
+import com.google.common.base.Optional;
+import fr.ifremer.wao.ContactsFilter;
+import fr.ifremer.wao.entity.ObsProgram;
+
+import java.io.Serializable;
+import java.util.Locale;
+
+public class ContactsFilterValuesCacheKey implements Serializable {
+
+ protected Locale locale;
+
+ protected ObsProgram obsProgram;
+
+ protected Optional<String> optionalCompanyId;
+
+ protected ContactsFilter contactsFilter;
+
+ public ContactsFilterValuesCacheKey(Locale locale, ObsProgram obsProgram, Optional<String> optionalCompanyId, ContactsFilter contactsFilter) {
+ this.locale = locale;
+ this.obsProgram = obsProgram;
+ this.optionalCompanyId = optionalCompanyId;
+ this.contactsFilter = contactsFilter;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ ContactsFilterValuesCacheKey that = (ContactsFilterValuesCacheKey) o;
+ boolean equals = Objects.equal(locale, that.locale)
+ && Objects.equal(optionalCompanyId, that.optionalCompanyId)
+ && Objects.equal(obsProgram, that.obsProgram)
+ && Objects.equal(contactsFilter, that.contactsFilter);
+ return equals;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(locale, optionalCompanyId, obsProgram, contactsFilter);
+ }
+
+}
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactsService.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactsService.java 2014-08-27 15:24:12 UTC (rev 2227)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactsService.java 2014-08-27 15:46:57 UTC (rev 2228)
@@ -24,6 +24,7 @@
import com.google.common.base.Charsets;
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
+import com.google.common.cache.Cache;
import com.google.common.collect.ImmutableSet;
import fr.ifremer.wao.ContactsFilter;
import fr.ifremer.wao.WaoTechnicalException;
@@ -135,17 +136,33 @@
public ContactsFilterValues getContactsFilterValues(AuthenticatedWaoUser authenticatedWaoUser, ContactsFilter filter) {
- ContactTopiaDao dao = getContactDao();
- List<Contact> contacts = dao.findAllForFilterValues(filter);
+ Locale locale = serviceContext.getLocale();
+ ObsProgram obsProgram = authenticatedWaoUser.getObsProgram();
Optional<String> optionalCompanyId = Optional.absent();
if (authenticatedWaoUser.isCoordinatorOrObserver()) {
optionalCompanyId = Optional.of(authenticatedWaoUser.getCompany().getTopiaId());
}
- ContactsFilterValues contactsFilterValues = new ContactsFilterValues(serviceContext.getLocale(), authenticatedWaoUser.getObsProgram(), optionalCompanyId);
- for (Contact contact : contacts) {
- contactsFilterValues.addContact(contact);
+ ContactsFilterValuesCacheKey cacheKey =
+ new ContactsFilterValuesCacheKey(locale, obsProgram, optionalCompanyId, filter);
+
+ Cache<ContactsFilterValuesCacheKey, ContactsFilterValues> cache =
+ serviceContext.getContactsFilterValuesCache();
+
+ ContactsFilterValues contactsFilterValues = cache.getIfPresent(cacheKey);
+
+ if (contactsFilterValues == null) {
+
+ ContactTopiaDao dao = getContactDao();
+ List<Contact> contacts = dao.findAllForFilterValues(filter);
+
+ contactsFilterValues = new ContactsFilterValues(locale, obsProgram, optionalCompanyId);
+ for (Contact contact : contacts) {
+ contactsFilterValues.addContact(contact);
+ }
+
+ cache.put(cacheKey, contactsFilterValues);
}
return contactsFilterValues;
@@ -235,8 +252,11 @@
updateContactCommand.setCreation(false);
- String mainObserverId = contact.getMainObserver().getTopiaId();
- updateContactCommand.setMainObserverId(mainObserverId);
+ if (contact.getMainObserver() != null) {
+ String mainObserverId = contact.getMainObserver().getTopiaId();
+ updateContactCommand.setMainObserverId(mainObserverId);
+ }
+
Set<String> secondaryObserversTopiaIds = contact.getSecondaryObserversTopiaIds();
updateContactCommand.setSecondaryObserverIds(secondaryObserversTopiaIds);
@@ -355,23 +375,23 @@
Contact contactToUpdate = updateContactCommand.getContact();
+ // Prevent that someone who is not admin change data that only admin
+ // must be able to modify
+ if ( ! authenticatedWaoUser.isAdmin()) {
+ contact.setCommentAdmin(contactToUpdate.getCommentAdmin());
+ contact.setValidationProgram(contactToUpdate.getValidationProgram());
+ contact.setDataReliability(contactToUpdate.getDataReliability());
+ }
+
// TODO brendan 20/06/14 create to binders
Binder<Contact, Contact> binder = BinderFactory.newBinder(Contact.class);
binder.copyExcluding(contact, contactToUpdate, TopiaEntity.PROPERTY_TOPIA_ID, TopiaEntity.PROPERTY_TOPIA_VERSION,
TopiaEntity.PROPERTY_TOPIA_CREATE_DATE, Contact.PROPERTY_SAMPLE_ROW);
- // Prevent that someone who is not admin change data that only admin
- // must be able to modify
- if ( ! authenticatedWaoUser.isAdmin()) {
- contactToUpdate.setCommentAdmin(contact.getCommentAdmin());
- contactToUpdate.setValidationProgram(contact.getValidationProgram());
- contactToUpdate.setDataReliability(contact.getDataReliability());
- }
-
}
try {
- validate(authenticatedWaoUser, updateContactCommand, false);
+ validate(authenticatedWaoUser, updateContactCommand);
} catch (ContactNotUpdatableException e) {
String message = l(l, "wao.import.contact.failure.not.updatable", lineNumber);
throw new ImportErrorException(message);
@@ -502,8 +522,7 @@
}
public void validate(AuthenticatedWaoUser authenticatedWaoUser,
- UpdateContactCommand updateContactCommand,
- boolean needUpdate) throws
+ UpdateContactCommand updateContactCommand) throws
ContactNotUpdatableException,
MissingContactMainObserverException,
MismatchContactMainObserverCompanyException,
@@ -529,247 +548,232 @@
MissingContactDataReliabilityException,
MissingContactCommentAdminException, MissingContactTerrestrialLocationException, IllegalAcceptationException {
- if (needUpdate) {
- Preconditions.checkState(!updateContactCommand.isCreation());
- }
+ // Check if contact can be updated
+ boolean canUpdateContact = authenticatedWaoUser.isAuthorizedToEditContact(updateContactCommand.getContact())
+ || authenticatedWaoUser.isAuthorizedToChangeContactValidation();
- //FIXME Do some security checks about authenticatedWaoUser
-
- // Check if contact can be updated
- boolean canUpdateContact = updateContactCommand.canUpdateContact(authenticatedWaoUser);
- if (!canUpdateContact) {
+ if ( ! canUpdateContact) {
throw new ContactNotUpdatableException();
}
- // Check if a validation controls are required
- boolean mustValidateContact = updateContactCommand.mustValidateContact();
+ // Pass validation controls
+ Contact contact = updateContactCommand.getContact();
- if (mustValidateContact) {
+ Company company = contact.getSampleRow().getCompany();
- // Pass validation controls
- Contact contact = updateContactCommand.getContact();
+ WaoUser mainObserver = contact.getMainObserver();
- Company company = contact.getSampleRow().getCompany();
+ {
+ //---
+ // mainObserver
+ //---
- WaoUser mainObserver = contact.getMainObserver();
+ if (mainObserver == null) {
+ throw new MissingContactMainObserverException(contact);
+ }
- {
- //---
- // mainObserver
- //---
+ boolean observerWorksForCompanyInSampleRow = mainObserver.getCompany().equals(company);
+ if (!observerWorksForCompanyInSampleRow) {
+ throw new MismatchContactMainObserverCompanyException(contact, mainObserver, company);
+ }
+ }
- if (mainObserver == null) {
- throw new MissingContactMainObserverException(contact);
- }
+ if (contact.isSecondaryObserversNotEmpty()) {
- boolean observerWorksForCompanyInSampleRow = mainObserver.getCompany().equals(company);
+ //---
+ // secondaryObservers
+ //---
+
+ if (contact.getSecondaryObservers().contains(mainObserver)) {
+ throw new DuplicatedContactMainObserverInSecondaryObserversException(contact);
+ }
+
+ for (WaoUser observer : contact.getSecondaryObservers()) {
+ boolean observerWorksForCompanyInSampleRow = observer.getCompany().equals(company);
if (!observerWorksForCompanyInSampleRow) {
- throw new MismatchContactMainObserverCompanyException(contact, mainObserver, company);
+ throw new MismatchContactSecondaryObserverCompanyException(contact, observer, company);
}
}
+ }
- if (contact.isSecondaryObserversNotEmpty()) {
+ Date observationBeginDate = contact.getObservationBeginDate();
+ Date observationEndDate = contact.getObservationEndDate();
+ Date dataInputDate = contact.getDataInputDate();
- //---
- // secondaryObservers
- //---
+ SampleRow sampleRow = contact.getSampleRow();
- if (contact.getSecondaryObservers().contains(mainObserver)) {
- throw new DuplicatedContactMainObserverInSecondaryObserversException(contact);
- }
+ if (observationBeginDate != null) {
- for (WaoUser observer : contact.getSecondaryObservers()) {
- boolean observerWorksForCompanyInSampleRow = observer.getCompany().equals(company);
- if (!observerWorksForCompanyInSampleRow) {
- throw new MismatchContactSecondaryObserverCompanyException(contact, observer, company);
- }
- }
- }
+ //---
+ // observationBeginDate
+ //---
- Date observationBeginDate = contact.getObservationBeginDate();
- Date observationEndDate = contact.getObservationEndDate();
- Date dataInputDate = contact.getDataInputDate();
+ SampleMonth month = sampleRow.getSampleMonth(observationBeginDate);
+ boolean operationBeginDateIsValid = month != null;
- SampleRow sampleRow = contact.getSampleRow();
+ if (!operationBeginDateIsValid) {
+ throw new InvalidContactObservationBeginDateException(contact);
+ }
+ }
- if (observationBeginDate != null) {
+ Date currentDate = serviceContext.getNow();
- //---
- // observationBeginDate
- //---
+ if (observationEndDate != null) {
- SampleMonth month = sampleRow.getSampleMonth(observationBeginDate);
- boolean operationBeginDateIsValid = month != null;
+ //---
+ // observationEndDate
+ //---
- if (!operationBeginDateIsValid) {
- throw new InvalidContactObservationBeginDateException(contact);
- }
+ if (observationBeginDate != null
+ && observationEndDate.before(observationBeginDate)) {
+ throw new ContactObservationEndDateBeforeBeginDateException(contact);
}
- Date currentDate = serviceContext.getNow();
+ if (observationEndDate.after(currentDate)) {
+ throw new ContactObservationEndDateAfterTodayException(contact, currentDate);
+ }
+ }
+
+ if (dataInputDate != null) {
+
+ //---
+ // dataInputDate
+ //---
+
if (observationEndDate != null) {
- //---
- // observationEndDate
- //---
+ // Here, we check that the date input date is after the end of the
+ // observation. Since the first is a day (at 00:00) and the second
+ // is date-time, there may be a bug if the data input day is the same
+ // as the end of observation
+ boolean dataInputDateAfterObservationEndDate =
+ observationEndDate.after(DateUtil.setMaxTimeOfDay(dataInputDate));
- if (observationBeginDate != null
- && observationEndDate.before(observationBeginDate)) {
- throw new ContactObservationEndDateBeforeBeginDateException(contact);
+ if (dataInputDateAfterObservationEndDate) {
+ throw new ContactDataInputDateBeforeObservationEndDateException(contact);
}
+ }
- if (observationEndDate.after(currentDate)) {
- throw new ContactObservationEndDateAfterTodayException(contact, currentDate);
- }
-
+ if (dataInputDate.after(currentDate)) {
+ throw new ContactDataInputDateAfterTodayException(contact, currentDate);
}
+ }
- if (dataInputDate != null) {
+ //---
+ // contactState
+ //---
- //---
- // dataInputDate
- //---
+ ContactState contactState = contact.getContactState();
- if (observationEndDate != null) {
+ boolean contactMustHaveAMotif = false;
+ switch (contactState) {
+ case OBSERVATION_CANCELLED:
- // Here, we check that the date input date is after the end of the
- // observation. Since the first is a day (at 00:00) and the second
- // is date-time, there may be a bug if the data input day is the same
- // as the end of observation
- boolean dataInputDateAfterObservationEndDate =
- observationEndDate.after(DateUtil.setMaxTimeOfDay(dataInputDate));
+ // Non abouti
- if (dataInputDateAfterObservationEndDate) {
- throw new ContactDataInputDateBeforeObservationEndDateException(contact);
- }
+ if (StringUtils.isBlank(contact.getComment())) {
+ throw new MissingContactCommentException(contact);
}
+ break;
+ case OBSERVATION_DONE:
- if (dataInputDate.after(currentDate)) {
- throw new ContactDataInputDateAfterTodayException(contact, currentDate);
+ // Observation réalisée
+
+ if (observationBeginDate == null) {
+ throw new MissingContactObservationBeginDateException(contact);
}
- }
+ if (observationEndDate == null) {
+ throw new MissingContactObservationEndDateException(contact);
+ }
+ if (contact.getNbObservants() == 0) {
+ throw new MissingContactNbObservantsException(contact);
+ }
+ if (contact.getObsProgram().isObsVente() && contact.getTerrestrialLocation() == null) {
+ throw new MissingContactTerrestrialLocationException(contact);
+ }
+ break;
- //---
- // contactState
- //---
+ case CONTACT_REFUSED:
+ contactMustHaveAMotif = true;
+ break;
+ case CONTACT_DEFINITELY_REFUSED:
+ contactMustHaveAMotif = true;
+ break;
- ContactState contactState = contact.getContactState();
+ }
- boolean contactMustHaveAMotif = false;
- switch (contactState) {
- case OBSERVATION_CANCELLED:
+ //---
+ // contactStateMotif
+ //---
- // Non abouti
+ if (contactMustHaveAMotif && contact.getContactStateMotif() == null) {
+ throw new MissingContactStateMotifException(contact);
+ }
- if (StringUtils.isBlank(contact.getComment())) {
- throw new MissingContactCommentException(contact);
- }
- break;
- case OBSERVATION_DONE:
+ if (!contactMustHaveAMotif && contact.getContactStateMotif() != null) {
+ throw new UnwantedContactContactStateMotifException(contact);
+ }
- // Observation réalisée
+ if (contact.isMammalsCapture() && StringUtils.isBlank(contact.getMammalsInfo())) {
+ throw new MissingContactMammalsInfoException(contact);
+ }
- if (observationBeginDate == null) {
- throw new MissingContactObservationBeginDateException(contact);
- }
- if (observationEndDate == null) {
- throw new MissingContactObservationEndDateException(contact);
- }
- if (contact.getNbObservants() == 0) {
- throw new MissingContactNbObservantsException(contact);
- }
- if (contact.getObsProgram().isObsVente() && contact.getTerrestrialLocation() == null) {
- throw new MissingContactTerrestrialLocationException(contact);
- }
- break;
+ if (BooleanUtils.isTrue(contact.getValidationCompany())) {
- case CONTACT_REFUSED:
- contactMustHaveAMotif = true;
- break;
- case CONTACT_DEFINITELY_REFUSED:
- contactMustHaveAMotif = true;
- break;
-
- }
-
//---
- // contactStateMotif
+ // validationCompany
//---
- if (contactMustHaveAMotif && contact.getContactStateMotif() == null) {
- throw new MissingContactStateMotifException(contact);
+ if (ContactState.OBSERVATION_DONE == contactState) {
+ if (contact.getObsProgram().isObsMer() && contact.getObservedDataControl() == null) {
+ throw new MissingContactObservedDataControlException(contact);
+ } else if (ObservedDataControl.CORRECTION_ASKED.equals(contact.getObservedDataControl())) {
+ throw new ContactWithObservedDataControlToCorrectionAskedException(contact);
+ }
}
- if (!contactMustHaveAMotif && contact.getContactStateMotif() != null) {
- throw new UnwantedContactContactStateMotifException(contact);
+ // Pour valider un contact société, il faut que le contact aie une date de transmission
+ Date restitution = contact.getRestitution();
+ if (ObservedDataControl.ACCEPTED.equals(contact.getObservedDataControl()) && restitution == null) {
+ throw new MissingContactRestitutionException(contact);
}
-
- if (contact.isMammalsCapture() && StringUtils.isBlank(contact.getMammalsInfo())) {
- throw new MissingContactMammalsInfoException(contact);
+ if (dataInputDate == null && restitution != null) {
+ throw new MissingContactDataInputDateException(contact);
}
-
- if (BooleanUtils.isTrue(contact.getValidationCompany())) {
-
- //---
- // validationCompany
- //---
-
- if (ContactState.OBSERVATION_DONE == contactState) {
- if (contact.getObsProgram().isObsMer() && contact.getObservedDataControl() == null) {
- throw new MissingContactObservedDataControlException(contact);
- } else if (ObservedDataControl.CORRECTION_ASKED.equals(contact.getObservedDataControl())) {
- throw new ContactWithObservedDataControlToCorrectionAskedException(contact);
- }
- }
-
- // Pour valider un contact société, il faut que le contact aie une date de transmission
- Date restitution = contact.getRestitution();
- if (ObservedDataControl.ACCEPTED.equals(contact.getObservedDataControl()) && restitution == null) {
- throw new MissingContactRestitutionException(contact);
- }
- if (dataInputDate == null && restitution != null) {
- throw new MissingContactDataInputDateException(contact);
- }
- if (dataInputDate != null && restitution != null && restitution.before(dataInputDate)) {
- throw new ContactRestitutionDateBeforeDataInputDateException(contact);
- }
+ if (dataInputDate != null && restitution != null && restitution.before(dataInputDate)) {
+ throw new ContactRestitutionDateBeforeDataInputDateException(contact);
}
+ }
- if (contact.getValidationProgram() != null && contact.getValidationCompany() == null) {
+ if (contact.getValidationProgram() != null && contact.getValidationCompany() == null) {
- throw new IllegalAcceptationException(contact);
- }
+ throw new IllegalAcceptationException(contact);
+ }
- DataReliability dataReliability = contact.getDataReliability();
+ DataReliability dataReliability = contact.getDataReliability();
- if (dataReliability != null && dataReliability.isCommentRequired() && StringUtils.isBlank(contact.getCommentAdmin())) {
- throw new MissingContactCommentAdminException(contact);
- }
+ if (dataReliability != null && dataReliability.isCommentRequired() && StringUtils.isBlank(contact.getCommentAdmin())) {
+ throw new MissingContactCommentAdminException(contact);
+ }
- if (BooleanUtils.isTrue(contact.getValidationProgram())) {
+ if (BooleanUtils.isTrue(contact.getValidationProgram())) {
- //---
- // validationProgram
- //---
- if (contact.getObsProgram().isObsMer()) {
+ //---
+ // validationProgram
+ //---
+ if (contact.getObsProgram().isObsMer()) {
- // it's an admin validation, data-reliability field must be filled
- if (dataReliability == null || DataReliability.UNKNOWN == dataReliability) {
- throw new MissingContactDataReliabilityException(contact);
- }
+ // it's an admin validation, data-reliability field must be filled
+ if (dataReliability == null || DataReliability.UNKNOWN == dataReliability) {
+ throw new MissingContactDataReliabilityException(contact);
}
}
}
}
- public void save(UpdateContactCommand updateContactCommand,
- boolean needUpdate) throws ContactNotUpdatableException {
+ public void save(UpdateContactCommand updateContactCommand) throws ContactNotUpdatableException {
- if (needUpdate) {
- Preconditions.checkState(!updateContactCommand.isCreation());
- }
-
save0(updateContactCommand);
commit();
@@ -782,9 +786,11 @@
protected void notifyMammalsObservationIfNecessary(UpdateContactCommand updateContactCommand) {
- if (updateContactCommand.isMammalsInfosChanged()) {
+ // we send notifications if there is mammals Capture and
+ // we prevent re-send of multiple identical messages
+ Contact contact = updateContactCommand.getContact();
- Contact contact = updateContactCommand.getContact();
+ if (contact.isMammalsCapture() && updateContactCommand.isMammalsInfosChanged()) {
MammalsObservationEmail email = getEmailService().newMammalsObservationEmail();
email.setContact(contact);
Copied: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/NoEffortDefinedException.java (from rev 2227, branches/wao-4.0.x/wao-services/src/main/java/fr/ifremer/wao/services/service/NoEffortDefinedException.java)
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/NoEffortDefinedException.java (rev 0)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/NoEffortDefinedException.java 2014-08-27 15:46:57 UTC (rev 2228)
@@ -0,0 +1,10 @@
+package fr.ifremer.wao.services.service;
+
+import fr.ifremer.wao.entity.SampleRow;
+
+public class NoEffortDefinedException extends SampleRowValidationException {
+
+ public NoEffortDefinedException(SampleRow sampleRow) {
+ super(sampleRow);
+ }
+}
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/SamplingPlanService.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/SamplingPlanService.java 2014-08-27 15:24:12 UTC (rev 2227)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/SamplingPlanService.java 2014-08-27 15:46:57 UTC (rev 2228)
@@ -596,6 +596,9 @@
} catch (MissingDcf5CodesException e) {
String message = I18n.l(getLocale(), "wao.import.sampleRow.failure.missingDcf5Codes", lineNumber);
throw new ImportErrorException(message);
+ } catch (NoEffortDefinedException e) {
+ String message = I18n.l(getLocale(), "wao.import.sampleRow.failure.noEffortDefined", lineNumber);
+ throw new ImportErrorException(message);
}
save0(updateSampleRowCommand);
@@ -701,7 +704,8 @@
MissingProfessionSpeciesException,
SampleMonthWithIllegalExpectedTidesValueException,
MissingDcf5CodesException,
- SampleRowCodeMustBeUniqueException {
+ SampleRowCodeMustBeUniqueException,
+ NoEffortDefinedException {
SampleRow sampleRow = updateSampleRowCommand.getSampleRow();
@@ -714,7 +718,7 @@
}
if (updateSampleRowCommand.isCreation()) {
- if ( ! WaoUtils.getSampleRowCodePattern(sampleRow.getObsProgram()).matcher(sampleRow.getCode()).matches()) {
+ if ( ! sampleRow.getObsProgram().getSampleRowCodePattern().matcher(sampleRow.getCode()).matches()) {
throw new WrongSampleRowCodeFormatException(sampleRow);
}
} else {
@@ -745,6 +749,10 @@
}
}
+ if (sampleRow.isSampleMonthEmpty()) {
+ throw new NoEffortDefinedException(sampleRow);
+ }
+
for (SampleMonth sampleMonth : sampleRow.getSampleMonth()) {
if (sampleMonth.getExpectedTidesValue() < 0) {
throw new SampleMonthWithIllegalExpectedTidesValueException(sampleRow, sampleMonth);
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/SynthesisService.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/SynthesisService.java 2014-08-27 15:24:12 UTC (rev 2227)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/SynthesisService.java 2014-08-27 15:46:57 UTC (rev 2228)
@@ -235,7 +235,7 @@
dataset.setValue(expected, I18n.l(locale, "wao.synthesis.planned"), WaoUtils.formatMonth(locale, month));
}
String rowKey;
- if (filter.isRealVsEstimated()) {
+ if (filter.getRealVsEstimated()) {
rowKey = I18n.l(locale, "wao.ui.samplingPlan.Actual");
} else {
rowKey = I18n.l(locale, "wao.synthesis.estimated");
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/UpdateContactCommand.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/UpdateContactCommand.java 2014-08-27 15:24:12 UTC (rev 2227)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/UpdateContactCommand.java 2014-08-27 15:46:57 UTC (rev 2228)
@@ -22,10 +22,9 @@
*/
import com.google.common.base.Preconditions;
+import com.google.common.base.Strings;
import fr.ifremer.wao.entity.Contact;
import fr.ifremer.wao.entity.DataReliability;
-import fr.ifremer.wao.services.AuthenticatedWaoUser;
-import org.apache.commons.lang3.ObjectUtils;
import java.io.Serializable;
import java.util.HashSet;
@@ -51,8 +50,6 @@
protected Boolean oldValidationProgram;
- protected String oldMammalsInfo;
-
protected String mainObserverId;
protected Set<String> secondaryObserverIds = new HashSet<>();
@@ -61,6 +58,8 @@
protected String contactStateMotifId;
+ protected boolean mammalsInfosChanged;
+
public boolean isCreation() {
return creation;
}
@@ -85,7 +84,6 @@
this.contact = contact;
this.oldValidationCompany = contact.getValidationCompany();
this.oldValidationProgram = contact.getValidationProgram();
- this.oldMammalsInfo = contact.getMammalsInfo();
}
public Boolean getValidationCompany() {
@@ -116,56 +114,18 @@
}
public void setMammalsInfo(String mammalsInfo) {
+ String oldMessage = Strings.nullToEmpty(contact.getMammalsInfo());
+ String newMessage = Strings.nullToEmpty(mammalsInfo);
+ mammalsInfosChanged = ! oldMessage.equals(newMessage);
contact.setMammalsInfo(mammalsInfo);
}
/**
- * Check if the contact can be updated by the given connected user.
- *
- * @param authenticatedWaoUser the user who want to update the contact
- * @return {@code true} if contact can be updated
- */
- public boolean canUpdateContact(AuthenticatedWaoUser authenticatedWaoUser) {
- boolean contactCanBeUpdated = true;
- if (!isCreation() && authenticatedWaoUser.isCoordinatorOrObserver()) {
- contactCanBeUpdated = oldValidationProgram == null;
- }
- return contactCanBeUpdated;
- }
-
- /**
- * Check if the contact need to pass validation controls.
- *
- * @return {@code true} if the contact must be validated
- */
- public boolean mustValidateContact() {
- boolean needValidation = isCreation() || // new contact
- oldValidationProgram == null || // want to validate a contact
- getValidationProgram() != null; // want to validate a contact
- return needValidation;
- }
-
- /**
* Check if mammals informations has changed.
*
* @return {@code true} if mammal informations changed
*/
public boolean isMammalsInfosChanged() {
-
- boolean mammalsInfosChanged = false;
-
- // we send notifications if there is mammals Capture and
- // we prevent re-send of multiple identical messages
- if (contact.isMammalsCapture()) {
- String oldMessage = null;
- if (!isCreation()) {
- oldMessage = oldMammalsInfo;
- }
- boolean messageChanged = ObjectUtils.notEqual(contact.getMammalsInfo(), oldMessage);
- if (messageChanged) {
- mammalsInfosChanged = true;
- }
- }
return mammalsInfosChanged;
}
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/UpdateWaoUserCommand.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/UpdateWaoUserCommand.java 2014-08-27 15:24:12 UTC (rev 2227)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/UpdateWaoUserCommand.java 2014-08-27 15:46:57 UTC (rev 2228)
@@ -207,7 +207,7 @@
}
public void setProfessionalReadOnly(boolean professionalReadOnly) {
- updateUserProfile(UserRole.ADMIN, true, professionalReadOnly);
+ updateUserProfile(UserRole.PROFESSIONAL, true, professionalReadOnly);
}
public UpdateWaoUserCommandPasswordStrategy getPasswordStrategy() {
Property changes on: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/wao-1.5.x/wao-business/src/main/java/fr/ifremer/wao/io/csv2/models:679-733
/branches/wao-4.0-obsvente/wao-services/src/main/java/fr/ifremer/wao/services/service/csv:2075-2085
+ /branches/wao-1.5.x/wao-business/src/main/java/fr/ifremer/wao/io/csv2/models:679-733
/branches/wao-4.0-obsvente/wao-services/src/main/java/fr/ifremer/wao/services/service/csv:2075-2085
/branches/wao-4.0.x/wao-services/src/main/java/fr/ifremer/wao/services/service/csv:2169-2227
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-08-27 15:24:12 UTC (rev 2227)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/ContactImportExportModel.java 2014-08-27 15:46:57 UTC (rev 2228)
@@ -41,6 +41,8 @@
import fr.ifremer.wao.services.service.csv.operations.BoatParserFormatter;
import fr.ifremer.wao.services.service.csv.operations.CompanyParserFormatter;
import fr.ifremer.wao.services.service.csv.operations.ContactStateMotivesParserFormatter;
+import fr.ifremer.wao.services.service.csv.operations.DayParserFormatter;
+import fr.ifremer.wao.services.service.csv.operations.DayTimeParserFormatter;
import fr.ifremer.wao.services.service.csv.operations.I18nAbleParserFormatter;
import fr.ifremer.wao.services.service.csv.operations.SampleRowParserFormatter;
import fr.ifremer.wao.services.service.csv.operations.UserParserFormatter;
@@ -139,7 +141,7 @@
protected ModelBuilder<Contact> getModel() {
ModelBuilder<Contact> modelBuilder = new ModelBuilder<>();
modelBuilder.newColumnForImportExport("CONTACT_ID", Contact.PROPERTY_TOPIA_ID);
- modelBuilder.newColumnForImportExport("CONTACT_DATE_CREATION", Contact.PROPERTY_CREATION_DATE, Common.DAY_TIME);
+ modelBuilder.newColumnForImportExport("CONTACT_DATE_CREATION", Contact.PROPERTY_CREATION_DATE, new DayTimeParserFormatter(locale));
modelBuilder.newColumnForImportExport("CONTACT_OBSERVATEUR_PRINCIPAL", Contact.PROPERTY_MAIN_OBSERVER, new UserParserFormatter(locale, waoUsers));
modelBuilder.newColumnForImportExport("CONTACT_OBSERVATEURS_SECONDAIRES", Contact.PROPERTY_SECONDARY_OBSERVERS, new UsersParserFormatter(locale, waoUsers));
@@ -170,9 +172,9 @@
new CompanyParserFormatter(locale, null)
);
modelBuilder.newColumnForImportExport("CONTACT_ETAT", "contactState", new I18nAbleParserFormatter<>(locale, ContactState.getAllowedStates(obsProgram)));
- modelBuilder.newColumnForImportExport("CONTACT_DEBUT_OBSERVATION", Contact.PROPERTY_OBSERVATION_BEGIN_DATE, Common.DAY_TIME);
- modelBuilder.newColumnForImportExport("CONTACT_FIN_OBSERVATION", Contact.PROPERTY_OBSERVATION_END_DATE, Common.DAY_TIME);
- modelBuilder.newColumnForImportExport("CONTACT_SAISIE_DONNEES", Contact.PROPERTY_DATA_INPUT_DATE, Common.DAY);
+ modelBuilder.newColumnForImportExport("CONTACT_DEBUT_OBSERVATION", Contact.PROPERTY_OBSERVATION_BEGIN_DATE, new DayTimeParserFormatter(locale));
+ modelBuilder.newColumnForImportExport("CONTACT_FIN_OBSERVATION", Contact.PROPERTY_OBSERVATION_END_DATE, new DayTimeParserFormatter(locale));
+ modelBuilder.newColumnForImportExport("CONTACT_SAISIE_DONNEES", Contact.PROPERTY_DATA_INPUT_DATE, new DayParserFormatter(locale));
modelBuilder.newColumnForImportExport("CONTACT_COMMENTAIRE_OBSERVATEUR", Contact.PROPERTY_COMMENT);
modelBuilder.newColumnForImportExport("CONTACT_COMMENTAIRE_COORDINATEUR", Contact.PROPERTY_COMMENT_COORDINATOR);
modelBuilder.newColumnForImportExport("CONTACT_COMMENTAIRE_PROGRAMME", Contact.PROPERTY_COMMENT_ADMIN);
@@ -210,7 +212,7 @@
return name;
}
});
- modelBuilder.newColumnForImportExport("CONTACT_TRANSMISSION_RESTITUTION", Contact.PROPERTY_RESTITUTION, Common.DAY);
+ modelBuilder.newColumnForImportExport("CONTACT_TRANSMISSION_RESTITUTION", Contact.PROPERTY_RESTITUTION, new DayParserFormatter(locale));
Set<ObservedDataControl> observedDataControlsValues = new HashSet<>();
Collections.addAll(observedDataControlsValues, ObservedDataControl.values());
Copied: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/operations/DayParserFormatter.java (from rev 2227, branches/wao-4.0.x/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/operations/DayParserFormatter.java)
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/operations/DayParserFormatter.java (rev 0)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/operations/DayParserFormatter.java 2014-08-27 15:46:57 UTC (rev 2228)
@@ -0,0 +1,31 @@
+package fr.ifremer.wao.services.service.csv.operations;
+
+import fr.ifremer.wao.WaoUtils;
+import org.nuiton.csv.Common;
+import org.nuiton.i18n.I18n;
+
+import java.text.ParseException;
+import java.util.Date;
+import java.util.Locale;
+
+/**
+ * On vérifie que ce n'est pas une date absurde (l'an 14...)
+ */
+public class DayParserFormatter extends Common.DateValue {
+
+ protected Locale locale;
+
+ public DayParserFormatter(Locale locale) {
+ super("dd/MM/yyyy");
+ this.locale = locale;
+ }
+
+ @Override
+ public Date parse(String value) throws ParseException {
+ Date day = super.parse(value);
+ if (day != null && ! WaoUtils.isAfterWaoCreation(day)) {
+ throw new IllegalArgumentException(I18n.l(locale, "wao.import.failure.dateBeforeWaoCreation", value));
+ }
+ return day;
+ }
+}
Copied: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/operations/DayTimeParserFormatter.java (from rev 2227, branches/wao-4.0.x/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/operations/DayTimeParserFormatter.java)
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/operations/DayTimeParserFormatter.java (rev 0)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/operations/DayTimeParserFormatter.java 2014-08-27 15:46:57 UTC (rev 2228)
@@ -0,0 +1,31 @@
+package fr.ifremer.wao.services.service.csv.operations;
+
+import fr.ifremer.wao.WaoUtils;
+import org.nuiton.csv.Common;
+import org.nuiton.i18n.I18n;
+
+import java.text.ParseException;
+import java.util.Date;
+import java.util.Locale;
+
+/**
+ * On vérifie que ce n'est pas une date absurde (l'an 14...)
+ */
+public class DayTimeParserFormatter extends Common.DateValue {
+
+ protected Locale locale;
+
+ public DayTimeParserFormatter(Locale locale) {
+ super("dd/MM/yyyy HH:mm");
+ this.locale = locale;
+ }
+
+ @Override
+ public Date parse(String value) throws ParseException {
+ Date dayTime = super.parse(value);
+ if (dayTime != null && ! WaoUtils.isAfterWaoCreation(dayTime)) {
+ throw new IllegalArgumentException(I18n.l(locale, "wao.import.failure.dateBeforeWaoCreation", value));
+ }
+ return dayTime;
+ }
+}
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/operations/SampleRowCodeParserFormatter.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/operations/SampleRowCodeParserFormatter.java 2014-08-27 15:24:12 UTC (rev 2227)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/operations/SampleRowCodeParserFormatter.java 2014-08-27 15:46:57 UTC (rev 2228)
@@ -23,7 +23,6 @@
*/
package fr.ifremer.wao.services.service.csv.operations;
-import fr.ifremer.wao.WaoUtils;
import fr.ifremer.wao.entity.ObsProgram;
import org.apache.commons.lang3.StringUtils;
import org.nuiton.csv.ValueParserFormatter;
@@ -41,7 +40,7 @@
public SampleRowCodeParserFormatter(Locale locale, ObsProgram obsProgram) {
this.locale = locale;
- sampleRowCodePattern = WaoUtils.getSampleRowCodePattern(obsProgram);
+ sampleRowCodePattern = obsProgram.getSampleRowCodePattern();
}
@Override
Modified: trunk/wao-services/src/main/resources/i18n/wao-services_en_GB.properties
===================================================================
--- trunk/wao-services/src/main/resources/i18n/wao-services_en_GB.properties 2014-08-27 15:24:12 UTC (rev 2227)
+++ trunk/wao-services/src/main/resources/i18n/wao-services_en_GB.properties 2014-08-27 15:46:57 UTC (rev 2228)
@@ -74,6 +74,7 @@
wao.import.contact.failure.wrongSampleRowCode=The is no sample row with code '%s'
wao.import.contact.failure.wrongTerrestrialLocation=There is no location of type '%s' with code '%s'
wao.import.failure=Import fail for reason\: %s.
+wao.import.failure.dateBeforeWaoCreation=The is too old (before 2010-01-27)
wao.import.failure.invalid.regionCode=The code '%s' is not a valid region code
wao.import.failure.wrongLocationType='%s' is not a valid location type, allowed values are %s
wao.import.failure.wrongUser=There is no user with login '%s'
@@ -89,6 +90,7 @@
wao.import.sampleRow.failure.missingProfessionSpecies=Line %s\: For this sampling strategy, you must provide the species
wao.import.sampleRow.failure.missingProgramName=Line %s\: You must precise the program name
wao.import.sampleRow.failure.missingSampleRowCode=Line %s\: You must precise a code for the sample row
+wao.import.sampleRow.failure.noEffortDefined=Line %s\: You must precise effort
wao.import.sampleRow.failure.sampleMonthWithIllegalExpectedTidesValue=Line %s\: Effort must be positive for month %s
wao.import.sampleRow.failure.unknownFishingGearDcfCode=Unknown fishing gear code\: %s
wao.import.sampleRow.failure.unknownTargetSpeciesDcfCode=Unknown target species code\: %s
Modified: trunk/wao-services/src/main/resources/i18n/wao-services_fr_FR.properties
===================================================================
--- trunk/wao-services/src/main/resources/i18n/wao-services_fr_FR.properties 2014-08-27 15:24:12 UTC (rev 2227)
+++ trunk/wao-services/src/main/resources/i18n/wao-services_fr_FR.properties 2014-08-27 15:46:57 UTC (rev 2228)
@@ -72,6 +72,7 @@
wao.import.contact.failure.wrongSampleRowCode=Il n'y a pas de ligne du plan avec le code '%s'
wao.import.contact.failure.wrongTerrestrialLocation=Il n'y a pas de lieu de type '%s' ayant pour code '%s'
wao.import.failure=Une erreur est survenue lors de l'import \: %s.
+wao.import.failure.dateBeforeWaoCreation=La date est trop ancienne (avant le 27/01/2010)
wao.import.failure.invalid.regionCode=Le code '%s' n'est pas un code de région valide
wao.import.failure.wrongLocationType='%s' n'est pas un type de lieu valide, les valeurs admises sont %s
wao.import.failure.wrongUser=Il n'y a pas d'utilisateur ayant pour identifiant '%s'
@@ -87,6 +88,7 @@
wao.import.sampleRow.failure.missingProfessionSpecies=Ligne %s \: Il faut préciser les espèces cibles pour cette stratégie d'échantillonage
wao.import.sampleRow.failure.missingProgramName=Ligne %s \: Il faut préciser le programme
wao.import.sampleRow.failure.missingSampleRowCode=Ligne %s \: Il faut préciser un code pour a ligne du plan
+wao.import.sampleRow.failure.noEffortDefined=Ligne %s \: Il faut préciser un effort sur au moins un mois
wao.import.sampleRow.failure.sampleMonthWithIllegalExpectedTidesValue=Ligne %s \: l'effort d'observation doit être positif pour le mois %s
wao.import.sampleRow.failure.unknownFishingGearDcfCode=Le code engin %s est inconnu du référentiel
wao.import.sampleRow.failure.unknownTargetSpeciesDcfCode=Le code espèce cible %s est inconnu du référentiel
Modified: trunk/wao-services/src/test/java/fr/ifremer/wao/services/FakeWaoApplicationContext.java
===================================================================
--- trunk/wao-services/src/test/java/fr/ifremer/wao/services/FakeWaoApplicationContext.java 2014-08-27 15:24:12 UTC (rev 2227)
+++ trunk/wao-services/src/test/java/fr/ifremer/wao/services/FakeWaoApplicationContext.java 2014-08-27 15:46:57 UTC (rev 2228)
@@ -31,6 +31,8 @@
import fr.ifremer.wao.WaoTopiaPersistenceContext;
import fr.ifremer.wao.services.service.BoatsFilterValues;
import fr.ifremer.wao.services.service.BoatsFilterValuesCacheKey;
+import fr.ifremer.wao.services.service.ContactsFilterValues;
+import fr.ifremer.wao.services.service.ContactsFilterValuesCacheKey;
import fr.ifremer.wao.services.service.InitWaoService;
import fr.ifremer.wao.services.service.SamplingPlan;
import fr.ifremer.wao.services.service.SamplingPlanCacheKey;
@@ -73,6 +75,8 @@
protected Cache<BoatsFilterValuesCacheKey, BoatsFilterValues> boatsFilterValuesCache;
+ protected Cache<ContactsFilterValuesCacheKey, ContactsFilterValues> contactsFilterValuesCache;
+
protected Cache<ContactsFilter, Synthesis> synthesisCache;
public FakeWaoApplicationContext(String context, boolean initWithReferential) {
@@ -283,6 +287,14 @@
}
@Override
+ public Cache<ContactsFilterValuesCacheKey, ContactsFilterValues> getContactsFilterValuesCache() {
+ if (contactsFilterValuesCache == null) {
+ contactsFilterValuesCache = CacheBuilder.newBuilder().build();
+ }
+ return contactsFilterValuesCache;
+ }
+
+ @Override
public Cache<ContactsFilter, Synthesis> getSynthesesCache() {
if (synthesisCache == null) {
synthesisCache = CacheBuilder.newBuilder().build();
Modified: trunk/wao-web/src/main/java/fr/ifremer/wao/web/CacheInvalidationTopiaEntityListener.java
===================================================================
--- trunk/wao-web/src/main/java/fr/ifremer/wao/web/CacheInvalidationTopiaEntityListener.java 2014-08-27 15:24:12 UTC (rev 2227)
+++ trunk/wao-web/src/main/java/fr/ifremer/wao/web/CacheInvalidationTopiaEntityListener.java 2014-08-27 15:46:57 UTC (rev 2228)
@@ -71,6 +71,13 @@
protected boolean invalidateAllContacts = false;
+ /**
+ * On désactive pour se reposer uniquement sur l'invalidation au bout d'un certain temps.
+ * @deprecated le temps du test en prod pour voir si ça améliore mais si on garde, à refactorer
+ */
+ @Deprecated
+ protected boolean boatsFilterValuesCacheInvalidationEnabled = false;
+
public CacheInvalidationTopiaEntityListener(
Cache<SamplingPlanCacheKey, SamplingPlan> samplingPlansCache,
Cache<BoatsFilterValuesCacheKey, BoatsFilterValues> boatsFilterValuesCache,
@@ -139,7 +146,7 @@
if (log.isTraceEnabled()) {
log.trace("will commit for entities " + event.getEntities());
}
- if (invalidateAllSampleRows || dirtySampleRowIds.size() > 20) {
+ if (invalidateAllSampleRows) {
samplingPlansCache.invalidateAll();
synthesesCache.invalidateAll();
} else {
@@ -158,8 +165,10 @@
}
synthesesCache.invalidateAll(synthesesCacheKeysToInvalidate);
}
- if (invalidateAllBoats || dirtyBoatIds.size() > 20) {
- boatsFilterValuesCache.invalidateAll();
+ if (invalidateAllBoats) {
+ if (boatsFilterValuesCacheInvalidationEnabled) {
+ boatsFilterValuesCache.invalidateAll();
+ }
} else {
Set<BoatsFilterValuesCacheKey> boatsFilterValuesCacheKeysToInvalidate = new HashSet<>();
for (Map.Entry<BoatsFilterValuesCacheKey, BoatsFilterValues> entry : boatsFilterValuesCache.asMap().entrySet()) {
@@ -167,7 +176,9 @@
boatsFilterValuesCacheKeysToInvalidate.add(entry.getKey());
}
}
- boatsFilterValuesCache.invalidateAll(boatsFilterValuesCacheKeysToInvalidate);
+ if (boatsFilterValuesCacheInvalidationEnabled) {
+ boatsFilterValuesCache.invalidateAll(boatsFilterValuesCacheKeysToInvalidate);
+ }
}
clear();
}
Modified: trunk/wao-web/src/main/java/fr/ifremer/wao/web/DefaultWaoApplicationContext.java
===================================================================
--- trunk/wao-web/src/main/java/fr/ifremer/wao/web/DefaultWaoApplicationContext.java 2014-08-27 15:24:12 UTC (rev 2227)
+++ trunk/wao-web/src/main/java/fr/ifremer/wao/web/DefaultWaoApplicationContext.java 2014-08-27 15:46:57 UTC (rev 2228)
@@ -34,11 +34,12 @@
import fr.ifremer.wao.services.WaoWebApplicationContext;
import fr.ifremer.wao.services.service.BoatsFilterValues;
import fr.ifremer.wao.services.service.BoatsFilterValuesCacheKey;
+import fr.ifremer.wao.services.service.ContactsFilterValues;
+import fr.ifremer.wao.services.service.ContactsFilterValuesCacheKey;
import fr.ifremer.wao.services.service.InitWaoService;
-import fr.ifremer.wao.services.service.ObsMerSamplingPlan;
import fr.ifremer.wao.services.service.SamplingPlan;
+import fr.ifremer.wao.services.service.SamplingPlanCacheKey;
import fr.ifremer.wao.services.service.Synthesis;
-import fr.ifremer.wao.services.service.SamplingPlanCacheKey;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.log4j.LogManager;
@@ -74,6 +75,8 @@
protected Cache<ContactsFilter, Synthesis> synthesesCache;
+ protected Cache<ContactsFilterValuesCacheKey, ContactsFilterValues> contactsFilterValuesCache;
+
@Override
public WaoApplicationConfig getApplicationConfig() {
if (applicationConfig == null) {
@@ -127,7 +130,7 @@
@Override
public Cache<BoatsFilterValuesCacheKey, BoatsFilterValues> getBoatsFilterValuesCache() {
if (boatsFilterValuesCache == null) {
- boatsFilterValuesCache = newCacheBuilder(100).expireAfterAccess(30, TimeUnit.DAYS).build();
+ boatsFilterValuesCache = newCacheBuilder(100).expireAfterWrite(18, TimeUnit.HOURS).build();
}
return boatsFilterValuesCache;
}
@@ -140,6 +143,14 @@
return synthesesCache;
}
+ @Override
+ public Cache<ContactsFilterValuesCacheKey, ContactsFilterValues> getContactsFilterValuesCache() {
+ if (contactsFilterValuesCache == null) {
+ contactsFilterValuesCache = newCacheBuilder(100).expireAfterWrite(18, TimeUnit.HOURS).build();
+ }
+ return contactsFilterValuesCache;
+ }
+
protected <K, V> CacheBuilder<K, V> newCacheBuilder(int expectedMaximumCacheSize) {
int maximumCacheSize = applicationConfig.isCachingEnabled() ? expectedMaximumCacheSize : 0;
CacheBuilder<K, V> cacheBuilder = (CacheBuilder<K, V>) CacheBuilder.newBuilder().maximumSize(maximumCacheSize);
@@ -187,6 +198,8 @@
if (log.isInfoEnabled()) {
log.info("samplingPlansCache stats: " + getSamplingPlansCache().stats().toString());
log.info("boatsFilterValuesCache stats: " + getBoatsFilterValuesCache().stats().toString());
+ log.info("contactsFilterValuesCache stats: " + getContactsFilterValuesCache().stats().toString());
+ log.info("synthesesCache stats: " + getSynthesesCache().stats().toString());
}
if (topiaApplicationContext != null) {
Modified: trunk/wao-web/src/main/java/fr/ifremer/wao/web/WaoInterceptor.java
===================================================================
--- trunk/wao-web/src/main/java/fr/ifremer/wao/web/WaoInterceptor.java 2014-08-27 15:24:12 UTC (rev 2227)
+++ trunk/wao-web/src/main/java/fr/ifremer/wao/web/WaoInterceptor.java 2014-08-27 15:46:57 UTC (rev 2228)
@@ -146,6 +146,15 @@
return invocation.invoke();
+ } catch (Throwable t) {
+
+ // TODO brendan 21/07/14 use try with resources
+ if (serviceContext != null) {
+ serviceContext.getPersistenceContext().rollback();
+ }
+
+ throw t;
+
} finally {
// TODO brendan 21/07/14 use try with resources
Modified: trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/AbstractImportCsvAction.java
===================================================================
--- trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/AbstractImportCsvAction.java 2014-08-27 15:24:12 UTC (rev 2227)
+++ trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/AbstractImportCsvAction.java 2014-08-27 15:46:57 UTC (rev 2228)
@@ -79,6 +79,10 @@
csvInputStream = new FileInputStream(csvFile);
+ if (log.isInfoEnabled()) {
+ log.info(getAuthenticatedWaoUser().getWaoUser() + " is doing a csv import in action " + this);
+ }
+
importCsv(csvInputStream);
session.addMessage(getSuccessMessage());
Modified: trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/EditContactAction.java
===================================================================
--- trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/EditContactAction.java 2014-08-27 15:24:12 UTC (rev 2227)
+++ trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/EditContactAction.java 2014-08-27 15:46:57 UTC (rev 2228)
@@ -68,6 +68,8 @@
import fr.ifremer.wao.services.service.administration.ReferentialService;
import fr.ifremer.wao.services.service.administration.WaoUsersService;
import fr.ifremer.wao.web.WaoJspActionSupport;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;
@@ -91,6 +93,8 @@
private static final long serialVersionUID = 1L;
+ private static final Log log = LogFactory.getLog(EditContactAction.class);
+
/**
* Id of contact to edit.
*/
@@ -146,51 +150,30 @@
}
public Map<String, String> getObservers() {
- if (observers == null) {
- prepare();
- }
return observers;
}
public Map<ContactState, String> getContactStates() {
- if (contactStates == null) {
- prepare();
- }
return contactStates;
}
public Map<String, String> getContactStateMotives() {
- if (contactStateMotives == null) {
- prepare();
- }
return contactStateMotives;
}
public Map<ObservedDataControl, String> getObservedDataControls() {
- if (observedDataControls == null) {
- prepare();
- }
return observedDataControls;
}
public Map<DataReliability, String> getDataReliabilities() {
- if (dataReliabilities == null) {
- prepare();
- }
return dataReliabilities;
}
public Map<String, String> getTerrestrialLocations() {
- if (terrestrialLocations == null) {
- prepare();
- }
return terrestrialLocations;
}
public Map<SamplingStrategy, String> getSamplingStrategies() {
- if (samplingStrategies == null) {
- prepare();
- }
return samplingStrategies;
}
@@ -260,7 +243,7 @@
AuthenticatedWaoUser authenticatedWaoUser = session.getAuthenticatedWaoUser();
try {
- service.validate(authenticatedWaoUser, updateContactCommand, true);
+ service.validate(authenticatedWaoUser, updateContactCommand);
} catch (ContactNotUpdatableException e) {
session.addErrorMessages(t("wao.ui.contacts.validation.failure.not.updatable"));
@@ -352,7 +335,7 @@
@Override
public String execute() throws Exception {
- service.save(updateContactCommand, false);
+ service.save(updateContactCommand);
session.addMessage(t("wao.ui.form.updateContactCommand.success"));
Modified: trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/EditSampleRowAction.java
===================================================================
--- trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/EditSampleRowAction.java 2014-08-27 15:24:12 UTC (rev 2227)
+++ trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/EditSampleRowAction.java 2014-08-27 15:46:57 UTC (rev 2228)
@@ -34,6 +34,7 @@
import fr.ifremer.wao.services.service.MissingProfessionSpeciesException;
import fr.ifremer.wao.services.service.MissingProgramNameException;
import fr.ifremer.wao.services.service.MissingSampleRowLogCommentException;
+import fr.ifremer.wao.services.service.NoEffortDefinedException;
import fr.ifremer.wao.services.service.ObsMerSamplingPlanService;
import fr.ifremer.wao.services.service.SampleMonthWithIllegalExpectedTidesValueException;
import fr.ifremer.wao.services.service.SampleRowCodeMustBeUniqueException;
@@ -121,6 +122,8 @@
addFieldError("updateSampleRowCommand.sampleRow.programName", t("wao.ui.form.SampleRow.error.missingProgramName"));
} catch (MissingDcf5CodesException e) {
addFieldError("updateSampleRowCommand.dcf5Codes", t("wao.ui.form.SampleRow.error.missingDcf5Codes"));
+ } catch (NoEffortDefinedException e) {
+ addFieldError("updateSampleRowCommand.dcf5Codes", t("wao.ui.form.SampleRow.error.noEffortDefined"));
}
}
Modified: trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/ValidateContactJsonAction.java
===================================================================
--- trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/ValidateContactJsonAction.java 2014-08-27 15:24:12 UTC (rev 2227)
+++ trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/ValidateContactJsonAction.java 2014-08-27 15:46:57 UTC (rev 2228)
@@ -135,8 +135,6 @@
Preconditions.checkState(StringUtils.isNotEmpty(contactId));
- AuthenticatedWaoUser authenticatedWaoUser = session.getAuthenticatedWaoUser();
-
try {
updateContactCommand = service.newUpdateContactCommand(
session.getAuthenticatedWaoUser(),
@@ -144,21 +142,31 @@
} catch (UnknownContactIdException e) {
addActionError(t("wao.ui.error.unknownContactId"));
}
+ }
+ @Override
+ public String execute() {
+
+ AuthenticatedWaoUser authenticatedWaoUser = session.getAuthenticatedWaoUser();
+
+ if (log.isInfoEnabled()) {
+ log.info("user " + authenticatedWaoUser + " wants to change validation for contact " + contactId);
+ }
+
if (authenticatedWaoUser.isAdmin()) {
updateContactCommand.setValidationProgram(validationState);
+ if (log.isInfoEnabled()) {
+ log.info("setting contact validation program to " + validationState);
+ }
} else {
updateContactCommand.setValidationCompany(validationState);
+ if (log.isInfoEnabled()) {
+ log.info("setting contact validation company to " + validationState);
+ }
}
- }
- @Override
- public String execute() {
-
- AuthenticatedWaoUser authenticatedWaoUser = session.getAuthenticatedWaoUser();
-
try {
- service.validate(authenticatedWaoUser, updateContactCommand, true);
+ service.validate(authenticatedWaoUser, updateContactCommand);
} catch (ContactNotUpdatableException e) {
session.addErrorMessages(t("wao.ui.contacts.validation.failure.not.updatable"));
@@ -251,10 +259,15 @@
if (isSuccessful()) {
try {
- service.save(updateContactCommand, true);
+ service.save(updateContactCommand);
} catch (ContactNotUpdatableException e) {
throw new WaoTechnicalException("should never occur", e);
}
+
+ if (log.isInfoEnabled()) {
+ log.info("changing validation state successful");
+ }
+
if (validationState == null) {
successMessage = t("wao.ui.contacts.validation.to.unvalidate.state.success");
} else if (validationState) {
@@ -262,6 +275,11 @@
} else {
successMessage = t("wao.ui.contacts.validation.to.reject.state.success");
}
+
+ } else {
+ if (log.isInfoEnabled()) {
+ log.info("changing validation state failed for reason " + errorMessage);
+ }
}
return SUCCESS;
Modified: trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/administration/EditWaoUserAction.java
===================================================================
--- trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/administration/EditWaoUserAction.java 2014-08-27 15:24:12 UTC (rev 2227)
+++ trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/administration/EditWaoUserAction.java 2014-08-27 15:46:57 UTC (rev 2228)
@@ -89,12 +89,12 @@
if ( ! updateWaoUserCommand.getClearPassword().equals(updateWaoUserCommand.getClearPasswordConfirmation())) {
addFieldError("updateWaoUserCommand.clearPasswordConfirmation", t("wao.ui.form.updateWaoUserCommand.passwordMismatch"));
}
- } else if (updateWaoUserCommand.getPasswordStrategy().isGeneratePassword()) {
- if ( ! StringUtil.isEmail(updateWaoUserCommand.getWaoUser().getLogin())) {
- addFieldError("updateWaoUserCommand.waoUser.login", t("wao.ui.form.updateWaoUserCommand.loginMustBeEmail"));
- }
}
+ if ( ! StringUtil.isEmail(updateWaoUserCommand.getWaoUser().getLogin())) {
+ addFieldError("updateWaoUserCommand.waoUser.login", t("wao.ui.form.updateWaoUserCommand.loginMustBeEmail"));
+ }
+
if (updateWaoUserCommand.getCompanyId() == null) {
addFieldError("updateWaoUserCommand.companyId", t("wao.ui.form.updateWaoUserCommand.requiredCompany"));
}
Modified: trunk/wao-web/src/main/java/fr/ifremer/wao/web/converter/AbstractDateConverter.java
===================================================================
--- trunk/wao-web/src/main/java/fr/ifremer/wao/web/converter/AbstractDateConverter.java 2014-08-27 15:24:12 UTC (rev 2227)
+++ trunk/wao-web/src/main/java/fr/ifremer/wao/web/converter/AbstractDateConverter.java 2014-08-27 15:46:57 UTC (rev 2228)
@@ -78,7 +78,7 @@
}
- if ( ! ImmutableSet.of(Locale.FRENCH, Locale.ENGLISH).contains(locale)) {
+ if ( ! ImmutableSet.of(Locale.FRENCH, Locale.ENGLISH, Locale.FRANCE).contains(locale)) {
if (log.isWarnEnabled()) {
log.warn("locale " + locale + " is not french nor english, will default to french");
}
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-08-27 15:24:12 UTC (rev 2227)
+++ trunk/wao-web/src/main/resources/i18n/wao-web_en_GB.properties 2014-08-27 15:46:57 UTC (rev 2228)
@@ -319,6 +319,7 @@
wao.ui.form.SampleRow.error.missingPeriodEnd=You must define the month when the observations ends
wao.ui.form.SampleRow.error.missingProfessionSpecies=You must define the target species
wao.ui.form.SampleRow.error.missingProgramName=You must provide the program name
+wao.ui.form.SampleRow.error.noEffortDefined=You must provide the effort
wao.ui.form.SampleRow.error.sampleMonthWithIllegalExpectedTidesValue=Effort for month %s must be positive
wao.ui.form.SampleRow.error.unknownFishingGearDcfCode=Unknown fishing gear code\: %s
wao.ui.form.SampleRow.error.unknownTargetSpeciesDcfCode=Unknown target species code\: %s
@@ -501,6 +502,7 @@
wao.ui.samplingPlan.averageTideTime=Average tide time (d.)
wao.ui.samplingPlan.effort=Observation effort
wao.ui.samplingPlan.effort.obsVente=Observation effort
+wao.ui.samplingPlan.effort.tip=There is a difference between "0" as effort and leave it empty. O means that no effort is asked to the observers but they can still create contacts for this month. Leaving the field empty makes impossible for the observers to create contacts for this months.
wao.ui.samplingPlan.estimated=estimated
wao.ui.samplingPlan.expected=expected
wao.ui.samplingPlan.export=Export the sampling plan from %s to %s
Property changes on: trunk/wao-web/src/main/resources/i18n/wao-web_en_GB.properties
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/wao-1.5.x/wao-ui/src/main/resources/i18n/wao-ui_en_GB.properties:679-733
/branches/wao-4.0-obsvente/wao-web/src/main/resources/i18n/wao-web_en_GB.properties:2075-2085
+ /branches/wao-1.5.x/wao-ui/src/main/resources/i18n/wao-ui_en_GB.properties:679-733
/branches/wao-4.0-obsvente/wao-web/src/main/resources/i18n/wao-web_en_GB.properties:2075-2085
/branches/wao-4.0.x/wao-web/src/main/resources/i18n/wao-web_en_GB.properties:2169-2227
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-08-27 15:24:12 UTC (rev 2227)
+++ trunk/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties 2014-08-27 15:46:57 UTC (rev 2228)
@@ -320,6 +320,7 @@
wao.ui.form.SampleRow.error.missingPeriodEnd=Il faut préciser le mois auquel se termine la période d'observation
wao.ui.form.SampleRow.error.missingProfessionSpecies=Il faut préciser les espèces cibles
wao.ui.form.SampleRow.error.missingProgramName=Il faut préciser le nom du programme
+wao.ui.form.SampleRow.error.noEffortDefined=Il faut préciser un effort sur un moins un mois
wao.ui.form.SampleRow.error.sampleMonthWithIllegalExpectedTidesValue=Il faut donner un effort positif pour le mois %s
wao.ui.form.SampleRow.error.unknownFishingGearDcfCode=Le code engin %s est inconnu du référentiel
wao.ui.form.SampleRow.error.unknownTargetSpeciesDcfCode=Le code espèce cible %s est inconnu du référentiel
@@ -502,6 +503,7 @@
wao.ui.samplingPlan.averageTideTime=Durée moyenne d'une marée (J.)
wao.ui.samplingPlan.effort=Effort d'observation en nombre de marées
wao.ui.samplingPlan.effort.obsVente=Effort d'observation en nombre de sorties
+wao.ui.samplingPlan.effort.tip=Il y a une différence entre saisir « 0 » comme effort mensuel et laisser la case vide. Si vous indiquez un effort de 0, aucun effort n'est demandé aux observateurs mais ils pourront tout de même saisir un contact. Si vous laissez la case vide, les observateurs ne pourront pas créer de contacts pour ce mois.
wao.ui.samplingPlan.estimated=estimé
wao.ui.samplingPlan.expected=planifié
wao.ui.samplingPlan.export=Exporter le plan d'échantillonnage du %s au %s
Property changes on: trunk/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/wao-1.5.x/wao-ui/src/main/resources/i18n/wao-ui_fr_FR.properties:679-733
/branches/wao-4.0-obsvente/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties:2075-2085
+ /branches/wao-1.5.x/wao-ui/src/main/resources/i18n/wao-ui_fr_FR.properties:679-733
/branches/wao-4.0-obsvente/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties:2075-2085
/branches/wao-4.0.x/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties:2169-2227
Modified: trunk/wao-web/src/main/webapp/WEB-INF/content/authentication/login.jsp
===================================================================
--- trunk/wao-web/src/main/webapp/WEB-INF/content/authentication/login.jsp 2014-08-27 15:24:12 UTC (rev 2227)
+++ trunk/wao-web/src/main/webapp/WEB-INF/content/authentication/login.jsp 2014-08-27 15:46:57 UTC (rev 2228)
@@ -27,6 +27,11 @@
<title>
<s:text name="wao.ui.form.authentication.title" />
</title>
+ <script>
+ $(document).ready(function () {
+ $('input[name="login"]').focus();
+ });
+ </script>
</head>
<body>
Modified: trunk/wao-web/src/main/webapp/WEB-INF/content/edit-contact-input.jsp
===================================================================
--- trunk/wao-web/src/main/webapp/WEB-INF/content/edit-contact-input.jsp 2014-08-27 15:24:12 UTC (rev 2227)
+++ trunk/wao-web/src/main/webapp/WEB-INF/content/edit-contact-input.jsp 2014-08-27 15:46:57 UTC (rev 2228)
@@ -155,7 +155,7 @@
<s:text name="wao.ui.field.Boat.boatLength"/>
</th>
<td>
- <s:property value="%{'' + updateContactCommand.contact.boat.boatLength}"/>
+ <s:property value="%{'' + updateContactCommand.contact.boat.boatLength}"/> cm.
</td>
</tr>
<tr>
@@ -175,6 +175,14 @@
<tbody>
<tr>
<th>
+ <s:text name="wao.ui.field.SampleRow.code"/>
+ </th>
+ <td>
+ <s:property value="updateContactCommand.contact.sampleRow.code"/>
+ </td>
+ </tr>
+ <tr>
+ <th>
<s:text name="wao.ui.field.SampleRow.profession"/>
</th>
<td>
@@ -217,7 +225,8 @@
<s:hidden name="contactId" value="%{contactId}"/>
- <fieldset>
+ <%--Do not remove the id (use by contacts page)--%>
+ <fieldset id="coordinatorOrObserverFocus">
<legend><s:text name="wao.ui.misc.observers"/></legend>
<s:select name="updateContactCommand.mainObserverId"
@@ -240,8 +249,7 @@
</fieldset>
- <%--Do not remove the id (use by contacts page)--%>
- <fieldset id="coordinatorOrObserverFocus">
+ <fieldset>
<legend><s:text name="wao.ui.misc.observationReport"/></legend>
<s:textfield name="updateContactCommand.contact.observationBeginDate"
@@ -306,7 +314,7 @@
disabled="%{!#editObservationReport}"/>
<div id="mammalsInfo">
- <s:textarea name="updateContactCommand.contact.mammalsInfo"
+ <s:textarea name="updateContactCommand.mammalsInfo"
label="%{getText('wao.ui.field.Contact.mammalsInfo')}"
disabled="%{!#editObservationReport}"/>
<div class="alert">
Modified: trunk/wao-web/src/main/webapp/WEB-INF/content/edit-sample-row-input.jsp
===================================================================
--- trunk/wao-web/src/main/webapp/WEB-INF/content/edit-sample-row-input.jsp 2014-08-27 15:24:12 UTC (rev 2227)
+++ trunk/wao-web/src/main/webapp/WEB-INF/content/edit-sample-row-input.jsp 2014-08-27 15:46:57 UTC (rev 2228)
@@ -68,7 +68,7 @@
});
$(months).each(function (index, month) {
var value = "";
- if (expectedObservationsByMonths[month]) {
+ if (expectedObservationsByMonths[month] != null) {
value = expectedObservationsByMonths[month];
}
var newInput = ' <td>'
@@ -206,7 +206,9 @@
</div>
</div>
-
+ <div class="alert">
+ <s:text name="wao.ui.samplingPlan.effort.tip" />
+ </div>
</fieldset>
<fieldset>
Modified: trunk/wao-web/src/main/webapp/wao.js
===================================================================
--- trunk/wao-web/src/main/webapp/wao.js 2014-08-27 15:24:12 UTC (rev 2227)
+++ trunk/wao-web/src/main/webapp/wao.js 2014-08-27 15:46:57 UTC (rev 2228)
@@ -611,7 +611,10 @@
// FIXME brendan 07/04/14 cannot enable select2 because we can't bind blur event without driving the application crazy, see https://github.com/ivaynberg/select2/issues/2193
//$('select').addClass('input-xlarge').select2();
- $('select.select2').select2();
+ var $select2Inputs = $('select.select2');
+ if ($select2Inputs.length > 0) {
+ $select2Inputs.select2();
+ }
WAO = new Wao();
1
0
The Wao team is pleased to announce the wao-4.0.9 release!
Application pour le suivi contractuels d'observations scientifiques de la pêche
Documentation of the project can be found here:
http://doc.codelutin.com/wao
Changes
-------
Changes in this version include:
Fixed Bugs:
o Le filtre des contacts "filtrer selon la date de début d'observation" prend JJ/MM/AAAA 00:00 au lieu de JJ/MM/AAAA 23:59 Issue: 5637. Thanks to Vincent BADTS. Resolved by bleny.
o Impossible de saisir une marée lorsque le mois du plan est vide (pas de marées prévues) Issue: 5550. Thanks to Anne-Sophie Cornou. Resolved by bleny.
Downloads
---------
For a manual installation, you can download files here:
http://forge.codelutin.com/projects/wao/files
* wao-4.0.9.war - http://forge.codelutin.com/attachments/download/2193
Maven artifacts
---------------
Artifacts are deployed in nuiton maven repository
http://maven.nuiton.org/other-releases/
Have fun!
-Wao team
1
0
r2227 - in branches/wao-4.0.x: . wao-persistence wao-services wao-web
by maven-release@users.forge.codelutin.com 27 Aug '14
by maven-release@users.forge.codelutin.com 27 Aug '14
27 Aug '14
Author: maven-release
Date: 2014-08-27 17:24:12 +0200 (Wed, 27 Aug 2014)
New Revision: 2227
Url: http://forge.codelutin.com/projects/wao/repository/revisions/2227
Log:
[maven-release-plugin] prepare for next development iteration
Modified:
branches/wao-4.0.x/pom.xml
branches/wao-4.0.x/wao-persistence/pom.xml
branches/wao-4.0.x/wao-services/pom.xml
branches/wao-4.0.x/wao-web/pom.xml
Modified: branches/wao-4.0.x/pom.xml
===================================================================
--- branches/wao-4.0.x/pom.xml 2014-08-27 15:24:07 UTC (rev 2226)
+++ branches/wao-4.0.x/pom.xml 2014-08-27 15:24:12 UTC (rev 2227)
@@ -10,7 +10,7 @@
<groupId>fr.ifremer</groupId>
<artifactId>wao</artifactId>
- <version>4.0.9</version>
+ <version>4.0.10-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Wao</name>
@@ -86,9 +86,9 @@
</modules>
<scm>
- <connection>scm:svn:http://svn.codelutin.com/wao/tags/wao-4.0.9</connection>
- <developerConnection>scm:svn:https://svn.codelutin.com/wao/tags/wao-4.0.9</developerConnection>
- <url>https://forge.codelutin.com/repositories/browse/wao/tags/wao-4.0.9</url>
+ <connection>scm:svn:http://svn.codelutin.com/wao/branches/wao-4.0.x</connection>
+ <developerConnection>scm:svn:https://svn.codelutin.com/wao/branches/wao-4.0.x</developerConnection>
+ <url>https://forge.codelutin.com/repositories/browse/wao/branches/wao-4.0.x</url>
</scm>
<properties>
Modified: branches/wao-4.0.x/wao-persistence/pom.xml
===================================================================
--- branches/wao-4.0.x/wao-persistence/pom.xml 2014-08-27 15:24:07 UTC (rev 2226)
+++ branches/wao-4.0.x/wao-persistence/pom.xml 2014-08-27 15:24:12 UTC (rev 2227)
@@ -5,7 +5,7 @@
<parent>
<groupId>fr.ifremer</groupId>
<artifactId>wao</artifactId>
- <version>4.0.9</version>
+ <version>4.0.10-SNAPSHOT</version>
</parent>
<artifactId>wao-persistence</artifactId>
Modified: branches/wao-4.0.x/wao-services/pom.xml
===================================================================
--- branches/wao-4.0.x/wao-services/pom.xml 2014-08-27 15:24:07 UTC (rev 2226)
+++ branches/wao-4.0.x/wao-services/pom.xml 2014-08-27 15:24:12 UTC (rev 2227)
@@ -5,7 +5,7 @@
<parent>
<groupId>fr.ifremer</groupId>
<artifactId>wao</artifactId>
- <version>4.0.9</version>
+ <version>4.0.10-SNAPSHOT</version>
</parent>
<artifactId>wao-services</artifactId>
Modified: branches/wao-4.0.x/wao-web/pom.xml
===================================================================
--- branches/wao-4.0.x/wao-web/pom.xml 2014-08-27 15:24:07 UTC (rev 2226)
+++ branches/wao-4.0.x/wao-web/pom.xml 2014-08-27 15:24:12 UTC (rev 2227)
@@ -5,7 +5,7 @@
<parent>
<groupId>fr.ifremer</groupId>
<artifactId>wao</artifactId>
- <version>4.0.9</version>
+ <version>4.0.10-SNAPSHOT</version>
</parent>
<artifactId>wao-web</artifactId>
1
0
Author: maven-release
Date: 2014-08-27 17:24:07 +0200 (Wed, 27 Aug 2014)
New Revision: 2226
Url: http://forge.codelutin.com/projects/wao/repository/revisions/2226
Log:
[maven-release-plugin] copy for tag wao-4.0.9
Added:
tags/wao-4.0.9/
Property changes on: tags/wao-4.0.9
___________________________________________________________________
Added: svn:mergeinfo
+ /branches/wao-4.0-obsvente:2075-2085
Added: svn:ignore
+ *.idea
*.iml
target
atlassian-ide-plugin.xml
1
0
r2225 - in branches/wao-4.0.x: . wao-persistence wao-services wao-web
by maven-release@users.forge.codelutin.com 27 Aug '14
by maven-release@users.forge.codelutin.com 27 Aug '14
27 Aug '14
Author: maven-release
Date: 2014-08-27 17:24:02 +0200 (Wed, 27 Aug 2014)
New Revision: 2225
Url: http://forge.codelutin.com/projects/wao/repository/revisions/2225
Log:
[maven-release-plugin] prepare release wao-4.0.9
Modified:
branches/wao-4.0.x/pom.xml
branches/wao-4.0.x/wao-persistence/pom.xml
branches/wao-4.0.x/wao-services/pom.xml
branches/wao-4.0.x/wao-web/pom.xml
Modified: branches/wao-4.0.x/pom.xml
===================================================================
--- branches/wao-4.0.x/pom.xml 2014-08-27 15:20:36 UTC (rev 2224)
+++ branches/wao-4.0.x/pom.xml 2014-08-27 15:24:02 UTC (rev 2225)
@@ -10,7 +10,7 @@
<groupId>fr.ifremer</groupId>
<artifactId>wao</artifactId>
- <version>4.0.9-SNAPSHOT</version>
+ <version>4.0.9</version>
<packaging>pom</packaging>
<name>Wao</name>
@@ -86,9 +86,9 @@
</modules>
<scm>
- <connection>scm:svn:http://svn.codelutin.com/wao/branches/wao-4.0.x</connection>
- <developerConnection>scm:svn:https://svn.codelutin.com/wao/branches/wao-4.0.x</developerConnection>
- <url>https://forge.codelutin.com/repositories/browse/wao/branches/wao-4.0.x</url>
+ <connection>scm:svn:http://svn.codelutin.com/wao/tags/wao-4.0.9</connection>
+ <developerConnection>scm:svn:https://svn.codelutin.com/wao/tags/wao-4.0.9</developerConnection>
+ <url>https://forge.codelutin.com/repositories/browse/wao/tags/wao-4.0.9</url>
</scm>
<properties>
Modified: branches/wao-4.0.x/wao-persistence/pom.xml
===================================================================
--- branches/wao-4.0.x/wao-persistence/pom.xml 2014-08-27 15:20:36 UTC (rev 2224)
+++ branches/wao-4.0.x/wao-persistence/pom.xml 2014-08-27 15:24:02 UTC (rev 2225)
@@ -5,7 +5,7 @@
<parent>
<groupId>fr.ifremer</groupId>
<artifactId>wao</artifactId>
- <version>4.0.9-SNAPSHOT</version>
+ <version>4.0.9</version>
</parent>
<artifactId>wao-persistence</artifactId>
Modified: branches/wao-4.0.x/wao-services/pom.xml
===================================================================
--- branches/wao-4.0.x/wao-services/pom.xml 2014-08-27 15:20:36 UTC (rev 2224)
+++ branches/wao-4.0.x/wao-services/pom.xml 2014-08-27 15:24:02 UTC (rev 2225)
@@ -5,7 +5,7 @@
<parent>
<groupId>fr.ifremer</groupId>
<artifactId>wao</artifactId>
- <version>4.0.9-SNAPSHOT</version>
+ <version>4.0.9</version>
</parent>
<artifactId>wao-services</artifactId>
Modified: branches/wao-4.0.x/wao-web/pom.xml
===================================================================
--- branches/wao-4.0.x/wao-web/pom.xml 2014-08-27 15:20:36 UTC (rev 2224)
+++ branches/wao-4.0.x/wao-web/pom.xml 2014-08-27 15:24:02 UTC (rev 2225)
@@ -5,7 +5,7 @@
<parent>
<groupId>fr.ifremer</groupId>
<artifactId>wao</artifactId>
- <version>4.0.9-SNAPSHOT</version>
+ <version>4.0.9</version>
</parent>
<artifactId>wao-web</artifactId>
1
0
r2224 - branches/wao-4.0.x/wao-web/src/main/java/fr/ifremer/wao/web
by bleny@users.forge.codelutin.com 27 Aug '14
by bleny@users.forge.codelutin.com 27 Aug '14
27 Aug '14
Author: bleny
Date: 2014-08-27 17:20:36 +0200 (Wed, 27 Aug 2014)
New Revision: 2224
Url: http://forge.codelutin.com/projects/wao/repository/revisions/2224
Log:
D?\195?\169sactivation de l'invalidation du cache des filtres des navires (refs #5403)
Modified:
branches/wao-4.0.x/wao-web/src/main/java/fr/ifremer/wao/web/CacheInvalidationTopiaEntityListener.java
branches/wao-4.0.x/wao-web/src/main/java/fr/ifremer/wao/web/DefaultWaoApplicationContext.java
Modified: branches/wao-4.0.x/wao-web/src/main/java/fr/ifremer/wao/web/CacheInvalidationTopiaEntityListener.java
===================================================================
--- branches/wao-4.0.x/wao-web/src/main/java/fr/ifremer/wao/web/CacheInvalidationTopiaEntityListener.java 2014-08-27 15:00:48 UTC (rev 2223)
+++ branches/wao-4.0.x/wao-web/src/main/java/fr/ifremer/wao/web/CacheInvalidationTopiaEntityListener.java 2014-08-27 15:20:36 UTC (rev 2224)
@@ -71,6 +71,13 @@
protected boolean invalidateAllContacts = false;
+ /**
+ * On désactive pour se reposer uniquement sur l'invalidation au bout d'un certain temps.
+ * @deprecated le temps du test en prod pour voir si ça améliore mais si on garde, à refactorer
+ */
+ @Deprecated
+ protected boolean boatsFilterValuesCacheInvalidationEnabled = false;
+
public CacheInvalidationTopiaEntityListener(
Cache<SamplingPlanCacheKey, SamplingPlan> samplingPlansCache,
Cache<BoatsFilterValuesCacheKey, BoatsFilterValues> boatsFilterValuesCache,
@@ -139,7 +146,7 @@
if (log.isTraceEnabled()) {
log.trace("will commit for entities " + event.getEntities());
}
- if (invalidateAllSampleRows || dirtySampleRowIds.size() > 20) {
+ if (invalidateAllSampleRows) {
samplingPlansCache.invalidateAll();
synthesesCache.invalidateAll();
} else {
@@ -158,8 +165,10 @@
}
synthesesCache.invalidateAll(synthesesCacheKeysToInvalidate);
}
- if (invalidateAllBoats || dirtyBoatIds.size() > 20) {
- boatsFilterValuesCache.invalidateAll();
+ if (invalidateAllBoats) {
+ if (boatsFilterValuesCacheInvalidationEnabled) {
+ boatsFilterValuesCache.invalidateAll();
+ }
} else {
Set<BoatsFilterValuesCacheKey> boatsFilterValuesCacheKeysToInvalidate = new HashSet<>();
for (Map.Entry<BoatsFilterValuesCacheKey, BoatsFilterValues> entry : boatsFilterValuesCache.asMap().entrySet()) {
@@ -167,7 +176,9 @@
boatsFilterValuesCacheKeysToInvalidate.add(entry.getKey());
}
}
- boatsFilterValuesCache.invalidateAll(boatsFilterValuesCacheKeysToInvalidate);
+ if (boatsFilterValuesCacheInvalidationEnabled) {
+ boatsFilterValuesCache.invalidateAll(boatsFilterValuesCacheKeysToInvalidate);
+ }
}
clear();
}
Modified: branches/wao-4.0.x/wao-web/src/main/java/fr/ifremer/wao/web/DefaultWaoApplicationContext.java
===================================================================
--- branches/wao-4.0.x/wao-web/src/main/java/fr/ifremer/wao/web/DefaultWaoApplicationContext.java 2014-08-27 15:00:48 UTC (rev 2223)
+++ branches/wao-4.0.x/wao-web/src/main/java/fr/ifremer/wao/web/DefaultWaoApplicationContext.java 2014-08-27 15:20:36 UTC (rev 2224)
@@ -130,7 +130,7 @@
@Override
public Cache<BoatsFilterValuesCacheKey, BoatsFilterValues> getBoatsFilterValuesCache() {
if (boatsFilterValuesCache == null) {
- boatsFilterValuesCache = newCacheBuilder(100).expireAfterAccess(30, TimeUnit.DAYS).build();
+ boatsFilterValuesCache = newCacheBuilder(100).expireAfterWrite(18, TimeUnit.HOURS).build();
}
return boatsFilterValuesCache;
}
1
0
r2223 - branches/wao-4.0.x/wao-services/src/main/java/fr/ifremer/wao/services/service
by bleny@users.forge.codelutin.com 27 Aug '14
by bleny@users.forge.codelutin.com 27 Aug '14
27 Aug '14
Author: bleny
Date: 2014-08-27 17:00:48 +0200 (Wed, 27 Aug 2014)
New Revision: 2223
Url: http://forge.codelutin.com/projects/wao/repository/revisions/2223
Log:
Correction d'un nom de variable
Modified:
branches/wao-4.0.x/wao-services/src/main/java/fr/ifremer/wao/services/service/BoatsService.java
Modified: branches/wao-4.0.x/wao-services/src/main/java/fr/ifremer/wao/services/service/BoatsService.java
===================================================================
--- branches/wao-4.0.x/wao-services/src/main/java/fr/ifremer/wao/services/service/BoatsService.java 2014-08-27 14:33:48 UTC (rev 2222)
+++ branches/wao-4.0.x/wao-services/src/main/java/fr/ifremer/wao/services/service/BoatsService.java 2014-08-27 15:00:48 UTC (rev 2223)
@@ -148,12 +148,12 @@
BoatTopiaDao dao = getBoatDao();
- List<Boat> sampleRows = dao.findAll(filter);
+ List<Boat> boats = dao.findAll(filter);
ExportModel<Boat> exportModel =
new BoatImportExportModel(getLocale());
- Export<Boat> export = Export.newExport(exportModel, sampleRows);
+ Export<Boat> export = Export.newExport(exportModel, boats);
try {
1
0
r2222 - in branches/wao-4.0.x: wao-services/src/main/java/fr/ifremer/wao/services/service wao-web/src/main/java/fr/ifremer/wao/web/action wao-web/src/main/webapp/WEB-INF/content
by bleny@users.forge.codelutin.com 27 Aug '14
by bleny@users.forge.codelutin.com 27 Aug '14
27 Aug '14
Author: bleny
Date: 2014-08-27 16:33:48 +0200 (Wed, 27 Aug 2014)
New Revision: 2222
Url: http://forge.codelutin.com/projects/wao/repository/revisions/2222
Log:
Plusieurs simplification du code dans le formulaire de modification d'un contact mais ?\195?\167a ne r?\195?\169soud pas le probl?\195?\168me (refs #5653)
Modified:
branches/wao-4.0.x/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactsService.java
branches/wao-4.0.x/wao-services/src/main/java/fr/ifremer/wao/services/service/UpdateContactCommand.java
branches/wao-4.0.x/wao-web/src/main/java/fr/ifremer/wao/web/action/EditContactAction.java
branches/wao-4.0.x/wao-web/src/main/webapp/WEB-INF/content/edit-contact-input.jsp
Modified: branches/wao-4.0.x/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactsService.java
===================================================================
--- branches/wao-4.0.x/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactsService.java 2014-08-19 15:43:17 UTC (rev 2221)
+++ branches/wao-4.0.x/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactsService.java 2014-08-27 14:33:48 UTC (rev 2222)
@@ -788,9 +788,11 @@
protected void notifyMammalsObservationIfNecessary(UpdateContactCommand updateContactCommand) {
- if (updateContactCommand.isMammalsInfosChanged()) {
+ // we send notifications if there is mammals Capture and
+ // we prevent re-send of multiple identical messages
+ Contact contact = updateContactCommand.getContact();
- Contact contact = updateContactCommand.getContact();
+ if (contact.isMammalsCapture() && updateContactCommand.isMammalsInfosChanged()) {
MammalsObservationEmail email = getEmailService().newMammalsObservationEmail();
email.setContact(contact);
Modified: branches/wao-4.0.x/wao-services/src/main/java/fr/ifremer/wao/services/service/UpdateContactCommand.java
===================================================================
--- branches/wao-4.0.x/wao-services/src/main/java/fr/ifremer/wao/services/service/UpdateContactCommand.java 2014-08-19 15:43:17 UTC (rev 2221)
+++ branches/wao-4.0.x/wao-services/src/main/java/fr/ifremer/wao/services/service/UpdateContactCommand.java 2014-08-27 14:33:48 UTC (rev 2222)
@@ -22,9 +22,9 @@
*/
import com.google.common.base.Preconditions;
+import com.google.common.base.Strings;
import fr.ifremer.wao.entity.Contact;
import fr.ifremer.wao.entity.DataReliability;
-import org.apache.commons.lang3.ObjectUtils;
import java.io.Serializable;
import java.util.HashSet;
@@ -50,8 +50,6 @@
protected Boolean oldValidationProgram;
- protected String oldMammalsInfo;
-
protected String mainObserverId;
protected Set<String> secondaryObserverIds = new HashSet<>();
@@ -60,6 +58,8 @@
protected String contactStateMotifId;
+ protected boolean mammalsInfosChanged;
+
public boolean isCreation() {
return creation;
}
@@ -84,7 +84,6 @@
this.contact = contact;
this.oldValidationCompany = contact.getValidationCompany();
this.oldValidationProgram = contact.getValidationProgram();
- this.oldMammalsInfo = contact.getMammalsInfo();
}
public Boolean getValidationCompany() {
@@ -115,6 +114,9 @@
}
public void setMammalsInfo(String mammalsInfo) {
+ String oldMessage = Strings.nullToEmpty(contact.getMammalsInfo());
+ String newMessage = Strings.nullToEmpty(mammalsInfo);
+ mammalsInfosChanged = ! oldMessage.equals(newMessage);
contact.setMammalsInfo(mammalsInfo);
}
@@ -124,21 +126,6 @@
* @return {@code true} if mammal informations changed
*/
public boolean isMammalsInfosChanged() {
-
- boolean mammalsInfosChanged = false;
-
- // we send notifications if there is mammals Capture and
- // we prevent re-send of multiple identical messages
- if (contact.isMammalsCapture()) {
- String oldMessage = null;
- if (!isCreation()) {
- oldMessage = oldMammalsInfo;
- }
- boolean messageChanged = ObjectUtils.notEqual(contact.getMammalsInfo(), oldMessage);
- if (messageChanged) {
- mammalsInfosChanged = true;
- }
- }
return mammalsInfosChanged;
}
Modified: branches/wao-4.0.x/wao-web/src/main/java/fr/ifremer/wao/web/action/EditContactAction.java
===================================================================
--- branches/wao-4.0.x/wao-web/src/main/java/fr/ifremer/wao/web/action/EditContactAction.java 2014-08-19 15:43:17 UTC (rev 2221)
+++ branches/wao-4.0.x/wao-web/src/main/java/fr/ifremer/wao/web/action/EditContactAction.java 2014-08-27 14:33:48 UTC (rev 2222)
@@ -22,7 +22,6 @@
*/
import com.google.common.base.Optional;
-import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import com.google.common.collect.Sets;
import com.opensymphony.xwork2.Preparable;
@@ -151,51 +150,30 @@
}
public Map<String, String> getObservers() {
- if (observers == null) {
- prepare();
- }
return observers;
}
public Map<ContactState, String> getContactStates() {
- if (contactStates == null) {
- prepare();
- }
return contactStates;
}
public Map<String, String> getContactStateMotives() {
- if (contactStateMotives == null) {
- prepare();
- }
return contactStateMotives;
}
public Map<ObservedDataControl, String> getObservedDataControls() {
- if (observedDataControls == null) {
- prepare();
- }
return observedDataControls;
}
public Map<DataReliability, String> getDataReliabilities() {
- if (dataReliabilities == null) {
- prepare();
- }
return dataReliabilities;
}
public Map<String, String> getTerrestrialLocations() {
- if (terrestrialLocations == null) {
- prepare();
- }
return terrestrialLocations;
}
public Map<SamplingStrategy, String> getSamplingStrategies() {
- if (samplingStrategies == null) {
- prepare();
- }
return samplingStrategies;
}
@@ -210,12 +188,6 @@
@Override
public void prepare() {
- Preconditions.checkState(optionalContactId.isPresent());
-
- if (log.isInfoEnabled()) {
- log.info("user " + getAuthenticatedWaoUser() + " want to edit contact " + optionalContactId.get());
- }
-
try {
updateContactCommand = service.newUpdateContactCommand(getAuthenticatedWaoUser(), optionalContactId);
} catch (UnknownContactIdException e) {
Modified: branches/wao-4.0.x/wao-web/src/main/webapp/WEB-INF/content/edit-contact-input.jsp
===================================================================
--- branches/wao-4.0.x/wao-web/src/main/webapp/WEB-INF/content/edit-contact-input.jsp 2014-08-19 15:43:17 UTC (rev 2221)
+++ branches/wao-4.0.x/wao-web/src/main/webapp/WEB-INF/content/edit-contact-input.jsp 2014-08-27 14:33:48 UTC (rev 2222)
@@ -314,7 +314,7 @@
disabled="%{!#editObservationReport}"/>
<div id="mammalsInfo">
- <s:textarea name="updateContactCommand.contact.mammalsInfo"
+ <s:textarea name="updateContactCommand.mammalsInfo"
label="%{getText('wao.ui.field.Contact.mammalsInfo')}"
disabled="%{!#editObservationReport}"/>
<div class="alert">
1
0
r2221 - branches/wao-4.0.x/wao-persistence/src/main/java/fr/ifremer/wao/entity
by bleny@users.forge.codelutin.com 19 Aug '14
by bleny@users.forge.codelutin.com 19 Aug '14
19 Aug '14
Author: bleny
Date: 2014-08-19 17:43:17 +0200 (Tue, 19 Aug 2014)
New Revision: 2221
Url: http://forge.codelutin.com/projects/wao/repository/revisions/2221
Log:
Pour le filtrage des contacts sur une fen?\195?\170tre de temps, pour la borne de fin de p?\195?\169riode, on doit inclure la journ?\195?\169e (fixes #5637)
Modified:
branches/wao-4.0.x/wao-persistence/src/main/java/fr/ifremer/wao/entity/ContactTopiaDao.java
Modified: branches/wao-4.0.x/wao-persistence/src/main/java/fr/ifremer/wao/entity/ContactTopiaDao.java
===================================================================
--- branches/wao-4.0.x/wao-persistence/src/main/java/fr/ifremer/wao/entity/ContactTopiaDao.java 2014-08-18 16:04:15 UTC (rev 2220)
+++ branches/wao-4.0.x/wao-persistence/src/main/java/fr/ifremer/wao/entity/ContactTopiaDao.java 2014-08-19 15:43:17 UTC (rev 2221)
@@ -39,6 +39,7 @@
import org.nuiton.topia.persistence.TopiaEntity;
import org.nuiton.topia.persistence.TopiaQueryBuilderAddCriteriaOrRunQueryStep;
import org.nuiton.topia.persistence.TopiaQueryBuilderRunQueryStep;
+import org.nuiton.util.DateUtil;
import java.util.Arrays;
import java.util.Calendar;
@@ -125,7 +126,8 @@
}
if (filter.getPeriodTo() != null) {
- query.addWhereClause("c." + periodProperty + " <= :periodTo", ImmutableMap.of("periodTo", (Object) filter.getPeriodTo()));
+ Date periodTo = DateUtil.setMaxTimeOfDay(filter.getPeriodTo());
+ query.addWhereClause("c." + periodProperty + " <= :periodTo", ImmutableMap.of("periodTo", (Object) periodTo));
}
if (CollectionUtils.isNotEmpty(filter.getContactIds())) {
1
0
r2220 - branches/wao-4.0.x/wao-web/src/main/java/fr/ifremer/wao/web/converter
by bleny@users.forge.codelutin.com 18 Aug '14
by bleny@users.forge.codelutin.com 18 Aug '14
18 Aug '14
Author: bleny
Date: 2014-08-18 18:04:15 +0200 (Mon, 18 Aug 2014)
New Revision: 2220
Url: http://forge.codelutin.com/projects/wao/repository/revisions/2220
Log:
On emp?\195?\170che un warn inutile si la locale est FRANCE
Modified:
branches/wao-4.0.x/wao-web/src/main/java/fr/ifremer/wao/web/converter/AbstractDateConverter.java
Modified: branches/wao-4.0.x/wao-web/src/main/java/fr/ifremer/wao/web/converter/AbstractDateConverter.java
===================================================================
--- branches/wao-4.0.x/wao-web/src/main/java/fr/ifremer/wao/web/converter/AbstractDateConverter.java 2014-08-18 15:43:36 UTC (rev 2219)
+++ branches/wao-4.0.x/wao-web/src/main/java/fr/ifremer/wao/web/converter/AbstractDateConverter.java 2014-08-18 16:04:15 UTC (rev 2220)
@@ -78,7 +78,7 @@
}
- if ( ! ImmutableSet.of(Locale.FRENCH, Locale.ENGLISH).contains(locale)) {
+ if ( ! ImmutableSet.of(Locale.FRENCH, Locale.ENGLISH, Locale.FRANCE).contains(locale)) {
if (log.isWarnEnabled()) {
log.warn("locale " + locale + " is not french nor english, will default to french");
}
1
0