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
January 2011
- 1 participants
- 174 discussions
Author: chatellier
Date: 2011-01-14 14:23:15 +0000 (Fri, 14 Jan 2011)
New Revision: 507
Log:
commons-io not used
Modified:
trunk/coser-ui/pom.xml
Modified: trunk/coser-ui/pom.xml
===================================================================
--- trunk/coser-ui/pom.xml 2011-01-14 14:19:54 UTC (rev 506)
+++ trunk/coser-ui/pom.xml 2011-01-14 14:23:15 UTC (rev 507)
@@ -30,10 +30,6 @@
<artifactId>commons-logging</artifactId>
</dependency>
<dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- </dependency>
- <dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
</dependency>
1
0
r506 - trunk/coser-business/src/main/java/fr/ifremer/coser/services
by chatellier@users.labs.libre-entreprise.org 14 Jan '11
by chatellier@users.labs.libre-entreprise.org 14 Jan '11
14 Jan '11
Author: chatellier
Date: 2011-01-14 14:19:54 +0000 (Fri, 14 Jan 2011)
New Revision: 506
Log:
Fix import
Modified:
trunk/coser-business/src/main/java/fr/ifremer/coser/services/ControlService.java
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/services/ControlService.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/services/ControlService.java 2011-01-14 14:05:29 UTC (rev 505)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/services/ControlService.java 2011-01-14 14:19:54 UTC (rev 506)
@@ -42,7 +42,7 @@
import java.util.regex.Pattern;
import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.lang.xwork.StringUtils;
+import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -61,6 +61,7 @@
import fr.ifremer.coser.CoserBusinessConfig;
import fr.ifremer.coser.CoserConstants.Category;
import fr.ifremer.coser.CoserConstants.ValidationLevel;
+import fr.ifremer.coser.bean.AbstractDataContainer;
import fr.ifremer.coser.bean.Control;
import fr.ifremer.coser.bean.Project;
import fr.ifremer.coser.control.ControlError;
1
0
r505 - 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/main/java/fr/ifremer/coser/util coser-business/src/main/resources/i18n coser-business/src/test/java/fr/ifremer/coser/services coser-ui/src/main/java/fr/ifremer/coser/ui coser-ui/src/main/java/fr/ifremer/coser/ui/common coser-ui/src/main/java/fr/ifremer/coser/ui/control coser-ui/src/main/java/fr/ifremer/cose
by chatellier@users.labs.libre-entreprise.org 14 Jan '11
by chatellier@users.labs.libre-entreprise.org 14 Jan '11
14 Jan '11
Author: chatellier
Date: 2011-01-14 14:05:29 +0000 (Fri, 14 Jan 2011)
New Revision: 505
Log:
Interface d'admin de selection de resultat.
Modification cot?\195?\169 web pour la r?\195?\169ception des r?\195?\169sultats.
Nombreuse corrections apres retours.
Added:
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/ExportUploadDialog.jaxx
Modified:
trunk/coser-business/src/main/java/fr/ifremer/coser/CoserBusinessConfig.java
trunk/coser-business/src/main/java/fr/ifremer/coser/bean/Project.java
trunk/coser-business/src/main/java/fr/ifremer/coser/bean/RSufiResult.java
trunk/coser-business/src/main/java/fr/ifremer/coser/services/ImportService.java
trunk/coser-business/src/main/java/fr/ifremer/coser/services/ProjectService.java
trunk/coser-business/src/main/java/fr/ifremer/coser/services/WebService.java
trunk/coser-business/src/main/java/fr/ifremer/coser/util/ProgressStream.java
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-business/src/test/java/fr/ifremer/coser/services/ProjectServiceTest.java
trunk/coser-business/src/test/java/fr/ifremer/coser/services/WebServiceTest.java
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/CoserFrameHandler.java
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/common/CommonHandler.java
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlHandler.java
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/project/ProjectHandler.java
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/OtherDataFileListModel.java
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/ResultHandler.java
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/ResultTableModel.java
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/RsufiResultRenderer.java
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/RsufiResultTreeModel.java
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/SelectUploadResultView.jaxx
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/SelectionAddResultDialog.jaxx
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/ZoneComboBoxModel.java
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/ZoneComboBoxRenderer.java
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/selection/SelectionDetailsView.jaxx
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/selection/SelectionHandler.java
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/util/ErrorHelper.java
trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/widgets/ComponentTitledBorder.java
trunk/coser-ui/src/main/resources/fr/ifremer/coser/bean/RSufiResult-error-validation.xml
trunk/coser-ui/src/main/resources/i18n/coser-ui_en_GB.properties
trunk/coser-ui/src/main/resources/i18n/coser-ui_fr_FR.properties
trunk/coser-web/src/main/java/fr/ifremer/coser/web/CoserWebConfig.java
trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/UploadResultAction.java
trunk/coser-web/src/main/resources/i18n/coser-web_en_GB.properties
trunk/coser-web/src/main/resources/i18n/coser-web_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 2011-01-12 15:54:25 UTC (rev 504)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/CoserBusinessConfig.java 2011-01-14 14:05:29 UTC (rev 505)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2010 Ifremer, Codelutin, Chatellier Eric
+ * Copyright (C) 2010 - 2011 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
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 2011-01-12 15:54:25 UTC (rev 504)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/bean/Project.java 2011-01-14 14:05:29 UTC (rev 505)
@@ -103,8 +103,7 @@
protected Control control;
- // FIXME echatellier 20101217 compabilité avec les projets beta (a retirer pour la v1)
- protected Date creationDate = new Date(0);
+ protected Date creationDate;
protected Map<String, Selection> selections;
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/bean/RSufiResult.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/bean/RSufiResult.java 2011-01-12 15:54:25 UTC (rev 504)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/bean/RSufiResult.java 2011-01-14 14:05:29 UTC (rev 505)
@@ -42,8 +42,7 @@
/** serialVersionUID. */
private static final long serialVersionUID = -1337710082675120199L;
- // FIXME echatellier 20110111 compabilité avec les projets beta (a retirer pour la v1)
- protected Date creationDate = new Date(0);
+ protected Date creationDate;
protected String name;
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/services/ImportService.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/services/ImportService.java 2011-01-12 15:54:25 UTC (rev 504)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/services/ImportService.java 2011-01-14 14:05:29 UTC (rev 505)
@@ -217,8 +217,8 @@
throw new CoserBusinessException(_("Wrong header detected in file %s. Find : %s, expected %s or %s",
file.getAbsolutePath(),
StringUtils.join(line, ", "),
- StringUtils.join(enHeaders, ", "),
- StringUtils.join(frHeaders, ", ")));
+ StringUtils.join(frHeaders, ", "),
+ StringUtils.join(enHeaders, ", ")));
}
}
else {
@@ -262,12 +262,11 @@
/**
* Store project category data in specified file as csv.
*
- * @param project project containing data
* @param content content to save
* @param file file to save to
* @throws CoserBusinessException
*/
- public void storeData(Project project, DataStorage content, File file) throws CoserBusinessException {
+ public void storeData(DataStorage content, File file) throws CoserBusinessException {
// save content
CSVWriter csvWriter = null;
@@ -288,6 +287,49 @@
}
/**
+ * Store data without quoting every columns with "" (r specific demand).
+ *
+ * @param content content to save
+ * @param file file to save to
+ *
+ * @throws CoserBusinessException
+ */
+ public void storeDataWhithoutQuote(DataStorage content, File file) throws CoserBusinessException {
+ // save content
+ Writer writer = null;
+ try {
+ writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), CoserConstants.CSV_FILE_ENCODING));
+
+ Iterator<String[]> itContent = content.iterator();
+ while (itContent.hasNext()) {
+ String[] contentDatas = itContent.next();
+
+ // start at 1 to not output "line" column
+ for (int i = 1 ; i < contentDatas.length ; i++) {
+
+ if (i != 1) {
+ writer.write(CoserConstants.CSV_SEPARATOR_CHAR);
+ }
+
+ String contentData = contentDatas[i];
+ if (contentData.indexOf(CoserConstants.CSV_SEPARATOR_CHAR) > -1) {
+ writer.write("\"" + contentData + "\"");
+ }
+ else {
+ writer.write(contentData);
+ }
+ }
+ writer.write("\n");
+ }
+ } catch (IOException ex) {
+ throw new CoserBusinessException("Can't save data", ex);
+ }
+ finally {
+ IOUtils.closeQuietly(writer);
+ }
+ }
+
+ /**
* Lit le fichier demandé et sauve dans une map les lignes demandées.
*
* @param file file to read
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 2011-01-12 15:54:25 UTC (rev 504)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/services/ProjectService.java 2011-01-14 14:05:29 UTC (rev 505)
@@ -30,16 +30,17 @@
import java.beans.Introspector;
import java.io.BufferedOutputStream;
+import java.io.BufferedWriter;
import java.io.File;
-import java.io.FileFilter;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
+import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
-import java.nio.charset.Charset;
+import java.io.Writer;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -66,21 +67,10 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.commons.math.util.MathUtils;
-import org.apache.http.HttpResponse;
-import org.apache.http.client.ClientProtocolException;
-import org.apache.http.client.HttpClient;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.entity.mime.HttpMultipartMode;
-import org.apache.http.entity.mime.MultipartEntity;
-import org.apache.http.entity.mime.content.InputStreamBody;
-import org.apache.http.entity.mime.content.StringBody;
-import org.apache.http.impl.client.DefaultHttpClient;
import org.nuiton.math.matrix.DimensionHelper;
import org.nuiton.math.matrix.MatrixFactory;
import org.nuiton.math.matrix.MatrixND;
import org.nuiton.math.matrix.MatrixProvider;
-import org.nuiton.util.FileUtil;
-import org.nuiton.util.ZipUtil;
import fr.ifremer.coser.CoserBusinessConfig;
import fr.ifremer.coser.CoserBusinessException;
@@ -103,7 +93,6 @@
import fr.ifremer.coser.data.Strata;
import fr.ifremer.coser.storage.DataStorage;
import fr.ifremer.coser.util.ProgressMonitor;
-import fr.ifremer.coser.util.ProgressStream;
/**
* Service business method relative to project.
@@ -797,7 +786,7 @@
log.debug("Saving control file : " + controlFile);
}
DataStorage content = getProjectContent(project, control, category, false);
- importService.storeData(project, content, controlFile);
+ importService.storeData(content, controlFile);
// save deleted content (if needed)
DataStorage contentDeleted = getProjectContent(project, control, category, true);
@@ -805,7 +794,7 @@
if (contentDeleted.size() > 1) {
String deletedFileName = getDataStorageFileName(project, category, CoserConstants.STORAGE_DELECTED_SUFFIX);
File deletedDataFile = new File(controlDirectory, deletedFileName);
- importService.storeData(project, contentDeleted, deletedDataFile);
+ importService.storeData(contentDeleted, deletedDataFile);
}
}
}
@@ -991,7 +980,7 @@
}
DataStorage content = getProjectContent(project, selection, category, false);
- importService.storeData(project, content, dataFile);
+ importService.storeData(content, dataFile);
// delete data are not saved here
// can't delete data in selection
@@ -1053,19 +1042,28 @@
else {
rsufiResultDirectory.mkdirs();
+ // ensure creation date (modifiable par l'ui)
+ if (rsufiResult.getCreationDate() == null) {
+ rsufiResult.setCreationDate(new Date());
+ }
+
OutputStream outputStream = null;
try {
// sauvegarde des 2 fichiers obligatoires
File estComIndFile = new File(rsufiResult.getEstComIndPath());
File estPopIndFile = new File(rsufiResult.getEstPopIndPath());
- File mapsDirectory = new File(rsufiResult.getMapsPath());
rsufiResult.setEstComIndName(estComIndFile.getName());
rsufiResult.setEstPopIndName(estPopIndFile.getName());
FileUtils.copyFileToDirectory(estComIndFile, rsufiResultDirectory);
FileUtils.copyFileToDirectory(estPopIndFile, rsufiResultDirectory);
File resultMapsDirectory = new File(rsufiResultDirectory, CoserConstants.STORAGE_MAPS_DIRECTORY);
- FileUtils.copyDirectory(mapsDirectory, resultMapsDirectory);
+ // maps path is optionnal
+ if (StringUtils.isNotEmpty(rsufiResult.getMapsPath())) {
+ File mapsDirectory = new File(rsufiResult.getMapsPath());
+ FileUtils.copyDirectory(mapsDirectory, resultMapsDirectory);
+ }
+
// sauvegarde des fichiers autre
File otherFilesDirectory = new File(rsufiResultDirectory, "others");
for (File othersFile : othersFiles) {
@@ -2304,194 +2302,6 @@
return matrix;
}
-
- /**
- * Présentation du graphique : histogramme de distribution en tailles par
- * espèce, par strate et par année (une planche par espèce et par année)
- * pour toute la série. Avec la possibilité de voir regroupé l'ensemble des
- * années.
- *
- * Données. TAILLES$Nombres et TAILLES$Longueur
- * Calcul. Sommer TAILLES$Nombres par classe de longueur (TAILLES$Longueur)
- * sur tous les traits d'une année (ou tous les années si regroupé)
- *
- *
- * @param project project
- * @param dataContainer data container
- * @return matrix 4 dimension
- *
- * @deprecated replaced by matrix proxy
- */
- public MatrixND getLengthStructureNonProxy(Project project, AbstractDataContainer dataContainer) {
-
- // load map traitname > stratename
- Map<String, String> haulAndStratas = new HashMap<String, String>();
- Iterator<String[]> itHaul = dataContainer.getHaul().iterator(true);
- while (itHaul.hasNext()) {
- String[] tuple = itHaul.next();
- String haul = tuple[Haul.INDEX_HAUL];
- String strataName = tuple[Haul.INDEX_STRATUM];
- haulAndStratas.put(haul, strataName);
- }
-
- // map lengthstep, species , strata , year > count
- Map<Double, Map<String, Map<String, Map<String, Double>>>> countForLengthSpeciesStrataYear =
- new HashMap<Double, Map<String, Map<String, Map<String, Double>>>>();
- Set<Double> lengthSet = new HashSet<Double>();
- Set<String> speciesSet = new HashSet<String>();
- Set<String> strataSet = new HashSet<String>();
- Set<String> yearsSet = new HashSet<String>();
-
- Iterator<String[]> itData = dataContainer.getLength().iterator(true);
- while (itData.hasNext()) {
- String[] tuple = itData.next();
-
- String year = tuple[Length.INDEX_YEAR];
- String haul = tuple[Length.INDEX_HAUL];
- String species = tuple[Length.INDEX_SPECIES];
- String lengthAsString = tuple[Length.INDEX_LENGTH];
- String numberAsString = tuple[Length.INDEX_NUMBER];
- String strata = haulAndStratas.get(haul);
-
- if (strata == null) {
- if (log.isWarnEnabled()) {
- log.warn("No strata for haul " + haul);
- }
- continue;
- }
-
- // remember for matrix spemantics
- speciesSet.add(species);
- strataSet.add(strata);
- yearsSet.add(year);
-
- // get correct length step
- // plain or half centimeters
- try {
- double length = Double.parseDouble(lengthAsString);
-
- // get length step to use
- double ceil = Math.ceil(length);
- double floor = Math.floor(length);
- // ne pas prendre 0.5 car 10.0 serait arrondit à 10.5
- double round = Math.floor(length + 0.499999);
-
- // on prend le pas ou demi pas le plus proche
- if (ceil == round) {
- length = floor + 0.5;
- }
- else {
- length = floor;
- }
-
- lengthSet.add(length);
-
- try {
- double number = Double.parseDouble(numberAsString);
-
- // fill map
- Map<String, Map<String, Map<String, Double>>> lengthCountForSpeciesStrataYear = countForLengthSpeciesStrataYear.get(length);
- if (lengthCountForSpeciesStrataYear == null) {
- lengthCountForSpeciesStrataYear = new HashMap<String, Map<String,Map<String,Double>>>();
- countForLengthSpeciesStrataYear.put(length, lengthCountForSpeciesStrataYear);
- }
-
- Map<String, Map<String, Double>> speciesCountForStrataYear = lengthCountForSpeciesStrataYear.get(species);
- if (speciesCountForStrataYear == null) {
- speciesCountForStrataYear = new HashMap<String, Map<String,Double>>();
- lengthCountForSpeciesStrataYear.put(species, speciesCountForStrataYear);
- }
-
- Map<String, Double> strataCountForYear = speciesCountForStrataYear.get(strata);
- if (strataCountForYear == null) {
- strataCountForYear = new HashMap<String, Double>();
- speciesCountForStrataYear.put(strata, strataCountForYear);
- }
-
- Double countForYear = strataCountForYear.get(year);
- if (countForYear == null) {
- strataCountForYear.put(year, number);
- }
- else {
- double newCount = countForYear + number;
- strataCountForYear.put(year, newCount);
- }
- }
- catch (NumberFormatException ex) {
- if (log.isWarnEnabled()) {
- log.warn("Can't parse number as double : " + numberAsString);
- }
- }
- }
- catch (NumberFormatException ex) {
- if (log.isWarnEnabled()) {
- log.warn("Can't parse length as double : " + lengthAsString);
- }
- }
- }
-
- // convert map to matrixND
- List<Double> lengthSem = new ArrayList<Double>(lengthSet);
- Collections.sort(lengthSem);
- List<String> speciesSem = new ArrayList<String>(speciesSet);
- Collections.sort(speciesSem);
- List<String> strataSem = new ArrayList<String>(strataSet);
- Collections.sort(strataSem);
- List<String> yearsSem = new ArrayList<String>(yearsSet);
- Collections.sort(yearsSem);
-
- if (log.isDebugEnabled()) {
- log.debug(_("Creating matrix : %d*%d*%d*%d", lengthSem.size(), speciesSem.size(), strataSem.size(), yearsSem.size()));
- }
-
- MatrixND matrix = MatrixFactory.getInstance().create(n_("coser.business.matrix.lengthstructure"), new List<?>[] {
- lengthSem , speciesSem, strataSem, yearsSem});
- matrix.setDimensionName(0, n_("coser.business.common.length"));
- matrix.setDimensionName(1, n_("coser.business.common.species"));
- matrix.setDimensionName(2, n_("coser.business.common.strata"));
- matrix.setDimensionName(3, n_("coser.business.common.years"));
-
- for (Map.Entry<Double, Map<String, Map<String, Map<String, Double>>>> lengthTuple : countForLengthSpeciesStrataYear.entrySet()) {
- Double length = lengthTuple.getKey();
- for (Map.Entry<String, Map<String, Map<String, Double>>> speciesTuple : lengthTuple.getValue().entrySet()) {
- String species = speciesTuple.getKey();
- for (Map.Entry<String, Map<String, Double>> strataTuple : speciesTuple.getValue().entrySet()) {
- String strata = strataTuple.getKey();
- for (Map.Entry<String, Double> yearTuple : strataTuple.getValue().entrySet()) {
- String year = yearTuple.getKey();
- matrix.setValue(new Object[]{length, species, strata, year}, yearTuple.getValue());
- }
- }
- }
- }
-
- /*for (double length = minLength ; length <= maxLength ; length += (halfStep) ? 0.5 : 1) {
- for (String species : speciesSem) {
- for (String strata : strataSem) {
- for (String year : yearsSem) {
-
- double value = 0.0;
- Map<String, Map<String, Map<String, Double>>> lengthTuple = countForLengthSpeciesStrataYear.get(length);
- if (lengthTuple != null) {
- Map<String, Map<String, Double>> speciesTuple = lengthTuple.get(species);
- if (speciesTuple != null) {
- Map<String, Double> strataTuple = speciesTuple.get(strata);
- if (strataTuple != null) {
- Double number = strataTuple.get(year);
- if (number != null) {
- value = number;
- }
- }
- }
- }
- matrix.setValue(new Object[]{length, species, strata, year}, value);
- }
- }
- }
- }*/
-
- return matrix;
- }
/**
* Présentation du graphique : histogramme de distribution en tailles par
@@ -2679,21 +2489,8 @@
// plain or half centimeters
try {
double length = Double.parseDouble(lengthAsString);
-
- // get length step to use
- double ceil = Math.ceil(length);
- double floor = Math.floor(length);
- // ne pas prendre 0.5 car 10.0 serait arrondit à 10.5
- double round = Math.floor(length + 0.499999);
+ length = getHalfStepValue(length);
- // on prend le pas ou demi pas le plus proche
- if (ceil == round) {
- length = floor + 0.5;
- }
- else {
- length = floor;
- }
-
if (!matrix.getSemantic(0).contains(length)) {
continue;
}
@@ -2721,8 +2518,34 @@
}
/**
- * Extrait les données de la selection
+ * Retourne la valeur au demi pas la plus proche.
*
+ * 38.0 > 38.0
+ * 38.1 > 38.0
+ * 38.6 > 38.5
+ *
+ * @param value value to get hasl step
+ * @return half step value
+ */
+ protected double getHalfStepValue(double value) {
+ // get length step to use
+ double floor = Math.floor(value);
+ // ne pas prendre 0.5 car 10.0 serait arrondit à 10.5
+ double round = Math.floor(value + 0.5);
+
+ // on prend le pas ou demi pas le plus proche
+ if (floor == round) {
+ value = floor;
+ }
+ else {
+ value = floor + 0.5;
+ }
+ return value;
+ }
+
+ /**
+ * Extrait les données de la selection pour rSufi.
+ *
* @param project project
* @param selection selection
* @param directory directory to extract file to
@@ -2744,13 +2567,29 @@
}
DataStorage content = getProjectContent(project, selection, category, false);
- importService.storeData(project, content, dataFile);
+ importService.storeDataWhithoutQuote(content, dataFile);
}
}
// extract additionnal data file (selected species)
File listSpeciesFile = new File(projectDirectory, "ListEspeces" + project.getName() + ".txt");
fillListSpeciesFile(selection, listSpeciesFile);
+
+ // extract additionnal project information
+ File informationFile = new File(projectDirectory, "project.txt");
+ PrintStream out = null;
+ try {
+ out = new PrintStream(new BufferedOutputStream(new FileOutputStream(informationFile)));
+
+ out.println(_("coser.business.extract.projectName") + project.getName());
+ out.println(_("coser.business.extract.projectAuthor") + project.getAuthor());
+ out.println(_("coser.business.extract.projectComment") + project.getComment());
+ } catch (IOException ex) {
+ throw new CoserBusinessException("Can't save project information file", ex);
+ }
+ finally {
+ IOUtils.closeQuietly(out);
+ }
}
/**
@@ -2847,225 +2686,4 @@
return result;
}
-
- /**
- * Retourne tous les projets qui ont des résultats.
- *
- * De la forme d'une liste de de path (à la tree path) :
- * ProjetName/SelectionName/ResultName
- *
- * @return results path
- */
- public List<String[]> findAllProjectWithResult() {
- List<String[]> results = new ArrayList<String[]>();
-
- // loop on projets
- File projectsDirectory = config.getProjectsDirectory();
- File[] projects = projectsDirectory.listFiles();
- if (projects != null) {
- for (File existingProject : projects) {
- if (existingProject.isDirectory()) {
- String projectName = existingProject.getName();
- Project p = new Project();
- p.setName(projectName);
-
- // loop on selections
- File selectionsDirectory = new File(existingProject, CoserConstants.STORAGE_SELECTION_DIRECTORY);
- File[] selections = selectionsDirectory.listFiles();
- if (selections != null) {
- for (File existingSelection : selections) {
- if (existingSelection.isDirectory()) {
- String selectionName = existingSelection.getName();
- Selection s = new Selection();
- s.setName(selectionName);
-
- // loop on result
- File rsufisDirectory = new File(existingSelection, CoserConstants.STORAGE_RESULTS_DIRECTORY);
- File[] rSufiResults = rsufisDirectory.listFiles();
- if (rSufiResults != null) {
- for (File rSufiResult : rSufiResults) {
- if (rSufiResult.isDirectory()) {
- String resultName = rSufiResult.getName();
- RSufiResult r = new RSufiResult();
- r.setName(resultName);
-
- String[] result = new String[] {projectName, selectionName, resultName};
- results.add(result);
- }
- }
- }
- }
- }
- }
- }
- }
- }
-
- return results;
- }
-
- /**
- * Upload user selected result to coser web front-end using common http
- * client.
- *
- * @param selectedResults selected result (collection of project/selection/rsufiresultname)
- * @param progress progress monitor
- * @throws CoserBusinessException
- */
- public void performResultUpload(Collection<String[]> selectedResults, ProgressMonitor progress) throws CoserBusinessException {
-
- // first copy prepare directory with only necessary data
- // ie project with only selected selections
- // and selection with only selected results
-
- progress.setText(_("coser.business.uploadresult.preparezip"));
- progress.setCurrent(0);
-
- File prepareZip = null;
- try {
- prepareZip = File.createTempFile("coserprepare-", ".zip");
- prepareZip.deleteOnExit();
-
- // copy selectively all data to target directory
- MultipleFileFilter mFileFilters = new MultipleFileFilter();
- for (String[] path : selectedResults) {
- OneResultFileFilter oneRFF = new OneResultFileFilter(config, path[0], path[1], path[2]);
- mFileFilters.add(oneRFF);
- }
-
- // create zip temp file
- File projectsDirectory = config.getProjectsDirectory();
-
- //ZipUtil.compress(prepareZip, projectsDirectory, mFileFilters);
- // compress les projets à la racines de l'archive
- // sans le dossier "projects"
- Collection<File> files = FileUtil.getFilteredElements(projectsDirectory, mFileFilters, true);
- ZipUtil.compressFiles(prepareZip, projectsDirectory, files, false);
- } catch (IOException ex) {
- throw new CoserBusinessException("Can't prepare upload data", ex);
- }
-
- progress.setText(_("coser.business.uploadresult.sendzip"));
- progress.setTotal((int)prepareZip.length());
-
- // then upload zip file to website
- try {
- HttpClient httpclient = new DefaultHttpClient();
- MultipartEntity reqEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
-
- // password param
- StringBody passwordBody = new StringBody("toto", Charset.forName("UTF-8"));
- reqEntity.addPart("password", passwordBody);
-
- // file param
- ProgressStream stream = new ProgressStream(new FileInputStream(prepareZip), progress);
- InputStreamBody fileBody = new InputStreamBody(stream, "application/zip", prepareZip.getName());
- reqEntity.addPart("resultFile", fileBody);
-
- HttpPost httppost = new HttpPost(config.getWebUploadURL());
- httppost.setEntity(reqEntity);
-
- if (log.isInfoEnabled()) {
- log.info("Uploading " + prepareZip + " to " + httppost.getURI());
- }
-
- HttpResponse response = httpclient.execute(httppost);
-
- if (log.isDebugEnabled()) {
- log.debug("Upload response code : " + response.getStatusLine());
- }
- } catch (ClientProtocolException ex) {
- throw new CoserBusinessException("Can't upload file", ex);
- } catch (IOException ex) {
- throw new CoserBusinessException("Can't upload file", ex);
- }
- }
-
- /**
- * Aggrege plusieurs file filters.
- */
- protected static class MultipleFileFilter implements FileFilter {
- protected Collection<FileFilter> fileFilters = new ArrayList<FileFilter>();
-
- public void add(FileFilter f) {
- fileFilters.add(f);
- }
-
- /*
- * @see java.io.FileFilter#accept(java.io.File)
- */
- @Override
- public boolean accept(File pathname) {
-
- boolean result = false;
- Iterator<FileFilter> it = fileFilters.iterator();
- while (it.hasNext() && !result) {
- result = it.next().accept(pathname);
- }
- return result;
- }
- }
-
- /**
- * Filter pour un resultat donné.
- *
- * Attention, implémentation que ne doit fonctionner que avec ZipUtil
- * car meme si on refuse en répertoire, il redemande quand même
- * les fils (et il faut qu'il les demande)
- */
- protected static class OneResultFileFilter implements FileFilter {
- protected CoserBusinessConfig config;
- protected String project;
- protected String selection;
- protected String rsufi;
-
- public OneResultFileFilter(CoserBusinessConfig config, String project, String selection, String rsufi) {
- this.config = config;
- this.project = project;
- this.selection = selection;
- this.rsufi = rsufi;
- }
-
- /*
- * @see java.io.FileFilter#accept(java.io.File)
- */
- @Override
- public boolean accept(File pathname) {
-
- boolean result = false;
-
- try {
- String currentPathName = pathname.getCanonicalPath() + File.separator;
-
- File projectDirectory = new File(config.getProjectsDirectory(), project);
- File selectionsDirectory = new File(projectDirectory, CoserConstants.STORAGE_SELECTION_DIRECTORY);
- File selectionDirectory = new File(selectionsDirectory, selection);
- File resultsDirectory = new File(selectionDirectory, CoserConstants.STORAGE_RESULTS_DIRECTORY);
- File resultDirectory = new File(resultsDirectory, rsufi);
-
- String projectPath = projectDirectory.getCanonicalPath() + File.separator;
- String selectionsPath = selectionsDirectory.getCanonicalPath() + File.separator;
- String selectionPath = selectionDirectory.getCanonicalPath() + File.separator;
- String resultsPath = resultsDirectory.getCanonicalPath() + File.separator;
- String resultPath = resultDirectory.getCanonicalPath() + File.separator;
-
- // on prend
- // - tout ce qu'il y a dans le projet
- // - sauf le répertoire "selections"
- // - ou la selection entierement
- // - sauf le répertoire result
- // - ou le resultat entierrement
- result = (currentPathName.startsWith(projectPath)
- && !currentPathName.startsWith(selectionsPath))
- || (currentPathName.startsWith(selectionPath)
- && !currentPathName.startsWith(resultsPath))
- || currentPathName.startsWith(resultPath);
-
- } catch (IOException ex) {
- throw new RuntimeException("Can't get system canonical path");
- }
-
- return result;
- }
- }
}
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/services/WebService.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/services/WebService.java 2011-01-12 15:54:25 UTC (rev 504)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/services/WebService.java 2011-01-14 14:05:29 UTC (rev 505)
@@ -28,34 +28,52 @@
import static org.nuiton.i18n.I18n._;
import java.io.File;
+import java.io.FileFilter;
+import java.io.FileInputStream;
import java.io.IOException;
+import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
+import java.util.regex.Matcher;
import org.apache.commons.collections.map.MultiKeyMap;
import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.commons.mail.EmailException;
import org.apache.commons.mail.MultiPartEmail;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.mime.HttpMultipartMode;
+import org.apache.http.entity.mime.MultipartEntity;
+import org.apache.http.entity.mime.content.InputStreamBody;
+import org.apache.http.entity.mime.content.StringBody;
+import org.apache.http.impl.client.DefaultHttpClient;
import org.nuiton.util.FileUtil;
+import org.nuiton.util.StringUtil;
import org.nuiton.util.ZipUtil;
import fr.ifremer.coser.CoserBusinessConfig;
import fr.ifremer.coser.CoserBusinessException;
import fr.ifremer.coser.CoserConstants;
import fr.ifremer.coser.CoserConstants.Category;
+import fr.ifremer.coser.CoserUtils;
import fr.ifremer.coser.bean.Project;
import fr.ifremer.coser.bean.RSufiResult;
+import fr.ifremer.coser.bean.Selection;
import fr.ifremer.coser.storage.DataStorage;
import fr.ifremer.coser.storage.MemoryDataStorage;
+import fr.ifremer.coser.util.ProgressMonitor;
+import fr.ifremer.coser.util.ProgressStream;
/**
* Service specifique à l'interface web de visualisation.
@@ -153,6 +171,341 @@
}
/**
+ * Retourne tous les projets qui ont des résultats.
+ *
+ * De la forme d'une liste de de path (à la tree path) :
+ * ProjetName/SelectionName/ResultName
+ *
+ * @param beginDate begin date (can be null)
+ * @param endDate end date (can be null)
+ * @param onlyPubliableResult select only publiable results
+ *
+ * @return results path
+ * @throws CoserBusinessException
+ */
+ public List<Object[]> findAllProjectWithResult(Date beginDate, Date endDate, boolean onlyPubliableResult) throws CoserBusinessException {
+ List<Object[]> results = new ArrayList<Object[]>();
+
+ // loop on projets
+ File projectsDirectory = config.getProjectsDirectory();
+ File[] projects = projectsDirectory.listFiles();
+ if (projects != null) {
+ for (File existingProject : projects) {
+ if (existingProject.isDirectory()) {
+ String projectName = existingProject.getName();
+ Project p = new Project();
+ p.setName(projectName);
+
+ // loop on selections
+ File selectionsDirectory = new File(existingProject, CoserConstants.STORAGE_SELECTION_DIRECTORY);
+ File[] selections = selectionsDirectory.listFiles();
+ if (selections != null) {
+ for (File existingSelection : selections) {
+ if (existingSelection.isDirectory()) {
+ String selectionName = existingSelection.getName();
+ Selection s = new Selection();
+ s.setName(selectionName);
+
+ // loop on result
+ File rsufisDirectory = new File(existingSelection, CoserConstants.STORAGE_RESULTS_DIRECTORY);
+ File[] rSufiResults = rsufisDirectory.listFiles();
+ if (rSufiResults != null) {
+ for (File rSufiResult : rSufiResults) {
+ if (rSufiResult.isDirectory()) {
+ RSufiResult r = projectService.getRSufiResult(rSufiResult);
+
+ boolean candidate = isCandidateResult(r, beginDate, endDate, onlyPubliableResult);
+ if (candidate) {
+ Object[] result = new Object[] {p, s, r};
+ results.add(result);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return results;
+ }
+
+ /**
+ * Test if result is valid with filtering.
+ *
+ * @param rsufiResult rsufi result to test
+ * @param beginDate begin date (can be null)
+ * @param endDate end date (can be null)
+ * @param onlyPubliableResult select only publiable results
+ * @return if result is valid candidate
+ */
+ protected boolean isCandidateResult(RSufiResult rsufiResult, Date beginDate,
+ Date endDate, boolean onlyPubliableResult) {
+
+ boolean result = true;
+
+ if (beginDate != null) {
+ result &= rsufiResult.getCreationDate().compareTo(beginDate) >= 0;
+ }
+
+ if (endDate != null) {
+ result &= rsufiResult.getCreationDate().compareTo(endDate) <= 0;
+ }
+
+ if (onlyPubliableResult) {
+ result &= rsufiResult.isPublishResult();
+ }
+
+ return result;
+ }
+
+ /**
+ * Extract directory to custom directory.
+ *
+ * @param selectedResults selected result paths
+ * @param extractDirectory extract directory (can be null)
+ * @param exportWithData include csv data during export
+ * @return extracted file (no automatically deleted)
+ * @throws CoserBusinessException
+ */
+ public File performResultExtract(Collection<Object[]> selectedResults, File extractDirectory, boolean exportWithData) throws CoserBusinessException {
+ File prepareZip = null;
+ try {
+ prepareZip = File.createTempFile("coserextract-", ".zip", extractDirectory);
+
+ // copy selectively all data to target directory
+ MultipleFileFilter mFileFilters = new MultipleFileFilter();
+ for (Object[] path : selectedResults) {
+ // load projet, needed to known source data file name
+ Project project = (Project)path[0];
+ project = projectService.openProject(project.getName());
+
+ OneResultFileFilter oneRFF = new OneResultFileFilter(config,
+ (Project)path[0], (Selection)path[1], (RSufiResult)path[2], exportWithData);
+ mFileFilters.add(oneRFF);
+ }
+
+ // create zip temp file
+ File projectsDirectory = config.getProjectsDirectory();
+
+ //ZipUtil.compress(prepareZip, projectsDirectory, mFileFilters);
+ // compress les projets à la racines de l'archive
+ // sans le dossier "projects"
+ Collection<File> files = FileUtil.getFilteredElements(projectsDirectory, mFileFilters, true);
+ ZipUtil.compressFiles(prepareZip, projectsDirectory, files, false);
+ } catch (IOException ex) {
+ throw new CoserBusinessException("Can't prepare upload data", ex);
+ }
+
+ return prepareZip;
+ }
+
+ /**
+ * Upload user selected result to coser web front-end using common http
+ * client.
+ *
+ * @param selectedResults selected result (collection of project/selection/rsufiresult)
+ * @param login remote admin login
+ * @param password remote admin password
+ * @param progress progress monitor
+ * @throws CoserBusinessException
+ */
+ public void performResultUpload(Collection<Object[]> selectedResults, String login, String password, ProgressMonitor progress) throws CoserBusinessException {
+
+ // first copy prepare directory with only necessary data
+ // ie project with only selected selections
+ // and selection with only selected results
+
+ progress.setCurrent(0);
+ progress.setText(_("coser.business.uploadresult.checkcollision"));
+ checkDataCollision(selectedResults);
+
+ progress.setText(_("coser.business.uploadresult.preparezip"));
+
+ // default extract to temp directory with data sources
+ File prepareZip = performResultExtract(selectedResults, null, true);
+
+ progress.setText(_("coser.business.uploadresult.sendzip"));
+ progress.setTotal((int)prepareZip.length());
+
+ // then upload zip file to website
+ try {
+ HttpClient httpclient = new DefaultHttpClient();
+ MultipartEntity reqEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
+
+ // login/password param (password encoded)
+ StringBody loginBody = new StringBody(login, Charset.forName("UTF-8"));
+ reqEntity.addPart("login", loginBody);
+ String sha1password = StringUtil.encodeSHA1(password);
+ StringBody passwordBody = new StringBody(sha1password, Charset.forName("UTF-8"));
+ reqEntity.addPart("sha1Password", passwordBody);
+
+ // file param
+ ProgressStream stream = new ProgressStream(new FileInputStream(prepareZip), progress);
+ InputStreamBody fileBody = new InputStreamBody(stream, "application/zip", prepareZip.getName());
+ reqEntity.addPart("resultFile", fileBody);
+
+ HttpPost httppost = new HttpPost(config.getWebUploadURL());
+ httppost.setEntity(reqEntity);
+
+ if (log.isInfoEnabled()) {
+ log.info("Uploading " + prepareZip + " to " + httppost.getURI());
+ }
+
+ HttpResponse response = httpclient.execute(httppost);
+
+ if (log.isDebugEnabled()) {
+ log.debug("Upload response code : " + response.getStatusLine());
+ }
+ } catch (ClientProtocolException ex) {
+ throw new CoserBusinessException("Can't upload file", ex);
+ } catch (IOException ex) {
+ throw new CoserBusinessException("Can't upload file", ex);
+ }
+
+ prepareZip.delete();
+ }
+
+ /**
+ * Met à jour les fichiers de propriétés des resultats (maps, dataSource)
+ * and check for duplicated couple (zoneid/resulttype (map) upload).
+ *
+ * @param selectedResults result id to check
+ * @throws CoserBusinessException
+ */
+ protected void checkDataCollision(Collection<Object[]> selectedResults) throws CoserBusinessException {
+
+ Collection<String> resultZoneTypeIds = new ArrayList<String>();
+
+ for (Object[] selectedResult : selectedResults) {
+ Project project = (Project)selectedResult[0];
+ Selection selection = (Selection)selectedResult[1];
+ RSufiResult rsufiResult = (RSufiResult)selectedResult[2];
+
+ // on creer une clé composé pour l'id du resultat
+ String resultZoneTypeId = rsufiResult.getZone() + String.valueOf(rsufiResult.isMapsReferenceResult());
+ if (resultZoneTypeIds.contains(resultZoneTypeId)) {
+ throw new CoserBusinessException(_("coser.business.resultupload.duplicatedresult",
+ project.getName(), selection.getName(), rsufiResult.getName(), rsufiResult.getZone()));
+ } else {
+ resultZoneTypeIds.add(resultZoneTypeId);
+ }
+ }
+ }
+
+ /**
+ * Aggrege plusieurs file filters.
+ */
+ protected static class MultipleFileFilter implements FileFilter {
+ protected Collection<FileFilter> fileFilters = new ArrayList<FileFilter>();
+
+ public void add(FileFilter f) {
+ fileFilters.add(f);
+ }
+
+ /*
+ * @see java.io.FileFilter#accept(java.io.File)
+ */
+ @Override
+ public boolean accept(File pathname) {
+
+ boolean result = false;
+ Iterator<FileFilter> it = fileFilters.iterator();
+ while (it.hasNext() && !result) {
+ result = it.next().accept(pathname);
+ }
+ return result;
+ }
+ }
+
+ /**
+ * Filter pour un resultat donné.
+ *
+ * Attention, implémentation que ne doit fonctionner que avec ZipUtil
+ * car meme si on refuse en répertoire, il redemande quand même
+ * les fils (et il faut qu'il les demande)
+ */
+ protected class OneResultFileFilter implements FileFilter {
+ protected CoserBusinessConfig config;
+ protected Project project;
+ protected Selection selection;
+ protected RSufiResult rsufi;
+ protected boolean exportWithData;
+
+ public OneResultFileFilter(CoserBusinessConfig config, Project project, Selection selection, RSufiResult rsufi, boolean exportWithData) {
+ this.config = config;
+ this.project = project;
+ this.selection = selection;
+ this.rsufi = rsufi;
+ this.exportWithData = exportWithData;
+ }
+
+ /*
+ * @see java.io.FileFilter#accept(java.io.File)
+ */
+ @Override
+ public boolean accept(File pathname) {
+
+ boolean result = false;
+
+ try {
+ String currentPathName = pathname.getCanonicalPath() + File.separator;
+
+ File projectDirectory = new File(config.getProjectsDirectory(), project.getName());
+ File selectionsDirectory = new File(projectDirectory, CoserConstants.STORAGE_SELECTION_DIRECTORY);
+ File selectionDirectory = new File(selectionsDirectory, selection.getName());
+ File resultsDirectory = new File(selectionDirectory, CoserConstants.STORAGE_RESULTS_DIRECTORY);
+ File resultDirectory = new File(resultsDirectory, rsufi.getName());
+
+ String projectPath = projectDirectory.getCanonicalPath() + File.separator;
+ String selectionsPath = selectionsDirectory.getCanonicalPath() + File.separator;
+ String selectionPath = selectionDirectory.getCanonicalPath() + File.separator;
+ String resultsPath = resultsDirectory.getCanonicalPath() + File.separator;
+ String resultPath = resultDirectory.getCanonicalPath() + File.separator;
+
+ // on prend
+ // - tout ce qu'il y a dans le projet
+ // - sauf le répertoire "selections"
+ // - ou la selection entierement
+ // - sauf le répertoire result
+ // - ou le resultat entierrement
+ result = (currentPathName.startsWith(projectPath)
+ && !currentPathName.startsWith(selectionsPath))
+ || (currentPathName.startsWith(selectionPath)
+ && !currentPathName.startsWith(resultsPath))
+ || currentPathName.startsWith(resultPath);
+
+ // cas ou les données sources ne doivent pas être exporter
+ // condition sur les nom de fichier ?
+ if (!exportWithData) {
+ String fileName = pathname.getName();
+
+ // on exclu tout les fichiers qui commence
+ // par les meme nom de fichier que ceux du projet
+ // (les noms de fichier sont personnalisable)
+ for (Category category : Category.values()) {
+ if (category.isDataCategory()) {
+ String sourceFileName = projectService.getDataStorageFileName(project, category, null);
+ Matcher matcher = CoserUtils.FILENAME_SUFFIX_PATTERN.matcher(sourceFileName);
+ if (matcher.matches()) {
+ result &= !(fileName.startsWith(matcher.group(1)) && fileName.endsWith(matcher.group(2)));
+ } else {
+ result &= !fileName.startsWith(sourceFileName);
+ }
+ }
+ }
+ }
+ } catch (IOException ex) {
+ throw new RuntimeException("Can't get system canonical path");
+ }
+
+ return result;
+ }
+ }
+
+ /**
* Traite le fichier uploade par l'application client et l'enregistre
* dans le stockage coté web.
*
@@ -284,8 +637,7 @@
if (newResultIds.contains(resultResultId)) {
// un nouveau resulat utilsera ce resultid
FileUtils.deleteDirectory(resultFile);
- }
- else {
+ } else {
// un resultat valid trouvé, selection non a supprimer
selectionResultCount++;
}
@@ -296,8 +648,7 @@
// si aucun resultat valide, suppression de la seletion
if (selectionResultCount == 0) {
FileUtils.deleteDirectory(selectionFile);
- }
- else {
+ } else {
projectSelectionCount++;
}
}
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/util/ProgressStream.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/util/ProgressStream.java 2011-01-12 15:54:25 UTC (rev 504)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/util/ProgressStream.java 2011-01-14 14:05:29 UTC (rev 505)
@@ -39,9 +39,9 @@
*/
public class ProgressStream extends InputStream {
- public InputStream delegateStream;
+ protected InputStream delegateStream;
- public ProgressMonitor delegateProgress;
+ protected ProgressMonitor delegateProgress;
public ProgressStream(InputStream delegateStream, ProgressMonitor delegateProgress) {
super();
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 2011-01-12 15:54:25 UTC (rev 504)
+++ trunk/coser-business/src/main/resources/i18n/coser-business_en_GB.properties 2011-01-14 14:05:29 UTC (rev 505)
@@ -66,6 +66,9 @@
coser.business.control.step.diffCatchLength=Check diff catch/length (%d%%)
coser.business.control.step.observation=Checking observation number \: %s (%d%%)
coser.business.control.step.xworks=Line checks \: %s (%d%%)
+coser.business.extract.projectAuthor=Project author \:
+coser.business.extract.projectComment=Project comment \:
+coser.business.extract.projectName=Project name \:
coser.business.line=Line
coser.business.matrix.density=Density
coser.business.matrix.lengthstructure=Length structures
@@ -91,7 +94,9 @@
coser.business.publication.selectionlogexporttitle=
coser.business.publication.stratafilename=Strata file name
coser.business.result.rsufiResultAlreadyExists=Result %s already exists \!
+coser.business.resultupload.duplicatedresult=Result %s/%s/%s duplicate another result for zone %s \!
coser.business.selection.notValidatedControl=Not validated control \!
+coser.business.uploadresult.checkcollision=Checking zone collisions
coser.business.uploadresult.preparezip=Preparing zip archive\u2026
coser.business.uploadresult.sendzip=Sending zip archive\u2026
coser.config.control.diffcatchlength.description=Percentage difference allowed between catch and length (in percent, for example 5% set 5.0)
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 2011-01-12 15:54:25 UTC (rev 504)
+++ trunk/coser-business/src/main/resources/i18n/coser-business_fr_FR.properties 2011-01-14 14:05:29 UTC (rev 505)
@@ -66,6 +66,9 @@
coser.business.control.step.diffCatchLength=V\u00E9rification des diff\u00E9rences captures/taille (%d%%)
coser.business.control.step.observation=V\u00E9rification du nombre d'observation \: %s (%d%%)
coser.business.control.step.xworks=Validation par lignes \: %s (%d%%)
+coser.business.extract.projectAuthor=Auteur du projet \:
+coser.business.extract.projectComment=Commentaire du projet \:
+coser.business.extract.projectName=Nom du project \:
coser.business.line=Ligne
coser.business.matrix.density=Densit\u00E9
coser.business.matrix.lengthstructure=Structures en taille
@@ -91,7 +94,9 @@
coser.business.publication.selectionlogexporttitle=Rapport de la s\u00E9lection %s (projet %s)
coser.business.publication.stratafilename=Nom du fichier strates
coser.business.result.rsufiResultAlreadyExists=Le r\u00E9sultat %D existe d\u00E9j\u00E0 \!
+coser.business.resultupload.duplicatedresult=Le r\u00E9sultat %s/%s/%s duplique un autre r\u00E9sultat pour la zone %s \!
coser.business.selection.notValidatedControl=Contr\u00F4le non valid\u00E9 \!
+coser.business.uploadresult.checkcollision=V\u00E9rification des collisions de zones
coser.business.uploadresult.preparezip=Pr\u00E9paration de l'archive zip\u2026
coser.business.uploadresult.sendzip=Envoi de l'archive zip\u2026
coser.config.control.diffcatchlength.description=Pourcentage d'\u00E9cart tol\u00E9r\u00E9 entre les captures et les tailles (en pourcent, par exemple pour 5% mettre 5.0)
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 2011-01-12 15:54:25 UTC (rev 504)
+++ trunk/coser-business/src/test/java/fr/ifremer/coser/services/ProjectServiceTest.java 2011-01-14 14:05:29 UTC (rev 505)
@@ -460,4 +460,18 @@
MatrixND matrix = projectService.getLengthStructure(project, selection);
Assert.assertNotNull(matrix);
}
+
+ /**
+ * Test le calcul du demi pas pour une valeur.
+ */
+ @Test
+ public void testHalfStepValue() {
+ Assert.assertEquals(38.0, projectService.getHalfStepValue(38.0), 0.00001);
+ Assert.assertEquals(38.0, projectService.getHalfStepValue(38.1), 0.00001);
+ Assert.assertEquals(38.0, projectService.getHalfStepValue(38.245), 0.00001);
+ Assert.assertEquals(38.5, projectService.getHalfStepValue(38.5), 0.00001);
+ Assert.assertEquals(38.5, projectService.getHalfStepValue(38.6), 0.00001);
+ Assert.assertEquals(38.5, projectService.getHalfStepValue(38.999), 0.00001);
+ Assert.assertEquals(42.5, projectService.getHalfStepValue(42.745), 0.00001);
+ }
}
Modified: trunk/coser-business/src/test/java/fr/ifremer/coser/services/WebServiceTest.java
===================================================================
--- trunk/coser-business/src/test/java/fr/ifremer/coser/services/WebServiceTest.java 2011-01-12 15:54:25 UTC (rev 504)
+++ trunk/coser-business/src/test/java/fr/ifremer/coser/services/WebServiceTest.java 2011-01-14 14:05:29 UTC (rev 505)
@@ -38,7 +38,6 @@
import org.nuiton.util.ZipUtil;
import fr.ifremer.coser.CoserBusinessException;
-import fr.ifremer.coser.bean.Project;
import fr.ifremer.coser.storage.DataStorage;
/**
@@ -88,7 +87,7 @@
@Test
public void testGetZones() throws CoserBusinessException {
DataStorage zones = webService.getZonesMap();
- Assert.assertEquals(16, zones.size());
+ Assert.assertEquals(17, zones.size());
}
/**
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 2011-01-12 15:54:25 UTC (rev 504)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/CoserFrameHandler.java 2011-01-14 14:05:29 UTC (rev 505)
@@ -502,14 +502,10 @@
* Display ui to select result to upload to website or to export as archive.
*/
public void showPublishResultView() {
- ProjectService projectService = view.getContextValue(ProjectService.class);
- List<String[]> results = projectService.findAllProjectWithResult();
-
SelectUploadResultView selectUploadResultView = new SelectUploadResultView(view);
- selectUploadResultView.setHandler(new ResultHandler());
- SwingUtil.fixTableColumnWidth(selectUploadResultView.getSelectedProjectTable(), 1, 25);
- selectUploadResultView.getSelectedProjectTable().setDefaultRenderer(String[].class, new RsufiResultRenderer());
- selectUploadResultView.getSelectedProjectTableModel().setResultPath(results);
+ ResultHandler handler = new ResultHandler();
+ selectUploadResultView.setHandler(handler);
+ handler.init(selectUploadResultView);
setMainComponent(selectUploadResultView);
}
}
Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/common/CommonHandler.java
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/common/CommonHandler.java 2011-01-12 15:54:25 UTC (rev 504)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/common/CommonHandler.java 2011-01-14 14:05:29 UTC (rev 505)
@@ -31,6 +31,7 @@
import java.io.File;
import java.io.IOException;
+import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
/**
@@ -44,7 +45,23 @@
*/
public class CommonHandler {
+ /** File chooser instance. */
+ protected JFileChooser fileChooserInstance;
+
/**
+ * Retourne une unique instance du file chooser pour conserver
+ * le répertoire de sélection d'un appel sur l'autre.
+ *
+ * @return file chooser
+ */
+ protected JFileChooser getFileChooserInstance() {
+ if (fileChooserInstance == null) {
+ fileChooserInstance = new JFileChooser();
+ }
+ return fileChooserInstance;
+ }
+
+ /**
* Install le curseur sablier.
*
* @param comp component to set cursor
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 2011-01-12 15:54:25 UTC (rev 504)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/control/ControlHandler.java 2011-01-14 14:05:29 UTC (rev 505)
@@ -376,7 +376,7 @@
SwingWorker<List<ControlError>, Void> task = new SwingWorker<List<ControlError>, Void>() {
- long before = System.currentTimeMillis();
+ protected long before = System.currentTimeMillis();
@Override
protected List<ControlError> doInBackground() {
Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/project/ProjectHandler.java
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/project/ProjectHandler.java 2011-01-12 15:54:25 UTC (rev 504)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/project/ProjectHandler.java 2011-01-14 14:05:29 UTC (rev 505)
@@ -63,22 +63,7 @@
private static final Log log = LogFactory.getLog(ProjectHandler.class);
- protected JFileChooser fileChooser;
-
protected JFileChooser mapFileChooser;
-
- /**
- * Retourne une unique instance du file chooser pour conserver
- * le répertoire de sélection d'un appel sur l'autre.
- *
- * @return l'unique instance de file chooser
- */
- protected JFileChooser getFileChooser() {
- if (fileChooser == null) {
- fileChooser = new JFileChooser();
- }
- return fileChooser;
- }
/**
* Retourne une unique instance du file chooser pour conserver
@@ -112,8 +97,9 @@
* @param textComponent text component to fill
*/
public void selectInputFile(ProjectCreationView projectView, JTextField textComponent) {
- JFileChooser selectFileChooser = getFileChooser();
-
+ JFileChooser selectFileChooser = getFileChooserInstance();
+ selectFileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
+
int result = selectFileChooser.showOpenDialog(projectView);
if (result == JFileChooser.APPROVE_OPTION) {
File selectedFile = selectFileChooser.getSelectedFile();
@@ -242,7 +228,7 @@
setWaitCursor(projectView);
SwingWorker<Project, Void> task = new SwingWorker<Project, Void>() {
- long before = System.currentTimeMillis();
+ protected long before = System.currentTimeMillis();
@Override
protected Project doInBackground() {
Added: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/ExportUploadDialog.jaxx
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/ExportUploadDialog.jaxx (rev 0)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/ExportUploadDialog.jaxx 2011-01-14 14:05:29 UTC (rev 505)
@@ -0,0 +1,95 @@
+<!--
+ #%L
+ Coser :: UI
+
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2010 - 2011 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%
+ -->
+<JDialog title="coser.ui.uploadresult.exportUploadTitle" modal="true">
+ <Table>
+ <ResultHandler id="handler" javaBean="null" />
+
+ <row>
+ <cell weightx="1" weighty="1" fill="both">
+ <Table border='{BorderFactory.createTitledBorder(_("coser.ui.uploadresult.extractChoice"))}'>
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="coser.ui.uploadresult.extractTo" />
+ </cell>
+ <cell weightx="1" fill="horizontal">
+ <JTextField id="extractToTextField" />
+ </cell>
+ <cell>
+ <JButton text="coser.ui.common.selectFile"
+ onActionPerformed="getHandler().selectExportDirectory(this, extractToTextField)" />
+ </cell>
+ </row>
+ <row>
+ <cell anchor="east">
+ <JCheckBox id="sourceDataExport" selected="true" />
+ </cell>
+ <cell columns="2">
+ <JLabel text="coser.ui.uploadresult.extractWithData" />
+ </cell>
+ </row>
+ <row>
+ <cell columns="3" anchor="east">
+ <JButton text="coser.ui.uploadresult.extract"
+ onActionPerformed="getHandler().performExtractResult(this)" />
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
+ <row>
+ <cell weightx="1" weighty="1" fill="both">
+ <Table border='{BorderFactory.createTitledBorder(_("coser.ui.uploadresult.uploadChoice"))}'>
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="coser.ui.uploadresult.uploadLogin" />
+ </cell>
+ <cell weightx="1" fill="horizontal">
+ <JTextField id="uploadLogintextField" />
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JLabel text="coser.ui.uploadresult.uploadPassword" />
+ </cell>
+ <cell>
+ <JPasswordField id="uploadPasswordtextField" />
+ </cell>
+ </row>
+ <row>
+ <cell columns="2" anchor="east">
+ <JButton text="coser.ui.uploadresult.upload"
+ onActionPerformed="getHandler().performUploadResult(this)" />
+ </cell>
+ </row>
+ <row>
+ <cell weightx="1" fill="horizontal" columns="2">
+ <fr.ifremer.coser.ui.util.CoserProgressBar id="uploadProgressBar" stringPainted="true" />
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
+ </Table>
+</JDialog>
\ No newline at end of file
Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/OtherDataFileListModel.java
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/OtherDataFileListModel.java 2011-01-12 15:54:25 UTC (rev 504)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/OtherDataFileListModel.java 2011-01-14 14:05:29 UTC (rev 505)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2010 Ifremer, Codelutin, Chatellier Eric
+ * Copyright (C) 2010 - 2011 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
Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/ResultHandler.java
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/ResultHandler.java 2011-01-12 15:54:25 UTC (rev 504)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/ResultHandler.java 2011-01-14 14:05:29 UTC (rev 505)
@@ -3,7 +3,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2010 Ifremer, Codelutin, Chatellier Eric
+ * Copyright (C) 2010 - 2011 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
@@ -25,18 +25,24 @@
import static org.nuiton.i18n.I18n._;
+import java.io.File;
+import java.util.ArrayList;
import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
+import javax.swing.JTextField;
import javax.swing.SwingWorker;
+import jaxx.runtime.JAXXUtil;
+
import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import fr.ifremer.coser.CoserBusinessException;
import fr.ifremer.coser.CoserException;
-import fr.ifremer.coser.services.ProjectService;
+import fr.ifremer.coser.services.WebService;
import fr.ifremer.coser.ui.common.CommonHandler;
import fr.ifremer.coser.ui.util.CoserProgressBar;
@@ -51,62 +57,187 @@
*/
public class ResultHandler extends CommonHandler {
- private static final Log log = LogFactory.getLog(ResultHandler.class);
+ /**
+ * Initialise la vue (principalement en recuperant les données.
+ *
+ * @param view view
+ */
+ public void init(SelectUploadResultView view) {
+ //SwingUtil.fixTableColumnWidth(view.getSelectedProjectTable(), 1, 25);
+ //SwingUtil.fixTableColumnWidth(view.getAvailableProjectTable(), 1, 25);
+ view.getAvailableProjectTable().setDefaultRenderer(String[].class, new RsufiResultRenderer());
+
+ // initialise les données avec les filtres par default
+ updateAvailableResultsFilter(view);
+
+ }
+
/**
- * Perform file upload to coser server after selection by user.
+ * Met à jour les données de la table apres la modification d'un
+ * ou plusieurs filtre.
*
* @param view view
*/
- public void performResultUpload(final SelectUploadResultView view) {
+ public void updateAvailableResultsFilter(SelectUploadResultView view) {
+
+ // get filter
+ Date beginDate = view.getFilterBeginDate().getDate();
+ Date endDate = view.getFilterEndDate().getDate();
+ boolean onlyPubliable = view.getPubliableResults().isSelected();
- int response = JOptionPane.showConfirmDialog(view, _("coser.ui.uploadresult.confirmupload"), _("coser.ui.uploadresult.title"),
- JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
+ // get result
+ WebService webService = view.getContextValue(WebService.class);
- if (response == JOptionPane.YES_OPTION) {
-
- // get result selected by user
- final Collection<String[]> selectedResult = view.getSelectedProjectTableModel().getSelectedResult();
- if (CollectionUtils.isNotEmpty(selectedResult)) {
+ try {
+ List<Object[]> results = webService.findAllProjectWithResult(beginDate, endDate, onlyPubliable);
+ view.getAvailableProjectTableModel().setResultPath(results);
+ } catch (CoserBusinessException ex) {
+ throw new CoserException("Can't get results", ex);
+ }
+ }
- SwingWorker<Void, Void> task = new SwingWorker<Void, Void>() {
+ /**
+ * Add selected result in available table to selected table.
+ *
+ * @param view view
+ */
+ public void addAvailableResult(SelectUploadResultView view) {
+
+ // get new result to add
+ List<Object[]> newResult = new ArrayList<Object[]>();
+ int[] selectedAvailableRows = view.getAvailableProjectTable().getSelectedRows();
+ for (int selectedAvailableRow : selectedAvailableRows) {
+ Object[] resultData = view.getAvailableProjectTableModel().getResultPath().get(selectedAvailableRow);
+ newResult.add(resultData);
+ }
- @Override
- protected Void doInBackground() {
-
- try {
- // get progress bar
- CoserProgressBar progressBar = view.getUploadProgressBar();
- ProjectService projectService = view.getContextValue(ProjectService.class);
- projectService.performResultUpload(selectedResult, progressBar);
- }
- catch (CoserBusinessException ex) {
- throw new CoserException("Can't send results", ex);
- }
- return null;
+ // les collisions ne peuvent pas être détecté a ce moment.
+ // seulement lors du clic sur le bouton export/upload
+
+ // add new results
+ List<Object[]> currentResult = view.getSelectedProjectTableModel().getResultPath();
+ currentResult.addAll(newResult);
+ view.getAvailableProjectTableModel().setResultPath(currentResult);
+ }
+
+ /**
+ * Remove selected result from selected list.
+ *
+ * @param view view
+ */
+ public void removeSelectedResult(SelectUploadResultView view) {
+ List<Object[]> currentResult = view.getSelectedProjectTableModel().getResultPath();
+ int[] selectedSelectedRows = view.getSelectedProjectTable().getSelectedRows();
+ for (int selectedSelectedRow : selectedSelectedRows) {
+ currentResult.remove(selectedSelectedRow);
+ }
+ view.getAvailableProjectTableModel().setResultPath(currentResult);
+ }
+
+ /**
+ * Perform file upload to coser server after selection by user.
+ *
+ * @param view view
+ */
+ public void performUploadResult(final ExportUploadDialog view) {
+
+ // get authen options
+ final String login = view.getUploadLogintextField().getText();
+ final String password = new String(view.getUploadPasswordtextField().getPassword());
+
+ // get result selected by user
+ SelectUploadResultView parentView = view.getContextValue(SelectUploadResultView.class, JAXXUtil.PARENT);
+ final Collection<Object[]> selectedResult = parentView.getSelectedProjectTableModel().getResultPath();
+ if (CollectionUtils.isNotEmpty(selectedResult)) {
+
+ SwingWorker<Void, Void> task = new SwingWorker<Void, Void>() {
+ @Override
+ protected Void doInBackground() {
+ try {
+ // get progress bar
+ CoserProgressBar progressBar = view.getUploadProgressBar();
+ WebService webService = view.getContextValue(WebService.class);
+ webService.performResultUpload(selectedResult, login, password, progressBar);
}
-
- @Override
- protected void done() {
+ catch (CoserBusinessException ex) {
+ throw new CoserException("Can't send results", ex);
+ }
+ return null;
+ }
- // laisser cet appel, sinon les exceptions sont silencieuse
- try {
- get();
- } catch (Exception ex) {
- throw new CoserException("Can't send results", ex);
- }
+ @Override
+ protected void done() {
- JOptionPane.showMessageDialog(view, _("coser.ui.uploadresult.resultsuploaded"),
- _("coser.ui.uploadresult.title"), JOptionPane.INFORMATION_MESSAGE);
+ // laisser cet appel, sinon les exceptions sont silencieuse
+ try {
+ get();
+ } catch (Exception ex) {
+ throw new CoserException("Can't send results", ex);
}
- };
- task.execute();
- }
+
+ JOptionPane.showMessageDialog(view, _("coser.ui.uploadresult.resultsuploaded"),
+ _("coser.ui.uploadresult.title"), JOptionPane.INFORMATION_MESSAGE);
+ }
+ };
+ task.execute();
}
- else {
- if (log.isDebugEnabled()) {
- log.debug("Upload result skipped");
- }
+ }
+
+ /**
+ * Perform file upload to coser server after selection by user.
+ *
+ * @param view view
+ */
+ public void performExtractResult(ExportUploadDialog view) {
+
+ // get extract directory
+ String extractPath = view.getExtractToTextField().getText();
+ File extractDirectory = new File(extractPath);
+
+ // get source data option
+ boolean withData = view.getSourceDataExport().isSelected();
+
+ SelectUploadResultView parentView = view.getContextValue(SelectUploadResultView.class, JAXXUtil.PARENT);
+ Collection<Object[]> selectedResult = parentView.getSelectedProjectTableModel().getResultPath();
+ WebService webService = view.getContextValue(WebService.class);
+ try {
+ webService.performResultExtract(selectedResult, extractDirectory, withData);
+ JOptionPane.showMessageDialog(view, _("coser.ui.uploadresult.resultsextracted"),
+ _("coser.ui.uploadresult.title"), JOptionPane.INFORMATION_MESSAGE);
}
+ catch (CoserBusinessException ex) {
+ throw new CoserException("Can't upload results", ex);
+ }
+
}
+
+ /**
+ * Just display export / upload dialog.
+ *
+ * @param view parent view
+ */
+ public void showExportUploadDialog(SelectUploadResultView view) {
+ ExportUploadDialog dialog = new ExportUploadDialog(view);
+ dialog.setHandler(this);
+ dialog.setLocationRelativeTo(view);
+ dialog.setVisible(true);
+ }
+
+ /**
+ * Select result file (directory only).
+ *
+ * @param view view
+ * @param textComponent text component to set selected file
+ */
+ public void selectExportDirectory(ExportUploadDialog view, JTextField textComponent) {
+ JFileChooser selectFileChooser = getFileChooserInstance();
+ selectFileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
+
+ int result = selectFileChooser.showOpenDialog(view);
+ if (result == JFileChooser.APPROVE_OPTION) {
+ File selectedFile = selectFileChooser.getSelectedFile();
+ textComponent.setText(selectedFile.getAbsolutePath());
+ }
+ }
}
Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/ResultTableModel.java
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/ResultTableModel.java 2011-01-12 15:54:25 UTC (rev 504)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/ResultTableModel.java 2011-01-14 14:05:29 UTC (rev 505)
@@ -3,7 +3,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2010 Ifremer, Codelutin, Chatellier Eric
+ * Copyright (C) 2010 - 2011 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
Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/RsufiResultRenderer.java
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/RsufiResultRenderer.java 2011-01-12 15:54:25 UTC (rev 504)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/RsufiResultRenderer.java 2011-01-14 14:05:29 UTC (rev 505)
@@ -3,7 +3,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2010 Ifremer, Codelutin, Chatellier Eric
+ * Copyright (C) 2010 - 2011 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
@@ -28,10 +28,12 @@
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;
-import org.apache.commons.lang.StringUtils;
+import fr.ifremer.coser.bean.Project;
+import fr.ifremer.coser.bean.RSufiResult;
+import fr.ifremer.coser.bean.Selection;
/**
- * TODO add comment here.
+ * Available and selected result path renderer.
*
* @author chatellier
* @version $Revision$
@@ -49,9 +51,12 @@
boolean isSelected, boolean hasFocus, int row, int column) {
Object localValue = value;
- if (value instanceof String[]) {
- String[] arrayValue = (String[])value;
- localValue = StringUtils.join(arrayValue, '/');
+ if (value instanceof Object[]) {
+ Object[] arrayValue = (Object[])value;
+ //localValue = StringUtils.join(arrayValue, '/');
+ localValue = ((Project)arrayValue[0]).getName() + "/" +
+ ((Selection)arrayValue[1]).getName() + "/" +
+ ((RSufiResult)arrayValue[2]).getName();
}
return super.getTableCellRendererComponent(table, localValue, isSelected, hasFocus,
row, column);
Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/RsufiResultTreeModel.java
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/RsufiResultTreeModel.java 2011-01-12 15:54:25 UTC (rev 504)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/RsufiResultTreeModel.java 2011-01-14 14:05:29 UTC (rev 505)
@@ -3,7 +3,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2010 Ifremer, Codelutin, Chatellier Eric
+ * Copyright (C) 2010 - 2011 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
@@ -25,12 +25,15 @@
import static org.nuiton.i18n.I18n._;
+import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.swing.table.AbstractTableModel;
+import fr.ifremer.coser.bean.RSufiResult;
+
/**
* Model represantant la liste de tous les resultats rsufi present
* dans le dossier de stockage de coser, tous projets confondu.
@@ -46,20 +49,41 @@
/** serialVersionUID. */
private static final long serialVersionUID = 6404018386062830677L;
- protected List<String[]> resultPath;
+ /** Les données de la table. */
+ protected List<Object[]> resultPath;
- protected Set<String[]> selectedResult;
-
- public void setResultPath(List<String[]> resultPath) {
+ /** Les résultats marqué comme étant des données de map. */
+ protected Set<Object[]> mapResult;
+
+ /** Les résultat dont la publication des données est autorisée. */
+ protected Set<Object[]> publishDataResult;
+
+ /** Selected table tablemodel (do not show all columns). */
+ protected boolean selected;
+
+ public RsufiResultTreeModel(boolean selected) {
+ this.selected = selected;
+ }
+
+ public void setResultPath(List<Object[]> resultPath) {
this.resultPath = resultPath;
- selectedResult = new HashSet<String[]>();
+ mapResult = new HashSet<Object[]>();
+ publishDataResult = new HashSet<Object[]>();
fireTableDataChanged();
}
- public Set<String[]> getSelectedResult() {
- return selectedResult;
+ public List<Object[]> getResultPath() {
+ return resultPath;
}
+ public Set<Object[]> getMapResult() {
+ return mapResult;
+ }
+
+ public Set<Object[]> getPublishDataResult() {
+ return publishDataResult;
+ }
+
/*
* @see javax.swing.table.TableModel#getRowCount()
*/
@@ -77,11 +101,17 @@
String result = null;
switch(column) {
case 0:
- result = _("coser.ui.uploadresult.path");
+ result = _("coser.ui.uploadresult.creationDate");
break;
case 1:
- result = _("coser.ui.uploadresult.selected");
+ result = _("coser.ui.uploadresult.path");
break;
+ case 2:
+ result = _("coser.ui.uploadresult.mapResult");
+ break;
+ case 3:
+ result = _("coser.ui.uploadresult.publishData");
+ break;
}
return result;
}
@@ -91,11 +121,17 @@
Class<?> result = null;
switch(columnIndex) {
case 0:
+ result = Date.class;
+ break;
+ case 1:
result = String[].class;
break;
- case 1:
+ case 2:
result = Boolean.class;
break;
+ case 3:
+ result = Boolean.class;
+ break;
}
return result;
}
@@ -105,7 +141,11 @@
*/
@Override
public int getColumnCount() {
- return 2;
+ int result = 2;
+ if (selected) {
+ result = 4;
+ }
+ return result;
}
/*
@@ -116,15 +156,25 @@
Object result = null;
- String[] data = resultPath.get(rowIndex);
+ Object[] data = resultPath.get(rowIndex);
switch (columnIndex) {
case 0:
+ RSufiResult rsufiResult = (RSufiResult)data[2];
+ result = rsufiResult.getCreationDate();
+ break;
+ case 1:
result = data;
break;
- case 1:
+ case 2:
// c'est pas tres safe tu les hashcode des tableaux
// mais bon...
- result = selectedResult.contains(data);
+ result = mapResult.contains(data);
+ break;
+ case 3:
+ // c'est pas tres safe tu les hashcode des tableaux
+ // mais bon...
+ result = publishDataResult.contains(data);
+ break;
}
return result;
@@ -132,20 +182,31 @@
@Override
public boolean isCellEditable(int rowIndex, int columnIndex) {
- return columnIndex == 1;
+ return columnIndex >= 1;
}
@Override
public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
+
+ Object[] data = resultPath.get(rowIndex);
+
+ if (columnIndex == 2) {
+ Boolean bValue = (Boolean)aValue;
+ if (bValue.booleanValue()) {
+ mapResult.add(data);
+ }
+ else {
+ mapResult.remove(data);
+ }
+ }
- if (aValue instanceof Boolean) {
- String[] data = resultPath.get(rowIndex);
+ else if (columnIndex == 3) {
Boolean bValue = (Boolean)aValue;
if (bValue.booleanValue()) {
- selectedResult.add(data);
+ publishDataResult.add(data);
}
else {
- selectedResult.remove(data);
+ publishDataResult.remove(data);
}
}
}
Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/SelectUploadResultView.jaxx
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/SelectUploadResultView.jaxx 2011-01-12 15:54:25 UTC (rev 504)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/SelectUploadResultView.jaxx 2011-01-14 14:05:29 UTC (rev 505)
@@ -5,7 +5,7 @@
$Id$
$HeadURL$
%%
- Copyright (C) 2010 Ifremer, Codelutin, Chatellier Eric
+ Copyright (C) 2010 - 2011 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
@@ -31,22 +31,78 @@
</cell>
</row>
<row>
- <cell weightx="1" fill="both">
+ <cell weightx="1" fill="horizontal">
+ <JLabel text="coser.ui.uploadresult.availableResults" />
+ </cell>
+ </row>
+ <row>
+ <cell weightx="1" fill="horizontal">
+ <Table>
+ <row>
+ <cell>
+ <JLabel text="coser.ui.uploadresult.filter.beginDate" />
+ </cell>
+ <cell>
+ <JXDatePicker id="filterBeginDate"
+ onActionPerformed="getHandler().updateAvailableResultsFilter(this)" />
+ </cell>
+ <cell>
+ <JLabel text="coser.ui.uploadresult.filter.endDate" />
+ </cell>
+ <cell>
+ <JXDatePicker id="filterEndDate"
+ onActionPerformed="getHandler().updateAvailableResultsFilter(this)" />
+ </cell>
+ <cell>
+ <JLabel text="coser.ui.uploadresult.filter.publiableResults" />
+ </cell>
+ <cell>
+ <JCheckBox id="publiableResults" selected="true"
+ onActionPerformed="getHandler().updateAvailableResultsFilter(this)" />
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
+ <row>
+ <cell weightx="1" weighty="1" fill="both">
<JScrollPane>
- <RsufiResultTreeModel id="selectedProjectTableModel" />
- <JTable id="selectedProjectTable" model="{getSelectedProjectTableModel()}"/>
+ <RsufiResultTreeModel id="availableProjectTableModel" initializer='new RsufiResultTreeModel(false)'
+ onTableChanged='addResultButton.setEnabled(getAvailableProjectTableModel().getRowCount() == 0)'/>
+ <JTable id="availableProjectTable" model="{getAvailableProjectTableModel()}"/>
</JScrollPane>
</cell>
</row>
<row>
- <cell weightx="1" anchor="east">
- <JButton text="coser.ui.uploadresult.upload"
- onActionPerformed="getHandler().performResultUpload(this)"/>
+ <cell weightx="1" anchor="center">
+ <JButton id="addResultButton" text="coser.ui.uploadresult.addResults"
+ onActionPerformed="getHandler().addAvailableResult(this)" />
</cell>
</row>
<row>
<cell weightx="1" fill="horizontal">
- <fr.ifremer.coser.ui.util.CoserProgressBar id="uploadProgressBar" stringPainted="true" />
+ <JLabel text="coser.ui.uploadresult.selectedResults" />
</cell>
</row>
+ <row>
+ <cell weightx="1" weighty="1" fill="both">
+ <JScrollPane>
+ <RsufiResultTreeModel id="selectedProjectTableModel" initializer='new RsufiResultTreeModel(true)'
+ onTableChanged='removeResultButton.setEnabled(getAvailableProjectTableModel().getRowCount() == 0)'/>
+ <JTable id="selectedProjectTable" model="{getSelectedProjectTableModel()}"/>
+ </JScrollPane>
+ </cell>
+ </row>
+ <row>
+ <cell weightx="1" anchor="center">
+ <JButton id="removeResultButton" text="coser.ui.uploadresult.removeResults"
+ onActionPerformed="getHandler().removeSelectedResult(this)"/>
+ </cell>
+ </row>
+ <row>
+ <cell weightx="1" anchor="east">
+ <JButton text="coser.ui.uploadresult.exportupload"
+ onActionPerformed="getHandler().showExportUploadDialog(this)"/>
+ </cell>
+ </row>
</Table>
Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/SelectionAddResultDialog.jaxx
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/SelectionAddResultDialog.jaxx 2011-01-12 15:54:25 UTC (rev 504)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/SelectionAddResultDialog.jaxx 2011-01-14 14:05:29 UTC (rev 505)
@@ -63,11 +63,20 @@
</row>
<row>
<cell anchor="west">
+ <JLabel text="coser.ui.result.creationDate" />
+ </cell>
+ <cell fill="horizontal" columns="2">
+ <JXDatePicker id="resultCreationDate" date="{new java.util.Date()}"
+ onActionPerformed="getRsufiResult().setCreationDate(resultCreationDate.getDate())"/>
+ </cell>
+ </row>
+ <row>
+ <cell anchor="west">
<JLabel text="coser.ui.result.zone" />
</cell>
<cell fill="horizontal" columns="2">
<JComboBox id="resultZoneCombo" model="{new ZoneComboBoxModel(this)}"
- renderer="{new ZoneComboBoxRenderer(this)}"
+ renderer="{new ZoneComboBoxRenderer()}"
onActionPerformed='getRsufiResult().setZone((String)resultZoneCombo.getSelectedItem())'/>
</cell>
</row>
Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/ZoneComboBoxModel.java
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/ZoneComboBoxModel.java 2011-01-12 15:54:25 UTC (rev 504)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/ZoneComboBoxModel.java 2011-01-14 14:05:29 UTC (rev 505)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2011 Codelutin, Chatellier Eric
+ * Copyright (C) 2011 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
@@ -25,15 +25,12 @@
package fr.ifremer.coser.ui.result;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
import javax.swing.DefaultComboBoxModel;
import fr.ifremer.coser.CoserBusinessException;
import fr.ifremer.coser.CoserException;
import fr.ifremer.coser.services.WebService;
+import fr.ifremer.coser.storage.DataStorage;
/**
* Zone combo box model.
@@ -51,19 +48,16 @@
/** serialVersionUID. */
private static final long serialVersionUID = 4452070553401468762L;
- public SelectionAddResultDialog view;
+ protected SelectionAddResultDialog view;
- public List<String> zonesIds;
+ protected DataStorage zonesMap;
- public Map<String, String[]> zonesMap;
-
public ZoneComboBoxModel(SelectionAddResultDialog view) {
this.view = view;
WebService webService = view.getContextValue(WebService.class);
try {
zonesMap = webService.getZonesMap();
- zonesIds = new ArrayList<String>(zonesMap.keySet());
} catch (CoserBusinessException ex) {
throw new CoserException("Can't get zone list", ex);
}
@@ -71,15 +65,23 @@
@Override
public int getSize() {
- return zonesIds.size();
+ // -1 for header
+ return zonesMap.size() - 1;
}
@Override
public Object getElementAt(int index) {
- return zonesIds.get(index);
+ // "id";"facade";"zone";"periode";"serie";"comment";"map"
+ // +1 for header
+ return zonesMap.get(index + 1)[0];
}
-
+
public String[] getZone(String zoneId) {
- return zonesMap.get(zoneId);
+ int index = zonesMap.indexOf(zoneId);
+ String[] result = null;
+ if (index != -1) {
+ result = zonesMap.get(index);
+ }
+ return result;
}
}
Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/ZoneComboBoxRenderer.java
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/ZoneComboBoxRenderer.java 2011-01-12 15:54:25 UTC (rev 504)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/result/ZoneComboBoxRenderer.java 2011-01-14 14:05:29 UTC (rev 505)
@@ -5,7 +5,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2011 Codelutin, Chatellier Eric
+ * Copyright (C) 2011 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
@@ -30,9 +30,6 @@
import javax.swing.DefaultListCellRenderer;
import javax.swing.JList;
-import fr.ifremer.coser.bean.Selection;
-import fr.ifremer.coser.services.ProjectService;
-
/**
* Zone list combo renderer (display zone name for zone id).
*
@@ -47,27 +44,21 @@
/** serialVersionUID. */
private static final long serialVersionUID = -8231189755539976714L;
- protected String surveyName;
-
- public ZoneComboBoxRenderer(SelectionAddResultDialog view) {
- ProjectService projectService = view.getContextValue(ProjectService.class);
- Selection selection = view.getContextValue(Selection.class);
- surveyName = projectService.getProjectSurveyName(selection);
- }
-
@Override
public Component getListCellRendererComponent(JList list, Object value,
int index, boolean isSelected, boolean cellHasFocus) {
String zoneId = (String)value;
ZoneComboBoxModel model = (ZoneComboBoxModel)list.getModel();
- String[] zoneInfo = model.getZone(zoneId);
+
+ // "id";"facade";"zone";"periode";"serie";"comment";"map"
+ String[] zoneData = model.getZone(zoneId);
String zoneName = null;
- if (zoneInfo != null) {
+ if (zoneData != null) {
// le surveyName ne sert à rien
// mais est la a titre d'information par rapport
// à l'affichage cote web
- zoneName = zoneInfo[0] + " - " + zoneInfo[1] + " - " + surveyName;
+ zoneName = zoneData[1] + " - " + zoneData[2] + " - " + zoneData[3] + " - " + zoneData[4];
}
else {
zoneName = zoneId;
Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/selection/SelectionDetailsView.jaxx
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/selection/SelectionDetailsView.jaxx 2011-01-12 15:54:25 UTC (rev 504)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/selection/SelectionDetailsView.jaxx 2011-01-14 14:05:29 UTC (rev 505)
@@ -5,7 +5,7 @@
$Id$
$HeadURL$
%%
- Copyright (C) 2010 Ifremer, Codelutin, Chatellier Eric
+ Copyright (C) 2010 - 2011 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
@@ -132,7 +132,7 @@
</cell>
<cell anchor="south">
<JButton id="validDatesButton" text="coser.ui.selection.details.validYears"
- onActionPerformed="getHandler().updateSelectionYearsData(this);setYearsValidated(true)"
+ onActionPerformed="getHandler().updateSelectionYearsData(this, false);setYearsValidated(true)"
enabled="{!isYearsValidated()}"/>
</cell>
</row>
@@ -168,7 +168,7 @@
<row>
<cell anchor="south" columns="2">
<JButton id="validStrataButton" text="coser.ui.selection.details.validStrata"
- onActionPerformed="getHandler().strataListChanged(this);setStrataValidated(true)"
+ onActionPerformed="getHandler().updateSelectionStrataData(this, false);setStrataValidated(true)"
enabled="{isYearsValidated() && !isStrataValidated()}"/>
</cell>
</row>
Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/selection/SelectionHandler.java
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/selection/SelectionHandler.java 2011-01-12 15:54:25 UTC (rev 504)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/selection/SelectionHandler.java 2011-01-14 14:05:29 UTC (rev 505)
@@ -35,6 +35,7 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
+import java.util.Date;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
@@ -89,12 +90,6 @@
private static final Log log = LogFactory.getLog(SelectionHandler.class);
- /** File chooser de l'export de répertoire. */
- protected JFileChooser exportFileChooser;
-
- /** File chooser de l'ajout de fichier resultat. */
- protected JFileChooser resultFileChooser;
-
/**
* Appelé sur un changement d'onglet dans l'interface de sélection.
*
@@ -237,7 +232,7 @@
((CoserListSelectionModel)detailView.getStrataList().getSelectionModel()).setSelectedObjects(selectedStrata);
// details view : fill species list and selection
- strataListChanged(detailView);
+ updateSelectionStrataData(detailView, true);
List<String> selectedSpecies = selection.getSelectedSpecies();
detailView.getSelectedSpeciesListModel().setSpecies(selectedSpecies);
@@ -291,6 +286,7 @@
* N'affiche pas de message utilsateur dans le cas d'un reload.
*
* @param view view
+ * @param reload reload total de la selection (n'affiche pas de message)
*/
protected void updateSelectionYearsData(SelectionDetailsView view, boolean reload) {
Project project = view.getContextValue(Project.class);
@@ -335,16 +331,6 @@
throw new CoserException("Can't filters data with specified years", ex);
}
}
-
- /**
- * Rafraichit la liste des zones suite à la selection des années et affiche
- * un message utilsateur.
- *
- * @param view view
- */
- public void updateSelectionYearsData(SelectionDetailsView view) {
- updateSelectionYearsData(view, false);
- }
/**
* Init openmap toolbar and openmap layers.
@@ -364,11 +350,12 @@
}
/**
- * Appellé lorsque la selection de la liste des zones a changé.
+ * Appelé lorsque la selection de la liste des zones a changé.
*
* @param view view
+ * @param reload reload total de la selection (n'affiche pas de message)
*/
- public void strataListChanged(SelectionDetailsView view) {
+ public void updateSelectionStrataData(SelectionDetailsView view, boolean reload) {
if (log.isDebugEnabled()) {
log.debug("Zone list selection changed, updating species list");
}
@@ -384,6 +371,11 @@
selection.setSelectedStrata(strata);
updateSelectionSpecies(view);
+
+ if (!reload) {
+ JOptionPane.showMessageDialog(view, _("coser.ui.selection.detail.stratavalidated"),
+ _("coser.ui.selection.selectionTitle"), JOptionPane.INFORMATION_MESSAGE);
+ }
}
/**
@@ -1101,20 +1093,6 @@
}
view.dispose();
}
-
- /**
- * Retourne une unique instance du file chooser pour conserver
- * le répertoire de sélection d'un appel sur l'autre.
- *
- * @return
- */
- protected JFileChooser getExportFileChooser() {
- if (exportFileChooser == null) {
- exportFileChooser = new JFileChooser();
- exportFileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
- }
- return exportFileChooser;
- }
/**
* Selectionne le dossier d'extraction.
@@ -1123,7 +1101,8 @@
* @param textComponent text component to set selected directory
*/
public void selectOutputDirectory(SelectionRsufiView view, JTextField textComponent) {
- JFileChooser selectFileChooser = getExportFileChooser();
+ JFileChooser selectFileChooser = getFileChooserInstance();
+ selectFileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
int result = selectFileChooser.showOpenDialog(view);
if (result == JFileChooser.APPROVE_OPTION) {
@@ -1156,26 +1135,13 @@
}
/**
- * Retourne une unique instance du file chooser pour conserver
- * le répertoire de sélection d'un appel sur l'autre.
- *
- * @return l'instance a utiliser
- */
- protected JFileChooser getResultFileChooser() {
- if (resultFileChooser == null) {
- resultFileChooser = new JFileChooser();
- }
- return resultFileChooser;
- }
-
- /**
* Select result file (file only).
*
* @param view view
* @param textComponent text component to set selected file
*/
public void selectResultFile(SelectionAddResultDialog view, JTextField textComponent) {
- JFileChooser selectFileChooser = getResultFileChooser();
+ JFileChooser selectFileChooser = getFileChooserInstance();
selectFileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
int result = selectFileChooser.showOpenDialog(view);
@@ -1192,7 +1158,7 @@
* @param textComponent text component to set selected directory
*/
public void selectMapsDirectory(SelectionAddResultDialog view, JTextField textComponent) {
- JFileChooser selectFileChooser = getResultFileChooser();
+ JFileChooser selectFileChooser = getFileChooserInstance();
selectFileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
int result = selectFileChooser.showOpenDialog(view);
@@ -1209,7 +1175,7 @@
* @param listComponent list component to set selected file
*/
public void selectResultFileOrDirectory(SelectionAddResultDialog view, JList listComponent) {
- JFileChooser selectFileChooser = getResultFileChooser();
+ JFileChooser selectFileChooser = getFileChooserInstance();
selectFileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
int result = selectFileChooser.showOpenDialog(view);
Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/util/ErrorHelper.java
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/util/ErrorHelper.java 2011-01-12 15:54:25 UTC (rev 504)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/util/ErrorHelper.java 2011-01-14 14:05:29 UTC (rev 505)
@@ -109,7 +109,7 @@
* @see org.jdesktop.swingx.error.ErrorReporter#reportError(org.jdesktop.swingx.error.ErrorInfo)
*/
@Override
- public void reportError(ErrorInfo errorInfo) throws NullPointerException {
+ public void reportError(ErrorInfo errorInfo) {
try {
String emailTo = coserConfig.getSupportEmail();
@@ -138,7 +138,7 @@
for (String propertyName : propertiesNames) {
// security, don't send string containing password :
if (!propertyName.contains("pass")) {
- message.append("\t" + propertyName + " : " + coserConfig.getOptions().getProperty(propertyName) + "\n");
+ message.append("\t" + propertyName + " : " + coserConfig.getOptions().getProperty(propertyName) + "\n");
}
}
Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/widgets/ComponentTitledBorder.java
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/widgets/ComponentTitledBorder.java 2011-01-12 15:54:25 UTC (rev 504)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/ui/widgets/ComponentTitledBorder.java 2011-01-14 14:05:29 UTC (rev 505)
@@ -31,7 +31,7 @@
import javax.swing.border.Border;
public class ComponentTitledBorder implements Border, MouseListener, SwingConstants {
- int offset = 5;
+ protected int offset = 5;
protected Component titleComponent;
protected JComponent container;
Modified: trunk/coser-ui/src/main/resources/fr/ifremer/coser/bean/RSufiResult-error-validation.xml
===================================================================
--- trunk/coser-ui/src/main/resources/fr/ifremer/coser/bean/RSufiResult-error-validation.xml 2011-01-12 15:54:25 UTC (rev 504)
+++ trunk/coser-ui/src/main/resources/fr/ifremer/coser/bean/RSufiResult-error-validation.xml 2011-01-14 14:05:29 UTC (rev 505)
@@ -51,10 +51,4 @@
<message>coser.ui.result.requiredestPopIndPath</message>
</field-validator>
</field>
- <field name="mapsPath">
- <field-validator type="requiredstring">
- <param name="trim">true</param>
- <message>coser.ui.result.requiredmapsPath</message>
- </field-validator>
- </field>
</validators>
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 2011-01-12 15:54:25 UTC (rev 504)
+++ trunk/coser-ui/src/main/resources/i18n/coser-ui_en_GB.properties 2011-01-14 14:05:29 UTC (rev 505)
@@ -129,6 +129,7 @@
coser.ui.result.addOtherDataFile=Add file
coser.ui.result.availableDataTitle=Available results \:
coser.ui.result.cancel=Cancel
+coser.ui.result.creationDate=Result date \:
coser.ui.result.estComIndFile=ESTCOMind file \:
coser.ui.result.estPopIndFile=ESTPOPind file \:
coser.ui.result.extractDataButton=Extract as Rsufi format
@@ -140,7 +141,6 @@
coser.ui.result.publishResult=Publish \:
coser.ui.result.requiredestComIndPath=ESTCOMind file is required
coser.ui.result.requiredestPopIndPath=ESTPOPind file is required
-coser.ui.result.requiredmapsPath=Maps directory is required
coser.ui.result.requiredname=Result name is required
coser.ui.result.requiredrsufiVersion=Rsufi version is required
coser.ui.result.resultName=Result name \:
@@ -160,6 +160,7 @@
coser.ui.selection.detail.mainAccordion=Details
coser.ui.selection.detail.speciesAccordion=Species
coser.ui.selection.detail.strataAccordion=Strata
+coser.ui.selection.detail.stratavalidated=Strata validated.
coser.ui.selection.detail.yearAccordion=Years
coser.ui.selection.detail.yearsvalidated=Years validated.
coser.ui.selection.details.addToSelectedListTip=Add selected species to selected species list.
@@ -216,13 +217,31 @@
coser.ui.selection.tab.details=Selection details
coser.ui.selection.tab.lists=Species lists
coser.ui.selection.tab.rsufi=RSufi
-coser.ui.uploadresult.confirmupload=Are you sure you want to upload this results ?
+coser.ui.uploadresult.addResults=Add results
+coser.ui.uploadresult.availableResults=Available results \:
+coser.ui.uploadresult.creationDate=Creaction date
coser.ui.uploadresult.explanation=Welcome in results server publication interface. Only administrators with password can use this interface.
+coser.ui.uploadresult.exportUploadTitle=Export/Upload
+coser.ui.uploadresult.exportupload=Extract/Upload
+coser.ui.uploadresult.extract=Extract
+coser.ui.uploadresult.extractChoice=Extract to directory
+coser.ui.uploadresult.extractTo=Extract directory \:
+coser.ui.uploadresult.extractWithData=Extract results with sources data
+coser.ui.uploadresult.filter.beginDate=Begin date \:
+coser.ui.uploadresult.filter.endDate=End date \:
+coser.ui.uploadresult.filter.publiableResults=Only publiables results
+coser.ui.uploadresult.mapResult=Map result
coser.ui.uploadresult.path=Result path
+coser.ui.uploadresult.publishData=Allow source data
+coser.ui.uploadresult.removeResults=Remove results
+coser.ui.uploadresult.resultsextracted=Result extracted.
coser.ui.uploadresult.resultsuploaded=Results published.
-coser.ui.uploadresult.selected=\u2026
+coser.ui.uploadresult.selectedResults=Selected results \:
coser.ui.uploadresult.title=Results publication
coser.ui.uploadresult.upload=Send results
+coser.ui.uploadresult.uploadChoice=Upload to server
+coser.ui.uploadresult.uploadLogin=Admin login \:
+coser.ui.uploadresult.uploadPassword=Admin password \:
coser.ui.validators.content=Content \:
coser.ui.validators.description=Application must be restarted after validators modification.
coser.ui.validators.title=Controls
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 2011-01-12 15:54:25 UTC (rev 504)
+++ trunk/coser-ui/src/main/resources/i18n/coser-ui_fr_FR.properties 2011-01-14 14:05:29 UTC (rev 505)
@@ -129,6 +129,7 @@
coser.ui.result.addOtherDataFile=Ajouter un fichier
coser.ui.result.availableDataTitle=R\u00E9sultats disponibles
coser.ui.result.cancel=Annuler
+coser.ui.result.creationDate=Date du r\u00E9sultats \:
coser.ui.result.estComIndFile=Fichier ESTCOMind \:
coser.ui.result.estPopIndFile=Fichier ESTPOPind \:
coser.ui.result.extractDataButton=Extraire au format RSufi
@@ -140,7 +141,6 @@
coser.ui.result.publishResult=Publication \:
coser.ui.result.requiredestComIndPath=Le fichier ESTCOMind est requis
coser.ui.result.requiredestPopIndPath=Le fichier ESTPOPind est requis
-coser.ui.result.requiredmapsPath=Le dossier des cartes 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 \:
@@ -160,6 +160,7 @@
coser.ui.selection.detail.mainAccordion=D\u00E9tails
coser.ui.selection.detail.speciesAccordion=Esp\u00E8ces
coser.ui.selection.detail.strataAccordion=Strates
+coser.ui.selection.detail.stratavalidated=Strates valid\u00E9es.
coser.ui.selection.detail.yearAccordion=Ann\u00E9es
coser.ui.selection.detail.yearsvalidated=Ann\u00E9es valid\u00E9es.
coser.ui.selection.details.addToSelectedListTip=Ajoute les esp\u00E8ces s\u00E9lectionn\u00E9es \u00E0 la liste des especes s\u00E9lectionn\u00E9es.
@@ -216,13 +217,31 @@
coser.ui.selection.tab.details=D\u00E9tails de la s\u00E9lection
coser.ui.selection.tab.lists=Listes des esp\u00E8ces
coser.ui.selection.tab.rsufi=RSufi
-coser.ui.uploadresult.confirmupload=\u00CAtes vous s\u00FBr de vouloir publier ces r\u00E9sultats ?
+coser.ui.uploadresult.addResults=Ajouter le r\u00E9sultat
+coser.ui.uploadresult.availableResults=R\u00E9sultats disponible \:
+coser.ui.uploadresult.creationDate=Date de cr\u00E9ation
coser.ui.uploadresult.explanation=Bienvenue dans l'interface de s\u00E9lection des r\u00E9sultats \u00E0 envoyer sur le serveur Coser. Seul les administrateurs disposant du mot de passe peuvent effectuer cette action.
+coser.ui.uploadresult.exportUploadTitle=Exporter/Uploader
+coser.ui.uploadresult.exportupload=Exporter/Uploader
+coser.ui.uploadresult.extract=Extraire
+coser.ui.uploadresult.extractChoice=Extraire vers un dossier
+coser.ui.uploadresult.extractTo=Dossier d'extraction \:
+coser.ui.uploadresult.extractWithData=Extraire les r\u00E9sultats avec les donn\uFFFDes sources
+coser.ui.uploadresult.filter.beginDate=Date de d\u00E9but \:
+coser.ui.uploadresult.filter.endDate=Date de fin \:
+coser.ui.uploadresult.filter.publiableResults=Seulement les r\u00E9sultats publiables
+coser.ui.uploadresult.mapResult=R\u00E9sultat de cartes
coser.ui.uploadresult.path=Chemin du r\u00E9sultats
+coser.ui.uploadresult.publishData=Autoriser les sources
+coser.ui.uploadresult.removeResults=Supprimer le r\u00E9sultat
+coser.ui.uploadresult.resultsextracted=R\u00E9sultats extraits.
coser.ui.uploadresult.resultsuploaded=R\u00E9sultats publi\u00E9s.
-coser.ui.uploadresult.selected=\u2026
+coser.ui.uploadresult.selectedResults=R\u00E9sultats s\u00E9lectionn\u00E9s \:
coser.ui.uploadresult.title=Publication des r\u00E9sultats
coser.ui.uploadresult.upload=Envoyer les r\u00E9sultats
+coser.ui.uploadresult.uploadChoice=Envoyer sur le serveur
+coser.ui.uploadresult.uploadLogin=Login admin \:
+coser.ui.uploadresult.uploadPassword=Mot de passe admin \:
coser.ui.validators.content=Contenu \:
coser.ui.validators.description=L'application doit \u00EAtre red\u00E9marr\u00E9e apr\u00E8s la modification des validateurs.
coser.ui.validators.title=Contr\u00F4les
Modified: trunk/coser-web/src/main/java/fr/ifremer/coser/web/CoserWebConfig.java
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/CoserWebConfig.java 2011-01-12 15:54:25 UTC (rev 504)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/CoserWebConfig.java 2011-01-14 14:05:29 UTC (rev 505)
@@ -57,22 +57,22 @@
}
/**
- * Get admin password.
+ * Get admin login.
*
- * @return admin password
+ * @return admin login
*/
- public String getAdminPassword() {
- String result = getOption(CoserWebOption.ADMIN_PASSWORD.key);
+ public String getAdminLogin() {
+ String result = getOption(CoserWebOption.ADMIN_LOGIN.key);
return result;
}
/**
- * Get eastwood server url to use.
+ * Get admin password.
*
- * @return eastwood context url
+ * @return admin password
*/
- public String getEastWoodUrl() {
- String result = getOption(CoserWebOption.EASTWOOD_URL.key);
+ public String getAdminPassword() {
+ String result = getOption(CoserWebOption.ADMIN_PASSWORD.key);
return result;
}
@@ -80,8 +80,8 @@
CONFIG_FILE(CONFIG_FILE_NAME, _("coser.config.config.file.description"), "coserweb.properties"),
ADMIN_EMAIL("coser.admin.email", _("coser.config.config.file.description"), "harmonie at ifremer.fr"),
- ADMIN_PASSWORD("coser.admin.password", _("coser.config.admin.password.description"), null),
- EASTWOOD_URL("coser.eastwood.url", _("coser.config.eastwood.url.description"), "http://www.ifremer.fr/eastwood");
+ ADMIN_LOGIN("coser.admin.login", _("coser.config.admin.login.description"), null),
+ ADMIN_PASSWORD("coser.admin.password", _("coser.config.admin.password.description"), null);
protected String key;
protected String description;
Modified: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/UploadResultAction.java
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/UploadResultAction.java 2011-01-12 15:54:25 UTC (rev 504)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/UploadResultAction.java 2011-01-14 14:05:29 UTC (rev 505)
@@ -34,6 +34,7 @@
import org.apache.commons.io.IOUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.nuiton.util.StringUtil;
import com.opensymphony.xwork2.Action;
@@ -61,38 +62,49 @@
private static final Log log = LogFactory.getLog(UploadResultAction.class);
- private File resultFile;
+ protected File resultFile;
- private String password;
+ protected String login;
+ protected String sha1Password;
+
+ public File getResultFile() {
+ return resultFile;
+ }
+
public void setResultFile(File resultFile) {
this.resultFile = resultFile;
}
- public void setPassword(String password) {
- this.password = password;
+ public String getLogin() {
+ return login;
}
- public File getResultFile() {
- return resultFile;
+ public void setLogin(String login) {
+ this.login = login;
}
- public String getPassword() {
- return password;
+ public void setSha1Password(String sha1Password) {
+ this.sha1Password = sha1Password;
}
+ public String getSha1Password() {
+ return sha1Password;
+ }
+
public String execute() {
// check
CoserWebConfig config = ServiceFactory.getCoserConfig();
- if (config.getAdminPassword() == null) {
+ if (config.getAdminPassword() == null || config.getAdminLogin() == null) {
if (log.isWarnEnabled()) {
log.warn("No admin password set, cannot enable result upload");
}
}
else {
- if (config.getAdminPassword().equals(password)) {
+ String configSha1Password = StringUtil.encodeSHA1(config.getAdminPassword());
+ if (config.getAdminLogin().equals(login) && configSha1Password.equals(sha1Password)) {
if (resultFile != null) {
WebService webService = ServiceFactory.getWebService();
try {
@@ -112,7 +124,7 @@
}
else {
if (log.isWarnEnabled()) {
- log.warn("Wrong password");
+ log.warn("Wrong login/password : login = " + login);
}
}
}
Modified: trunk/coser-web/src/main/resources/i18n/coser-web_en_GB.properties
===================================================================
--- trunk/coser-web/src/main/resources/i18n/coser-web_en_GB.properties 2011-01-12 15:54:25 UTC (rev 504)
+++ trunk/coser-web/src/main/resources/i18n/coser-web_en_GB.properties 2011-01-14 14:05:29 UTC (rev 505)
@@ -1,3 +1,3 @@
+coser.config.admin.login.description=
coser.config.admin.password.description=
coser.config.config.file.description=
-coser.config.eastwood.url.description=
Modified: trunk/coser-web/src/main/resources/i18n/coser-web_fr_FR.properties
===================================================================
--- trunk/coser-web/src/main/resources/i18n/coser-web_fr_FR.properties 2011-01-12 15:54:25 UTC (rev 504)
+++ trunk/coser-web/src/main/resources/i18n/coser-web_fr_FR.properties 2011-01-14 14:05:29 UTC (rev 505)
@@ -1,3 +1,3 @@
+coser.config.admin.login.description=
coser.config.admin.password.description=
coser.config.config.file.description=
-coser.config.eastwood.url.description=
1
0
r504 - in trunk/coser-business/src: main/java/fr/ifremer/coser/services test/java/fr/ifremer/coser/services test/resources/web
by chatellier@users.labs.libre-entreprise.org 12 Jan '11
by chatellier@users.labs.libre-entreprise.org 12 Jan '11
12 Jan '11
Author: chatellier
Date: 2011-01-12 15:54:25 +0000 (Wed, 12 Jan 2011)
New Revision: 504
Log:
T?\195?\169l?\195?\169chargement des donn?\195?\169es sources.
Modified:
trunk/coser-business/src/main/java/fr/ifremer/coser/services/WebService.java
trunk/coser-business/src/test/java/fr/ifremer/coser/services/WebServiceTest.java
trunk/coser-business/src/test/resources/web/upload1.zip
trunk/coser-business/src/test/resources/web/upload2.zip
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/services/WebService.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/services/WebService.java 2011-01-12 15:11:27 UTC (rev 503)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/services/WebService.java 2011-01-12 15:54:25 UTC (rev 504)
@@ -39,6 +39,7 @@
import org.apache.commons.collections.map.MultiKeyMap;
import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -50,6 +51,7 @@
import fr.ifremer.coser.CoserBusinessConfig;
import fr.ifremer.coser.CoserBusinessException;
import fr.ifremer.coser.CoserConstants;
+import fr.ifremer.coser.CoserConstants.Category;
import fr.ifremer.coser.bean.Project;
import fr.ifremer.coser.bean.RSufiResult;
import fr.ifremer.coser.storage.DataStorage;
@@ -790,4 +792,114 @@
return result;
}
+
+ /**
+ * Genere un fichier zip des sources d'un projet.
+ *
+ * Contient:
+ * <ul>
+ * <li>les 4 fichiers apres sélection
+ * <li>
+ * <li>
+ * </ul>
+ *
+ * @param zone zone (zoneid-surveyname)
+ * @param locale locale (fr/en)
+ * @return map file
+ * @throws CoserBusinessException
+ */
+ public File getSourceZip(String zone, String locale) throws CoserBusinessException {
+
+ File result = null;
+
+ // parcours des resultats disponibles
+ File projectsDirectory = config.getWebProjectsDirectory();
+ File[] projectFiles = projectsDirectory.listFiles();
+ if (projectFiles != null) {
+ for (File projectFile : projectFiles) {
+ if (projectFile.isDirectory()) {
+ File selectionsDirectory = new File(projectFile, CoserConstants.STORAGE_SELECTION_DIRECTORY);
+ File[] selectionFiles = selectionsDirectory.listFiles();
+
+ // selection iteration
+ if (selectionFiles != null) {
+ for (File selectionFile : selectionFiles) {
+ if (selectionFile.isDirectory()) {
+ File resultsDirectory = new File(selectionFile, CoserConstants.STORAGE_RESULTS_DIRECTORY);
+ File[] resultFiles = resultsDirectory.listFiles();
+
+ // result iteration
+ if (resultFiles != null) {
+ for (File resultFile : resultFiles) {
+ if (resultFile.isDirectory()) {
+ RSufiResult rsufiResult = projectService.getRSufiResult(resultFile);
+
+ // extraction des especes pour le résultat demandé
+ if (rsufiResult.getZone() != null && rsufiResult.getZone().equals(zone)) {
+
+ // load project (without data to get original file names)
+ Project project = projectService.openProject(projectFile.getName(), projectsDirectory);
+
+ result = generateSourceZip(project, selectionFile);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Generate zip for selection.
+ *
+ * @param project project
+ * @param selectionDirectory selection directory
+ * @return generated zip file
+ * @throws CoserBusinessException
+ */
+ protected File generateSourceZip(Project project, File selectionDirectory) throws CoserBusinessException {
+
+ File resultZip = null;
+
+ try {
+ File tempDir = FileUtil.createTempDirectory("coser-", ".tmp");
+
+ // pour que l'archive contiennent ce dossier
+ File archiveDir = new File(tempDir, "coser-sources");
+
+ // recupere les noms originaux des fichiers
+ // de selection et de nom de fichier dans le zip
+ String catchSeFileName = projectService.getDataStorageFileName(project, Category.CATCH, CoserConstants.STORAGE_SELECTION_SUFFIX);
+ String haulSeFileName = projectService.getDataStorageFileName(project, Category.HAUL, CoserConstants.STORAGE_SELECTION_SUFFIX);
+ String lengthSeFileName = projectService.getDataStorageFileName(project, Category.LENGTH, CoserConstants.STORAGE_SELECTION_SUFFIX);
+ String strataSeFileName = projectService.getDataStorageFileName(project, Category.STRATA, CoserConstants.STORAGE_SELECTION_SUFFIX);
+ String catchFileName = projectService.getDataStorageFileName(project, Category.CATCH, null);
+ String haulFileName = projectService.getDataStorageFileName(project, Category.HAUL, null);
+ String lengthFileName = projectService.getDataStorageFileName(project, Category.LENGTH, null);
+ String strataFileName = projectService.getDataStorageFileName(project, Category.STRATA, null);
+
+ // copy to temp directory
+ FileUtils.copyFile(new File(selectionDirectory, catchSeFileName), new File(archiveDir, catchFileName));
+ FileUtils.copyFile(new File(selectionDirectory, haulSeFileName), new File(archiveDir, haulFileName));
+ FileUtils.copyFile(new File(selectionDirectory, lengthSeFileName), new File(archiveDir, lengthFileName));
+ FileUtils.copyFile(new File(selectionDirectory, strataSeFileName), new File(archiveDir, strataFileName));
+
+ // make zip
+ resultZip = File.createTempFile("coser-result", ".zip");
+ ZipUtil.compress(resultZip, archiveDir);
+
+ // clean directory
+ FileUtils.deleteDirectory(tempDir);
+ } catch (IOException ex) {
+ throw new CoserBusinessException("Can't create zip file", ex);
+ }
+
+ return resultZip;
+ }
}
Modified: trunk/coser-business/src/test/java/fr/ifremer/coser/services/WebServiceTest.java
===================================================================
--- trunk/coser-business/src/test/java/fr/ifremer/coser/services/WebServiceTest.java 2011-01-12 15:11:27 UTC (rev 503)
+++ trunk/coser-business/src/test/java/fr/ifremer/coser/services/WebServiceTest.java 2011-01-12 15:54:25 UTC (rev 504)
@@ -26,14 +26,19 @@
package fr.ifremer.coser.services;
import java.io.File;
+import java.io.IOException;
import java.net.URL;
import org.apache.commons.collections.map.MultiKeyMap;
+import org.apache.commons.io.FileUtils;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+import org.nuiton.util.FileUtil;
+import org.nuiton.util.ZipUtil;
import fr.ifremer.coser.CoserBusinessException;
+import fr.ifremer.coser.bean.Project;
import fr.ifremer.coser.storage.DataStorage;
/**
@@ -113,4 +118,23 @@
assertFileExists(config.getWebProjectsDirectory() + "/projet1/selections/selection11/results/result114");
assertFileExists(config.getWebProjectsDirectory() + "/projet3/selections/selection31/results/result311");
}
+
+ /**
+ * Test du contenu du zip de téléchargement des sources.
+ *
+ * @throws CoserBusinessException
+ * @throws IOException
+ */
+ @Test
+ public void testSourceZip() throws CoserBusinessException, IOException {
+ URL firstUpload = WebServiceTest.class.getResource("/web/upload1.zip");
+ File firstUploadFile = new File(firstUpload.getFile());
+ webService.registerNewUploadedResults(firstUploadFile);
+
+ File zip = webService.getSourceZip("testzone1", "en");
+ File tempDir = FileUtil.createTempDirectory("coser", ".tmp");
+ ZipUtil.uncompress(zip, tempDir);
+ Assert.assertTrue(new File(tempDir, "coser-sources" + File.separator + "testcatch.csv").isFile());
+ FileUtils.deleteDirectory(tempDir);
+ }
}
Modified: trunk/coser-business/src/test/resources/web/upload1.zip
===================================================================
(Binary files differ)
Modified: trunk/coser-business/src/test/resources/web/upload2.zip
===================================================================
(Binary files differ)
1
0
r503 - in trunk/coser-web/src/main: java/fr/ifremer/coser/web/actions java/fr/ifremer/coser/web/actions/source webapp/WEB-INF/content webapp/WEB-INF/content/source
by chatellier@users.labs.libre-entreprise.org 12 Jan '11
by chatellier@users.labs.libre-entreprise.org 12 Jan '11
12 Jan '11
Author: chatellier
Date: 2011-01-12 15:11:27 +0000 (Wed, 12 Jan 2011)
New Revision: 503
Log:
Download sources action
Added:
trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/source/
trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/source/FacadeAction.java
trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/source/SourceAction.java
trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/source/SourceDataAction.java
trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/source/ZoneAction.java
trunk/coser-web/src/main/webapp/WEB-INF/content/source/
trunk/coser-web/src/main/webapp/WEB-INF/content/source/facade.jsp
trunk/coser-web/src/main/webapp/WEB-INF/content/source/source.jsp
trunk/coser-web/src/main/webapp/WEB-INF/content/source/zone.jsp
Modified:
trunk/coser-web/src/main/webapp/WEB-INF/content/index.jsp
Added: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/source/FacadeAction.java
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/source/FacadeAction.java (rev 0)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/source/FacadeAction.java 2011-01-12 15:11:27 UTC (rev 503)
@@ -0,0 +1,68 @@
+/*
+ * #%L
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2010 - 2011 Ifremer, Codelutin, Chatellier Eric
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+package fr.ifremer.coser.web.actions.source;
+
+import java.util.Map;
+
+import com.opensymphony.xwork2.ActionSupport;
+
+import fr.ifremer.coser.CoserBusinessException;
+import fr.ifremer.coser.services.WebService;
+import fr.ifremer.coser.web.CoserWebException;
+import fr.ifremer.coser.web.ServiceFactory;
+
+/**
+ * Action index, affiche la liste des facades majeures.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class FacadeAction extends ActionSupport {
+
+ /** serialVersionUID. */
+ private static final long serialVersionUID = 3385467755357775199L;
+
+ protected Map<String, String> facades;
+
+ public Map<String, String> getFacades() {
+ return facades;
+ }
+
+ @Override
+ public String execute() {
+
+ WebService webService = ServiceFactory.getWebService();
+ try {
+ // renvoi la liste des facadeid et leur label associé
+ facades = webService.getFacades();
+
+ } catch (CoserBusinessException ex) {
+ throw new CoserWebException("Can't get zone map", ex);
+ }
+
+ return SUCCESS;
+ }
+}
Property changes on: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/source/FacadeAction.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/source/SourceAction.java
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/source/SourceAction.java (rev 0)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/source/SourceAction.java 2011-01-12 15:11:27 UTC (rev 503)
@@ -0,0 +1,56 @@
+/*
+ * #%L
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2010 - 2011 Ifremer, Codelutin, Chatellier Eric
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+package fr.ifremer.coser.web.actions.source;
+
+import com.opensymphony.xwork2.ActionSupport;
+
+/**
+ * Affiche les liens de téléchargement du zip pour le projet choisit.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class SourceAction extends ActionSupport {
+
+ /** serialVersionUID. */
+ private static final long serialVersionUID = 3385467755357775199L;
+
+ protected String zone;
+
+ public String getZone() {
+ return zone;
+ }
+
+ public void setZone(String zone) {
+ this.zone = zone;
+ }
+
+ @Override
+ public String execute() {
+
+ return SUCCESS;
+ }
+}
Property changes on: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/source/SourceAction.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/source/SourceDataAction.java
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/source/SourceDataAction.java (rev 0)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/source/SourceDataAction.java 2011-01-12 15:11:27 UTC (rev 503)
@@ -0,0 +1,93 @@
+/*
+ * #%L
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2010 - 2011 Ifremer, Codelutin, Chatellier Eric
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+package fr.ifremer.coser.web.actions.source;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+import java.util.Locale;
+
+import org.apache.struts2.convention.annotation.Action;
+import org.apache.struts2.convention.annotation.Result;
+
+import com.opensymphony.xwork2.ActionSupport;
+
+import fr.ifremer.coser.CoserBusinessException;
+import fr.ifremer.coser.services.WebService;
+import fr.ifremer.coser.web.CoserWebException;
+import fr.ifremer.coser.web.ServiceFactory;
+
+/**
+ * Force le téléchargement du zip.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class SourceDataAction extends ActionSupport {
+
+ /** serialVersionUID. */
+ private static final long serialVersionUID = 3385467755357775199L;
+
+ protected String zone;
+
+ public String getZone() {
+ return zone;
+ }
+
+ public void setZone(String zone) {
+ this.zone = zone;
+ }
+
+ @Action(results= {@Result(type="stream", params={"contentType", "application/zip", "inputName", "inputStream", "contentDisposition", "attachment; filename=\"${filename}\""})})
+ public String execute() {
+ return SUCCESS;
+ }
+
+ public String getFilename() {
+ return "source.zip";
+ }
+
+ public InputStream getInputStream() {
+ WebService webService = ServiceFactory.getWebService();
+
+ Locale locale = getLocale();
+ String localeCode = locale.getLanguage();
+
+ InputStream input = null;
+ try {
+
+ File sourceZip = webService.getSourceZip(zone, localeCode);
+ input = new FileInputStream(sourceZip);
+ } catch (CoserBusinessException ex) {
+ throw new CoserWebException("Can't get source zip file", ex);
+ } catch (FileNotFoundException ex) {
+ throw new CoserWebException("Can't get source zip file", ex);
+ }
+
+ return input;
+ }
+}
Property changes on: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/source/SourceDataAction.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/source/ZoneAction.java
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/source/ZoneAction.java (rev 0)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/source/ZoneAction.java 2011-01-12 15:11:27 UTC (rev 503)
@@ -0,0 +1,76 @@
+/*
+ * #%L
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2010 - 2011 Ifremer, Codelutin, Chatellier Eric
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+package fr.ifremer.coser.web.actions.source;
+
+import java.util.Map;
+
+import com.opensymphony.xwork2.ActionSupport;
+
+import fr.ifremer.coser.CoserBusinessException;
+import fr.ifremer.coser.services.WebService;
+import fr.ifremer.coser.web.CoserWebException;
+import fr.ifremer.coser.web.ServiceFactory;
+
+/**
+ * Affiche la liste des sous zones (zone).
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class ZoneAction extends ActionSupport {
+
+ /** serialVersionUID. */
+ private static final long serialVersionUID = 3385467755357775199L;
+
+ protected String facade;
+
+ public void setFacade(String facade) {
+ this.facade = facade;
+ }
+
+ protected Map<String, String> zones;
+
+ public Map<String, String> getZones() {
+ return zones;
+ }
+
+ @Override
+ public String execute() {
+
+ WebService webService = ServiceFactory.getWebService();
+ try {
+
+ // renvoi la liste des id subzone-survey et leurs label
+ // associé
+ zones = webService.getZoneForFacade(facade);
+
+ } catch (CoserBusinessException ex) {
+ throw new CoserWebException("Can't get zone map", ex);
+ }
+
+ return SUCCESS;
+ }
+}
Property changes on: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/source/ZoneAction.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Modified: trunk/coser-web/src/main/webapp/WEB-INF/content/index.jsp
===================================================================
--- trunk/coser-web/src/main/webapp/WEB-INF/content/index.jsp 2011-01-12 14:58:42 UTC (rev 502)
+++ trunk/coser-web/src/main/webapp/WEB-INF/content/index.jsp 2011-01-12 15:11:27 UTC (rev 503)
@@ -41,7 +41,7 @@
<p>
<span style="font-weight:bold"><s:text name="message.index.datatypetitle" /> :</span><br />
<ul>
- <li><s:a action="zone"><s:text name="message.index.datatype1" /></s:a></li>
+ <li><s:a action="source/facade"><s:text name="message.index.datatype1" /></s:a></li>
<li><s:a action="map/facade"><s:text name="message.index.datatype2" /></s:a></li>
<li><s:a action="pop/facade"><s:text name="message.index.datatype3" /></s:a></li>
<li><s:a action="com/facade"><s:text name="message.index.datatype4" /></s:a></li>
Added: trunk/coser-web/src/main/webapp/WEB-INF/content/source/facade.jsp
===================================================================
--- trunk/coser-web/src/main/webapp/WEB-INF/content/source/facade.jsp (rev 0)
+++ trunk/coser-web/src/main/webapp/WEB-INF/content/source/facade.jsp 2011-01-12 15:11:27 UTC (rev 503)
@@ -0,0 +1,42 @@
+<!--
+ #%L
+ Coser :: Web
+
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2010 - 2011 Ifremer, Codelutin, Chatellier Eric
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ #L%
+ -->
+<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<%@taglib uri="/struts-tags" prefix="s" %>
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <title>Coser</title>
+ </head>
+ <body>
+
+ <img src="<s:url value='/images/zonesmap.jpg' />" />
+
+ <br />
+
+ <s:form action="zone" method="get">
+ <s:select name="facade" list="facades" label="Select a facade" />
+ <s:submit label="Suite"/>
+ </s:form>
+ </body>
+</html>
\ No newline at end of file
Added: trunk/coser-web/src/main/webapp/WEB-INF/content/source/source.jsp
===================================================================
--- trunk/coser-web/src/main/webapp/WEB-INF/content/source/source.jsp (rev 0)
+++ trunk/coser-web/src/main/webapp/WEB-INF/content/source/source.jsp 2011-01-12 15:11:27 UTC (rev 503)
@@ -0,0 +1,38 @@
+<!--
+ #%L
+ Coser :: Web
+
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2010 - 2011 Ifremer, Codelutin, Chatellier Eric
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ #L%
+ -->
+<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<%@taglib uri="/struts-tags" prefix="s" %>
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <title>Coser</title>
+ </head>
+ <body>
+
+ <s:a action="source-data">
+ <s:param name="zone" value="%{zone}" />
+ Download
+ </s:a>.
+ </body>
+</html>
\ No newline at end of file
Added: trunk/coser-web/src/main/webapp/WEB-INF/content/source/zone.jsp
===================================================================
--- trunk/coser-web/src/main/webapp/WEB-INF/content/source/zone.jsp (rev 0)
+++ trunk/coser-web/src/main/webapp/WEB-INF/content/source/zone.jsp 2011-01-12 15:11:27 UTC (rev 503)
@@ -0,0 +1,47 @@
+<!--
+ #%L
+ Coser :: Web
+
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2010 - 2011 Ifremer, Codelutin, Chatellier Eric
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ #L%
+ -->
+<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<%@taglib uri="/struts-tags" prefix="s" %>
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <title>Coser</title>
+ </head>
+ <body>
+
+ <img src="<s:url value='/images/zonesmap.jpg' />" />
+
+ <br />
+
+ <s:if test="%{zones.isEmpty()}">
+ No result founds
+ </s:if>
+ <s:else>
+ <s:form action="source" method="get">
+ <s:select name="zone" list="zones" label="Select a sub zone" />
+ <s:submit label="Suite"/>
+ </s:form>
+ </s:else>
+ </body>
+</html>
\ No newline at end of file
1
0
Author: chatellier
Date: 2011-01-12 14:58:42 +0000 (Wed, 12 Jan 2011)
New Revision: 502
Log:
Add itext and xhtmlrenderer deps.
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2011-01-12 14:58:40 UTC (rev 501)
+++ trunk/pom.xml 2011-01-12 14:58:42 UTC (rev 502)
@@ -259,6 +259,20 @@
<version>2.5</version>
<scope>provided</scope>
</dependency>
+
+ <dependency>
+ <groupId>com.lowagie</groupId>
+ <artifactId>itext</artifactId>
+ <version>2.0.8</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.xhtmlrenderer</groupId>
+ <artifactId>core-renderer</artifactId>
+ <version>R8pre2</version>
+ <scope>compile</scope>
+ </dependency>
</dependencies>
</dependencyManagement>
1
0
Author: chatellier
Date: 2011-01-12 14:58:40 +0000 (Wed, 12 Jan 2011)
New Revision: 501
Log:
Add itext and xhtmlrenderer deps.
Modified:
trunk/coser-business/pom.xml
Modified: trunk/coser-business/pom.xml
===================================================================
--- trunk/coser-business/pom.xml 2011-01-12 10:05:12 UTC (rev 500)
+++ trunk/coser-business/pom.xml 2011-01-12 14:58:40 UTC (rev 501)
@@ -94,6 +94,14 @@
<groupId>jfree</groupId>
<artifactId>jcommon</artifactId>
</dependency>
+ <dependency>
+ <groupId>com.lowagie</groupId>
+ <artifactId>itext</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.xhtmlrenderer</groupId>
+ <artifactId>core-renderer</artifactId>
+ </dependency>
</dependencies>
<name>Coser :: Business</name>
1
0
r500 - in trunk/coser-web/src/main: java/fr/ifremer/coser/web/actions/com java/fr/ifremer/coser/web/actions/map java/fr/ifremer/coser/web/actions/pop webapp/WEB-INF/content webapp/WEB-INF/content/com webapp/WEB-INF/content/map webapp/WEB-INF/content/pop
by chatellier@users.labs.libre-entreprise.org 12 Jan '11
by chatellier@users.labs.libre-entreprise.org 12 Jan '11
12 Jan '11
Author: chatellier
Date: 2011-01-12 10:05:12 +0000 (Wed, 12 Jan 2011)
New Revision: 500
Log:
Refactoring zone>facade, subzone > zone
Added:
trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/com/FacadeAction.java
trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/com/ZoneAction.java
trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/map/FacadeAction.java
trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/map/ZoneAction.java
trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/pop/FacadeAction.java
trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/pop/ZoneAction.java
trunk/coser-web/src/main/webapp/WEB-INF/content/com/facade.jsp
trunk/coser-web/src/main/webapp/WEB-INF/content/com/zone.jsp
trunk/coser-web/src/main/webapp/WEB-INF/content/map/facade.jsp
trunk/coser-web/src/main/webapp/WEB-INF/content/map/zone.jsp
trunk/coser-web/src/main/webapp/WEB-INF/content/pop/facade.jsp
trunk/coser-web/src/main/webapp/WEB-INF/content/pop/zone.jsp
Removed:
trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/com/SubzoneAction.java
trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/com/ZoneAction.java
trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/map/SubzoneAction.java
trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/map/ZoneAction.java
trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/pop/SubzoneAction.java
trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/pop/ZoneAction.java
trunk/coser-web/src/main/webapp/WEB-INF/content/com/subzone.jsp
trunk/coser-web/src/main/webapp/WEB-INF/content/com/zone.jsp
trunk/coser-web/src/main/webapp/WEB-INF/content/map/subzone.jsp
trunk/coser-web/src/main/webapp/WEB-INF/content/map/zone.jsp
trunk/coser-web/src/main/webapp/WEB-INF/content/pop/subzone.jsp
trunk/coser-web/src/main/webapp/WEB-INF/content/pop/zone.jsp
Modified:
trunk/coser-web/src/main/webapp/WEB-INF/content/index.jsp
Copied: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/com/FacadeAction.java (from rev 498, trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/com/ZoneAction.java)
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/com/FacadeAction.java (rev 0)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/com/FacadeAction.java 2011-01-12 10:05:12 UTC (rev 500)
@@ -0,0 +1,69 @@
+/*
+ * #%L
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2010 - 2011 Ifremer, Codelutin, Chatellier Eric
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+package fr.ifremer.coser.web.actions.com;
+
+import java.util.Map;
+
+import com.opensymphony.xwork2.ActionSupport;
+
+import fr.ifremer.coser.CoserBusinessException;
+import fr.ifremer.coser.services.WebService;
+import fr.ifremer.coser.web.CoserWebException;
+import fr.ifremer.coser.web.ServiceFactory;
+
+/**
+ * Action index, affiche la liste des facades majeures.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class FacadeAction extends ActionSupport {
+
+ /** serialVersionUID. */
+ private static final long serialVersionUID = 3385467755357775199L;
+
+ protected Map<String, String> facades;
+
+ public Map<String, String> getFacades() {
+ return facades;
+ }
+
+ @Override
+ public String execute() {
+
+ WebService webService = ServiceFactory.getWebService();
+ try {
+
+ // renvoi la liste des facadeid et leur label associé
+ facades = webService.getFacades();
+
+ } catch (CoserBusinessException ex) {
+ throw new CoserWebException("Can't get zone map", ex);
+ }
+
+ return SUCCESS;
+ }
+}
Deleted: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/com/SubzoneAction.java
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/com/SubzoneAction.java 2011-01-12 09:23:11 UTC (rev 499)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/com/SubzoneAction.java 2011-01-12 10:05:12 UTC (rev 500)
@@ -1,76 +0,0 @@
-/*
- * #%L
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2010 - 2011 Ifremer, Codelutin, Chatellier Eric
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-
-package fr.ifremer.coser.web.actions.com;
-
-import java.util.Map;
-
-import com.opensymphony.xwork2.ActionSupport;
-
-import fr.ifremer.coser.CoserBusinessException;
-import fr.ifremer.coser.services.WebService;
-import fr.ifremer.coser.web.CoserWebException;
-import fr.ifremer.coser.web.ServiceFactory;
-
-/**
- * Affiche la liste des sous zones (zone).
- *
- * @author chatellier
- * @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
- */
-public class SubzoneAction extends ActionSupport {
-
- /** serialVersionUID. */
- private static final long serialVersionUID = 3385467755357775199L;
-
- protected String facade;
-
- public void setFacade(String facade) {
- this.facade = facade;
- }
-
- protected Map<String, String> zones;
-
- public Map<String, String> getZones() {
- return zones;
- }
-
- @Override
- public String execute() {
-
- WebService webService = ServiceFactory.getWebService();
- try {
-
- // renvoi la liste des id subzone-survey et leurs label
- // associé
- zones = webService.getZoneForFacade(facade);
-
- } catch (CoserBusinessException ex) {
- throw new CoserWebException("Can't get zone map", ex);
- }
-
- return SUCCESS;
- }
-}
Deleted: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/com/ZoneAction.java
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/com/ZoneAction.java 2011-01-12 09:23:11 UTC (rev 499)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/com/ZoneAction.java 2011-01-12 10:05:12 UTC (rev 500)
@@ -1,69 +0,0 @@
-/*
- * #%L
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2010 - 2011 Ifremer, Codelutin, Chatellier Eric
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-
-package fr.ifremer.coser.web.actions.com;
-
-import java.util.Map;
-
-import com.opensymphony.xwork2.ActionSupport;
-
-import fr.ifremer.coser.CoserBusinessException;
-import fr.ifremer.coser.services.WebService;
-import fr.ifremer.coser.web.CoserWebException;
-import fr.ifremer.coser.web.ServiceFactory;
-
-/**
- * Action index, affiche la liste des facades majeures.
- *
- * @author chatellier
- * @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
- */
-public class ZoneAction extends ActionSupport {
-
- /** serialVersionUID. */
- private static final long serialVersionUID = 3385467755357775199L;
-
- protected Map<String, String> facades;
-
- public Map<String, String> getFacades() {
- return facades;
- }
-
- @Override
- public String execute() {
-
- WebService webService = ServiceFactory.getWebService();
- try {
-
- // renvoi la liste des facadeid et leur label associé
- facades = webService.getFacades();
-
- } catch (CoserBusinessException ex) {
- throw new CoserWebException("Can't get zone map", ex);
- }
-
- return SUCCESS;
- }
-}
Copied: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/com/ZoneAction.java (from rev 498, trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/com/SubzoneAction.java)
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/com/ZoneAction.java (rev 0)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/com/ZoneAction.java 2011-01-12 10:05:12 UTC (rev 500)
@@ -0,0 +1,76 @@
+/*
+ * #%L
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2010 - 2011 Ifremer, Codelutin, Chatellier Eric
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+package fr.ifremer.coser.web.actions.com;
+
+import java.util.Map;
+
+import com.opensymphony.xwork2.ActionSupport;
+
+import fr.ifremer.coser.CoserBusinessException;
+import fr.ifremer.coser.services.WebService;
+import fr.ifremer.coser.web.CoserWebException;
+import fr.ifremer.coser.web.ServiceFactory;
+
+/**
+ * Affiche la liste des sous zones (zone).
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class ZoneAction extends ActionSupport {
+
+ /** serialVersionUID. */
+ private static final long serialVersionUID = 3385467755357775199L;
+
+ protected String facade;
+
+ public void setFacade(String facade) {
+ this.facade = facade;
+ }
+
+ protected Map<String, String> zones;
+
+ public Map<String, String> getZones() {
+ return zones;
+ }
+
+ @Override
+ public String execute() {
+
+ WebService webService = ServiceFactory.getWebService();
+ try {
+
+ // renvoi la liste des id subzone-survey et leurs label
+ // associé
+ zones = webService.getZoneForFacade(facade);
+
+ } catch (CoserBusinessException ex) {
+ throw new CoserWebException("Can't get zone map", ex);
+ }
+
+ return SUCCESS;
+ }
+}
Copied: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/map/FacadeAction.java (from rev 498, trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/map/ZoneAction.java)
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/map/FacadeAction.java (rev 0)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/map/FacadeAction.java 2011-01-12 10:05:12 UTC (rev 500)
@@ -0,0 +1,68 @@
+/*
+ * #%L
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2010 - 2011 Ifremer, Codelutin, Chatellier Eric
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+package fr.ifremer.coser.web.actions.map;
+
+import java.util.Map;
+
+import com.opensymphony.xwork2.ActionSupport;
+
+import fr.ifremer.coser.CoserBusinessException;
+import fr.ifremer.coser.services.WebService;
+import fr.ifremer.coser.web.CoserWebException;
+import fr.ifremer.coser.web.ServiceFactory;
+
+/**
+ * Action index, affiche la liste des facades majeures.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class FacadeAction extends ActionSupport {
+
+ /** serialVersionUID. */
+ private static final long serialVersionUID = 3385467755357775199L;
+
+ protected Map<String, String> facades;
+
+ public Map<String, String> getFacades() {
+ return facades;
+ }
+
+ @Override
+ public String execute() {
+
+ WebService webService = ServiceFactory.getWebService();
+ try {
+ // renvoi la liste des facadeid et leur label associé
+ facades = webService.getFacades();
+
+ } catch (CoserBusinessException ex) {
+ throw new CoserWebException("Can't get zone map", ex);
+ }
+
+ return SUCCESS;
+ }
+}
Deleted: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/map/SubzoneAction.java
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/map/SubzoneAction.java 2011-01-12 09:23:11 UTC (rev 499)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/map/SubzoneAction.java 2011-01-12 10:05:12 UTC (rev 500)
@@ -1,76 +0,0 @@
-/*
- * #%L
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2010 - 2011 Ifremer, Codelutin, Chatellier Eric
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-
-package fr.ifremer.coser.web.actions.map;
-
-import java.util.Map;
-
-import com.opensymphony.xwork2.ActionSupport;
-
-import fr.ifremer.coser.CoserBusinessException;
-import fr.ifremer.coser.services.WebService;
-import fr.ifremer.coser.web.CoserWebException;
-import fr.ifremer.coser.web.ServiceFactory;
-
-/**
- * Affiche la liste des sous zones (zone).
- *
- * @author chatellier
- * @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
- */
-public class SubzoneAction extends ActionSupport {
-
- /** serialVersionUID. */
- private static final long serialVersionUID = 3385467755357775199L;
-
- protected String facade;
-
- public void setFacade(String facade) {
- this.facade = facade;
- }
-
- protected Map<String, String> zones;
-
- public Map<String, String> getZones() {
- return zones;
- }
-
- @Override
- public String execute() {
-
- WebService webService = ServiceFactory.getWebService();
- try {
-
- // renvoi la liste des id subzone-survey et leurs label
- // associé
- zones = webService.getZoneForFacade(facade);
-
- } catch (CoserBusinessException ex) {
- throw new CoserWebException("Can't get zone map", ex);
- }
-
- return SUCCESS;
- }
-}
Deleted: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/map/ZoneAction.java
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/map/ZoneAction.java 2011-01-12 09:23:11 UTC (rev 499)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/map/ZoneAction.java 2011-01-12 10:05:12 UTC (rev 500)
@@ -1,68 +0,0 @@
-/*
- * #%L
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2010 - 2011 Ifremer, Codelutin, Chatellier Eric
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-
-package fr.ifremer.coser.web.actions.map;
-
-import java.util.Map;
-
-import com.opensymphony.xwork2.ActionSupport;
-
-import fr.ifremer.coser.CoserBusinessException;
-import fr.ifremer.coser.services.WebService;
-import fr.ifremer.coser.web.CoserWebException;
-import fr.ifremer.coser.web.ServiceFactory;
-
-/**
- * Action index, affiche la liste des facades majeures.
- *
- * @author chatellier
- * @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
- */
-public class ZoneAction extends ActionSupport {
-
- /** serialVersionUID. */
- private static final long serialVersionUID = 3385467755357775199L;
-
- protected Map<String, String> facades;
-
- public Map<String, String> getFacades() {
- return facades;
- }
-
- @Override
- public String execute() {
-
- WebService webService = ServiceFactory.getWebService();
- try {
- // renvoi la liste des facadeid et leur label associé
- facades = webService.getFacades();
-
- } catch (CoserBusinessException ex) {
- throw new CoserWebException("Can't get zone map", ex);
- }
-
- return SUCCESS;
- }
-}
Copied: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/map/ZoneAction.java (from rev 498, trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/map/SubzoneAction.java)
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/map/ZoneAction.java (rev 0)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/map/ZoneAction.java 2011-01-12 10:05:12 UTC (rev 500)
@@ -0,0 +1,76 @@
+/*
+ * #%L
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2010 - 2011 Ifremer, Codelutin, Chatellier Eric
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+package fr.ifremer.coser.web.actions.map;
+
+import java.util.Map;
+
+import com.opensymphony.xwork2.ActionSupport;
+
+import fr.ifremer.coser.CoserBusinessException;
+import fr.ifremer.coser.services.WebService;
+import fr.ifremer.coser.web.CoserWebException;
+import fr.ifremer.coser.web.ServiceFactory;
+
+/**
+ * Affiche la liste des sous zones (zone).
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class ZoneAction extends ActionSupport {
+
+ /** serialVersionUID. */
+ private static final long serialVersionUID = 3385467755357775199L;
+
+ protected String facade;
+
+ public void setFacade(String facade) {
+ this.facade = facade;
+ }
+
+ protected Map<String, String> zones;
+
+ public Map<String, String> getZones() {
+ return zones;
+ }
+
+ @Override
+ public String execute() {
+
+ WebService webService = ServiceFactory.getWebService();
+ try {
+
+ // renvoi la liste des id subzone-survey et leurs label
+ // associé
+ zones = webService.getZoneForFacade(facade);
+
+ } catch (CoserBusinessException ex) {
+ throw new CoserWebException("Can't get zone map", ex);
+ }
+
+ return SUCCESS;
+ }
+}
Copied: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/pop/FacadeAction.java (from rev 498, trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/pop/ZoneAction.java)
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/pop/FacadeAction.java (rev 0)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/pop/FacadeAction.java 2011-01-12 10:05:12 UTC (rev 500)
@@ -0,0 +1,68 @@
+/*
+ * #%L
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2010 - 2011 Ifremer, Codelutin, Chatellier Eric
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+package fr.ifremer.coser.web.actions.pop;
+
+import java.util.Map;
+
+import com.opensymphony.xwork2.ActionSupport;
+
+import fr.ifremer.coser.CoserBusinessException;
+import fr.ifremer.coser.services.WebService;
+import fr.ifremer.coser.web.CoserWebException;
+import fr.ifremer.coser.web.ServiceFactory;
+
+/**
+ * Action index, affiche la liste des facades majeures.
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class FacadeAction extends ActionSupport {
+
+ /** serialVersionUID. */
+ private static final long serialVersionUID = 3385467755357775199L;
+
+ protected Map<String, String> facades;
+
+ public Map<String, String> getFacades() {
+ return facades;
+ }
+
+ @Override
+ public String execute() {
+
+ WebService webService = ServiceFactory.getWebService();
+ try {
+ // renvoi la liste des facadeid et leur label associé
+ facades = webService.getFacades();
+
+ } catch (CoserBusinessException ex) {
+ throw new CoserWebException("Can't get zone map", ex);
+ }
+
+ return SUCCESS;
+ }
+}
Deleted: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/pop/SubzoneAction.java
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/pop/SubzoneAction.java 2011-01-12 09:23:11 UTC (rev 499)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/pop/SubzoneAction.java 2011-01-12 10:05:12 UTC (rev 500)
@@ -1,76 +0,0 @@
-/*
- * #%L
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2010 - 2011 Ifremer, Codelutin, Chatellier Eric
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-
-package fr.ifremer.coser.web.actions.pop;
-
-import java.util.Map;
-
-import com.opensymphony.xwork2.ActionSupport;
-
-import fr.ifremer.coser.CoserBusinessException;
-import fr.ifremer.coser.services.WebService;
-import fr.ifremer.coser.web.CoserWebException;
-import fr.ifremer.coser.web.ServiceFactory;
-
-/**
- * Affiche la liste des sous zones (zone).
- *
- * @author chatellier
- * @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
- */
-public class SubzoneAction extends ActionSupport {
-
- /** serialVersionUID. */
- private static final long serialVersionUID = 3385467755357775199L;
-
- protected String facade;
-
- public void setFacade(String facade) {
- this.facade = facade;
- }
-
- protected Map<String, String> zones;
-
- public Map<String, String> getZones() {
- return zones;
- }
-
- @Override
- public String execute() {
-
- WebService webService = ServiceFactory.getWebService();
- try {
-
- // renvoi la liste des id subzone-survey et leurs label
- // associé
- zones = webService.getZoneForFacade(facade);
-
- } catch (CoserBusinessException ex) {
- throw new CoserWebException("Can't get zone map", ex);
- }
-
- return SUCCESS;
- }
-}
Deleted: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/pop/ZoneAction.java
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/pop/ZoneAction.java 2011-01-12 09:23:11 UTC (rev 499)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/pop/ZoneAction.java 2011-01-12 10:05:12 UTC (rev 500)
@@ -1,68 +0,0 @@
-/*
- * #%L
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2010 - 2011 Ifremer, Codelutin, Chatellier Eric
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-
-package fr.ifremer.coser.web.actions.pop;
-
-import java.util.Map;
-
-import com.opensymphony.xwork2.ActionSupport;
-
-import fr.ifremer.coser.CoserBusinessException;
-import fr.ifremer.coser.services.WebService;
-import fr.ifremer.coser.web.CoserWebException;
-import fr.ifremer.coser.web.ServiceFactory;
-
-/**
- * Action index, affiche la liste des facades majeures.
- *
- * @author chatellier
- * @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
- */
-public class ZoneAction extends ActionSupport {
-
- /** serialVersionUID. */
- private static final long serialVersionUID = 3385467755357775199L;
-
- protected Map<String, String> facades;
-
- public Map<String, String> getFacades() {
- return facades;
- }
-
- @Override
- public String execute() {
-
- WebService webService = ServiceFactory.getWebService();
- try {
- // renvoi la liste des facadeid et leur label associé
- facades = webService.getFacades();
-
- } catch (CoserBusinessException ex) {
- throw new CoserWebException("Can't get zone map", ex);
- }
-
- return SUCCESS;
- }
-}
Copied: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/pop/ZoneAction.java (from rev 498, trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/pop/SubzoneAction.java)
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/pop/ZoneAction.java (rev 0)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/pop/ZoneAction.java 2011-01-12 10:05:12 UTC (rev 500)
@@ -0,0 +1,76 @@
+/*
+ * #%L
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2010 - 2011 Ifremer, Codelutin, Chatellier Eric
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+package fr.ifremer.coser.web.actions.pop;
+
+import java.util.Map;
+
+import com.opensymphony.xwork2.ActionSupport;
+
+import fr.ifremer.coser.CoserBusinessException;
+import fr.ifremer.coser.services.WebService;
+import fr.ifremer.coser.web.CoserWebException;
+import fr.ifremer.coser.web.ServiceFactory;
+
+/**
+ * Affiche la liste des sous zones (zone).
+ *
+ * @author chatellier
+ * @version $Revision$
+ *
+ * Last update : $Date$
+ * By : $Author$
+ */
+public class ZoneAction extends ActionSupport {
+
+ /** serialVersionUID. */
+ private static final long serialVersionUID = 3385467755357775199L;
+
+ protected String facade;
+
+ public void setFacade(String facade) {
+ this.facade = facade;
+ }
+
+ protected Map<String, String> zones;
+
+ public Map<String, String> getZones() {
+ return zones;
+ }
+
+ @Override
+ public String execute() {
+
+ WebService webService = ServiceFactory.getWebService();
+ try {
+
+ // renvoi la liste des id subzone-survey et leurs label
+ // associé
+ zones = webService.getZoneForFacade(facade);
+
+ } catch (CoserBusinessException ex) {
+ throw new CoserWebException("Can't get zone map", ex);
+ }
+
+ return SUCCESS;
+ }
+}
Copied: trunk/coser-web/src/main/webapp/WEB-INF/content/com/facade.jsp (from rev 498, trunk/coser-web/src/main/webapp/WEB-INF/content/com/zone.jsp)
===================================================================
--- trunk/coser-web/src/main/webapp/WEB-INF/content/com/facade.jsp (rev 0)
+++ trunk/coser-web/src/main/webapp/WEB-INF/content/com/facade.jsp 2011-01-12 10:05:12 UTC (rev 500)
@@ -0,0 +1,42 @@
+<!--
+ #%L
+ Coser :: Web
+
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2010 - 2011 Ifremer, Codelutin, Chatellier Eric
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ #L%
+ -->
+<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<%@taglib uri="/struts-tags" prefix="s" %>
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <title>Coser</title>
+ </head>
+ <body>
+
+ <img src="<s:url value='/images/zonesmap.jpg' />" />
+
+ <br />
+
+ <s:form action="zone" method="get">
+ <s:select name="facade" list="facades" label="Select a facade" />
+ <s:submit label="Suite"/>
+ </s:form>
+ </body>
+</html>
\ No newline at end of file
Deleted: trunk/coser-web/src/main/webapp/WEB-INF/content/com/subzone.jsp
===================================================================
--- trunk/coser-web/src/main/webapp/WEB-INF/content/com/subzone.jsp 2011-01-12 09:23:11 UTC (rev 499)
+++ trunk/coser-web/src/main/webapp/WEB-INF/content/com/subzone.jsp 2011-01-12 10:05:12 UTC (rev 500)
@@ -1,47 +0,0 @@
-<!--
- #%L
- Coser :: Web
-
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2010 - 2011 Ifremer, Codelutin, Chatellier Eric
- %%
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
- #L%
- -->
-<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<%@taglib uri="/struts-tags" prefix="s" %>
-<html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title>Coser</title>
- </head>
- <body>
-
- <img src="<s:url value='/images/zonesmap.jpg' />" />
-
- <br />
-
- <s:if test="%{zones.isEmpty()}">
- No result founds
- </s:if>
- <s:else>
- <s:form action="indicator" method="get">
- <s:select name="zone" list="zones" label="Select a sub zone" />
- <s:submit label="Suite"/>
- </s:form>
- </s:else>
- </body>
-</html>
\ No newline at end of file
Deleted: trunk/coser-web/src/main/webapp/WEB-INF/content/com/zone.jsp
===================================================================
--- trunk/coser-web/src/main/webapp/WEB-INF/content/com/zone.jsp 2011-01-12 09:23:11 UTC (rev 499)
+++ trunk/coser-web/src/main/webapp/WEB-INF/content/com/zone.jsp 2011-01-12 10:05:12 UTC (rev 500)
@@ -1,42 +0,0 @@
-<!--
- #%L
- Coser :: Web
-
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2010 - 2011 Ifremer, Codelutin, Chatellier Eric
- %%
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
- #L%
- -->
-<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<%@taglib uri="/struts-tags" prefix="s" %>
-<html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title>Coser</title>
- </head>
- <body>
-
- <img src="<s:url value='/images/zonesmap.jpg' />" />
-
- <br />
-
- <s:form action="subzone" method="get">
- <s:select name="facade" list="facades" label="Select a facade" />
- <s:submit label="Suite"/>
- </s:form>
- </body>
-</html>
\ No newline at end of file
Copied: trunk/coser-web/src/main/webapp/WEB-INF/content/com/zone.jsp (from rev 494, trunk/coser-web/src/main/webapp/WEB-INF/content/com/subzone.jsp)
===================================================================
--- trunk/coser-web/src/main/webapp/WEB-INF/content/com/zone.jsp (rev 0)
+++ trunk/coser-web/src/main/webapp/WEB-INF/content/com/zone.jsp 2011-01-12 10:05:12 UTC (rev 500)
@@ -0,0 +1,47 @@
+<!--
+ #%L
+ Coser :: Web
+
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2010 - 2011 Ifremer, Codelutin, Chatellier Eric
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ #L%
+ -->
+<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<%@taglib uri="/struts-tags" prefix="s" %>
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <title>Coser</title>
+ </head>
+ <body>
+
+ <img src="<s:url value='/images/zonesmap.jpg' />" />
+
+ <br />
+
+ <s:if test="%{zones.isEmpty()}">
+ No result founds
+ </s:if>
+ <s:else>
+ <s:form action="indicator" method="get">
+ <s:select name="zone" list="zones" label="Select a sub zone" />
+ <s:submit label="Suite"/>
+ </s:form>
+ </s:else>
+ </body>
+</html>
\ No newline at end of file
Modified: trunk/coser-web/src/main/webapp/WEB-INF/content/index.jsp
===================================================================
--- trunk/coser-web/src/main/webapp/WEB-INF/content/index.jsp 2011-01-12 09:23:11 UTC (rev 499)
+++ trunk/coser-web/src/main/webapp/WEB-INF/content/index.jsp 2011-01-12 10:05:12 UTC (rev 500)
@@ -42,9 +42,9 @@
<span style="font-weight:bold"><s:text name="message.index.datatypetitle" /> :</span><br />
<ul>
<li><s:a action="zone"><s:text name="message.index.datatype1" /></s:a></li>
- <li><s:a action="map/zone"><s:text name="message.index.datatype2" /></s:a></li>
- <li><s:a action="pop/zone"><s:text name="message.index.datatype3" /></s:a></li>
- <li><s:a action="com/zone"><s:text name="message.index.datatype4" /></s:a></li>
+ <li><s:a action="map/facade"><s:text name="message.index.datatype2" /></s:a></li>
+ <li><s:a action="pop/facade"><s:text name="message.index.datatype3" /></s:a></li>
+ <li><s:a action="com/facade"><s:text name="message.index.datatype4" /></s:a></li>
</ul>
</p>
Copied: trunk/coser-web/src/main/webapp/WEB-INF/content/map/facade.jsp (from rev 498, trunk/coser-web/src/main/webapp/WEB-INF/content/map/zone.jsp)
===================================================================
--- trunk/coser-web/src/main/webapp/WEB-INF/content/map/facade.jsp (rev 0)
+++ trunk/coser-web/src/main/webapp/WEB-INF/content/map/facade.jsp 2011-01-12 10:05:12 UTC (rev 500)
@@ -0,0 +1,42 @@
+<!--
+ #%L
+ Coser :: Web
+
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2010 - 2011 Ifremer, Codelutin, Chatellier Eric
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ #L%
+ -->
+<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<%@taglib uri="/struts-tags" prefix="s" %>
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <title>Coser</title>
+ </head>
+ <body>
+
+ <img src="<s:url value='/images/zonesmap.jpg' />" />
+
+ <br />
+
+ <s:form action="zone" method="get">
+ <s:select name="facade" list="facades" label="Select a facade" />
+ <s:submit label="Suite"/>
+ </s:form>
+ </body>
+</html>
\ No newline at end of file
Deleted: trunk/coser-web/src/main/webapp/WEB-INF/content/map/subzone.jsp
===================================================================
--- trunk/coser-web/src/main/webapp/WEB-INF/content/map/subzone.jsp 2011-01-12 09:23:11 UTC (rev 499)
+++ trunk/coser-web/src/main/webapp/WEB-INF/content/map/subzone.jsp 2011-01-12 10:05:12 UTC (rev 500)
@@ -1,47 +0,0 @@
-<!--
- #%L
- Coser :: Web
-
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2010 - 2011 Ifremer, Codelutin, Chatellier Eric
- %%
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
- #L%
- -->
-<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<%@taglib uri="/struts-tags" prefix="s" %>
-<html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title>Coser</title>
- </head>
- <body>
-
- <img src="<s:url value='/images/zonesmap.jpg' />" />
-
- <br />
-
- <s:if test="%{zones.isEmpty()}">
- No result founds
- </s:if>
- <s:else>
- <s:form action="species" method="get">
- <s:select name="zone" list="zones" label="Select a sub zone" />
- <s:submit label="Suite"/>
- </s:form>
- </s:else>
- </body>
-</html>
\ No newline at end of file
Deleted: trunk/coser-web/src/main/webapp/WEB-INF/content/map/zone.jsp
===================================================================
--- trunk/coser-web/src/main/webapp/WEB-INF/content/map/zone.jsp 2011-01-12 09:23:11 UTC (rev 499)
+++ trunk/coser-web/src/main/webapp/WEB-INF/content/map/zone.jsp 2011-01-12 10:05:12 UTC (rev 500)
@@ -1,42 +0,0 @@
-<!--
- #%L
- Coser :: Web
-
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2010 - 2011 Ifremer, Codelutin, Chatellier Eric
- %%
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
- #L%
- -->
-<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<%@taglib uri="/struts-tags" prefix="s" %>
-<html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title>Coser</title>
- </head>
- <body>
-
- <img src="<s:url value='/images/zonesmap.jpg' />" />
-
- <br />
-
- <s:form action="subzone" method="get">
- <s:select name="facade" list="facades" label="Select a facade" />
- <s:submit label="Suite"/>
- </s:form>
- </body>
-</html>
\ No newline at end of file
Copied: trunk/coser-web/src/main/webapp/WEB-INF/content/map/zone.jsp (from rev 491, trunk/coser-web/src/main/webapp/WEB-INF/content/map/subzone.jsp)
===================================================================
--- trunk/coser-web/src/main/webapp/WEB-INF/content/map/zone.jsp (rev 0)
+++ trunk/coser-web/src/main/webapp/WEB-INF/content/map/zone.jsp 2011-01-12 10:05:12 UTC (rev 500)
@@ -0,0 +1,47 @@
+<!--
+ #%L
+ Coser :: Web
+
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2010 - 2011 Ifremer, Codelutin, Chatellier Eric
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ #L%
+ -->
+<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<%@taglib uri="/struts-tags" prefix="s" %>
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <title>Coser</title>
+ </head>
+ <body>
+
+ <img src="<s:url value='/images/zonesmap.jpg' />" />
+
+ <br />
+
+ <s:if test="%{zones.isEmpty()}">
+ No result founds
+ </s:if>
+ <s:else>
+ <s:form action="species" method="get">
+ <s:select name="zone" list="zones" label="Select a sub zone" />
+ <s:submit label="Suite"/>
+ </s:form>
+ </s:else>
+ </body>
+</html>
\ No newline at end of file
Copied: trunk/coser-web/src/main/webapp/WEB-INF/content/pop/facade.jsp (from rev 498, trunk/coser-web/src/main/webapp/WEB-INF/content/pop/zone.jsp)
===================================================================
--- trunk/coser-web/src/main/webapp/WEB-INF/content/pop/facade.jsp (rev 0)
+++ trunk/coser-web/src/main/webapp/WEB-INF/content/pop/facade.jsp 2011-01-12 10:05:12 UTC (rev 500)
@@ -0,0 +1,42 @@
+<!--
+ #%L
+ Coser :: Web
+
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2010 - 2011 Ifremer, Codelutin, Chatellier Eric
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ #L%
+ -->
+<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<%@taglib uri="/struts-tags" prefix="s" %>
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <title>Coser</title>
+ </head>
+ <body>
+
+ <img src="<s:url value='/images/zonesmap.jpg' />" />
+
+ <br />
+
+ <s:form action="zone" method="get">
+ <s:select name="facade" list="facades" label="Select a facade" />
+ <s:submit label="Suite"/>
+ </s:form>
+ </body>
+</html>
\ No newline at end of file
Deleted: trunk/coser-web/src/main/webapp/WEB-INF/content/pop/subzone.jsp
===================================================================
--- trunk/coser-web/src/main/webapp/WEB-INF/content/pop/subzone.jsp 2011-01-12 09:23:11 UTC (rev 499)
+++ trunk/coser-web/src/main/webapp/WEB-INF/content/pop/subzone.jsp 2011-01-12 10:05:12 UTC (rev 500)
@@ -1,47 +0,0 @@
-<!--
- #%L
- Coser :: Web
-
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2010 - 2011 Ifremer, Codelutin, Chatellier Eric
- %%
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
- #L%
- -->
-<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<%@taglib uri="/struts-tags" prefix="s" %>
-<html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title>Coser</title>
- </head>
- <body>
-
- <img src="<s:url value='/images/zonesmap.jpg' />" />
-
- <br />
-
- <s:if test="%{zones.isEmpty()}">
- No result founds
- </s:if>
- <s:else>
- <s:form action="species" method="get">
- <s:select name="zone" list="zones" label="Select a sub zone" />
- <s:submit label="Suite"/>
- </s:form>
- </s:else>
- </body>
-</html>
\ No newline at end of file
Deleted: trunk/coser-web/src/main/webapp/WEB-INF/content/pop/zone.jsp
===================================================================
--- trunk/coser-web/src/main/webapp/WEB-INF/content/pop/zone.jsp 2011-01-12 09:23:11 UTC (rev 499)
+++ trunk/coser-web/src/main/webapp/WEB-INF/content/pop/zone.jsp 2011-01-12 10:05:12 UTC (rev 500)
@@ -1,42 +0,0 @@
-<!--
- #%L
- Coser :: Web
-
- $Id$
- $HeadURL$
- %%
- Copyright (C) 2010 - 2011 Ifremer, Codelutin, Chatellier Eric
- %%
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
- #L%
- -->
-<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<%@taglib uri="/struts-tags" prefix="s" %>
-<html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title>Coser</title>
- </head>
- <body>
-
- <img src="<s:url value='/images/zonesmap.jpg' />" />
-
- <br />
-
- <s:form action="subzone" method="get">
- <s:select name="facade" list="facades" label="Select a facade" />
- <s:submit label="Suite"/>
- </s:form>
- </body>
-</html>
\ No newline at end of file
Copied: trunk/coser-web/src/main/webapp/WEB-INF/content/pop/zone.jsp (from rev 488, trunk/coser-web/src/main/webapp/WEB-INF/content/pop/subzone.jsp)
===================================================================
--- trunk/coser-web/src/main/webapp/WEB-INF/content/pop/zone.jsp (rev 0)
+++ trunk/coser-web/src/main/webapp/WEB-INF/content/pop/zone.jsp 2011-01-12 10:05:12 UTC (rev 500)
@@ -0,0 +1,47 @@
+<!--
+ #%L
+ Coser :: Web
+
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2010 - 2011 Ifremer, Codelutin, Chatellier Eric
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ #L%
+ -->
+<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<%@taglib uri="/struts-tags" prefix="s" %>
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <title>Coser</title>
+ </head>
+ <body>
+
+ <img src="<s:url value='/images/zonesmap.jpg' />" />
+
+ <br />
+
+ <s:if test="%{zones.isEmpty()}">
+ No result founds
+ </s:if>
+ <s:else>
+ <s:form action="species" method="get">
+ <s:select name="zone" list="zones" label="Select a sub zone" />
+ <s:submit label="Suite"/>
+ </s:form>
+ </s:else>
+ </body>
+</html>
\ No newline at end of file
1
0
r499 - trunk/coser-business/src/main/java/fr/ifremer/coser/services
by chatellier@users.labs.libre-entreprise.org 12 Jan '11
by chatellier@users.labs.libre-entreprise.org 12 Jan '11
12 Jan '11
Author: chatellier
Date: 2011-01-12 09:23:11 +0000 (Wed, 12 Jan 2011)
New Revision: 499
Log:
Refactoring zone>facade, subzone > zone
Modified:
trunk/coser-business/src/main/java/fr/ifremer/coser/services/ProjectService.java
trunk/coser-business/src/main/java/fr/ifremer/coser/services/WebService.java
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 2011-01-12 09:23:01 UTC (rev 498)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/services/ProjectService.java 2011-01-12 09:23:11 UTC (rev 499)
@@ -2823,25 +2823,9 @@
}
/**
- * Look for project survey name in container data.
- *
- * @param container data container
- * @return survey name
- */
- public String getProjectSurveyName(AbstractDataContainer container) {
- String result = null;
-
- Iterator<String[]> itCatchData = container.getCatch().iterator(true);
- while (StringUtils.isEmpty(result) && itCatchData.hasNext()) {
- result = itCatchData.next()[Catch.INDEX_SURVEY];
- }
-
- return result;
- }
-
- /**
* Look for project survey name in rsufi result.
* Read estcomind file to known that.
+ * Used in webservice to know map file names.
*
* @param resultDirectory result directory
* @param rSufiResult rsufi result
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/services/WebService.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/services/WebService.java 2011-01-12 09:23:01 UTC (rev 498)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/services/WebService.java 2011-01-12 09:23:11 UTC (rev 499)
@@ -53,17 +53,18 @@
import fr.ifremer.coser.bean.Project;
import fr.ifremer.coser.bean.RSufiResult;
import fr.ifremer.coser.storage.DataStorage;
+import fr.ifremer.coser.storage.MemoryDataStorage;
/**
* Service specifique à l'interface web de visualisation.
*
- * Ce service, contrairement au autre a un état, les indicateurs et zones
- * chargées persistent apres chargement, car elle ne peuvent pas changer
+ * Ce service, contrairement aux autres a un état, les indicateurs et zones
+ * chargées persistent après chargement, car elle ne peuvent pas changer
* tant que l'application est en cours d'utilisation.
*
* Il faut garder à l'esprit que les projets n'ont pas forcement
* de resultat, donc le chargement du projet est possible, mais
- * pas les données de control et les données de selection.
+ * pas les données de controle et les données de selection.
*
* @author chatellier
* @version $Revision$
@@ -86,8 +87,8 @@
/** Indicator map (id, locale > translation) (etat du service). */
protected MultiKeyMap indicatorsMap;
- /** Zones map (id > zone, subzone) (etat du service). */
- protected Map<String, String[]> zonesMap;
+ /** Zones map (etat du service). */
+ protected DataStorage zonesMap;
public WebService(CoserBusinessConfig config) {
this.config = config;
@@ -129,7 +130,7 @@
* @return zones map
* @throws CoserBusinessException
*/
- public Map<String, String[]> getZonesMap() throws CoserBusinessException {
+ public DataStorage getZonesMap() throws CoserBusinessException {
if (zonesMap == null) {
File zoneFile = config.getWebZonesFile();
@@ -137,20 +138,12 @@
// l'operation n'est pas obligatoire pour tous les clients
// lourd, le fichier peut donc ne pas exister
if (zoneFile.isFile()) {
- zonesMap = new HashMap<String, String[]>();
-
- DataStorage zonesStorage = importService.loadCSVFile(zoneFile);
- Iterator<String[]> iteratorZones = zonesStorage.iterator(true);
- while (iteratorZones.hasNext()) {
- // "id";"zone";"subzone";"periode";"serie";"comment";"map"
- String[] zone = iteratorZones.next();
- zonesMap.put(zone[0], new String[]{zone[1], zone[2]});
- }
+ zonesMap = importService.loadCSVFile(zoneFile);
}
else {
// fait volontairement un return new, n'affecte pas l'etat du
// service
- return new HashMap<String, String[]>();
+ return new MemoryDataStorage();
}
}
@@ -164,8 +157,8 @@
* Le nouveau fichier uploadé est mergé avec l'ancien, c'est à dire:
* <ul>
* <li>dezipage dans un fichier temporaire
- * <li>recuperation des noms zone/souszone-campagne des nouveau fichiers
- * <li>suppression dans l'ancien répertoire des resultats deja presents dans le nouveau (pour les conflits)
+ * <li>recuperation des noms de zones des nouveau fichiers
+ * <li>suppression dans l'ancien répertoire des resultats deja presents dans le nouveau (pour les conflits zone-type : map/non map)
* <li>suppression des selections vides
* <li>suppression des projets vides
* <li>copie (avec ecrasement) des nouveaux fichiers dans l'ancien répertoire
@@ -348,22 +341,42 @@
}
/**
+ * Get facades list (as facadeid/facadename).
+ *
+ * @return facades map
+ * @throws CoserBusinessException
+ */
+ public Map<String, String> getFacades() throws CoserBusinessException {
+ Map<String, String> facades = new HashMap<String, String>();
+ DataStorage zonesMap = getZonesMap();
+ Iterator<String[]> itZone = zonesMap.iterator(true);
+ while (itZone.hasNext()) {
+ String[] tuple = itZone.next();
+ // on a pas d'id pour les facades
+ facades.put(tuple[1], tuple[1]);
+ }
+ return facades;
+ }
+
+ /**
* Pour une zone principale, recupere la liste des couples sous-zone /
* campagne qui sont disponible dans cette zone principale.
*
- * @param mainZone main zone (le nom de la zone principale)
+ * @param facade facade (le nom de la facade principale)
* @return couple subzoneid/sub
* @throws CoserBusinessException
*/
- public Map<String, String> getSurveysForZone(String mainZone) throws CoserBusinessException {
+ public Map<String, String> getZoneForFacade(String facade) throws CoserBusinessException {
Map<String, String> surveyForZone = new HashMap<String, String>();
// get subzone for main zone
Collection<String> subZones = new ArrayList<String>();
- for (Map.Entry<String, String[]> zoneEntry : getZonesMap().entrySet()) {
- String[] zoneAndSubZone = zoneEntry.getValue();
- if (zoneAndSubZone[0].equals(mainZone)) {
- subZones.add(zoneEntry.getKey());
+ Iterator<String[]> itZone = getZonesMap().iterator(true);
+ while (itZone.hasNext()) {
+ // "id";"facade";"zone";"periode";"serie";"comment";"map"
+ String[] tuple = itZone.next();
+ if (tuple[1].equals(facade)) {
+ subZones.add(tuple[0]);
}
}
@@ -391,18 +404,14 @@
RSufiResult rsufiResult = projectService.getRSufiResult(resultFile);
String resultZoneId = rsufiResult.getZone();
if (subZones.contains(resultZoneId)) {
- String surveyName = projectService.getProjectSurveyName(resultFile, rsufiResult);
- String zoneid = resultZoneId + "-" + surveyName;
-
+ String zoneid = resultZoneId;
+
// get zone name
- String zoneName = "";
- for (Map.Entry<String, String[]> zoneEntry : getZonesMap().entrySet()) {
- if (zoneEntry.getKey().equals(resultZoneId)) {
- zoneName = zoneEntry.getValue()[1];
- }
- }
-
- zoneName += " - " + surveyName;
+ // "id";"facade";"zone";"periode";"serie";"comment";"map"
+ int zoneIndex = getZonesMap().indexOf(zoneid);
+ String[] zoneData = getZonesMap().get(zoneIndex);
+ String zoneName = zoneData[2] + " - " + zoneData[3] + " - " + zoneData[4];
+
surveyForZone.put(zoneid, zoneName);
}
}
@@ -421,7 +430,7 @@
/**
* Recuperer la liste des populations pour une zone donnée.
*
- * @param zone zone (zoneid-surveyname)
+ * @param zone zone id
* @return map species nom info>nom officiel
* @throws CoserBusinessException
*/
@@ -429,9 +438,6 @@
Map<String, String> result = new TreeMap<String, String>();
- String zoneId = zone.substring(0, zone.indexOf('-'));
- String survey = zone.substring(zone.indexOf('-') + 1);
-
// parcours des resultats disponibles
File projectsDirectory = config.getWebProjectsDirectory();
File[] projectFiles = projectsDirectory.listFiles();
@@ -455,18 +461,14 @@
RSufiResult rsufiResult = projectService.getRSufiResult(resultFile);
// extraction des especes pour le résultat demandé
- if (rsufiResult.getZone() != null && rsufiResult.getZone().equals(zoneId)) {
+ if (rsufiResult.getZone() != null && rsufiResult.getZone().equals(zone)) {
// load project (without data to get reftax data)
Project project = projectService.openProject(projectFile.getName(), projectsDirectory);
- // get survey name (other condition)
- String surveyName = projectService.getProjectSurveyName(resultFile, rsufiResult);
- if (surveyName.equals(survey)) {
- Map<String, String> resultSpecies = getRsufiResultSpecies(project, resultFile, rsufiResult);
- result.putAll(resultSpecies);
- break;
- }
+ Map<String, String> resultSpecies = getRsufiResultSpecies(project, resultFile, rsufiResult);
+ result.putAll(resultSpecies);
+ break;
}
}
}
@@ -533,7 +535,7 @@
* Retourne les indicateurs calculés avec leurs traductions scientifique
* pour la zone et l'especes souhaitées.
*
- * @param zone zone (zoneid-surveyname)
+ * @param zone zone id
* @param species especes (if {@code null} look for com indicators
* @param locale locale ({@code fr} ou {@code en})
* @return la liste des indicateurs
@@ -542,9 +544,6 @@
public Map<String, String> getIndicators(String zone, String species, String locale) throws CoserBusinessException {
Map<String, String> indicators = new TreeMap<String, String>();
- String zoneId = zone.substring(0, zone.indexOf('-'));
- String survey = zone.substring(zone.indexOf('-') + 1);
-
// parcours des resultats disponibles
File projectsDirectory = config.getWebProjectsDirectory();
File[] projectFiles = projectsDirectory.listFiles();
@@ -568,24 +567,18 @@
RSufiResult rsufiResult = projectService.getRSufiResult(resultFile);
// extraction des especes pour le résultat demandé
- if (rsufiResult.getZone() != null && rsufiResult.getZone().equals(zoneId)) {
+ if (rsufiResult.getZone() != null && rsufiResult.getZone().equals(zone)) {
- // get survey name (other condition)
- String surveyName = projectService.getProjectSurveyName(resultFile, rsufiResult);
-
- // data loading not necessary here
- if (surveyName.equals(survey)) {
- Map<String, String> resultIndicators = null;
-
- if (species == null) {
- resultIndicators = getRsufiResultComIndicators(resultFile, rsufiResult, locale);
- }
- else {
- resultIndicators = getRsufiResultPopIndicators(resultFile, rsufiResult, species, locale);
- }
- indicators.putAll(resultIndicators);
- break;
+ Map<String, String> resultIndicators = null;
+
+ if (species == null) {
+ resultIndicators = getRsufiResultComIndicators(resultFile, rsufiResult, locale);
}
+ else {
+ resultIndicators = getRsufiResultPopIndicators(resultFile, rsufiResult, species, locale);
+ }
+ indicators.putAll(resultIndicators);
+ break;
}
}
}
@@ -684,7 +677,7 @@
* Retourne les indicateurs calculés avec leurs traductions scientifique
* pour la zone et l'especes souhaitées.
*
- * @param zone zone (zoneid-surveyname)
+ * @param zone zone id
* @param species especes (if {@code null} look for com indicators
* @param indicator indicator
* @param locale locale ({@code fr} ou {@code en})
@@ -694,9 +687,6 @@
public File getChart(String zone, String species, String indicator, String locale) throws CoserBusinessException {
File result = null;
- String zoneId = zone.substring(0, zone.indexOf('-'));
- String survey = zone.substring(zone.indexOf('-') + 1);
-
// parcours des resultats disponibles
File projectsDirectory = config.getWebProjectsDirectory();
File[] projectFiles = projectsDirectory.listFiles();
@@ -720,21 +710,15 @@
RSufiResult rsufiResult = projectService.getRSufiResult(resultFile);
// extraction des especes pour le résultat demandé
- if (rsufiResult.getZone() != null && rsufiResult.getZone().equals(zoneId)) {
+ if (rsufiResult.getZone() != null && rsufiResult.getZone().equals(zone)) {
- // get survey name (other condition)
- String surveyName = projectService.getProjectSurveyName(resultFile, rsufiResult);
-
- // data loading not necessary here
- if (surveyName.equals(survey)) {
- if (species == null) {
- result = publicationService.getRsufiResultComChart(resultFile, rsufiResult, indicator, locale);
- }
- else {
- result = publicationService.getRsufiResultPopChart(resultFile, rsufiResult, species, indicator, locale);
- }
- break;
+ if (species == null) {
+ result = publicationService.getRsufiResultComChart(resultFile, rsufiResult, indicator, locale);
}
+ else {
+ result = publicationService.getRsufiResultPopChart(resultFile, rsufiResult, species, indicator, locale);
+ }
+ break;
}
}
}
@@ -762,9 +746,6 @@
File result = null;
- String zoneId = zone.substring(0, zone.indexOf('-'));
- String survey = zone.substring(zone.indexOf('-') + 1);
-
// parcours des resultats disponibles
File projectsDirectory = config.getWebProjectsDirectory();
File[] projectFiles = projectsDirectory.listFiles();
@@ -788,16 +769,14 @@
RSufiResult rsufiResult = projectService.getRSufiResult(resultFile);
// extraction des especes pour le résultat demandé
- if (rsufiResult.getZone() != null && rsufiResult.getZone().equals(zoneId)) {
+ if (rsufiResult.getZone() != null && rsufiResult.getZone().equals(zone)) {
// get survey name (other condition)
String surveyName = projectService.getProjectSurveyName(resultFile, rsufiResult);
- if (surveyName.equals(survey)) {
- String mapName = survey + "_" + species.toUpperCase() + ".png";
- File mapsDirectory = new File(resultFile, CoserConstants.STORAGE_MAPS_DIRECTORY);
- result = new File(mapsDirectory, mapName);
- }
+ String mapName = surveyName + "_" + species.toUpperCase() + ".png";
+ File mapsDirectory = new File(resultFile, CoserConstants.STORAGE_MAPS_DIRECTORY);
+ result = new File(mapsDirectory, mapName);
}
}
}
1
0
r498 - in trunk: coser-business/src/test/java/fr/ifremer/coser/services coser-web/src/main/java/fr/ifremer/coser/web coser-web/src/main/java/fr/ifremer/coser/web/actions/com coser-web/src/main/java/fr/ifremer/coser/web/actions/map coser-web/src/main/java/fr/ifremer/coser/web/actions/pop coser-web/src/main/webapp/WEB-INF/content/com coser-web/src/main/webapp/WEB-INF/content/map coser-web/src/main/webapp/WEB-INF/content/pop
by chatellier@users.labs.libre-entreprise.org 12 Jan '11
by chatellier@users.labs.libre-entreprise.org 12 Jan '11
12 Jan '11
Author: chatellier
Date: 2011-01-12 09:23:01 +0000 (Wed, 12 Jan 2011)
New Revision: 498
Log:
Refactoring zone>facade, subzone > zone
Modified:
trunk/coser-business/src/test/java/fr/ifremer/coser/services/ProjectServiceTest.java
trunk/coser-business/src/test/java/fr/ifremer/coser/services/WebServiceTest.java
trunk/coser-web/src/main/java/fr/ifremer/coser/web/ServiceFactory.java
trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/com/GraphAction.java
trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/com/GraphDataAction.java
trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/com/SubzoneAction.java
trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/com/ZoneAction.java
trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/map/MapDataAction.java
trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/map/SubzoneAction.java
trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/map/ZoneAction.java
trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/pop/GraphAction.java
trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/pop/GraphDataAction.java
trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/pop/SubzoneAction.java
trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/pop/ZoneAction.java
trunk/coser-web/src/main/webapp/WEB-INF/content/com/zone.jsp
trunk/coser-web/src/main/webapp/WEB-INF/content/map/zone.jsp
trunk/coser-web/src/main/webapp/WEB-INF/content/pop/zone.jsp
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 2011-01-12 09:21:35 UTC (rev 497)
+++ trunk/coser-business/src/test/java/fr/ifremer/coser/services/ProjectServiceTest.java 2011-01-12 09:23:01 UTC (rev 498)
@@ -460,20 +460,4 @@
MatrixND matrix = projectService.getLengthStructure(project, selection);
Assert.assertNotNull(matrix);
}
-
- /**
- * Test la recuperation du nom de la campagne.
- *
- * @throws CoserBusinessException
- */
- @Test
- public void getProjectSurveyName() throws CoserBusinessException {
- Project project = createTestProject(projectService, true);
- String survey = projectService.getProjectSurveyName(project.getControl());
- Assert.assertEquals("COSER_TEST", survey);
-
- Selection selection = projectService.initProjectSelection(project);
- survey = projectService.getProjectSurveyName(selection);
- Assert.assertEquals("COSER_TEST", survey);
- }
}
Modified: trunk/coser-business/src/test/java/fr/ifremer/coser/services/WebServiceTest.java
===================================================================
--- trunk/coser-business/src/test/java/fr/ifremer/coser/services/WebServiceTest.java 2011-01-12 09:21:35 UTC (rev 497)
+++ trunk/coser-business/src/test/java/fr/ifremer/coser/services/WebServiceTest.java 2011-01-12 09:23:01 UTC (rev 498)
@@ -27,7 +27,6 @@
import java.io.File;
import java.net.URL;
-import java.util.Map;
import org.apache.commons.collections.map.MultiKeyMap;
import org.junit.Assert;
@@ -35,6 +34,7 @@
import org.junit.Test;
import fr.ifremer.coser.CoserBusinessException;
+import fr.ifremer.coser.storage.DataStorage;
/**
* Test du service de l'interface web.
@@ -82,7 +82,7 @@
*/
@Test
public void testGetZones() throws CoserBusinessException {
- Map<String, String[]> zones = webService.getZonesMap();
+ DataStorage zones = webService.getZonesMap();
Assert.assertEquals(16, zones.size());
}
Modified: trunk/coser-web/src/main/java/fr/ifremer/coser/web/ServiceFactory.java
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/ServiceFactory.java 2011-01-12 09:21:35 UTC (rev 497)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/ServiceFactory.java 2011-01-12 09:23:01 UTC (rev 498)
@@ -3,7 +3,7 @@
* $Id$
* $HeadURL$
* %%
- * Copyright (C) 2010 Ifremer, Codelutin, Chatellier Eric
+ * Copyright (C) 2010 - 2011 Ifremer, Codelutin, Chatellier Eric
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -25,7 +25,6 @@
import org.nuiton.i18n.I18n;
import org.nuiton.util.ArgumentsParserException;
-import fr.ifremer.coser.services.PublicationService;
import fr.ifremer.coser.services.WebService;
/**
Modified: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/com/GraphAction.java
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/com/GraphAction.java 2011-01-12 09:21:35 UTC (rev 497)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/com/GraphAction.java 2011-01-12 09:23:01 UTC (rev 498)
@@ -28,22 +28,6 @@
* Affiche le graphique demandé.
*
* Parametre : zone, species, indicator.
- *
- * Based on eastwoood, same doc as google chart api :
- * http://code.google.com/apis/chart/docs/making_charts.html
- *
- * chart?cht=<chart_type>&chd=<chart_data>&chs=<chart_size>&...additional_parameters...
- *
- * Dans ce cas, on va faire un graphe avec des points pour les valeurs
- * et des traits (en dessous/au dessus) pour les ecarts types.
- * chd=t:
- * 12,16,16,24,26,28,41,51,66,68,13,45,81|
- * 16,14,22,34,22,31,31,48,71,64,15,38,84|
- * 8,6,4,5,2,13,9,8,7,6,1,8,8
- * chm=
- * o,0000FF,0,-1,0|
- * h,FF0000,0,0:9:,5|
- * h,FF0000,0,0:9:,5
*
* @author chatellier
* @version $Revision$
@@ -60,8 +44,6 @@
protected String indicator;
- protected String chartUrl;
-
public String getZone() {
return zone;
}
@@ -80,7 +62,6 @@
@Override
public String execute() {
-
return SUCCESS;
}
}
Modified: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/com/GraphDataAction.java
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/com/GraphDataAction.java 2011-01-12 09:21:35 UTC (rev 497)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/com/GraphDataAction.java 2011-01-12 09:23:01 UTC (rev 498)
@@ -42,22 +42,6 @@
* Affiche le graphique demandé.
*
* Parametre : zone, species, indicator.
- *
- * Based on eastwoood, same doc as google chart api :
- * http://code.google.com/apis/chart/docs/making_charts.html
- *
- * chart?cht=<chart_type>&chd=<chart_data>&chs=<chart_size>&...additional_parameters...
- *
- * Dans ce cas, on va faire un graphe avec des points pour les valeurs
- * et des traits (en dessous/au dessus) pour les ecarts types.
- * chd=t:
- * 12,16,16,24,26,28,41,51,66,68,13,45,81|
- * 16,14,22,34,22,31,31,48,71,64,15,38,84|
- * 8,6,4,5,2,13,9,8,7,6,1,8,8
- * chm=
- * o,0000FF,0,-1,0|
- * h,FF0000,0,0:9:,5|
- * h,FF0000,0,0:9:,5
*
* @author chatellier
* @version $Revision$
@@ -71,7 +55,7 @@
private static final long serialVersionUID = 3385467755357775199L;
protected String zone;
-
+
protected String indicator;
protected String chartUrl;
@@ -91,12 +75,12 @@
public void setIndicator(String indicator) {
this.indicator = indicator;
}
-
+
@Action(results= {@Result(type="stream", params={"contentType", "image/png", "inputName", "inputStream"})})
public String execute() {
return SUCCESS;
}
-
+
public InputStream getInputStream() {
WebService webService = ServiceFactory.getWebService();
@@ -112,7 +96,7 @@
} catch (FileNotFoundException ex) {
throw new CoserWebException("Can't get map file", ex);
}
-
+
return input;
}
}
Modified: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/com/SubzoneAction.java
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/com/SubzoneAction.java 2011-01-12 09:21:35 UTC (rev 497)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/com/SubzoneAction.java 2011-01-12 09:23:01 UTC (rev 498)
@@ -45,10 +45,10 @@
/** serialVersionUID. */
private static final long serialVersionUID = 3385467755357775199L;
- protected String mainZone;
+ protected String facade;
- public void setMainZone(String mainZone) {
- this.mainZone = mainZone;
+ public void setFacade(String facade) {
+ this.facade = facade;
}
protected Map<String, String> zones;
@@ -65,7 +65,7 @@
// renvoi la liste des id subzone-survey et leurs label
// associé
- zones = webService.getSurveysForZone(mainZone);
+ zones = webService.getZoneForFacade(facade);
} catch (CoserBusinessException ex) {
throw new CoserWebException("Can't get zone map", ex);
Modified: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/com/ZoneAction.java
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/com/ZoneAction.java 2011-01-12 09:21:35 UTC (rev 497)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/com/ZoneAction.java 2011-01-12 09:23:01 UTC (rev 498)
@@ -22,7 +22,6 @@
package fr.ifremer.coser.web.actions.com;
-import java.util.HashMap;
import java.util.Map;
import com.opensymphony.xwork2.ActionSupport;
@@ -33,7 +32,7 @@
import fr.ifremer.coser.web.ServiceFactory;
/**
- * Action index, affiche la liste des zones majeures (main zone).
+ * Action index, affiche la liste des facades majeures.
*
* @author chatellier
* @version $Revision$
@@ -46,25 +45,21 @@
/** serialVersionUID. */
private static final long serialVersionUID = 3385467755357775199L;
- protected Map<String, String> mainZones;
+ protected Map<String, String> facades;
- public Map<String, String> getMainZones() {
- return mainZones;
+ public Map<String, String> getFacades() {
+ return facades;
}
@Override
public String execute() {
- mainZones = new HashMap<String, String>();
-
WebService webService = ServiceFactory.getWebService();
try {
- Map<String, String[]> zonesMap = webService.getZonesMap();
+
+ // renvoi la liste des facadeid et leur label associé
+ facades = webService.getFacades();
- for (Map.Entry<String, String[]> zoneMapEntry : zonesMap.entrySet()) {
- mainZones.put(zoneMapEntry.getValue()[0], zoneMapEntry.getValue()[0]);
- }
-
} catch (CoserBusinessException ex) {
throw new CoserWebException("Can't get zone map", ex);
}
Modified: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/map/MapDataAction.java
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/map/MapDataAction.java 2011-01-12 09:21:35 UTC (rev 497)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/map/MapDataAction.java 2011-01-12 09:23:01 UTC (rev 498)
@@ -26,9 +26,7 @@
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
-import java.io.OutputStream;
-import org.apache.commons.io.IOUtils;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
Modified: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/map/SubzoneAction.java
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/map/SubzoneAction.java 2011-01-12 09:21:35 UTC (rev 497)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/map/SubzoneAction.java 2011-01-12 09:23:01 UTC (rev 498)
@@ -45,10 +45,10 @@
/** serialVersionUID. */
private static final long serialVersionUID = 3385467755357775199L;
- protected String mainZone;
+ protected String facade;
- public void setMainZone(String mainZone) {
- this.mainZone = mainZone;
+ public void setFacade(String facade) {
+ this.facade = facade;
}
protected Map<String, String> zones;
@@ -65,7 +65,7 @@
// renvoi la liste des id subzone-survey et leurs label
// associé
- zones = webService.getSurveysForZone(mainZone);
+ zones = webService.getZoneForFacade(facade);
} catch (CoserBusinessException ex) {
throw new CoserWebException("Can't get zone map", ex);
Modified: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/map/ZoneAction.java
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/map/ZoneAction.java 2011-01-12 09:21:35 UTC (rev 497)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/map/ZoneAction.java 2011-01-12 09:23:01 UTC (rev 498)
@@ -22,7 +22,6 @@
package fr.ifremer.coser.web.actions.map;
-import java.util.HashMap;
import java.util.Map;
import com.opensymphony.xwork2.ActionSupport;
@@ -33,7 +32,7 @@
import fr.ifremer.coser.web.ServiceFactory;
/**
- * Action index, affiche la liste des zones majeures (main zone).
+ * Action index, affiche la liste des facades majeures.
*
* @author chatellier
* @version $Revision$
@@ -46,25 +45,20 @@
/** serialVersionUID. */
private static final long serialVersionUID = 3385467755357775199L;
- protected Map<String, String> mainZones;
+ protected Map<String, String> facades;
- public Map<String, String> getMainZones() {
- return mainZones;
+ public Map<String, String> getFacades() {
+ return facades;
}
@Override
public String execute() {
- mainZones = new HashMap<String, String>();
-
WebService webService = ServiceFactory.getWebService();
try {
- Map<String, String[]> zonesMap = webService.getZonesMap();
+ // renvoi la liste des facadeid et leur label associé
+ facades = webService.getFacades();
- for (Map.Entry<String, String[]> zoneMapEntry : zonesMap.entrySet()) {
- mainZones.put(zoneMapEntry.getValue()[0], zoneMapEntry.getValue()[0]);
- }
-
} catch (CoserBusinessException ex) {
throw new CoserWebException("Can't get zone map", ex);
}
Modified: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/pop/GraphAction.java
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/pop/GraphAction.java 2011-01-12 09:21:35 UTC (rev 497)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/pop/GraphAction.java 2011-01-12 09:23:01 UTC (rev 498)
@@ -24,29 +24,10 @@
import com.opensymphony.xwork2.ActionSupport;
-import fr.ifremer.coser.web.CoserWebConfig;
-import fr.ifremer.coser.web.ServiceFactory;
-
/**
* Affiche le graphique demandé.
*
* Parametre : zone, species, indicator.
- *
- * Based on eastwoood, same doc as google chart api :
- * http://code.google.com/apis/chart/docs/making_charts.html
- *
- * chart?cht=<chart_type>&chd=<chart_data>&chs=<chart_size>&...additional_parameters...
- *
- * Dans ce cas, on va faire un graphe avec des points pour les valeurs
- * et des traits (en dessous/au dessus) pour les ecarts types.
- * chd=t:
- * 12,16,16,24,26,28,41,51,66,68,13,45,81|
- * 16,14,22,34,22,31,31,48,71,64,15,38,84|
- * 8,6,4,5,2,13,9,8,7,6,1,8,8
- * chm=
- * o,0000FF,0,-1,0|
- * h,FF0000,0,0:9:,5|
- * h,FF0000,0,0:9:,5
*
* @author chatellier
* @version $Revision$
@@ -65,8 +46,6 @@
protected String indicator;
- protected String chartUrl;
-
public String getZone() {
return zone;
}
@@ -93,30 +72,6 @@
@Override
public String execute() {
-
- /*CoserWebConfig config = ServiceFactory.getCoserConfig();
-
- chartUrl = config.getEastWoodUrl() + "/chart?";
-
- // chart type
- chartUrl += "&cht=lxy";
- // data
- chartUrl += "&chd=t:10,20,40,80,90,95,99|20,30,40,50,60,70,80";
- // legend
- chartUrl += "&chdl=Species";
- // legend position
- chartUrl += "&chdlp=b";
- // markers (plot)
- chartUrl += "&chm=o,FF0000,0,-1,5";
- // display x y axis
- chartUrl += "&chxt=x,y";
- // taille
- chartUrl += "&chs=600x300";
- // taille de la courbe
- chartUrl += "&chls=2";
- // titre du graphique
- chartUrl += "&chtt=" + zone + ";" + species + ";" + indicator;*/
-
return SUCCESS;
}
}
Modified: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/pop/GraphDataAction.java
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/pop/GraphDataAction.java 2011-01-12 09:21:35 UTC (rev 497)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/pop/GraphDataAction.java 2011-01-12 09:23:01 UTC (rev 498)
@@ -34,9 +34,7 @@
import com.opensymphony.xwork2.ActionSupport;
import fr.ifremer.coser.CoserBusinessException;
-import fr.ifremer.coser.services.PublicationService;
import fr.ifremer.coser.services.WebService;
-import fr.ifremer.coser.web.CoserWebConfig;
import fr.ifremer.coser.web.CoserWebException;
import fr.ifremer.coser.web.ServiceFactory;
@@ -44,22 +42,6 @@
* Affiche le graphique demandé.
*
* Parametre : zone, species, indicator.
- *
- * Based on eastwoood, same doc as google chart api :
- * http://code.google.com/apis/chart/docs/making_charts.html
- *
- * chart?cht=<chart_type>&chd=<chart_data>&chs=<chart_size>&...additional_parameters...
- *
- * Dans ce cas, on va faire un graphe avec des points pour les valeurs
- * et des traits (en dessous/au dessus) pour les ecarts types.
- * chd=t:
- * 12,16,16,24,26,28,41,51,66,68,13,45,81|
- * 16,14,22,34,22,31,31,48,71,64,15,38,84|
- * 8,6,4,5,2,13,9,8,7,6,1,8,8
- * chm=
- * o,0000FF,0,-1,0|
- * h,FF0000,0,0:9:,5|
- * h,FF0000,0,0:9:,5
*
* @author chatellier
* @version $Revision$
Modified: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/pop/SubzoneAction.java
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/pop/SubzoneAction.java 2011-01-12 09:21:35 UTC (rev 497)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/pop/SubzoneAction.java 2011-01-12 09:23:01 UTC (rev 498)
@@ -45,10 +45,10 @@
/** serialVersionUID. */
private static final long serialVersionUID = 3385467755357775199L;
- protected String mainZone;
+ protected String facade;
- public void setMainZone(String mainZone) {
- this.mainZone = mainZone;
+ public void setFacade(String facade) {
+ this.facade = facade;
}
protected Map<String, String> zones;
@@ -65,7 +65,7 @@
// renvoi la liste des id subzone-survey et leurs label
// associé
- zones = webService.getSurveysForZone(mainZone);
+ zones = webService.getZoneForFacade(facade);
} catch (CoserBusinessException ex) {
throw new CoserWebException("Can't get zone map", ex);
Modified: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/pop/ZoneAction.java
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/pop/ZoneAction.java 2011-01-12 09:21:35 UTC (rev 497)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/pop/ZoneAction.java 2011-01-12 09:23:01 UTC (rev 498)
@@ -22,7 +22,6 @@
package fr.ifremer.coser.web.actions.pop;
-import java.util.HashMap;
import java.util.Map;
import com.opensymphony.xwork2.ActionSupport;
@@ -33,7 +32,7 @@
import fr.ifremer.coser.web.ServiceFactory;
/**
- * Action index, affiche la liste des zones majeures (main zone).
+ * Action index, affiche la liste des facades majeures.
*
* @author chatellier
* @version $Revision$
@@ -46,25 +45,20 @@
/** serialVersionUID. */
private static final long serialVersionUID = 3385467755357775199L;
- protected Map<String, String> mainZones;
+ protected Map<String, String> facades;
- public Map<String, String> getMainZones() {
- return mainZones;
+ public Map<String, String> getFacades() {
+ return facades;
}
@Override
public String execute() {
- mainZones = new HashMap<String, String>();
-
WebService webService = ServiceFactory.getWebService();
try {
- Map<String, String[]> zonesMap = webService.getZonesMap();
+ // renvoi la liste des facadeid et leur label associé
+ facades = webService.getFacades();
- for (Map.Entry<String, String[]> zoneMapEntry : zonesMap.entrySet()) {
- mainZones.put(zoneMapEntry.getValue()[0], zoneMapEntry.getValue()[0]);
- }
-
} catch (CoserBusinessException ex) {
throw new CoserWebException("Can't get zone map", ex);
}
Modified: trunk/coser-web/src/main/webapp/WEB-INF/content/com/zone.jsp
===================================================================
--- trunk/coser-web/src/main/webapp/WEB-INF/content/com/zone.jsp 2011-01-12 09:21:35 UTC (rev 497)
+++ trunk/coser-web/src/main/webapp/WEB-INF/content/com/zone.jsp 2011-01-12 09:23:01 UTC (rev 498)
@@ -35,7 +35,7 @@
<br />
<s:form action="subzone" method="get">
- <s:select name="mainZone" list="mainZones" label="Select a zone" />
+ <s:select name="facade" list="facades" label="Select a facade" />
<s:submit label="Suite"/>
</s:form>
</body>
Modified: trunk/coser-web/src/main/webapp/WEB-INF/content/map/zone.jsp
===================================================================
--- trunk/coser-web/src/main/webapp/WEB-INF/content/map/zone.jsp 2011-01-12 09:21:35 UTC (rev 497)
+++ trunk/coser-web/src/main/webapp/WEB-INF/content/map/zone.jsp 2011-01-12 09:23:01 UTC (rev 498)
@@ -35,7 +35,7 @@
<br />
<s:form action="subzone" method="get">
- <s:select name="mainZone" list="mainZones" label="Select a zone" />
+ <s:select name="facade" list="facades" label="Select a facade" />
<s:submit label="Suite"/>
</s:form>
</body>
Modified: trunk/coser-web/src/main/webapp/WEB-INF/content/pop/zone.jsp
===================================================================
--- trunk/coser-web/src/main/webapp/WEB-INF/content/pop/zone.jsp 2011-01-12 09:21:35 UTC (rev 497)
+++ trunk/coser-web/src/main/webapp/WEB-INF/content/pop/zone.jsp 2011-01-12 09:23:01 UTC (rev 498)
@@ -35,7 +35,7 @@
<br />
<s:form action="subzone" method="get">
- <s:select name="mainZone" list="mainZones" label="Select a zone" />
+ <s:select name="facade" list="facades" label="Select a facade" />
<s:submit label="Suite"/>
</s:form>
</body>
1
0