Wao-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- 2352 discussions
r1859 - trunk/wao-web/src/main/webapp/WEB-INF/decorators
by tchemit@users.forge.codelutin.com 07 Apr '14
by tchemit@users.forge.codelutin.com 07 Apr '14
07 Apr '14
Author: tchemit
Date: 2014-04-07 19:10:27 +0200 (Mon, 07 Apr 2014)
New Revision: 1859
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1859
Log:
refs #4487 remove bad link
Modified:
trunk/wao-web/src/main/webapp/WEB-INF/decorators/layout.jsp
Modified: trunk/wao-web/src/main/webapp/WEB-INF/decorators/layout.jsp
===================================================================
--- trunk/wao-web/src/main/webapp/WEB-INF/decorators/layout.jsp 2014-04-07 17:09:47 UTC (rev 1858)
+++ trunk/wao-web/src/main/webapp/WEB-INF/decorators/layout.jsp 2014-04-07 17:10:27 UTC (rev 1859)
@@ -178,7 +178,7 @@
<s:actionerror theme="bootstrap" />
<s:actionmessage theme="bootstrap" />
<s:fielderror theme="bootstrap" />
- <div id="notifications"><a href="#notifications"></a></div>
+ <div id="notifications"></div>
<decorator:body />
</main>
1
0
r1858 - in trunk: wao-services/src/main/java/fr/ifremer/wao/services/service wao-services/src/main/resources/i18n wao-web/src/main/java/fr/ifremer/wao/web/action wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer wao-web/src/main/resources/i18n
by tchemit@users.forge.codelutin.com 07 Apr '14
by tchemit@users.forge.codelutin.com 07 Apr '14
07 Apr '14
Author: tchemit
Date: 2014-04-07 19:09:47 +0200 (Mon, 07 Apr 2014)
New Revision: 1858
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1858
Log:
refs #4487 validation of a contact + improve import i18n message in exception
Added:
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactDataInputDateAfterObservationEndDateException.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactDataInputDateAfterTodayException.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactObservationEndDateAfterTodayException.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactObservationEndDateBeforeBeginDateException.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactRestitutionDateBeforeDataInputDateException.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/DuplicatedContactMainObserverInSecondaryObserversException.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/InvalidContactMainObserverException.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/InvalidContactObservationBeginDateException.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MismatchContactMainObserverCompanyException.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MismatchContactSecondaryObserverCompanyException.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MissingContactCommentAdminException.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MissingContactCommentException.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MissingContactDataInputDateException.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MissingContactDataReliabilityException.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MissingContactMainObserverException.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MissingContactNbObservantsForObservationDoneStateException.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MissingContactObservationBeginDateException.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MissingContactObservationEndDateException.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MissingContactObservedDataControlException.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MissingContactRestitutionException.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MissingContactStateMotifException.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/UnwantedContactContactStateMotifException.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/WaoContactValidationException.java
Removed:
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactNotValidException.java
Modified:
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/IllegalDeletionException.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ImportErrorException.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerContactsService.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/UpdateContactCommand.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-web/src/main/java/fr/ifremer/wao/web/action/AbstractImportCsvAction.java
trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/EditContactAction.java
trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/ValidateContactJsonAction.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
Added: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactDataInputDateAfterObservationEndDateException.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactDataInputDateAfterObservationEndDateException.java (rev 0)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactDataInputDateAfterObservationEndDateException.java 2014-04-07 17:09:47 UTC (rev 1858)
@@ -0,0 +1,18 @@
+package fr.ifremer.wao.services.service;
+
+import fr.ifremer.wao.entity.Contact;
+
+/**
+ * Created on 4/7/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 4.0
+ */
+public class ContactDataInputDateAfterObservationEndDateException extends WaoContactValidationException {
+
+ private static final long serialVersionUID = 1L;
+
+ public ContactDataInputDateAfterObservationEndDateException(Contact contact) {
+ super(contact);
+ }
+}
Property changes on: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactDataInputDateAfterObservationEndDateException.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactDataInputDateAfterTodayException.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactDataInputDateAfterTodayException.java (rev 0)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactDataInputDateAfterTodayException.java 2014-04-07 17:09:47 UTC (rev 1858)
@@ -0,0 +1,27 @@
+package fr.ifremer.wao.services.service;
+
+import fr.ifremer.wao.entity.Contact;
+
+import java.util.Date;
+
+/**
+ * Created on 4/7/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 4.0
+ */
+public class ContactDataInputDateAfterTodayException extends WaoContactValidationException {
+
+ private static final long serialVersionUID = 1L;
+
+ protected Date now;
+
+ public ContactDataInputDateAfterTodayException(Contact contact, Date now) {
+ super(contact);
+ this.now = now;
+ }
+
+ public Date getNow() {
+ return now;
+ }
+}
Property changes on: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactDataInputDateAfterTodayException.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Deleted: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactNotValidException.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactNotValidException.java 2014-04-07 17:07:49 UTC (rev 1857)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactNotValidException.java 2014-04-07 17:09:47 UTC (rev 1858)
@@ -1,41 +0,0 @@
-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 fr.ifremer.wao.WaoException;
-
-/**
- * Quand un contact n'est pas valide (lors d'une création ou d'un import).
- * <p/>
- * Created on 4/4/14.
- *
- * @author Tony Chemit <chemit(a)codelutin.com>
- * @since 4.0
- */
-public class ContactNotValidException extends WaoException {
-
- private static final long serialVersionUID = 1L;
-
- public ContactNotValidException(String message) {
- super(message);
- }
-}
Added: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactObservationEndDateAfterTodayException.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactObservationEndDateAfterTodayException.java (rev 0)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactObservationEndDateAfterTodayException.java 2014-04-07 17:09:47 UTC (rev 1858)
@@ -0,0 +1,27 @@
+package fr.ifremer.wao.services.service;
+
+import fr.ifremer.wao.entity.Contact;
+
+import java.util.Date;
+
+/**
+ * Created on 4/7/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 4.0
+ */
+public class ContactObservationEndDateAfterTodayException extends WaoContactValidationException {
+
+ private static final long serialVersionUID = 1L;
+
+ protected Date today;
+
+ public ContactObservationEndDateAfterTodayException(Contact contact, Date today) {
+ super(contact);
+ this.today = today;
+ }
+
+ public Date getToday() {
+ return today;
+ }
+}
Property changes on: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactObservationEndDateAfterTodayException.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactObservationEndDateBeforeBeginDateException.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactObservationEndDateBeforeBeginDateException.java (rev 0)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactObservationEndDateBeforeBeginDateException.java 2014-04-07 17:09:47 UTC (rev 1858)
@@ -0,0 +1,18 @@
+package fr.ifremer.wao.services.service;
+
+import fr.ifremer.wao.entity.Contact;
+
+/**
+ * Created on 4/7/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 4.0
+ */
+public class ContactObservationEndDateBeforeBeginDateException extends WaoContactValidationException {
+
+ private static final long serialVersionUID = 1L;
+
+ public ContactObservationEndDateBeforeBeginDateException(Contact contact) {
+ super(contact);
+ }
+}
Property changes on: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactObservationEndDateBeforeBeginDateException.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactRestitutionDateBeforeDataInputDateException.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactRestitutionDateBeforeDataInputDateException.java (rev 0)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactRestitutionDateBeforeDataInputDateException.java 2014-04-07 17:09:47 UTC (rev 1858)
@@ -0,0 +1,40 @@
+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 fr.ifremer.wao.entity.Contact;
+
+/**
+ * Created on 4/4/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 4.0
+ */
+public class ContactRestitutionDateBeforeDataInputDateException extends WaoContactValidationException {
+
+ private static final long serialVersionUID = 1L;
+
+ public ContactRestitutionDateBeforeDataInputDateException(Contact contact) {
+ super(contact);
+ }
+
+}
Property changes on: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactRestitutionDateBeforeDataInputDateException.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/DuplicatedContactMainObserverInSecondaryObserversException.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/DuplicatedContactMainObserverInSecondaryObserversException.java (rev 0)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/DuplicatedContactMainObserverInSecondaryObserversException.java 2014-04-07 17:09:47 UTC (rev 1858)
@@ -0,0 +1,18 @@
+package fr.ifremer.wao.services.service;
+
+import fr.ifremer.wao.entity.Contact;
+
+/**
+ * Created on 4/7/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 4.0
+ */
+public class DuplicatedContactMainObserverInSecondaryObserversException extends WaoContactValidationException {
+
+ private static final long serialVersionUID = 1L;
+
+ public DuplicatedContactMainObserverInSecondaryObserversException(Contact contact) {
+ super(contact);
+ }
+}
Property changes on: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/DuplicatedContactMainObserverInSecondaryObserversException.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/IllegalDeletionException.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/IllegalDeletionException.java 2014-04-07 17:07:49 UTC (rev 1857)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/IllegalDeletionException.java 2014-04-07 17:09:47 UTC (rev 1858)
@@ -40,6 +40,8 @@
*/
public class IllegalDeletionException extends WaoException {
+ private static final long serialVersionUID = 1L;
+
protected static final ImmutableMap<Class<? extends TopiaEntity>, String> ENTITIES_I18N_KEYS =
ImmutableMap.of(
Contact.class, I18n.n("wao.action.delete.failure.attachedContacts"),
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ImportErrorException.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ImportErrorException.java 2014-04-07 17:07:49 UTC (rev 1857)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ImportErrorException.java 2014-04-07 17:09:47 UTC (rev 1858)
@@ -25,6 +25,8 @@
import org.nuiton.csv.ImportRuntimeException;
import org.nuiton.i18n.I18n;
+import java.util.Locale;
+
/**
* Une erreur est survenue lors d'un import CSV.
*/
@@ -32,24 +34,22 @@
private static final long serialVersionUID = 1L;
- //FIXME ? Why?
- protected static final String MESSAGE = I18n.t("wao.import.failure");
-
public ImportErrorException(ImportRuntimeException e) {
super(e);
}
- public ImportErrorException(ContactNotValidException e) {
- super(e);
+ public ImportErrorException(String message) {
+ super(message);
}
- public ImportErrorException(NullSampleMonthException e) {
- super(e);
+ public String getMessage(Locale locale) {
+ String causeMessage;
+ if (getCause() == null) {
+ causeMessage = getMessage();
+ } else {
+ causeMessage = getCause().getMessage();
+ }
+ return I18n.l(locale, "wao.import.failure", causeMessage);
}
- @Override
- public String getMessage() {
- return MESSAGE + " " + getCause().getMessage();
- }
-
}
Added: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/InvalidContactMainObserverException.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/InvalidContactMainObserverException.java (rev 0)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/InvalidContactMainObserverException.java 2014-04-07 17:09:47 UTC (rev 1858)
@@ -0,0 +1,18 @@
+package fr.ifremer.wao.services.service;
+
+import fr.ifremer.wao.entity.Contact;
+
+/**
+ * Created on 4/7/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 4.0
+ */
+public class InvalidContactMainObserverException extends WaoContactValidationException {
+
+ private static final long serialVersionUID = 1L;
+
+ public InvalidContactMainObserverException(Contact contact, String message) {
+ super(contact);
+ }
+}
Property changes on: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/InvalidContactMainObserverException.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/InvalidContactObservationBeginDateException.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/InvalidContactObservationBeginDateException.java (rev 0)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/InvalidContactObservationBeginDateException.java 2014-04-07 17:09:47 UTC (rev 1858)
@@ -0,0 +1,18 @@
+package fr.ifremer.wao.services.service;
+
+import fr.ifremer.wao.entity.Contact;
+
+/**
+ * Created on 4/7/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 4.0
+ */
+public class InvalidContactObservationBeginDateException extends WaoContactValidationException {
+
+ private static final long serialVersionUID = 1L;
+
+ public InvalidContactObservationBeginDateException(Contact contact) {
+ super(contact);
+ }
+}
Property changes on: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/InvalidContactObservationBeginDateException.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MismatchContactMainObserverCompanyException.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MismatchContactMainObserverCompanyException.java (rev 0)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MismatchContactMainObserverCompanyException.java 2014-04-07 17:09:47 UTC (rev 1858)
@@ -0,0 +1,34 @@
+package fr.ifremer.wao.services.service;
+
+import fr.ifremer.wao.entity.Company;
+import fr.ifremer.wao.entity.Contact;
+import fr.ifremer.wao.entity.WaoUser;
+
+/**
+ * Created on 4/7/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 4.0
+ */
+public class MismatchContactMainObserverCompanyException extends WaoContactValidationException {
+
+ private static final long serialVersionUID = 1L;
+
+ protected Company company;
+
+ protected WaoUser observer;
+
+ public MismatchContactMainObserverCompanyException(Contact contact, Company company, WaoUser observer) {
+ super(contact);
+ this.company = company;
+ this.observer = observer;
+ }
+
+ public Company getCompany() {
+ return company;
+ }
+
+ public WaoUser getObserver() {
+ return observer;
+ }
+}
Property changes on: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MismatchContactMainObserverCompanyException.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MismatchContactSecondaryObserverCompanyException.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MismatchContactSecondaryObserverCompanyException.java (rev 0)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MismatchContactSecondaryObserverCompanyException.java 2014-04-07 17:09:47 UTC (rev 1858)
@@ -0,0 +1,34 @@
+package fr.ifremer.wao.services.service;
+
+import fr.ifremer.wao.entity.Company;
+import fr.ifremer.wao.entity.Contact;
+import fr.ifremer.wao.entity.WaoUser;
+
+/**
+ * Created on 4/7/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 4.0
+ */
+public class MismatchContactSecondaryObserverCompanyException extends WaoContactValidationException {
+
+ private static final long serialVersionUID = 1L;
+
+ protected WaoUser observer;
+
+ protected Company company;
+
+ public MismatchContactSecondaryObserverCompanyException(Contact contact, WaoUser observer, Company company) {
+ super(contact);
+ this.observer = observer;
+ this.company = company;
+ }
+
+ public WaoUser getObserver() {
+ return observer;
+ }
+
+ public Company getCompany() {
+ return company;
+ }
+}
Property changes on: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MismatchContactSecondaryObserverCompanyException.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MissingContactCommentAdminException.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MissingContactCommentAdminException.java (rev 0)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MissingContactCommentAdminException.java 2014-04-07 17:09:47 UTC (rev 1858)
@@ -0,0 +1,18 @@
+package fr.ifremer.wao.services.service;
+
+import fr.ifremer.wao.entity.Contact;
+
+/**
+ * Created on 4/7/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 4.0
+ */
+public class MissingContactCommentAdminException extends WaoContactValidationException {
+
+ private static final long serialVersionUID = 1L;
+
+ public MissingContactCommentAdminException(Contact contact) {
+ super(contact);
+ }
+}
Property changes on: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MissingContactCommentAdminException.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MissingContactCommentException.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MissingContactCommentException.java (rev 0)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MissingContactCommentException.java 2014-04-07 17:09:47 UTC (rev 1858)
@@ -0,0 +1,40 @@
+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 fr.ifremer.wao.entity.Contact;
+
+/**
+ * Created on 4/4/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 4.0
+ */
+public class MissingContactCommentException extends WaoContactValidationException {
+
+ private static final long serialVersionUID = 1L;
+
+ public MissingContactCommentException(Contact contact) {
+ super(contact);
+ }
+
+}
Property changes on: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MissingContactCommentException.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MissingContactDataInputDateException.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MissingContactDataInputDateException.java (rev 0)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MissingContactDataInputDateException.java 2014-04-07 17:09:47 UTC (rev 1858)
@@ -0,0 +1,40 @@
+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 fr.ifremer.wao.entity.Contact;
+
+/**
+ * Created on 4/4/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 4.0
+ */
+public class MissingContactDataInputDateException extends WaoContactValidationException {
+
+ private static final long serialVersionUID = 1L;
+
+ public MissingContactDataInputDateException(Contact contact) {
+ super(contact);
+ }
+
+}
Property changes on: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MissingContactDataInputDateException.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MissingContactDataReliabilityException.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MissingContactDataReliabilityException.java (rev 0)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MissingContactDataReliabilityException.java 2014-04-07 17:09:47 UTC (rev 1858)
@@ -0,0 +1,18 @@
+package fr.ifremer.wao.services.service;
+
+import fr.ifremer.wao.entity.Contact;
+
+/**
+ * Created on 4/7/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 4.0
+ */
+public class MissingContactDataReliabilityException extends WaoContactValidationException {
+
+ private static final long serialVersionUID = 1L;
+
+ public MissingContactDataReliabilityException(Contact contact) {
+ super(contact);
+ }
+}
Property changes on: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MissingContactDataReliabilityException.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MissingContactMainObserverException.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MissingContactMainObserverException.java (rev 0)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MissingContactMainObserverException.java 2014-04-07 17:09:47 UTC (rev 1858)
@@ -0,0 +1,18 @@
+package fr.ifremer.wao.services.service;
+
+import fr.ifremer.wao.entity.Contact;
+
+/**
+ * Created on 4/7/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 4.0
+ */
+public class MissingContactMainObserverException extends WaoContactValidationException {
+
+ private static final long serialVersionUID = 1L;
+
+ public MissingContactMainObserverException(Contact contact) {
+ super(contact);
+ }
+}
Property changes on: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MissingContactMainObserverException.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MissingContactNbObservantsForObservationDoneStateException.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MissingContactNbObservantsForObservationDoneStateException.java (rev 0)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MissingContactNbObservantsForObservationDoneStateException.java 2014-04-07 17:09:47 UTC (rev 1858)
@@ -0,0 +1,40 @@
+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 fr.ifremer.wao.entity.Contact;
+
+/**
+ * Created on 4/4/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 4.0
+ */
+public class MissingContactNbObservantsForObservationDoneStateException extends WaoContactValidationException {
+
+ private static final long serialVersionUID = 1L;
+
+ public MissingContactNbObservantsForObservationDoneStateException(Contact contact) {
+ super(contact);
+ }
+
+}
Property changes on: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MissingContactNbObservantsForObservationDoneStateException.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MissingContactObservationBeginDateException.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MissingContactObservationBeginDateException.java (rev 0)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MissingContactObservationBeginDateException.java 2014-04-07 17:09:47 UTC (rev 1858)
@@ -0,0 +1,40 @@
+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 fr.ifremer.wao.entity.Contact;
+
+/**
+ * Created on 4/4/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 4.0
+ */
+public class MissingContactObservationBeginDateException extends WaoContactValidationException {
+
+ private static final long serialVersionUID = 1L;
+
+ public MissingContactObservationBeginDateException(Contact contact) {
+ super(contact);
+ }
+
+}
Property changes on: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MissingContactObservationBeginDateException.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MissingContactObservationEndDateException.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MissingContactObservationEndDateException.java (rev 0)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MissingContactObservationEndDateException.java 2014-04-07 17:09:47 UTC (rev 1858)
@@ -0,0 +1,40 @@
+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 fr.ifremer.wao.entity.Contact;
+
+/**
+ * Created on 4/4/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 4.0
+ */
+public class MissingContactObservationEndDateException extends WaoContactValidationException {
+
+ private static final long serialVersionUID = 1L;
+
+ public MissingContactObservationEndDateException(Contact contact) {
+ super(contact);
+ }
+
+}
Property changes on: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MissingContactObservationEndDateException.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MissingContactObservedDataControlException.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MissingContactObservedDataControlException.java (rev 0)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MissingContactObservedDataControlException.java 2014-04-07 17:09:47 UTC (rev 1858)
@@ -0,0 +1,18 @@
+package fr.ifremer.wao.services.service;
+
+import fr.ifremer.wao.entity.Contact;
+
+/**
+ * Created on 4/7/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 4.0
+ */
+public class MissingContactObservedDataControlException extends WaoContactValidationException {
+
+ private static final long serialVersionUID = 1L;
+
+ public MissingContactObservedDataControlException(Contact contact) {
+ super(contact);
+ }
+}
Property changes on: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MissingContactObservedDataControlException.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MissingContactRestitutionException.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MissingContactRestitutionException.java (rev 0)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MissingContactRestitutionException.java 2014-04-07 17:09:47 UTC (rev 1858)
@@ -0,0 +1,40 @@
+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 fr.ifremer.wao.entity.Contact;
+
+/**
+ * Created on 4/4/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 4.0
+ */
+public class MissingContactRestitutionException extends WaoContactValidationException {
+
+ private static final long serialVersionUID = 1L;
+
+ public MissingContactRestitutionException(Contact contact) {
+ super(contact);
+ }
+
+}
Property changes on: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MissingContactRestitutionException.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MissingContactStateMotifException.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MissingContactStateMotifException.java (rev 0)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MissingContactStateMotifException.java 2014-04-07 17:09:47 UTC (rev 1858)
@@ -0,0 +1,40 @@
+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 fr.ifremer.wao.entity.Contact;
+
+/**
+ * Created on 4/4/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 4.0
+ */
+public class MissingContactStateMotifException extends WaoContactValidationException {
+
+ private static final long serialVersionUID = 1L;
+
+ public MissingContactStateMotifException(Contact contact) {
+ super(contact);
+ }
+
+}
Property changes on: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/MissingContactStateMotifException.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerContactsService.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerContactsService.java 2014-04-07 17:07:49 UTC (rev 1857)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerContactsService.java 2014-04-07 17:09:47 UTC (rev 1858)
@@ -27,7 +27,9 @@
import com.google.common.collect.ImmutableSet;
import fr.ifremer.wao.ContactsFilter;
import fr.ifremer.wao.WaoTechnicalException;
+import fr.ifremer.wao.WaoUtils;
import fr.ifremer.wao.entity.Boat;
+import fr.ifremer.wao.entity.Company;
import fr.ifremer.wao.entity.Contact;
import fr.ifremer.wao.entity.ContactImpl;
import fr.ifremer.wao.entity.ContactState;
@@ -238,8 +240,9 @@
List<Boat> boats = getBoatDao().findAll();
List<ContactStateMotif> motives = getContactStateMotifDao().findAll();
+ Locale l = getLocale();
ImportModel<Contact> contactImportModel =
- ObsMerContactImportExportModel.forImport(getLocale(),
+ ObsMerContactImportExportModel.forImport(l,
obsProgram,
waoUsers,
sampleRows,
@@ -258,27 +261,96 @@
UpdateContactCommand updateContactCommand = newUpdateContactCommand(authenticatedWaoUser,
optionalContactId);
- //FIXME Apply imported contact...
-// updateContactCommand.setContact(contact);
+ if (updateContactCommand.isCreation()) {
- try {
- preValidate(authenticatedWaoUser, updateContactCommand, false);
- } catch (ContactNotUpdatableException e) {
- if (log.isWarnEnabled()) {
- log.warn("Can't update contact: " + contactId);
- }
- continue;
+ // TODO bind everything ?
+ } else {
+
+ // TODO bind only filled ?
}
+ preValidate(authenticatedWaoUser, updateContactCommand, false);
+
save0(updateContactCommand);
}
} catch (ImportRuntimeException e) {
throw new ImportErrorException(e);
- } catch (ContactNotValidException e) {
- throw new ImportErrorException(e);
- } catch (NullSampleMonthException e) {
- throw new ImportErrorException(e);
+ } catch (ContactNotUpdatableException e) {
+ String message = l(l, "wao.import.contact.failure.not.updatable");
+ throw new ImportErrorException(message);
+ } catch (UnwantedContactContactStateMotifException e) {
+ String message = l(l, "wao.import.contact.failure.unwantedContactStateMotif");
+ throw new ImportErrorException(message);
+ } catch (MissingContactNbObservantsForObservationDoneStateException e) {
+ String state = WaoUtils.l(l, e.getContact().getContactState());
+ String message = l(l, "wao.import.contact.failure.missingObserver", state);
+ throw new ImportErrorException(message);
+ } catch (MissingContactObservationEndDateException e) {
+ String state = WaoUtils.l(l, e.getContact().getContactState());
+ String message = l(l, "wao.import.contact.failure.missingObservationEndDate", state);
+ throw new ImportErrorException(message);
+ } catch (ContactDataInputDateAfterObservationEndDateException e) {
+ String message = l(l, "wao.import.contact.failure.dataInputDateAfterObservationEndDate");
+ throw new ImportErrorException(message);
+ } catch (InvalidContactObservationBeginDateException e) {
+ String message = l(l, "wao.import.contact.failure.invalidObservationBeginDate");
+ throw new ImportErrorException(message);
+ } catch (MissingContactRestitutionException e) {
+ String message = l(l, "wao.import.contact.failure.missingRestitution");
+ throw new ImportErrorException(message);
+ } catch (ContactDataInputDateAfterTodayException e) {
+ String message = l(l, "wao.import.contact.failure.dataInputDateAfterObservationEndDate");
+ throw new ImportErrorException(message);
+ } catch (MissingContactCommentException e) {
+ String state = WaoUtils.l(l, e.getContact().getContactState());
+ String message = l(l, "wao.import.contact.failure.missingComment", state);
+ throw new ImportErrorException(message);
+ } catch (MismatchContactMainObserverCompanyException e) {
+ String companyName = e.getCompany().getName();
+ String observerLogin = e.getObserver().getLogin();
+ String message = l(l, "wao.import.contact.failure.mismatchCompanyForObserver", observerLogin, companyName);
+ throw new ImportErrorException(message);
+ } catch (ContactRestitutionDateBeforeDataInputDateException e) {
+ String message = l(l, "wao.import.contact.failure.transmissionDateBeforeDataInputDate");
+ throw new ImportErrorException(message);
+ } catch (ContactObservationEndDateBeforeBeginDateException e) {
+ String message = l(l, "wao.import.contact.failure.observationEndDateBeforeBeginDate");
+ throw new ImportErrorException(message);
+ } catch (DuplicatedContactMainObserverInSecondaryObserversException e) {
+ String message = l(l, "wao.import.contact.failure.duplicatedMainObserverInSecondaryObservers");
+ throw new ImportErrorException(message);
+ } catch (MissingContactDataReliabilityException e) {
+ String message = l(l, "wao.import.contact.failure.missingDataReliability");
+ throw new ImportErrorException(message);
+ } catch (MismatchContactSecondaryObserverCompanyException e) {
+ String companyName = e.getCompany().getName();
+ String observerLogin = e.getObserver().getLogin();
+ String message = l(l, "wao.import.contact.failure.mismatchCompanyForObserver", observerLogin, companyName);
+ throw new ImportErrorException(message);
+ } catch (MissingContactObservedDataControlException e) {
+ String message = l(l, "wao.import.contact.failure.missingObservedDataControl");
+ throw new ImportErrorException(message);
+ } catch (MissingContactStateMotifException e) {
+ String message = l(l, "wao.import.contact.failure.missingContactStateMotif");
+ throw new ImportErrorException(message);
+ } catch (MissingContactDataInputDateException e) {
+ String message = l(l, "wao.import.contact.failure.missingDataInputDate");
+ throw new ImportErrorException(message);
+ } catch (MissingContactMainObserverException e) {
+ String message = l(l, "wao.import.contact.failure.missingMainObserver");
+ throw new ImportErrorException(message);
+ } catch (MissingContactCommentAdminException e) {
+ String dataReliability = WaoUtils.l(l, e.getContact().getDataReliability());
+ String message = l(l, "wao.import.contact.failure.missingCommentAdmin", dataReliability);
+ throw new ImportErrorException(message);
+ } catch (ContactObservationEndDateAfterTodayException e) {
+ String message = l(l, "wao.import.contact.failure.observationEndDateAfterToday");
+ throw new ImportErrorException(message);
+ } catch (MissingContactObservationBeginDateException e) {
+ String state = WaoUtils.l(l, e.getContact().getContactState());
+ String message = l(l, "wao.import.contact.failure.missingObservationBeginDate", state);
+ throw new ImportErrorException(message);
}
commit();
@@ -286,7 +358,29 @@
public void preValidate(AuthenticatedWaoUser authenticatedWaoUser,
UpdateContactCommand updateContactCommand,
- boolean needUpdate) throws ContactNotUpdatableException, ContactNotValidException {
+ boolean needUpdate) throws
+ ContactNotUpdatableException,
+ MissingContactMainObserverException,
+ MismatchContactMainObserverCompanyException,
+ DuplicatedContactMainObserverInSecondaryObserversException,
+ MismatchContactSecondaryObserverCompanyException,
+ InvalidContactObservationBeginDateException,
+ ContactObservationEndDateBeforeBeginDateException,
+ ContactObservationEndDateAfterTodayException,
+ ContactDataInputDateAfterObservationEndDateException,
+ ContactDataInputDateAfterTodayException,
+ MissingContactCommentException,
+ MissingContactObservationBeginDateException,
+ MissingContactObservationEndDateException,
+ MissingContactNbObservantsForObservationDoneStateException,
+ MissingContactStateMotifException,
+ UnwantedContactContactStateMotifException,
+ MissingContactObservedDataControlException,
+ MissingContactRestitutionException,
+ MissingContactDataInputDateException,
+ ContactRestitutionDateBeforeDataInputDateException,
+ MissingContactDataReliabilityException,
+ MissingContactCommentAdminException {
if (needUpdate) {
Preconditions.checkState(!updateContactCommand.isCreation());
@@ -310,155 +404,204 @@
Locale l = serviceContext.getLocale();
- if (contact.getMainObserver() == null) {
- throw new ContactNotValidException(l(l, "wao.import.contact.failure.missing.main.observer"));
- }
+ Company company = contact.getSampleRow().getCompany();
- if (contact.isSecondaryObserversNotEmpty() && contact.getSecondaryObservers().contains(contact.getMainObserver())) {
- throw new ContactNotValidException(l(l, "wao.import.contact.failure.mainObserver.cant.be.secondaryObserver"));
- }
+ WaoUser mainObserver = contact.getMainObserver();
- for (WaoUser observer : contact.getAllObservers()) {
- boolean observerWorksForCompanyInSampleRow = observer.getCompany().equals(contact.getSampleRow().getCompany());
+ {
+ //---
+ // mainObserver
+ //---
+
+ if (mainObserver == null) {
+ throw new MissingContactMainObserverException(contact);
+ }
+
+ boolean observerWorksForCompanyInSampleRow = mainObserver.getCompany().equals(company);
if (!observerWorksForCompanyInSampleRow) {
- throw new ContactNotValidException(l(l, "wao.import.contact.failure.invalid.company.for.observer",
- observer.getLogin(), contact.getSampleRow().getCompany().getName()));
+ throw new MismatchContactMainObserverCompanyException(contact, company, mainObserver);
}
}
- // Validation for saving contact depends on contactState
- ContactState contactState = contact.getContactState();
- Date observationBeginDate = contact.getObservationBeginDate();
- if (log.isDebugEnabled()) {
- log.debug("For state : " + contactState + " and observation begin date " + observationBeginDate);
- }
+ if (contact.isSecondaryObserversNotEmpty()) {
- // need the sample months to be loaded, it's never the case :-(
- // boolean operationBeginDateIsValid = contact.getSampleRow().isValid(observationBeginDate);
+ //---
+ // secondaryObservers
+ //---
- String sampleRowCode = contact.getSampleRow().getCode();
- SampleRow sampleRow = getSampleRowDao().forCodeEquals(sampleRowCode).findAny();
+ if (contact.getSecondaryObservers().contains(mainObserver)) {
+ throw new DuplicatedContactMainObserverInSecondaryObserversException(contact);
+ }
- SampleMonth month = sampleRow.getSampleMonth(observationBeginDate);
- boolean operationBeginDateIsValid = month != null;
-
- if (log.isDebugEnabled()) {
- log.debug("operation begin data is valid : " + operationBeginDateIsValid);
+ for (WaoUser observer : contact.getSecondaryObservers()) {
+ boolean observerWorksForCompanyInSampleRow = observer.getCompany().equals(company);
+ if (!observerWorksForCompanyInSampleRow) {
+ throw new MismatchContactSecondaryObserverCompanyException(contact, observer, company);
+ }
+ }
}
- if (observationBeginDate != null && !operationBeginDateIsValid) {
- throw new ContactNotValidException(l(l, "wao.import.contact.failure.invalid.trip.beginDate",
- contact.getSampleRow().getCode()));
- }
-
+ Date observationBeginDate = contact.getObservationBeginDate();
Date observationEndDate = contact.getObservationEndDate();
- if (observationBeginDate != null && observationEndDate != null
- && observationEndDate.before(observationBeginDate)) {
- throw new ContactNotValidException(l(l, "wao.import.contact.failure.invalid.observation.endDate"));
- }
-
Date dataInputDate = contact.getDataInputDate();
- // 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 observationEndDateIsBeforeDataInputDate =
- observationEndDate == null
- || dataInputDate == null
- || observationEndDate.before(DateUtil.setMaxTimeOfDay(dataInputDate));
- if (log.isDebugEnabled()) {
- log.debug("observationEndDate = " + observationEndDate +
- ", dateInputDate = " + dataInputDate + ", observationEndDateIsBeforeDataInputDate = "
- + observationEndDateIsBeforeDataInputDate);
+ SampleRow sampleRow = contact.getSampleRow();
+
+ if (observationBeginDate != null) {
+
+ //---
+ // observationBeginDate
+ //---
+
+ SampleMonth month = sampleRow.getSampleMonth(observationBeginDate);
+ boolean operationBeginDateIsValid = month != null;
+
+ if (!operationBeginDateIsValid) {
+ throw new InvalidContactObservationBeginDateException(contact);
+ }
}
- if (!observationEndDateIsBeforeDataInputDate) {
- throw new ContactNotValidException(l(l, "wao.import.contact.failure.invalid.observation.end"));
- }
Date currentDate = serviceContext.getNow();
- if (observationEndDate != null && observationEndDate.after(currentDate)) {
- throw new ContactNotValidException(l(l, "wao.import.contact.failure.invalid.trip.endDate"));
- }
- if (dataInputDate != null && dataInputDate.after(currentDate)) {
- throw new ContactNotValidException(l(l, "wao.import.contact.failure.invalid.observation.end2"));
- }
+ if (observationEndDate != null) {
- // Non abouti
- if (contactState == ContactState.OBSERVATION_CANCELLED && StringUtils.isBlank(contact.getComment())) {
- throw new ContactNotValidException(l(l, "wao.business.contact.validation.commentMissingForState",
- contact.getContactState().toString()));
- // Observation réalisée
- } else if (contactState.equals(ContactState.OBSERVATION_DONE)) {
+ //---
+ // observationEndDate
+ //---
- if (observationBeginDate == null) {
- throw new ContactNotValidException(l(l, "wao.import.contact.failure.missing.trip.beginDate", contactState));
+ if (observationBeginDate != null
+ && observationEndDate.before(observationBeginDate)) {
+ throw new ContactObservationEndDateBeforeBeginDateException(contact);
}
- if (observationEndDate == null) {
- throw new ContactNotValidException(l(l, "wao.import.contact.failure.missing.observation.endDate", contactState));
+
+ if (observationEndDate.after(currentDate)) {
+ throw new ContactObservationEndDateAfterTodayException(contact, currentDate);
}
- if (contact.getNbObservants() == 0) {
- throw new ContactNotValidException(l(l, "wao.import.contact.failure.invalid.observer.state", contactState));
- }
- if (contact.getObsProgram() == ObsProgram.OBSVENTE) {
- if (contact.getTerrestrialLocation() == null) {
- throw new ContactNotValidException(l(l, "wao.import.contact.failure.missing.observationArea"));
+
+ }
+
+ if (dataInputDate != null) {
+
+ //---
+ // dataInputDate
+ //---
+
+ if (observationEndDate != null) {
+
+ // 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 observationEndDateIsBeforeDataInputDate =
+ observationEndDate.before(DateUtil.setMaxTimeOfDay(dataInputDate));
+
+ if (!observationEndDateIsBeforeDataInputDate) {
+ throw new ContactDataInputDateAfterObservationEndDateException(contact);
}
}
+
+ if (dataInputDate.after(currentDate)) {
+ throw new ContactDataInputDateAfterTodayException(contact, currentDate);
+ }
}
- boolean contactMustHaveAMotif = contact.getObsProgram() == ObsProgram.OBSMER
- && (contactState == ContactState.CONTACT_REFUSED
- || contactState == ContactState.CONTACT_DEFINITELY_REFUSED);
+ //---
+ // contactState
+ //---
+
+ ContactState contactState = contact.getContactState();
+
+ boolean contactMustHaveAMotif = false;
+ switch (contactState) {
+ case OBSERVATION_CANCELLED:
+
+ // Non abouti
+
+ if (StringUtils.isBlank(contact.getComment())) {
+ throw new MissingContactCommentException(contact);
+ }
+ break;
+ case OBSERVATION_DONE:
+
+ // Observation réalisée
+
+ if (observationBeginDate == null) {
+ throw new MissingContactObservationBeginDateException(contact);
+ }
+ if (observationEndDate == null) {
+ throw new MissingContactObservationEndDateException(contact);
+ }
+ if (contact.getNbObservants() == 0) {
+ throw new MissingContactNbObservantsForObservationDoneStateException(contact);
+ }
+ break;
+
+ case CONTACT_REFUSED:
+ contactMustHaveAMotif = true;
+ break;
+ case CONTACT_DEFINITELY_REFUSED:
+ contactMustHaveAMotif = true;
+ break;
+
+ }
+
+ //---
+ // contactStateMotif
+ //---
+
if (contactMustHaveAMotif && contact.getContactStateMotif() == null) {
- throw new ContactNotValidException(l(l, "wao.business.contact.validation.contactStateMotifMissing"));
+ throw new MissingContactStateMotifException(contact);
}
if (!contactMustHaveAMotif && contact.getContactStateMotif() != null) {
- throw new ContactNotValidException(l(l, "wao.business.contact.validation.contactStateMotifUnwanted"));
+ throw new UnwantedContactContactStateMotifException(contact);
}
- if (log.isDebugEnabled()) {
- log.debug("validationProgram = " + contact.getValidationProgram());
- }
+ if (BooleanUtils.isTrue(contact.getValidationCompany())) {
- if (BooleanUtils.isTrue(contact.getValidationCompany())) {
+ //---
+ // validationCompany
+ //---
+
// Pour valider un contact société, il faut que le contact aie une date de transmission
- if (contact.getContactState() == ContactState.OBSERVATION_DONE && contact.getObservedDataControl() == null) {
- throw new ContactNotValidException(l(l, "wao.business.contact.validation.observedDataControlMissingForValidation"));
+ if (ContactState.OBSERVATION_DONE == contactState && contact.getObservedDataControl() == null) {
+ throw new MissingContactObservedDataControlException(contact);
}
- if (contact.getObservedDataControl() == ObservedDataControl.ACCEPTED && contact.getRestitution() == null) {
- throw new ContactNotValidException(l(l, "wao.business.contact.validation.restitutionMissingForValidation"));
+ Date restitution = contact.getRestitution();
+
+ if (ObservedDataControl.ACCEPTED == contact.getObservedDataControl() && restitution == null) {
+ throw new MissingContactRestitutionException(contact);
}
- if (contact.getDataInputDate() == null && contact.getRestitution() != null) {
- throw new ContactNotValidException(l(l, "wao.import.contact.failure.missing.observationDate"));
+ if (dataInputDate == null && restitution != null) {
+ throw new MissingContactDataInputDateException(contact);
}
- if (contact.getDataInputDate() != null && contact.getRestitution() != null && contact.getRestitution().before(contact.getDataInputDate())) {
- throw new ContactNotValidException(l(l, "wao.import.contact.failure.invalid.transmissionDate"));
+ if (dataInputDate != null && restitution != null && restitution.before(dataInputDate)) {
+ throw new ContactRestitutionDateBeforeDataInputDateException(contact);
}
}
if (BooleanUtils.isTrue(contact.getValidationProgram())) {
+
+ //---
+ // validationProgram
+ //---
+
// it's an admin validation, data-reliability field must be filled
- if (log.isDebugEnabled()) {
- log.debug("field data reliability is " + contact.getDataReliability());
- }
- if (contact.getDataReliability() == null ||
- contact.getDataReliability() == DataReliability.UNKNOWN) {
- throw new ContactNotValidException(l(l, "wao.business.contact.validation.dataReliabilityMissingForValidation"));
- } else if (contact.getDataReliability() != DataReliability.RELIABLE
+ DataReliability dataReliability = contact.getDataReliability();
+
+ if (dataReliability == null || DataReliability.UNKNOWN == dataReliability) {
+ throw new MissingContactDataReliabilityException(contact);
+ } else if (DataReliability.RELIABLE != dataReliability
&& StringUtils.isEmpty(contact.getCommentAdmin())) {
- throw new ContactNotValidException(l(l, "wao.business.contact.validation.commentAdminNecessaryForDataReliability",
- contact.getDataReliability().toString()));
+ throw new MissingContactCommentAdminException(contact);
}
}
}
}
public void save(UpdateContactCommand updateContactCommand,
- boolean needUpdate) throws ContactNotValidException, ContactNotUpdatableException, NullSampleMonthException {
+ boolean needUpdate) throws ContactNotUpdatableException {
if (needUpdate) {
Preconditions.checkState(!updateContactCommand.isCreation());
@@ -490,7 +633,7 @@
commit();
}
- protected void save0(UpdateContactCommand updateContactCommand) throws NullSampleMonthException {
+ protected void save0(UpdateContactCommand updateContactCommand) {
// Get contact to validate (must exist)
Contact contact = updateContactCommand.getContact();
Added: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/UnwantedContactContactStateMotifException.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/UnwantedContactContactStateMotifException.java (rev 0)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/UnwantedContactContactStateMotifException.java 2014-04-07 17:09:47 UTC (rev 1858)
@@ -0,0 +1,18 @@
+package fr.ifremer.wao.services.service;
+
+import fr.ifremer.wao.entity.Contact;
+
+/**
+ * Created on 4/7/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 4.0
+ */
+public class UnwantedContactContactStateMotifException extends WaoContactValidationException {
+
+ private static final long serialVersionUID = 1L;
+
+ public UnwantedContactContactStateMotifException(Contact contact) {
+ super(contact);
+ }
+}
Property changes on: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/UnwantedContactContactStateMotifException.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
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-04-07 17:07:49 UTC (rev 1857)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/UpdateContactCommand.java 2014-04-07 17:09:47 UTC (rev 1858)
@@ -130,7 +130,7 @@
*/
public boolean mustValidateContact() {
boolean needValidation = isCreation() || // new contact
- oldValidationProgram == null || // want to unvalidate a contact
+ oldValidationProgram == null || // want to validate a contact
getValidationProgram() != null; // want to validate a contact
return needValidation;
}
Copied: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/WaoContactValidationException.java (from rev 1848, trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactNotValidException.java)
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/WaoContactValidationException.java (rev 0)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/WaoContactValidationException.java 2014-04-07 17:09:47 UTC (rev 1858)
@@ -0,0 +1,48 @@
+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 fr.ifremer.wao.WaoException;
+import fr.ifremer.wao.entity.Contact;
+
+/**
+ * Exception de base pour la validation d'une création - mise à jour ou import d'un contact.
+ * <p/>
+ * Created on 4/4/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 4.0
+ */
+public class WaoContactValidationException extends WaoException {
+
+ private static final long serialVersionUID = 1L;
+
+ protected Contact contact;
+
+ public WaoContactValidationException(Contact contact) {
+ this.contact = contact;
+ }
+
+ public Contact getContact() {
+ return contact;
+ }
+}
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-04-07 17:07:49 UTC (rev 1857)
+++ trunk/wao-services/src/main/resources/i18n/wao-services_en_GB.properties 2014-04-07 17:09:47 UTC (rev 1858)
@@ -17,14 +17,6 @@
wao.business.completeSampling.false=No
wao.business.completeSampling.true=Yes
wao.business.completeSampling.undefined=Undefined
-wao.business.contact.validation.commentAdminNecessaryForDataReliability=You must precise in admin comment why data reliability is '%s'
-wao.business.contact.validation.commentMissingForState=You must give a comment for state '%s'
-wao.business.contact.validation.contactStateMotifMissing=You must precise a motif for the refusal
-wao.business.contact.validation.contactStateMotifUnwanted=You must not give a motif
-wao.business.contact.validation.dataReliabilityMissingForValidation=You must provide data reliability before validating
-wao.business.contact.validation.missingHoursOfBeginEndObservation=You must provide accurate time for the beginning and the end of observation
-wao.business.contact.validation.observedDataControlMissingForValidation=You must provide a value for observed data control
-wao.business.contact.validation.restitutionMissingForValidation=You must provide the restitution forward date
wao.business.entity.UserProfile.description=%s on %s%s
wao.business.mammalsCapture.mail.message=Hello,\n\nAn observer of the ObsMer program provided to WAO the following information\:\n\nTide\: %s\nProfession\: %s\n\nAccidental capture\:\n%s\n\nBest regards,\n\nObsmer program\nhttp\://www.ifremer.fr/wao
wao.business.mammalsCapture.mail.subject=Obsmer WAO\: Information about an accidental capture
@@ -39,33 +31,42 @@
wao.import.boat.failure.invalid.locationCode=The code '%s' is not a valid location code
wao.import.boat.failure.missing.port=The port is required
wao.import.contact.failure.boatMissing=You need to precise the plate number of the boat associated to the contact
+wao.import.contact.failure.dataInputDateAfterObservationEndDate=La date de saisie des données doit être postérieure à la date de fin d'observation
+wao.import.contact.failure.dataInputDateBeforeToday=La date de saisie des données doit être antérieur à la date du jour
wao.import.contact.failure.districtMissing=You need to precise the boat district
-wao.import.contact.failure.invalid.company.for.observer=L'observateur %s n'est pas membre de la société %s
-wao.import.contact.failure.invalid.dataInputDate=La date de saisie des données ne peut pas être postérieure à la date du jour
-wao.import.contact.failure.invalid.dataInputDate2=La date de saisie des données ne peut pas être antérieure à la date de fin d'observation
-wao.import.contact.failure.invalid.observation.endDate=La date de fin d'observation ne peut pas être antérieure à celle du début
-wao.import.contact.failure.invalid.observer.state=Il ne peut y avoir aucun observateur pour l'état '%s'
-wao.import.contact.failure.invalid.transmissionDate=Il faut que la date de transmission de la restitution soit après la date de saisie des données
-wao.import.contact.failure.invalid.trip.beginDate=La date de début de la marée doit correspondre à un mois valide (non vide) de la ligne
-wao.import.contact.failure.invalid.trip.endDate=La date de fin de la marée ne peut pas être postérieure à la date du jour
+wao.import.contact.failure.duplicatedMainObserverInSecondaryObservers=Main observer can not be also a secondary observer
+wao.import.contact.failure.invalidObservationBeginDate=La date de début de la marée doit correspondre à un mois valide (non vide) de la ligne
wao.import.contact.failure.locationTypeMissing=The type of the location must be filled
-wao.import.contact.failure.mainObserver.cant.be.secondaryObserver=
-wao.import.contact.failure.mainObserver.cant.be.secondaryObserver.=L'utilisateur référant ne doit pas se trouver aussi parmi les observateurs secondaires
-wao.import.contact.failure.missing.main.observer=Il faut au moins un observateur référant
-wao.import.contact.failure.missing.observation.endDate=La date de fin d'observation est obligatoire pour l'état '%s'
-wao.import.contact.failure.missing.observationArea=Il faut préciser un lieu d'observation
-wao.import.contact.failure.missing.observationDate=Il faut préciser une date de saisie des données en plus de la date de transmission de la restitution
-wao.import.contact.failure.missing.trip.beginDate=La date de début de marée est obligatoire pour l'état '%s'
+wao.import.contact.failure.mismatchCompanyForObserver=L'observateur %s n'est pas membre de la société %s
+wao.import.contact.failure.missingComment=You must give a comment for state '%s'
+wao.import.contact.failure.missingCommentAdmin=You must precise in admin comment why data reliability is '%s'
+wao.import.contact.failure.missingContactStateMotif=You must precise a motif for the refusal
+wao.import.contact.failure.missingDataInputDate=Il faut préciser une date de saisie des données en plus de la date de transmission de la restitution
+wao.import.contact.failure.missingDataReliability=You must provide data reliability before validating
+wao.import.contact.failure.missingHoursOfBeginEndObservation=You must provide accurate time for the beginning and the end of observation
+wao.import.contact.failure.missingMainBbserver=Il faut au moins un observateur référant
+wao.import.contact.failure.missingMainObserver=
+wao.import.contact.failure.missingObservationArea=Il faut préciser un lieu d'observation
+wao.import.contact.failure.missingObservationBeginDate=La date de début de marée est obligatoire pour l'état '%s'
+wao.import.contact.failure.missingObservationEndDate=La date de fin d'observation est obligatoire pour l'état '%s'
+wao.import.contact.failure.missingObservedDataControl=You must provide a value for observed data control
+wao.import.contact.failure.missingObserver=Il ne peut y avoir aucun observateur pour l'état '%s'
+wao.import.contact.failure.missingRestitution=You must provide the restitution forward date
+wao.import.contact.failure.not.updatable=Insufficient credentials to update contact
+wao.import.contact.failure.observationEndDateAfterToday=La date de fin de la marée ne peut pas être postérieure à la date du jour
+wao.import.contact.failure.observationEndDateBeforeBeginDate=La date de fin d'observation ne peut pas être antérieure à celle du début
wao.import.contact.failure.sampleRowCodeMissing=The code of the sample row line is missing
wao.import.contact.failure.terrestrialLocationMissing=The code of the terrestrial location is missing
+wao.import.contact.failure.transmissionDateBeforeDataInputDate=Il faut que la date de transmission de la restitution soit après la date de saisie des données
wao.import.contact.failure.unkwonCompany=Company named '%s' does not exist
+wao.import.contact.failure.unwantedContactStateMotif=You must not give a motif
wao.import.contact.failure.wrongBoat=There is no boat with plate number '%s'
wao.import.contact.failure.wrongColor=The color '%s' is not a valid color. It must be composed of 6 characters without the hash (\#), see http\://en.wikipedia.org/wiki/Web_colors
wao.import.contact.failure.wrongContactStateMotifCode=The code '%s' is not a valid code
wao.import.contact.failure.wrongDistrict='%s' is not a valid boat district code
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.
+wao.import.failure=Import fail for reason\: %s.
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.wrongObsDebCode=There is no profession code having 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-04-07 17:07:49 UTC (rev 1857)
+++ trunk/wao-services/src/main/resources/i18n/wao-services_fr_FR.properties 2014-04-07 17:09:47 UTC (rev 1858)
@@ -17,14 +17,6 @@
wao.business.completeSampling.false=Non
wao.business.completeSampling.true=Oui
wao.business.completeSampling.undefined=Non défini
-wao.business.contact.validation.commentAdminNecessaryForDataReliability=Il faut préciser dans le commentaire administrateur pourquoi la donnée est '%s'
-wao.business.contact.validation.commentMissingForState=Il faut préciser un commentaire pour l'état '%s'
-wao.business.contact.validation.contactStateMotifMissing=Il faut préciser un motif de refus
-wao.business.contact.validation.contactStateMotifUnwanted=Il ne faut pas préciser de motif de refus
-wao.business.contact.validation.dataReliabilityMissingForValidation=Il faut préciser la qualité de la donnée avant de valider
-wao.business.contact.validation.missingHoursOfBeginEndObservation=Il faut préciser les heures exactes de début et de fin d'observation
-wao.business.contact.validation.observedDataControlMissingForValidation=Il faut préciser une valeur pour le contrôle des données observées
-wao.business.contact.validation.restitutionMissingForValidation=Il faut préciser une date de transmission de la restitution de la donnée avant de valider
wao.business.entity.UserProfile.description=%s sur %s%s
wao.business.mammalsCapture.mail.message=Bonjour,\n\nUn observateur du programme Obsmer a renseigné dans WAO l'information suivante \:\n\nMarée \: %s\nMétier \: %s\n\nCapture accidentelle \:\n%s\n\nCordialement,\n\nLe programme Obsmer\nhttp\://www.ifremer.fr/wao
wao.business.mammalsCapture.mail.subject=Obsmer WAO\: Information sur capture accidentelle
@@ -38,33 +30,43 @@
wao.import.boat.failure.invalid.locationCode=Le code '%s' n'est pas un code de lieu valide
wao.import.boat.failure.missing.port=Il faut préciser un port
wao.import.contact.failure.boatMissing=Il faut préciser l'immatriculation du navire associé au contact
+wao.import.contact.failure.dataInputDateAfterObservationEndDate=
+wao.import.contact.failure.dataInputDateBeforeObservationEndDate=La date de saisie des données ne peut pas être antérieure à la date de fin d'observation
+wao.import.contact.failure.dataInputDateBeforeToday=La date de saisie des données doit être antérieur à la date du jour
wao.import.contact.failure.districtMissing=Il faut préciser le code d'un quartier maritime
-wao.import.contact.failure.invalid.company.for.observer=L'observateur %s n'est pas membre de la société %s
-wao.import.contact.failure.invalid.dataInputDate=La date de saisie des données ne peut pas être postérieure à la date du jour
-wao.import.contact.failure.invalid.dataInputDate2=La date de saisie des données ne peut pas être antérieure à la date de fin d'observation
-wao.import.contact.failure.invalid.observation.endDate=La date de fin d'observation ne peut pas être antérieure à celle du début
-wao.import.contact.failure.invalid.observer.state=Il ne peut y avoir aucun observateur pour l'état '%s'
-wao.import.contact.failure.invalid.transmissionDate=Il faut que la date de transmission de la restitution soit après la date de saisie des données
-wao.import.contact.failure.invalid.trip.beginDate=La date de début de la marée doit correspondre à un mois valide (non vide) de la ligne
-wao.import.contact.failure.invalid.trip.endDate=La date de fin de la marée ne peut pas être postérieure à la date du jour
+wao.import.contact.failure.duplicatedMainObserverInSecondaryObservers=L'utilisateur référant ne doit pas se trouver aussi parmi les observateurs secondaires
+wao.import.contact.failure.invalid.observationBeginDate=La date de début de la marée doit correspondre à un mois valide (non vide) de la ligne
+wao.import.contact.failure.invalidObservationBeginDate=
wao.import.contact.failure.locationTypeMissing=Le type du lieu doit être renseigné
-wao.import.contact.failure.mainObserver.cant.be.secondaryObserver=
-wao.import.contact.failure.mainObserver.cant.be.secondaryObserver.=L'utilisateur référant ne doit pas se trouver aussi parmi les observateurs secondaires
-wao.import.contact.failure.missing.main.observer=Il faut au moins un observateur référant
-wao.import.contact.failure.missing.observation.endDate=La date de fin d'observation est obligatoire pour l'état '%s'
-wao.import.contact.failure.missing.observationArea=Il faut préciser un lieu d'observation
-wao.import.contact.failure.missing.observationDate=Il faut préciser une date de saisie des données en plus de la date de transmission de la restitution
-wao.import.contact.failure.missing.trip.beginDate=La date de début de marée est obligatoire pour l'état '%s'
+wao.import.contact.failure.mismatchCompanyForObserver=L'observateur %s n'est pas membre de la société %s
+wao.import.contact.failure.missingComment=Il faut préciser un commentaire pour l'état '%s'
+wao.import.contact.failure.missingCommentAdmin=Il faut préciser dans le commentaire administrateur pourquoi la donnée est '%s'
+wao.import.contact.failure.missingContactStateMotif=Il faut préciser un motif de refus
+wao.import.contact.failure.missingDataInputDate=Il faut préciser une date de saisie des données en plus de la date de transmission de la restitution
+wao.import.contact.failure.missingDataReliability=Il faut préciser la qualité de la donnée avant de valider
+wao.import.contact.failure.missingHoursOfBeginEndObservation=Il faut préciser les heures exactes de début et de fin d'observation
+wao.import.contact.failure.missingMainObserver=Il faut au moins un observateur référant
+wao.import.contact.failure.missingObservationArea=Il faut préciser un lieu d'observation
+wao.import.contact.failure.missingObservationBeginDate=La date de début de marée est obligatoire pour l'état '%s'
+wao.import.contact.failure.missingObservationEndDate=La date de fin d'observation est obligatoire pour l'état '%s'
+wao.import.contact.failure.missingObservedDataControl=Il faut préciser une valeur pour le contrôle des données observées
+wao.import.contact.failure.missingObserver=Il ne peut y avoir aucun observateur pour l'état '%s'
+wao.import.contact.failure.missingRestitution=Il faut préciser une date de transmission de la restitution de la donnée avant de valider
+wao.import.contact.failure.not.updatable=Vous n'avez pas les droits suffisants pour modifier le contact
+wao.import.contact.failure.observationEndDateAfterToday=La date de fin de la marée ne peut pas être postérieure à la date du jour
+wao.import.contact.failure.observationEndDateBeforeBeginDate=La date de fin d'observation ne peut pas être antérieure à celle du début
wao.import.contact.failure.sampleRowCodeMissing=Il manque le code de la ligne de plan associée
wao.import.contact.failure.terrestrialLocationMissing=Il manque le code du lieu
+wao.import.contact.failure.transmissionDateBeforeDataInputDate=Il faut que la date de transmission de la restitution soit après la date de saisie des données
wao.import.contact.failure.unkwonCompany=Il n'y a pas de société ayant pour nom '%s'
+wao.import.contact.failure.unwantedContactStateMotif=Il ne faut pas préciser de motif de refus
wao.import.contact.failure.wrongBoat=Il n'y a pas de navire avec l'immatriculation '%s'
wao.import.contact.failure.wrongColor=Le code couleur '%s' n'est pas valide, il doit être composé de six caractères sans dièze voir http\://fr.wikipedia.org/wiki/Couleurs_du_Web
wao.import.contact.failure.wrongContactStateMotifCode=Le code '%s' n'est pas un code de motif de refus valide
wao.import.contact.failure.wrongDistrict='%s' n'est pas un code quartier maritime valide
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.
+wao.import.failure=Une erreur est survenue lors de l'import \: %s.
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.wrongObsDebCode=Il n'y a pas de code métier ayant pour code '%s'
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-04-07 17:07:49 UTC (rev 1857)
+++ trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/AbstractImportCsvAction.java 2014-04-07 17:09:47 UTC (rev 1858)
@@ -93,7 +93,7 @@
} catch (ImportErrorException e) {
- session.addErrorMessages(e.getMessage());
+ session.addErrorMessages(e.getMessage(getLocale()));
result = ERROR;
Modified: trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/EditContactAction.java
===================================================================
--- trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/EditContactAction.java 2014-04-07 17:07:49 UTC (rev 1857)
+++ trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/EditContactAction.java 2014-04-07 17:09:47 UTC (rev 1858)
@@ -24,10 +24,31 @@
import com.google.common.base.Optional;
import com.google.common.base.Strings;
import com.opensymphony.xwork2.Preparable;
+import fr.ifremer.wao.WaoUtils;
import fr.ifremer.wao.services.AuthenticatedWaoUser;
+import fr.ifremer.wao.services.service.ContactDataInputDateAfterObservationEndDateException;
+import fr.ifremer.wao.services.service.ContactDataInputDateAfterTodayException;
import fr.ifremer.wao.services.service.ContactNotUpdatableException;
-import fr.ifremer.wao.services.service.ContactNotValidException;
+import fr.ifremer.wao.services.service.ContactObservationEndDateAfterTodayException;
+import fr.ifremer.wao.services.service.ContactObservationEndDateBeforeBeginDateException;
+import fr.ifremer.wao.services.service.ContactRestitutionDateBeforeDataInputDateException;
+import fr.ifremer.wao.services.service.DuplicatedContactMainObserverInSecondaryObserversException;
+import fr.ifremer.wao.services.service.InvalidContactObservationBeginDateException;
+import fr.ifremer.wao.services.service.MismatchContactMainObserverCompanyException;
+import fr.ifremer.wao.services.service.MismatchContactSecondaryObserverCompanyException;
+import fr.ifremer.wao.services.service.MissingContactCommentAdminException;
+import fr.ifremer.wao.services.service.MissingContactCommentException;
+import fr.ifremer.wao.services.service.MissingContactDataInputDateException;
+import fr.ifremer.wao.services.service.MissingContactDataReliabilityException;
+import fr.ifremer.wao.services.service.MissingContactMainObserverException;
+import fr.ifremer.wao.services.service.MissingContactNbObservantsForObservationDoneStateException;
+import fr.ifremer.wao.services.service.MissingContactObservationBeginDateException;
+import fr.ifremer.wao.services.service.MissingContactObservationEndDateException;
+import fr.ifremer.wao.services.service.MissingContactObservedDataControlException;
+import fr.ifremer.wao.services.service.MissingContactRestitutionException;
+import fr.ifremer.wao.services.service.MissingContactStateMotifException;
import fr.ifremer.wao.services.service.ObsMerContactsService;
+import fr.ifremer.wao.services.service.UnwantedContactContactStateMotifException;
import fr.ifremer.wao.services.service.UpdateContactCommand;
import fr.ifremer.wao.web.WaoJspActionSupport;
import org.apache.struts2.convention.annotation.Result;
@@ -86,9 +107,81 @@
try {
service.preValidate(authenticatedWaoUser, updateContactCommand, true);
} catch (ContactNotUpdatableException e) {
- addActionError(t("wao.ui.contacts.validation.failure.not.updatable", e.getMessage()));
- } catch (ContactNotValidException e) {
- addActionError(t("wao.ui.contacts.validation.failure.not.valid", e.getMessage()));
+ addActionError(t("wao.ui.contacts.validation.failure.not.updatable"));
+ addFieldError("updateContactCommand.contact.", t("wao.ui.contacts.validation.failure.not.updatable", e.getMessage()));
+
+ } catch (UnwantedContactContactStateMotifException e) {
+ addFieldError("updateContactCommand.contact.", t("wao.import.contact.failure.unwantedContactStateMotif"));
+
+ } catch (MissingContactNbObservantsForObservationDoneStateException e) {
+ String state = WaoUtils.l(getLocale(), e.getContact().getContactState());
+ addFieldError("updateContactCommand.contact.", t("wao.import.contact.failure.missingObserver", state));
+
+ } catch (MissingContactObservationEndDateException e) {
+ String state = WaoUtils.l(getLocale(), e.getContact().getContactState());
+ addFieldError("updateContactCommand.contact.", t("wao.import.contact.failure.missingObservationEndDate", state));
+
+ } catch (ContactDataInputDateAfterObservationEndDateException e) {
+ addFieldError("updateContactCommand.contact.", t("wao.import.contact.failure.dataInputDateAfterObservationEndDate"));
+
+ } catch (InvalidContactObservationBeginDateException e) {
+ addFieldError("updateContactCommand.contact.", t("wao.import.contact.failure.invalidObservationBeginDate"));
+
+ } catch (MissingContactRestitutionException e) {
+ addFieldError("updateContactCommand.contact.", t("wao.import.contact.failure.missingRestitution"));
+
+ } catch (ContactDataInputDateAfterTodayException e) {
+ addFieldError("updateContactCommand.contact.", t("wao.import.contact.failure.dataInputDateAfterObservationEndDate"));
+
+ } catch (MissingContactCommentException e) {
+ String state = WaoUtils.l(getLocale(), e.getContact().getContactState());
+ addFieldError("updateContactCommand.contact.", t("wao.import.contact.failure.missingComment", state));
+
+ } catch (MismatchContactMainObserverCompanyException e) {
+ String companyName = e.getCompany().getName();
+ String observerLogin = e.getObserver().getLogin();
+ addFieldError("updateContactCommand.contact.", t("wao.import.contact.failure.mismatchCompanyForObserver", observerLogin, companyName));
+
+ } catch (ContactRestitutionDateBeforeDataInputDateException e) {
+ addFieldError("updateContactCommand.contact.", t("wao.import.contact.failure.transmissionDateBeforeDataInputDate"));
+
+ } catch (ContactObservationEndDateBeforeBeginDateException e) {
+ addFieldError("updateContactCommand.contact.", t("wao.import.contact.failure.observationEndDateBeforeBeginDate"));
+
+ } catch (DuplicatedContactMainObserverInSecondaryObserversException e) {
+ addFieldError("updateContactCommand.contact.", t("wao.import.contact.failure.duplicatedMainObserverInSecondaryObservers"));
+
+ } catch (MissingContactDataReliabilityException e) {
+ addFieldError("updateContactCommand.contact.", t("wao.import.contact.failure.missingDataReliability"));
+
+ } catch (MismatchContactSecondaryObserverCompanyException e) {
+ String companyName = e.getCompany().getName();
+ String observerLogin = e.getObserver().getLogin();
+ addFieldError("updateContactCommand.contact.", t("wao.import.contact.failure.mismatchCompanyForObserver", observerLogin, companyName));
+
+ } catch (MissingContactObservedDataControlException e) {
+ addFieldError("updateContactCommand.contact.", t("wao.import.contact.failure.missingObservedDataControl"));
+
+ } catch (MissingContactStateMotifException e) {
+ addFieldError("updateContactCommand.contact.", t("wao.import.contact.failure.missingContactStateMotif"));
+
+ } catch (MissingContactDataInputDateException e) {
+ addFieldError("updateContactCommand.contact.", t("wao.import.contact.failure.missingDataInputDate"));
+
+ } catch (MissingContactMainObserverException e) {
+ addFieldError("updateContactCommand.contact.", t("wao.import.contact.failure.missingMainObserver"));
+
+ } catch (MissingContactCommentAdminException e) {
+ String dataReliability = WaoUtils.l(getLocale(), e.getContact().getDataReliability());
+ addFieldError("updateContactCommand.contact.", t("wao.import.contact.failure.missingCommentAdmin", dataReliability));
+
+ } catch (ContactObservationEndDateAfterTodayException e) {
+ addFieldError("updateContactCommand.contact.", t("wao.import.contact.failure.observationEndDateAfterToday"));
+
+ } catch (MissingContactObservationBeginDateException e) {
+ String state = WaoUtils.l(getLocale(), e.getContact().getContactState());
+ addFieldError("updateContactCommand.contact.", t("wao.import.contact.failure.missingObservationBeginDate", state));
+
}
}
Modified: trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/ValidateContactJsonAction.java
===================================================================
--- trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/ValidateContactJsonAction.java 2014-04-07 17:07:49 UTC (rev 1857)
+++ trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/ValidateContactJsonAction.java 2014-04-07 17:09:47 UTC (rev 1858)
@@ -24,9 +24,31 @@
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import com.opensymphony.xwork2.Preparable;
+import fr.ifremer.wao.WaoUtils;
import fr.ifremer.wao.services.AuthenticatedWaoUser;
+import fr.ifremer.wao.services.service.ContactDataInputDateAfterObservationEndDateException;
+import fr.ifremer.wao.services.service.ContactDataInputDateAfterTodayException;
import fr.ifremer.wao.services.service.ContactNotUpdatableException;
-import fr.ifremer.wao.services.service.ContactNotValidException;
+import fr.ifremer.wao.services.service.ContactObservationEndDateAfterTodayException;
+import fr.ifremer.wao.services.service.ContactObservationEndDateBeforeBeginDateException;
+import fr.ifremer.wao.services.service.ContactRestitutionDateBeforeDataInputDateException;
+import fr.ifremer.wao.services.service.DuplicatedContactMainObserverInSecondaryObserversException;
+import fr.ifremer.wao.services.service.InvalidContactObservationBeginDateException;
+import fr.ifremer.wao.services.service.MismatchContactMainObserverCompanyException;
+import fr.ifremer.wao.services.service.MismatchContactSecondaryObserverCompanyException;
+import fr.ifremer.wao.services.service.MissingContactCommentAdminException;
+import fr.ifremer.wao.services.service.MissingContactCommentException;
+import fr.ifremer.wao.services.service.MissingContactDataInputDateException;
+import fr.ifremer.wao.services.service.MissingContactDataReliabilityException;
+import fr.ifremer.wao.services.service.MissingContactMainObserverException;
+import fr.ifremer.wao.services.service.MissingContactNbObservantsForObservationDoneStateException;
+import fr.ifremer.wao.services.service.MissingContactObservationBeginDateException;
+import fr.ifremer.wao.services.service.MissingContactObservationEndDateException;
+import fr.ifremer.wao.services.service.MissingContactObservedDataControlException;
+import fr.ifremer.wao.services.service.MissingContactRestitutionException;
+import fr.ifremer.wao.services.service.MissingContactStateMotifException;
+import fr.ifremer.wao.services.service.UnwantedContactContactStateMotifException;
+import fr.ifremer.wao.services.service.WaoContactValidationException;
import fr.ifremer.wao.services.service.ObsMerContactsService;
import fr.ifremer.wao.services.service.UpdateContactCommand;
import fr.ifremer.wao.web.WaoJsonActionSupport;
@@ -147,9 +169,79 @@
try {
service.preValidate(authenticatedWaoUser, updateContactCommand, true);
} catch (ContactNotUpdatableException e) {
- errorMessage = t("wao.ui.contacts.validation.failure.not.updatable", e.getMessage());
- } catch (ContactNotValidException e) {
- errorMessage = t("wao.ui.contacts.validation.failure.not.valid", e.getMessage());
+ errorMessage = t("wao.ui.contacts.validation.failure.not.updatable");
+ } catch (UnwantedContactContactStateMotifException e) {
+ errorMessage = t("wao.import.contact.failure.unwantedContactStateMotif");
+
+ } catch (MissingContactNbObservantsForObservationDoneStateException e) {
+ String state = WaoUtils.l(getLocale(), e.getContact().getContactState());
+ errorMessage = t("wao.import.contact.failure.missingObserver", state);
+
+ } catch (MissingContactObservationEndDateException e) {
+ String state = WaoUtils.l(getLocale(), e.getContact().getContactState());
+ errorMessage = t("wao.import.contact.failure.missingObservationEndDate", state);
+
+ } catch (ContactDataInputDateAfterObservationEndDateException e) {
+ errorMessage = t("wao.import.contact.failure.dataInputDateAfterObservationEndDate");
+
+ } catch (InvalidContactObservationBeginDateException e) {
+ errorMessage = t("wao.import.contact.failure.invalidObservationBeginDate");
+
+ } catch (MissingContactRestitutionException e) {
+ errorMessage = t("wao.import.contact.failure.missingRestitution");
+
+ } catch (ContactDataInputDateAfterTodayException e) {
+ errorMessage = t("wao.import.contact.failure.dataInputDateAfterObservationEndDate");
+
+ } catch (MissingContactCommentException e) {
+ String state = WaoUtils.l(getLocale(), e.getContact().getContactState());
+ errorMessage = t("wao.import.contact.failure.missingComment", state);
+
+ } catch (MismatchContactMainObserverCompanyException e) {
+ String companyName = e.getCompany().getName();
+ String observerLogin = e.getObserver().getLogin();
+ errorMessage = t("wao.import.contact.failure.mismatchCompanyForObserver", observerLogin, companyName);
+
+ } catch (ContactRestitutionDateBeforeDataInputDateException e) {
+ errorMessage = t("wao.import.contact.failure.transmissionDateBeforeDataInputDate");
+
+ } catch (ContactObservationEndDateBeforeBeginDateException e) {
+ errorMessage = t("wao.import.contact.failure.observationEndDateBeforeBeginDate");
+
+ } catch (DuplicatedContactMainObserverInSecondaryObserversException e) {
+ errorMessage = t("wao.import.contact.failure.duplicatedMainObserverInSecondaryObservers");
+
+ } catch (MissingContactDataReliabilityException e) {
+ errorMessage = t("wao.import.contact.failure.missingDataReliability");
+
+ } catch (MismatchContactSecondaryObserverCompanyException e) {
+ String companyName = e.getCompany().getName();
+ String observerLogin = e.getObserver().getLogin();
+ errorMessage = t("wao.import.contact.failure.mismatchCompanyForObserver", observerLogin, companyName);
+
+ } catch (MissingContactObservedDataControlException e) {
+ errorMessage = t("wao.import.contact.failure.missingObservedDataControl");
+
+ } catch (MissingContactStateMotifException e) {
+ errorMessage = t("wao.import.contact.failure.missingContactStateMotif");
+
+ } catch (MissingContactDataInputDateException e) {
+ errorMessage = t("wao.import.contact.failure.missingDataInputDate");
+
+ } catch (MissingContactMainObserverException e) {
+ errorMessage = t("wao.import.contact.failure.missingMainObserver");
+
+ } catch (MissingContactCommentAdminException e) {
+ String dataReliability = WaoUtils.l(getLocale(), e.getContact().getDataReliability());
+ errorMessage = t("wao.import.contact.failure.missingCommentAdmin", dataReliability);
+
+ } catch (ContactObservationEndDateAfterTodayException e) {
+ errorMessage = t("wao.import.contact.failure.observationEndDateAfterToday");
+
+ } catch (MissingContactObservationBeginDateException e) {
+ String state = WaoUtils.l(getLocale(), e.getContact().getContactState());
+ errorMessage = t("wao.import.contact.failure.missingObservationBeginDate", state);
+
} catch (Exception e) {
if (log.isErrorEnabled()) {
log.error(e);
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-04-07 17:07:49 UTC (rev 1857)
+++ trunk/wao-web/src/main/resources/i18n/wao-web_en_GB.properties 2014-04-07 17:09:47 UTC (rev 1858)
@@ -5,6 +5,25 @@
wao.import.boatGroups.success=Import boats successful
wao.import.boats.prompt=Import boat groups
wao.import.boats.success=Import boat groups successful
+wao.import.contact.failure.dataInputDateAfterObservationEndDate=
+wao.import.contact.failure.duplicatedMainObserverInSecondaryObservers=
+wao.import.contact.failure.invalidObservationBeginDate=
+wao.import.contact.failure.mismatchCompanyForObserver=
+wao.import.contact.failure.missingComment=
+wao.import.contact.failure.missingCommentAdmin=
+wao.import.contact.failure.missingContactStateMotif=
+wao.import.contact.failure.missingDataInputDate=
+wao.import.contact.failure.missingDataReliability=
+wao.import.contact.failure.missingMainObserver=
+wao.import.contact.failure.missingObservationBeginDate=
+wao.import.contact.failure.missingObservationEndDate=
+wao.import.contact.failure.missingObservedDataControl=
+wao.import.contact.failure.missingObserver=
+wao.import.contact.failure.missingRestitution=
+wao.import.contact.failure.observationEndDateAfterToday=
+wao.import.contact.failure.observationEndDateBeforeBeginDate=
+wao.import.contact.failure.transmissionDateBeforeDataInputDate=
+wao.import.contact.failure.unwantedContactStateMotif=
wao.import.contactStateMotives.prompt=Import contact state motives
wao.import.contactStateMotives.success=Import contact state motives successful
wao.import.fishingZones.prompt=Import fishing zones
@@ -134,7 +153,7 @@
wao.ui.contacts.title=%s contacts found
wao.ui.contacts.validation=Validation
wao.ui.contacts.validation.failure=An error occurs %s
-wao.ui.contacts.validation.failure.not.updatable=You can not modify this contact\: %s
+wao.ui.contacts.validation.failure.not.updatable=You can not modify the contact
wao.ui.contacts.validation.failure.not.valid=Contact is not valid\: %s
wao.ui.contacts.validation.to.accept.state.success=Contact was accepted successful
wao.ui.contacts.validation.to.reject.state.success=Contact was rejected successful
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-04-07 17:07:49 UTC (rev 1857)
+++ trunk/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties 2014-04-07 17:09:47 UTC (rev 1858)
@@ -5,6 +5,25 @@
wao.import.boatGroups.success=Import des flotilles réalisé avec succès
wao.import.boats.prompt=Import des navires
wao.import.boats.success=Import des navires réalisé avec succès
+wao.import.contact.failure.dataInputDateAfterObservationEndDate=
+wao.import.contact.failure.duplicatedMainObserverInSecondaryObservers=
+wao.import.contact.failure.invalidObservationBeginDate=
+wao.import.contact.failure.mismatchCompanyForObserver=
+wao.import.contact.failure.missingComment=
+wao.import.contact.failure.missingCommentAdmin=
+wao.import.contact.failure.missingContactStateMotif=
+wao.import.contact.failure.missingDataInputDate=
+wao.import.contact.failure.missingDataReliability=
+wao.import.contact.failure.missingMainObserver=
+wao.import.contact.failure.missingObservationBeginDate=
+wao.import.contact.failure.missingObservationEndDate=
+wao.import.contact.failure.missingObservedDataControl=
+wao.import.contact.failure.missingObserver=
+wao.import.contact.failure.missingRestitution=
+wao.import.contact.failure.observationEndDateAfterToday=
+wao.import.contact.failure.observationEndDateBeforeBeginDate=
+wao.import.contact.failure.transmissionDateBeforeDataInputDate=
+wao.import.contact.failure.unwantedContactStateMotif=
wao.import.contactStateMotives.prompt=Import des motifs de refus
wao.import.contactStateMotives.success=Import des motifs de refus réalisé avec succès
wao.import.fishingZones.prompt=Import des zones de pêches
@@ -134,7 +153,7 @@
wao.ui.contacts.title=%s contacts trouvés
wao.ui.contacts.validation=Validations
wao.ui.contacts.validation.failure=Une erreur est survenue %s
-wao.ui.contacts.validation.failure.not.updatable=Vous n'avez pas les droits pour modifier ce contact \: %s
+wao.ui.contacts.validation.failure.not.updatable=Vous n'avez pas les droits suffisants pour modifier le contact
wao.ui.contacts.validation.failure.not.valid=Le contact n'a pas pu être validé pour la raison suivante \: %s
wao.ui.contacts.validation.to.accept.state.success=Le contact a été accepté avec succès
wao.ui.contacts.validation.to.reject.state.success=Le contact a été rejeté avec succès
1
0
r1857 - trunk/wao-persistence/src/main/java/fr/ifremer/wao
by tchemit@users.forge.codelutin.com 07 Apr '14
by tchemit@users.forge.codelutin.com 07 Apr '14
07 Apr '14
Author: tchemit
Date: 2014-04-07 19:07:49 +0200 (Mon, 07 Apr 2014)
New Revision: 1857
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1857
Log:
add method to translate I18nAble
Modified:
trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java
Modified: trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java 2014-04-07 17:07:12 UTC (rev 1856)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java 2014-04-07 17:07:49 UTC (rev 1857)
@@ -21,9 +21,11 @@
* #L%
*/
+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 java.text.DateFormat;
import java.text.ParseException;
@@ -35,8 +37,6 @@
import java.util.Locale;
import java.util.regex.Pattern;
-import static org.nuiton.i18n.I18n.l;
-
public class WaoUtils {
@Deprecated
@@ -78,29 +78,33 @@
}
public static String formatTime(Locale locale, Date date) {
- return l(locale, "wao.time.formatter", date);
+ return I18n.l(locale, "wao.time.formatter", date);
}
public static String formatDateTime(Locale locale, Date date) {
- return l(locale, "wao.datetime.formatter", date);
+ return I18n.l(locale, "wao.datetime.formatter", date);
}
public static String formatDate(Locale locale, Date date) {
- return l(locale, "wao.date.formatter", date);
+ return I18n.l(locale, "wao.date.formatter", date);
}
public static String formatMonth(Locale locale, Date date) {
- return l(locale, "wao.month.formatter", date);
+ return I18n.l(locale, "wao.month.formatter", date);
}
public static Date parseMonth(Locale locale, String monthYear) throws ParseException {
- String pattern = l(locale, "wao.month.pattern");
+ String pattern = I18n.l(locale, "wao.month.pattern");
DateFormat dateFormat = new SimpleDateFormat(pattern);
return dateFormat.parse(monthYear);
}
+ 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})$");
+ return Pattern.compile("^(\\d{4})_" + obsProgram.getShortCode() + "(\\d{4})$");
}
public static <T extends Enum> Collection<Integer> toOrdinals(Collection<T> enums) {
1
0
r1856 - in trunk: wao-persistence/src/main/java/fr/ifremer/wao wao-services/src/main/java/fr/ifremer/wao/services/service wao-services/src/main/java/fr/ifremer/wao/services/service/administration
by tchemit@users.forge.codelutin.com 07 Apr '14
by tchemit@users.forge.codelutin.com 07 Apr '14
07 Apr '14
Author: tchemit
Date: 2014-04-07 19:07:12 +0200 (Mon, 07 Apr 2014)
New Revision: 1856
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1856
Log:
fix serializable on exceptions
Modified:
trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoException.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoTechnicalException.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/SampleRowCodeMustBeUniqueException.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/CompanyNameMustBeUniqueException.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/InactiveWaoUserException.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/LoginMustBeUniqueException.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/NoRoleAttributedException.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/UnknownBoatImmatriculationsException.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/UnknownFishingGearDcfCodeException.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/UnknownTargetSpeciesDcfCodeException.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/WrongCredentialsException.java
Modified: trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoException.java
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoException.java 2014-04-07 17:05:49 UTC (rev 1855)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoException.java 2014-04-07 17:07:12 UTC (rev 1856)
@@ -23,6 +23,8 @@
public class WaoException extends Exception {
+ private static final long serialVersionUID = 1L;
+
public WaoException() {
}
Modified: trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoTechnicalException.java
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoTechnicalException.java 2014-04-07 17:05:49 UTC (rev 1855)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoTechnicalException.java 2014-04-07 17:07:12 UTC (rev 1856)
@@ -23,6 +23,8 @@
public class WaoTechnicalException extends RuntimeException {
+ private static final long serialVersionUID = 1L;
+
public WaoTechnicalException() {
}
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/SampleRowCodeMustBeUniqueException.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/SampleRowCodeMustBeUniqueException.java 2014-04-07 17:05:49 UTC (rev 1855)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/SampleRowCodeMustBeUniqueException.java 2014-04-07 17:07:12 UTC (rev 1856)
@@ -25,4 +25,5 @@
public class SampleRowCodeMustBeUniqueException extends WaoException {
+ private static final long serialVersionUID = 1L;
}
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/CompanyNameMustBeUniqueException.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/CompanyNameMustBeUniqueException.java 2014-04-07 17:05:49 UTC (rev 1855)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/CompanyNameMustBeUniqueException.java 2014-04-07 17:07:12 UTC (rev 1856)
@@ -25,4 +25,5 @@
public class CompanyNameMustBeUniqueException extends WaoException {
+ private static final long serialVersionUID = 1L;
}
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/InactiveWaoUserException.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/InactiveWaoUserException.java 2014-04-07 17:05:49 UTC (rev 1855)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/InactiveWaoUserException.java 2014-04-07 17:07:12 UTC (rev 1856)
@@ -26,6 +26,8 @@
public class InactiveWaoUserException extends WaoException {
+ private static final long serialVersionUID = 1L;
+
protected WaoUser waoUser;
public InactiveWaoUserException(WaoUser waoUser) {
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/LoginMustBeUniqueException.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/LoginMustBeUniqueException.java 2014-04-07 17:05:49 UTC (rev 1855)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/LoginMustBeUniqueException.java 2014-04-07 17:07:12 UTC (rev 1856)
@@ -25,4 +25,5 @@
public class LoginMustBeUniqueException extends WaoException {
+ private static final long serialVersionUID = 1L;
}
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/NoRoleAttributedException.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/NoRoleAttributedException.java 2014-04-07 17:05:49 UTC (rev 1855)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/NoRoleAttributedException.java 2014-04-07 17:07:12 UTC (rev 1856)
@@ -26,6 +26,8 @@
public class NoRoleAttributedException extends WaoException {
+ private static final long serialVersionUID = 1L;
+
protected WaoUser waoUser;
public NoRoleAttributedException(WaoUser waoUser) {
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/UnknownBoatImmatriculationsException.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/UnknownBoatImmatriculationsException.java 2014-04-07 17:05:49 UTC (rev 1855)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/UnknownBoatImmatriculationsException.java 2014-04-07 17:07:12 UTC (rev 1856)
@@ -27,6 +27,8 @@
public class UnknownBoatImmatriculationsException extends WaoException {
+ private static final long serialVersionUID = 1L;
+
protected Set<String> immatriculations;
public UnknownBoatImmatriculationsException(Set<String> immatriculations) {
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/UnknownFishingGearDcfCodeException.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/UnknownFishingGearDcfCodeException.java 2014-04-07 17:05:49 UTC (rev 1855)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/UnknownFishingGearDcfCodeException.java 2014-04-07 17:07:12 UTC (rev 1856)
@@ -25,6 +25,8 @@
public class UnknownFishingGearDcfCodeException extends WaoException {
+ private static final long serialVersionUID = 1L;
+
protected String code;
public UnknownFishingGearDcfCodeException(String code) {
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/UnknownTargetSpeciesDcfCodeException.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/UnknownTargetSpeciesDcfCodeException.java 2014-04-07 17:05:49 UTC (rev 1855)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/UnknownTargetSpeciesDcfCodeException.java 2014-04-07 17:07:12 UTC (rev 1856)
@@ -25,6 +25,8 @@
public class UnknownTargetSpeciesDcfCodeException extends WaoException {
+ private static final long serialVersionUID = 1L;
+
protected String code;
public UnknownTargetSpeciesDcfCodeException(String code) {
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/WrongCredentialsException.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/WrongCredentialsException.java 2014-04-07 17:05:49 UTC (rev 1855)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/administration/WrongCredentialsException.java 2014-04-07 17:07:12 UTC (rev 1856)
@@ -25,4 +25,5 @@
public class WrongCredentialsException extends WaoException {
+ private static final long serialVersionUID = 1L;
}
1
0
r1855 - trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity
by tchemit@users.forge.codelutin.com 07 Apr '14
by tchemit@users.forge.codelutin.com 07 Apr '14
07 Apr '14
Author: tchemit
Date: 2014-04-07 19:05:49 +0200 (Mon, 07 Apr 2014)
New Revision: 1855
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1855
Log:
use new topia api
Modified:
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SampleRowImpl.java
Modified: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SampleRowImpl.java
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SampleRowImpl.java 2014-04-07 14:36:01 UTC (rev 1854)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SampleRowImpl.java 2014-04-07 17:05:49 UTC (rev 1855)
@@ -258,7 +258,7 @@
Preconditions.checkState(
!getObsProgram().equals(ObsProgram.OBSDEB),
"opération non prévue pour ObsDeb");
- if (CollectionUtils.isNotEmpty(getSampleMonth())) {
+ if (isSampleMonthNotEmpty()) {
for (SampleMonth sampleMonth : getSampleMonth()) {
if (sampleMonth.isPeriodDatesContains(date)) {
return sampleMonth;
1
0
r1854 - trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity
by bleny@users.forge.codelutin.com 07 Apr '14
by bleny@users.forge.codelutin.com 07 Apr '14
07 Apr '14
Author: bleny
Date: 2014-04-07 16:36:01 +0200 (Mon, 07 Apr 2014)
New Revision: 1854
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1854
Log:
refs #4490 fix query generation for boats registration code filter
Modified:
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/BoatTopiaDao.java
Modified: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/BoatTopiaDao.java
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/BoatTopiaDao.java 2014-04-07 14:17:38 UTC (rev 1853)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/BoatTopiaDao.java 2014-04-07 14:36:01 UTC (rev 1854)
@@ -100,9 +100,9 @@
}
if (StringUtils.isNotEmpty(filter.getRegistrationCode())) {
- //FIXME !
- query.addLike(Boat.PROPERTY_IMMATRICULATION + "::text", filter.getRegistrationCode() + "%");
+ query.addWhereClause("str(b." + Boat.PROPERTY_IMMATRICULATION + ") like :registrationCode", ImmutableMap.of("registrationCode", (Object) (filter.getRegistrationCode() + "%")));
}
+
if (CollectionUtils.isNotEmpty(filter.getShipOwnerIds())) {
query.addWhereClause(
"b.topiaId IN (SELECT b2.topiaId FROM fr.ifremer.wao.entity.BoatImpl AS b2 JOIN b2.shipOwner AS shipOwner WHERE shipOwner.topiaId IN (:shipOwnerIds))",
1
0
r1853 - in trunk: wao-services/src/main/java/fr/ifremer/wao/services/service wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer wao-web/src/main/resources/i18n wao-web/src/main/webapp wao-web/src/main/webapp/WEB-INF wao-web/src/main/webapp/WEB-INF/content/obsmer
by bleny@users.forge.codelutin.com 07 Apr '14
by bleny@users.forge.codelutin.com 07 Apr '14
07 Apr '14
Author: bleny
Date: 2014-04-07 16:17:38 +0200 (Mon, 07 Apr 2014)
New Revision: 1853
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1853
Log:
refs #4490 add boat infos form
Added:
trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/UpdateBoatInfosJsonAction.java
Modified:
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerBoatsService.java
trunk/wao-web/src/main/resources/i18n/wao-web_en_GB.properties
trunk/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties
trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/boat-details.jsp
trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/boats.jsp
trunk/wao-web/src/main/webapp/WEB-INF/decorators.xml
trunk/wao-web/src/main/webapp/enpoints-js.jsp
trunk/wao-web/src/main/webapp/wao.css
trunk/wao-web/src/main/webapp/wao.js
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerBoatsService.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerBoatsService.java 2014-04-07 11:01:57 UTC (rev 1852)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerBoatsService.java 2014-04-07 14:17:38 UTC (rev 1853)
@@ -27,6 +27,7 @@
import fr.ifremer.wao.WaoTechnicalException;
import fr.ifremer.wao.entity.Boat;
import fr.ifremer.wao.entity.BoatInfos;
+import fr.ifremer.wao.entity.BoatInfosImpl;
import fr.ifremer.wao.entity.BoatInfosTopiaDao;
import fr.ifremer.wao.entity.BoatTopiaDao;
import fr.ifremer.wao.entity.Company;
@@ -152,6 +153,20 @@
public BoatDetails getBoatDetails(ObsProgram obsProgram, String boatId, String companyId) {
+ BoatInfos boatInfos = getBoatInfos(boatId, companyId);
+
+ Contact mostRecentContact = getContactDao().findMostRecentContactOrNull(obsProgram, boatId, companyId);
+
+ long count = getContactDao().newQueryBuilder().addTopiaIdEquals(Contact.PROPERTY_BOAT, boatId).count();
+
+ BoatDetails boatDetails = new BoatDetails(boatInfos, mostRecentContact);
+
+ return boatDetails;
+
+ }
+
+ public BoatInfos getBoatInfos(String boatId, String companyId) {
+
BoatInfosTopiaDao dao = getBoatInfosDao();
Optional<BoatInfos> optionalBoatInfos =
@@ -166,19 +181,26 @@
} else {
Boat boat = getBoatDao().findByTopiaId(boatId);
Company company = getCompanyDao().findByTopiaId(companyId);
- boatInfos = dao.create(BoatInfos.PROPERTY_BOAT, boat,
- BoatInfos.PROPERTY_COMPANY, company);
- commit();
+ boatInfos = new BoatInfosImpl();
+ boatInfos.setBoat(boat);
+ boatInfos.setCompany(company);
}
- Contact mostRecentContact = getContactDao().findMostRecentContactOrNull(obsProgram, boatId, companyId);
+ return boatInfos;
- long count = getContactDao().newQueryBuilder().addTopiaIdEquals(Contact.PROPERTY_BOAT, boatId).count();
+ }
- BoatDetails boatDetails = new BoatDetails(boatInfos, mostRecentContact);
+ public void saveBoatInfos(BoatInfos boatInfos) {
- return boatDetails;
+ BoatInfosTopiaDao dao = getBoatInfosDao();
+ if (boatInfos.isPersisted()) {
+ dao.update(boatInfos);
+ } else {
+ dao.create(boatInfos);
+ }
+
+ commit();
+
}
-
}
Added: trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/UpdateBoatInfosJsonAction.java
===================================================================
--- trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/UpdateBoatInfosJsonAction.java (rev 0)
+++ trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/UpdateBoatInfosJsonAction.java 2014-04-07 14:17:38 UTC (rev 1853)
@@ -0,0 +1,59 @@
+package fr.ifremer.wao.web.action.obsmer;
+
+import com.google.common.base.Preconditions;
+import com.opensymphony.xwork2.Preparable;
+import fr.ifremer.wao.entity.BoatInfos;
+import fr.ifremer.wao.services.service.ObsMerBoatsService;
+import fr.ifremer.wao.web.WaoJsonActionSupport;
+
+public class UpdateBoatInfosJsonAction extends WaoJsonActionSupport implements Preparable {
+
+ private static final long serialVersionUID = 1L;
+
+ protected transient ObsMerBoatsService service;
+
+ protected String companyId;
+
+ protected String boatId;
+
+ protected BoatInfos boatInfos;
+
+ public void setService(ObsMerBoatsService service) {
+ this.service = service;
+ }
+
+ public void setCompanyId(String companyId) {
+ this.companyId = companyId;
+ }
+
+ public void setBoatId(String boatId) {
+ this.boatId = boatId;
+ }
+
+ @Override
+ public void prepare() {
+
+ Preconditions.checkState(session.getAuthenticatedWaoUser().isAuthorizedToViewBoatDetails(companyId));
+
+ boatInfos = service.getBoatInfos(boatId, companyId);
+
+ }
+
+ public BoatInfos getBoatInfos() {
+ return boatInfos;
+ }
+
+ public void setBoatInfos(BoatInfos boatInfos) {
+ this.boatInfos = boatInfos;
+ }
+
+ @Override
+ public String execute() {
+
+ service.saveBoatInfos(boatInfos);
+
+ return SUCCESS;
+
+ }
+
+}
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-04-07 11:01:57 UTC (rev 1852)
+++ trunk/wao-web/src/main/resources/i18n/wao-web_en_GB.properties 2014-04-07 14:17:38 UTC (rev 1853)
@@ -97,6 +97,8 @@
wao.ui.boats.boatName=Name
wao.ui.boats.buildYear=Build year
wao.ui.boats.district=District
+wao.ui.boats.info=Details
+wao.ui.boats.interlocutor=Interlocutor
wao.ui.boats.nbObservations=%s observation(s), %s with your company (all programs considered)
wao.ui.boats.portOfRegistry=Port
wao.ui.boats.portOfRegistry.description=It's the main operating port of the boat
@@ -264,6 +266,7 @@
wao.ui.forgotPassword=Forgot password ?
wao.ui.form.Boat.name=Name
wao.ui.form.Boat.registrationCode=Registration number
+wao.ui.form.BoatInfos.success=Modifications successfuly saved
wao.ui.form.Company.error.nameMustBeUnique=Company name must be unique
wao.ui.form.Company.title.creation=Create a new company
wao.ui.form.Company.title.edition=Edit company %s
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-04-07 11:01:57 UTC (rev 1852)
+++ trunk/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties 2014-04-07 14:17:38 UTC (rev 1853)
@@ -97,6 +97,8 @@
wao.ui.boats.boatName=Nom
wao.ui.boats.buildYear=Année de construction
wao.ui.boats.district=Quartier maritime
+wao.ui.boats.info=Autres informations sur ce navire
+wao.ui.boats.interlocutor=Coordonnées de l'interlocuteur
wao.ui.boats.nbObservations=%s observation(s) dont %s avec votre société
wao.ui.boats.portOfRegistry=Port
wao.ui.boats.portOfRegistry.description=Il s'agit du port d'exploitation principal du navire
@@ -264,6 +266,7 @@
wao.ui.forgotPassword=Mot de passe oublié ?
wao.ui.form.Boat.name=Nom
wao.ui.form.Boat.registrationCode=Immatriculation
+wao.ui.form.BoatInfos.success=Les informations ont bien été enregistrées
wao.ui.form.Company.error.nameMustBeUnique=Le nom de la société doit être unique
wao.ui.form.Company.title.creation=Création d'une société
wao.ui.form.Company.title.edition=Modification de la société %s
Modified: trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/boat-details.jsp
===================================================================
--- trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/boat-details.jsp 2014-04-07 11:01:57 UTC (rev 1852)
+++ trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/boat-details.jsp 2014-04-07 14:17:38 UTC (rev 1853)
@@ -21,48 +21,53 @@
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<%@taglib uri="/struts-tags" prefix="s" %>
-<table class="table">
- <caption>
- <s:text name="wao.ui.contact.lastContact"/>
- </caption>
- <tbody>
- <tr>
- <th>
- <s:text name="wao.ui.field.Boat.shipOwner"/>
- </th>
- <td>
- <s:property value="boatDetails.boatInfos.boat.shipOwner.firstName"/>
- <s:property value="boatDetails.boatInfos.boat.shipOwner.lastName"/>
+<h2>
+ <s:text name="wao.ui.boatinfo.title">
+ <s:param value="boatDetails.boatInfos.boat.name"/>
+ </s:text>
+</h2>
- <s:url action="boats" id="shipOwnerBoatsUrl">
- <s:param name="filter.shipOwnerIds" value="boatDetails.boatInfos.boat.shipOwner.topiaId"/>
- </s:url>
- <s:a href="%{shipOwnerBoatsUrl}">
- <s:text name="wao.ui.action.viewShipOwnerBoats"/>
- </s:a>
- </td>
- </tr>
- <tr>
- <th>
- <s:text name="wao.ui.field.Boat.boatGroup"/>
- </th>
- <td>
- <s:if test="boatDetails.boatInfos.boat.boatGroup == null">
- <s:text name="wao.ui.misc.N/A"/>
- </s:if>
- <s:else>
- <s:property value="boatDetails.boatInfos.boat.boatGroup.description"/>
- </s:else>
- </td>
- </tr>
- </tbody>
-</table>
+<script>
+ $(document).ready(function () {
+ $boatInfosForm = $('#boat-infos-form');
+
+ $('#save-boat-infos').click(function () {
+ var data = {};
+ $boatInfosForm.find('input').each(function (index, input) {
+ var $input = $(input);
+ var parameterName = $input.prop('name');
+ if (parameterName.indexOf('__') === 0) {
+ return;
+ }
+ var parameterValue;
+ if ($input.attr('type') === 'checkbox') {
+ parameterValue = $input.prop('checked');
+ } else {
+ parameterValue = $input.prop('value');
+ }
+ data[parameterName] = parameterValue;
+ });
+ var successCallback = function () {
+ WAO.notifications.success('<s:text name="wao.ui.form.BoatInfos.success"/>');
+ }
+ WAO.post(WAO.OBSMER_UPDATE_BOAT_INFOS_JSON_URL, data, successCallback);
+ });
+
+ $('#unlock-boat-infos-form').click(function () {
+ $boatInfosForm.find('input[readOnly="true"], button').removeAttr('readOnly').removeAttr('disabled');
+ $(this).attr('disabled', 'disabled');
+ });
+ });
+</script>
+
<s:if test="boatDetails.mostRecentContact != null">
+
+ <h3>
+ <s:text name="wao.ui.contact.lastContact"/>
+ </h3>
+
<table class="table">
- <caption>
- <s:text name="wao.ui.contact.lastContact"/>
- </caption>
<tbody>
<tr>
<th>
@@ -100,10 +105,15 @@
</table>
</s:if>
-<s:form cssClass="form-horizontal">
+<h3>
+ <s:text name="wao.ui.boats.interlocutor"/>
+</h3>
- <s:hidden name="boatInfosId" value="%{boatDetails.boatInfos.topiaId}" />
+<s:form id="boat-infos-form" cssClass="form-horizontal">
+ <s:hidden name="boatId" value="%{boatDetails.boatInfos.boat.topiaId}" />
+ <s:hidden name="companyId" value="%{boatDetails.boatInfos.company.topiaId}" />
+
<s:textfield name="boatInfos.contactFirstName" value="%{boatDetails.boatInfos.contactFirstName}" label="%{getText('wao.ui.field.BoatInfos.contactFirstName')}" readOnly="true" />
<s:textfield name="boatInfos.contactLastName" value="%{boatDetails.boatInfos.contactLastName}" label="%{getText('wao.ui.field.BoatInfos.contactLastName')}" readOnly="true" />
<s:textfield type="email" name="boatInfos.contactEmail" value="%{boatDetails.boatInfos.contactEmail}" label="%{getText('wao.ui.field.BoatInfos.contactEmail')}" readOnly="true" />
@@ -115,9 +125,20 @@
<s:textfield name="boatInfos.contactCity" value="%{boatDetails.boatInfos.contactCity}" label="%{getText('wao.ui.field.BoatInfos.contactCity')}" readOnly="true" />
<s:textfield name="boatInfos.comment" value="%{boatDetails.boatInfos.comment}" label="%{getText('wao.ui.field.BoatInfos.comment')}" readOnly="true" />
+ <button type="button" id="unlock-boat-infos-form" class="btn">
+ <i class="icon-edit"></i> <s:text name="wao.ui.action.edit" />
+ </button>
+
+ <button type="button" id="save-boat-infos" class="btn" disabled="disabled">
+ <i class="icon-hdd"></i> <s:text name="wao.ui.action.save" />
+ </button>
+
</s:form>
-<s:text name="wao.ui.boats.associatedLine"/>
+
+<h3>
+ <s:text name="wao.ui.boats.associatedLine"/>
+</h3>
<ul>
<s:iterator value="boatDetails.boatInfos.boat.elligibleBoat">
<li>
@@ -128,3 +149,41 @@
</li>
</s:iterator>
</ul>
+
+<h3>
+ <s:text name="wao.ui.boats.info"/>
+</h3>
+
+<table class="table">
+ <tbody>
+ <tr>
+ <th>
+ <s:text name="wao.ui.field.Boat.shipOwner"/>
+ </th>
+ <td>
+ <s:property value="boatDetails.boatInfos.boat.shipOwner.firstName"/>
+ <s:property value="boatDetails.boatInfos.boat.shipOwner.lastName"/>
+
+ <s:url action="boats" id="shipOwnerBoatsUrl">
+ <s:param name="filter.shipOwnerIds" value="boatDetails.boatInfos.boat.shipOwner.topiaId"/>
+ </s:url>
+ <s:a href="%{shipOwnerBoatsUrl}">
+ <s:text name="wao.ui.action.viewShipOwnerBoats"/>
+ </s:a>
+ </td>
+ </tr>
+ <tr>
+ <th>
+ <s:text name="wao.ui.field.Boat.boatGroup"/>
+ </th>
+ <td>
+ <s:if test="boatDetails.boatInfos.boat.boatGroup == null">
+ <s:text name="wao.ui.misc.N/A"/>
+ </s:if>
+ <s:else>
+ <s:property value="boatDetails.boatInfos.boat.boatGroup.description"/>
+ </s:else>
+ </td>
+ </tr>
+ </tbody>
+</table>
Modified: trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/boats.jsp
===================================================================
--- trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/boats.jsp 2014-04-07 11:01:57 UTC (rev 1852)
+++ trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/boats.jsp 2014-04-07 14:17:38 UTC (rev 1853)
@@ -143,13 +143,13 @@
</div>
<div>
+ <h2>
+ <s:text name="wao.ui.boats.title">
+ <s:param value="%{pagination.nbRecords}"/>
+ </s:text>
+ </h2>
<table id="boats-list" class="table-condensed table-striped table-hover">
- <caption>
- <s:text name="wao.ui.boats.title">
- <s:param value="%{pagination.nbRecords}"/>
- </s:text>
- </caption>
<thead>
<tr>
<th>
Modified: trunk/wao-web/src/main/webapp/WEB-INF/decorators.xml
===================================================================
--- trunk/wao-web/src/main/webapp/WEB-INF/decorators.xml 2014-04-07 11:01:57 UTC (rev 1852)
+++ trunk/wao-web/src/main/webapp/WEB-INF/decorators.xml 2014-04-07 14:17:38 UTC (rev 1853)
@@ -23,6 +23,7 @@
<pattern>/css/*</pattern>
<pattern>/img/*</pattern>
<pattern>*?*fragment=true*</pattern>
+ <pattern>*-json*</pattern>
</excludes>
<decorator name="layout-login" page="layout-login.jsp">
Modified: trunk/wao-web/src/main/webapp/enpoints-js.jsp
===================================================================
--- trunk/wao-web/src/main/webapp/enpoints-js.jsp 2014-04-07 11:01:57 UTC (rev 1852)
+++ trunk/wao-web/src/main/webapp/enpoints-js.jsp 2014-04-07 14:17:38 UTC (rev 1853)
@@ -29,6 +29,8 @@
WAO.OBSMER_SAMPLE_ROWS_FILTER_VALUES_JSON_URL = '<s:url namespace="/obsmer" action="sample-rows-filter-values-json"/>';
WAO.OBSMER_BOATS_FILTER_VALUES_JSON_URL = '<s:url namespace="/obsmer" action="boats-filter-values-json"/>';
WAO.OBSMER_CONTACTS_FILTER_VALUES_JSON_URL = '<s:url namespace="/obsmer" action="contacts-filter-values-json"/>';
+ WAO.OBSMER_UPDATE_BOAT_INFOS_JSON_URL = '<s:url namespace="/obsmer" action="update-boat-infos-json"/>';
+
});
Modified: trunk/wao-web/src/main/webapp/wao.css
===================================================================
--- trunk/wao-web/src/main/webapp/wao.css 2014-04-07 11:01:57 UTC (rev 1852)
+++ trunk/wao-web/src/main/webapp/wao.css 2014-04-07 14:17:38 UTC (rev 1853)
@@ -292,7 +292,7 @@
}
#boats-filters-list-details-layout > div {
- margin-left: 20px;
+ margin-left: 50px;
}
#boats-filters-list-details-layout > div:nth-child(3) {
Modified: trunk/wao-web/src/main/webapp/wao.js
===================================================================
--- trunk/wao-web/src/main/webapp/wao.js 2014-04-07 11:01:57 UTC (rev 1852)
+++ trunk/wao-web/src/main/webapp/wao.js 2014-04-07 14:17:38 UTC (rev 1853)
@@ -54,7 +54,7 @@
this.$selects.each(function (index, select) {
var $select = $(select);
var parameterName = $select.prop('name');
- if (parameterName.indexOf('__') == 0) {
+ if (parameterName.indexOf('__') === 0) {
return;
}
var parameterValues = [];
@@ -66,11 +66,11 @@
this.$inputs.each(function (index, input) {
var $input = $(input);
var parameterName = $input.prop('name');
- if (parameterName.indexOf('__') == 0) {
+ if (parameterName.indexOf('__') === 0) {
return;
}
var parameterValue;
- if ($input.attr('type') == 'checkbox') {
+ if ($input.attr('type') === 'checkbox') {
parameterValue = $input.prop('checked');
} else {
parameterValue = $input.prop('value');
@@ -115,7 +115,7 @@
var parameterName = $input.prop('name');
var parameterValue = filter[parameterName];
$input.prop('value', parameterValue);
- if ($input.attr('type') == 'checkbox') {
+ if ($input.attr('type') === 'checkbox') {
$input.prop('checked', parameterValue);
}
});
@@ -238,6 +238,16 @@
$.get(url, data, stopSpinningAfterCallingSuccessCallback);
}
+ this.post = function (url, data, successCallback) {
+ this.startSpinner();
+ var stopSpinningAfterCallingSuccessCallback = function () {
+ var result = successCallback.apply(this, arguments);
+ self.stopSpinner();
+ return result;
+ };
+ $.post(url, data, stopSpinningAfterCallingSuccessCallback);
+ }
+
};
$(document).ready(function () {
1
0
r1852 - in trunk/wao-services/src/main: java/fr/ifremer/wao/services/service resources/i18n
by tchemit@users.forge.codelutin.com 07 Apr '14
by tchemit@users.forge.codelutin.com 07 Apr '14
07 Apr '14
Author: tchemit
Date: 2014-04-07 13:01:57 +0200 (Mon, 07 Apr 2014)
New Revision: 1852
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1852
Log:
refs #4487 fix filterValues for observedDataControl
Modified:
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactsFilterValues.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
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactsFilterValues.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactsFilterValues.java 2014-04-07 10:38:17 UTC (rev 1851)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactsFilterValues.java 2014-04-07 11:01:57 UTC (rev 1852)
@@ -120,7 +120,9 @@
}
ObservedDataControl observedDataControl = contact.getObservedDataControl();
- if (observedDataControl != null) {
+ if (observedDataControl == null) {
+ observedDataControls.add(FilterOption.forValueAndLabel("", l(locale, "wao.business.observedDataControl.undefined")));
+ } else {
observedDataControls.add(FilterOption.forEnum(locale, observedDataControl));
}
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-04-07 10:38:17 UTC (rev 1851)
+++ trunk/wao-services/src/main/resources/i18n/wao-services_en_GB.properties 2014-04-07 11:01:57 UTC (rev 1852)
@@ -8,15 +8,15 @@
csv.import.error.unableToSetValue=Unable to set value '%s' (entity '%s', line %s, column '%s')
csv.import.error.unrecognizedHeaders=Fields %s are not recognized. Accepted fields are %s.
csv.import.logComment=Edited through import
-wao.business.completeSampling.undefined=Undefined
-wao.business.completeSampling.true=Yes
-wao.business.completeSampling.false=No
fr.ifremer.wao.services.service.mail.UserCredentialsEmail.subject=Your Wao credentials
wao.action.delete.failure.attachedContacts=Object is attached to some contacts.
wao.action.delete.failure.attachedNews=Object is attached to some news.
wao.action.delete.failure.attachedSampleRows=Object is attached to some sample rows.
wao.action.delete.failure.attachedWaoUsers=Object is attached to some users.
wao.business.boat.validation.immatriculation.wrongFormat=The boat registry number must be composed of 6 digits
+wao.business.completeSampling.false=No
+wao.business.completeSampling.true=Yes
+wao.business.completeSampling.undefined=Undefined
wao.business.contact.validation.commentAdminNecessaryForDataReliability=You must precise in admin comment why data reliability is '%s'
wao.business.contact.validation.commentMissingForState=You must give a comment for state '%s'
wao.business.contact.validation.contactStateMotifMissing=You must precise a motif for the refusal
@@ -28,6 +28,7 @@
wao.business.entity.UserProfile.description=%s on %s%s
wao.business.mammalsCapture.mail.message=Hello,\n\nAn observer of the ObsMer program provided to WAO the following information\:\n\nTide\: %s\nProfession\: %s\n\nAccidental capture\:\n%s\n\nBest regards,\n\nObsmer program\nhttp\://www.ifremer.fr/wao
wao.business.mammalsCapture.mail.subject=Obsmer WAO\: Information about an accidental capture
+wao.business.observedDataControl.undefined=Undefined
wao.business.other=Other
wao.business.readOnly=(read-only)
wao.business.validationState.refused=Refused
@@ -40,8 +41,8 @@
wao.import.contact.failure.boatMissing=You need to precise the plate number of the boat associated to the contact
wao.import.contact.failure.districtMissing=You need to precise the boat district
wao.import.contact.failure.invalid.company.for.observer=L'observateur %s n'est pas membre de la société %s
-wao.import.contact.failure.invalid.observation.end=La date de saisie des données ne peut pas être antérieure à la date de fin d'observation
-wao.import.contact.failure.invalid.observation.end2=La date de saisie des données ne peut pas être postérieure à la date du jour
+wao.import.contact.failure.invalid.dataInputDate=La date de saisie des données ne peut pas être postérieure à la date du jour
+wao.import.contact.failure.invalid.dataInputDate2=La date de saisie des données ne peut pas être antérieure à la date de fin d'observation
wao.import.contact.failure.invalid.observation.endDate=La date de fin d'observation ne peut pas être antérieure à celle du début
wao.import.contact.failure.invalid.observer.state=Il ne peut y avoir aucun observateur pour l'état '%s'
wao.import.contact.failure.invalid.transmissionDate=Il faut que la date de transmission de la restitution soit après la date de saisie des données
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-04-07 10:38:17 UTC (rev 1851)
+++ trunk/wao-services/src/main/resources/i18n/wao-services_fr_FR.properties 2014-04-07 11:01:57 UTC (rev 1852)
@@ -13,10 +13,10 @@
wao.action.delete.failure.attachedNews=L'objet est lié à des actualités.
wao.action.delete.failure.attachedSampleRows=L'objet est lié à des lignes du plan.
wao.action.delete.failure.attachedWaoUsers=L'objet est lié à des utilisateurs.
+wao.business.boat.validation.immatriculation.wrongFormat=L'immatriculation du navire doit être formée de 6 chiffres
+wao.business.completeSampling.false=Non
+wao.business.completeSampling.true=Oui
wao.business.completeSampling.undefined=Non défini
-wao.business.completeSampling.true=Oui
-wao.business.completeSampling.false=Non
-wao.business.boat.validation.immatriculation.wrongFormat=L'immatriculation du navire doit être formée de 6 chiffres
wao.business.contact.validation.commentAdminNecessaryForDataReliability=Il faut préciser dans le commentaire administrateur pourquoi la donnée est '%s'
wao.business.contact.validation.commentMissingForState=Il faut préciser un commentaire pour l'état '%s'
wao.business.contact.validation.contactStateMotifMissing=Il faut préciser un motif de refus
@@ -28,6 +28,7 @@
wao.business.entity.UserProfile.description=%s sur %s%s
wao.business.mammalsCapture.mail.message=Bonjour,\n\nUn observateur du programme Obsmer a renseigné dans WAO l'information suivante \:\n\nMarée \: %s\nMétier \: %s\n\nCapture accidentelle \:\n%s\n\nCordialement,\n\nLe programme Obsmer\nhttp\://www.ifremer.fr/wao
wao.business.mammalsCapture.mail.subject=Obsmer WAO\: Information sur capture accidentelle
+wao.business.observedDataControl.undefined=Non défini
wao.business.readOnly=(lecture seule)
wao.business.validationState.refused=Réfusé
wao.business.validationState.standby=En attente
@@ -39,8 +40,8 @@
wao.import.contact.failure.boatMissing=Il faut préciser l'immatriculation du navire associé au contact
wao.import.contact.failure.districtMissing=Il faut préciser le code d'un quartier maritime
wao.import.contact.failure.invalid.company.for.observer=L'observateur %s n'est pas membre de la société %s
-wao.import.contact.failure.invalid.observation.end=La date de saisie des données ne peut pas être antérieure à la date de fin d'observation
-wao.import.contact.failure.invalid.observation.end2=La date de saisie des données ne peut pas être postérieure à la date du jour
+wao.import.contact.failure.invalid.dataInputDate=La date de saisie des données ne peut pas être postérieure à la date du jour
+wao.import.contact.failure.invalid.dataInputDate2=La date de saisie des données ne peut pas être antérieure à la date de fin d'observation
wao.import.contact.failure.invalid.observation.endDate=La date de fin d'observation ne peut pas être antérieure à celle du début
wao.import.contact.failure.invalid.observer.state=Il ne peut y avoir aucun observateur pour l'état '%s'
wao.import.contact.failure.invalid.transmissionDate=Il faut que la date de transmission de la restitution soit après la date de saisie des données
1
0
r1851 - in trunk/wao-services/src/main: java/fr/ifremer/wao/services/service resources/i18n
by tchemit@users.forge.codelutin.com 07 Apr '14
by tchemit@users.forge.codelutin.com 07 Apr '14
07 Apr '14
Author: tchemit
Date: 2014-04-07 12:38:17 +0200 (Mon, 07 Apr 2014)
New Revision: 1851
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1851
Log:
refs #4487 fix filterValues for completeSampling + contactStateMotif
Modified:
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactsFilterValues.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
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactsFilterValues.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactsFilterValues.java 2014-04-07 10:38:06 UTC (rev 1850)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ContactsFilterValues.java 2014-04-07 10:38:17 UTC (rev 1851)
@@ -41,6 +41,7 @@
import java.util.TreeSet;
import static org.nuiton.i18n.I18n.l;
+import static org.nuiton.i18n.I18n.n;
/**
* Created on 4/3/14.
@@ -80,7 +81,6 @@
protected SortedSet<FilterOption> programAcceptations = new TreeSet<>();
- //FIXME What to do with this ?
protected SortedSet<FilterOption> completeSamplings = new TreeSet<>();
public ContactsFilterValues(Locale locale, ObsProgram obsProgram) {
@@ -135,20 +135,29 @@
terrestrialLocations.add(FilterOption.forValueAndLabel(terrestrialLocation.getTopiaId(), terrestrialLocation.getDescription()));
}
- //FIXME ?
ContactStateMotif contactStateMotif = contact.getContactStateMotif();
if (contactStateMotif != null) {
- contactStateMotives.add(FilterOption.forValueAndLabel(contactStateMotif.getTopiaId(), contactStateMotif.getCode()));
+ contactStateMotives.add(FilterOption.forValueAndLabel(contactStateMotif.getTopiaId(), contactStateMotif.getName()));
}
+
Boolean validationCompany = contact.getValidationCompany();
- addValidationFilterOption(companyAcceptations, validationCompany);
+ addBooleanFilterOption(companyAcceptations, validationCompany,
+ n("wao.business.validationState.standby"),
+ n("wao.business.validationState.validated"),
+ n("wao.business.validationState.refused"));
Boolean validationProgram = contact.getValidationProgram();
- addValidationFilterOption(programAcceptations, validationProgram);
+ addBooleanFilterOption(programAcceptations, validationProgram,
+ n("wao.business.validationState.standby"),
+ n("wao.business.validationState.validated"),
+ n("wao.business.validationState.refused"));
- //FIXME ?
Boolean completeSampling = contact.getCompleteSampling();
+ addBooleanFilterOption(completeSamplings, completeSampling,
+ n("wao.business.completeSampling.undefined"),
+ n("wao.business.completeSampling.true"),
+ n("wao.business.completeSampling.false"));
}
public BoatsFilterValues getBoatsFilterValues() {
@@ -211,18 +220,22 @@
return completeSamplings;
}
- protected void addValidationFilterOption(SortedSet<FilterOption> options, Boolean validationState) {
+ protected void addBooleanFilterOption(SortedSet<FilterOption> options,
+ Boolean booleanValue,
+ String nullI18nKey,
+ String trueI18nKey,
+ String falseI18nKey) {
String value;
String label;
- if (validationState == null) {
+ if (booleanValue == null) {
value = null;
- label = l(locale, "wao.business.validationState.standby");
- } else if (validationState) {
- value = validationState.toString();
- label = l(locale, "wao.business.validationState.validated");
+ label = l(locale, nullI18nKey);
+ } else if (booleanValue) {
+ value = booleanValue.toString();
+ label = l(locale, trueI18nKey);
} else {
- value = validationState.toString();
- label = l(locale, "wao.business.validationState.refused");
+ value = booleanValue.toString();
+ label = l(locale, falseI18nKey);
}
options.add(FilterOption.forValueAndLabel(value, label));
}
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-04-07 10:38:06 UTC (rev 1850)
+++ trunk/wao-services/src/main/resources/i18n/wao-services_en_GB.properties 2014-04-07 10:38:17 UTC (rev 1851)
@@ -8,6 +8,9 @@
csv.import.error.unableToSetValue=Unable to set value '%s' (entity '%s', line %s, column '%s')
csv.import.error.unrecognizedHeaders=Fields %s are not recognized. Accepted fields are %s.
csv.import.logComment=Edited through import
+wao.business.completeSampling.undefined=Undefined
+wao.business.completeSampling.true=Yes
+wao.business.completeSampling.false=No
fr.ifremer.wao.services.service.mail.UserCredentialsEmail.subject=Your Wao credentials
wao.action.delete.failure.attachedContacts=Object is attached to some contacts.
wao.action.delete.failure.attachedNews=Object is attached to some news.
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-04-07 10:38:06 UTC (rev 1850)
+++ trunk/wao-services/src/main/resources/i18n/wao-services_fr_FR.properties 2014-04-07 10:38:17 UTC (rev 1851)
@@ -13,6 +13,9 @@
wao.action.delete.failure.attachedNews=L'objet est lié à des actualités.
wao.action.delete.failure.attachedSampleRows=L'objet est lié à des lignes du plan.
wao.action.delete.failure.attachedWaoUsers=L'objet est lié à des utilisateurs.
+wao.business.completeSampling.undefined=Non défini
+wao.business.completeSampling.true=Oui
+wao.business.completeSampling.false=Non
wao.business.boat.validation.immatriculation.wrongFormat=L'immatriculation du navire doit être formée de 6 chiffres
wao.business.contact.validation.commentAdminNecessaryForDataReliability=Il faut préciser dans le commentaire administrateur pourquoi la donnée est '%s'
wao.business.contact.validation.commentMissingForState=Il faut préciser un commentaire pour l'état '%s'
1
0
r1850 - trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer
by bleny@users.forge.codelutin.com 07 Apr '14
by bleny@users.forge.codelutin.com 07 Apr '14
07 Apr '14
Author: bleny
Date: 2014-04-07 12:38:06 +0200 (Mon, 07 Apr 2014)
New Revision: 1850
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1850
Log:
refs #4483 add link to contacts for each sample row in sampling-plan
Modified:
trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp
Modified: trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp
===================================================================
--- trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp 2014-04-07 10:33:52 UTC (rev 1849)
+++ trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp 2014-04-07 10:38:06 UTC (rev 1850)
@@ -483,7 +483,9 @@
</s:if>
<li>
<s:url action="contacts" id="viewAssociatedContactsUrl">
- <s:param name="sampleRowIds" value="sampleRowId" />
+ <s:param name="filter.sampleRowFilter.sampleRowCodes" value="code" />
+ <s:param name="filter.periodFrom" />
+ <s:param name="filter.periodTo" />
</s:url>
<s:a href="%{viewAssociatedContactsUrl}">
<s:text name="wao.ui.action.viewAssociatedContacts" />
1
0