Coser-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
November 2010
- 2 participants
- 175 discussions
r294 - trunk/coser-business/src/main/java/fr/ifremer/coser/command
by chatellier@users.labs.libre-entreprise.org 26 Nov '10
by chatellier@users.labs.libre-entreprise.org 26 Nov '10
26 Nov '10
Author: chatellier
Date: 2010-11-26 14:49:50 +0000 (Fri, 26 Nov 2010)
New Revision: 294
Log:
Fix performance issue
Modified:
trunk/coser-business/src/main/java/fr/ifremer/coser/command/MergeSpeciesCommand.java
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/command/MergeSpeciesCommand.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/command/MergeSpeciesCommand.java 2010-11-26 14:08:06 UTC (rev 293)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/command/MergeSpeciesCommand.java 2010-11-26 14:49:50 UTC (rev 294)
@@ -384,7 +384,8 @@
newSpecyName = value;
}
else if (argAttribute.equals("speciesNames")) {
- speciesNames = CoserUtils.convertBracketToList(value).toArray(new String[0]);
+ List<String> speciesNamesList = CoserUtils.convertBracketToList(value);
+ speciesNames = speciesNamesList.toArray(new String[speciesNamesList.size()]);
}
}
1
0
r293 - trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control
by chatellier@users.labs.libre-entreprise.org 26 Nov '10
by chatellier@users.labs.libre-entreprise.org 26 Nov '10
26 Nov '10
Author: chatellier
Date: 2010-11-26 14:08:06 +0000 (Fri, 26 Nov 2010)
New Revision: 293
Log:
Apres un remplacement de masse, il faut rachichir la donn?\195?\169es en cours d'edition
Modified:
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlHandler.java
Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlHandler.java
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlHandler.java 2010-11-26 14:03:54 UTC (rev 292)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlHandler.java 2010-11-26 14:08:06 UTC (rev 293)
@@ -309,6 +309,11 @@
throw new CoserException("Can't replace field value", ex);
}
replaceView.dispose();
+
+ // bufix
+ // si le remplacement de masse a modifié la ligne courante, il
+ // faut la rafraichir
+ controlDataTableSelectionChanged(controlView);
}
/**
1
0
r292 - in trunk: coser-business/src/main/java/fr/ifremer/coser/control coser-business/src/main/java/fr/ifremer/coser/services coser-business/src/test/java/fr/ifremer/coser/services coser-ui/src/main/java/fr/ifremer/coser coser-ui/src/main/java/fr/ifremer/coser/ui/control
by chatellier@users.labs.libre-entreprise.org 26 Nov '10
by chatellier@users.labs.libre-entreprise.org 26 Nov '10
26 Nov '10
Author: chatellier
Date: 2010-11-26 14:03:54 +0000 (Fri, 26 Nov 2010)
New Revision: 292
Log:
Refactoring validation > control
Added:
trunk/coser-business/src/main/java/fr/ifremer/coser/control/ControlError.java
trunk/coser-business/src/main/java/fr/ifremer/coser/control/ControlErrorGroup.java
trunk/coser-business/src/main/java/fr/ifremer/coser/control/DiffCatchLengthControlError.java
trunk/coser-business/src/main/java/fr/ifremer/coser/services/ControlService.java
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlErrorTreeRenderer.java
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/GlobalControlErrorModel.java
Removed:
trunk/coser-business/src/main/java/fr/ifremer/coser/control/DiffCatchLengthValidationError.java
trunk/coser-business/src/main/java/fr/ifremer/coser/control/GlobalValidationGroup.java
trunk/coser-business/src/main/java/fr/ifremer/coser/control/ValidationError.java
trunk/coser-business/src/main/java/fr/ifremer/coser/services/ValidationService.java
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlValidationRenderer.java
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/GlobalValidationModel.java
Modified:
trunk/coser-business/src/main/java/fr/ifremer/coser/services/PublicationService.java
trunk/coser-business/src/test/java/fr/ifremer/coser/services/PublicationServiceTest.java
trunk/coser-business/src/test/java/fr/ifremer/coser/services/ValidationServiceTest.java
trunk/coser-ui/src/main/java/fr/ifremer/coser/Coser.java
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlHandler.java
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlView.jaxx
Copied: trunk/coser-business/src/main/java/fr/ifremer/coser/control/ControlError.java (from rev 260, trunk/coser-business/src/main/java/fr/ifremer/coser/control/ValidationError.java)
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/control/ControlError.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/control/ControlError.java 2010-11-26 14:03:54 UTC (rev 292)
@@ -0,0 +1,214 @@
+/*
+ * #%L
+ *
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2010 Ifremer, Codelutin, Chatellier Eric
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser 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 Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+package fr.ifremer.coser.control;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import fr.ifremer.coser.CoserConstants.Category;
+import fr.ifremer.coser.CoserConstants.ValidationLevel;
+
+/**
+ * Class regroupant les erreurs de controle d'une entité, son type (erreur,
+ * warning...) et les information supplémentaires permettant de la corriger
+ * (numéro de ligne).
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class ControlError implements Serializable {
+
+ /** serialVersionUID. */
+ private static final long serialVersionUID = -1806823191454701123L;
+
+ /** Category de l'erreur. */
+ protected Category category;
+
+ /** Niveau de l'erreur (fatal, error, warning, info). */
+ protected ValidationLevel level;
+
+ /** Message explicitant l'erreur de validation. */
+ protected String message;
+
+ /** Message donnant plus de précision sur l'erreur. */
+ protected String detailMessage;
+
+ /** Tip message (can be {@code null}). */
+ protected String tipMessage;
+
+ /**
+ * Numero des lignes dans le fichier CSV.
+ *
+ * Peut être vide si l'erreur n'est pas associé à une ligne specifiques.
+ */
+ protected Set<String> lineNumbers;
+
+ public ControlError() {
+ super();
+
+ lineNumbers = new HashSet<String>();
+ }
+
+ /**
+ * Category de l'erreur.
+ *
+ * Peut etre null si l'erreur n'est pas associées à une category en particulier.
+ *
+ * @return category de l'erreur
+ */
+ public Category getCategory() {
+ return category;
+ }
+
+ /**
+ * Category de l'erreur.
+ *
+ * @param category category de l'erreur
+ */
+ public void setCategory(Category category) {
+ this.category = category;
+ }
+
+ /**
+ * Niveau de l'erreur (fatal, error, warning, info).
+ *
+ * @return level
+ */
+ public ValidationLevel getLevel() {
+ return level;
+ }
+
+ /**
+ * Niveau de l'erreur (fatal, error, warning, info).
+ *
+ * @param level level
+ */
+ public void setLevel(ValidationLevel level) {
+ this.level = level;
+ }
+
+ /**
+ * Message explicitant l'erreur de validation.
+ *
+ * @return message
+ */
+ public String getMessage() {
+ return message;
+ }
+
+ /**
+ * Message explicitant l'erreur de validation.
+ *
+ * @param message message
+ */
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ /**
+ * Message donnant plus de précision sur l'erreur.
+ *
+ * Si le message de detail est null, le message est retourné.
+ *
+ * @return detail message
+ */
+ public String getDetailMessage() {
+ String result = detailMessage;
+ if (result == null) {
+ result = message;
+ }
+ return result;
+ }
+
+ /**
+ * Message donnant plus de précision sur l'erreur.
+ *
+ * @param detailMessage detail message
+ */
+ public void setDetailMessage(String detailMessage) {
+ this.detailMessage = detailMessage;
+ }
+
+ /**
+ * Get tip message (can be {@code null}).
+ *
+ * @return tip message
+ */
+ public String getTipMessage() {
+ return tipMessage;
+ }
+
+ /**
+ * Set tip message (can be {@code null}).
+ *
+ * @param tipMessage tip message
+ */
+ public void setTipMessage(String tipMessage) {
+ this.tipMessage = tipMessage;
+ }
+
+ /**
+ * Numero des lignes dans le fichier CSV.
+ *
+ * Peut être vide si l'erreur n'est pas associé a une ligne specifiques.
+ *
+ * @return line number
+ */
+ public Set<String> getLineNumbers() {
+ return lineNumbers;
+ }
+
+ /**
+ * Numero des lignes dans le fichier CSV.
+ *
+ * Peut être vide si l'erreur n'est pas associé a une ligne specifiques.
+ *
+ * @param lineNumber line number
+ */
+ public void addLineNumber(String lineNumber) {
+ lineNumbers.add(lineNumber);
+ }
+
+ /**
+ * Numero des lignes dans le fichier CSV.
+ *
+ * @param lineNumbers line numbers to add
+ */
+ public void addAllLineNumber(Collection<String> lineNumbers) {
+ this.lineNumbers.addAll(lineNumbers);
+ }
+
+ @Override
+ public String toString() {
+ return "ValidationError [level=" + level + ", message=" + message
+ + ", lineNumber=" + lineNumbers + "]";
+ }
+}
Copied: trunk/coser-business/src/main/java/fr/ifremer/coser/control/ControlErrorGroup.java (from rev 284, trunk/coser-business/src/main/java/fr/ifremer/coser/control/GlobalValidationGroup.java)
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/control/ControlErrorGroup.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/control/ControlErrorGroup.java 2010-11-26 14:03:54 UTC (rev 292)
@@ -0,0 +1,119 @@
+/*
+ * #%L
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2010 Ifremer, Codelutin, Chatellier Eric
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+package fr.ifremer.coser.control;
+
+import fr.ifremer.coser.CoserConstants.Category;
+import fr.ifremer.coser.CoserConstants.ValidationLevel;
+
+/**
+ * Global validation group node.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class ControlErrorGroup implements Comparable<ControlErrorGroup> {
+
+ protected final Category category;
+
+ protected final ValidationLevel validationLevel;
+
+ protected final String message;
+
+ /**
+ * @param category
+ * @param validationLevel
+ * @param message
+ */
+ public ControlErrorGroup(Category category, ValidationLevel validationLevel, String message) {
+ super();
+ this.category = category;
+ this.validationLevel = validationLevel;
+ this.message = message;
+ }
+
+ public Category getCategory() {
+ return category;
+ }
+
+ public ValidationLevel getValidationLevel() {
+ return validationLevel;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ /*
+ * @see java.lang.Comparable#compareTo(java.lang.Object)
+ */
+ @Override
+ public int compareTo(ControlErrorGroup o) {
+ int compare = o.getValidationLevel().compareTo(validationLevel);
+ if (compare == 0) {
+ compare = o.getMessage().compareTo(message);
+ }
+ return compare;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((category == null) ? 0 : category.hashCode());
+ result = prime * result + ((message == null) ? 0 : message.hashCode());
+ result = prime * result + ((validationLevel == null) ? 0 : validationLevel.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ ControlErrorGroup other = (ControlErrorGroup) obj;
+ if (message == null) {
+ if (other.message != null) {
+ return false;
+ }
+ } else if (!message.equals(other.message)) {
+ return false;
+ }
+ if (validationLevel != other.validationLevel) {
+ return false;
+ }
+ if (category != other.category) {
+ return false;
+ }
+ return true;
+ }
+}
Copied: trunk/coser-business/src/main/java/fr/ifremer/coser/control/DiffCatchLengthControlError.java (from rev 284, trunk/coser-business/src/main/java/fr/ifremer/coser/control/DiffCatchLengthValidationError.java)
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/control/DiffCatchLengthControlError.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/control/DiffCatchLengthControlError.java 2010-11-26 14:03:54 UTC (rev 292)
@@ -0,0 +1,53 @@
+/*
+ * #%L
+ *
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2010 Ifremer, Codelutin, Chatellier Eric
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser 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 Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+package fr.ifremer.coser.control;
+
+/**
+ * Erreur de controle specifique pour les différences des nombres entre
+ * les captures et les tailles pour utilisation typée de cette erreur
+ * (export html) et information supplémentaires (especes).
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class DiffCatchLengthControlError extends ControlError {
+
+ /** serialVersionUID. */
+ private static final long serialVersionUID = -3254763296138201677L;
+
+ protected String species;
+
+ public String getSpecies() {
+ return species;
+ }
+
+ public void setSpecies(String species) {
+ this.species = species;
+ }
+}
Deleted: trunk/coser-business/src/main/java/fr/ifremer/coser/control/DiffCatchLengthValidationError.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/control/DiffCatchLengthValidationError.java 2010-11-26 13:47:45 UTC (rev 291)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/control/DiffCatchLengthValidationError.java 2010-11-26 14:03:54 UTC (rev 292)
@@ -1,53 +0,0 @@
-/*
- * #%L
- *
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2010 Ifremer, Codelutin, Chatellier Eric
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser 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 Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>.
- * #L%
- */
-
-package fr.ifremer.coser.control;
-
-/**
- * Erreur de controle specifique pour les différences des nombres entre
- * les captures et les tailles pour utilisation typée de cette erreur
- * (export html) et information supplémentaires (especes).
- *
- * @author chatellier
- * @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
- */
-public class DiffCatchLengthValidationError extends ValidationError {
-
- /** serialVersionUID. */
- private static final long serialVersionUID = -3254763296138201677L;
-
- protected String species;
-
- public String getSpecies() {
- return species;
- }
-
- public void setSpecies(String species) {
- this.species = species;
- }
-}
Deleted: trunk/coser-business/src/main/java/fr/ifremer/coser/control/GlobalValidationGroup.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/control/GlobalValidationGroup.java 2010-11-26 13:47:45 UTC (rev 291)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/control/GlobalValidationGroup.java 2010-11-26 14:03:54 UTC (rev 292)
@@ -1,119 +0,0 @@
-/*
- * #%L
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2010 Ifremer, Codelutin, Chatellier Eric
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU 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 General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-package fr.ifremer.coser.control;
-
-import fr.ifremer.coser.CoserConstants.Category;
-import fr.ifremer.coser.CoserConstants.ValidationLevel;
-
-/**
- * Global validation group node.
- *
- * @author chatellier
- * @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
- */
-public class GlobalValidationGroup implements Comparable<GlobalValidationGroup> {
-
- protected final Category category;
-
- protected final ValidationLevel validationLevel;
-
- protected final String message;
-
- /**
- * @param category
- * @param validationLevel
- * @param message
- */
- public GlobalValidationGroup(Category category, ValidationLevel validationLevel, String message) {
- super();
- this.category = category;
- this.validationLevel = validationLevel;
- this.message = message;
- }
-
- public Category getCategory() {
- return category;
- }
-
- public ValidationLevel getValidationLevel() {
- return validationLevel;
- }
-
- public String getMessage() {
- return message;
- }
-
- /*
- * @see java.lang.Comparable#compareTo(java.lang.Object)
- */
- @Override
- public int compareTo(GlobalValidationGroup o) {
- int compare = o.getValidationLevel().compareTo(validationLevel);
- if (compare == 0) {
- compare = o.getMessage().compareTo(message);
- }
- return compare;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((category == null) ? 0 : category.hashCode());
- result = prime * result + ((message == null) ? 0 : message.hashCode());
- result = prime * result + ((validationLevel == null) ? 0 : validationLevel.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- GlobalValidationGroup other = (GlobalValidationGroup) obj;
- if (message == null) {
- if (other.message != null) {
- return false;
- }
- } else if (!message.equals(other.message)) {
- return false;
- }
- if (validationLevel != other.validationLevel) {
- return false;
- }
- if (category != other.category) {
- return false;
- }
- return true;
- }
-}
Deleted: trunk/coser-business/src/main/java/fr/ifremer/coser/control/ValidationError.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/control/ValidationError.java 2010-11-26 13:47:45 UTC (rev 291)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/control/ValidationError.java 2010-11-26 14:03:54 UTC (rev 292)
@@ -1,214 +0,0 @@
-/*
- * #%L
- *
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2010 Ifremer, Codelutin, Chatellier Eric
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser 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 Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>.
- * #L%
- */
-
-package fr.ifremer.coser.control;
-
-import java.io.Serializable;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-
-import fr.ifremer.coser.CoserConstants.Category;
-import fr.ifremer.coser.CoserConstants.ValidationLevel;
-
-/**
- * Class regroupant les erreurs de validation d'une entité, son type (erreur,
- * warning...) et les information supplémentaires permettant de la corriger
- * (numéro de ligne).
- *
- * @author chatellier
- * @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
- */
-public class ValidationError implements Serializable {
-
- /** serialVersionUID. */
- private static final long serialVersionUID = -1806823191454701123L;
-
- /** Category de l'erreur. */
- protected Category category;
-
- /** Niveau de l'erreur (fatal, error, warning, info). */
- protected ValidationLevel level;
-
- /** Message explicitant l'erreur de validation. */
- protected String message;
-
- /** Message donnant plus de précision sur l'erreur. */
- protected String detailMessage;
-
- /** Tip message (can be {@code null}). */
- protected String tipMessage;
-
- /**
- * Numero des lignes dans le fichier CSV.
- *
- * Peut être vide si l'erreur n'est pas associé à une ligne specifiques.
- */
- protected Set<String> lineNumbers;
-
- public ValidationError() {
- super();
-
- lineNumbers = new HashSet<String>();
- }
-
- /**
- * Category de l'erreur.
- *
- * Peut etre null si l'erreur n'est pas associées à une category en particulier.
- *
- * @return category de l'erreur
- */
- public Category getCategory() {
- return category;
- }
-
- /**
- * Category de l'erreur.
- *
- * @param category category de l'erreur
- */
- public void setCategory(Category category) {
- this.category = category;
- }
-
- /**
- * Niveau de l'erreur (fatal, error, warning, info).
- *
- * @return level
- */
- public ValidationLevel getLevel() {
- return level;
- }
-
- /**
- * Niveau de l'erreur (fatal, error, warning, info).
- *
- * @param level level
- */
- public void setLevel(ValidationLevel level) {
- this.level = level;
- }
-
- /**
- * Message explicitant l'erreur de validation.
- *
- * @return message
- */
- public String getMessage() {
- return message;
- }
-
- /**
- * Message explicitant l'erreur de validation.
- *
- * @param message message
- */
- public void setMessage(String message) {
- this.message = message;
- }
-
- /**
- * Message donnant plus de précision sur l'erreur.
- *
- * Si le message de detail est null, le message est retourné.
- *
- * @return detail message
- */
- public String getDetailMessage() {
- String result = detailMessage;
- if (result == null) {
- result = message;
- }
- return result;
- }
-
- /**
- * Message donnant plus de précision sur l'erreur.
- *
- * @param detailMessage detail message
- */
- public void setDetailMessage(String detailMessage) {
- this.detailMessage = detailMessage;
- }
-
- /**
- * Get tip message (can be {@code null}).
- *
- * @return tip message
- */
- public String getTipMessage() {
- return tipMessage;
- }
-
- /**
- * Set tip message (can be {@code null}).
- *
- * @param tipMessage tip message
- */
- public void setTipMessage(String tipMessage) {
- this.tipMessage = tipMessage;
- }
-
- /**
- * Numero des lignes dans le fichier CSV.
- *
- * Peut être vide si l'erreur n'est pas associé a une ligne specifiques.
- *
- * @return line number
- */
- public Set<String> getLineNumbers() {
- return lineNumbers;
- }
-
- /**
- * Numero des lignes dans le fichier CSV.
- *
- * Peut être vide si l'erreur n'est pas associé a une ligne specifiques.
- *
- * @param lineNumber line number
- */
- public void addLineNumber(String lineNumber) {
- lineNumbers.add(lineNumber);
- }
-
- /**
- * Numero des lignes dans le fichier CSV.
- *
- * @param lineNumbers line numbers to add
- */
- public void addAllLineNumber(Collection<String> lineNumbers) {
- this.lineNumbers.addAll(lineNumbers);
- }
-
- @Override
- public String toString() {
- return "ValidationError [level=" + level + ", message=" + message
- + ", lineNumber=" + lineNumbers + "]";
- }
-}
Copied: trunk/coser-business/src/main/java/fr/ifremer/coser/services/ControlService.java (from rev 283, trunk/coser-business/src/main/java/fr/ifremer/coser/services/ValidationService.java)
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/services/ControlService.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/services/ControlService.java 2010-11-26 14:03:54 UTC (rev 292)
@@ -0,0 +1,975 @@
+/*
+ * #%L
+ *
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2010 Ifremer, Codelutin, Chatellier Eric
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser 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 Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+package fr.ifremer.coser.services;
+
+import static org.nuiton.i18n.I18n._;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang.xwork.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import com.opensymphony.xwork2.ActionContext;
+import com.opensymphony.xwork2.ValidationAwareSupport;
+import com.opensymphony.xwork2.config.Configuration;
+import com.opensymphony.xwork2.config.ConfigurationManager;
+import com.opensymphony.xwork2.inject.Container;
+import com.opensymphony.xwork2.util.FileManager;
+import com.opensymphony.xwork2.util.ValueStack;
+import com.opensymphony.xwork2.util.ValueStackFactory;
+import com.opensymphony.xwork2.validator.ActionValidatorManager;
+import com.opensymphony.xwork2.validator.DelegatingValidatorContext;
+import com.opensymphony.xwork2.validator.ValidationException;
+
+import fr.ifremer.coser.CoserBusinessConfig;
+import fr.ifremer.coser.CoserConstants.Category;
+import fr.ifremer.coser.CoserConstants.ValidationLevel;
+import fr.ifremer.coser.bean.Control;
+import fr.ifremer.coser.bean.Project;
+import fr.ifremer.coser.control.DiffCatchLengthControlError;
+import fr.ifremer.coser.control.ProgressMonitor;
+import fr.ifremer.coser.control.ControlError;
+import fr.ifremer.coser.data.AbstractDataEntity;
+import fr.ifremer.coser.data.Catch;
+import fr.ifremer.coser.data.Haul;
+import fr.ifremer.coser.data.Length;
+import fr.ifremer.coser.data.Strata;
+import fr.ifremer.coser.storage.DataStorage;
+
+/**
+ * Validation service.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class ControlService {
+
+ private static final Log log = LogFactory.getLog(ControlService.class);
+
+ protected CoserBusinessConfig config;
+
+ protected ValidationAwareSupport validationSupport;
+
+ protected DelegatingValidatorContext validationContext;
+
+ protected ActionValidatorManager validator;
+
+ protected ActionContext context;
+
+ /**
+ * Initialise le context xworks.
+ *
+ * @param config configuration
+ */
+ public ControlService(CoserBusinessConfig config) {
+ this.config = config;
+ validationSupport = new ValidationAwareSupport();
+ validationContext = new DelegatingValidatorContext(validationSupport);
+
+ ConfigurationManager confManager = new ConfigurationManager();
+ Configuration conf = confManager.getConfiguration();
+ Container container = conf.getContainer();
+ ValueStackFactory stackFactory = container.getInstance(ValueStackFactory.class);
+ ValueStack vs = stackFactory.createValueStack();
+
+ context = new ActionContext(vs.getContext());
+ ActionContext.setContext(context);
+
+ // huge improve cache performance
+ FileManager.setReloadingConfigs(false);
+
+ // init validator
+ Container container2 = context.getContainer();
+ validator = container2.getInstance(ActionValidatorManager.class, "no-annotations");
+ }
+
+ /**
+ * Valide un seul bean, retourne la liste des erreurs trouvées.
+ *
+ * @param bean bean to validate
+ * @param category result errors category
+ * @return
+ */
+ protected List<ControlError> validate(AbstractDataEntity bean, Category category) {
+ List<ControlError> result = new ArrayList<ControlError>();;
+ try {
+ // obligatoire pour les appel dans les thread et swing EDT
+ ActionContext.setContext(context);
+
+ for(ValidationLevel validationLevel : ValidationLevel.values()) {
+
+ try {
+ validator.validate(bean, validationLevel.getXWorkContext(), validationContext);
+
+ if (validationContext.hasErrors()) {
+ Map<String, List<String>> fieldErrors = validationContext.getFieldErrors();
+
+ for (List<String> errors : fieldErrors.values()) {
+ ControlError error = new ControlError();
+ error.setCategory(category);
+ String messages = StringUtils.join(errors, ", ");
+ error.setMessage(messages);
+ error.setLevel(validationLevel);
+
+ // add error line
+ error.addLineNumber(bean.getLine());
+
+ result.add(error);
+ }
+
+ Collection<String> actionMessages = validationContext.getActionErrors();
+ if (CollectionUtils.isNotEmpty(actionMessages)) {
+ ControlError error = new ControlError();
+ error.setCategory(category);
+ String messages = StringUtils.join(actionMessages, ", ");
+ error.setMessage(messages);
+ error.setLevel(validationLevel);
+
+ // add error line
+ error.addLineNumber(bean.getLine());
+
+ result.add(error);
+ }
+ }
+ }
+ finally {
+ // vidage par log level
+ validationSupport.clearFieldErrors();
+ validationSupport.clearActionErrors();
+ }
+ }
+
+ } catch (ValidationException ex) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't validate bean", ex);
+ }
+ }
+ finally {
+ validationSupport.clearFieldErrors();
+ validationSupport.clearActionErrors();
+ }
+ return result;
+ }
+
+ /**
+ * Valide toutes les données du projet.
+ *
+ * @param project project
+ * @param control control a valider
+ * @param progress progress monitor
+ * @return les erreurs de validation
+ */
+ public List<ControlError> validateData(Project project, Control control, ProgressMonitor progress) {
+
+ // valide chaque category
+ List<ControlError> validationErrors = new ArrayList<ControlError>();
+ for (Category category : Category.values()) {
+ if (category.isDataCategory()) {
+ // validation de la category seule (generique)
+ List<ControlError> categoryErrors = validateCategoryXWork(control, category, progress);
+ if (categoryErrors != null) {
+ validationErrors.addAll(categoryErrors);
+ }
+ // validation specifique de la category
+ List<ControlError> specificErrors = validateCategorySpecific(control, category, progress);
+ if (specificErrors != null) {
+ validationErrors.addAll(specificErrors);
+ }
+ }
+ }
+
+ // validation entre catch et length (specific)
+ List<ControlError> diffCatchLengthErrors = validateDiffCatchLength(control);
+ if (diffCatchLengthErrors != null) {
+ validationErrors.addAll(diffCatchLengthErrors);
+ }
+
+ // validation par croisement de fichiers
+ List<ControlError> crossFileErrors = validationCrossFiles(project, control, progress);
+ if (crossFileErrors != null) {
+ validationErrors.addAll(crossFileErrors);
+ }
+
+ // cas particulier, s'il n'y a aucune erreur, on ajout une erreur de
+ // type info pour dire qu'il n'y a pas d'erreur
+ if (validationErrors.isEmpty()) {
+ ControlError noErrorError = new ControlError();
+ noErrorError.setLevel(ValidationLevel.INFO);
+ noErrorError.setMessage(_("coser.business.control.noerrorfound"));
+ validationErrors.add(noErrorError);
+ }
+ return validationErrors;
+ }
+
+ /**
+ * Valide une category entière d'un project.
+ *
+ * @param control control a valider
+ * @param category category a valider
+ * @param progress progress monitor
+ * @return les erreurs de validation
+ */
+ public List<ControlError> validateCategory(Control control, Category category, ProgressMonitor progress) {
+
+ // validation de la category seule (generique)
+ List<ControlError> errors = validateCategoryXWork(control, category, progress);
+ // validation specifique de la category
+ List<ControlError> specificErrors = validateCategorySpecific(control, category, progress);
+ if (specificErrors != null) {
+ errors.addAll(specificErrors);
+ }
+
+ return errors;
+ }
+
+ /**
+ * Valide une category entière d'un project.
+ *
+ * @param control control a valider
+ * @param category category a valider
+ * @param progress progress monitor
+ * @return les erreurs de validation (not null)
+ */
+ public List<ControlError> validateCategoryXWork(Control control, Category category, ProgressMonitor progress) {
+
+ // instance des bean utilisé lors de la validation
+ Catch beanCatch = new Catch();
+ Haul beanHaul = new Haul();
+ Length beanLength = new Length();
+ Strata beanStrata = new Strata();
+
+ // get content depending on category
+ DataStorage dataToCheck = null;
+ switch (category) {
+ case CATCH:
+ dataToCheck = control.getCatch();
+ break;
+ case HAUL:
+ dataToCheck = control.getHaul();
+ break;
+ case LENGTH:
+ dataToCheck = control.getLength();
+ break;
+ case STRATA:
+ dataToCheck = control.getStrata();
+ break;
+ }
+
+ // update progress
+ int total = dataToCheck.size() - 1;
+ if (progress != null) {
+ progress.setText(_("coser.business.control.step.xworks", _(category.getTranslationKey()), 0));
+ progress.setTotal(total);
+ }
+
+ Map<String, String> uniqueDataKeys = new HashMap<String, String>();
+ List<ControlError> validationErrors = new ArrayList<ControlError>();
+ Iterator<String[]> itDataToCheck = dataToCheck.iterator();
+ int lineIndex = 1; // 1 = skip header
+ itDataToCheck.next(); // skip header
+ while (itDataToCheck.hasNext()) {
+
+ // update progress
+ if (progress != null) {
+ int progressPercent = (int)((double)lineIndex / (double)total * 100.0);
+ progress.setText(_("coser.business.control.step.xworks", progressPercent));
+ progress.setCurrent(lineIndex);
+ ++lineIndex;
+ }
+
+ // first, do single bean validation
+ String[] line = itDataToCheck.next();
+ List<ControlError> errors = null;
+ switch (category) {
+ case CATCH:
+ beanCatch.setData(line);
+ errors = validate(beanCatch, category);
+ break;
+ case HAUL:
+ beanHaul.setData(line);
+ errors = validate(beanHaul, category);
+ break;
+ case LENGTH:
+ beanLength.setData(line);
+ errors = validate(beanLength, category);
+ break;
+ case STRATA:
+ beanStrata.setData(line);
+ errors = validate(beanStrata, category);
+ break;
+ }
+ if (errors != null) {
+ validationErrors.addAll(errors);
+ }
+
+ // check for duplicated lines
+ String lineNumber = line[AbstractDataEntity.INDEX_LINE];
+ String uniqueDataKey = getSignificantData(category, line);
+ if (uniqueDataKeys.containsKey(uniqueDataKey)) {
+ ControlError error = new ControlError();
+ error.setCategory(category);
+ error.setLevel(ValidationLevel.ERROR);
+ error.addLineNumber(uniqueDataKeys.get(uniqueDataKey));
+ error.addLineNumber(lineNumber);
+ error.setMessage(_("coser.business.control.error.duplicatedLine", uniqueDataKey));
+ error.setDetailMessage(_("coser.business.control.error.duplicatedLineDetails", uniqueDataKey));
+ validationErrors.add(error);
+ }
+ else {
+ uniqueDataKeys.put(uniqueDataKey, lineNumber);
+ }
+ }
+
+ return validationErrors;
+ }
+
+ /**
+ * Retourne sous forme de clé la partie significative des données.
+ * Donc sans le numéro de ligne suivant la catégorie.
+ *
+ * Utilisé pour la detection des doublons.
+ *
+ * CAPTURES
+ * Vérifier l'unicité sur : "Campagne", "Annee", "Trait", "Espece"
+ *
+ * STRATES
+ * Vérifier l'unicité sur : "Campagne", "Strate"
+ *
+ * TAILLES
+ * Vérifier l'unicité sur : Campagne", "Annee", "Trait", "Espece", "Sexe", "Maturite", "Longueur"
+ *
+ * TRAITS
+ * Vérifier l'unicité sur : "Campagne", "Annee", "Trait", "Mois"
+ *
+ * @param category category
+ * @param data data
+ * @return string key
+ */
+ protected String getSignificantData(Category category, String[] data) {
+ StringBuilder sb = new StringBuilder();
+ for (int index = 0 ; index < data.length ; ++index) {
+ // never count index line
+ if (index != AbstractDataEntity.INDEX_LINE) {
+ switch (category) {
+ case CATCH:
+ if (index == Catch.INDEX_SURVEY || index == Catch.INDEX_YEAR || index == Catch.INDEX_HAUL || index == Catch.INDEX_SPECIES) {
+ sb.append(data[index]).append('|');
+ }
+ break;
+ case HAUL:
+ if (index == Haul.INDEX_SURVEY || index == Haul.INDEX_YEAR || index == Haul.INDEX_HAUL || index == Haul.INDEX_MONTH) {
+ sb.append(data[index]).append('|');
+ }
+ break;
+ case LENGTH:
+ if (index == Length.INDEX_SURVEY || index == Length.INDEX_YEAR || index == Length.INDEX_HAUL ||
+ index == Length.INDEX_SPECIES || index == Length.INDEX_SEX || index == Length.INDEX_MATURITY || index == Length.INDEX_LENGTH) {
+ sb.append(data[index]).append('|');
+ }
+ break;
+ case STRATA:
+ if (index == Strata.INDEX_SURVEY || index == Strata.INDEX_STRATUM) {
+ sb.append(data[index]).append('|');
+ }
+ break;
+ }
+
+ }
+
+ }
+ return sb.toString();
+ }
+
+ /**
+ * Effectue un calcul global, mais specific a chaque categorie.
+ *
+ * @param control control
+ * @param category category
+ * @param progress progress monitor
+ * @return
+ */
+ protected List<ControlError> validateCategorySpecific(Control control,
+ Category category, ProgressMonitor progress) {
+
+ List<ControlError> validationErrors = null;
+ switch (category) {
+ case CATCH:
+ validationErrors = validateCategorySpecificCatch(control, progress);
+ break;
+ case HAUL:
+ validationErrors = validateCategorySpecificHaul(control, progress);
+ break;
+ case LENGTH:
+ validationErrors = validateCategorySpecificLength(control, progress);
+ break;
+ case STRATA:
+ validationErrors = validateCategorySpecificStrata(control, progress);
+ break;
+ }
+ return validationErrors;
+ }
+
+ /**
+ * Alerte si Somme(CAPTURES$Nombre par CAPTURES$Annee|Strate|Espece) < nobsmin.
+ * Erreur si CAPT$Nombre n'est pas 0 si le poids dans CAPT$Poids>0
+ *
+ * @param control
+ * @param progress
+ * @return
+ */
+ protected List<ControlError> validateCategorySpecificCatch(
+ Control control, ProgressMonitor progress) {
+
+ List<ControlError> validationErrors = new ArrayList<ControlError>();
+
+ int total = control.getCatch().size() - 1;
+ if (progress != null) {
+ progress.setText(_("coser.business.control.step.observation", 0));
+ progress.setTotal(total);
+ }
+
+ // "Campagne","Annee","Trait","Espece","Nombre","Poids"
+ // regroupement par campagne/annee/trait
+ Map<String, Double> nombreForKey = new HashMap<String, Double>();
+ Map<String, String> firstLineForKey = new HashMap<String, String>();
+
+ // parcours des elements
+ Iterator<String[]> itTuple = control.getCatch().iterator();
+ itTuple.next(); // skip header
+ int lineIndex = 1; // skip header
+ while (itTuple.hasNext()) {
+ String[] tuple = itTuple.next();
+
+ // update progress
+ if (progress != null) {
+ int progressPercent = (int)((double)lineIndex / (double)total * 100.0);
+ progress.setText(_("coser.business.control.step.observation", progressPercent));
+ progress.setCurrent(lineIndex);
+ ++lineIndex;
+ }
+
+ // compute key
+ StringBuffer sb = new StringBuffer();
+ for (int tupleIndex = 0 ; tupleIndex < tuple.length; ++tupleIndex) {
+ if (tupleIndex == Catch.INDEX_YEAR || tupleIndex == Catch.INDEX_HAUL ||
+ tupleIndex == Catch.INDEX_SPECIES) {
+ sb.append(tuple[tupleIndex]).append(';');
+ }
+ }
+
+ // store number sum
+ String nombreValue = tuple[Catch.INDEX_NUMBER];
+ String lineNumber = tuple[AbstractDataEntity.INDEX_LINE];
+ try {
+ Double nombre = Double.valueOf(nombreValue);
+ String key = sb.toString();
+ if (nombreForKey.containsKey(key)) {
+ Double oldValue = nombreForKey.get(key);
+ Double newValue = oldValue + nombre;
+ nombreForKey.put(key, newValue);
+ }
+ else {
+ nombreForKey.put(key, nombre);
+ // sauvegarde la premiere ligne qui correspond a un regroupement de clé
+ firstLineForKey.put(key, lineNumber);
+ }
+ }
+ catch (NumberFormatException ex) {
+ // par trop grave, normalement les données deviennent
+ // valide au fil de la validation
+ if (log.isWarnEnabled()) {
+ log.warn("Can't parse '" + nombreValue + "' as double");
+ }
+ }
+ }
+
+ // now look for invalid data
+ for (Map.Entry<String, Double> sumObservation : nombreForKey.entrySet()) {
+ String key = sumObservation.getKey();
+ Double value = sumObservation.getValue();
+ if (value < config.getControlNobsmin()) {
+
+ String lineNumber = firstLineForKey.get(key);
+
+ ControlError error = new ControlError();
+ error.setCategory(Category.CATCH);
+ error.setLevel(ValidationLevel.WARNING);
+ error.addLineNumber(lineNumber);
+ error.setMessage(_("coser.business.control.error.minObservationCount"));
+ error.setDetailMessage(_("coser.business.control.error.minObservationCountDetail", key, value));
+ validationErrors.add(error);
+ }
+ }
+
+ return validationErrors;
+ }
+
+ /**
+ * Detecte des différences entre les nombres dans captures
+ * et les nombres dand taille.
+ *
+ * @see PublicationService#getCompareCatchLengthGraph(Project, Control, String) for details
+ * @see CoserBusinessConfig#getControlDiffCatchLength() for option
+ *
+ * @return errors
+ */
+ protected List<ControlError> validateDiffCatchLength(Control control) {
+
+ List<ControlError> validationErrors = new ArrayList<ControlError>();
+ SortedSet<String> setYear = new TreeSet<String>();
+
+ // look for data (data summed over catch)
+ Map<String, Map<String, Double>> catchForSpeciesYears = new HashMap<String, Map<String, Double>>();
+ Iterator<String[]> itCatchData = control.getCatch().iterator();
+ itCatchData.next(); // header
+ while (itCatchData.hasNext()) {
+ String[] tuple = itCatchData.next();
+ String species = tuple[Catch.INDEX_SPECIES];
+
+ Map<String, Double> speciesCatchForYears = catchForSpeciesYears.get(species);
+ if (speciesCatchForYears == null) {
+ speciesCatchForYears = new HashMap<String, Double>();
+ catchForSpeciesYears.put(species, speciesCatchForYears);
+ }
+
+ String year = tuple[Catch.INDEX_YEAR];
+ setYear.add(year);
+ String nombreValue = tuple[Catch.INDEX_NUMBER];
+ try {
+ Double nombreDouble = Double.valueOf(nombreValue);
+
+ if (speciesCatchForYears.containsKey(year)) {
+ Double oldValue = speciesCatchForYears.get(year);
+ Double newValue = oldValue + nombreDouble;
+ speciesCatchForYears.put(year, newValue);
+ }
+ else {
+ speciesCatchForYears.put(year, nombreDouble);
+ }
+ }
+ catch (NumberFormatException ex) {
+ if (log.isWarnEnabled()) {
+ log.warn("Can't parse " + nombreValue + " as double");
+ }
+ }
+ }
+
+ // look for data (data summed over length)
+ Map<String, Map<String, Double>> lengthForSpeciesYears = new HashMap<String, Map<String, Double>>();
+ Iterator<String[]> itLengthData = control.getLength().iterator();
+ itLengthData.next(); // header
+ while (itLengthData.hasNext()) {
+ String[] tuple = itLengthData.next();
+ String species = tuple[Length.INDEX_SPECIES];
+
+ Map<String, Double> speciesLengthForYears = lengthForSpeciesYears.get(species);
+ if (speciesLengthForYears == null) {
+ speciesLengthForYears = new HashMap<String, Double>();
+ lengthForSpeciesYears.put(species, speciesLengthForYears);
+ }
+
+ String year = tuple[Length.INDEX_YEAR];
+ setYear.add(year);
+ String nombreValue = tuple[Length.INDEX_NUMBER];
+ try {
+ Double nombreDouble = Double.valueOf(nombreValue);
+
+ if (speciesLengthForYears.containsKey(year)) {
+ Double oldValue = speciesLengthForYears.get(year);
+ Double newValue = oldValue + nombreDouble;
+ speciesLengthForYears.put(year, newValue);
+ }
+ else {
+ speciesLengthForYears.put(year, nombreDouble);
+ }
+ }
+ catch (NumberFormatException ex) {
+ if (log.isWarnEnabled()) {
+ log.warn("Can't parse " + nombreValue + " as double");
+ }
+ }
+ }
+
+ // check for all species and years
+ for (Map.Entry<String, Map<String, Double>> catchEntries : catchForSpeciesYears.entrySet()) {
+ String species = catchEntries.getKey();
+ Map<String, Double> catchNumbers = catchEntries.getValue();
+ Map<String, Double> lengthNumbers = lengthForSpeciesYears.get(species);
+
+ if (lengthNumbers == null) {
+ // on suppose que cette erreur est détectée par un autre controle
+ continue;
+ }
+
+ Iterator<String> itYears = setYear.iterator();
+ while (itYears.hasNext()) {
+ String year = itYears.next();
+
+ Double catchNumber = catchNumbers.get(year);
+ Double lengthNumber = lengthNumbers.get(year);
+ if (catchNumber == null) {
+ catchNumber = 0.0; // marche pou NA
+ }
+ if (lengthNumber == null) {
+ lengthNumber = 0.0; // marche pour NA
+ }
+
+ // diff entre 4 et 5 = (5-4) * 100 / 5
+ double min = Math.min(catchNumber, lengthNumber);
+ // si c'est 0, ou absence de catures, ce n'est pas une erreur
+ if (min > 0) {
+ double max = Math.max(catchNumber, lengthNumber);
+ double diff = (max - min) * 100 / max;
+
+ if (diff > config.getControlDiffCatchLength()) {
+ DiffCatchLengthControlError error = new DiffCatchLengthControlError();
+ error.setSpecies(species);
+ error.setLevel(ValidationLevel.WARNING);
+ error.setMessage(_("coser.business.control.error.diffCatchLength"));
+ error.setDetailMessage(_("coser.business.control.error.diffCatchLengthDetail", species, year));
+ validationErrors.add(error);
+ }
+ }
+ }
+ }
+
+ return validationErrors;
+ }
+
+ /**
+ * Alerte si Somme(TAILLES$Nombre par TAILLES$Annee|Strate|Espece) < nobsmin
+ *
+ * @param control
+ * @param progress
+ * @return
+ */
+ protected List<ControlError> validateCategorySpecificLength(
+ Control control, ProgressMonitor progress) {
+ List<ControlError> validationErrors = new ArrayList<ControlError>();
+
+ int total = control.getLength().size() - 1;
+ if (progress != null) {
+ progress.setText(_("coser.business.control.step.observation", 0));
+ progress.setTotal(total);
+ }
+
+ // "Campagne","Annee","Trait","Espece","Nombre","Poids"
+ // regroupement par campagne/annee/trait
+ Map<String, Double> nombreForKey = new HashMap<String, Double>();
+ Map<String, String> firstLineForKey = new HashMap<String, String>();
+
+ // parcours des elements
+ Iterator<String[]> itTuple = control.getLength().iterator();
+ itTuple.next(); // skip header
+ int lineIndex = 1; // skip header
+ while (itTuple.hasNext()) {
+ String[] tuple = itTuple.next();
+
+ // update progress
+ if (progress != null) {
+ int progressPercent = (int)((double)lineIndex / (double)total * 100.0);
+ progress.setText(_("coser.business.control.step.observation", progressPercent));
+ progress.setCurrent(lineIndex);
+ ++lineIndex;
+ }
+
+ // compute key
+ StringBuffer sb = new StringBuffer();
+ for (int tupleIndex = 0 ; tupleIndex < tuple.length; ++tupleIndex) {
+ if (tupleIndex == Length.INDEX_YEAR || tupleIndex == Length.INDEX_HAUL ||
+ tupleIndex == Length.INDEX_SPECIES) {
+ sb.append(tuple[tupleIndex]).append(';');
+ }
+ }
+
+ // store number sum
+ String nombreValue = tuple[Length.INDEX_NUMBER];
+ String lineNumber = tuple[AbstractDataEntity.INDEX_LINE];
+ try {
+ Double nombre = Double.valueOf(nombreValue);
+ String key = sb.toString();
+ if (nombreForKey.containsKey(key)) {
+ Double oldValue = nombreForKey.get(key);
+ Double newValue = oldValue + nombre;
+ nombreForKey.put(key, newValue);
+ }
+ else {
+ nombreForKey.put(key, nombre);
+ // sauvegarde la premiere ligne qui correspond a un regroupement de clé
+ firstLineForKey.put(key, lineNumber);
+ }
+ }
+ catch (NumberFormatException ex) {
+ // par trop grave, normalement les données deviennet
+ // valide au fil de la validation
+ if (log.isWarnEnabled()) {
+ log.warn("Can't parse " + nombreValue + " as double");
+ }
+ }
+ }
+
+ // now look for invalid data
+ for (Map.Entry<String, Double> sumObservation : nombreForKey.entrySet()) {
+ String key = sumObservation.getKey();
+ Double value = sumObservation.getValue();
+ if (value < config.getControlNobsmin()) {
+
+ String lineNumber = firstLineForKey.get(key);
+
+ ControlError error = new ControlError();
+ error.setCategory(Category.LENGTH);
+ error.setLevel(ValidationLevel.WARNING);
+ error.addLineNumber(lineNumber);
+ error.setMessage(_("coser.business.control.error.minObservationCount"));
+ error.setDetailMessage(_("coser.business.control.error.minObservationCountDetail", key, value));
+ validationErrors.add(error);
+ }
+ }
+
+ return validationErrors;
+ }
+
+ /**
+ * @param control
+ * @param progress
+ * @return
+ */
+ protected List<ControlError> validateCategorySpecificHaul(Control control,
+ ProgressMonitor progress) {
+ return null;
+ }
+
+ /**
+ * @param control
+ * @param progress
+ * @return
+ */
+ protected List<ControlError> validateCategorySpecificStrata(
+ Control control, ProgressMonitor progress) {
+ return null;
+ }
+
+ /**
+ * Validation par croisement de fichiers.
+ *
+ * Les erreurs relevé ici porte sur plusieurs fichiers.
+ *
+ * @param control control
+ * @param progress progress
+ * @return error list
+ */
+ protected List<ControlError> validationCrossFiles(Project project, Control control,
+ ProgressMonitor progress) {
+
+ if (progress != null) {
+ progress.setText(_("coser.business.control.step.crossFileChech", 0));
+ progress.setTotal(100);
+ progress.setCurrent(0);
+ }
+
+ List<ControlError> crossFilesErrors = new ArrayList<ControlError>();
+
+ // get all iterators
+ Iterator<String[]> itReftax = project.getRefTaxSpecies().iterator();
+ itReftax.next(); // skip header
+ Iterator<String[]> itCatch = control.getCatch().iterator();
+ itCatch.next(); // skip header
+ Iterator<String[]> itLength = control.getLength().iterator();
+ itLength.next(); // skip header
+ Iterator<String[]> itStrata = control.getStrata().iterator();
+ itStrata.next(); // skip header
+ Iterator<String[]> itHaul = control.getHaul().iterator();
+ itHaul.next(); // skip header
+
+ // declare all necessary data
+ Set<String> refTaxSpecies = new HashSet<String>();
+ Set<String> catchYear = new HashSet<String>();
+ Set<String> lengthYear = new HashSet<String>();
+ Set<String> haulYear = new HashSet<String>();
+ Set<String> campagneNames = new HashSet<String>();
+ Set<String> lengthYearHaulSpecies = new HashSet<String>();
+ Set<String> catchYearHaulSpecies = new HashSet<String>();
+ Set<String> haulYearHaul = new HashSet<String>();
+ Set<String> lengthYearHaul = new HashSet<String>();
+ Set<String> catchYearHaul = new HashSet<String>();
+
+ // parcourt de toutes les données
+ while (itReftax.hasNext() ) {
+ String[] tuple = itReftax.next();
+ // "C_Perm","NumSys","NivSys","C_VALIDE","L_VALIDE","AA_VALIDE","C_TxP\u00E8re","Taxa"
+ refTaxSpecies.add(tuple[3]);
+ }
+
+ while (itCatch.hasNext()) {
+ String[] catchData = itCatch.next();
+ campagneNames.add(catchData[Catch.INDEX_SURVEY]);
+ catchYear.add(catchData[Catch.INDEX_YEAR]);
+ catchYearHaulSpecies.add(catchData[Catch.INDEX_YEAR] + "|" + catchData[Catch.INDEX_HAUL] + "|" + catchData[Catch.INDEX_SPECIES]);
+ catchYearHaul.add(catchData[Catch.INDEX_YEAR] + "|" + catchData[Catch.INDEX_HAUL]);
+
+ // Contrôle des noms d'espèces dans fichiers CAPTURES et TAILLES qui
+ // doivent être dans le référentiel "reftax": CAPTURES$Espece et
+ // TAILLES$Espece doivent exister dans REFTAX$ C_VALIDE
+ if (!refTaxSpecies.contains(catchData[Catch.INDEX_SPECIES])) {
+ ControlError error = new ControlError();
+ error.setCategory(Category.CATCH);
+ error.addLineNumber(catchData[Catch.INDEX_LINE]);
+ error.setLevel(ValidationLevel.ERROR);
+ error.setMessage(_("coser.business.control.error.nonExistantSpecies"));
+ error.setDetailMessage(_("coser.business.control.error.nonExistantSpeciesDetail", catchData[Catch.INDEX_SPECIES]));
+ crossFilesErrors.add(error);
+ }
+ }
+
+ if (progress != null) {
+ progress.setText(_("coser.business.control.step.crossFileChech", 25));
+ progress.setCurrent(25);
+ }
+
+ while (itLength.hasNext()) {
+ String[] lengthData = itLength.next();
+ campagneNames.add(lengthData[Length.INDEX_SURVEY]);
+ lengthYear.add(lengthData[Length.INDEX_YEAR]);
+ lengthYearHaulSpecies.add(lengthData[Length.INDEX_YEAR] + "|" +
+ lengthData[Length.INDEX_HAUL] + "|" + lengthData[Length.INDEX_SPECIES]);
+ lengthYearHaul.add(lengthData[Length.INDEX_YEAR] + "|" + lengthData[Length.INDEX_HAUL]);
+
+ // Contrôle des noms d'espèces dans fichiers CAPTURES et TAILLES qui
+ // doivent être dans le référentiel "reftax": CAPTURES$Espece et
+ // TAILLES$Espece doivent exister dans REFTAX$ C_VALIDE
+ if (!refTaxSpecies.contains(lengthData[Length.INDEX_SPECIES])) {
+ ControlError error = new ControlError();
+ error.setCategory(Category.LENGTH);
+ error.addLineNumber(lengthData[Length.INDEX_LINE]);
+ error.setLevel(ValidationLevel.ERROR);
+ error.setMessage(_("coser.business.control.error.nonExistantSpecies"));
+ error.setDetailMessage(_("coser.business.control.error.nonExistantSpeciesDetail", lengthData[Length.INDEX_SPECIES]));
+ crossFilesErrors.add(error);
+ }
+ }
+
+ if (progress != null) {
+ progress.setText(_("coser.business.control.step.crossFileChech", 50));
+ progress.setCurrent(50);
+ }
+
+ while (itStrata.hasNext()) {
+ String[] strataData = itStrata.next();
+ campagneNames.add(strataData[Strata.INDEX_SURVEY]);
+ }
+
+ if (progress != null) {
+ progress.setText(_("coser.business.control.step.crossFileChech", 75));
+ progress.setCurrent(75);
+ }
+
+ while (itHaul.hasNext()) {
+ String[] haulData = itHaul.next();
+ campagneNames.add(haulData[Haul.INDEX_SURVEY]);
+ haulYear.add(haulData[Haul.INDEX_YEAR]);
+ haulYearHaul.add(haulData[Haul.INDEX_YEAR] + "|" + haulData[Haul.INDEX_HAUL]);
+ }
+
+ // Vérifier que les mêmes années sont présentes dans fichiers captures
+ // traits et tailles: CAPTURES$Annee, TRAITS$Annee, TAILLES$Annee.
+ if (!catchYear.equals(lengthYear) || !haulYear.equals(lengthYear)) {
+ ControlError error = new ControlError();
+ error.setLevel(ValidationLevel.FATAL);
+ error.setMessage(_("coser.business.control.error.yearsNotEquals"));
+ //error.setDetailMessage(_("coser.business.control.error.yearsNotEquals"));
+ crossFilesErrors.add(error);
+ }
+
+ // Vérifier que le nom de la campagne est le même dans tous les fichiers *$Campagne.
+ if (campagneNames.size() != 1) {
+ ControlError error = new ControlError();
+ error.setLevel(ValidationLevel.FATAL);
+ error.setMessage(_("coser.business.control.error.surveyNotEquals"));
+ //error.setDetailMessage(_("coser.business.control.error.surveyNotEquals"));
+ crossFilesErrors.add(error);
+ }
+
+ // Vérifier que pour chaque espèce présent dans un trait d'une année
+ // dans le fichier tailles (noté Annee|Trait|Espece) il y a une donnée
+ // dans le fichier captures (le contraire n'est pas vraie)
+ Collection<String> missingSpeciesCatchTuples = CollectionUtils.subtract(lengthYearHaulSpecies, catchYearHaulSpecies);
+ for (String missingSpeciesCatchTuple : missingSpeciesCatchTuples) {
+ ControlError error = new ControlError();
+ error.setLevel(ValidationLevel.FATAL);
+ error.setMessage(_("coser.business.control.error.missingYearHaulSpeciesForCatchData"));
+ error.setDetailMessage(_("coser.business.control.error.missingYearHaulSpeciesForCatchDataDetail", missingSpeciesCatchTuple));
+ error.setTipMessage(_("coser.business.control.error.missingYearHaulSpeciesForCatchDataTip"));
+ crossFilesErrors.add(error);
+ }
+
+ // Vérifier que pour chaque trait présent une année (noté Annee|Trait)
+ // dans les fichiers tailles et capt il y a une donnée dans le fichier
+ // traits
+ Collection<String> missingHaulLengthTuples = CollectionUtils.subtract(lengthYearHaul, haulYearHaul);
+ for (String missingHaulLengthTuple : missingHaulLengthTuples) {
+ ControlError error = new ControlError();
+ error.setLevel(ValidationLevel.FATAL);
+ error.setMessage(_("coser.business.control.error.missingYearHaulForLengthData"));
+ error.setDetailMessage(_("coser.business.control.error.missingYearHaulForLengthDataDetail", missingHaulLengthTuple));
+ error.setTipMessage(_("coser.business.control.error.missingYearHaulForLengthDataTip"));
+ crossFilesErrors.add(error);
+ }
+
+ // Vérifier que pour chaque trait présent une année (noté Annee|Trait)
+ // dans les fichiers tailles et capt il y a une donnée dans le fichier
+ // traits
+ Collection<String> missingHaulCatchTuples = CollectionUtils.subtract(catchYearHaul, haulYearHaul);
+ for (String missingHaulCatchTuple : missingHaulCatchTuples) {
+ ControlError error = new ControlError();
+ error.setLevel(ValidationLevel.FATAL);
+ error.setMessage(_("coser.business.control.error.missingYearHaulForCatchData"));
+ error.setDetailMessage(_("coser.business.control.error.missingYearHaulForCatchDataDetail", missingHaulCatchTuple));
+ error.setTipMessage(_("coser.business.control.error.missingYearHaulForCatchDataTip"));
+ crossFilesErrors.add(error);
+ }
+
+ if (progress != null) {
+ progress.setText(_("coser.business.control.step.crossFileChech", 100));
+ progress.setCurrent(100);
+ }
+
+ return crossFilesErrors;
+ }
+}
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/services/PublicationService.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/services/PublicationService.java 2010-11-26 13:47:45 UTC (rev 291)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/services/PublicationService.java 2010-11-26 14:03:54 UTC (rev 292)
@@ -65,9 +65,9 @@
import fr.ifremer.coser.CoserConstants.Category;
import fr.ifremer.coser.bean.AbstractDataContainer;
import fr.ifremer.coser.bean.Project;
-import fr.ifremer.coser.control.DiffCatchLengthValidationError;
-import fr.ifremer.coser.control.GlobalValidationGroup;
-import fr.ifremer.coser.control.ValidationError;
+import fr.ifremer.coser.control.DiffCatchLengthControlError;
+import fr.ifremer.coser.control.ControlErrorGroup;
+import fr.ifremer.coser.control.ControlError;
import fr.ifremer.coser.data.Catch;
import fr.ifremer.coser.data.Length;
@@ -270,7 +270,7 @@
* @param validationErrors errors list
* @throws CoserBusinessException
*/
- public File exportErrorsAsHTML(Project project, AbstractDataContainer container, List<ValidationError> validationErrors) throws CoserBusinessException {
+ public File exportErrorsAsHTML(Project project, AbstractDataContainer container, List<ControlError> validationErrors) throws CoserBusinessException {
File exportHtmlFile = null;
PrintStream out = null;
@@ -290,26 +290,26 @@
out.println("</head><body>");
// convert all errors as tree (code duplicated from ui tree model)
- Map<String, List<GlobalValidationGroup>> validationCategoryChild = new HashMap<String, List<GlobalValidationGroup>>();
- Map<GlobalValidationGroup, List<ValidationError>> validationErrorsChilds = new HashMap<GlobalValidationGroup, List<ValidationError>>();
- for (ValidationError validationError : validationErrors) {
+ Map<String, List<ControlErrorGroup>> validationCategoryChild = new HashMap<String, List<ControlErrorGroup>>();
+ Map<ControlErrorGroup, List<ControlError>> validationErrorsChilds = new HashMap<ControlErrorGroup, List<ControlError>>();
+ for (ControlError validationError : validationErrors) {
String category = validationError.getCategory() == null ? _("coser.business.control.error.allCategories") : _(validationError.getCategory().getTranslationKey());
- List<GlobalValidationGroup> errorGroup = validationCategoryChild.get(category);
+ List<ControlErrorGroup> errorGroup = validationCategoryChild.get(category);
if (errorGroup == null) {
- errorGroup = new ArrayList<GlobalValidationGroup>();
+ errorGroup = new ArrayList<ControlErrorGroup>();
validationCategoryChild.put(category, errorGroup);
}
- GlobalValidationGroup group = new GlobalValidationGroup(validationError.getCategory(), validationError.getLevel(), validationError.getMessage());
- List<ValidationError> childErrors = validationErrorsChilds.get(group);
+ ControlErrorGroup group = new ControlErrorGroup(validationError.getCategory(), validationError.getLevel(), validationError.getMessage());
+ List<ControlError> childErrors = validationErrorsChilds.get(group);
if (childErrors == null) {
- childErrors = new ArrayList<ValidationError>();
+ childErrors = new ArrayList<ControlError>();
validationErrorsChilds.put(group, childErrors);
errorGroup.add(group);
}
- if (validationError instanceof DiffCatchLengthValidationError) {
- DiffCatchLengthValidationError diffError = (DiffCatchLengthValidationError)validationError;
+ if (validationError instanceof DiffCatchLengthControlError) {
+ DiffCatchLengthControlError diffError = (DiffCatchLengthControlError)validationError;
speciesGraph.add(diffError.getSpecies());
}
childErrors.add(validationError);
@@ -319,11 +319,11 @@
// render output html
out.println("<h1 style='text-align:center'>" + _("coser.business.publication.htmlexporttitle", project.getName()) + "</h1>");
- for (Map.Entry<String, List<GlobalValidationGroup>> categoriesEntry : validationCategoryChild.entrySet()) {
+ for (Map.Entry<String, List<ControlErrorGroup>> categoriesEntry : validationCategoryChild.entrySet()) {
out.println("<h2>" + categoriesEntry.getKey() + "</h2>");
out.println("<ul>");
- for (GlobalValidationGroup group : categoriesEntry.getValue()) {
+ for (ControlErrorGroup group : categoriesEntry.getValue()) {
out.println("<li style='margin-bottom:20px'><span style='color:");
switch (group.getValidationLevel()) {
@@ -344,7 +344,7 @@
out.println("</span>");
out.println("<ul>");
- for (ValidationError error : validationErrorsChilds.get(group)) {
+ for (ControlError error : validationErrorsChilds.get(group)) {
out.println("<li type='circle'>");
out.print(_(error.getDetailMessage()));
Set<String> lineNumbers = error.getLineNumbers();
@@ -364,8 +364,8 @@
out.println("<p style='font-style:italic'>" + tipMessage + "</p>");
}
// ajout d'un graph si necessaire
- if (error instanceof DiffCatchLengthValidationError) {
- DiffCatchLengthValidationError diffError = (DiffCatchLengthValidationError)error;
+ if (error instanceof DiffCatchLengthControlError) {
+ DiffCatchLengthControlError diffError = (DiffCatchLengthControlError)error;
JFreeChart chart = charts.get(diffError.getSpecies());
File tmpChartImage = File.createTempFile("chart-", ".jpg", imageDirectory);
ChartUtilities.saveChartAsJPEG(tmpChartImage, chart, 800, 400);
Deleted: trunk/coser-business/src/main/java/fr/ifremer/coser/services/ValidationService.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/services/ValidationService.java 2010-11-26 13:47:45 UTC (rev 291)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/services/ValidationService.java 2010-11-26 14:03:54 UTC (rev 292)
@@ -1,975 +0,0 @@
-/*
- * #%L
- *
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2010 Ifremer, Codelutin, Chatellier Eric
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser 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 Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>.
- * #L%
- */
-
-package fr.ifremer.coser.services;
-
-import static org.nuiton.i18n.I18n._;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.SortedSet;
-import java.util.TreeSet;
-
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.lang.xwork.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import com.opensymphony.xwork2.ActionContext;
-import com.opensymphony.xwork2.ValidationAwareSupport;
-import com.opensymphony.xwork2.config.Configuration;
-import com.opensymphony.xwork2.config.ConfigurationManager;
-import com.opensymphony.xwork2.inject.Container;
-import com.opensymphony.xwork2.util.FileManager;
-import com.opensymphony.xwork2.util.ValueStack;
-import com.opensymphony.xwork2.util.ValueStackFactory;
-import com.opensymphony.xwork2.validator.ActionValidatorManager;
-import com.opensymphony.xwork2.validator.DelegatingValidatorContext;
-import com.opensymphony.xwork2.validator.ValidationException;
-
-import fr.ifremer.coser.CoserBusinessConfig;
-import fr.ifremer.coser.CoserConstants.Category;
-import fr.ifremer.coser.CoserConstants.ValidationLevel;
-import fr.ifremer.coser.bean.Control;
-import fr.ifremer.coser.bean.Project;
-import fr.ifremer.coser.control.DiffCatchLengthValidationError;
-import fr.ifremer.coser.control.ProgressMonitor;
-import fr.ifremer.coser.control.ValidationError;
-import fr.ifremer.coser.data.AbstractDataEntity;
-import fr.ifremer.coser.data.Catch;
-import fr.ifremer.coser.data.Haul;
-import fr.ifremer.coser.data.Length;
-import fr.ifremer.coser.data.Strata;
-import fr.ifremer.coser.storage.DataStorage;
-
-/**
- * Validation service.
- *
- * @author chatellier
- * @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
- */
-public class ValidationService {
-
- private static final Log log = LogFactory.getLog(ValidationService.class);
-
- protected CoserBusinessConfig config;
-
- protected ValidationAwareSupport validationSupport;
-
- protected DelegatingValidatorContext validationContext;
-
- protected ActionValidatorManager validator;
-
- protected ActionContext context;
-
- /**
- * Initialise le context xworks.
- *
- * @param config configuration
- */
- public ValidationService(CoserBusinessConfig config) {
- this.config = config;
- validationSupport = new ValidationAwareSupport();
- validationContext = new DelegatingValidatorContext(validationSupport);
-
- ConfigurationManager confManager = new ConfigurationManager();
- Configuration conf = confManager.getConfiguration();
- Container container = conf.getContainer();
- ValueStackFactory stackFactory = container.getInstance(ValueStackFactory.class);
- ValueStack vs = stackFactory.createValueStack();
-
- context = new ActionContext(vs.getContext());
- ActionContext.setContext(context);
-
- // huge improve cache performance
- FileManager.setReloadingConfigs(false);
-
- // init validator
- Container container2 = context.getContainer();
- validator = container2.getInstance(ActionValidatorManager.class, "no-annotations");
- }
-
- /**
- * Valide un seul bean, retourne la liste des erreurs trouvées.
- *
- * @param bean bean to validate
- * @param category result errors category
- * @return
- */
- protected List<ValidationError> validate(AbstractDataEntity bean, Category category) {
- List<ValidationError> result = new ArrayList<ValidationError>();;
- try {
- // obligatoire pour les appel dans les thread et swing EDT
- ActionContext.setContext(context);
-
- for(ValidationLevel validationLevel : ValidationLevel.values()) {
-
- try {
- validator.validate(bean, validationLevel.getXWorkContext(), validationContext);
-
- if (validationContext.hasErrors()) {
- Map<String, List<String>> fieldErrors = validationContext.getFieldErrors();
-
- for (List<String> errors : fieldErrors.values()) {
- ValidationError error = new ValidationError();
- error.setCategory(category);
- String messages = StringUtils.join(errors, ", ");
- error.setMessage(messages);
- error.setLevel(validationLevel);
-
- // add error line
- error.addLineNumber(bean.getLine());
-
- result.add(error);
- }
-
- Collection<String> actionMessages = validationContext.getActionErrors();
- if (CollectionUtils.isNotEmpty(actionMessages)) {
- ValidationError error = new ValidationError();
- error.setCategory(category);
- String messages = StringUtils.join(actionMessages, ", ");
- error.setMessage(messages);
- error.setLevel(validationLevel);
-
- // add error line
- error.addLineNumber(bean.getLine());
-
- result.add(error);
- }
- }
- }
- finally {
- // vidage par log level
- validationSupport.clearFieldErrors();
- validationSupport.clearActionErrors();
- }
- }
-
- } catch (ValidationException ex) {
- if (log.isErrorEnabled()) {
- log.error("Can't validate bean", ex);
- }
- }
- finally {
- validationSupport.clearFieldErrors();
- validationSupport.clearActionErrors();
- }
- return result;
- }
-
- /**
- * Valide toutes les données du projet.
- *
- * @param project project
- * @param control control a valider
- * @param progress progress monitor
- * @return les erreurs de validation
- */
- public List<ValidationError> validateData(Project project, Control control, ProgressMonitor progress) {
-
- // valide chaque category
- List<ValidationError> validationErrors = new ArrayList<ValidationError>();
- for (Category category : Category.values()) {
- if (category.isDataCategory()) {
- // validation de la category seule (generique)
- List<ValidationError> categoryErrors = validateCategoryXWork(control, category, progress);
- if (categoryErrors != null) {
- validationErrors.addAll(categoryErrors);
- }
- // validation specifique de la category
- List<ValidationError> specificErrors = validateCategorySpecific(control, category, progress);
- if (specificErrors != null) {
- validationErrors.addAll(specificErrors);
- }
- }
- }
-
- // validation entre catch et length (specific)
- List<ValidationError> diffCatchLengthErrors = validateDiffCatchLength(control);
- if (diffCatchLengthErrors != null) {
- validationErrors.addAll(diffCatchLengthErrors);
- }
-
- // validation par croisement de fichiers
- List<ValidationError> crossFileErrors = validationCrossFiles(project, control, progress);
- if (crossFileErrors != null) {
- validationErrors.addAll(crossFileErrors);
- }
-
- // cas particulier, s'il n'y a aucune erreur, on ajout une erreur de
- // type info pour dire qu'il n'y a pas d'erreur
- if (validationErrors.isEmpty()) {
- ValidationError noErrorError = new ValidationError();
- noErrorError.setLevel(ValidationLevel.INFO);
- noErrorError.setMessage(_("coser.business.control.noerrorfound"));
- validationErrors.add(noErrorError);
- }
- return validationErrors;
- }
-
- /**
- * Valide une category entière d'un project.
- *
- * @param control control a valider
- * @param category category a valider
- * @param progress progress monitor
- * @return les erreurs de validation
- */
- public List<ValidationError> validateCategory(Control control, Category category, ProgressMonitor progress) {
-
- // validation de la category seule (generique)
- List<ValidationError> errors = validateCategoryXWork(control, category, progress);
- // validation specifique de la category
- List<ValidationError> specificErrors = validateCategorySpecific(control, category, progress);
- if (specificErrors != null) {
- errors.addAll(specificErrors);
- }
-
- return errors;
- }
-
- /**
- * Valide une category entière d'un project.
- *
- * @param control control a valider
- * @param category category a valider
- * @param progress progress monitor
- * @return les erreurs de validation (not null)
- */
- public List<ValidationError> validateCategoryXWork(Control control, Category category, ProgressMonitor progress) {
-
- // instance des bean utilisé lors de la validation
- Catch beanCatch = new Catch();
- Haul beanHaul = new Haul();
- Length beanLength = new Length();
- Strata beanStrata = new Strata();
-
- // get content depending on category
- DataStorage dataToCheck = null;
- switch (category) {
- case CATCH:
- dataToCheck = control.getCatch();
- break;
- case HAUL:
- dataToCheck = control.getHaul();
- break;
- case LENGTH:
- dataToCheck = control.getLength();
- break;
- case STRATA:
- dataToCheck = control.getStrata();
- break;
- }
-
- // update progress
- int total = dataToCheck.size() - 1;
- if (progress != null) {
- progress.setText(_("coser.business.control.step.xworks", _(category.getTranslationKey()), 0));
- progress.setTotal(total);
- }
-
- Map<String, String> uniqueDataKeys = new HashMap<String, String>();
- List<ValidationError> validationErrors = new ArrayList<ValidationError>();
- Iterator<String[]> itDataToCheck = dataToCheck.iterator();
- int lineIndex = 1; // 1 = skip header
- itDataToCheck.next(); // skip header
- while (itDataToCheck.hasNext()) {
-
- // update progress
- if (progress != null) {
- int progressPercent = (int)((double)lineIndex / (double)total * 100.0);
- progress.setText(_("coser.business.control.step.xworks", progressPercent));
- progress.setCurrent(lineIndex);
- ++lineIndex;
- }
-
- // first, do single bean validation
- String[] line = itDataToCheck.next();
- List<ValidationError> errors = null;
- switch (category) {
- case CATCH:
- beanCatch.setData(line);
- errors = validate(beanCatch, category);
- break;
- case HAUL:
- beanHaul.setData(line);
- errors = validate(beanHaul, category);
- break;
- case LENGTH:
- beanLength.setData(line);
- errors = validate(beanLength, category);
- break;
- case STRATA:
- beanStrata.setData(line);
- errors = validate(beanStrata, category);
- break;
- }
- if (errors != null) {
- validationErrors.addAll(errors);
- }
-
- // check for duplicated lines
- String lineNumber = line[AbstractDataEntity.INDEX_LINE];
- String uniqueDataKey = getSignificantData(category, line);
- if (uniqueDataKeys.containsKey(uniqueDataKey)) {
- ValidationError error = new ValidationError();
- error.setCategory(category);
- error.setLevel(ValidationLevel.ERROR);
- error.addLineNumber(uniqueDataKeys.get(uniqueDataKey));
- error.addLineNumber(lineNumber);
- error.setMessage(_("coser.business.control.error.duplicatedLine", uniqueDataKey));
- error.setDetailMessage(_("coser.business.control.error.duplicatedLineDetails", uniqueDataKey));
- validationErrors.add(error);
- }
- else {
- uniqueDataKeys.put(uniqueDataKey, lineNumber);
- }
- }
-
- return validationErrors;
- }
-
- /**
- * Retourne sous forme de clé la partie significative des données.
- * Donc sans le numéro de ligne suivant la catégorie.
- *
- * Utilisé pour la detection des doublons.
- *
- * CAPTURES
- * Vérifier l'unicité sur : "Campagne", "Annee", "Trait", "Espece"
- *
- * STRATES
- * Vérifier l'unicité sur : "Campagne", "Strate"
- *
- * TAILLES
- * Vérifier l'unicité sur : Campagne", "Annee", "Trait", "Espece", "Sexe", "Maturite", "Longueur"
- *
- * TRAITS
- * Vérifier l'unicité sur : "Campagne", "Annee", "Trait", "Mois"
- *
- * @param category category
- * @param data data
- * @return string key
- */
- protected String getSignificantData(Category category, String[] data) {
- StringBuilder sb = new StringBuilder();
- for (int index = 0 ; index < data.length ; ++index) {
- // never count index line
- if (index != AbstractDataEntity.INDEX_LINE) {
- switch (category) {
- case CATCH:
- if (index == Catch.INDEX_SURVEY || index == Catch.INDEX_YEAR || index == Catch.INDEX_HAUL || index == Catch.INDEX_SPECIES) {
- sb.append(data[index]).append('|');
- }
- break;
- case HAUL:
- if (index == Haul.INDEX_SURVEY || index == Haul.INDEX_YEAR || index == Haul.INDEX_HAUL || index == Haul.INDEX_MONTH) {
- sb.append(data[index]).append('|');
- }
- break;
- case LENGTH:
- if (index == Length.INDEX_SURVEY || index == Length.INDEX_YEAR || index == Length.INDEX_HAUL ||
- index == Length.INDEX_SPECIES || index == Length.INDEX_SEX || index == Length.INDEX_MATURITY || index == Length.INDEX_LENGTH) {
- sb.append(data[index]).append('|');
- }
- break;
- case STRATA:
- if (index == Strata.INDEX_SURVEY || index == Strata.INDEX_STRATUM) {
- sb.append(data[index]).append('|');
- }
- break;
- }
-
- }
-
- }
- return sb.toString();
- }
-
- /**
- * Effectue un calcul global, mais specific a chaque categorie.
- *
- * @param control control
- * @param category category
- * @param progress progress monitor
- * @return
- */
- protected List<ValidationError> validateCategorySpecific(Control control,
- Category category, ProgressMonitor progress) {
-
- List<ValidationError> validationErrors = null;
- switch (category) {
- case CATCH:
- validationErrors = validateCategorySpecificCatch(control, progress);
- break;
- case HAUL:
- validationErrors = validateCategorySpecificHaul(control, progress);
- break;
- case LENGTH:
- validationErrors = validateCategorySpecificLength(control, progress);
- break;
- case STRATA:
- validationErrors = validateCategorySpecificStrata(control, progress);
- break;
- }
- return validationErrors;
- }
-
- /**
- * Alerte si Somme(CAPTURES$Nombre par CAPTURES$Annee|Strate|Espece) < nobsmin.
- * Erreur si CAPT$Nombre n'est pas 0 si le poids dans CAPT$Poids>0
- *
- * @param control
- * @param progress
- * @return
- */
- protected List<ValidationError> validateCategorySpecificCatch(
- Control control, ProgressMonitor progress) {
-
- List<ValidationError> validationErrors = new ArrayList<ValidationError>();
-
- int total = control.getCatch().size() - 1;
- if (progress != null) {
- progress.setText(_("coser.business.control.step.observation", 0));
- progress.setTotal(total);
- }
-
- // "Campagne","Annee","Trait","Espece","Nombre","Poids"
- // regroupement par campagne/annee/trait
- Map<String, Double> nombreForKey = new HashMap<String, Double>();
- Map<String, String> firstLineForKey = new HashMap<String, String>();
-
- // parcours des elements
- Iterator<String[]> itTuple = control.getCatch().iterator();
- itTuple.next(); // skip header
- int lineIndex = 1; // skip header
- while (itTuple.hasNext()) {
- String[] tuple = itTuple.next();
-
- // update progress
- if (progress != null) {
- int progressPercent = (int)((double)lineIndex / (double)total * 100.0);
- progress.setText(_("coser.business.control.step.observation", progressPercent));
- progress.setCurrent(lineIndex);
- ++lineIndex;
- }
-
- // compute key
- StringBuffer sb = new StringBuffer();
- for (int tupleIndex = 0 ; tupleIndex < tuple.length; ++tupleIndex) {
- if (tupleIndex == Catch.INDEX_YEAR || tupleIndex == Catch.INDEX_HAUL ||
- tupleIndex == Catch.INDEX_SPECIES) {
- sb.append(tuple[tupleIndex]).append(';');
- }
- }
-
- // store number sum
- String nombreValue = tuple[Catch.INDEX_NUMBER];
- String lineNumber = tuple[AbstractDataEntity.INDEX_LINE];
- try {
- Double nombre = Double.valueOf(nombreValue);
- String key = sb.toString();
- if (nombreForKey.containsKey(key)) {
- Double oldValue = nombreForKey.get(key);
- Double newValue = oldValue + nombre;
- nombreForKey.put(key, newValue);
- }
- else {
- nombreForKey.put(key, nombre);
- // sauvegarde la premiere ligne qui correspond a un regroupement de clé
- firstLineForKey.put(key, lineNumber);
- }
- }
- catch (NumberFormatException ex) {
- // par trop grave, normalement les données deviennent
- // valide au fil de la validation
- if (log.isWarnEnabled()) {
- log.warn("Can't parse '" + nombreValue + "' as double");
- }
- }
- }
-
- // now look for invalid data
- for (Map.Entry<String, Double> sumObservation : nombreForKey.entrySet()) {
- String key = sumObservation.getKey();
- Double value = sumObservation.getValue();
- if (value < config.getControlNobsmin()) {
-
- String lineNumber = firstLineForKey.get(key);
-
- ValidationError error = new ValidationError();
- error.setCategory(Category.CATCH);
- error.setLevel(ValidationLevel.WARNING);
- error.addLineNumber(lineNumber);
- error.setMessage(_("coser.business.control.error.minObservationCount"));
- error.setDetailMessage(_("coser.business.control.error.minObservationCountDetail", key, value));
- validationErrors.add(error);
- }
- }
-
- return validationErrors;
- }
-
- /**
- * Detecte des différences entre les nombres dans captures
- * et les nombres dand taille.
- *
- * @see PublicationService#getCompareCatchLengthGraph(Project, Control, String) for details
- * @see CoserBusinessConfig#getControlDiffCatchLength() for option
- *
- * @return errors
- */
- protected List<ValidationError> validateDiffCatchLength(Control control) {
-
- List<ValidationError> validationErrors = new ArrayList<ValidationError>();
- SortedSet<String> setYear = new TreeSet<String>();
-
- // look for data (data summed over catch)
- Map<String, Map<String, Double>> catchForSpeciesYears = new HashMap<String, Map<String, Double>>();
- Iterator<String[]> itCatchData = control.getCatch().iterator();
- itCatchData.next(); // header
- while (itCatchData.hasNext()) {
- String[] tuple = itCatchData.next();
- String species = tuple[Catch.INDEX_SPECIES];
-
- Map<String, Double> speciesCatchForYears = catchForSpeciesYears.get(species);
- if (speciesCatchForYears == null) {
- speciesCatchForYears = new HashMap<String, Double>();
- catchForSpeciesYears.put(species, speciesCatchForYears);
- }
-
- String year = tuple[Catch.INDEX_YEAR];
- setYear.add(year);
- String nombreValue = tuple[Catch.INDEX_NUMBER];
- try {
- Double nombreDouble = Double.valueOf(nombreValue);
-
- if (speciesCatchForYears.containsKey(year)) {
- Double oldValue = speciesCatchForYears.get(year);
- Double newValue = oldValue + nombreDouble;
- speciesCatchForYears.put(year, newValue);
- }
- else {
- speciesCatchForYears.put(year, nombreDouble);
- }
- }
- catch (NumberFormatException ex) {
- if (log.isWarnEnabled()) {
- log.warn("Can't parse " + nombreValue + " as double");
- }
- }
- }
-
- // look for data (data summed over length)
- Map<String, Map<String, Double>> lengthForSpeciesYears = new HashMap<String, Map<String, Double>>();
- Iterator<String[]> itLengthData = control.getLength().iterator();
- itLengthData.next(); // header
- while (itLengthData.hasNext()) {
- String[] tuple = itLengthData.next();
- String species = tuple[Length.INDEX_SPECIES];
-
- Map<String, Double> speciesLengthForYears = lengthForSpeciesYears.get(species);
- if (speciesLengthForYears == null) {
- speciesLengthForYears = new HashMap<String, Double>();
- lengthForSpeciesYears.put(species, speciesLengthForYears);
- }
-
- String year = tuple[Length.INDEX_YEAR];
- setYear.add(year);
- String nombreValue = tuple[Length.INDEX_NUMBER];
- try {
- Double nombreDouble = Double.valueOf(nombreValue);
-
- if (speciesLengthForYears.containsKey(year)) {
- Double oldValue = speciesLengthForYears.get(year);
- Double newValue = oldValue + nombreDouble;
- speciesLengthForYears.put(year, newValue);
- }
- else {
- speciesLengthForYears.put(year, nombreDouble);
- }
- }
- catch (NumberFormatException ex) {
- if (log.isWarnEnabled()) {
- log.warn("Can't parse " + nombreValue + " as double");
- }
- }
- }
-
- // check for all species and years
- for (Map.Entry<String, Map<String, Double>> catchEntries : catchForSpeciesYears.entrySet()) {
- String species = catchEntries.getKey();
- Map<String, Double> catchNumbers = catchEntries.getValue();
- Map<String, Double> lengthNumbers = lengthForSpeciesYears.get(species);
-
- if (lengthNumbers == null) {
- // on suppose que cette erreur est détectée par un autre controle
- continue;
- }
-
- Iterator<String> itYears = setYear.iterator();
- while (itYears.hasNext()) {
- String year = itYears.next();
-
- Double catchNumber = catchNumbers.get(year);
- Double lengthNumber = lengthNumbers.get(year);
- if (catchNumber == null) {
- catchNumber = 0.0; // marche pou NA
- }
- if (lengthNumber == null) {
- lengthNumber = 0.0; // marche pour NA
- }
-
- // diff entre 4 et 5 = (5-4) * 100 / 5
- double min = Math.min(catchNumber, lengthNumber);
- // si c'est 0, ou absence de catures, ce n'est pas une erreur
- if (min > 0) {
- double max = Math.max(catchNumber, lengthNumber);
- double diff = (max - min) * 100 / max;
-
- if (diff > config.getControlDiffCatchLength()) {
- DiffCatchLengthValidationError error = new DiffCatchLengthValidationError();
- error.setSpecies(species);
- error.setLevel(ValidationLevel.WARNING);
- error.setMessage(_("coser.business.control.error.diffCatchLength"));
- error.setDetailMessage(_("coser.business.control.error.diffCatchLengthDetail", species, year));
- validationErrors.add(error);
- }
- }
- }
- }
-
- return validationErrors;
- }
-
- /**
- * Alerte si Somme(TAILLES$Nombre par TAILLES$Annee|Strate|Espece) < nobsmin
- *
- * @param control
- * @param progress
- * @return
- */
- protected List<ValidationError> validateCategorySpecificLength(
- Control control, ProgressMonitor progress) {
- List<ValidationError> validationErrors = new ArrayList<ValidationError>();
-
- int total = control.getLength().size() - 1;
- if (progress != null) {
- progress.setText(_("coser.business.control.step.observation", 0));
- progress.setTotal(total);
- }
-
- // "Campagne","Annee","Trait","Espece","Nombre","Poids"
- // regroupement par campagne/annee/trait
- Map<String, Double> nombreForKey = new HashMap<String, Double>();
- Map<String, String> firstLineForKey = new HashMap<String, String>();
-
- // parcours des elements
- Iterator<String[]> itTuple = control.getLength().iterator();
- itTuple.next(); // skip header
- int lineIndex = 1; // skip header
- while (itTuple.hasNext()) {
- String[] tuple = itTuple.next();
-
- // update progress
- if (progress != null) {
- int progressPercent = (int)((double)lineIndex / (double)total * 100.0);
- progress.setText(_("coser.business.control.step.observation", progressPercent));
- progress.setCurrent(lineIndex);
- ++lineIndex;
- }
-
- // compute key
- StringBuffer sb = new StringBuffer();
- for (int tupleIndex = 0 ; tupleIndex < tuple.length; ++tupleIndex) {
- if (tupleIndex == Length.INDEX_YEAR || tupleIndex == Length.INDEX_HAUL ||
- tupleIndex == Length.INDEX_SPECIES) {
- sb.append(tuple[tupleIndex]).append(';');
- }
- }
-
- // store number sum
- String nombreValue = tuple[Length.INDEX_NUMBER];
- String lineNumber = tuple[AbstractDataEntity.INDEX_LINE];
- try {
- Double nombre = Double.valueOf(nombreValue);
- String key = sb.toString();
- if (nombreForKey.containsKey(key)) {
- Double oldValue = nombreForKey.get(key);
- Double newValue = oldValue + nombre;
- nombreForKey.put(key, newValue);
- }
- else {
- nombreForKey.put(key, nombre);
- // sauvegarde la premiere ligne qui correspond a un regroupement de clé
- firstLineForKey.put(key, lineNumber);
- }
- }
- catch (NumberFormatException ex) {
- // par trop grave, normalement les données deviennet
- // valide au fil de la validation
- if (log.isWarnEnabled()) {
- log.warn("Can't parse " + nombreValue + " as double");
- }
- }
- }
-
- // now look for invalid data
- for (Map.Entry<String, Double> sumObservation : nombreForKey.entrySet()) {
- String key = sumObservation.getKey();
- Double value = sumObservation.getValue();
- if (value < config.getControlNobsmin()) {
-
- String lineNumber = firstLineForKey.get(key);
-
- ValidationError error = new ValidationError();
- error.setCategory(Category.LENGTH);
- error.setLevel(ValidationLevel.WARNING);
- error.addLineNumber(lineNumber);
- error.setMessage(_("coser.business.control.error.minObservationCount"));
- error.setDetailMessage(_("coser.business.control.error.minObservationCountDetail", key, value));
- validationErrors.add(error);
- }
- }
-
- return validationErrors;
- }
-
- /**
- * @param control
- * @param progress
- * @return
- */
- protected List<ValidationError> validateCategorySpecificHaul(Control control,
- ProgressMonitor progress) {
- return null;
- }
-
- /**
- * @param control
- * @param progress
- * @return
- */
- protected List<ValidationError> validateCategorySpecificStrata(
- Control control, ProgressMonitor progress) {
- return null;
- }
-
- /**
- * Validation par croisement de fichiers.
- *
- * Les erreurs relevé ici porte sur plusieurs fichiers.
- *
- * @param control control
- * @param progress progress
- * @return error list
- */
- protected List<ValidationError> validationCrossFiles(Project project, Control control,
- ProgressMonitor progress) {
-
- if (progress != null) {
- progress.setText(_("coser.business.control.step.crossFileChech", 0));
- progress.setTotal(100);
- progress.setCurrent(0);
- }
-
- List<ValidationError> crossFilesErrors = new ArrayList<ValidationError>();
-
- // get all iterators
- Iterator<String[]> itReftax = project.getRefTaxSpecies().iterator();
- itReftax.next(); // skip header
- Iterator<String[]> itCatch = control.getCatch().iterator();
- itCatch.next(); // skip header
- Iterator<String[]> itLength = control.getLength().iterator();
- itLength.next(); // skip header
- Iterator<String[]> itStrata = control.getStrata().iterator();
- itStrata.next(); // skip header
- Iterator<String[]> itHaul = control.getHaul().iterator();
- itHaul.next(); // skip header
-
- // declare all necessary data
- Set<String> refTaxSpecies = new HashSet<String>();
- Set<String> catchYear = new HashSet<String>();
- Set<String> lengthYear = new HashSet<String>();
- Set<String> haulYear = new HashSet<String>();
- Set<String> campagneNames = new HashSet<String>();
- Set<String> lengthYearHaulSpecies = new HashSet<String>();
- Set<String> catchYearHaulSpecies = new HashSet<String>();
- Set<String> haulYearHaul = new HashSet<String>();
- Set<String> lengthYearHaul = new HashSet<String>();
- Set<String> catchYearHaul = new HashSet<String>();
-
- // parcourt de toutes les données
- while (itReftax.hasNext() ) {
- String[] tuple = itReftax.next();
- // "C_Perm","NumSys","NivSys","C_VALIDE","L_VALIDE","AA_VALIDE","C_TxP\u00E8re","Taxa"
- refTaxSpecies.add(tuple[3]);
- }
-
- while (itCatch.hasNext()) {
- String[] catchData = itCatch.next();
- campagneNames.add(catchData[Catch.INDEX_SURVEY]);
- catchYear.add(catchData[Catch.INDEX_YEAR]);
- catchYearHaulSpecies.add(catchData[Catch.INDEX_YEAR] + "|" + catchData[Catch.INDEX_HAUL] + "|" + catchData[Catch.INDEX_SPECIES]);
- catchYearHaul.add(catchData[Catch.INDEX_YEAR] + "|" + catchData[Catch.INDEX_HAUL]);
-
- // Contrôle des noms d'espèces dans fichiers CAPTURES et TAILLES qui
- // doivent être dans le référentiel "reftax": CAPTURES$Espece et
- // TAILLES$Espece doivent exister dans REFTAX$ C_VALIDE
- if (!refTaxSpecies.contains(catchData[Catch.INDEX_SPECIES])) {
- ValidationError error = new ValidationError();
- error.setCategory(Category.CATCH);
- error.addLineNumber(catchData[Catch.INDEX_LINE]);
- error.setLevel(ValidationLevel.ERROR);
- error.setMessage(_("coser.business.control.error.nonExistantSpecies"));
- error.setDetailMessage(_("coser.business.control.error.nonExistantSpeciesDetail", catchData[Catch.INDEX_SPECIES]));
- crossFilesErrors.add(error);
- }
- }
-
- if (progress != null) {
- progress.setText(_("coser.business.control.step.crossFileChech", 25));
- progress.setCurrent(25);
- }
-
- while (itLength.hasNext()) {
- String[] lengthData = itLength.next();
- campagneNames.add(lengthData[Length.INDEX_SURVEY]);
- lengthYear.add(lengthData[Length.INDEX_YEAR]);
- lengthYearHaulSpecies.add(lengthData[Length.INDEX_YEAR] + "|" +
- lengthData[Length.INDEX_HAUL] + "|" + lengthData[Length.INDEX_SPECIES]);
- lengthYearHaul.add(lengthData[Length.INDEX_YEAR] + "|" + lengthData[Length.INDEX_HAUL]);
-
- // Contrôle des noms d'espèces dans fichiers CAPTURES et TAILLES qui
- // doivent être dans le référentiel "reftax": CAPTURES$Espece et
- // TAILLES$Espece doivent exister dans REFTAX$ C_VALIDE
- if (!refTaxSpecies.contains(lengthData[Length.INDEX_SPECIES])) {
- ValidationError error = new ValidationError();
- error.setCategory(Category.LENGTH);
- error.addLineNumber(lengthData[Length.INDEX_LINE]);
- error.setLevel(ValidationLevel.ERROR);
- error.setMessage(_("coser.business.control.error.nonExistantSpecies"));
- error.setDetailMessage(_("coser.business.control.error.nonExistantSpeciesDetail", lengthData[Length.INDEX_SPECIES]));
- crossFilesErrors.add(error);
- }
- }
-
- if (progress != null) {
- progress.setText(_("coser.business.control.step.crossFileChech", 50));
- progress.setCurrent(50);
- }
-
- while (itStrata.hasNext()) {
- String[] strataData = itStrata.next();
- campagneNames.add(strataData[Strata.INDEX_SURVEY]);
- }
-
- if (progress != null) {
- progress.setText(_("coser.business.control.step.crossFileChech", 75));
- progress.setCurrent(75);
- }
-
- while (itHaul.hasNext()) {
- String[] haulData = itHaul.next();
- campagneNames.add(haulData[Haul.INDEX_SURVEY]);
- haulYear.add(haulData[Haul.INDEX_YEAR]);
- haulYearHaul.add(haulData[Haul.INDEX_YEAR] + "|" + haulData[Haul.INDEX_HAUL]);
- }
-
- // Vérifier que les mêmes années sont présentes dans fichiers captures
- // traits et tailles: CAPTURES$Annee, TRAITS$Annee, TAILLES$Annee.
- if (!catchYear.equals(lengthYear) || !haulYear.equals(lengthYear)) {
- ValidationError error = new ValidationError();
- error.setLevel(ValidationLevel.FATAL);
- error.setMessage(_("coser.business.control.error.yearsNotEquals"));
- //error.setDetailMessage(_("coser.business.control.error.yearsNotEquals"));
- crossFilesErrors.add(error);
- }
-
- // Vérifier que le nom de la campagne est le même dans tous les fichiers *$Campagne.
- if (campagneNames.size() != 1) {
- ValidationError error = new ValidationError();
- error.setLevel(ValidationLevel.FATAL);
- error.setMessage(_("coser.business.control.error.surveyNotEquals"));
- //error.setDetailMessage(_("coser.business.control.error.surveyNotEquals"));
- crossFilesErrors.add(error);
- }
-
- // Vérifier que pour chaque espèce présent dans un trait d'une année
- // dans le fichier tailles (noté Annee|Trait|Espece) il y a une donnée
- // dans le fichier captures (le contraire n'est pas vraie)
- Collection<String> missingSpeciesCatchTuples = CollectionUtils.subtract(lengthYearHaulSpecies, catchYearHaulSpecies);
- for (String missingSpeciesCatchTuple : missingSpeciesCatchTuples) {
- ValidationError error = new ValidationError();
- error.setLevel(ValidationLevel.FATAL);
- error.setMessage(_("coser.business.control.error.missingYearHaulSpeciesForCatchData"));
- error.setDetailMessage(_("coser.business.control.error.missingYearHaulSpeciesForCatchDataDetail", missingSpeciesCatchTuple));
- error.setTipMessage(_("coser.business.control.error.missingYearHaulSpeciesForCatchDataTip"));
- crossFilesErrors.add(error);
- }
-
- // Vérifier que pour chaque trait présent une année (noté Annee|Trait)
- // dans les fichiers tailles et capt il y a une donnée dans le fichier
- // traits
- Collection<String> missingHaulLengthTuples = CollectionUtils.subtract(lengthYearHaul, haulYearHaul);
- for (String missingHaulLengthTuple : missingHaulLengthTuples) {
- ValidationError error = new ValidationError();
- error.setLevel(ValidationLevel.FATAL);
- error.setMessage(_("coser.business.control.error.missingYearHaulForLengthData"));
- error.setDetailMessage(_("coser.business.control.error.missingYearHaulForLengthDataDetail", missingHaulLengthTuple));
- error.setTipMessage(_("coser.business.control.error.missingYearHaulForLengthDataTip"));
- crossFilesErrors.add(error);
- }
-
- // Vérifier que pour chaque trait présent une année (noté Annee|Trait)
- // dans les fichiers tailles et capt il y a une donnée dans le fichier
- // traits
- Collection<String> missingHaulCatchTuples = CollectionUtils.subtract(catchYearHaul, haulYearHaul);
- for (String missingHaulCatchTuple : missingHaulCatchTuples) {
- ValidationError error = new ValidationError();
- error.setLevel(ValidationLevel.FATAL);
- error.setMessage(_("coser.business.control.error.missingYearHaulForCatchData"));
- error.setDetailMessage(_("coser.business.control.error.missingYearHaulForCatchDataDetail", missingHaulCatchTuple));
- error.setTipMessage(_("coser.business.control.error.missingYearHaulForCatchDataTip"));
- crossFilesErrors.add(error);
- }
-
- if (progress != null) {
- progress.setText(_("coser.business.control.step.crossFileChech", 100));
- progress.setCurrent(100);
- }
-
- return crossFilesErrors;
- }
-}
Modified: trunk/coser-business/src/test/java/fr/ifremer/coser/services/PublicationServiceTest.java
===================================================================
--- trunk/coser-business/src/test/java/fr/ifremer/coser/services/PublicationServiceTest.java 2010-11-26 13:47:45 UTC (rev 291)
+++ trunk/coser-business/src/test/java/fr/ifremer/coser/services/PublicationServiceTest.java 2010-11-26 14:03:54 UTC (rev 292)
@@ -47,8 +47,8 @@
import fr.ifremer.coser.CoserConstants.Category;
import fr.ifremer.coser.CoserConstants.ValidationLevel;
import fr.ifremer.coser.bean.Project;
-import fr.ifremer.coser.control.DiffCatchLengthValidationError;
-import fr.ifremer.coser.control.ValidationError;
+import fr.ifremer.coser.control.DiffCatchLengthControlError;
+import fr.ifremer.coser.control.ControlError;
/**
* Publication service tests
@@ -92,24 +92,24 @@
public void testExportHtml() throws CoserBusinessException, IOException {
Project project = createTestProject(projectService, false);
- List<ValidationError> validationErrors = new ArrayList<ValidationError>();
+ List<ControlError> validationErrors = new ArrayList<ControlError>();
// error 1 :
- ValidationError error1 = new ValidationError();
+ ControlError error1 = new ControlError();
error1.setLevel(ValidationLevel.FATAL);
error1.setMessage("Test fatal");
error1.addLineNumber("15");
error1.setCategory(Category.CATCH);
validationErrors.add(error1);
- DiffCatchLengthValidationError error2 = new DiffCatchLengthValidationError();
+ DiffCatchLengthControlError error2 = new DiffCatchLengthControlError();
error2.setLevel(ValidationLevel.WARNING);
error2.setMessage("Test warning and graph");
error2.setSpecies("COSER_SPECIES1");
error2.setTipMessage("Explication sur l'erreur");
validationErrors.add(error2);
- ValidationError error3 = new ValidationError();
+ ControlError error3 = new ControlError();
error3.setLevel(ValidationLevel.ERROR);
error3.setMessage("Test error");
error3.addLineNumber("12");
Modified: trunk/coser-business/src/test/java/fr/ifremer/coser/services/ValidationServiceTest.java
===================================================================
--- trunk/coser-business/src/test/java/fr/ifremer/coser/services/ValidationServiceTest.java 2010-11-26 13:47:45 UTC (rev 291)
+++ trunk/coser-business/src/test/java/fr/ifremer/coser/services/ValidationServiceTest.java 2010-11-26 14:03:54 UTC (rev 292)
@@ -34,7 +34,7 @@
import fr.ifremer.coser.CoserConstants.Category;
import fr.ifremer.coser.bean.Control;
-import fr.ifremer.coser.control.ValidationError;
+import fr.ifremer.coser.control.ControlError;
import fr.ifremer.coser.data.Catch;
import fr.ifremer.coser.data.Haul;
import fr.ifremer.coser.data.Length;
@@ -54,7 +54,7 @@
private static final Log log = LogFactory.getLog(ValidationServiceTest.class);
- protected ValidationService validationService = new ValidationService(config);
+ protected ControlService validationService = new ControlService(config);
/**
* Test les validations sur les champs vide.
@@ -65,7 +65,7 @@
Catch myCatch = new Catch();
myCatch.setData(new String[]{"1", "","","","","",""});
- List<ValidationError> errors = validationService.validate(myCatch, Category.CATCH);
+ List<ControlError> errors = validationService.validate(myCatch, Category.CATCH);
Assert.assertNotNull(errors);
Assert.assertEquals(4, errors.size());
@@ -82,7 +82,7 @@
public void testDoubleValidation() {
Catch myCatch = new Catch();
myCatch.setData(new String[]{"1", "Test survey","1999","Test trait","Test sp","NA","12"});
- List<ValidationError> errors = validationService.validate(myCatch, Category.CATCH);
+ List<ControlError> errors = validationService.validate(myCatch, Category.CATCH);
log.warn(errors);
Assert.assertTrue(errors.isEmpty());
}
@@ -95,7 +95,7 @@
Length myLength = new Length();
// "Survey","Year","Haul","Species","Sex","Maturity","Length","Number","Weight","Age"
myLength.setData(new String[]{"1", "Test survey","1999","Test trait","Test sp","i","m","23.25", "3.00", "44.99", "12"});
- List<ValidationError> errors = validationService.validate(myLength, Category.LENGTH);
+ List<ControlError> errors = validationService.validate(myLength, Category.LENGTH);
log.warn(errors);
Assert.assertEquals(1, errors.size());
}
@@ -107,7 +107,7 @@
public void test5DecimalValidation() {
Haul haulBean = new Haul();
haulBean.setData(new String[]{"1", "COSER_TEST","2010","TRAIT3","10","STR3","0.06","43.89","1.73","115.00"});
- List<ValidationError> errors = validationService.validate(haulBean, Category.HAUL);
+ List<ControlError> errors = validationService.validate(haulBean, Category.HAUL);
Assert.assertEquals(3, errors.size());
haulBean.setData(new String[]{"1","COSER_TEST","2010","TRAIT3","10","STR3","0.06000","43.89000","1.73234","115.00"});
@@ -125,7 +125,7 @@
dataCatch.add(new String[]{"Line", "Campagne","Annee","Trait","Espece","Nombre","Poids"});
dataCatch.add(new String[]{"1", "Test survey","1999","Test trait","Test sp","0","12"});
control.setCatch(dataCatch);
- List<ValidationError> errors = validationService.validateCategory(control, Category.CATCH, null);
+ List<ControlError> errors = validationService.validateCategory(control, Category.CATCH, null);
if (log.isDebugEnabled()) {
log.debug("Validation errors = " + errors);
}
Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/Coser.java
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/Coser.java 2010-11-26 13:47:45 UTC (rev 291)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/Coser.java 2010-11-26 14:03:54 UTC (rev 292)
@@ -41,7 +41,7 @@
import fr.ifremer.coser.services.PublicationService;
import fr.ifremer.coser.services.ImportService;
import fr.ifremer.coser.services.ProjectService;
-import fr.ifremer.coser.services.ValidationService;
+import fr.ifremer.coser.services.ControlService;
import fr.ifremer.coser.ui.CoserFrame;
import fr.ifremer.coser.ui.util.ErrorHelper;
@@ -138,7 +138,7 @@
context.setContextValue(session);
context.setContextValue(new ProjectService(coserConfig));
context.setContextValue(new ImportService(coserConfig));
- context.setContextValue(new ValidationService(coserConfig));
+ context.setContextValue(new ControlService(coserConfig));
context.setContextValue(new PublicationService(coserConfig));
// init frame with session reloading
Copied: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlErrorTreeRenderer.java (from rev 284, trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlValidationRenderer.java)
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlErrorTreeRenderer.java (rev 0)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlErrorTreeRenderer.java 2010-11-26 14:03:54 UTC (rev 292)
@@ -0,0 +1,139 @@
+/*
+ * #%L
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2010 Codelutin, Chatellier Eric
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+package fr.ifremer.coser.ui.control;
+
+import static org.nuiton.i18n.I18n._;
+
+import java.awt.Component;
+
+import javax.swing.ImageIcon;
+import javax.swing.JLabel;
+import javax.swing.JTree;
+import javax.swing.tree.DefaultTreeCellRenderer;
+
+import jaxx.runtime.validator.swing.SwingValidatorUtil;
+import fr.ifremer.coser.CoserConstants.Category;
+import fr.ifremer.coser.CoserConstants.ValidationLevel;
+import fr.ifremer.coser.control.ControlErrorGroup;
+import fr.ifremer.coser.control.ControlError;
+
+/**
+ * Renderer pour le table des erreurs globales.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class ControlErrorTreeRenderer extends DefaultTreeCellRenderer {
+
+ /** serialVersionUID. */
+ private static final long serialVersionUID = -6423364126451874968L;
+
+ protected ImageIcon fatalIcon = null;
+ protected ImageIcon errorIcon = null;
+ protected ImageIcon warningIcon = null;
+ protected ImageIcon infoIcon = null;
+
+ public ControlErrorTreeRenderer() {
+ // use icon in jaxx
+ fatalIcon = SwingValidatorUtil.getFatalIcon();
+ errorIcon = SwingValidatorUtil.getErrorIcon();
+ warningIcon = SwingValidatorUtil.getWarningIcon();
+ infoIcon = SwingValidatorUtil.getInfoIcon();
+ }
+
+ @Override
+ public Component getTreeCellRendererComponent(JTree tree, Object value,
+ boolean sel, boolean expanded, boolean leaf, int row,
+ boolean hasFocus) {
+
+ GlobalControlErrorModel model = (GlobalControlErrorModel)tree.getModel();
+ JLabel component = (JLabel)super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
+
+ ImageIcon icon = null;
+ String text = null;
+ String tooltipText = null;
+
+ if (value instanceof String) {
+ text = _((String)value) + " (" + model.getChildCount(value) + ")";
+ }
+ else if (value instanceof Category) {
+ text = _(((Category)value).getTranslationKey()) + " (" + model.getChildCount(value) + ")";
+ }
+ else if (value instanceof ControlErrorGroup) {
+ ControlErrorGroup validationErrorGroup = (ControlErrorGroup)value;
+ ValidationLevel level = validationErrorGroup.getValidationLevel();
+ switch (level) {
+ case FATAL:
+ icon = fatalIcon;
+ break;
+ case ERROR:
+ icon = errorIcon;
+ break;
+ case WARNING:
+ icon = warningIcon;
+ break;
+ case INFO:
+ icon = infoIcon;
+ break;
+ }
+
+ String message = validationErrorGroup.getMessage();
+ text = _(message) + " (" + model.getChildCount(value) + ")";
+ }
+ else if (value instanceof ControlError) {
+ ControlError validationError = (ControlError)value;
+ ValidationLevel level = validationError.getLevel();
+ switch (level) {
+ case FATAL:
+ icon = fatalIcon;
+ break;
+ case ERROR:
+ icon = errorIcon;
+ break;
+ case WARNING:
+ icon = warningIcon;
+ break;
+ case INFO:
+ icon = infoIcon;
+ break;
+ }
+
+ String message = validationError.getDetailMessage();
+ if (message == null) {
+ message = validationError.getMessage();
+ }
+ text = _(message);
+ tooltipText = validationError.getTipMessage();
+ }
+
+ component.setText(text);
+ component.setIcon(icon);
+ component.setToolTipText(tooltipText);
+
+ return component;
+ }
+}
Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlHandler.java
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlHandler.java 2010-11-26 13:47:45 UTC (rev 291)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlHandler.java 2010-11-26 14:03:54 UTC (rev 292)
@@ -76,8 +76,8 @@
import fr.ifremer.coser.CoserConstants.ValidationLevel;
import fr.ifremer.coser.CoserException;
import fr.ifremer.coser.bean.Project;
-import fr.ifremer.coser.control.GlobalValidationGroup;
-import fr.ifremer.coser.control.ValidationError;
+import fr.ifremer.coser.control.ControlErrorGroup;
+import fr.ifremer.coser.control.ControlError;
import fr.ifremer.coser.data.AbstractDataEntity;
import fr.ifremer.coser.data.Catch;
import fr.ifremer.coser.data.Haul;
@@ -85,7 +85,7 @@
import fr.ifremer.coser.data.Strata;
import fr.ifremer.coser.services.ProjectService;
import fr.ifremer.coser.services.PublicationService;
-import fr.ifremer.coser.services.ValidationService;
+import fr.ifremer.coser.services.ControlService;
/**
* Control handler for control view.
@@ -317,19 +317,19 @@
* @param view
*/
public void checkData(final ControlView view) {
- final ValidationService validationService = view.getContextValue(ValidationService.class);
+ final ControlService validationService = view.getContextValue(ControlService.class);
final Project project = view.getContextValue(Project.class);
//final Category category = (Category)view.getCategoryComboBox().getSelectedItem();
final ControlProgressBar progressBar = view.getCheckProgressBar();
- SwingWorker<List<ValidationError>, Void> task = new SwingWorker<List<ValidationError>, Void>() {
+ SwingWorker<List<ControlError>, Void> task = new SwingWorker<List<ControlError>, Void>() {
long before = System.currentTimeMillis();
@Override
- public List<ValidationError> doInBackground() {
+ public List<ControlError> doInBackground() {
- List<ValidationError> validationErrors = validationService.validateData(project, project.getControl(), progressBar);
+ List<ControlError> validationErrors = validationService.validateData(project, project.getControl(), progressBar);
return validationErrors;
}
@@ -341,20 +341,20 @@
}
try {
- List<ValidationError> errors = get();
- view.getGlobalValidationModel().setValidationErrors(errors);
+ List<ControlError> errors = get();
+ view.getGlobalControlErrorModel().setControlErrors(errors);
// hack parce que impossible de faire un fire
// sans que les colonnes soit redimentionnées
- SwingUtil.fixTableColumnWidth(view.getValidationGlobalErrorsTable(), 1, 25);
+ SwingUtil.fixTableColumnWidth(view.getGlobalControlErrorTable(), 1, 25);
// active le bouton de sauvegarde si la liste d'erreur
// ne contient pas de message d'erreur
// warning, c'est ok
boolean errorFound = false;
- Iterator<ValidationError> itError = errors.iterator();
+ Iterator<ControlError> itError = errors.iterator();
while (itError.hasNext() && !errorFound) {
- ValidationError error = itError.next();
+ ControlError error = itError.next();
if (error.getLevel() == ValidationLevel.ERROR || error.getLevel() == ValidationLevel.FATAL) {
errorFound = true;
}
@@ -434,7 +434,7 @@
* @param event selection event
*/
public void showSelectedError(ControlView view, TreeSelectionEvent event) {
- TreePath selectedError = view.getValidationGlobalErrorsTable().getTreeSelectionModel().getSelectionPath();
+ TreePath selectedError = view.getGlobalControlErrorTable().getTreeSelectionModel().getSelectionPath();
if (selectedError != null) {
Object[] pathWay = selectedError.getPath();
@@ -446,7 +446,7 @@
// swap category
view.getCategoryComboBoxModel().setSelectedItem(category);
- ValidationError error = (ValidationError)pathWay[3];
+ ControlError error = (ControlError)pathWay[3];
Set<String> errorLineNumbers = error.getLineNumbers();
// peut être vide, si l'erreur ne porte pas sur un bean en particulier
if (errorLineNumbers != null) {
@@ -481,7 +481,7 @@
// clic contextuel
if (event.getButton() == MouseEvent.BUTTON3) {
- TreePath selectedError = controlView.getValidationGlobalErrorsTable().getTreeSelectionModel().getSelectionPath();
+ TreePath selectedError = controlView.getGlobalControlErrorTable().getTreeSelectionModel().getSelectionPath();
JPopupMenu popupMenu = new JPopupMenu(_("coser.ui.control.globalErrorMenuLabel"));
@@ -493,7 +493,7 @@
if (pathWay.length == 3) {
if (pathWay[1] instanceof Category) {
final Category category = (Category)pathWay[1];
- final GlobalValidationGroup validationGroup = (GlobalValidationGroup)pathWay[2];
+ final ControlErrorGroup validationGroup = (ControlErrorGroup)pathWay[2];
JMenuItem replaceMenu = new JMenuItem(_("coser.ui.control.globalErrorMenuSelectAll"));
replaceMenu.addActionListener(new ActionListener() {
@@ -517,7 +517,7 @@
});
popupMenu.add(generateHtmlMenu);
- popupMenu.show(controlView.getValidationGlobalErrorsTable(), event.getX(), event.getY());
+ popupMenu.show(controlView.getGlobalControlErrorTable(), event.getX(), event.getY());
}
}
@@ -527,17 +527,17 @@
* @param controlView controlView
* @param validationGroup validationGroup
*/
- protected void selectAllErrorGroupLines(ControlView controlView, Category category, GlobalValidationGroup validationGroup) {
+ protected void selectAllErrorGroupLines(ControlView controlView, Category category, ControlErrorGroup validationGroup) {
// swap category
controlView.getCategoryComboBoxModel().setSelectedItem(category);
// select all lines
- GlobalValidationModel model = controlView.getGlobalValidationModel();
+ GlobalControlErrorModel model = controlView.getGlobalControlErrorModel();
controlView.getControlDataTableSelectionModel().clearSelection();
boolean first = true;
int childCount = model.getChildCount(validationGroup);
for (int indexChild = 0 ; indexChild < childCount ; ++indexChild) {
- ValidationError validationError = (ValidationError)model.getChild(validationGroup, indexChild);
+ ControlError validationError = (ControlError)model.getChild(validationGroup, indexChild);
Set<String> errorLineNumbers = validationError.getLineNumbers();
for (String errorLineNumber : errorLineNumbers) {
@@ -591,10 +591,10 @@
Project project = controlView.getContextValue(Project.class);
// get error list from table model
- List<ValidationError> validationErrors = controlView.getGlobalValidationModel().getValidationErrors();
+ List<ControlError> controlErrors = controlView.getGlobalControlErrorModel().getControlErrors();
File htmlFile = null;
try {
- htmlFile = publicationService.exportErrorsAsHTML(project, project.getControl(), validationErrors);
+ htmlFile = publicationService.exportErrorsAsHTML(project, project.getControl(), controlErrors);
Desktop.getDesktop().browse(htmlFile.toURI());
} catch (CoserBusinessException ex) {
Deleted: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlValidationRenderer.java
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlValidationRenderer.java 2010-11-26 13:47:45 UTC (rev 291)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlValidationRenderer.java 2010-11-26 14:03:54 UTC (rev 292)
@@ -1,139 +0,0 @@
-/*
- * #%L
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2010 Codelutin, Chatellier Eric
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU 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 General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-package fr.ifremer.coser.ui.control;
-
-import static org.nuiton.i18n.I18n._;
-
-import java.awt.Component;
-
-import javax.swing.ImageIcon;
-import javax.swing.JLabel;
-import javax.swing.JTree;
-import javax.swing.tree.DefaultTreeCellRenderer;
-
-import jaxx.runtime.validator.swing.SwingValidatorUtil;
-import fr.ifremer.coser.CoserConstants.Category;
-import fr.ifremer.coser.CoserConstants.ValidationLevel;
-import fr.ifremer.coser.control.GlobalValidationGroup;
-import fr.ifremer.coser.control.ValidationError;
-
-/**
- * Renderer pour le table des erreurs globales.
- *
- * @author chatellier
- * @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
- */
-public class ControlValidationRenderer extends DefaultTreeCellRenderer {
-
- /** serialVersionUID. */
- private static final long serialVersionUID = -6423364126451874968L;
-
- protected ImageIcon fatalIcon = null;
- protected ImageIcon errorIcon = null;
- protected ImageIcon warningIcon = null;
- protected ImageIcon infoIcon = null;
-
- public ControlValidationRenderer() {
- // use icon in jaxx
- fatalIcon = SwingValidatorUtil.getFatalIcon();
- errorIcon = SwingValidatorUtil.getErrorIcon();
- warningIcon = SwingValidatorUtil.getWarningIcon();
- infoIcon = SwingValidatorUtil.getInfoIcon();
- }
-
- @Override
- public Component getTreeCellRendererComponent(JTree tree, Object value,
- boolean sel, boolean expanded, boolean leaf, int row,
- boolean hasFocus) {
-
- GlobalValidationModel model = (GlobalValidationModel)tree.getModel();
- JLabel component = (JLabel)super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
-
- ImageIcon icon = null;
- String text = null;
- String tooltipText = null;
-
- if (value instanceof String) {
- text = _((String)value) + " (" + model.getChildCount(value) + ")";
- }
- else if (value instanceof Category) {
- text = _(((Category)value).getTranslationKey()) + " (" + model.getChildCount(value) + ")";
- }
- else if (value instanceof GlobalValidationGroup) {
- GlobalValidationGroup validationErrorGroup = (GlobalValidationGroup)value;
- ValidationLevel level = validationErrorGroup.getValidationLevel();
- switch (level) {
- case FATAL:
- icon = fatalIcon;
- break;
- case ERROR:
- icon = errorIcon;
- break;
- case WARNING:
- icon = warningIcon;
- break;
- case INFO:
- icon = infoIcon;
- break;
- }
-
- String message = validationErrorGroup.getMessage();
- text = _(message) + " (" + model.getChildCount(value) + ")";
- }
- else if (value instanceof ValidationError) {
- ValidationError validationError = (ValidationError)value;
- ValidationLevel level = validationError.getLevel();
- switch (level) {
- case FATAL:
- icon = fatalIcon;
- break;
- case ERROR:
- icon = errorIcon;
- break;
- case WARNING:
- icon = warningIcon;
- break;
- case INFO:
- icon = infoIcon;
- break;
- }
-
- String message = validationError.getDetailMessage();
- if (message == null) {
- message = validationError.getMessage();
- }
- text = _(message);
- tooltipText = validationError.getTipMessage();
- }
-
- component.setText(text);
- component.setIcon(icon);
- component.setToolTipText(tooltipText);
-
- return component;
- }
-}
Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlView.jaxx
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlView.jaxx 2010-11-26 13:47:45 UTC (rev 291)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlView.jaxx 2010-11-26 14:03:54 UTC (rev 292)
@@ -30,7 +30,7 @@
new jaxx.runtime.validator.swing.SwingValidatorMessageTableRenderer());
// global validation
- SwingUtil.fixTableColumnWidth(validationGlobalErrorsTable, 1, 25);
+ SwingUtil.fixTableColumnWidth(globalControlErrorTable, 1, 25);
}
]]></script>
@@ -130,14 +130,14 @@
<JSplitPane name="splitpaneGlobalErrorComment">
<JScrollPane>
- <GlobalValidationModel id="globalValidationModel" />
- <JXTreeTable id='validationGlobalErrorsTable' treeTableModel="{globalValidationModel}"
+ <GlobalControlErrorModel id="globalControlErrorModel" />
+ <JXTreeTable id='globalControlErrorTable' treeTableModel="{globalControlErrorModel}"
rootVisible="false" showsRootHandles="true"
- treeCellRenderer="{new ControlValidationRenderer()}"
+ treeCellRenderer="{new ControlErrorTreeRenderer()}"
onMouseClicked="getHandler().showGlobalErrorTableContextMenu(this, event)"
selectionMode="{ListSelectionModel.SINGLE_SELECTION}" />
- <javax.swing.tree.TreeSelectionModel id="globalValidationTableSelectionModel"
- javaBean="validationGlobalErrorsTable.getTreeSelectionModel()"
+ <javax.swing.tree.TreeSelectionModel id="globalControlErrorSelectionModel"
+ javaBean="globalControlErrorTable.getTreeSelectionModel()"
onValueChanged="getHandler().showSelectedError(this, event)" />
</JScrollPane>
Copied: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/GlobalControlErrorModel.java (from rev 284, trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/GlobalValidationModel.java)
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/GlobalControlErrorModel.java (rev 0)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/GlobalControlErrorModel.java 2010-11-26 14:03:54 UTC (rev 292)
@@ -0,0 +1,291 @@
+/*
+ * #%L
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2010 Ifremer, Codelutin, Chatellier Eric
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+package fr.ifremer.coser.ui.control;
+
+import static org.nuiton.i18n.I18n._;
+import static org.nuiton.i18n.I18n.n_;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.jdesktop.swingx.treetable.AbstractTreeTableModel;
+
+import fr.ifremer.coser.CoserConstants.Category;
+import fr.ifremer.coser.CoserConstants.ValidationLevel;
+import fr.ifremer.coser.control.ControlErrorGroup;
+import fr.ifremer.coser.control.ControlError;
+
+/**
+ * Global validation table model.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class GlobalControlErrorModel extends AbstractTreeTableModel {
+
+ /** serialVersionUID. */
+ private static final long serialVersionUID = -32286733264427664L;
+
+ protected List<ControlError> controlErrors;
+ protected List<Object> controlErrorCategory;
+ protected Map<Object, List<ControlErrorGroup>> controlCategoryChild;
+ protected Map<ControlErrorGroup, List<ControlError>> controlErrorsChilds;
+ protected Set<Object> checkedControlErrors;
+
+ public GlobalControlErrorModel() {
+ super(1);
+ }
+
+ public void setControlErrors(List<ControlError> controlErrors) {
+ this.controlErrors = controlErrors;
+ getValidationErrorAsMaps(controlErrors);
+ modelSupport.fireNewRoot();
+ }
+
+ public List<ControlError> getControlErrors() {
+ return controlErrors;
+ }
+
+ /**
+ * Convert error list to tree structure.
+ *
+ * @param validationErrors list to convert
+ */
+ protected void getValidationErrorAsMaps(List<ControlError> validationErrors) {
+
+ controlCategoryChild = new HashMap<Object, List<ControlErrorGroup>>();
+ controlErrorsChilds = new HashMap<ControlErrorGroup, List<ControlError>>();
+
+ for (ControlError validationError : validationErrors) {
+
+ Object category = validationError.getCategory() == null ?
+ n_("coser.ui.control.error.allCategories") : validationError.getCategory();
+ List<ControlErrorGroup> errorGroup = controlCategoryChild.get(category);
+ if (errorGroup == null) {
+ errorGroup = new ArrayList<ControlErrorGroup>();
+ controlCategoryChild.put(category, errorGroup);
+ }
+
+ ControlErrorGroup group = new ControlErrorGroup(validationError.getCategory(), validationError.getLevel(), validationError.getMessage());
+
+ List<ControlError> childErrors = controlErrorsChilds.get(group);
+ if (childErrors == null) {
+ childErrors = new ArrayList<ControlError>();
+ controlErrorsChilds.put(group, childErrors);
+ errorGroup.add(group);
+ }
+
+ childErrors.add(validationError);
+ }
+
+ controlErrorCategory = new ArrayList<Object>(controlCategoryChild.keySet());
+ Collections.sort(controlErrorCategory, new Comparator<Object>() {
+ @Override
+ public int compare(Object o1, Object o2) {
+ int result = -1;
+ if (o1 instanceof String) {
+ if (o2 instanceof String) {
+ result = ((String)o1).compareTo((String)o2);
+ }
+ }
+ else if (o1 instanceof Category) {
+ if (o2 instanceof Category) {
+ result = ((Category)o1).compareTo((Category)o2);
+ }
+ }
+ return result;
+ }
+
+ });
+ for (List<ControlErrorGroup> groups : controlCategoryChild.values()) {
+ Collections.sort(groups);
+ }
+ checkedControlErrors = new HashSet<Object>();
+ }
+
+ /*
+ * @see javax.swing.table.TableModel#getColumnCount()
+ */
+ @Override
+ public int getColumnCount() {
+ return 2;
+ }
+
+
+ @Override
+ public String getColumnName(int columnIndex) {
+
+ String result = null;
+
+ switch (columnIndex) {
+ case 0:
+ result = _("coser.ui.control.global.message");
+ break;
+ case 1:
+ result = _("coser.ui.control.global.done");
+ break;
+ }
+ return result;
+ }
+
+ @Override
+ public Class<?> getColumnClass(int columnIndex) {
+ Class<?> result = null;
+
+ switch (columnIndex) {
+ case 0:
+ result = ValidationLevel.class;
+ break;
+ case 1:
+ result = Boolean.class;
+ break;
+ }
+ return result;
+ }
+
+ /*
+ * @see org.jdesktop.swingx.treetable.TreeTableModel#getValueAt(java.lang.Object, int)
+ */
+ @Override
+ public Object getValueAt(Object node, int column) {
+
+ Object result = null;
+
+ switch (column) {
+ case 0:
+ result = node;
+ break;
+ default:
+ result = checkedControlErrors.contains(node);
+ break;
+ }
+
+ return result;
+ }
+
+ /*
+ * @see javax.swing.tree.TreeModel#getChild(java.lang.Object, int)
+ */
+ @Override
+ public Object getChild(Object parent, int index) {
+
+ Object result = null;
+
+ if (parent == getRoot()) {
+ result = controlErrorCategory.get(index);
+ }
+ else if (parent instanceof String || parent instanceof Category) {
+ result = controlCategoryChild.get(parent).get(index);
+ }
+ else if (parent instanceof ControlErrorGroup) {
+ List<ControlError> childError = controlErrorsChilds.get(parent);
+ result = childError.get(index);
+ }
+
+ return result;
+ }
+
+ /*
+ * @see javax.swing.tree.TreeModel#getChildCount(java.lang.Object)
+ */
+ @Override
+ public int getChildCount(Object parent) {
+ int result = 0;
+
+ if (parent == getRoot()) {
+ if (controlErrorCategory != null) {
+ result = controlErrorCategory.size();
+ }
+ }
+ else if (parent instanceof String || parent instanceof Category) {
+ result = controlCategoryChild.get(parent).size();
+ }
+ else if (parent instanceof ControlErrorGroup) {
+ List<ControlError> childError = controlErrorsChilds.get(parent);
+ result = childError.size();
+ }
+
+ return result;
+ }
+
+ /*
+ * @see javax.swing.tree.TreeModel#getIndexOfChild(java.lang.Object, java.lang.Object)
+ */
+ @Override
+ public int getIndexOfChild(Object parent, Object child) {
+ int result = -1;
+
+ if (parent == getRoot()) {
+ result = controlErrorCategory.indexOf(child);
+ }
+ else if (parent instanceof String || parent instanceof Category) {
+ result = controlCategoryChild.get(parent).indexOf(child);
+ }
+ else if (parent instanceof ControlErrorGroup) {
+ List<ControlError> childError = controlErrorsChilds.get(parent);
+ result = childError.indexOf(child);
+ }
+
+ return result;
+ }
+
+ @Override
+ public boolean isCellEditable(Object node, int column) {
+ boolean result = false;
+ if (column == 1) {
+ result = true;
+ }
+ return result;
+ }
+
+ @Override
+ public void setValueAt(Object value, Object node, int column) {
+
+ Boolean booleanValue = (Boolean)value;
+ if (booleanValue.booleanValue()) {
+ checkedControlErrors.add(node);
+ }
+ else {
+ checkedControlErrors.remove(node);
+ }
+
+ // recursive check of sub errors
+ if (node instanceof String || node instanceof Category || node instanceof ControlErrorGroup) {
+ int childCount = getChildCount(node);
+ for (int i = 0 ; i < childCount; ++i) {
+ Object child = getChild(node, i);
+ setValueAt(value, child, column);
+ }
+ }
+ }
+}
Deleted: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/GlobalValidationModel.java
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/GlobalValidationModel.java 2010-11-26 13:47:45 UTC (rev 291)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/GlobalValidationModel.java 2010-11-26 14:03:54 UTC (rev 292)
@@ -1,291 +0,0 @@
-/*
- * #%L
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2010 Ifremer, Codelutin, Chatellier Eric
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU 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 General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-package fr.ifremer.coser.ui.control;
-
-import static org.nuiton.i18n.I18n._;
-import static org.nuiton.i18n.I18n.n_;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.jdesktop.swingx.treetable.AbstractTreeTableModel;
-
-import fr.ifremer.coser.CoserConstants.Category;
-import fr.ifremer.coser.CoserConstants.ValidationLevel;
-import fr.ifremer.coser.control.GlobalValidationGroup;
-import fr.ifremer.coser.control.ValidationError;
-
-/**
- * Global validation table model.
- *
- * @author chatellier
- * @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
- */
-public class GlobalValidationModel extends AbstractTreeTableModel {
-
- /** serialVersionUID. */
- private static final long serialVersionUID = -32286733264427664L;
-
- protected List<ValidationError> validationErrors;
- protected List<Object> validationErrorCategory;
- protected Map<Object, List<GlobalValidationGroup>> validationCategoryChild;
- protected Map<GlobalValidationGroup, List<ValidationError>> validationErrorsChilds;
- protected Set<Object> checkedValidationErrors;
-
- public GlobalValidationModel() {
- super(1);
- }
-
- public void setValidationErrors(List<ValidationError> validationErrors) {
- this.validationErrors = validationErrors;
- getValidationErrorAsMaps(validationErrors);
- modelSupport.fireNewRoot();
- }
-
- public List<ValidationError> getValidationErrors() {
- return validationErrors;
- }
-
- /**
- * Convert error list to tree structure.
- *
- * @param validationErrors list to convert
- */
- protected void getValidationErrorAsMaps(List<ValidationError> validationErrors) {
-
- validationCategoryChild = new HashMap<Object, List<GlobalValidationGroup>>();
- validationErrorsChilds = new HashMap<GlobalValidationGroup, List<ValidationError>>();
-
- for (ValidationError validationError : validationErrors) {
-
- Object category = validationError.getCategory() == null ?
- n_("coser.ui.control.error.allCategories") : validationError.getCategory();
- List<GlobalValidationGroup> errorGroup = validationCategoryChild.get(category);
- if (errorGroup == null) {
- errorGroup = new ArrayList<GlobalValidationGroup>();
- validationCategoryChild.put(category, errorGroup);
- }
-
- GlobalValidationGroup group = new GlobalValidationGroup(validationError.getCategory(), validationError.getLevel(), validationError.getMessage());
-
- List<ValidationError> childErrors = validationErrorsChilds.get(group);
- if (childErrors == null) {
- childErrors = new ArrayList<ValidationError>();
- validationErrorsChilds.put(group, childErrors);
- errorGroup.add(group);
- }
-
- childErrors.add(validationError);
- }
-
- validationErrorCategory = new ArrayList<Object>(validationCategoryChild.keySet());
- Collections.sort(validationErrorCategory, new Comparator<Object>() {
- @Override
- public int compare(Object o1, Object o2) {
- int result = -1;
- if (o1 instanceof String) {
- if (o2 instanceof String) {
- result = ((String)o1).compareTo((String)o2);
- }
- }
- else if (o1 instanceof Category) {
- if (o2 instanceof Category) {
- result = ((Category)o1).compareTo((Category)o2);
- }
- }
- return result;
- }
-
- });
- for (List<GlobalValidationGroup> groups : validationCategoryChild.values()) {
- Collections.sort(groups);
- }
- checkedValidationErrors = new HashSet<Object>();
- }
-
- /*
- * @see javax.swing.table.TableModel#getColumnCount()
- */
- @Override
- public int getColumnCount() {
- return 2;
- }
-
-
- @Override
- public String getColumnName(int columnIndex) {
-
- String result = null;
-
- switch (columnIndex) {
- case 0:
- result = _("coser.ui.control.global.message");
- break;
- case 1:
- result = _("coser.ui.control.global.done");
- break;
- }
- return result;
- }
-
- @Override
- public Class<?> getColumnClass(int columnIndex) {
- Class<?> result = null;
-
- switch (columnIndex) {
- case 0:
- result = ValidationLevel.class;
- break;
- case 1:
- result = Boolean.class;
- break;
- }
- return result;
- }
-
- /*
- * @see org.jdesktop.swingx.treetable.TreeTableModel#getValueAt(java.lang.Object, int)
- */
- @Override
- public Object getValueAt(Object node, int column) {
-
- Object result = null;
-
- switch (column) {
- case 0:
- result = node;
- break;
- default:
- result = checkedValidationErrors.contains(node);
- break;
- }
-
- return result;
- }
-
- /*
- * @see javax.swing.tree.TreeModel#getChild(java.lang.Object, int)
- */
- @Override
- public Object getChild(Object parent, int index) {
-
- Object result = null;
-
- if (parent == getRoot()) {
- result = validationErrorCategory.get(index);
- }
- else if (parent instanceof String || parent instanceof Category) {
- result = validationCategoryChild.get(parent).get(index);
- }
- else if (parent instanceof GlobalValidationGroup) {
- List<ValidationError> childError = validationErrorsChilds.get(parent);
- result = childError.get(index);
- }
-
- return result;
- }
-
- /*
- * @see javax.swing.tree.TreeModel#getChildCount(java.lang.Object)
- */
- @Override
- public int getChildCount(Object parent) {
- int result = 0;
-
- if (parent == getRoot()) {
- if (validationErrorCategory != null) {
- result = validationErrorCategory.size();
- }
- }
- else if (parent instanceof String || parent instanceof Category) {
- result = validationCategoryChild.get(parent).size();
- }
- else if (parent instanceof GlobalValidationGroup) {
- List<ValidationError> childError = validationErrorsChilds.get(parent);
- result = childError.size();
- }
-
- return result;
- }
-
- /*
- * @see javax.swing.tree.TreeModel#getIndexOfChild(java.lang.Object, java.lang.Object)
- */
- @Override
- public int getIndexOfChild(Object parent, Object child) {
- int result = -1;
-
- if (parent == getRoot()) {
- result = validationErrorCategory.indexOf(child);
- }
- else if (parent instanceof String || parent instanceof Category) {
- result = validationCategoryChild.get(parent).indexOf(child);
- }
- else if (parent instanceof GlobalValidationGroup) {
- List<ValidationError> childError = validationErrorsChilds.get(parent);
- result = childError.indexOf(child);
- }
-
- return result;
- }
-
- @Override
- public boolean isCellEditable(Object node, int column) {
- boolean result = false;
- if (column == 1) {
- result = true;
- }
- return result;
- }
-
- @Override
- public void setValueAt(Object value, Object node, int column) {
-
- Boolean booleanValue = (Boolean)value;
- if (booleanValue.booleanValue()) {
- checkedValidationErrors.add(node);
- }
- else {
- checkedValidationErrors.remove(node);
- }
-
- // recursive check of sub errors
- if (node instanceof String || node instanceof Category || node instanceof GlobalValidationGroup) {
- int childCount = getChildCount(node);
- for (int i = 0 ; i < childCount; ++i) {
- Object child = getChild(node, i);
- setValueAt(value, child, column);
- }
- }
- }
-}
1
0
r291 - in trunk: coser-business/src/main/java/fr/ifremer/coser coser-business/src/main/java/fr/ifremer/coser/services coser-business/src/main/resources/fr/ifremer/coser/data coser-business/src/main/resources/i18n coser-ui/src/main/java/fr/ifremer/coser/ui coser-ui/src/main/java/fr/ifremer/coser/ui/control coser-ui/src/main/java/fr/ifremer/coser/ui/project coser-ui/src/main/resources/i18n
by chatellier@users.labs.libre-entreprise.org 26 Nov '10
by chatellier@users.labs.libre-entreprise.org 26 Nov '10
26 Nov '10
Author: chatellier
Date: 2010-11-26 13:47:45 +0000 (Fri, 26 Nov 2010)
New Revision: 291
Log:
Fill i18n en_GB file
Modified:
trunk/coser-business/src/main/java/fr/ifremer/coser/CoserBusinessConfig.java
trunk/coser-business/src/main/java/fr/ifremer/coser/services/ProjectService.java
trunk/coser-business/src/main/resources/fr/ifremer/coser/data/Catch-error-validation.xml
trunk/coser-business/src/main/resources/fr/ifremer/coser/data/Length-error-validation.xml
trunk/coser-business/src/main/resources/i18n/coser-business_en_GB.properties
trunk/coser-business/src/main/resources/i18n/coser-business_fr_FR.properties
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/CoserFrame.jaxx
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/CoserFrameHandler.java
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlGraphDialog.jaxx
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/project/ProjectCreationView.jaxx
trunk/coser-ui/src/main/resources/i18n/coser-ui_en_GB.properties
trunk/coser-ui/src/main/resources/i18n/coser-ui_fr_FR.properties
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/CoserBusinessConfig.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/CoserBusinessConfig.java 2010-11-26 12:39:12 UTC (rev 290)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/CoserBusinessConfig.java 2010-11-26 13:47:45 UTC (rev 291)
@@ -109,7 +109,7 @@
VALIDATOR_DIRECTORY("coser.validator.directory", _("coser.config.validator.directory.description"), "${" + DATABASE_DIRECTORY.key + "}" + File.separator + "validators", String.class, false, false),
REFERENCE_SPECIES("coser.reference.species", _("coser.config.reference.species.description"), "", String.class, false, false),
- REFERENCE_TYPE_ESPECES("coser.reference.typeEspeces", _("coser.config.reference.typeEspeces.description"), "", String.class, false, false),
+ REFERENCE_TYPE_ESPECES("coser.reference.typeSpecies", _("coser.config.reference.typeSpecies.description"), "", String.class, false, false),
CONTROL_NOBSMIN("coser.control.nobsmin", _("coser.config.control.nobsmin.description"), "1.0", Double.class, false, false),
CONTROL_DIFF_CATCH_LENGTH("coser.control.diffcatchlength", _("coser.config.control.diffcatchlength.description"), "5.0", Double.class, false, false),
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/services/ProjectService.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/services/ProjectService.java 2010-11-26 12:39:12 UTC (rev 290)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/services/ProjectService.java 2010-11-26 13:47:45 UTC (rev 291)
@@ -1682,7 +1682,7 @@
public Project mergeSpecies(Project project, Selection selection, String newSpecyName, String comment, String... speciesNames) throws CoserBusinessException {
if (!isSpecyNameExist(project, newSpecyName)) {
- throw new CoserBusinessException(_("Specy %s doesn't exist in referential", newSpecyName));
+ throw new CoserBusinessException(_("Species %s doesn't exist in referential", newSpecyName));
}
MergeSpeciesCommand command = new MergeSpeciesCommand();
Modified: trunk/coser-business/src/main/resources/fr/ifremer/coser/data/Catch-error-validation.xml
===================================================================
--- trunk/coser-business/src/main/resources/fr/ifremer/coser/data/Catch-error-validation.xml 2010-11-26 12:39:12 UTC (rev 290)
+++ trunk/coser-business/src/main/resources/fr/ifremer/coser/data/Catch-error-validation.xml 2010-11-26 13:47:45 UTC (rev 291)
@@ -47,7 +47,7 @@
<field name="species">
<field-validator type="requiredstring">
<param name="trim">true</param>
- <message>Missing specy name</message>
+ <message>Missing species name</message>
</field-validator>
</field>
<field name="numberAsString">
Modified: trunk/coser-business/src/main/resources/fr/ifremer/coser/data/Length-error-validation.xml
===================================================================
--- trunk/coser-business/src/main/resources/fr/ifremer/coser/data/Length-error-validation.xml 2010-11-26 12:39:12 UTC (rev 290)
+++ trunk/coser-business/src/main/resources/fr/ifremer/coser/data/Length-error-validation.xml 2010-11-26 13:47:45 UTC (rev 291)
@@ -47,7 +47,7 @@
<field name="species">
<field-validator type="requiredstring">
<param name="trim">true</param>
- <message>Missing specy name</message>
+ <message>Missing species name</message>
</field-validator>
</field>
<field name="sex">
Modified: trunk/coser-business/src/main/resources/i18n/coser-business_en_GB.properties
===================================================================
--- trunk/coser-business/src/main/resources/i18n/coser-business_en_GB.properties 2010-11-26 12:39:12 UTC (rev 290)
+++ trunk/coser-business/src/main/resources/i18n/coser-business_en_GB.properties 2010-11-26 13:47:45 UTC (rev 291)
@@ -9,64 +9,64 @@
Missing\ haul\ name=
Missing\ maturity\ attribute=
Missing\ sex\ attribute=
-Missing\ specy\ name=
+Missing\ species\ name=
Missing\ stratum\ name=
Missing\ survey\ name=
Project\ %s\ already\ exist=
Project\ %s\ doesn't\ exists\ \!=
Selection\ %s\ already\ exists=
-Specy\ %s\ doesn't\ exist\ in\ referential=
+Species\ %s\ doesn't\ exist\ in\ referential=
Wrong\ header\ detected\ in\ file\ %s.\ Find\ \:\ %s,\ expected\ %s=
Wrong\ header\ detected\ in\ file\ %s.\ Find\ \:\ %s,\ expected\ %s\ or\ %s=
coser.business.category.catch=Catch
coser.business.category.haul=Haul
coser.business.category.length=Length
-coser.business.category.reftax.species=
+coser.business.category.reftax.species=Reftax (species)
coser.business.category.strata=Stata
-coser.business.category.typeEspece=Specy type code
-coser.business.chart.compareCatchLengthNumberTitle=
-coser.business.common.number=
-coser.business.common.year=
-coser.business.control.error.allCategories=
-coser.business.control.error.diffCatchLength=
-coser.business.control.error.diffCatchLengthDetail=
-coser.business.control.error.duplicatedLine=
-coser.business.control.error.duplicatedLineDetails=
-coser.business.control.error.invalidLengthLengthStep=
-coser.business.control.error.minObservationCount=
-coser.business.control.error.minObservationCountDetail=
-coser.business.control.error.missingYearHaulForCatchData=
-coser.business.control.error.missingYearHaulForCatchDataDetail=
-coser.business.control.error.missingYearHaulForCatchDataTip=
-coser.business.control.error.missingYearHaulForLengthData=
-coser.business.control.error.missingYearHaulForLengthDataDetail=
-coser.business.control.error.missingYearHaulForLengthDataTip=
-coser.business.control.error.missingYearHaulSpeciesForCatchData=
-coser.business.control.error.missingYearHaulSpeciesForCatchDataDetail=
-coser.business.control.error.missingYearHaulSpeciesForCatchDataTip=
-coser.business.control.error.noCatchNumberWithWeight=
-coser.business.control.error.nonExistantSpecies=
-coser.business.control.error.nonExistantSpeciesDetail=
-coser.business.control.error.surveyNotEquals=
-coser.business.control.error.yearsNotEquals=
+coser.business.category.typeEspece=Species type code
+coser.business.chart.compareCatchLengthNumberTitle=Comparison of numbers and length and catch (%s)
+coser.business.common.number=Number
+coser.business.common.year=Year
+coser.business.control.error.allCategories=All categories
+coser.business.control.error.diffCatchLength=Differences between length and catch
+coser.business.control.error.diffCatchLengthDetail=Differences between length and catch for species %s (year \: %s)
+coser.business.control.error.duplicatedLine=Duplicated line
+coser.business.control.error.duplicatedLineDetails=Duplicated line for key \: %s
+coser.business.control.error.invalidLengthLengthStep=Invalid length step (authorized centimeters and half-centimeters)
+coser.business.control.error.minObservationCount=Minimum number of observation not reached
+coser.business.control.error.minObservationCountDetail=Minimum number of observation not reached (%s) \: %.2f
+coser.business.control.error.missingYearHaulForCatchData=Missing hauls in haul data for some catch
+coser.business.control.error.missingYearHaulForCatchDataDetail=Missing %s tuple in hauls
+coser.business.control.error.missingYearHaulForCatchDataTip=Check that for each haul present one year (denoted Year|Line) in the capture file there is a data in the haul file
+coser.business.control.error.missingYearHaulForLengthData=Missing hauls in haul data for some length
+coser.business.control.error.missingYearHaulForLengthDataDetail=Missing %s tuple in hauls
+coser.business.control.error.missingYearHaulForLengthDataTip=Check that for each haul present one year (denoted Year|Line) in the length file there is a data in the haul file
+coser.business.control.error.missingYearHaulSpeciesForCatchData=Missing species in catch file for some length
+coser.business.control.error.missingYearHaulSpeciesForCatchDataDetail=Missing %s tuple in catch
+coser.business.control.error.missingYearHaulSpeciesForCatchDataTip=Check that for each species present in a line from one year to the file sizes (denoted Year | Line | Species) there is a catch-up in the file (the opposite is not true, ie there are species in catches which there is no information in file size)
+coser.business.control.error.noCatchNumberWithWeight=Weight found without number
+coser.business.control.error.nonExistantSpecies=Species not present in Reftax
+coser.business.control.error.nonExistantSpeciesDetail=Species %S is not present in Reftax
+coser.business.control.error.surveyNotEquals=Survey names are not equals in 4 data files
+coser.business.control.error.yearsNotEquals=Years are not equals in 4 data files
coser.business.control.noerrorfound=No error found
-coser.business.control.step.crossFileChech=
-coser.business.control.step.observation=
-coser.business.control.step.xworks=
+coser.business.control.step.crossFileChech=Cross file checks (%d%%)
+coser.business.control.step.observation=Checking observation number (%d%%)
+coser.business.control.step.xworks=Line checks (%d%%)
coser.business.line=Line
-coser.business.publication.htmlexportlines=
-coser.business.publication.htmlexporttitle=
-coser.business.result.rsufiResultAlreadyExists=
-coser.business.selection.notValidatedControl=
-coser.config.control.diffcatchlength.description=
-coser.config.control.nobsmin.description=
-coser.config.database.directory.description=
-coser.config.projects.directory.description=
-coser.config.reference.species.description=
-coser.config.reference.typeEspeces.description=
-coser.config.selection.densityFilter.description=
-coser.config.selection.occurrenceFilter.description=
-coser.config.validator.directory.description=
+coser.business.publication.htmlexportlines=Lines
+coser.business.publication.htmlexporttitle=Error report for project %s
+coser.business.result.rsufiResultAlreadyExists=Result %s already exists \!
+coser.business.selection.notValidatedControl=Not validated control \!
+coser.config.control.diffcatchlength.description=Percentage difference allowed between catch and length (in percent, for example 5% set 5.0)
+coser.config.control.nobsmin.description=Minimal observation number
+coser.config.database.directory.description=Coser database directory (all Coser data)
+coser.config.projects.directory.description=Coser projects directory
+coser.config.reference.species.description=Species reference file location (reftax)
+coser.config.reference.typeSpecies.description=Code type species file location
+coser.config.selection.densityFilter.description=Default density filter value
+coser.config.selection.occurrenceFilter.description=Default occurrence filter value
+coser.config.validator.directory.description=Validation files directory location
depth\ attribute\ is\ not\ a\ valid\ double=
lat\ attribute\ is\ not\ a\ valid\ double=
lat\ must\ contain\ at\ least\ 5\ decimals=
Modified: trunk/coser-business/src/main/resources/i18n/coser-business_fr_FR.properties
===================================================================
--- trunk/coser-business/src/main/resources/i18n/coser-business_fr_FR.properties 2010-11-26 12:39:12 UTC (rev 290)
+++ trunk/coser-business/src/main/resources/i18n/coser-business_fr_FR.properties 2010-11-26 13:47:45 UTC (rev 291)
@@ -9,13 +9,13 @@
Missing\ haul\ name=Nom de trait manquant
Missing\ maturity\ attribute=Attribut maturit\u00E9 manquant
Missing\ sex\ attribute=Attribut sex manquant
-Missing\ specy\ name=Nom d'esp\u00E8ce manquant
+Missing\ species\ name=Nom d'esp\u00E8ce manquant
Missing\ stratum\ name=Nom de strate manquant
Missing\ survey\ name=Nom de campagne manquant
Project\ %s\ already\ exist=Le projet %s existe d\u00E9j\u00E0 \!
Project\ %s\ doesn't\ exists\ \!=Le projet %s n'existe pas \!
Selection\ %s\ already\ exists=La s\u00E9lection %s existe d\u00E9j\u00E0 \!
-Specy\ %s\ doesn't\ exist\ in\ referential=L'esp\u00E8ce %s n'existe pas dans le r\u00E9f\u00E9rentiel
+Species\ %s\ doesn't\ exist\ in\ referential=L'esp\u00E8ce %s n'existe pas dans le r\u00E9f\u00E9rentiel
Wrong\ header\ detected\ in\ file\ %s.\ Find\ \:\ %s,\ expected\ %s=Mauvais ent\u00EAte de fichier d\u00E9tect\u00E9 dans\n%s.\n\nTrouv\u00E9\u2009\:\n\t%s\nAttendu\u2009\:\n\t%s.
Wrong\ header\ detected\ in\ file\ %s.\ Find\ \:\ %s,\ expected\ %s\ or\ %s=Mauvais ent\u00EAte de fichier d\u00E9tect\u00E9 dans %s.\n\nTrouv\u00E9\u2009\:\n\t%s\nAttendu\u2009\:\n\t%s\nou\u2009\:\n\t%s.
coser.business.category.catch=Captures
@@ -37,7 +37,7 @@
coser.business.control.error.minObservationCountDetail=Nombre minimal d'observation non atteint (%s) \: %.2f
coser.business.control.error.missingYearHaulForCatchData=Traits manquants dans les traits pour certaines captures
coser.business.control.error.missingYearHaulForCatchDataDetail=Couple %s manquant dans les traits
-coser.business.control.error.missingYearHaulForCatchDataTip=V\u00E9rifier que pour chaque trait pr\u00E9sent une ann\u00E9e (not\u00E9 Annee|Trait) dans le fichier et capture, il y a une donn\u00E9e dans le fichier traits
+coser.business.control.error.missingYearHaulForCatchDataTip=V\u00E9rifier que pour chaque trait pr\u00E9sent une ann\u00E9e (not\u00E9 Annee|Trait) dans le fichier capture, il y a une donn\u00E9e dans le fichier traits
coser.business.control.error.missingYearHaulForLengthData=Traits manquants dans les taits pour certaines tailles
coser.business.control.error.missingYearHaulForLengthDataDetail=Couple %s manquant dans les traits
coser.business.control.error.missingYearHaulForLengthDataTip=V\u00E9rifier que pour chaque trait pr\u00E9sent une ann\u00E9e (not\u00E9 Annee|Trait) dans le fichier tailles, il y a une donn\u00E9e dans le fichier traits
@@ -63,7 +63,7 @@
coser.config.database.directory.description=Emplacement du dossier de toutes les donn\u00E9es relatives \u00E0 Coser
coser.config.projects.directory.description=Emplacement du dossier de sauvegarde des projets
coser.config.reference.species.description=Emplacement du fichier de r\u00E9f\u00E9rence des esp\u00E8ces (Reftax)
-coser.config.reference.typeEspeces.description=Emplacement du fichier de code type des esp\u00E8ces
+coser.config.reference.typeSpecies.description=Emplacement du fichier de code type des esp\u00E8ces
coser.config.selection.densityFilter.description=Filtre par d\u00E9faut sur la moyenne des densit\u00E9s
coser.config.selection.occurrenceFilter.description=Filtre par d\u00E9faut sur la moyenne des occurrences
coser.config.validator.directory.description=Emplacement des fichiers de validations
Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/CoserFrame.jaxx
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/CoserFrame.jaxx 2010-11-26 12:39:12 UTC (rev 290)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/CoserFrame.jaxx 2010-11-26 13:47:45 UTC (rev 291)
@@ -43,7 +43,7 @@
<JMenuItem text="coser.ui.mainframe.menu.data.summary" onActionPerformed="getHandler().showSummaryView()"/>
<JMenuItem text="coser.ui.mainframe.menu.data.control" onActionPerformed="getHandler().showControlView()"/>
<SelectionsListMenuItem id="menuWindowSelectionMenuItem"
- text="coser.ui.mainframe.menu.data.selection" constructorParams="this" />
+ text="coser.ui.mainframe.menu.data.selections" constructorParams="this" />
</JMenu>
<JMenu id='menuOptions' text="coser.ui.mainframe.menu.options">
Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/CoserFrameHandler.java
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/CoserFrameHandler.java 2010-11-26 12:39:12 UTC (rev 290)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/CoserFrameHandler.java 2010-11-26 13:47:45 UTC (rev 291)
@@ -252,7 +252,7 @@
return;
}
if (!codeTypeEspeceFile.canRead()) {
- JOptionPane.showMessageDialog(projectView, _("coser.ui.project.createProjectMissingCodeTypeEspeces"),
+ JOptionPane.showMessageDialog(projectView, _("coser.ui.project.createProjectMissingCodeTypeSpecies"),
_("coser.ui.project.missingFile"), JOptionPane.ERROR_MESSAGE);
return;
}
Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlGraphDialog.jaxx
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlGraphDialog.jaxx 2010-11-26 12:39:12 UTC (rev 290)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlGraphDialog.jaxx 2010-11-26 13:47:45 UTC (rev 291)
@@ -29,7 +29,7 @@
<Table>
<row>
<cell>
- <JLabel text="coser.ui.control.graph.specy"/>
+ <JLabel text="coser.ui.control.graph.species"/>
</cell>
<cell fill="horizontal">
<SpecyComboModel id="specyComboModel" />
Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/project/ProjectCreationView.jaxx
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/project/ProjectCreationView.jaxx 2010-11-26 12:39:12 UTC (rev 290)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/project/ProjectCreationView.jaxx 2010-11-26 13:47:45 UTC (rev 291)
@@ -84,7 +84,7 @@
</row>
<row>
<cell anchor="west">
- <JLabel text="coser.ui.project.captureFile" />
+ <JLabel text="coser.ui.project.catchFile" />
</cell>
<cell weightx="1" fill="horizontal" columns="2">
<JTextField id="projectCatchFile" text="{project.getCatchFile()}" />
@@ -99,7 +99,7 @@
</row>
<row>
<cell anchor="west">
- <JLabel text="coser.ui.project.stratesFile" />
+ <JLabel text="coser.ui.project.strataFile" />
</cell>
<cell fill="horizontal" columns="2">
<JTextField id="projectStrataFile" text="{project.getStrataFile()}" />
@@ -129,7 +129,7 @@
</row>
<row>
<cell anchor="west">
- <JLabel text="coser.ui.project.traitsFile" />
+ <JLabel text="coser.ui.project.haulFile" />
</cell>
<cell fill="horizontal" columns="2">
<JTextField id="projectHaulFile" text="{project.getHaulFile()}" />
Modified: trunk/coser-ui/src/main/resources/i18n/coser-ui_en_GB.properties
===================================================================
--- trunk/coser-ui/src/main/resources/i18n/coser-ui_en_GB.properties 2010-11-26 12:39:12 UTC (rev 290)
+++ trunk/coser-ui/src/main/resources/i18n/coser-ui_en_GB.properties 2010-11-26 13:47:45 UTC (rev 291)
@@ -1,24 +1,24 @@
coser.config.application.version.description=Application's version
-coser.config.category.configuration=
-coser.config.category.configuration.description=
-coser.config.category.path=
-coser.config.category.path.description=
+coser.config.category.configuration=Configuration
+coser.config.category.configuration.description=Configuration (numerics data)
+coser.config.category.path=Path
+coser.config.category.path.description=File and directory configuration
coser.config.config.file.description=Coser configuration file
coser.config.locale.description=Application's locale
coser.config.lookandfeel.description=Application's swing theme
coser.config.support.email.description=Support email address
coser.ui.common.cancel=Cancel
coser.ui.common.comment=Comment
-coser.ui.common.selectAll=All
-coser.ui.common.selectAll.short=
+coser.ui.common.selectAll=Select all
+coser.ui.common.selectAll.short=All
coser.ui.common.selectFile=Select\u2026
-coser.ui.common.unselectAll=None
-coser.ui.common.unselectAll.short=
+coser.ui.common.unselectAll=Unselect all
+coser.ui.common.unselectAll.short=None
coser.ui.common.valid=Valid
coser.ui.config.title=Configuration
-coser.ui.control.categorylabel=
+coser.ui.control.categorylabel=Displayed data \:
coser.ui.control.checkData=Check data
-coser.ui.control.comment=
+coser.ui.control.comment=Comment \:
coser.ui.control.confirmDeletionMessage=Are you sure you want to delete this data ?
coser.ui.control.confirmDeletionTitle=Confirm delete
coser.ui.control.confirmDeletionsMessage=Are you sure you want to delete %d selected lines ?
@@ -27,34 +27,34 @@
coser.ui.control.dataMenuReplace=Replace in %s for selection
coser.ui.control.dataMenuReplaceAll=Replace in %s in all data
coser.ui.control.deleteLine=Delete line
-coser.ui.control.error.allCategories=
+coser.ui.control.error.allCategories=All categories
coser.ui.control.global.done=\u2026
coser.ui.control.global.message=Message
-coser.ui.control.globalErrorMenuGenerateHTML=
+coser.ui.control.globalErrorMenuGenerateHTML=Export as HTML
coser.ui.control.globalErrorMenuLabel=Error menu
coser.ui.control.globalErrorMenuSelectAll=Select all lines
-coser.ui.control.graph.specy=Specy \:
+coser.ui.control.graph.species=Species \:
coser.ui.control.graphtitle=Graph
-coser.ui.control.htmlReportCantBeOpened=
-coser.ui.control.htmlReportError=
-coser.ui.control.project.requiredauthor=
-coser.ui.control.project.requiredcatchFile=
-coser.ui.control.project.requiredhaulFile=
-coser.ui.control.project.requiredlengthFile=
-coser.ui.control.project.requiredname=
-coser.ui.control.project.requiredstrataFile=
+coser.ui.control.htmlReportCantBeOpened=HTML report as been generated in \:\n%s\nbut it can't be opened because default system browser in undefined \!
+coser.ui.control.htmlReportError=Open error
+coser.ui.control.project.requiredauthor=Author field is required
+coser.ui.control.project.requiredcatchFile=Catch file is required
+coser.ui.control.project.requiredhaulFile=Haul file is required
+coser.ui.control.project.requiredlengthFile=Length file is required
+coser.ui.control.project.requiredname=Project name is required
+coser.ui.control.project.requiredstrataFile=Strata file is required
coser.ui.control.replace.find=Find \:
coser.ui.control.replace.inField=In field \:
coser.ui.control.replace.replace=Replace \:
-coser.ui.control.replace.replacedCount=
+coser.ui.control.replace.replacedCount=%d lines replaced
coser.ui.control.replace.title=Find and replace
coser.ui.control.save=Save
-coser.ui.control.validcontrol=
-coser.ui.control.validcontroltip=
+coser.ui.control.validcontrol=Valid control
+coser.ui.control.validcontroltip=Mark control as validated. Can be done only after data check ended without errors.
coser.ui.error.htmlmessage=An error occurs \: %s
coser.ui.error.title=Global application error
-coser.ui.graph.compareNumberCatchSize=
-coser.ui.graph.lengthStructure=
+coser.ui.graph.compareNumberCatchSize=Comparison Catch/Length
+coser.ui.graph.lengthStructure=Length structure
coser.ui.locale.mustRestart=You must restart application to take effect
coser.ui.locale.title=Locale modification
coser.ui.mainframe.menu.configuration=Configuration
@@ -62,9 +62,9 @@
coser.ui.mainframe.menu.data.control=Control
coser.ui.mainframe.menu.data.newSelection=New selection
coser.ui.mainframe.menu.data.noSelection=No selection
-coser.ui.mainframe.menu.data.noValidation=
-coser.ui.mainframe.menu.data.selection=S\u00E9lection
-coser.ui.mainframe.menu.data.summary=
+coser.ui.mainframe.menu.data.noValidation=Control not validated
+coser.ui.mainframe.menu.data.selections=S\u00E9lections
+coser.ui.mainframe.menu.data.summary=Summary
coser.ui.mainframe.menu.file=File
coser.ui.mainframe.menu.locale.fr=Fran\u00E7ais
coser.ui.mainframe.menu.locale.uk=English
@@ -74,75 +74,75 @@
coser.ui.mainframe.menu.quit=Quit
coser.ui.mainframe.menu.validators=Validators
coser.ui.mainframe.menu.view=View
-coser.ui.mainframe.menu.view.lookandfeel=Theme
+coser.ui.mainframe.menu.view.lookandfeel=Look and feel
coser.ui.mainview.title=Contr\u00F4le et S\u00E9lection RSufi
-coser.ui.project.captureFile=Capture file \:
+coser.ui.project.catchFile=Catch file \:
coser.ui.project.createProject=Create project
-coser.ui.project.createProjectMissingCodeTypeEspeces=
-coser.ui.project.createProjectMissingReftax=
+coser.ui.project.createProjectMissingCodeTypeSpecies=File 'CodeTypeSpecies' is not valid \!\n(check configuration \: coser.reference.typeSpecies)
+coser.ui.project.createProjectMissingReftax=File 'Reftax' is not valid \!\n(check configuration \: coser.reference.species)
coser.ui.project.creationError=Creation error
coser.ui.project.customReferenceSpeciesFile=New reference file \:
+coser.ui.project.haulFile=Haul file \:
coser.ui.project.lengthFile=Length file \:
-coser.ui.project.missingFile=
+coser.ui.project.missingFile=Missing file
coser.ui.project.newProject=New project
coser.ui.project.openError=Open error
coser.ui.project.openProject=Open
coser.ui.project.openProjectTitle=Open existing project
coser.ui.project.project=Project \:
-coser.ui.project.projectauthor=
-coser.ui.project.projectcomment=Comments \:
+coser.ui.project.projectauthor=Author \:
+coser.ui.project.projectcomment=Comment \:
coser.ui.project.projectname=Project name \:
-coser.ui.project.stratesFile=Strates file \:
-coser.ui.project.summary.path=
-coser.ui.project.summary.title=
-coser.ui.project.summary.validated=
-coser.ui.project.traitsFile=Traits file \:
+coser.ui.project.strataFile=Strata file \:
+coser.ui.project.summary.path=Project path \:
+coser.ui.project.summary.title=Project summary
+coser.ui.project.summary.validated=Control validated \:
coser.ui.project.useCustomReferenceSpeciesFile=Use custom reference file
coser.ui.project.usedReferenceSpeciesFile=Current reference file (Reffax) \:
coser.ui.result.addNewResult=Save result
coser.ui.result.addOtherDataFile=Add file
coser.ui.result.availableDataTitle=Available results \:
-coser.ui.result.cancel=
+coser.ui.result.cancel=Cancel
coser.ui.result.dataFile1=Data file 1 \:
coser.ui.result.dataFile2=Data file 2 \:
-coser.ui.result.extractDataButton=Extract
-coser.ui.result.extractDataLabel=Extraction directory
+coser.ui.result.extractDataButton=Extract as Rsufi format
+coser.ui.result.extractDataLabel=Extraction directory \:
coser.ui.result.extractDataTitle=Extract RSufi data
-coser.ui.result.newResult=
+coser.ui.result.newResult=New Result
coser.ui.result.otherDataFile=Other files \:
-coser.ui.result.requiredname=
-coser.ui.result.requiredrsufiVersion=
+coser.ui.result.requiredname=Result name is required
+coser.ui.result.requiredrsufiVersion=Rsufi version is required
coser.ui.result.resultName=Result name \:
-coser.ui.result.rsufiVersion=RSufi version
-coser.ui.result.saveError=
-coser.ui.result.table.dataFile1=
-coser.ui.result.table.dataFile2=
-coser.ui.result.table.resultName=
-coser.ui.result.table.rsufiVersion=
-coser.ui.result.validNewResult=
+coser.ui.result.rsufiVersion=RSufi version \:
+coser.ui.result.saveError=Save error
+coser.ui.result.table.dataFile1=Data file 1
+coser.ui.result.table.dataFile2=Data file 2
+coser.ui.result.table.resultName=Result name
+coser.ui.result.table.rsufiVersion=RSufi Version
+coser.ui.result.validNewResult=Add this result
coser.ui.selection.allSpecies=L1 \: All species
-coser.ui.selection.comment=
+coser.ui.selection.comment=Comment \:
coser.ui.selection.createError=Creation error
-coser.ui.selection.details.comment=Comments
-coser.ui.selection.details.dates=
+coser.ui.selection.details.comment=Comments \:
+coser.ui.selection.details.dates=Years \:
coser.ui.selection.details.description=Description \:
-coser.ui.selection.details.filteredSpecies=
+coser.ui.selection.details.filteredSpecies=Filtered species (%d/%d) \:
coser.ui.selection.details.name=Selection name \:
coser.ui.selection.details.saveSelection=Save selection
-coser.ui.selection.details.selectedSpecies=
-coser.ui.selection.details.showMapTip=
-coser.ui.selection.details.showSpreciesTip=
-coser.ui.selection.details.strata=Strata \:
-coser.ui.selection.details.type=
-coser.ui.selection.details.validDates=
-coser.ui.selection.details.validFilter=
-coser.ui.selection.details.validSelection=
-coser.ui.selection.details.validStrata=
+coser.ui.selection.details.selectedSpecies=L1 \: Selected species (%d/%d) \:
+coser.ui.selection.details.showMapTip=Display strata map
+coser.ui.selection.details.showSpreciesTip=Display sampling effort table
+coser.ui.selection.details.strata=Strata (%d/%d) \:
+coser.ui.selection.details.type=Filter by type (%d/%d) \:
+coser.ui.selection.details.validDates=Valid years
+coser.ui.selection.details.validFilter=Valid filter
+coser.ui.selection.details.validSelection=Valid selection
+coser.ui.selection.details.validStrata=Valid strata
coser.ui.selection.filter.density=Density \:
coser.ui.selection.filter.filter=Filter
coser.ui.selection.filter.occurrence=Occurrence \:
-coser.ui.selection.fusion.comment=Comment
-coser.ui.selection.fusion.description=Species merge. Fill new specy name with name existing in referential.
+coser.ui.selection.fusion.comment=Comment \:
+coser.ui.selection.fusion.description=Species merge. Fill new species name with name existing in referential.
coser.ui.selection.fusion.name=New name \:
coser.ui.selection.fusion.title=Merge
coser.ui.selection.fusionError=Merge error
@@ -151,8 +151,8 @@
coser.ui.selection.occurenceDensitySpecies=L2 \: Filtered species
coser.ui.selection.occurrencedensityrenderer=<html>%s<span style\='font-size\:85%%;color\:gray;'>(Occ\=%.2f, Dens\=%.2f)</span></html>
coser.ui.selection.saveError=Save error
-coser.ui.selection.selection.requiredDescription=
-coser.ui.selection.selection.requiredName=
+coser.ui.selection.selection.requiredDescription=Selection description is required
+coser.ui.selection.selection.requiredName=Selection name is required
coser.ui.selection.sizeAllYearSpecies=L3 \: Species with size all year
coser.ui.selection.speciesMenuFusion=Merge
coser.ui.selection.speciesMenuLabel=Species menu
Modified: trunk/coser-ui/src/main/resources/i18n/coser-ui_fr_FR.properties
===================================================================
--- trunk/coser-ui/src/main/resources/i18n/coser-ui_fr_FR.properties 2010-11-26 12:39:12 UTC (rev 290)
+++ trunk/coser-ui/src/main/resources/i18n/coser-ui_fr_FR.properties 2010-11-26 13:47:45 UTC (rev 291)
@@ -12,7 +12,7 @@
coser.ui.common.selectAll=S\u00E9lectionner tout
coser.ui.common.selectAll.short=Tout
coser.ui.common.selectFile=S\u00E9lectionner\u2026
-coser.ui.common.unselectAll=D\u00E9-s\u00E9lectionner tout
+coser.ui.common.unselectAll=D\u00E9s\u00E9lectionner tout
coser.ui.common.unselectAll.short=Aucun
coser.ui.common.valid=Valider
coser.ui.config.title=Configuration
@@ -33,7 +33,7 @@
coser.ui.control.globalErrorMenuGenerateHTML=Exporter en HTML
coser.ui.control.globalErrorMenuLabel=Menu des erreurs
coser.ui.control.globalErrorMenuSelectAll=S\u00E9lectionner toutes les lignes
-coser.ui.control.graph.specy=Esp\u00E8ces \:
+coser.ui.control.graph.species=Esp\u00E8ces \:
coser.ui.control.graphtitle=Graphique
coser.ui.control.htmlReportCantBeOpened=Le rapport HTML a \u00E9t\u00E9 g\u00E9n\u00E9r\u00E9 dans le fichier \:\n%s\nmais ne peut pas \u00EAtre ouvert automatiquement car le navigateur\npar d\u00E9faut du syst\u00E8me n'est pas d\u00E9fini \!
coser.ui.control.htmlReportError=Erreur d'ouverture
@@ -41,7 +41,7 @@
coser.ui.control.project.requiredcatchFile=Le fichier 'capture' est requis
coser.ui.control.project.requiredhaulFile=Le fichier 'traits' est requis
coser.ui.control.project.requiredlengthFile=Le fichier 'taille' est requis
-coser.ui.control.project.requiredname=Le champ 'nom' est requis
+coser.ui.control.project.requiredname=Le nom du project est requis
coser.ui.control.project.requiredstrataFile=Le fichier 'strates' est requis
coser.ui.control.replace.find=Chercher \:
coser.ui.control.replace.inField=Dans le champ \:
@@ -63,7 +63,7 @@
coser.ui.mainframe.menu.data.newSelection=Nouvelle s\u00E9lection
coser.ui.mainframe.menu.data.noSelection=Aucune s\u00E9lection
coser.ui.mainframe.menu.data.noValidation=Contr\u00F4le non valid\u00E9
-coser.ui.mainframe.menu.data.selection=S\u00E9lections
+coser.ui.mainframe.menu.data.selections=S\u00E9lections
coser.ui.mainframe.menu.data.summary=R\u00E9sum\u00E9
coser.ui.mainframe.menu.file=Fichier
coser.ui.mainframe.menu.locale.fr=Fran\u00E7ais
@@ -76,13 +76,14 @@
coser.ui.mainframe.menu.view=Vue
coser.ui.mainframe.menu.view.lookandfeel=Th\u00E8me
coser.ui.mainview.title=Contr\u00F4le et S\u00E9lection RSufi
-coser.ui.project.captureFile=Fichier de captures \:
+coser.ui.project.catchFile=Fichier de captures \:
coser.ui.project.createProject=Cr\u00E9er le projet
-coser.ui.project.createProjectMissingCodeTypeEspeces=Le fichier 'CodeTypeEspeces' n'est pas valide \!\n(v\u00E9rifiez la configuration \: coser.reference.typeEspeces)
+coser.ui.project.createProjectMissingCodeTypeSpecies=Le fichier 'CodeTypeEspeces' n'est pas valide \!\n(v\u00E9rifiez la configuration \: coser.reference.typeSpecies)
coser.ui.project.createProjectMissingReftax=Le fichier 'Reftax' n'est pas valide \!\n(v\u00E9rifiez la configuration \: coser.reference.species)
coser.ui.project.creationError=Erreur de cr\u00E9ation
coser.ui.project.customReferenceSpeciesFile=Nouveau fichier de r\u00E9f\u00E9rence \:
-coser.ui.project.lengthFile=Fichiers des tailles \:
+coser.ui.project.haulFile=Fichier des traits \:
+coser.ui.project.lengthFile=Fichier des tailles \:
coser.ui.project.missingFile=Fichier manquant
coser.ui.project.newProject=Nouveau projet
coser.ui.project.openError=Erreur d'ouverture
@@ -92,11 +93,10 @@
coser.ui.project.projectauthor=Auteur \:
coser.ui.project.projectcomment=Commentaire \:
coser.ui.project.projectname=Nom du projet \:
-coser.ui.project.stratesFile=Fichiers des strates \:
+coser.ui.project.strataFile=Fichier des strates \:
coser.ui.project.summary.path=Chemin du projet \:
coser.ui.project.summary.title=R\u00E9sum\u00E9 du projet
coser.ui.project.summary.validated=Contr\u00F4le valid\u00E9 \:
-coser.ui.project.traitsFile=Fichiers des traits \:
coser.ui.project.useCustomReferenceSpeciesFile=Utiliser un autre fichier de r\u00E9f\u00E9rence
coser.ui.project.usedReferenceSpeciesFile=Fichier de r\u00E9f\u00E9rence utilis\u00E9 (Reftax) \:
coser.ui.result.addNewResult=Ajouter un r\u00E9sultat
@@ -105,12 +105,12 @@
coser.ui.result.cancel=Annuler
coser.ui.result.dataFile1=Fichier r\u00E9sultat 1 \:
coser.ui.result.dataFile2=Fichier r\u00E9sultat 2 \:
-coser.ui.result.extractDataButton=Extraire
+coser.ui.result.extractDataButton=Extraire au format RSufi
coser.ui.result.extractDataLabel=Dossier d'extraction \:
-coser.ui.result.extractDataTitle=Extraction des donn\u00E9es d'entr\u00E9e de RSufi
+coser.ui.result.extractDataTitle=Extraction des donn\u00E9es RSufi
coser.ui.result.newResult=Nouveau r\u00E9sultat
coser.ui.result.otherDataFile=Autre fichiers \:
-coser.ui.result.requiredname=Le champ 'name' est requis
+coser.ui.result.requiredname=Le nom du r\u00E9sultat est requis
coser.ui.result.requiredrsufiVersion=Le champ 'rsufiVersion' est requis
coser.ui.result.resultName=Nom du r\u00E9sultat \:
coser.ui.result.rsufiVersion=Version de RSufi \:
@@ -130,8 +130,8 @@
coser.ui.selection.details.name=Nom de la s\u00E9lection \:
coser.ui.selection.details.saveSelection=Sauvegarder la s\u00E9lection
coser.ui.selection.details.selectedSpecies=L1 \: Esp\u00E8ces s\u00E9lectionn\u00E9es (%d/%d) \:
-coser.ui.selection.details.showMapTip=Afficher la carte des zones
-coser.ui.selection.details.showSpreciesTip=Afficher la table des esp\u00E8ces
+coser.ui.selection.details.showMapTip=Afficher la carte des strates
+coser.ui.selection.details.showSpreciesTip=Afficher la table de l'effort d'\u00E9chantillonage
coser.ui.selection.details.strata=Strates (%d/%d) \:
coser.ui.selection.details.type=Filtrer par type (%d/%d) \:
coser.ui.selection.details.validDates=Valider les ann\u00E9es
@@ -151,8 +151,8 @@
coser.ui.selection.occurenceDensitySpecies=L2 \: Esp\u00E8ces filtr\u00E9es
coser.ui.selection.occurrencedensityrenderer=<html>%s<span style\='font-size\:85%%;color\:gray;'>(Occ\=%.2f, Dens\=%.2f)</span></html>
coser.ui.selection.saveError=Erreur de sauvegarde
-coser.ui.selection.selection.requiredDescription=Le champ 'description' est requis
-coser.ui.selection.selection.requiredName=Le champ 'nom' est requis
+coser.ui.selection.selection.requiredDescription=La description de la s\u00E9lection est requise
+coser.ui.selection.selection.requiredName=Le nom de la s\u00E9lection est requis
coser.ui.selection.sizeAllYearSpecies=L3 \: Esp\u00E8ces avec taille pour toutes les ann\u00E9es
coser.ui.selection.speciesMenuFusion=Fusion
coser.ui.selection.speciesMenuLabel=Menu esp\u00E8ces
1
0
r290 - trunk/coser-business/src/main/java/fr/ifremer/coser/storage
by chatellier@users.labs.libre-entreprise.org 26 Nov '10
by chatellier@users.labs.libre-entreprise.org 26 Nov '10
26 Nov '10
Author: chatellier
Date: 2010-11-26 12:39:12 +0000 (Fri, 26 Nov 2010)
New Revision: 290
Log:
Must be protected
Modified:
trunk/coser-business/src/main/java/fr/ifremer/coser/storage/MemoryDataStorage.java
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/storage/MemoryDataStorage.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/storage/MemoryDataStorage.java 2010-11-26 12:36:23 UTC (rev 289)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/storage/MemoryDataStorage.java 2010-11-26 12:39:12 UTC (rev 290)
@@ -49,8 +49,8 @@
*/
public class MemoryDataStorage implements DataStorage {
- public List<String> listStorage;
- public List<String> lineIndexStorage;
+ protected List<String> listStorage;
+ protected List<String> lineIndexStorage;
public MemoryDataStorage() {
listStorage = new ArrayList<String>();
1
0
r289 - trunk/coser-business/src/test/java/fr/ifremer/coser/services
by chatellier@users.labs.libre-entreprise.org 26 Nov '10
by chatellier@users.labs.libre-entreprise.org 26 Nov '10
26 Nov '10
Author: chatellier
Date: 2010-11-26 12:36:23 +0000 (Fri, 26 Nov 2010)
New Revision: 289
Log:
Copie des ressources de test sans les .svn
Modified:
trunk/coser-business/src/test/java/fr/ifremer/coser/services/CoserTestAbstract.java
Modified: trunk/coser-business/src/test/java/fr/ifremer/coser/services/CoserTestAbstract.java
===================================================================
--- trunk/coser-business/src/test/java/fr/ifremer/coser/services/CoserTestAbstract.java 2010-11-26 11:02:18 UTC (rev 288)
+++ trunk/coser-business/src/test/java/fr/ifremer/coser/services/CoserTestAbstract.java 2010-11-26 12:36:23 UTC (rev 289)
@@ -26,6 +26,7 @@
package fr.ifremer.coser.services;
import java.io.File;
+import java.io.FileFilter;
import java.io.IOException;
import java.util.HashMap;
import java.util.Locale;
@@ -72,8 +73,19 @@
I18n.init(Locale.UK);
- FileUtils.copyDirectoryToDirectory(new File("src" + File.separator +
- "test" + File.separator + "resources", "projects"), testDirectory);
+ FileUtils.copyDirectory(new File("src" + File.separator +
+ "test" + File.separator + "resources", "projects"),
+ config.getProjectsDirectory(), new FileFilter() {
+ @Override
+ public boolean accept(File pathname) {
+ boolean result = true;
+ if (pathname.getAbsolutePath().indexOf(
+ File.separator + ".svn") != -1) {
+ result = false;
+ }
+ return result;
+ }
+ });
}
@AfterClass
1
0
26 Nov '10
Author: chatellier
Date: 2010-11-26 11:02:18 +0000 (Fri, 26 Nov 2010)
New Revision: 288
Log:
Set trunk to error
Modified:
trunk/coser-ui/src/main/resources/log4j.properties
Modified: trunk/coser-ui/src/main/resources/log4j.properties
===================================================================
--- trunk/coser-ui/src/main/resources/log4j.properties 2010-11-26 10:57:07 UTC (rev 287)
+++ trunk/coser-ui/src/main/resources/log4j.properties 2010-11-26 11:02:18 UTC (rev 288)
@@ -38,4 +38,4 @@
log4j.appender.file.layout.ConversionPattern=%d{dd-MM-yy HH:mm:ss} %5p %c:%L - %m%n
# Specific logging
-log4j.category.fr.ifremer.coser=DEBUG
+#log4j.category.fr.ifremer.coser=DEBUG
1
0
r287 - in trunk/coser-business/src/test: java/fr/ifremer/coser/services resources resources/projects resources/projects/project2 resources/projects/project2/control resources/projects/project2/original resources/projects/project2/selections resources/projects/project2/selections/testselection2 resources/projects/projectctrvalidated resources/projects/projectctrvalidated/control resources/projects/projectctrvalidated/original resources/projects/projectctrvalidated/selections resources/project
by chatellier@users.labs.libre-entreprise.org 26 Nov '10
by chatellier@users.labs.libre-entreprise.org 26 Nov '10
26 Nov '10
Author: chatellier
Date: 2010-11-26 10:57:07 +0000 (Fri, 26 Nov 2010)
New Revision: 287
Log:
Ajout de 2 projets de test et d'un test pour verifier qu'ils sont correctement charg?\195?\169s
Added:
trunk/coser-business/src/test/resources/projects/
trunk/coser-business/src/test/resources/projects/project2/
trunk/coser-business/src/test/resources/projects/project2/codeTypeEspeces.csv
trunk/coser-business/src/test/resources/projects/project2/control/
trunk/coser-business/src/test/resources/projects/project2/control/control.properties
trunk/coser-business/src/test/resources/projects/project2/control/testcatch_co.csv
trunk/coser-business/src/test/resources/projects/project2/control/testhaul_co.csv
trunk/coser-business/src/test/resources/projects/project2/control/testlength_co.csv
trunk/coser-business/src/test/resources/projects/project2/control/testlength_del.csv
trunk/coser-business/src/test/resources/projects/project2/control/teststrata_co.csv
trunk/coser-business/src/test/resources/projects/project2/original/
trunk/coser-business/src/test/resources/projects/project2/original/testcatch.csv
trunk/coser-business/src/test/resources/projects/project2/original/testhaul.csv
trunk/coser-business/src/test/resources/projects/project2/original/testlength.csv
trunk/coser-business/src/test/resources/projects/project2/original/teststrata.csv
trunk/coser-business/src/test/resources/projects/project2/project.properties
trunk/coser-business/src/test/resources/projects/project2/reftaxSpecies.csv
trunk/coser-business/src/test/resources/projects/project2/selections/
trunk/coser-business/src/test/resources/projects/project2/selections/testselection2/
trunk/coser-business/src/test/resources/projects/project2/selections/testselection2/testcatch_se.csv
trunk/coser-business/src/test/resources/projects/project2/selections/testselection2/testhaul_se.csv
trunk/coser-business/src/test/resources/projects/project2/selections/testselection2/testlength_se.csv
trunk/coser-business/src/test/resources/projects/project2/selections/testselection2/testselection2.selection
trunk/coser-business/src/test/resources/projects/project2/selections/testselection2/teststrata_se.csv
trunk/coser-business/src/test/resources/projects/projectctrvalidated/
trunk/coser-business/src/test/resources/projects/projectctrvalidated/codeTypeEspeces.csv
trunk/coser-business/src/test/resources/projects/projectctrvalidated/control/
trunk/coser-business/src/test/resources/projects/projectctrvalidated/control/control.properties
trunk/coser-business/src/test/resources/projects/projectctrvalidated/control/testcatch_co.csv
trunk/coser-business/src/test/resources/projects/projectctrvalidated/control/testhaul_co.csv
trunk/coser-business/src/test/resources/projects/projectctrvalidated/control/testlength_co.csv
trunk/coser-business/src/test/resources/projects/projectctrvalidated/control/teststrata_co.csv
trunk/coser-business/src/test/resources/projects/projectctrvalidated/original/
trunk/coser-business/src/test/resources/projects/projectctrvalidated/original/testcatch.csv
trunk/coser-business/src/test/resources/projects/projectctrvalidated/original/testhaul.csv
trunk/coser-business/src/test/resources/projects/projectctrvalidated/original/testlength.csv
trunk/coser-business/src/test/resources/projects/projectctrvalidated/original/teststrata.csv
trunk/coser-business/src/test/resources/projects/projectctrvalidated/project.properties
trunk/coser-business/src/test/resources/projects/projectctrvalidated/reftaxSpecies.csv
trunk/coser-business/src/test/resources/projects/projectctrvalidated/selections/
trunk/coser-business/src/test/resources/projects/projectctrvalidated/selections/testselection1/
trunk/coser-business/src/test/resources/projects/projectctrvalidated/selections/testselection1/testcatch_se.csv
trunk/coser-business/src/test/resources/projects/projectctrvalidated/selections/testselection1/testhaul_se.csv
trunk/coser-business/src/test/resources/projects/projectctrvalidated/selections/testselection1/testlength_se.csv
trunk/coser-business/src/test/resources/projects/projectctrvalidated/selections/testselection1/testselection1.selection
trunk/coser-business/src/test/resources/projects/projectctrvalidated/selections/testselection1/teststrata_se.csv
Modified:
trunk/coser-business/src/test/java/fr/ifremer/coser/services/CoserTestAbstract.java
trunk/coser-business/src/test/java/fr/ifremer/coser/services/ProjectServiceTest.java
Modified: trunk/coser-business/src/test/java/fr/ifremer/coser/services/CoserTestAbstract.java
===================================================================
--- trunk/coser-business/src/test/java/fr/ifremer/coser/services/CoserTestAbstract.java 2010-11-26 10:31:48 UTC (rev 286)
+++ trunk/coser-business/src/test/java/fr/ifremer/coser/services/CoserTestAbstract.java 2010-11-26 10:57:07 UTC (rev 287)
@@ -61,7 +61,7 @@
protected static File testDirectory;
@BeforeClass
- public static void initConfig() {
+ public static void initConfig() throws IOException {
String tmpDir = System.getProperty("java.io.tmpdir");
testDirectory = new File(tmpDir, "coser");
if (testDirectory.isDirectory()) {
@@ -71,6 +71,9 @@
config.setDatabaseDirectory(testDirectory.getAbsolutePath());
I18n.init(Locale.UK);
+
+ FileUtils.copyDirectoryToDirectory(new File("src" + File.separator +
+ "test" + File.separator + "resources", "projects"), testDirectory);
}
@AfterClass
@@ -127,4 +130,20 @@
}
return project;
}
+
+ /**
+ * Ouvre un projet present dans le repertoire de test (copié depuis
+ * les resources ou créé durant les tests).
+ *
+ * @param projectService project service
+ * @param projectName project name
+ * @return opened project (control data loaded)
+ * @throws CoserBusinessException
+ */
+ protected Project openTestProject(ProjectService projectService, String projectName) throws CoserBusinessException {
+
+ Project project = projectService.openProject(projectName);
+ project = projectService.loadControlData(project);
+ return project;
+ }
}
Modified: trunk/coser-business/src/test/java/fr/ifremer/coser/services/ProjectServiceTest.java
===================================================================
--- trunk/coser-business/src/test/java/fr/ifremer/coser/services/ProjectServiceTest.java 2010-11-26 10:31:48 UTC (rev 286)
+++ trunk/coser-business/src/test/java/fr/ifremer/coser/services/ProjectServiceTest.java 2010-11-26 10:57:07 UTC (rev 287)
@@ -77,9 +77,8 @@
@Test(expected=CoserBusinessException.class)
public void testDuplicatedProject() throws CoserBusinessException {
Project p = new Project();
- p.setName("myProject");
+ p.setName("project2"); // il existe deja dans src/test/resources
projectService.createProject(p, new HashMap<CoserConstants.Category, File>());
- projectService.createProject(p, new HashMap<CoserConstants.Category, File>());
}
/**
@@ -103,8 +102,31 @@
Assert.assertTrue(new File(config.getProjectsDirectory(),
project.getName() + File.separator + "reftaxSpecies.csv").exists());
}
-
+
/**
+ * Test que les projets des resources de test sont bien rechargé.
+ *
+ * @throws CoserBusinessException
+ */
+ @Test
+ public void testTestResourcesProjectReloading() throws CoserBusinessException {
+ Project projectValidated = openTestProject(projectService, "projectctrvalidated");
+ // ce projet a un control validé
+ Assert.assertTrue(projectValidated.getControl().isValidated());
+
+ // la selection
+ Selection selection = projectValidated.getSelections().get("testselection1");
+ Assert.assertNotNull(selection);
+ projectService.loadSelectionData(projectValidated, selection);
+ Assert.assertEquals(1, selection.getHistoryCommand().size()); // un merge
+ Assert.assertEquals("Test selectedSpeciesOccDensComment", selection.getSelectedSpeciesOccDensComment());
+ Assert.assertEquals(3.5, selection.getDensityFilter(), 0);
+
+ Project projectNotValidated = openTestProject(projectService, "project2");
+ Assert.assertFalse(projectNotValidated.getControl().isValidated());
+ }
+
+ /**
* Test que le project est correctement créer (à partir des données
* dans /src/test/resources.
*
Added: trunk/coser-business/src/test/resources/projects/project2/codeTypeEspeces.csv
===================================================================
--- trunk/coser-business/src/test/resources/projects/project2/codeTypeEspeces.csv (rev 0)
+++ trunk/coser-business/src/test/resources/projects/project2/codeTypeEspeces.csv 2010-11-26 10:57:07 UTC (rev 287)
@@ -0,0 +1,4 @@
+"Types";"Commentaire";"NumSys min";"NumSys max"
+"Type1";;"00001";"00002"
+"Type2";;"00003";"00005"
+"Type3";;"00006";"00010"
Added: trunk/coser-business/src/test/resources/projects/project2/control/control.properties
===================================================================
--- trunk/coser-business/src/test/resources/projects/project2/control/control.properties (rev 0)
+++ trunk/coser-business/src/test/resources/projects/project2/control/control.properties 2010-11-26 10:57:07 UTC (rev 287)
@@ -0,0 +1,3 @@
+#Fri Nov 26 11:37:55 CET 2010
+control.commands.0=(69fea302-003c-427c-92dd-8f5541864b1c);(DeleteLineCommand);();((category\=LENGTH);(lineNumber\=2))
+control.validated=false
Added: trunk/coser-business/src/test/resources/projects/project2/control/testcatch_co.csv
===================================================================
--- trunk/coser-business/src/test/resources/projects/project2/control/testcatch_co.csv (rev 0)
+++ trunk/coser-business/src/test/resources/projects/project2/control/testcatch_co.csv 2010-11-26 10:57:07 UTC (rev 287)
@@ -0,0 +1,25 @@
+"coser.business.line";"Survey";"Year";"Haul";"Species";"Number";"Weight"
+"1";"COSER_TEST";"2010";"TRAIT1";"COSER_SPECIES1";"234.33";"4.55"
+"2";"COSER_TEST";"2010";"TRAIT1";"COSER_SPECIES2";"4.33";"1.12"
+"3";"COSER_TEST";"2010";"TRAIT1";"COSER_SPECIES3";"859.04";"22.16"
+"4";"COSER_TEST";"2010";"TRAIT1";"COSER_SPECIES4";"251.86";"59.34"
+"5";"COSER_TEST";"2010";"TRAIT2";"COSER_SPECIES1";"407.54";"81.37"
+"6";"COSER_TEST";"2010";"TRAIT2";"COSER_SPECIES2";"472.91";"59.38"
+"7";"COSER_TEST";"2010";"TRAIT2";"COSER_SPECIES3";"38.36";"41.60"
+"8";"COSER_TEST";"2010";"TRAIT2";"COSER_SPECIES4";"146.76";"76.15"
+"9";"COSER_TEST";"2010";"TRAIT3";"COSER_SPECIES1";"737.53";"32.27"
+"10";"COSER_TEST";"2010";"TRAIT3";"COSER_SPECIES2";"715.54";"91.42"
+"11";"COSER_TEST";"2010";"TRAIT3";"COSER_SPECIES3";"256.31";"55.32"
+"12";"COSER_TEST";"2010";"TRAIT3";"COSER_SPECIES4";"308.81";"85.96"
+"13";"COSER_TEST";"2011";"TRAIT10";"COSER_SPECIES1";"326.53";"0.55"
+"14";"COSER_TEST";"2011";"TRAIT10";"COSER_SPECIES2";"965.46";"75.30"
+"15";"COSER_TEST";"2011";"TRAIT10";"COSER_SPECIES3";"187.44";"45.04"
+"16";"COSER_TEST";"2011";"TRAIT10";"COSER_SPECIES4";"714.22";"25.60"
+"17";"COSER_TEST";"2011";"TRAIT20";"COSER_SPECIES1";"475.71";"51.42"
+"18";"COSER_TEST";"2011";"TRAIT20";"COSER_SPECIES2";"661.88";"82.41"
+"19";"COSER_TEST";"2011";"TRAIT20";"COSER_SPECIES3";"378.28";"27.32"
+"20";"COSER_TEST";"2011";"TRAIT20";"COSER_SPECIES4";"139.31";"11.74"
+"21";"COSER_TEST";"2011";"TRAIT30";"COSER_SPECIES1";"810.68";"67.38"
+"22";"COSER_TEST";"2011";"TRAIT30";"COSER_SPECIES2";"783.03";"40.36"
+"23";"COSER_TEST";"2011";"TRAIT30";"COSER_SPECIES3";"244.24";"87.85"
+"24";"COSER_TEST";"2011";"TRAIT30";"COSER_SPECIES4";"52.71";"22.93"
Added: trunk/coser-business/src/test/resources/projects/project2/control/testhaul_co.csv
===================================================================
--- trunk/coser-business/src/test/resources/projects/project2/control/testhaul_co.csv (rev 0)
+++ trunk/coser-business/src/test/resources/projects/project2/control/testhaul_co.csv 2010-11-26 10:57:07 UTC (rev 287)
@@ -0,0 +1,7 @@
+"coser.business.line";"Survey";"Year";"Haul";"Month";"Stratum";"SweptSurface";"Lat";"Long";"Depth"
+"1";"COSER_TEST";"2010";"TRAIT1";"10";"STR1";"0.06";"43.75";"-1.50";"45.50"
+"2";"COSER_TEST";"2010";"TRAIT2";"10";"STR2";"0.06";"43.81";"-1.45";"31.00"
+"3";"COSER_TEST";"2010";"TRAIT3";"10";"STR3";"0.06";"43.89";"-1.73";"115.00"
+"4";"COSER_TEST";"2011";"TRAIT10";"10";"STR4";"0.06";"43.96";"-2.03";"143.00"
+"5";"COSER_TEST";"2011";"TRAIT20";"10";"STR5";"0.06";"43.91";"-2.09";"185.00"
+"6";"COSER_TEST";"2011";"TRAIT30";"10";"STR6";"0.06";"43.88";"-2.12";"295.00"
Added: trunk/coser-business/src/test/resources/projects/project2/control/testlength_co.csv
===================================================================
--- trunk/coser-business/src/test/resources/projects/project2/control/testlength_co.csv (rev 0)
+++ trunk/coser-business/src/test/resources/projects/project2/control/testlength_co.csv 2010-11-26 10:57:07 UTC (rev 287)
@@ -0,0 +1,29 @@
+"coser.business.line";"Survey";"Year";"Haul";"Species";"Sex";"Maturity";"Length";"Number";"Weight";"Age"
+"1";"COSER_TEST";"2010";"TRAIT1";"COSER_SPECIES1";"i";"NA";"29.19";"1.00";"0.45";"NA"
+"3";"COSER_TEST";"2010";"TRAIT1";"COSER_SPECIES2";"i";"NA";"19.60";"3.00";"0.78";"NA"
+"4";"COSER_TEST";"2010";"TRAIT1";"COSER_SPECIES3";"i";"NA";"32.93";"5.00";"0.87";"NA"
+"5";"COSER_TEST";"2010";"TRAIT1";"COSER_SPECIES3";"f";"NA";"26.27";"3.00";"0.03";"NA"
+"6";"COSER_TEST";"2010";"TRAIT1";"COSER_SPECIES3";"m";"NA";"35.25";"4.00";"";"NA"
+"7";"COSER_TEST";"2010";"TRAIT1";"COSER_SPECIES4";"i";"NA";"37.82";"4.00";"0.61";"NA"
+"8";"COSER_TEST";"2010";"TRAIT2";"COSER_SPECIES1";"i";"NA";"20.07";"2.00";"0.12";"NA"
+"9";"COSER_TEST";"2010";"TRAIT2";"COSER_SPECIES1";"i";"NA";"27.18";"2.00";"0.92";"NA"
+"10";"COSER_TEST";"2010";"TRAIT2";"COSER_SPECIES2";"i";"NA";"21.14";"1.00";"0.34";"NA"
+"11";"COSER_TEST";"2010";"TRAIT2";"COSER_SPECIES3";"i";"NA";"1.82";"4.00";"0.1";"NA"
+"12";"COSER_TEST";"2010";"TRAIT2";"COSER_SPECIES4";"i";"NA";"36.55";"4.00";"0.39";"NA"
+"13";"COSER_TEST";"2010";"TRAIT3";"COSER_SPECIES1";"i";"NA";"20.39";"3.00";"0.28";"NA"
+"14";"COSER_TEST";"2010";"TRAIT3";"COSER_SPECIES2";"i";"NA";"19.88";"3.00";"0.31";"NA"
+"15";"COSER_TEST";"2010";"TRAIT3";"COSER_SPECIES3";"i";"NA";"18.16";"1.00";"0.34";"NA"
+"16";"COSER_TEST";"2010";"TRAIT3";"COSER_SPECIES4";"i";"NA";"10.22";"2.00";"0.31";"NA"
+"17";"COSER_TEST";"2010";"TRAIT3";"COSER_SPECIES4";"f";"NA";"33.03";"5.00";"0.26";"NA"
+"18";"COSER_TEST";"2011";"TRAIT1";"COSER_SPECIES1";"i";"NA";"1.00";"4.00";"0.81";"NA"
+"19";"COSER_TEST";"2011";"TRAIT1";"COSER_SPECIES2";"i";"NA";"27.61";"3.00";"NA"
+"20";"COSER_TEST";"2011";"TRAIT1";"COSER_SPECIES3";"i";"NA";"20.44";"3.00";"0.43";"NA"
+"21";"COSER_TEST";"2011";"TRAIT1";"COSER_SPECIES4";"i";"NA";"6.86";"1.00";"0.23";"NA"
+"22";"COSER_TEST";"2011";"TRAIT2";"COSER_SPECIES1";"i";"NA";"15.04";"4.00";"0.95";"NA"
+"23";"COSER_TEST";"2011";"TRAIT2";"COSER_SPECIES2";"i";"NA";"35.03";"1.00";"0.26";"NA"
+"24";"COSER_TEST";"2011";"TRAIT2";"COSER_SPECIES3";"i";"NA";"19.41";"1.00";"0.51";"NA"
+"25";"COSER_TEST";"2011";"TRAIT2";"COSER_SPECIES4";"i";"NA";"24.58";"2.00";"NA"
+"26";"COSER_TEST";"2011";"TRAIT3";"COSER_SPECIES1";"i";"NA";"2.46";"3.00";"0.32";"NA"
+"27";"COSER_TEST";"2011";"TRAIT3";"COSER_SPECIES2";"i";"NA";"18.93";"5.00";"0.22";"NA"
+"28";"COSER_TEST";"2011";"TRAIT3";"COSER_SPECIES3";"i";"NA";"23.77";"5.00";"0.12";"NA"
+"29";"COSER_TEST";"2011";"TRAIT3";"COSER_SPECIES4";"i";"NA";"0.94";"3.00";"0.77";"NA"
Added: trunk/coser-business/src/test/resources/projects/project2/control/testlength_del.csv
===================================================================
--- trunk/coser-business/src/test/resources/projects/project2/control/testlength_del.csv (rev 0)
+++ trunk/coser-business/src/test/resources/projects/project2/control/testlength_del.csv 2010-11-26 10:57:07 UTC (rev 287)
@@ -0,0 +1,2 @@
+"Survey";"Year";"Haul";"Species";"Sex";"Maturity";"Length";"Number";"Weight";"Age"
+"2";"COSER_TEST";"2010";"TRAIT1";"COSER_SPECIES2";"i";"NA";"19.60";"2.00";"0.34";"NA"
Added: trunk/coser-business/src/test/resources/projects/project2/control/teststrata_co.csv
===================================================================
--- trunk/coser-business/src/test/resources/projects/project2/control/teststrata_co.csv (rev 0)
+++ trunk/coser-business/src/test/resources/projects/project2/control/teststrata_co.csv 2010-11-26 10:57:07 UTC (rev 287)
@@ -0,0 +1,11 @@
+"coser.business.line";"Survey";"Stratum";"Surface"
+"1";"COSER_TEST";"STR1";"15909.15"
+"2";"COSER_TEST";"STR2";"11184.27"
+"3";"COSER_TEST";"STR3";"5200.96"
+"4";"COSER_TEST";"STR4";"15573.19"
+"5";"COSER_TEST";"STR5";"8625.07"
+"6";"COSER_TEST";"STR6";"10.20"
+"7";"COSER_TEST";"STR7";"19683.28"
+"8";"COSER_TEST";"STR8";"6053.53"
+"9";"COSER_TEST";"STR9";"993.49"
+"10";"COSER_TEST";"STR10";"5975.14"
Added: trunk/coser-business/src/test/resources/projects/project2/original/testcatch.csv
===================================================================
--- trunk/coser-business/src/test/resources/projects/project2/original/testcatch.csv (rev 0)
+++ trunk/coser-business/src/test/resources/projects/project2/original/testcatch.csv 2010-11-26 10:57:07 UTC (rev 287)
@@ -0,0 +1,25 @@
+"Survey";"Year";"Haul";"Species";"Number";"Weight"
+COSER_TEST;2010;TRAIT1;COSER_SPECIES1;234.33;4.55
+COSER_TEST;2010;TRAIT1;COSER_SPECIES2;4.33;1.12
+COSER_TEST;2010;TRAIT1;COSER_SPECIES3;859.04;22.16
+COSER_TEST;2010;TRAIT1;COSER_SPECIES4;251.86;59.34
+COSER_TEST;2010;TRAIT2;COSER_SPECIES1;407.54;81.37
+COSER_TEST;2010;TRAIT2;COSER_SPECIES2;472.91;59.38
+COSER_TEST;2010;TRAIT2;COSER_SPECIES3;38.36;41.60
+COSER_TEST;2010;TRAIT2;COSER_SPECIES4;146.76;76.15
+COSER_TEST;2010;TRAIT3;COSER_SPECIES1;737.53;32.27
+COSER_TEST;2010;TRAIT3;COSER_SPECIES2;715.54;91.42
+COSER_TEST;2010;TRAIT3;COSER_SPECIES3;256.31;55.32
+COSER_TEST;2010;TRAIT3;COSER_SPECIES4;308.81;85.96
+COSER_TEST;2011;TRAIT10;COSER_SPECIES1;326.53;0.55
+COSER_TEST;2011;TRAIT10;COSER_SPECIES2;965.46;75.30
+COSER_TEST;2011;TRAIT10;COSER_SPECIES3;187.44;45.04
+COSER_TEST;2011;TRAIT10;COSER_SPECIES4;714.22;25.60
+COSER_TEST;2011;TRAIT20;COSER_SPECIES1;475.71;51.42
+COSER_TEST;2011;TRAIT20;COSER_SPECIES2;661.88;82.41
+COSER_TEST;2011;TRAIT20;COSER_SPECIES3;378.28;27.32
+COSER_TEST;2011;TRAIT20;COSER_SPECIES4;139.31;11.74
+COSER_TEST;2011;TRAIT30;COSER_SPECIES1;810.68;67.38
+COSER_TEST;2011;TRAIT30;COSER_SPECIES2;783.03;40.36
+COSER_TEST;2011;TRAIT30;COSER_SPECIES3;244.24;87.85
+COSER_TEST;2011;TRAIT30;COSER_SPECIES4;52.71;22.93
Added: trunk/coser-business/src/test/resources/projects/project2/original/testhaul.csv
===================================================================
--- trunk/coser-business/src/test/resources/projects/project2/original/testhaul.csv (rev 0)
+++ trunk/coser-business/src/test/resources/projects/project2/original/testhaul.csv 2010-11-26 10:57:07 UTC (rev 287)
@@ -0,0 +1,7 @@
+Survey;Year;Haul;Month;Stratum;SweptSurface;Lat;Long;Depth
+COSER_TEST;2010;TRAIT1;10;STR1;0.06;43.75;-1.50;45.50
+COSER_TEST;2010;TRAIT2;10;STR2;0.06;43.81;-1.45;31.00
+COSER_TEST;2010;TRAIT3;10;STR3;0.06;43.89;-1.73;115.00
+COSER_TEST;2011;TRAIT10;10;STR4;0.06;43.96;-2.03;143.00
+COSER_TEST;2011;TRAIT20;10;STR5;0.06;43.91;-2.09;185.00
+COSER_TEST;2011;TRAIT30;10;STR6;0.06;43.88;-2.12;295.00
Added: trunk/coser-business/src/test/resources/projects/project2/original/testlength.csv
===================================================================
--- trunk/coser-business/src/test/resources/projects/project2/original/testlength.csv (rev 0)
+++ trunk/coser-business/src/test/resources/projects/project2/original/testlength.csv 2010-11-26 10:57:07 UTC (rev 287)
@@ -0,0 +1,30 @@
+Survey;Year;Haul;Species;Sex;Maturity;Length;Number;Weight;Age
+COSER_TEST;2010;TRAIT1;COSER_SPECIES1;i;NA;29.19;1.00;0.45;NA
+COSER_TEST;2010;TRAIT1;COSER_SPECIES2;i;NA;19.60;2.00;0.34;NA
+COSER_TEST;2010;TRAIT1;COSER_SPECIES2;i;NA;19.60;3.00;0.78;NA
+COSER_TEST;2010;TRAIT1;COSER_SPECIES3;i;NA;32.93;5.00;0.87;NA
+COSER_TEST;2010;TRAIT1;COSER_SPECIES3;f;NA;26.27;3.00;0.03;NA
+COSER_TEST;2010;TRAIT1;COSER_SPECIES3;m;NA;35.25;4.00;;NA
+COSER_TEST;2010;TRAIT1;COSER_SPECIES4;i;NA;37.82;4.00;0.61;NA
+COSER_TEST;2010;TRAIT2;COSER_SPECIES1;i;NA;20.07;2.00;0.12;NA
+COSER_TEST;2010;TRAIT2;COSER_SPECIES1;i;NA;27.18;2.00;0.92;NA
+COSER_TEST;2010;TRAIT2;COSER_SPECIES2;i;NA;21.14;1.00;0.34;NA
+COSER_TEST;2010;TRAIT2;COSER_SPECIES3;i;NA;1.82;4.00;0.1;NA
+COSER_TEST;2010;TRAIT2;COSER_SPECIES4;i;NA;36.55;4.00;0.39;NA
+COSER_TEST;2010;TRAIT3;COSER_SPECIES1;i;NA;20.39;3.00;0.28;NA
+COSER_TEST;2010;TRAIT3;COSER_SPECIES2;i;NA;19.88;3.00;0.31;NA
+COSER_TEST;2010;TRAIT3;COSER_SPECIES3;i;NA;18.16;1.00;0.34;NA
+COSER_TEST;2010;TRAIT3;COSER_SPECIES4;i;NA;10.22;2.00;0.31;NA
+COSER_TEST;2010;TRAIT3;COSER_SPECIES4;f;NA;33.03;5.00;0.26;NA
+COSER_TEST;2011;TRAIT1;COSER_SPECIES1;i;NA;1.00;4.00;0.81;NA
+COSER_TEST;2011;TRAIT1;COSER_SPECIES2;i;NA;27.61;3.00;NA
+COSER_TEST;2011;TRAIT1;COSER_SPECIES3;i;NA;20.44;3.00;0.43;NA
+COSER_TEST;2011;TRAIT1;COSER_SPECIES4;i;NA;6.86;1.00;0.23;NA
+COSER_TEST;2011;TRAIT2;COSER_SPECIES1;i;NA;15.04;4.00;0.95;NA
+COSER_TEST;2011;TRAIT2;COSER_SPECIES2;i;NA;35.03;1.00;0.26;NA
+COSER_TEST;2011;TRAIT2;COSER_SPECIES3;i;NA;19.41;1.00;0.51;NA
+COSER_TEST;2011;TRAIT2;COSER_SPECIES4;i;NA;24.58;2.00;NA
+COSER_TEST;2011;TRAIT3;COSER_SPECIES1;i;NA;2.46;3.00;0.32;NA
+COSER_TEST;2011;TRAIT3;COSER_SPECIES2;i;NA;18.93;5.00;0.22;NA
+COSER_TEST;2011;TRAIT3;COSER_SPECIES3;i;NA;23.77;5.00;0.12;NA
+COSER_TEST;2011;TRAIT3;COSER_SPECIES4;i;NA;0.94;3.00;0.77;NA
Added: trunk/coser-business/src/test/resources/projects/project2/original/teststrata.csv
===================================================================
--- trunk/coser-business/src/test/resources/projects/project2/original/teststrata.csv (rev 0)
+++ trunk/coser-business/src/test/resources/projects/project2/original/teststrata.csv 2010-11-26 10:57:07 UTC (rev 287)
@@ -0,0 +1,11 @@
+Survey;Stratum;Surface
+COSER_TEST;STR1;15909.15
+COSER_TEST;STR2;11184.27
+COSER_TEST;STR3;5200.96
+COSER_TEST;STR4;15573.19
+COSER_TEST;STR5;8625.07
+COSER_TEST;STR6;10.20
+COSER_TEST;STR7;19683.28
+COSER_TEST;STR8;6053.53
+COSER_TEST;STR9;993.49
+COSER_TEST;STR10;5975.14
Added: trunk/coser-business/src/test/resources/projects/project2/project.properties
===================================================================
--- trunk/coser-business/src/test/resources/projects/project2/project.properties (rev 0)
+++ trunk/coser-business/src/test/resources/projects/project2/project.properties 2010-11-26 10:57:07 UTC (rev 287)
@@ -0,0 +1,5 @@
+#Fri Nov 26 11:37:55 CET 2010
+project.catchFileName=testcatch.csv
+project.strataFileName=teststrata.csv
+project.haulFileName=testhaul.csv
+project.lengthFileName=testlength.csv
Added: trunk/coser-business/src/test/resources/projects/project2/reftaxSpecies.csv
===================================================================
--- trunk/coser-business/src/test/resources/projects/project2/reftaxSpecies.csv (rev 0)
+++ trunk/coser-business/src/test/resources/projects/project2/reftaxSpecies.csv 2010-11-26 10:57:07 UTC (rev 287)
@@ -0,0 +1,6 @@
+"C_Perm";"NumSys";"NivSys";"C_VALIDE";"L_VALIDE";"AA_VALIDE";"C_TxPère";"Taxa"
+"1";"000001";"1";"COSER_SPECIES1";"L'espece de test coser 1";"";"";"";
+"2";"000002";"2";"COSER_SPECIES2";"L'espece de test coser 2";"";"";"";
+"3";"000003";"3";"COSER_SPECIES3";"L'espece de test coser 3";"";"";"";
+"4";"000004";"4";"COSER_SPECIES4";"L'espece de test coser 4";"";"";"";
+"5";"000005";"5";"COSER_SPECIES_MERGE";"L'espece de test coser pour fusion";"";"";"";
Added: trunk/coser-business/src/test/resources/projects/project2/selections/testselection2/testcatch_se.csv
===================================================================
--- trunk/coser-business/src/test/resources/projects/project2/selections/testselection2/testcatch_se.csv (rev 0)
+++ trunk/coser-business/src/test/resources/projects/project2/selections/testselection2/testcatch_se.csv 2010-11-26 10:57:07 UTC (rev 287)
@@ -0,0 +1,25 @@
+"coser.business.line";"Survey";"Year";"Haul";"Species";"Number";"Weight"
+"1";"COSER_TEST";"2010";"TRAIT1";"COSER_SPECIES1";"234.33";"4.55"
+"2";"COSER_TEST";"2010";"TRAIT1";"COSER_SPECIES2";"4.33";"1.12"
+"3";"COSER_TEST";"2010";"TRAIT1";"COSER_SPECIES3";"859.04";"22.16"
+"4";"COSER_TEST";"2010";"TRAIT1";"COSER_SPECIES4";"251.86";"59.34"
+"5";"COSER_TEST";"2010";"TRAIT2";"COSER_SPECIES1";"407.54";"81.37"
+"6";"COSER_TEST";"2010";"TRAIT2";"COSER_SPECIES2";"472.91";"59.38"
+"7";"COSER_TEST";"2010";"TRAIT2";"COSER_SPECIES3";"38.36";"41.60"
+"8";"COSER_TEST";"2010";"TRAIT2";"COSER_SPECIES4";"146.76";"76.15"
+"9";"COSER_TEST";"2010";"TRAIT3";"COSER_SPECIES1";"737.53";"32.27"
+"10";"COSER_TEST";"2010";"TRAIT3";"COSER_SPECIES2";"715.54";"91.42"
+"11";"COSER_TEST";"2010";"TRAIT3";"COSER_SPECIES3";"256.31";"55.32"
+"12";"COSER_TEST";"2010";"TRAIT3";"COSER_SPECIES4";"308.81";"85.96"
+"13";"COSER_TEST";"2011";"TRAIT10";"COSER_SPECIES1";"326.53";"0.55"
+"14";"COSER_TEST";"2011";"TRAIT10";"COSER_SPECIES2";"965.46";"75.30"
+"15";"COSER_TEST";"2011";"TRAIT10";"COSER_SPECIES3";"187.44";"45.04"
+"16";"COSER_TEST";"2011";"TRAIT10";"COSER_SPECIES4";"714.22";"25.60"
+"17";"COSER_TEST";"2011";"TRAIT20";"COSER_SPECIES1";"475.71";"51.42"
+"18";"COSER_TEST";"2011";"TRAIT20";"COSER_SPECIES2";"661.88";"82.41"
+"19";"COSER_TEST";"2011";"TRAIT20";"COSER_SPECIES3";"378.28";"27.32"
+"20";"COSER_TEST";"2011";"TRAIT20";"COSER_SPECIES4";"139.31";"11.74"
+"21";"COSER_TEST";"2011";"TRAIT30";"COSER_SPECIES1";"810.68";"67.38"
+"22";"COSER_TEST";"2011";"TRAIT30";"COSER_SPECIES2";"783.03";"40.36"
+"23";"COSER_TEST";"2011";"TRAIT30";"COSER_SPECIES3";"244.24";"87.85"
+"24";"COSER_TEST";"2011";"TRAIT30";"COSER_SPECIES4";"52.71";"22.93"
Added: trunk/coser-business/src/test/resources/projects/project2/selections/testselection2/testhaul_se.csv
===================================================================
--- trunk/coser-business/src/test/resources/projects/project2/selections/testselection2/testhaul_se.csv (rev 0)
+++ trunk/coser-business/src/test/resources/projects/project2/selections/testselection2/testhaul_se.csv 2010-11-26 10:57:07 UTC (rev 287)
@@ -0,0 +1,7 @@
+"coser.business.line";"Survey";"Year";"Haul";"Month";"Stratum";"SweptSurface";"Lat";"Long";"Depth"
+"1";"COSER_TEST";"2010";"TRAIT1";"10";"STR1";"0.06";"43.75";"-1.50";"45.50"
+"2";"COSER_TEST";"2010";"TRAIT2";"10";"STR2";"0.06";"43.81";"-1.45";"31.00"
+"3";"COSER_TEST";"2010";"TRAIT3";"10";"STR3";"0.06";"43.89";"-1.73";"115.00"
+"4";"COSER_TEST";"2011";"TRAIT10";"10";"STR4";"0.06";"43.96";"-2.03";"143.00"
+"5";"COSER_TEST";"2011";"TRAIT20";"10";"STR5";"0.06";"43.91";"-2.09";"185.00"
+"6";"COSER_TEST";"2011";"TRAIT30";"10";"STR6";"0.06";"43.88";"-2.12";"295.00"
Added: trunk/coser-business/src/test/resources/projects/project2/selections/testselection2/testlength_se.csv
===================================================================
--- trunk/coser-business/src/test/resources/projects/project2/selections/testselection2/testlength_se.csv (rev 0)
+++ trunk/coser-business/src/test/resources/projects/project2/selections/testselection2/testlength_se.csv 2010-11-26 10:57:07 UTC (rev 287)
@@ -0,0 +1,30 @@
+"coser.business.line";"Survey";"Year";"Haul";"Species";"Sex";"Maturity";"Length";"Number";"Weight";"Age"
+"1";"COSER_TEST";"2010";"TRAIT1";"COSER_SPECIES1";"i";"NA";"29.19";"1.00";"0.45";"NA"
+"2";"COSER_TEST";"2010";"TRAIT1";"COSER_SPECIES2";"i";"NA";"19.60";"2.00";"0.34";"NA"
+"3";"COSER_TEST";"2010";"TRAIT1";"COSER_SPECIES2";"i";"NA";"19.60";"3.00";"0.78";"NA"
+"4";"COSER_TEST";"2010";"TRAIT1";"COSER_SPECIES3";"i";"NA";"32.93";"5.00";"0.87";"NA"
+"5";"COSER_TEST";"2010";"TRAIT1";"COSER_SPECIES3";"f";"NA";"26.27";"3.00";"0.03";"NA"
+"6";"COSER_TEST";"2010";"TRAIT1";"COSER_SPECIES3";"m";"NA";"35.25";"4.00";"";"NA"
+"7";"COSER_TEST";"2010";"TRAIT1";"COSER_SPECIES4";"i";"NA";"37.82";"4.00";"0.61";"NA"
+"8";"COSER_TEST";"2010";"TRAIT2";"COSER_SPECIES1";"i";"NA";"20.07";"2.00";"0.12";"NA"
+"9";"COSER_TEST";"2010";"TRAIT2";"COSER_SPECIES1";"i";"NA";"27.18";"2.00";"0.92";"NA"
+"10";"COSER_TEST";"2010";"TRAIT2";"COSER_SPECIES2";"i";"NA";"21.14";"1.00";"0.34";"NA"
+"11";"COSER_TEST";"2010";"TRAIT2";"COSER_SPECIES3";"i";"NA";"1.82";"4.00";"0.1";"NA"
+"12";"COSER_TEST";"2010";"TRAIT2";"COSER_SPECIES4";"i";"NA";"36.55";"4.00";"0.39";"NA"
+"13";"COSER_TEST";"2010";"TRAIT3";"COSER_SPECIES1";"i";"NA";"20.39";"3.00";"0.28";"NA"
+"14";"COSER_TEST";"2010";"TRAIT3";"COSER_SPECIES2";"i";"NA";"19.88";"3.00";"0.31";"NA"
+"15";"COSER_TEST";"2010";"TRAIT3";"COSER_SPECIES3";"i";"NA";"18.16";"1.00";"0.34";"NA"
+"16";"COSER_TEST";"2010";"TRAIT3";"COSER_SPECIES4";"i";"NA";"10.22";"2.00";"0.31";"NA"
+"17";"COSER_TEST";"2010";"TRAIT3";"COSER_SPECIES4";"f";"NA";"33.03";"5.00";"0.26";"NA"
+"18";"COSER_TEST";"2011";"TRAIT1";"COSER_SPECIES1";"i";"NA";"1.00";"4.00";"0.81";"NA"
+"19";"COSER_TEST";"2011";"TRAIT1";"COSER_SPECIES2";"i";"NA";"27.61";"3.00";"NA"
+"20";"COSER_TEST";"2011";"TRAIT1";"COSER_SPECIES3";"i";"NA";"20.44";"3.00";"0.43";"NA"
+"21";"COSER_TEST";"2011";"TRAIT1";"COSER_SPECIES4";"i";"NA";"6.86";"1.00";"0.23";"NA"
+"22";"COSER_TEST";"2011";"TRAIT2";"COSER_SPECIES1";"i";"NA";"15.04";"4.00";"0.95";"NA"
+"23";"COSER_TEST";"2011";"TRAIT2";"COSER_SPECIES2";"i";"NA";"35.03";"1.00";"0.26";"NA"
+"24";"COSER_TEST";"2011";"TRAIT2";"COSER_SPECIES3";"i";"NA";"19.41";"1.00";"0.51";"NA"
+"25";"COSER_TEST";"2011";"TRAIT2";"COSER_SPECIES4";"i";"NA";"24.58";"2.00";"NA"
+"26";"COSER_TEST";"2011";"TRAIT3";"COSER_SPECIES1";"i";"NA";"2.46";"3.00";"0.32";"NA"
+"27";"COSER_TEST";"2011";"TRAIT3";"COSER_SPECIES2";"i";"NA";"18.93";"5.00";"0.22";"NA"
+"28";"COSER_TEST";"2011";"TRAIT3";"COSER_SPECIES3";"i";"NA";"23.77";"5.00";"0.12";"NA"
+"29";"COSER_TEST";"2011";"TRAIT3";"COSER_SPECIES4";"i";"NA";"0.94";"3.00";"0.77";"NA"
Added: trunk/coser-business/src/test/resources/projects/project2/selections/testselection2/testselection2.selection
===================================================================
--- trunk/coser-business/src/test/resources/projects/project2/selections/testselection2/testselection2.selection (rev 0)
+++ trunk/coser-business/src/test/resources/projects/project2/selections/testselection2/testselection2.selection 2010-11-26 10:57:07 UTC (rev 287)
@@ -0,0 +1,4 @@
+#Fri Nov 26 11:37:55 CET 2010
+selection.validated=false
+selection.densityFilter=5.0
+selection.occurrenceFilter=5.0
Added: trunk/coser-business/src/test/resources/projects/project2/selections/testselection2/teststrata_se.csv
===================================================================
--- trunk/coser-business/src/test/resources/projects/project2/selections/testselection2/teststrata_se.csv (rev 0)
+++ trunk/coser-business/src/test/resources/projects/project2/selections/testselection2/teststrata_se.csv 2010-11-26 10:57:07 UTC (rev 287)
@@ -0,0 +1,11 @@
+"coser.business.line";"Survey";"Stratum";"Surface"
+"1";"COSER_TEST";"STR1";"15909.15"
+"2";"COSER_TEST";"STR2";"11184.27"
+"3";"COSER_TEST";"STR3";"5200.96"
+"4";"COSER_TEST";"STR4";"15573.19"
+"5";"COSER_TEST";"STR5";"8625.07"
+"6";"COSER_TEST";"STR6";"10.20"
+"7";"COSER_TEST";"STR7";"19683.28"
+"8";"COSER_TEST";"STR8";"6053.53"
+"9";"COSER_TEST";"STR9";"993.49"
+"10";"COSER_TEST";"STR10";"5975.14"
Added: trunk/coser-business/src/test/resources/projects/projectctrvalidated/codeTypeEspeces.csv
===================================================================
--- trunk/coser-business/src/test/resources/projects/projectctrvalidated/codeTypeEspeces.csv (rev 0)
+++ trunk/coser-business/src/test/resources/projects/projectctrvalidated/codeTypeEspeces.csv 2010-11-26 10:57:07 UTC (rev 287)
@@ -0,0 +1,4 @@
+"Types";"Commentaire";"NumSys min";"NumSys max"
+"Type1";;"00001";"00002"
+"Type2";;"00003";"00005"
+"Type3";;"00006";"00010"
Added: trunk/coser-business/src/test/resources/projects/projectctrvalidated/control/control.properties
===================================================================
--- trunk/coser-business/src/test/resources/projects/projectctrvalidated/control/control.properties (rev 0)
+++ trunk/coser-business/src/test/resources/projects/projectctrvalidated/control/control.properties 2010-11-26 10:57:07 UTC (rev 287)
@@ -0,0 +1,2 @@
+#Fri Nov 26 11:37:55 CET 2010
+control.validated=true
Added: trunk/coser-business/src/test/resources/projects/projectctrvalidated/control/testcatch_co.csv
===================================================================
--- trunk/coser-business/src/test/resources/projects/projectctrvalidated/control/testcatch_co.csv (rev 0)
+++ trunk/coser-business/src/test/resources/projects/projectctrvalidated/control/testcatch_co.csv 2010-11-26 10:57:07 UTC (rev 287)
@@ -0,0 +1,25 @@
+"coser.business.line";"Survey";"Year";"Haul";"Species";"Number";"Weight"
+"1";"COSER_TEST";"2010";"TRAIT1";"COSER_SPECIES1";"234.33";"4.55"
+"2";"COSER_TEST";"2010";"TRAIT1";"COSER_SPECIES2";"4.33";"1.12"
+"3";"COSER_TEST";"2010";"TRAIT1";"COSER_SPECIES3";"859.04";"22.16"
+"4";"COSER_TEST";"2010";"TRAIT1";"COSER_SPECIES4";"251.86";"59.34"
+"5";"COSER_TEST";"2010";"TRAIT2";"COSER_SPECIES1";"407.54";"81.37"
+"6";"COSER_TEST";"2010";"TRAIT2";"COSER_SPECIES2";"472.91";"59.38"
+"7";"COSER_TEST";"2010";"TRAIT2";"COSER_SPECIES3";"38.36";"41.60"
+"8";"COSER_TEST";"2010";"TRAIT2";"COSER_SPECIES4";"146.76";"76.15"
+"9";"COSER_TEST";"2010";"TRAIT3";"COSER_SPECIES1";"737.53";"32.27"
+"10";"COSER_TEST";"2010";"TRAIT3";"COSER_SPECIES2";"715.54";"91.42"
+"11";"COSER_TEST";"2010";"TRAIT3";"COSER_SPECIES3";"256.31";"55.32"
+"12";"COSER_TEST";"2010";"TRAIT3";"COSER_SPECIES4";"308.81";"85.96"
+"13";"COSER_TEST";"2011";"TRAIT10";"COSER_SPECIES1";"326.53";"0.55"
+"14";"COSER_TEST";"2011";"TRAIT10";"COSER_SPECIES2";"965.46";"75.30"
+"15";"COSER_TEST";"2011";"TRAIT10";"COSER_SPECIES3";"187.44";"45.04"
+"16";"COSER_TEST";"2011";"TRAIT10";"COSER_SPECIES4";"714.22";"25.60"
+"17";"COSER_TEST";"2011";"TRAIT20";"COSER_SPECIES1";"475.71";"51.42"
+"18";"COSER_TEST";"2011";"TRAIT20";"COSER_SPECIES2";"661.88";"82.41"
+"19";"COSER_TEST";"2011";"TRAIT20";"COSER_SPECIES3";"378.28";"27.32"
+"20";"COSER_TEST";"2011";"TRAIT20";"COSER_SPECIES4";"139.31";"11.74"
+"21";"COSER_TEST";"2011";"TRAIT30";"COSER_SPECIES1";"810.68";"67.38"
+"22";"COSER_TEST";"2011";"TRAIT30";"COSER_SPECIES2";"783.03";"40.36"
+"23";"COSER_TEST";"2011";"TRAIT30";"COSER_SPECIES3";"244.24";"87.85"
+"24";"COSER_TEST";"2011";"TRAIT30";"COSER_SPECIES4";"52.71";"22.93"
Added: trunk/coser-business/src/test/resources/projects/projectctrvalidated/control/testhaul_co.csv
===================================================================
--- trunk/coser-business/src/test/resources/projects/projectctrvalidated/control/testhaul_co.csv (rev 0)
+++ trunk/coser-business/src/test/resources/projects/projectctrvalidated/control/testhaul_co.csv 2010-11-26 10:57:07 UTC (rev 287)
@@ -0,0 +1,7 @@
+"coser.business.line";"Survey";"Year";"Haul";"Month";"Stratum";"SweptSurface";"Lat";"Long";"Depth"
+"1";"COSER_TEST";"2010";"TRAIT1";"10";"STR1";"0.06";"43.75";"-1.50";"45.50"
+"2";"COSER_TEST";"2010";"TRAIT2";"10";"STR2";"0.06";"43.81";"-1.45";"31.00"
+"3";"COSER_TEST";"2010";"TRAIT3";"10";"STR3";"0.06";"43.89";"-1.73";"115.00"
+"4";"COSER_TEST";"2011";"TRAIT10";"10";"STR4";"0.06";"43.96";"-2.03";"143.00"
+"5";"COSER_TEST";"2011";"TRAIT20";"10";"STR5";"0.06";"43.91";"-2.09";"185.00"
+"6";"COSER_TEST";"2011";"TRAIT30";"10";"STR6";"0.06";"43.88";"-2.12";"295.00"
Added: trunk/coser-business/src/test/resources/projects/projectctrvalidated/control/testlength_co.csv
===================================================================
--- trunk/coser-business/src/test/resources/projects/projectctrvalidated/control/testlength_co.csv (rev 0)
+++ trunk/coser-business/src/test/resources/projects/projectctrvalidated/control/testlength_co.csv 2010-11-26 10:57:07 UTC (rev 287)
@@ -0,0 +1,30 @@
+"coser.business.line";"Survey";"Year";"Haul";"Species";"Sex";"Maturity";"Length";"Number";"Weight";"Age"
+"1";"COSER_TEST";"2010";"TRAIT1";"COSER_SPECIES1";"i";"NA";"29.19";"1.00";"0.45";"NA"
+"2";"COSER_TEST";"2010";"TRAIT1";"COSER_SPECIES2";"i";"NA";"19.60";"2.00";"0.34";"NA"
+"3";"COSER_TEST";"2010";"TRAIT1";"COSER_SPECIES2";"i";"NA";"19.60";"3.00";"0.78";"NA"
+"4";"COSER_TEST";"2010";"TRAIT1";"COSER_SPECIES3";"i";"NA";"32.93";"5.00";"0.87";"NA"
+"5";"COSER_TEST";"2010";"TRAIT1";"COSER_SPECIES3";"f";"NA";"26.27";"3.00";"0.03";"NA"
+"6";"COSER_TEST";"2010";"TRAIT1";"COSER_SPECIES3";"m";"NA";"35.25";"4.00";"";"NA"
+"7";"COSER_TEST";"2010";"TRAIT1";"COSER_SPECIES4";"i";"NA";"37.82";"4.00";"0.61";"NA"
+"8";"COSER_TEST";"2010";"TRAIT2";"COSER_SPECIES1";"i";"NA";"20.07";"2.00";"0.12";"NA"
+"9";"COSER_TEST";"2010";"TRAIT2";"COSER_SPECIES1";"i";"NA";"27.18";"2.00";"0.92";"NA"
+"10";"COSER_TEST";"2010";"TRAIT2";"COSER_SPECIES2";"i";"NA";"21.14";"1.00";"0.34";"NA"
+"11";"COSER_TEST";"2010";"TRAIT2";"COSER_SPECIES3";"i";"NA";"1.82";"4.00";"0.1";"NA"
+"12";"COSER_TEST";"2010";"TRAIT2";"COSER_SPECIES4";"i";"NA";"36.55";"4.00";"0.39";"NA"
+"13";"COSER_TEST";"2010";"TRAIT3";"COSER_SPECIES1";"i";"NA";"20.39";"3.00";"0.28";"NA"
+"14";"COSER_TEST";"2010";"TRAIT3";"COSER_SPECIES2";"i";"NA";"19.88";"3.00";"0.31";"NA"
+"15";"COSER_TEST";"2010";"TRAIT3";"COSER_SPECIES3";"i";"NA";"18.16";"1.00";"0.34";"NA"
+"16";"COSER_TEST";"2010";"TRAIT3";"COSER_SPECIES4";"i";"NA";"10.22";"2.00";"0.31";"NA"
+"17";"COSER_TEST";"2010";"TRAIT3";"COSER_SPECIES4";"f";"NA";"33.03";"5.00";"0.26";"NA"
+"18";"COSER_TEST";"2011";"TRAIT1";"COSER_SPECIES1";"i";"NA";"1.00";"4.00";"0.81";"NA"
+"19";"COSER_TEST";"2011";"TRAIT1";"COSER_SPECIES2";"i";"NA";"27.61";"3.00";"NA"
+"20";"COSER_TEST";"2011";"TRAIT1";"COSER_SPECIES3";"i";"NA";"20.44";"3.00";"0.43";"NA"
+"21";"COSER_TEST";"2011";"TRAIT1";"COSER_SPECIES4";"i";"NA";"6.86";"1.00";"0.23";"NA"
+"22";"COSER_TEST";"2011";"TRAIT2";"COSER_SPECIES1";"i";"NA";"15.04";"4.00";"0.95";"NA"
+"23";"COSER_TEST";"2011";"TRAIT2";"COSER_SPECIES2";"i";"NA";"35.03";"1.00";"0.26";"NA"
+"24";"COSER_TEST";"2011";"TRAIT2";"COSER_SPECIES3";"i";"NA";"19.41";"1.00";"0.51";"NA"
+"25";"COSER_TEST";"2011";"TRAIT2";"COSER_SPECIES4";"i";"NA";"24.58";"2.00";"NA"
+"26";"COSER_TEST";"2011";"TRAIT3";"COSER_SPECIES1";"i";"NA";"2.46";"3.00";"0.32";"NA"
+"27";"COSER_TEST";"2011";"TRAIT3";"COSER_SPECIES2";"i";"NA";"18.93";"5.00";"0.22";"NA"
+"28";"COSER_TEST";"2011";"TRAIT3";"COSER_SPECIES3";"i";"NA";"23.77";"5.00";"0.12";"NA"
+"29";"COSER_TEST";"2011";"TRAIT3";"COSER_SPECIES4";"i";"NA";"0.94";"3.00";"0.77";"NA"
Added: trunk/coser-business/src/test/resources/projects/projectctrvalidated/control/teststrata_co.csv
===================================================================
--- trunk/coser-business/src/test/resources/projects/projectctrvalidated/control/teststrata_co.csv (rev 0)
+++ trunk/coser-business/src/test/resources/projects/projectctrvalidated/control/teststrata_co.csv 2010-11-26 10:57:07 UTC (rev 287)
@@ -0,0 +1,11 @@
+"coser.business.line";"Survey";"Stratum";"Surface"
+"1";"COSER_TEST";"STR1";"15909.15"
+"2";"COSER_TEST";"STR2";"11184.27"
+"3";"COSER_TEST";"STR3";"5200.96"
+"4";"COSER_TEST";"STR4";"15573.19"
+"5";"COSER_TEST";"STR5";"8625.07"
+"6";"COSER_TEST";"STR6";"10.20"
+"7";"COSER_TEST";"STR7";"19683.28"
+"8";"COSER_TEST";"STR8";"6053.53"
+"9";"COSER_TEST";"STR9";"993.49"
+"10";"COSER_TEST";"STR10";"5975.14"
Added: trunk/coser-business/src/test/resources/projects/projectctrvalidated/original/testcatch.csv
===================================================================
--- trunk/coser-business/src/test/resources/projects/projectctrvalidated/original/testcatch.csv (rev 0)
+++ trunk/coser-business/src/test/resources/projects/projectctrvalidated/original/testcatch.csv 2010-11-26 10:57:07 UTC (rev 287)
@@ -0,0 +1,25 @@
+"Survey";"Year";"Haul";"Species";"Number";"Weight"
+COSER_TEST;2010;TRAIT1;COSER_SPECIES1;234.33;4.55
+COSER_TEST;2010;TRAIT1;COSER_SPECIES2;4.33;1.12
+COSER_TEST;2010;TRAIT1;COSER_SPECIES3;859.04;22.16
+COSER_TEST;2010;TRAIT1;COSER_SPECIES4;251.86;59.34
+COSER_TEST;2010;TRAIT2;COSER_SPECIES1;407.54;81.37
+COSER_TEST;2010;TRAIT2;COSER_SPECIES2;472.91;59.38
+COSER_TEST;2010;TRAIT2;COSER_SPECIES3;38.36;41.60
+COSER_TEST;2010;TRAIT2;COSER_SPECIES4;146.76;76.15
+COSER_TEST;2010;TRAIT3;COSER_SPECIES1;737.53;32.27
+COSER_TEST;2010;TRAIT3;COSER_SPECIES2;715.54;91.42
+COSER_TEST;2010;TRAIT3;COSER_SPECIES3;256.31;55.32
+COSER_TEST;2010;TRAIT3;COSER_SPECIES4;308.81;85.96
+COSER_TEST;2011;TRAIT10;COSER_SPECIES1;326.53;0.55
+COSER_TEST;2011;TRAIT10;COSER_SPECIES2;965.46;75.30
+COSER_TEST;2011;TRAIT10;COSER_SPECIES3;187.44;45.04
+COSER_TEST;2011;TRAIT10;COSER_SPECIES4;714.22;25.60
+COSER_TEST;2011;TRAIT20;COSER_SPECIES1;475.71;51.42
+COSER_TEST;2011;TRAIT20;COSER_SPECIES2;661.88;82.41
+COSER_TEST;2011;TRAIT20;COSER_SPECIES3;378.28;27.32
+COSER_TEST;2011;TRAIT20;COSER_SPECIES4;139.31;11.74
+COSER_TEST;2011;TRAIT30;COSER_SPECIES1;810.68;67.38
+COSER_TEST;2011;TRAIT30;COSER_SPECIES2;783.03;40.36
+COSER_TEST;2011;TRAIT30;COSER_SPECIES3;244.24;87.85
+COSER_TEST;2011;TRAIT30;COSER_SPECIES4;52.71;22.93
Added: trunk/coser-business/src/test/resources/projects/projectctrvalidated/original/testhaul.csv
===================================================================
--- trunk/coser-business/src/test/resources/projects/projectctrvalidated/original/testhaul.csv (rev 0)
+++ trunk/coser-business/src/test/resources/projects/projectctrvalidated/original/testhaul.csv 2010-11-26 10:57:07 UTC (rev 287)
@@ -0,0 +1,7 @@
+Survey;Year;Haul;Month;Stratum;SweptSurface;Lat;Long;Depth
+COSER_TEST;2010;TRAIT1;10;STR1;0.06;43.75;-1.50;45.50
+COSER_TEST;2010;TRAIT2;10;STR2;0.06;43.81;-1.45;31.00
+COSER_TEST;2010;TRAIT3;10;STR3;0.06;43.89;-1.73;115.00
+COSER_TEST;2011;TRAIT10;10;STR4;0.06;43.96;-2.03;143.00
+COSER_TEST;2011;TRAIT20;10;STR5;0.06;43.91;-2.09;185.00
+COSER_TEST;2011;TRAIT30;10;STR6;0.06;43.88;-2.12;295.00
Added: trunk/coser-business/src/test/resources/projects/projectctrvalidated/original/testlength.csv
===================================================================
--- trunk/coser-business/src/test/resources/projects/projectctrvalidated/original/testlength.csv (rev 0)
+++ trunk/coser-business/src/test/resources/projects/projectctrvalidated/original/testlength.csv 2010-11-26 10:57:07 UTC (rev 287)
@@ -0,0 +1,30 @@
+Survey;Year;Haul;Species;Sex;Maturity;Length;Number;Weight;Age
+COSER_TEST;2010;TRAIT1;COSER_SPECIES1;i;NA;29.19;1.00;0.45;NA
+COSER_TEST;2010;TRAIT1;COSER_SPECIES2;i;NA;19.60;2.00;0.34;NA
+COSER_TEST;2010;TRAIT1;COSER_SPECIES2;i;NA;19.60;3.00;0.78;NA
+COSER_TEST;2010;TRAIT1;COSER_SPECIES3;i;NA;32.93;5.00;0.87;NA
+COSER_TEST;2010;TRAIT1;COSER_SPECIES3;f;NA;26.27;3.00;0.03;NA
+COSER_TEST;2010;TRAIT1;COSER_SPECIES3;m;NA;35.25;4.00;;NA
+COSER_TEST;2010;TRAIT1;COSER_SPECIES4;i;NA;37.82;4.00;0.61;NA
+COSER_TEST;2010;TRAIT2;COSER_SPECIES1;i;NA;20.07;2.00;0.12;NA
+COSER_TEST;2010;TRAIT2;COSER_SPECIES1;i;NA;27.18;2.00;0.92;NA
+COSER_TEST;2010;TRAIT2;COSER_SPECIES2;i;NA;21.14;1.00;0.34;NA
+COSER_TEST;2010;TRAIT2;COSER_SPECIES3;i;NA;1.82;4.00;0.1;NA
+COSER_TEST;2010;TRAIT2;COSER_SPECIES4;i;NA;36.55;4.00;0.39;NA
+COSER_TEST;2010;TRAIT3;COSER_SPECIES1;i;NA;20.39;3.00;0.28;NA
+COSER_TEST;2010;TRAIT3;COSER_SPECIES2;i;NA;19.88;3.00;0.31;NA
+COSER_TEST;2010;TRAIT3;COSER_SPECIES3;i;NA;18.16;1.00;0.34;NA
+COSER_TEST;2010;TRAIT3;COSER_SPECIES4;i;NA;10.22;2.00;0.31;NA
+COSER_TEST;2010;TRAIT3;COSER_SPECIES4;f;NA;33.03;5.00;0.26;NA
+COSER_TEST;2011;TRAIT1;COSER_SPECIES1;i;NA;1.00;4.00;0.81;NA
+COSER_TEST;2011;TRAIT1;COSER_SPECIES2;i;NA;27.61;3.00;NA
+COSER_TEST;2011;TRAIT1;COSER_SPECIES3;i;NA;20.44;3.00;0.43;NA
+COSER_TEST;2011;TRAIT1;COSER_SPECIES4;i;NA;6.86;1.00;0.23;NA
+COSER_TEST;2011;TRAIT2;COSER_SPECIES1;i;NA;15.04;4.00;0.95;NA
+COSER_TEST;2011;TRAIT2;COSER_SPECIES2;i;NA;35.03;1.00;0.26;NA
+COSER_TEST;2011;TRAIT2;COSER_SPECIES3;i;NA;19.41;1.00;0.51;NA
+COSER_TEST;2011;TRAIT2;COSER_SPECIES4;i;NA;24.58;2.00;NA
+COSER_TEST;2011;TRAIT3;COSER_SPECIES1;i;NA;2.46;3.00;0.32;NA
+COSER_TEST;2011;TRAIT3;COSER_SPECIES2;i;NA;18.93;5.00;0.22;NA
+COSER_TEST;2011;TRAIT3;COSER_SPECIES3;i;NA;23.77;5.00;0.12;NA
+COSER_TEST;2011;TRAIT3;COSER_SPECIES4;i;NA;0.94;3.00;0.77;NA
Added: trunk/coser-business/src/test/resources/projects/projectctrvalidated/original/teststrata.csv
===================================================================
--- trunk/coser-business/src/test/resources/projects/projectctrvalidated/original/teststrata.csv (rev 0)
+++ trunk/coser-business/src/test/resources/projects/projectctrvalidated/original/teststrata.csv 2010-11-26 10:57:07 UTC (rev 287)
@@ -0,0 +1,11 @@
+Survey;Stratum;Surface
+COSER_TEST;STR1;15909.15
+COSER_TEST;STR2;11184.27
+COSER_TEST;STR3;5200.96
+COSER_TEST;STR4;15573.19
+COSER_TEST;STR5;8625.07
+COSER_TEST;STR6;10.20
+COSER_TEST;STR7;19683.28
+COSER_TEST;STR8;6053.53
+COSER_TEST;STR9;993.49
+COSER_TEST;STR10;5975.14
Added: trunk/coser-business/src/test/resources/projects/projectctrvalidated/project.properties
===================================================================
--- trunk/coser-business/src/test/resources/projects/projectctrvalidated/project.properties (rev 0)
+++ trunk/coser-business/src/test/resources/projects/projectctrvalidated/project.properties 2010-11-26 10:57:07 UTC (rev 287)
@@ -0,0 +1,5 @@
+#Fri Nov 26 11:37:55 CET 2010
+project.catchFileName=testcatch.csv
+project.strataFileName=teststrata.csv
+project.haulFileName=testhaul.csv
+project.lengthFileName=testlength.csv
Added: trunk/coser-business/src/test/resources/projects/projectctrvalidated/reftaxSpecies.csv
===================================================================
--- trunk/coser-business/src/test/resources/projects/projectctrvalidated/reftaxSpecies.csv (rev 0)
+++ trunk/coser-business/src/test/resources/projects/projectctrvalidated/reftaxSpecies.csv 2010-11-26 10:57:07 UTC (rev 287)
@@ -0,0 +1,6 @@
+"C_Perm";"NumSys";"NivSys";"C_VALIDE";"L_VALIDE";"AA_VALIDE";"C_TxPère";"Taxa"
+"1";"000001";"1";"COSER_SPECIES1";"L'espece de test coser 1";"";"";"";
+"2";"000002";"2";"COSER_SPECIES2";"L'espece de test coser 2";"";"";"";
+"3";"000003";"3";"COSER_SPECIES3";"L'espece de test coser 3";"";"";"";
+"4";"000004";"4";"COSER_SPECIES4";"L'espece de test coser 4";"";"";"";
+"5";"000005";"5";"COSER_SPECIES_MERGE";"L'espece de test coser pour fusion";"";"";"";
Added: trunk/coser-business/src/test/resources/projects/projectctrvalidated/selections/testselection1/testcatch_se.csv
===================================================================
--- trunk/coser-business/src/test/resources/projects/projectctrvalidated/selections/testselection1/testcatch_se.csv (rev 0)
+++ trunk/coser-business/src/test/resources/projects/projectctrvalidated/selections/testselection1/testcatch_se.csv 2010-11-26 10:57:07 UTC (rev 287)
@@ -0,0 +1,25 @@
+"coser.business.line";"Survey";"Year";"Haul";"Species";"Number";"Weight"
+"1";"COSER_TEST";"2010";"TRAIT1";"COSER_SPECIES1";"234.33";"4.55"
+"2";"COSER_TEST";"2010";"TRAIT1";"COSER_SPECIES2";"4.33";"1.12"
+"3";"COSER_TEST";"2010";"TRAIT1";"COSER_SPECIES3";"859.04";"22.16"
+"4";"COSER_TEST";"2010";"TRAIT1";"COSER_SPECIES4";"251.86";"59.34"
+"5";"COSER_TEST";"2010";"TRAIT2";"COSER_SPECIES1";"407.54";"81.37"
+"6";"COSER_TEST";"2010";"TRAIT2";"COSER_SPECIES2";"472.91";"59.38"
+"7";"COSER_TEST";"2010";"TRAIT2";"COSER_SPECIES3";"38.36";"41.60"
+"8";"COSER_TEST";"2010";"TRAIT2";"COSER_SPECIES4";"146.76";"76.15"
+"9";"COSER_TEST";"2010";"TRAIT3";"COSER_SPECIES1";"737.53";"32.27"
+"10";"COSER_TEST";"2010";"TRAIT3";"COSER_SPECIES2";"715.54";"91.42"
+"11";"COSER_TEST";"2010";"TRAIT3";"COSER_SPECIES3";"256.31";"55.32"
+"12";"COSER_TEST";"2010";"TRAIT3";"COSER_SPECIES4";"308.81";"85.96"
+"13";"COSER_TEST";"2011";"TRAIT10";"COSER_SPECIES1";"326.53";"0.55"
+"14";"COSER_TEST";"2011";"TRAIT10";"COSER_SPECIES2";"965.46";"75.30"
+"15";"COSER_TEST";"2011";"TRAIT10";"COSER_SPECIES3";"187.44";"45.04"
+"16";"COSER_TEST";"2011";"TRAIT10";"COSER_SPECIES4";"714.22";"25.60"
+"17";"COSER_TEST";"2011";"TRAIT20";"COSER_SPECIES1";"475.71";"51.42"
+"18";"COSER_TEST";"2011";"TRAIT20";"COSER_SPECIES2";"661.88";"82.41"
+"19";"COSER_TEST";"2011";"TRAIT20";"COSER_SPECIES3";"378.28";"27.32"
+"20";"COSER_TEST";"2011";"TRAIT20";"COSER_SPECIES4";"139.31";"11.74"
+"21";"COSER_TEST";"2011";"TRAIT30";"COSER_SPECIES1";"810.68";"67.38"
+"22";"COSER_TEST";"2011";"TRAIT30";"COSER_SPECIES2";"783.03";"40.36"
+"23";"COSER_TEST";"2011";"TRAIT30";"COSER_SPECIES3";"244.24";"87.85"
+"24";"COSER_TEST";"2011";"TRAIT30";"COSER_SPECIES4";"52.71";"22.93"
Added: trunk/coser-business/src/test/resources/projects/projectctrvalidated/selections/testselection1/testhaul_se.csv
===================================================================
--- trunk/coser-business/src/test/resources/projects/projectctrvalidated/selections/testselection1/testhaul_se.csv (rev 0)
+++ trunk/coser-business/src/test/resources/projects/projectctrvalidated/selections/testselection1/testhaul_se.csv 2010-11-26 10:57:07 UTC (rev 287)
@@ -0,0 +1,7 @@
+"coser.business.line";"Survey";"Year";"Haul";"Month";"Stratum";"SweptSurface";"Lat";"Long";"Depth"
+"1";"COSER_TEST";"2010";"TRAIT1";"10";"STR1";"0.06";"43.75";"-1.50";"45.50"
+"2";"COSER_TEST";"2010";"TRAIT2";"10";"STR2";"0.06";"43.81";"-1.45";"31.00"
+"3";"COSER_TEST";"2010";"TRAIT3";"10";"STR3";"0.06";"43.89";"-1.73";"115.00"
+"4";"COSER_TEST";"2011";"TRAIT10";"10";"STR4";"0.06";"43.96";"-2.03";"143.00"
+"5";"COSER_TEST";"2011";"TRAIT20";"10";"STR5";"0.06";"43.91";"-2.09";"185.00"
+"6";"COSER_TEST";"2011";"TRAIT30";"10";"STR6";"0.06";"43.88";"-2.12";"295.00"
Added: trunk/coser-business/src/test/resources/projects/projectctrvalidated/selections/testselection1/testlength_se.csv
===================================================================
--- trunk/coser-business/src/test/resources/projects/projectctrvalidated/selections/testselection1/testlength_se.csv (rev 0)
+++ trunk/coser-business/src/test/resources/projects/projectctrvalidated/selections/testselection1/testlength_se.csv 2010-11-26 10:57:07 UTC (rev 287)
@@ -0,0 +1,30 @@
+"coser.business.line";"Survey";"Year";"Haul";"Species";"Sex";"Maturity";"Length";"Number";"Weight";"Age"
+"1";"COSER_TEST";"2010";"TRAIT1";"COSER_SPECIES1";"i";"NA";"29.19";"1.00";"0.45";"NA"
+"2";"COSER_TEST";"2010";"TRAIT1";"COSER_SPECIES2";"i";"NA";"19.60";"2.00";"0.34";"NA"
+"3";"COSER_TEST";"2010";"TRAIT1";"COSER_SPECIES2";"i";"NA";"19.60";"3.00";"0.78";"NA"
+"4";"COSER_TEST";"2010";"TRAIT1";"COSER_SPECIES3";"i";"NA";"32.93";"5.00";"0.87";"NA"
+"5";"COSER_TEST";"2010";"TRAIT1";"COSER_SPECIES3";"f";"NA";"26.27";"3.00";"0.03";"NA"
+"6";"COSER_TEST";"2010";"TRAIT1";"COSER_SPECIES3";"m";"NA";"35.25";"4.00";"";"NA"
+"7";"COSER_TEST";"2010";"TRAIT1";"COSER_SPECIES4";"i";"NA";"37.82";"4.00";"0.61";"NA"
+"8";"COSER_TEST";"2010";"TRAIT2";"COSER_SPECIES1";"i";"NA";"20.07";"2.00";"0.12";"NA"
+"9";"COSER_TEST";"2010";"TRAIT2";"COSER_SPECIES1";"i";"NA";"27.18";"2.00";"0.92";"NA"
+"10";"COSER_TEST";"2010";"TRAIT2";"COSER_SPECIES2";"i";"NA";"21.14";"1.00";"0.34";"NA"
+"11";"COSER_TEST";"2010";"TRAIT2";"COSER_SPECIES3";"i";"NA";"1.82";"4.00";"0.1";"NA"
+"12";"COSER_TEST";"2010";"TRAIT2";"COSER_SPECIES4";"i";"NA";"36.55";"4.00";"0.39";"NA"
+"13";"COSER_TEST";"2010";"TRAIT3";"COSER_SPECIES1";"i";"NA";"20.39";"3.00";"0.28";"NA"
+"14";"COSER_TEST";"2010";"TRAIT3";"COSER_SPECIES2";"i";"NA";"19.88";"3.00";"0.31";"NA"
+"15";"COSER_TEST";"2010";"TRAIT3";"COSER_SPECIES3";"i";"NA";"18.16";"1.00";"0.34";"NA"
+"16";"COSER_TEST";"2010";"TRAIT3";"COSER_SPECIES4";"i";"NA";"10.22";"2.00";"0.31";"NA"
+"17";"COSER_TEST";"2010";"TRAIT3";"COSER_SPECIES4";"f";"NA";"33.03";"5.00";"0.26";"NA"
+"18";"COSER_TEST";"2011";"TRAIT1";"COSER_SPECIES1";"i";"NA";"1.00";"4.00";"0.81";"NA"
+"19";"COSER_TEST";"2011";"TRAIT1";"COSER_SPECIES2";"i";"NA";"27.61";"3.00";"NA"
+"20";"COSER_TEST";"2011";"TRAIT1";"COSER_SPECIES3";"i";"NA";"20.44";"3.00";"0.43";"NA"
+"21";"COSER_TEST";"2011";"TRAIT1";"COSER_SPECIES4";"i";"NA";"6.86";"1.00";"0.23";"NA"
+"22";"COSER_TEST";"2011";"TRAIT2";"COSER_SPECIES1";"i";"NA";"15.04";"4.00";"0.95";"NA"
+"23";"COSER_TEST";"2011";"TRAIT2";"COSER_SPECIES2";"i";"NA";"35.03";"1.00";"0.26";"NA"
+"24";"COSER_TEST";"2011";"TRAIT2";"COSER_SPECIES3";"i";"NA";"19.41";"1.00";"0.51";"NA"
+"25";"COSER_TEST";"2011";"TRAIT2";"COSER_SPECIES4";"i";"NA";"24.58";"2.00";"NA"
+"26";"COSER_TEST";"2011";"TRAIT3";"COSER_SPECIES1";"i";"NA";"2.46";"3.00";"0.32";"NA"
+"27";"COSER_TEST";"2011";"TRAIT3";"COSER_SPECIES2";"i";"NA";"18.93";"5.00";"0.22";"NA"
+"28";"COSER_TEST";"2011";"TRAIT3";"COSER_SPECIES3";"i";"NA";"23.77";"5.00";"0.12";"NA"
+"29";"COSER_TEST";"2011";"TRAIT3";"COSER_SPECIES4";"i";"NA";"0.94";"3.00";"0.77";"NA"
Added: trunk/coser-business/src/test/resources/projects/projectctrvalidated/selections/testselection1/testselection1.selection
===================================================================
--- trunk/coser-business/src/test/resources/projects/projectctrvalidated/selections/testselection1/testselection1.selection (rev 0)
+++ trunk/coser-business/src/test/resources/projects/projectctrvalidated/selections/testselection1/testselection1.selection 2010-11-26 10:57:07 UTC (rev 287)
@@ -0,0 +1,7 @@
+#Fri Nov 26 11:37:55 CET 2010
+selection.validated=false
+selection.densityFilter=3.5
+selection.occurrenceFilter=3.75
+selection.commands.0=(57dc29ae-9991-4f0c-9233-9ab0a5a4ccf4);(MergeSpeciesCommand);();((newSpecyName\=COSER_SPECIES_MERGE);(speciesNames\=(COSER_SPECIES1);(COSER_SPECIES2)))
+selection.selectedSpeciesOccDensComment=Test selectedSpeciesOccDensComment
+selection.comment=Selection test
Added: trunk/coser-business/src/test/resources/projects/projectctrvalidated/selections/testselection1/teststrata_se.csv
===================================================================
--- trunk/coser-business/src/test/resources/projects/projectctrvalidated/selections/testselection1/teststrata_se.csv (rev 0)
+++ trunk/coser-business/src/test/resources/projects/projectctrvalidated/selections/testselection1/teststrata_se.csv 2010-11-26 10:57:07 UTC (rev 287)
@@ -0,0 +1,11 @@
+"coser.business.line";"Survey";"Stratum";"Surface"
+"1";"COSER_TEST";"STR1";"15909.15"
+"2";"COSER_TEST";"STR2";"11184.27"
+"3";"COSER_TEST";"STR3";"5200.96"
+"4";"COSER_TEST";"STR4";"15573.19"
+"5";"COSER_TEST";"STR5";"8625.07"
+"6";"COSER_TEST";"STR6";"10.20"
+"7";"COSER_TEST";"STR7";"19683.28"
+"8";"COSER_TEST";"STR8";"6053.53"
+"9";"COSER_TEST";"STR9";"993.49"
+"10";"COSER_TEST";"STR10";"5975.14"
1
0
r286 - trunk/coser-business/src/test/java/fr/ifremer/coser/services
by chatellier@users.labs.libre-entreprise.org 26 Nov '10
by chatellier@users.labs.libre-entreprise.org 26 Nov '10
26 Nov '10
Author: chatellier
Date: 2010-11-26 10:31:48 +0000 (Fri, 26 Nov 2010)
New Revision: 286
Log:
Conservation et utilisation des noms originaux des fichiers utilisateur
Modified:
trunk/coser-business/src/test/java/fr/ifremer/coser/services/CoserTestAbstract.java
trunk/coser-business/src/test/java/fr/ifremer/coser/services/ProjectServiceTest.java
Modified: trunk/coser-business/src/test/java/fr/ifremer/coser/services/CoserTestAbstract.java
===================================================================
--- trunk/coser-business/src/test/java/fr/ifremer/coser/services/CoserTestAbstract.java 2010-11-26 10:28:18 UTC (rev 285)
+++ trunk/coser-business/src/test/java/fr/ifremer/coser/services/CoserTestAbstract.java 2010-11-26 10:31:48 UTC (rev 286)
@@ -108,6 +108,11 @@
categoriesAndFile.put(Category.REFTAX_SPECIES, testReftax);
categoriesAndFile.put(Category.TYPE_ESPECES, testTypeEspeces);
+ project.setCatchFileName(testCatch.getName());
+ project.setLengthFileName(testLength.getName());
+ project.setHaulFileName(testHaul.getName());
+ project.setStrataFileName(testStrata.getName());
+
project = projectService.createProject(project, categoriesAndFile);
project = projectService.loadControlData(project);
Modified: trunk/coser-business/src/test/java/fr/ifremer/coser/services/ProjectServiceTest.java
===================================================================
--- trunk/coser-business/src/test/java/fr/ifremer/coser/services/ProjectServiceTest.java 2010-11-26 10:28:18 UTC (rev 285)
+++ trunk/coser-business/src/test/java/fr/ifremer/coser/services/ProjectServiceTest.java 2010-11-26 10:31:48 UTC (rev 286)
@@ -93,13 +93,13 @@
Project project = createTestProject(projectService, false);
Assert.assertTrue(new File(config.getProjectsDirectory(),
- project.getName() + File.separator + "original" + File.separator + "catch.csv").exists());
+ project.getName() + File.separator + "original" + File.separator + "testcatch.csv").exists());
Assert.assertTrue(new File(config.getProjectsDirectory(),
- project.getName() + File.separator + "original" + File.separator + "haul.csv").exists());
+ project.getName() + File.separator + "original" + File.separator + "testhaul.csv").exists());
Assert.assertTrue(new File(config.getProjectsDirectory(),
- project.getName() + File.separator + "original" + File.separator + "strata.csv").exists());
+ project.getName() + File.separator + "original" + File.separator + "teststrata.csv").exists());
Assert.assertTrue(new File(config.getProjectsDirectory(),
- project.getName() + File.separator + "original" + File.separator + "length.csv").exists());
+ project.getName() + File.separator + "original" + File.separator + "testlength.csv").exists());
Assert.assertTrue(new File(config.getProjectsDirectory(),
project.getName() + File.separator + "reftaxSpecies.csv").exists());
}
@@ -116,7 +116,7 @@
projectService.saveProjectControl(project);
Assert.assertTrue(new File(config.getProjectsDirectory(),
- project.getName() + File.separator + "control" + File.separator + "catch_co.csv").exists());
+ project.getName() + File.separator + "control" + File.separator + "testcatch_co.csv").exists());
}
/**
@@ -133,7 +133,7 @@
Assert.assertTrue(new File(config.getProjectsDirectory(),
project.getName() + File.separator + "selections" + File.separator +
- "titi" + File.separator + "catch_se.csv").exists());
+ "titi" + File.separator + "testcatch_se.csv").exists());
}
/**
1
0
r285 - in trunk: coser-business/src/main/java/fr/ifremer/coser coser-business/src/main/java/fr/ifremer/coser/bean coser-business/src/main/java/fr/ifremer/coser/services coser-business/src/test/java/fr/ifremer/coser coser-business/src/test/resources coser-ui/src/main/java/fr/ifremer/coser/ui
by chatellier@users.labs.libre-entreprise.org 26 Nov '10
by chatellier@users.labs.libre-entreprise.org 26 Nov '10
26 Nov '10
Author: chatellier
Date: 2010-11-26 10:28:18 +0000 (Fri, 26 Nov 2010)
New Revision: 285
Log:
Conservation et utilisation des noms originaux des fichiers utilisateur
Added:
trunk/coser-business/src/test/java/fr/ifremer/coser/CoserUtilsTest.java
Modified:
trunk/coser-business/src/main/java/fr/ifremer/coser/CoserConstants.java
trunk/coser-business/src/main/java/fr/ifremer/coser/CoserUtils.java
trunk/coser-business/src/main/java/fr/ifremer/coser/bean/Project.java
trunk/coser-business/src/main/java/fr/ifremer/coser/services/ProjectService.java
trunk/coser-business/src/test/resources/log4j.properties
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/CoserFrameHandler.java
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/CoserConstants.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/CoserConstants.java 2010-11-26 09:36:00 UTC (rev 284)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/CoserConstants.java 2010-11-26 10:28:18 UTC (rev 285)
@@ -68,17 +68,14 @@
/** Suffix des nom de fichiers data apres selection. */
public static final String STORAGE_SELECTION_SUFFIX = "_se";
- /** Extension des fichiers CSV. */
- public static final String STORAGE_CSV_EXTENSION = ".csv";
-
/** Categories des données manipulées. */
public static enum Category {
- CATCH(n_("coser.business.category.catch"), "catch"),
- STRATA(n_("coser.business.category.strata"), "strata"),
- HAUL(n_("coser.business.category.haul"), "haul"),
- LENGTH(n_("coser.business.category.length"), "length"),
- REFTAX_SPECIES(n_("coser.business.category.reftax.species"), "reftaxSpecies", false),
- TYPE_ESPECES(n_("coser.business.category.typeEspece"), "codeTypeEspeces", false);
+ CATCH(n_("coser.business.category.catch"), "catch.csv", true),
+ STRATA(n_("coser.business.category.strata"), "strata.csv", true),
+ HAUL(n_("coser.business.category.haul"), "haul.csv", true),
+ LENGTH(n_("coser.business.category.length"), "length.csv", true),
+ REFTAX_SPECIES(n_("coser.business.category.reftax.species"), "reftaxSpecies.csv", false),
+ TYPE_ESPECES(n_("coser.business.category.typeEspece"), "codeTypeEspeces.csv", false);
protected String translationKey;
protected String storageFileName;
@@ -92,15 +89,23 @@
this.dataCategory = dataCategory;
}
- private Category(String translationKey, String storageFileName) {
- this(translationKey, storageFileName, true);
- }
-
public String getTranslationKey() {
return translationKey;
}
-
+
+ /**
+ * Nom de stockage interne a coser.
+ *
+ * N'est pas utilisé pour les categorie de données (nom original utilisé).
+ *
+ * @return le nom de stockage (pour les fichier de référence)
+ */
public String getStorageFileName() {
+
+ if (dataCategory) {
+ throw new IllegalStateException("Can't use storageFileName for data category !");
+ }
+
return storageFileName;
}
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/CoserUtils.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/CoserUtils.java 2010-11-26 09:36:00 UTC (rev 284)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/CoserUtils.java 2010-11-26 10:28:18 UTC (rev 285)
@@ -28,6 +28,8 @@
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import org.apache.commons.lang.StringUtils;
import org.nuiton.util.StringUtil;
@@ -45,6 +47,9 @@
public static final String BRACKET_STRING_SEPARATOR = ";";
+ /** Pattern pour ajouter les suffix (probleme de replace sur le 'dernier' .) */
+ public static Pattern FILENAME_SUFFIX_PATTERN = Pattern.compile("^(.+)(\\.[^\\.]+)$");
+
/**
* Converti une collection de string en une string
* delimité par les () pour pouvoir être facilement relu par
@@ -86,4 +91,28 @@
}
return listArgs;
}
+
+ /**
+ * Dans un nom de fichier, ajoute un suffix dans le nom du fichier
+ * juste avant l'extension.
+ *
+ * Exemple :
+ * captures.csv > captures_co.csv (ajout du suffix _co)
+ * captures > captures_co (si pas d'extension)
+ *
+ * @param str nom du fichier
+ * @param suffix suffix a ajouter
+ * @return nouveau nom du fichier
+ */
+ public static String addSuffixBeforeExtension(String str, String suffix) {
+ String result = null;
+ Matcher matcher = FILENAME_SUFFIX_PATTERN.matcher(str);
+ if (matcher.matches()) {
+ result = matcher.group(1) + suffix + matcher.group(2);
+ }
+ else {
+ result = str + suffix;
+ }
+ return result;
+ }
}
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/bean/Project.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/bean/Project.java 2010-11-26 09:36:00 UTC (rev 284)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/bean/Project.java 2010-11-26 10:28:18 UTC (rev 285)
@@ -75,6 +75,19 @@
/** Utilisé seulement lors de la création du projet (sinon, non valorisé). */
protected String strataFile;
+ /** Nom original du fichier de captures. */
+ protected String catchFileName;
+
+ /** Nom original du fichier de traits. */
+ protected String haulFileName;
+
+ /** Nom original du fichier de tailles. */
+ protected String lengthFileName;
+
+ /** Nom original du fichier de strates. */
+ protected String strataFileName;
+
+ /** Commentaire du projet. */
protected String comment;
protected Control control;
@@ -147,6 +160,38 @@
getPropertyChangeSupport().firePropertyChange("strataFile", oldValue, strataFile);
}
+ public String getCatchFileName() {
+ return catchFileName;
+ }
+
+ public void setCatchFileName(String catchFileName) {
+ this.catchFileName = catchFileName;
+ }
+
+ public String getHaulFileName() {
+ return haulFileName;
+ }
+
+ public void setHaulFileName(String haulFileName) {
+ this.haulFileName = haulFileName;
+ }
+
+ public String getLengthFileName() {
+ return lengthFileName;
+ }
+
+ public void setLengthFileName(String lengthFileName) {
+ this.lengthFileName = lengthFileName;
+ }
+
+ public String getStrataFileName() {
+ return strataFileName;
+ }
+
+ public void setStrataFileName(String strataFileName) {
+ this.strataFileName = strataFileName;
+ }
+
public String getComment() {
return comment;
}
@@ -216,6 +261,18 @@
if (author != null) {
props.setProperty("project.author", author);
}
+ if (catchFileName != null) {
+ props.setProperty("project.catchFileName", catchFileName);
+ }
+ if (lengthFileName != null) {
+ props.setProperty("project.lengthFileName", lengthFileName);
+ }
+ if (haulFileName != null) {
+ props.setProperty("project.haulFileName", haulFileName);
+ }
+ if (strataFileName != null) {
+ props.setProperty("project.strataFileName", strataFileName);
+ }
if (comment != null) {
props.setProperty("project.comment", comment);
}
@@ -226,6 +283,18 @@
if (props.containsKey("project.author")) {
setAuthor(props.getProperty("project.author"));
}
+ if (props.containsKey("project.catchFileName")) {
+ setCatchFileName(props.getProperty("project.catchFileName"));
+ }
+ if (props.containsKey("project.lengthFileName")) {
+ setLengthFileName(props.getProperty("project.lengthFileName"));
+ }
+ if (props.containsKey("project.haulFileName")) {
+ setHaulFileName(props.getProperty("project.haulFileName"));
+ }
+ if (props.containsKey("project.strataFileName")) {
+ setStrataFileName(props.getProperty("project.strataFileName"));
+ }
if (props.containsKey("control.comment")) {
setComment(props.getProperty("control.comment"));
}
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/services/ProjectService.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/services/ProjectService.java 2010-11-26 09:36:00 UTC (rev 284)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/services/ProjectService.java 2010-11-26 10:28:18 UTC (rev 285)
@@ -187,19 +187,19 @@
Category category = categoryAndFile.getKey();
File dataFile = categoryAndFile.getValue();
try {
-
+
// les fichiers de donnees sont stockes dans un repertoire
// "original"
if (category.isDataCategory()) {
- File storageDataFile = new File(originalDirectory,
- category.getStorageFileName() + CoserConstants.STORAGE_CSV_EXTENSION);
+ String storageFileName = getDataStorageFileName(project, category, null);
+ File storageDataFile = new File(originalDirectory, storageFileName);
FileUtils.copyFile(dataFile, storageDataFile);
}
// les fichiers autres (reftax) sont stockes a la base
else {
File storageDataFile = new File(projectDirectory,
- category.getStorageFileName() + CoserConstants.STORAGE_CSV_EXTENSION);
+ category.getStorageFileName());
FileUtils.copyFile(dataFile, storageDataFile);
}
} catch (IOException ex) {
@@ -240,6 +240,42 @@
}
/**
+ * Retourne le nom de stockage d'un fichier de données suivant la categories
+ * de fichier demandé. Les fichiers sont stockés avec leurs noms originaux
+ * (sauf les fichiers de réference) donc il n'est pas fixe.
+ *
+ * @param project project (containing originals file names)
+ * @param category category to get file name
+ * @param suffix suffix to add into file name
+ * @return storage file name
+ */
+ protected String getDataStorageFileName(Project project, Category category, String suffix) {
+
+ String result = null;
+
+ switch (category) {
+ case CATCH:
+ result = project.getCatchFileName();
+ break;
+ case HAUL:
+ result = project.getHaulFileName();
+ break;
+ case LENGTH:
+ result = project.getLengthFileName();
+ break;
+ case STRATA:
+ result = project.getStrataFileName();
+ break;
+ }
+
+ if (suffix != null) {
+ result = CoserUtils.addSuffixBeforeExtension(result, suffix);
+ }
+
+ return result;
+ }
+
+ /**
* Open project without loading data.
*
* Just load non category data (reftax).
@@ -263,8 +299,7 @@
// load only additional files
if (!category.isDataCategory()) {
File inputFile = new File(projectDirectory,
- category.getStorageFileName() +
- CoserConstants.STORAGE_CSV_EXTENSION);
+ category.getStorageFileName());
if (inputFile.isFile()) {
DataStorage dataStorage = importService.loadCSVFile(project, category, inputFile, false);
@@ -432,8 +467,8 @@
// seulement les category de données ici
if (category.isDataCategory()) {
- File inputFile = new File(controlDirectory, category.getStorageFileName() +
- CoserConstants.STORAGE_CONTROL_SUFFIX + CoserConstants.STORAGE_CSV_EXTENSION);
+ String storageFileName = getDataStorageFileName(project, category, CoserConstants.STORAGE_CONTROL_SUFFIX);
+ File inputFile = new File(controlDirectory, storageFileName);
if (inputFile.isFile()) {
DataStorage dataStorage = importService.loadCSVFile(project, category, inputFile, false);
@@ -447,8 +482,8 @@
}
// load deleted file if exists
- inputFile = new File(controlDirectory, category.getStorageFileName() +
- CoserConstants.STORAGE_DELECTED_SUFFIX + CoserConstants.STORAGE_CSV_EXTENSION);
+ storageFileName = getDataStorageFileName(project, category, CoserConstants.STORAGE_DELECTED_SUFFIX);
+ inputFile = new File(controlDirectory, storageFileName);
DataStorage dataStorage = null;
if (inputFile.isFile()) {
dataStorage = importService.loadCSVFile(project, category, inputFile, false);
@@ -469,8 +504,8 @@
for (Category category : Category.values()) {
if (category.isDataCategory()) {
- File storageDataFile = new File(originalDirectory,
- category.getStorageFileName() + CoserConstants.STORAGE_CSV_EXTENSION);
+ String storageFileName = getDataStorageFileName(project, category, null);
+ File storageDataFile = new File(originalDirectory, storageFileName);
// main data
if (storageDataFile.isFile()) {
@@ -545,8 +580,8 @@
// seulement les category de données ici
if (category.isDataCategory()) {
- File inputFile = new File(selectionDirectory, category.getStorageFileName() +
- CoserConstants.STORAGE_SELECTION_SUFFIX + CoserConstants.STORAGE_CSV_EXTENSION);
+ String storageFileName = getDataStorageFileName(project, category, CoserConstants.STORAGE_SELECTION_SUFFIX);
+ File inputFile = new File(selectionDirectory, storageFileName);
if (inputFile.isFile()) {
DataStorage dataStorage = importService.loadCSVFile(project, category, inputFile, false);
@@ -605,10 +640,8 @@
if (category.isDataCategory()) {
// save main content
- File controlFile = new File(controlDirectory,
- category.getStorageFileName() +
- CoserConstants.STORAGE_CONTROL_SUFFIX +
- CoserConstants.STORAGE_CSV_EXTENSION);
+ String storageFileName = getDataStorageFileName(project, category, CoserConstants.STORAGE_CONTROL_SUFFIX);
+ File controlFile = new File(controlDirectory, storageFileName);
if (log.isDebugEnabled()) {
log.debug("Saving control file : " + controlFile);
}
@@ -619,10 +652,8 @@
DataStorage contentDeleted = getProjectContent(project, control, category, true);
// if more content than header
if (contentDeleted.size() > 1) {
- File deletedDataFile = new File(controlDirectory,
- category.getStorageFileName() +
- CoserConstants.STORAGE_DELECTED_SUFFIX +
- CoserConstants.STORAGE_CSV_EXTENSION);
+ String deletedFileName = getDataStorageFileName(project, category, CoserConstants.STORAGE_DELECTED_SUFFIX);
+ File deletedDataFile = new File(controlDirectory, deletedFileName);
importService.storeData(project, contentDeleted, deletedDataFile);
}
}
@@ -758,10 +789,8 @@
for (Category category : Category.values()) {
if (category.isDataCategory()) {
- File dataFile = new File(selectionDirectory,
- category.getStorageFileName() +
- CoserConstants.STORAGE_SELECTION_SUFFIX +
- CoserConstants.STORAGE_CSV_EXTENSION);
+ String storageFileName = getDataStorageFileName(project, category, CoserConstants.STORAGE_SELECTION_SUFFIX);
+ File dataFile = new File(selectionDirectory, storageFileName);
if (log.isDebugEnabled()) {
log.debug("Saving selection file : " + dataFile);
}
Added: trunk/coser-business/src/test/java/fr/ifremer/coser/CoserUtilsTest.java
===================================================================
--- trunk/coser-business/src/test/java/fr/ifremer/coser/CoserUtilsTest.java (rev 0)
+++ trunk/coser-business/src/test/java/fr/ifremer/coser/CoserUtilsTest.java 2010-11-26 10:28:18 UTC (rev 285)
@@ -0,0 +1,51 @@
+/*
+ * #%L
+ *
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2010 Ifremer, Codelutin, Chatellier Eric
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser 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 Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+package fr.ifremer.coser;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Coser utils tests.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class CoserUtilsTest {
+
+ /**
+ * Test l'ajout de suffix dans les noms de fichier.
+ */
+ @Test
+ public void testAddSuffixBeforeExtension() {
+ Assert.assertEquals("captures_co.csv", CoserUtils.addSuffixBeforeExtension("captures.csv", CoserConstants.STORAGE_CONTROL_SUFFIX));
+ Assert.assertEquals("cap.tu.res_se.csv", CoserUtils.addSuffixBeforeExtension("cap.tu.res.csv", CoserConstants.STORAGE_SELECTION_SUFFIX));
+ Assert.assertEquals("captures_co", CoserUtils.addSuffixBeforeExtension("captures", CoserConstants.STORAGE_CONTROL_SUFFIX));
+ }
+}
Property changes on: trunk/coser-business/src/test/java/fr/ifremer/coser/CoserUtilsTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/coser-business/src/test/resources/log4j.properties
===================================================================
--- trunk/coser-business/src/test/resources/log4j.properties 2010-11-26 09:36:00 UTC (rev 284)
+++ trunk/coser-business/src/test/resources/log4j.properties 2010-11-26 10:28:18 UTC (rev 285)
@@ -32,5 +32,5 @@
log4j.appender.stdout.layout.ConversionPattern=%d{HH:mm:ss} %-5p %c:%L - %m%n
# Categories
-log4j.category.fr.ifremer.coser=DEBUG
+#log4j.category.fr.ifremer.coser=DEBUG
#log4j.category.com.opensymphony.xwork2=DEBUG
Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/CoserFrameHandler.java
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/CoserFrameHandler.java 2010-11-26 09:36:00 UTC (rev 284)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/CoserFrameHandler.java 2010-11-26 10:28:18 UTC (rev 285)
@@ -239,6 +239,12 @@
File reftaxSpeciesFile = new File(reftaxSpeciesPath);
File codeTypeEspeceFile = new File(codeTypeEspecePath);
+ // remember original file names
+ project.setCatchFileName(capturesFile.getName());
+ project.setLengthFileName(taillesFile.getName());
+ project.setHaulFileName(traitsFile.getName());
+ project.setStrataFileName(stratesFile.getName());
+
// check some files existences
if (!reftaxSpeciesFile.canRead()) {
JOptionPane.showMessageDialog(projectView, _("coser.ui.project.createProjectMissingReftax"),
1
0