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
March 2014
- 4 participants
- 51 discussions
12 Mar '14
Author: tchemit
Date: 2014-03-12 18:35:43 +0100 (Wed, 12 Mar 2014)
New Revision: 1145
Url: http://forge.codelutin.com/projects/coser/repository/revisions/1145
Log:
refs #4664 review Result API (using Command pattern), need to finish the web part
Added:
trunk/coser-business/src/main/java/fr/ifremer/coser/result/MapResult.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/ResultType.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/VoidResult.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/ResultRepositoryCommand.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/ResultRepositoryCommandEngine.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/ResultRepositoryType.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/EchoBaseResultRepositoryCommandEngine.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/EchoBaseResultRepositoryType.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/DeleteResultsCommand.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/ExtractRawDataAndResultsCommand.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/ExtractRawDataCommand.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetAllResultsCommand.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetCommunityIndicatorResultCommand.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetIndicatorsForCommunityIndicatorResultCommand.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetIndicatorsForExtractRawDataAndResultsCommand.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetIndicatorsForPopulationIndicatorResultCommand.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetMapResultCommand.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetPopulationIndicatorResultCommand.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetSpeciesForMapResultCommand.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetSpeciesForPopulationIndicatorResultCommand.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetSpeciesListForCommunityIndicatorResultCommand.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetSpeciesListForExtractRawDataAndResultsCommand.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetZonesForCommunityIndicatorResultCommand.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetZonesForExtractRawDataAndResultsCommand.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetZonesForExtractRawDataCommand.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetZonesForMapResultCommand.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetZonesForPopulationIndicatorResultCommand.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/LegacyResultRepositoryCommandEngine.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/LegacyResultRepositoryType.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/DeleteResultsCommand.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/ExtractRawDataAndResultsCommand.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/ExtractRawDataCommand.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetAllResultsCommand.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetCommunityIndicatorResultCommand.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetIndicatorsForCommunityIndicatorResultCommand.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetIndicatorsForExtractRawDataAndResultsCommand.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetIndicatorsForPopulationIndicatorResultCommand.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetMapResultCommand.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetPopulationIndicatorResultCommand.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetSpeciesForMapResultCommand.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetSpeciesForPopulationIndicatorResultCommand.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetSpeciesListForCommunityIndicatorResultCommand.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetSpeciesListForExtractRawDataAndResultsCommand.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetZonesForCommunityIndicatorResultCommand.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetZonesForExtractRawDataCommand.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetZonesForMapResultCommand.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetZonesForPopulationIndicatorResultCommand.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetZonesListForExtractRawDataAndResultsCommand.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/AbstractGetIndicatorResultRequest.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/CoserRequestIndicatorAware.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/CoserRequestZoneListAware.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/DeleteResultsRequest.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/ExtractRawDataAndResultsRequest.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/ExtractRawDataRequest.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetAllResultsRequest.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetCommunityIndicatorResultRequest.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetIndicatorsForCommunityIndicatorResultRequest.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetIndicatorsForExtractRawDataAndResultsRequest.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetIndicatorsForPopulationIndicatorResultRequest.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetMapResultRequest.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetPopulationIndicatorResultRequest.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetSpeciesForMapResultRequest.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetSpeciesForPopulationIndicatorResultRequest.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetSpeciesListForCommunityIndicatorResultRequest.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetSpeciesListForExtractRawDataAndResultsRequest.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetZonesForCommunityIndicatorResultRequest.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetZonesForExtractRawDataAndResultsRequest.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetZonesForExtractRawDataRequest.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetZonesForMapResultRequest.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetZonesForPopulationIndicatorResultRequest.java
trunk/coser-business/src/main/resources/META-INF/
trunk/coser-business/src/main/resources/META-INF/services/
trunk/coser-business/src/main/resources/META-INF/services/fr.ifremer.coser.result.repository.ResultRepositoryType
trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/admin/ReloadProjectsAction.java
Removed:
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/RequestUnavailableForProducerException.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/ResultProducer.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/CommunityIndicatorResultProducer.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/ExtractResultProducer.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/MapResultProducer.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/PopulationIndicatorResultProducer.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/RawDataResultProducer.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/CommunityIndicatorResultProducer.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/ExtractResultProducer.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/MapResultProducer.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/PopulationIndicatorResultProducer.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/RawDataResultProducer.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/CommunityIndicatorRequest.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/DeleteRequest.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/ExtractRequest.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/IndicatorRequest.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/MapRequest.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/PopulationIndicatorRequest.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/RawDataRequest.java
Modified:
trunk/coser-business/src/main/java/fr/ifremer/coser/CoserServiceContext.java
trunk/coser-business/src/main/java/fr/ifremer/coser/DefaultCoserServiceContext.java
trunk/coser-business/src/main/java/fr/ifremer/coser/bean/EchoBaseProject.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/CoserResultEngine.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/ResultRepository.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/ResultRepositoryProvider.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/EchoBaseResultRepository.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/EchoBaseResultRepositoryProvider.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/LegacyResultRepository.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/LegacyResultRepositoryProvider.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/CoserRequestBuilder.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/CoserRequestZoneAware.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/result/repository/echobase/EchoBaseResultRepositoryTest.java
trunk/coser-web/src/main/java/fr/ifremer/coser/web/CoserApplicationContext.java
trunk/coser-web/src/main/java/fr/ifremer/coser/web/ServiceHelper.java
trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/admin/DeleteProjectsAction.java
trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/admin/ListProjectsAction.java
trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/admin/PerformLoginAction.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/GraphDownloadAction.java
trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/com/IndicatorAction.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/common/CommonIndicator.java
trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/common/CoserAction.java
trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/map/MapAction.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/SpeciesAction.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/GraphDownloadAction.java
trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/pop/IndicatorAction.java
trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/pop/SpeciesAction.java
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/search/ExtractAction.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/ZoneAction.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
trunk/coser-web/src/main/resources/log4j.properties
trunk/coser-web/src/main/webapp/WEB-INF/content/admin/list-projects.jsp
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/CoserServiceContext.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/CoserServiceContext.java 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/CoserServiceContext.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -25,6 +25,7 @@
import fr.ifremer.coser.bean.IndicatorMap;
import fr.ifremer.coser.bean.ZoneMap;
import fr.ifremer.coser.result.repository.ResultRepositoryProvider;
+import fr.ifremer.coser.result.repository.ResultRepositoryType;
import java.util.Set;
@@ -38,8 +39,10 @@
CoserBusinessConfig getConfig();
- Set<ResultRepositoryProvider<?>> getProviders();
+ Set<ResultRepositoryType> getResultRepositoryTypes();
+ Set<ResultRepositoryProvider<?>> getResultRepositoryProviders();
+
IndicatorMap getIndicatorsMap();
ZoneMap getZonesMap();
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/DefaultCoserServiceContext.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/DefaultCoserServiceContext.java 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/DefaultCoserServiceContext.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -22,11 +22,16 @@
* #L%
*/
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Sets;
import fr.ifremer.coser.bean.IndicatorMap;
import fr.ifremer.coser.bean.ZoneMap;
-import fr.ifremer.coser.result.CoserResultEngine;
import fr.ifremer.coser.result.repository.ResultRepositoryProvider;
+import fr.ifremer.coser.result.repository.ResultRepositoryType;
+import fr.ifremer.coser.result.repository.echobase.EchoBaseResultRepositoryProvider;
+import fr.ifremer.coser.result.repository.legacy.LegacyResultRepositoryProvider;
+import java.util.ServiceLoader;
import java.util.Set;
/**
@@ -43,9 +48,14 @@
protected CoserBusinessConfig config;
/**
+ * Available type of result repositories (loaded by service loader).
+ */
+ protected Set<ResultRepositoryType> resultRepositoryTypes;
+
+ /**
* Result repositories providers.
*/
- protected Set<ResultRepositoryProvider<?>> providers;
+ protected Set<ResultRepositoryProvider<?>> resultRepositoryProviders;
/**
* Cache of indicator definition.
@@ -61,20 +71,47 @@
this.config = config;
}
+ public static Set<ResultRepositoryProvider<?>> createDefaultRepositoryProviders(CoserBusinessConfig config) {
+ Preconditions.checkNotNull(config);
+ Set<ResultRepositoryProvider<?>> result = Sets.newHashSet();
+
+ // add legacy map repository
+ Preconditions.checkNotNull(config.getWebMapsProjectsDirectory());
+ result.add(new LegacyResultRepositoryProvider(config.getWebMapsProjectsDirectory()));
+
+ // add legacy indicators repository
+ Preconditions.checkNotNull(config.getWebIndicatorsProjectsDirectory());
+ result.add(new LegacyResultRepositoryProvider(config.getWebIndicatorsProjectsDirectory()));
+
+ // add EchoBase repository
+ Preconditions.checkNotNull(config.getWebEchobaseProjectsDirectory());
+ result.add(new EchoBaseResultRepositoryProvider(config.getWebEchobaseProjectsDirectory()));
+ return result;
+ }
+
@Override
public CoserBusinessConfig getConfig() {
return config;
}
@Override
- public Set<ResultRepositoryProvider<?>> getProviders() {
- if (providers == null) {
- providers = CoserResultEngine.createDefaultRepositoryProviders(config);
+ public Set<ResultRepositoryType> getResultRepositoryTypes() {
+ if (resultRepositoryTypes == null) {
+ ServiceLoader<ResultRepositoryType> loader = ServiceLoader.load(ResultRepositoryType.class);
+ resultRepositoryTypes = Sets.newHashSet(loader);
}
- return providers;
+ return resultRepositoryTypes;
}
@Override
+ public Set<ResultRepositoryProvider<?>> getResultRepositoryProviders() {
+ if (resultRepositoryProviders == null) {
+ resultRepositoryProviders = createDefaultRepositoryProviders(config);
+ }
+ return resultRepositoryProviders;
+ }
+
+ @Override
public IndicatorMap getIndicatorsMap() {
if (indicatorsMap == null) {
indicatorsMap = new IndicatorMap(config.getWebIndicatorsFile());
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/bean/EchoBaseProject.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/bean/EchoBaseProject.java 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/bean/EchoBaseProject.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -71,6 +71,9 @@
protected Date creationDate;
+ /** Result publiable. */
+ protected boolean publiableResult;
+
public EchoBaseProject(File basedir) {
this.basedir = basedir;
}
@@ -131,6 +134,14 @@
this.creationDate = creationDate;
}
+ public boolean isPubliableResult() {
+ return publiableResult;
+ }
+
+ public void setPubliableResult(boolean publiableResult) {
+ this.publiableResult = publiableResult;
+ }
+
public File getSpeciesDefinitionFile() {
return new File(basedir, "species.csv");
}
@@ -207,6 +218,8 @@
if (creationDate != null) {
props.setProperty("project.creationDate", String.valueOf(creationDate.getTime()));
}
+ props.setProperty("project.publiableResult", String.valueOf(publiableResult));
+
return props;
}
@@ -230,6 +243,10 @@
Date date = new Date(Long.parseLong(props.getProperty("project.creationDate")));
setCreationDate(date);
}
+ if (props.containsKey("project.publiableResult")) {
+ boolean v = Boolean.valueOf(props.getProperty("project.publiableResult"));
+ setPubliableResult(v);
+ }
}
public static FilenameFilter newMapSpeciesFilenameFilter(String surveyName) {
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/result/CoserResultEngine.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/CoserResultEngine.java 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/CoserResultEngine.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -26,13 +26,11 @@
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
-import fr.ifremer.coser.CoserBusinessConfig;
import fr.ifremer.coser.CoserServiceContext;
import fr.ifremer.coser.result.repository.ResultRepository;
+import fr.ifremer.coser.result.repository.ResultRepositoryCommandEngine;
import fr.ifremer.coser.result.repository.ResultRepositoryProvider;
-import fr.ifremer.coser.result.repository.echobase.EchoBaseResultRepositoryProvider;
-import fr.ifremer.coser.result.repository.legacy.LegacyResultRepositoryProvider;
-import org.apache.commons.collections4.MapUtils;
+import fr.ifremer.coser.result.repository.ResultRepositoryType;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -41,16 +39,13 @@
import java.util.Set;
/**
- * To request some results on the web server side.
+ * To execute command all over coser result repositories.
* <p/>
* This new API will let us to define any result format to be queried.
* <p/>
* Created on 3/4/14.
*
* @author Tony Chemit <chemit(a)codelutin.com>
- * @see ResultRepositoryProvider
- * @see ResultRepository
- * @see CoserResult
* @since 1.5
*/
public class CoserResultEngine {
@@ -58,31 +53,8 @@
/** Logger. */
private static final Log log = LogFactory.getLog(CoserResultEngine.class);
- public static Set<ResultRepositoryProvider<?>> createDefaultRepositoryProviders(CoserBusinessConfig config) {
- Preconditions.checkNotNull(config);
- Set<ResultRepositoryProvider<?>> result = Sets.newHashSet();
+ protected Set<ResultRepositoryCommandEngine> repositories;
- // add legacy map repository
- Preconditions.checkNotNull(config.getWebMapsProjectsDirectory());
- result.add(new LegacyResultRepositoryProvider(config.getWebMapsProjectsDirectory()));
-
- // add legacy indicators repository
- Preconditions.checkNotNull(config.getWebIndicatorsProjectsDirectory());
- result.add(new LegacyResultRepositoryProvider(config.getWebIndicatorsProjectsDirectory()));
-
- // add EchoBase repository
- Preconditions.checkNotNull(config.getWebEchobaseProjectsDirectory());
- result.add(new EchoBaseResultRepositoryProvider(config.getWebEchobaseProjectsDirectory()));
- return result;
- }
-
- /**
- * Result repositories loaded lazy from their provider.
- *
- * @see #getRepositories()
- */
- protected Set<ResultRepository> repositories;
-
protected final CoserServiceContext serviceContext;
public CoserResultEngine(CoserServiceContext serviceContext) {
@@ -90,84 +62,96 @@
this.serviceContext = serviceContext;
}
+ public Map<String, ResultRepositoryType> getRepositoryTypes() {
+ Map<String, ResultRepositoryType> result = Maps.newHashMap();
+ for (ResultRepositoryType resultRepositoryType : serviceContext.getResultRepositoryTypes()) {
+ result.put(resultRepositoryType.getId(), resultRepositoryType);
+ }
+ return result;
+ }
+
public void resetRepositories() {
this.repositories = null;
}
- public Map<String, String> getAvailableExtractTypes() {
- Map<String, String> result = Maps.newLinkedHashMap();
- return result;
- }
+ public CoserResult getUniqueResult(CoserRequest request) throws DuplicatedResultException {
- public Map<String, String> getAvailableZones(CoserRequest request) {
- Map<String, String> result = Maps.newHashMap();
- for (ResultRepository repository : getRepositories()) {
- Map<String, String> resultForRepository = repository.getAvailableZones(request);
- if (MapUtils.isNotEmpty(resultForRepository)) {
- result.putAll(resultForRepository);
- }
- }
- return result;
- }
+ Preconditions.checkArgument(request.isFilled());
- public Map<String, String> getAvailableSpecies(CoserRequest request) {
- Map<String, String> result = Maps.newHashMap();
- for (ResultRepository repository : getRepositories()) {
- Map<String, String> resultForRepository = repository.getAvailableSpecies(request);
- if (MapUtils.isNotEmpty(resultForRepository)) {
- result.putAll(resultForRepository);
- }
+ ResultRepositoryCommandEngine repository = getMatchingRepository(request);
+
+ if (repository == null) {
+ throw new NoResultRepositoryFoundException("No result repository matching request", request);
}
+ CoserResult result = repository.executeRequest(request);
+ if (result == null) {
+ throw new NoResultFoundException(repository.getResultRepository().getId(), request);
+ }
return result;
}
- public Map<String, String> getAvailableIndicators(CoserRequest request) {
- Map<String, String> result = Maps.newHashMap();
- for (ResultRepository repository : getRepositories()) {
- Map<String, String> resultForRepository = repository.getAvailableIndicators(request);
- if (MapUtils.isNotEmpty(resultForRepository)) {
- result.putAll(resultForRepository);
+ public List<CoserResult> getMultipleResult(CoserRequest request) throws DuplicatedResultException {
+
+ Preconditions.checkArgument(request.isFilled());
+
+ List<CoserResult> result = Lists.newArrayList();
+ for (ResultRepositoryCommandEngine repository : getRepositories()) {
+ if (repository.acceptRequest(request)) {
+
+ CoserResult repositoryResult = repository.executeRequest(request);
+ result.add(repositoryResult);
}
}
return result;
}
- public CoserResult getResult(CoserRequest request) throws DuplicatedResultException {
+ protected ResultRepositoryCommandEngine getMatchingRepository(CoserRequest request) throws DuplicatedResultException {
- Preconditions.checkArgument(request.isFilled());
+ List<ResultRepositoryCommandEngine> repositoryList = Lists.newArrayList();
- ResultRepository repository = getMatchingRepository(request);
+ for (ResultRepositoryCommandEngine resultRepository : getRepositories()) {
- if (repository == null) {
- throw new NoResultRepositoryFoundException("No result repository matching request", request);
+ if (resultRepository.acceptRequest(request)) {
+ repositoryList.add(resultRepository);
+ }
}
- CoserResult result = repository.getResult(request);
- if (result == null) {
- throw new NoResultFoundException(repository.getId(), request);
+
+ ResultRepositoryCommandEngine repository;
+ switch (repositoryList.size()) {
+ case 0:
+ repository = null;
+ break;
+ case 1:
+ repository = repositoryList.get(0);
+ break;
+ default:
+ throw new DuplicatedResultException(
+ repositoryList.toArray(new ResultRepository[repositoryList.size()]));
}
- return result;
+ return repository;
}
- protected Set<ResultRepository> getRepositories() {
+ protected Set<ResultRepositoryCommandEngine> getRepositories() {
if (repositories == null) {
Set<String> ids = Sets.newHashSet();
repositories = Sets.newHashSet();
- for (ResultRepositoryProvider repositoryProvider : serviceContext.getProviders()) {
+ for (ResultRepositoryProvider repositoryProvider : serviceContext.getResultRepositoryProviders()) {
Set<ResultRepository> resultRepositories = repositoryProvider.loadRepositories(serviceContext);
// check all repository use a unique id
for (ResultRepository resultRepository : resultRepositories) {
String id = resultRepository.getId();
if (log.isDebugEnabled()) {
- log.debug("Try to register resultrepository: " + id);
+ log.debug("Try to register result Repository: " + id);
}
if (!ids.add(id)) {
// there is already a repository with this id
throw new ResultRepositoryInitializationException(repositoryProvider, "Duplicate result repository with id: " + id, null);
}
+ ResultRepositoryCommandEngine repositoryCommandEngine = repositoryProvider.newEngine(resultRepository);
+ repositories.add(repositoryCommandEngine);
}
- repositories.addAll(resultRepositories);
}
if (log.isInfoEnabled()) {
log.info("Found " + repositories.size() + " result repository(ies).");
@@ -175,30 +159,4 @@
}
return repositories;
}
-
- protected ResultRepository getMatchingRepository(CoserRequest request) throws DuplicatedResultException {
-
- List<ResultRepository> repositoryList = Lists.newArrayList();
-
- for (ResultRepository resultRepository : getRepositories()) {
-
- if (resultRepository.acceptResult(request)) {
- repositoryList.add(resultRepository);
- }
- }
-
- ResultRepository repository;
- switch (repositoryList.size()) {
- case 0:
- repository = null;
- break;
- case 1:
- repository = repositoryList.get(0);
- break;
- default:
- throw new DuplicatedResultException(
- repositoryList.toArray(new ResultRepository[repositoryList.size()]));
- }
- return repository;
- }
}
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/MapResult.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/MapResult.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/MapResult.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,56 @@
+package fr.ifremer.coser.result;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import java.util.Map;
+
+/**
+ * Created on 3/12/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class MapResult implements CoserResult {
+
+ private static final long serialVersionUID = 1L;
+
+ protected final String source;
+
+ protected final Map<String, String> map;
+
+ public MapResult(String source, Map<String, String> map) {
+ this.map = map;
+ this.source = source;
+ }
+
+ @Override
+ public String getSource() {
+ return source;
+ }
+
+ @Override
+ public Map<String, String> getResult() {
+ return map;
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/MapResult.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/ResultType.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/ResultType.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/ResultType.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,37 @@
+package fr.ifremer.coser.result;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+/**
+ * Type of result we can get on a result repository.
+ * <p/>
+ * Created on 3/12/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public enum ResultType {
+ MAP,
+ INDICATOR,
+ MAP_AND_INDICATOR
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/ResultType.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/VoidResult.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/VoidResult.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/VoidResult.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,50 @@
+package fr.ifremer.coser.result;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+/**
+ * Created on 3/12/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class VoidResult implements CoserResult {
+
+ private static final long serialVersionUID = 1L;
+
+ protected final String source;
+
+ public VoidResult(String source) {
+ this.source = source;
+ }
+
+ @Override
+ public String getSource() {
+ return source;
+ }
+
+ @Override
+ public Void getResult() {
+ return null;
+ }
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/VoidResult.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Deleted: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/RequestUnavailableForProducerException.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/RequestUnavailableForProducerException.java 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/RequestUnavailableForProducerException.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -1,49 +0,0 @@
-package fr.ifremer.coser.result.repository;
-
-/*
- * #%L
- * Coser :: Business
- * %%
- * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>.
- * #L%
- */
-
-/**
- * When a request ask a unavailable result of a producer.
- * <p/>
- * Created on 3/11/14.
- *
- * @author Tony Chemit <chemit(a)codelutin.com>
- * @since 1.5
- */
-public class RequestUnavailableForProducerException extends RuntimeException {
-
- private static final long serialVersionUID = 1L;
-
- public static RequestUnavailableForProducerException newException(String methodName, ResultProducer<?> producer) {
- return new RequestUnavailableForProducerException(methodName, producer.getRepository().getId());
- }
-
- protected final String methodName;
-
- protected final String repositoryId;
-
- protected RequestUnavailableForProducerException(String methodName, String repositoryId) {
- this.methodName = methodName;
- this.repositoryId = repositoryId;
- }
-}
Deleted: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/ResultProducer.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/ResultProducer.java 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/ResultProducer.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -1,52 +0,0 @@
-package fr.ifremer.coser.result.repository;
-
-/*
- * #%L
- * Coser :: Business
- * %%
- * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.coser.result.CoserRequest;
-import fr.ifremer.coser.result.CoserResult;
-
-import java.util.Map;
-
-/**
- * To execute a result.
- * <p/>
- * Created on 3/11/14.
- *
- * @author Tony Chemit <chemit(a)codelutin.com>
- * @since 1.5
- */
-public interface ResultProducer<R extends CoserRequest> {
-
- ResultRepository getRepository();
-
- boolean acceptResult(R request);
-
- Map<String, String> getAvailableZones(R request);
-
- Map<String, String> getAvailableSpecies(R request);
-
- Map<String, String> getAvailableIndicators(R request);
-
- CoserResult produceResult(R request);
-
-}
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/ResultRepository.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/ResultRepository.java 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/ResultRepository.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -22,11 +22,6 @@
* #L%
*/
-import fr.ifremer.coser.result.CoserRequest;
-import fr.ifremer.coser.result.CoserResult;
-
-import java.util.Map;
-
/**
* General contract of a repository of results in CoserWeb.
* <p/>
@@ -43,43 +38,7 @@
String getId();
/**
- * Get all available zones for the given request.
- *
- * @param request request
- * @return all available zones for the given request
+ * @return the type of result repository
*/
- <R extends CoserRequest> Map<String, String> getAvailableZones(R request);
-
- /**
- * Get all available species (or speciesList) for the given request.
- *
- * @param request request
- * @return all available species for the given request.
- */
- <R extends CoserRequest> Map<String, String> getAvailableSpecies(R request);
-
- /**
- * Get all available indicators for the given request.
- *
- * @param request request
- * @return all available indicators for the given request.
- */
- <R extends CoserRequest> Map<String, String> getAvailableIndicators(R request);
-
- /**
- * @param request request to test
- * @return {@code true} if this repository has some result for the given
- * request, {@code false} otherwise
- */
- <R extends CoserRequest> boolean acceptResult(R request);
-
- /**
- * Get result for the given request.
- * <p/>
- * We assume here that the repository has a result for the given request.
- *
- * @param request request to obtain result
- * @return the result for the given request
- */
- <R extends CoserRequest> CoserResult getResult(R request);
+ ResultRepositoryType getResultRepositoryType();
}
Copied: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/ResultRepositoryCommand.java (from rev 1144, trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/ResultProducer.java)
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/ResultRepositoryCommand.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/ResultRepositoryCommand.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,50 @@
+package fr.ifremer.coser.result.repository;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.coser.result.CoserRequest;
+import fr.ifremer.coser.result.CoserResult;
+
+/**
+ * To execute a command on a result.
+ * <p/>
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public interface ResultRepositoryCommand<Repo extends ResultRepository, Request extends CoserRequest> {
+
+ Class<Request> getRequestType();
+
+ boolean accept(Repo repository, Request request);
+
+ CoserResult execute(Repo repository, Request request);
+
+// Map<String, String> getAvailableZones(Repo repository, Request request);
+//
+// Map<String, String> getAvailableSpecies(Repo repository, Request request);
+//
+// Map<String, String> getAvailableIndicators(Repo repository, Request request);
+
+}
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/ResultRepositoryCommandEngine.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/ResultRepositoryCommandEngine.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/ResultRepositoryCommandEngine.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,56 @@
+package fr.ifremer.coser.result.repository;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.coser.result.CoserRequest;
+import fr.ifremer.coser.result.CoserResult;
+
+/**
+ * To execute commands on a result repository.
+ * <p/>
+ * Created on 3/12/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public interface ResultRepositoryCommandEngine {
+
+ ResultRepository getResultRepository();
+
+ /**
+ * @param request request to test
+ * @return {@code true} if this repository has some result for the given
+ * request, {@code false} otherwise
+ */
+ <R extends CoserRequest> boolean acceptRequest(R request);
+
+ /**
+ * Execute given request.
+ * <p/>
+ * We assume here that the repository has a result for the given request.
+ *
+ * @param request request to execute
+ * @return the result for the given request
+ */
+ <R extends CoserRequest> CoserResult executeRequest(R request);
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/ResultRepositoryCommandEngine.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/ResultRepositoryProvider.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/ResultRepositoryProvider.java 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/ResultRepositoryProvider.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -42,4 +42,6 @@
* @return the set of provided result repositories.
*/
Set<R> loadRepositories(CoserServiceContext serviceContext) throws ResultRepositoryInitializationException;
+
+ ResultRepositoryCommandEngine newEngine(R repository);
}
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/ResultRepositoryType.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/ResultRepositoryType.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/ResultRepositoryType.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,50 @@
+package fr.ifremer.coser.result.repository;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.coser.result.ResultType;
+import fr.ifremer.coser.result.request.GetAllResultsRequest;
+
+import java.io.Serializable;
+import java.util.Set;
+
+/**
+ * To define a new type of result repository.
+ * <p/>
+ * This contract does nothing in special, but is just loaded by
+ * a service loader to know all possible result repositories type.
+ * <p/>
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @see GetAllResultsRequest
+ * @since 1.5
+ */
+public interface ResultRepositoryType extends Serializable {
+
+ String getId();
+
+ String getLabelKey();
+
+ Set<ResultType> getResultTypes();
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/ResultRepositoryType.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Deleted: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/CommunityIndicatorResultProducer.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/CommunityIndicatorResultProducer.java 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/CommunityIndicatorResultProducer.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -1,441 +0,0 @@
-package fr.ifremer.coser.result.repository.echobase;
-
-/*
- * #%L
- * Coser :: Business
- * %%
- * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>.
- * #L%
- */
-
-import com.google.common.base.Preconditions;
-import fr.ifremer.coser.CoserTechnicalException;
-import fr.ifremer.coser.bean.EchoBaseProject;
-import fr.ifremer.coser.bean.ZoneMap;
-import fr.ifremer.coser.result.FileResult;
-import fr.ifremer.coser.result.Reports;
-import fr.ifremer.coser.result.repository.ResultProducer;
-import fr.ifremer.coser.result.request.CommunityIndicatorRequest;
-import fr.ifremer.coser.storage.DataStorage;
-import fr.ifremer.coser.storage.DataStorages;
-import fr.ifremer.coser.storage.MemoryDataStorage;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jfree.chart.ChartUtilities;
-import org.jfree.chart.JFreeChart;
-import org.jfree.chart.axis.CategoryAxis;
-import org.jfree.chart.axis.CategoryLabelPositions;
-import org.jfree.chart.axis.NumberAxis;
-import org.jfree.chart.axis.ValueAxis;
-import org.jfree.chart.plot.CategoryPlot;
-import org.jfree.chart.plot.PlotOrientation;
-import org.jfree.chart.renderer.category.CategoryItemRenderer;
-import org.jfree.chart.renderer.category.StatisticalLineAndShapeRenderer;
-import org.jfree.data.statistics.DefaultStatisticalCategoryDataset;
-import org.nuiton.util.FileUtil;
-import org.nuiton.util.ZipUtil;
-
-import java.awt.Color;
-import java.io.File;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Created on 3/11/14.
- *
- * @author Tony Chemit <chemit(a)codelutin.com>
- * @since 1.5
- */
-public class CommunityIndicatorResultProducer implements ResultProducer<CommunityIndicatorRequest> {
-
- /** Logger. */
- private static final Log log = LogFactory.getLog(CommunityIndicatorResultProducer.class);
-
- protected final EchoBaseResultRepository repository;
-
- protected final Reports reports;
-
- protected final EchoBaseProject project;
-
- public CommunityIndicatorResultProducer(EchoBaseResultRepository repository) {
- this.repository = repository;
- this.project = repository.project;
- this.reports = repository.reports;
- }
-
- @Override
- public EchoBaseResultRepository getRepository() {
- return repository;
- }
-
- @Override
- public boolean acceptResult(CommunityIndicatorRequest request) {
- return repository.matchFacade(request) &&
- repository.matchZone(request) &&
- matchIndicatorAndSpeciesList(request);
- }
-
- @Override
- public Map<String, String> getAvailableZones(CommunityIndicatorRequest request) {
- Preconditions.checkNotNull(request.getFacade());
-
- boolean match = repository.matchFacade(request);
-
- Map<String, String> result = null;
- if (match) {
- ZoneMap zonesMap = repository.getZonesMap();
- List<String> allowedZones = zonesMap.getZonesForFacade(request.getFacade());
- result = zonesMap.getSubZonesMap(project.getZoneName(), allowedZones);
- }
- return result;
- }
-
- @Override
- public Map<String, String> getAvailableSpecies(CommunityIndicatorRequest request) {
- Preconditions.checkNotNull(request.getFacade());
- Preconditions.checkNotNull(request.getZone());
- Preconditions.checkNotNull(request.getIndicator());
-
- boolean match = repository.matchFacade(request) &&
- repository.matchZone(request) &&
- matchIndicator(request);
-
- Map<String, String> result = null;
-
- if (match) {
- // get all speciesList for given facade + zone + indicator
- Set<String> speciesList = repository.getCommunityIndicatorSpecies(request.getIndicator());
- result = repository.getSpeciesMap().getSpeciesSubMap(speciesList);
- }
- return result;
- }
-
- @Override
- public Map<String, String> getAvailableIndicators(CommunityIndicatorRequest request) {
- Preconditions.checkNotNull(request.getFacade());
- Preconditions.checkNotNull(request.getZone());
-
- Map<String, String> result = null;
- boolean match = repository.matchFacade(request) && repository.matchZone(request);
- if (match) {
-
- // get all indicators for given facade + zone
- Set<String> indicatorList = repository.getCommunityIndicators();
- result = repository.getIndicatorsMap().getIndicatorsValues(indicatorList, request.getLocale());
- }
- return result;
- }
-
- @Override
- public FileResult produceResult(CommunityIndicatorRequest r) {
-
- File file = null;
- switch (r.getResultType()) {
- case DATA:
- file = getCommunityIndicatorDataFile(r.getLocale(),
- r.getIndicator(),
- r.getSpecies());
- break;
-
- case GRAPH:
- file = getCommunityIndicatorGraphFile(r.getLocale(),
- r.getZone(),
- r.getIndicator(),
- r.getSpecies());
- break;
- }
- FileResult result = new FileResult(repository.getId(), file);
- return result;
- }
-
-
- protected File getCommunityIndicatorDataFile(Locale locale,
- String indicator,
- String speciesList) {
-
- try {
-
- File tempDir = FileUtil.createTempDirectory("coser-chart-population-indicator", "-tmp");
-
- File baseDir = new File(tempDir, project.getSurveyName());
- FileUtils.forceMkdir(baseDir);
-
- // ajout du fichier csv avec les indicateurs
- DataStorage dataStorage = new MemoryDataStorage();
-
- Iterator<String[]> iterator = repository.loadCommunityIndicatorStorage(false);
-
- // add header
- dataStorage.add(iterator.next());
-
- while (iterator.hasNext()) {
- String[] tuple = iterator.next();
- if (repository.matchCommunityIndicatorAndSpeciesList(tuple, indicator, speciesList)) {
- dataStorage.add(tuple);
- }
- }
- File csvFile = DataStorages.save(dataStorage, "coser-chart-community-indicator",
- ".csv"
- );
-
- File csvFileCopied = new File(baseDir, indicator + ".csv");
- FileUtils.copyFile(csvFile, csvFileCopied);
- FileUtils.forceDelete(csvFile);
-
- //TODO See what to generate here (we don't have any selection in echobase results).
-// // ajout du fichier d'information sur les espèces incluses dans
-// // les calculs des indicateurs de communautés
-// // load project (without data to get reftax data)
-// Project project = path.getProject();
-// Selection selection = path.getSelection();
-// File metaFile = webService.generateMetaFilePDF(project,
-// selection,
-// resultDirectory,
-// rSufiResult,
-// indicator,
-// locale);
-// File metaFileCopied = new File(baseDir, "Information.pdf");
-// FileUtils.copyFile(metaFile, metaFileCopied);
-
- // make zip
- File result = File.createTempFile("coser-chart-community-indicator", ".zip");
- result.deleteOnExit();
- ZipUtil.compress(result, baseDir);
-
- // clean directory
- FileUtils.deleteDirectory(tempDir);
- return result;
- } catch (Exception e) {
- throw new CoserTechnicalException("Can't create zip file", e);
- }
- }
-
- protected File getCommunityIndicatorGraphFile(Locale locale,
- String zone,
- String indicator,
- String speciesList) {
-
- // indicator list to take care
- // pour avoir une valeur non nulle si list est null
- // on prend dans ce cas la premiere valeur trouvée
- String localList = speciesList;
-
- if (log.isDebugEnabled()) {
- log.debug("Searching list for indicator : " + indicator);
- }
-
- int multiplicator = 1;
- int minYear = Integer.MAX_VALUE;
- int maxYear = Integer.MIN_VALUE;
- boolean indicatorFound = false;
- Map<Integer, Double[]> graphData = new HashMap<Integer, Double[]>();
- Iterator<String[]> iterator = repository.loadCommunityIndicatorStorage(true);
- while (iterator.hasNext()) {
- // Campagne Indicateur Liste Strate Annee Estimation EcartType CV
- String[] tuple = iterator.next();
- String indicatorList = tuple[2];
-
- if (repository.matchIndicatorIndicator(tuple, indicator)) {
- indicatorFound = true;
-
- // si pas de list selectionnée, on prend la premiere
- if (StringUtils.isBlank(localList)) {
- localList = indicatorList;
- }
-
- if (indicatorList.equals(localList)) {
- Double estimation = Double.parseDouble(tuple[5]);
- Double ecart = Double.parseDouble(tuple[6]);
- int year = Integer.parseInt(tuple[4]);
-
- if (year < minYear) {
- minYear = year;
- }
- if (year > maxYear) {
- maxYear = year;
- }
- graphData.put(year, new Double[]{estimation, ecart});
-
- // si les données sont énormes, on affiche les données
- // / multiplicator et on le mentionne dans la légende
- if (estimation > 1e9) {
- multiplicator = 1000000;
- }
- if (estimation > 1e6 && multiplicator < 1000000) {
- multiplicator = 1000;
- }
- }
- }
- }
-
- File result = null;
-
- // avec l'extraction des données, on peut demander a générer un graphique
- // sur un indicateur qui n'est pas présent dans le projet courant,
- // dans ce cas, on retourne null
- if (indicatorFound) {
-
- String zoneDisplayName = repository.getZonesMap().getZoneFullName(zone);
- String indicatorName = repository.getIndicatorsMap().getIndicatorValue(indicator, locale);
- String unit = repository.getIndicatorsMap().getIndicatorUnit(indicator);
-
- // get graph title
- String chartTitle = zoneDisplayName;
- chartTitle += " - " + indicatorName;
-
- // ajout de la traduction de la liste d'indicateur
- // les liste sont a1, T1, T2 ...
- String listLetter = String.valueOf(localList.charAt(0));
- Iterator<String[]> typeIterator = repository.getSpeciesMap().iterator(true);
- while (typeIterator.hasNext()) {
- // "Types";"Commentaire";"NumSys min";"NumSys max";"Code"
- String[] tuple = typeIterator.next();
- if (tuple[4].equals(listLetter)) {
- /// gestion du groupe "Tous"
- // cas special, c'est la seule valeur du fichier
- // code type espece qui a besoin d'une traduction
- if (tuple[4].equalsIgnoreCase("T")) {
- if ("fr".equals(locale.getLanguage())) {
- chartTitle += " - " + "Tous Liste " + localList.charAt(1);
- } else if ("es".equals(locale.getLanguage())) {
- chartTitle += " - " + "Todo Lista " + localList.charAt(1);
- } else {
- chartTitle += " - " + "All List " + localList.charAt(1);
- }
- } else {
- // ajout de la traduction du nom de liste plus le numéro
- if ("fr".equals(locale.getLanguage())) {
- chartTitle += " - " + tuple[0] + " Liste " + localList.charAt(1);
- } else if ("es".equals(locale.getLanguage())) {
- chartTitle += " - " + tuple[0] + " Lista " + localList.charAt(1);
- } else {
- chartTitle += " - " + tuple[0] + " List " + localList.charAt(1);
- }
- }
- break;
- }
- }
-
- // generate dataset with sorted data
- DefaultStatisticalCategoryDataset statisticalDataset = new DefaultStatisticalCategoryDataset();
- for (int indexYear = minYear; indexYear <= maxYear; ++indexYear) {
- Double[] entry = graphData.get(indexYear);
- if (entry != null) {
- Double estimation = entry[0] / multiplicator;
- Double ecart = entry[1] / multiplicator;
- statisticalDataset.add(estimation, ecart, "Serie1", (Comparable) indexYear);
- } else {
- statisticalDataset.add(null, null, "Serie1", indexYear);
- }
- }
-
- // configure chart
- //CategoryAxis categoryAxis = new CategoryAxis(t("coser.business.common.year"));
- String yearAxis = reports.getYearChartTitle(locale);
-
- CategoryAxis categoryAxis = new CategoryAxis(yearAxis);
- categoryAxis.setCategoryMargin(0);
- categoryAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
- // label horizontaux
- String legendY = indicatorName;
- if (multiplicator != 1) {
- // affiche par exemple : cm * 1000
- legendY += " (" + unit + "*" + multiplicator + ")";
- } else if (StringUtils.isNotEmpty(unit)) {
- legendY += " (" + unit + ")";
- }
- ValueAxis valueAxis = new NumberAxis(legendY);
- valueAxis.setUpperMargin(0.1);
-
- CategoryItemRenderer renderer = new StatisticalLineAndShapeRenderer(false, true);
-
- // n'affiche pas les nombre sur le graphique
- //StandardCategoryItemLabelGenerator itemLabelGenerator = new StandardCategoryItemLabelGenerator();
- //renderer.setBaseItemLabelGenerator(itemLabelGenerator);
- //renderer.setBaseItemLabelsVisible(true);
-
- CategoryPlot plot = new CategoryPlot(statisticalDataset, categoryAxis, valueAxis, renderer);
- plot.setOrientation(PlotOrientation.VERTICAL);
- JFreeChart chart = new JFreeChart(chartTitle,
- JFreeChart.DEFAULT_TITLE_FONT, plot, true);
-
- // remove series legend
- chart.removeLegend();
- // white background
- chart.setBackgroundPaint(Color.WHITE);
-
- try {
- result = File.createTempFile("coser-chart-community-indicator-", ".png");
- result.deleteOnExit();
- ChartUtilities.saveChartAsPNG(result, chart, 800, 400);
- } catch (IOException ex) {
- throw new CoserTechnicalException("Can't save chart", ex);
- }
- }
-
- return result;
- }
-
- // --------------------------------------------------------------------- //
- // --- Matchers -------------------------------------------------------- //
- // --------------------------------------------------------------------- //
-
- protected boolean matchIndicator(CommunityIndicatorRequest request) {
- Preconditions.checkNotNull(request.getIndicator());
-
- String indicator = request.getIndicator();
-
- boolean result = false;
-
- Iterator<String[]> iterator = repository.loadCommunityIndicatorStorage(true);
- while (iterator.hasNext()) {
- String[] tuple = iterator.next();
- if (repository.matchIndicatorIndicator(tuple, indicator)) {
- result = true;
- break;
- }
- }
- return result;
- }
-
- protected boolean matchIndicatorAndSpeciesList(CommunityIndicatorRequest request) {
- Preconditions.checkNotNull(request.getIndicator());
- Preconditions.checkNotNull(request.getSpecies());
-
- String indicator = request.getIndicator();
- String speciesList = request.getSpecies();
-
- boolean result = false;
-
- Iterator<String[]> iterator = repository.loadCommunityIndicatorStorage(true);
- while (iterator.hasNext()) {
- String[] tuple = iterator.next();
- if (repository.matchCommunityIndicatorAndSpeciesList(tuple, indicator, speciesList)) {
- result = true;
- break;
- }
- }
- return result;
- }
-}
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/EchoBaseResultRepository.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/EchoBaseResultRepository.java 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/EchoBaseResultRepository.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -25,25 +25,16 @@
import com.google.common.base.Function;
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import fr.ifremer.coser.CoserServiceContext;
import fr.ifremer.coser.bean.EchoBaseProject;
import fr.ifremer.coser.bean.IndicatorMap;
import fr.ifremer.coser.bean.SpeciesMap;
import fr.ifremer.coser.bean.ZoneMap;
-import fr.ifremer.coser.result.CoserRequest;
-import fr.ifremer.coser.result.CoserResult;
import fr.ifremer.coser.result.Reports;
-import fr.ifremer.coser.result.repository.ResultProducer;
import fr.ifremer.coser.result.repository.ResultRepository;
-import fr.ifremer.coser.result.request.CommunityIndicatorRequest;
import fr.ifremer.coser.result.request.CoserRequestFacadeAware;
import fr.ifremer.coser.result.request.CoserRequestZoneAware;
-import fr.ifremer.coser.result.request.ExtractRequest;
-import fr.ifremer.coser.result.request.MapRequest;
-import fr.ifremer.coser.result.request.PopulationIndicatorRequest;
-import fr.ifremer.coser.result.request.RawDataRequest;
import fr.ifremer.coser.storage.DataStorage;
import fr.ifremer.coser.storage.DataStorages;
import org.apache.commons.logging.Log;
@@ -53,7 +44,6 @@
import java.io.FilenameFilter;
import java.util.Iterator;
import java.util.List;
-import java.util.Map;
import java.util.Set;
/**
@@ -68,11 +58,6 @@
private static final Log log = LogFactory.getLog(EchoBaseResultRepository.class);
/**
- * Id of result source.
- */
- public static final String ID = "echobase";
-
- /**
* Project definition.
*/
protected final EchoBaseProject project;
@@ -112,12 +97,11 @@
*/
protected final Reports reports;
- protected final Map<String, ResultProducer<?>> resultProducers;
-
- public EchoBaseResultRepository(CoserServiceContext serviceContext, EchoBaseProject project) {
- this.serviceContext = serviceContext;
+ public EchoBaseResultRepository(CoserServiceContext serviceContext,
+ EchoBaseProject project) {
Preconditions.checkNotNull(serviceContext);
Preconditions.checkNotNull(project);
+ this.serviceContext = serviceContext;
this.project = project;
this.mapsDirectory = project.getMapsDirectory();
this.reports = new Reports();
@@ -127,13 +111,6 @@
this.speciesCodeToMapFile = EchoBaseProject.newSpeciesCodeToMapFileName(surveyName);
this.mapSpeciesFilenameFilter = EchoBaseProject.newMapSpeciesFilenameFilter(surveyName);
- this.resultProducers = Maps.newHashMap();
- this.resultProducers.put(MapRequest.class.getName(), new MapResultProducer(this));
- this.resultProducers.put(CommunityIndicatorRequest.class.getName(), new CommunityIndicatorResultProducer(this));
- this.resultProducers.put(PopulationIndicatorRequest.class.getName(), new PopulationIndicatorResultProducer(this));
- this.resultProducers.put(RawDataRequest.class.getName(), new RawDataResultProducer(this));
- this.resultProducers.put(ExtractRequest.class.getName(), new ExtractResultProducer(this));
-
if (log.isInfoEnabled()) {
log.info("New result repository: " + getId());
}
@@ -145,95 +122,77 @@
@Override
public String getId() {
- return ID + "::" + project.getBasedir();
+ return EchoBaseResultRepositoryType.ID + "::" + project.getBasedir();
}
@Override
- public <R extends CoserRequest> Map<String, String> getAvailableZones(R request) {
- Preconditions.checkNotNull(request);
- ResultProducer<R> resultProducer = getProducer(request);
- Preconditions.checkNotNull(resultProducer);
+ public EchoBaseResultRepositoryType getResultRepositoryType() {
+ return EchoBaseResultRepositoryType.INSTANCE;
+ }
- Map<String, String> result = resultProducer.getAvailableZones(request);
- return result;
+ public File getBasedir() {
+ return project.getBasedir();
}
- @Override
- public <R extends CoserRequest> Map<String, String> getAvailableSpecies(R request) {
- Preconditions.checkNotNull(request);
- ResultProducer<R> resultProducer = getProducer(request);
- Preconditions.checkNotNull(resultProducer);
+ public EchoBaseProject getProject() {
+ return project;
+ }
- Map<String, String> result = resultProducer.getAvailableSpecies(request);
- return result;
+ public String getProjectName() {
+ return project.getName();
}
- @Override
- public <R extends CoserRequest> Map<String, String> getAvailableIndicators(R request) {
- Preconditions.checkNotNull(request);
- ResultProducer<R> resultProducer = getProducer(request);
- Preconditions.checkNotNull(resultProducer);
+ public Reports getReports() {
+ return reports;
+ }
- Map<String, String> result = resultProducer.getAvailableIndicators(request);
- return result;
+ public String getSurveyName() {
+ return project.getSurveyName();
}
- @Override
- public <R extends CoserRequest> boolean acceptResult(R request) {
- Preconditions.checkNotNull(request);
- Preconditions.checkArgument(request.isFilled());
+ public String getZone() {
+ return project.getZoneName();
+ }
- ResultProducer<R> resultProducer = getProducer(request);
- Preconditions.checkNotNull(resultProducer);
- boolean result = resultProducer.acceptResult(request);
- return result;
+ public boolean isMapsResult() {
+ return true;
}
- @Override
- public <R extends CoserRequest> CoserResult getResult(R request) {
- Preconditions.checkNotNull(request);
- Preconditions.checkArgument(request.isFilled());
- Preconditions.checkArgument(acceptResult(request));
-
- ResultProducer<R> resultProducer = getProducer(request);
- Preconditions.checkNotNull(resultProducer);
-
- CoserResult result = resultProducer.produceResult(request);
- return result;
+ public boolean isIndicatorsResult() {
+ return true;
}
- protected <R extends CoserRequest> ResultProducer<R> getProducer(R request) {
- String requestTypeName = request.getClass().getName();
- return (ResultProducer<R>) resultProducers.get(requestTypeName);
+ public boolean isPubliableResult() {
+ return project.isPubliableResult();
}
// --------------------------------------------------------------------- //
// --- Matchers -------------------------------------------------------- //
// --------------------------------------------------------------------- //
- protected boolean matchFacade(CoserRequestFacadeAware request) {
+ public boolean matchFacade(CoserRequestFacadeAware request) {
return project.getFacadeName().equals(request.getFacade());
}
- protected boolean matchZone(CoserRequestZoneAware request) {
+ public boolean matchZone(CoserRequestZoneAware request) {
return project.getZoneName().equals(request.getZone());
}
- protected boolean matchIndicatorSpecies(String[] tuple, String species) {
+ public boolean matchIndicatorSpecies(String[] tuple, String species) {
String speciesCode = tuple[3];
boolean result = species.equals(speciesCode);
return result;
}
- protected boolean matchIndicatorIndicator(String[] tuple, String indicator) {
+ public boolean matchIndicatorIndicator(String[] tuple, String indicator) {
String indicatorCode = tuple[1];
boolean result = indicator.equals(indicatorCode);
return result;
}
- protected boolean matchIndicatorSpeciesAndIndicator(String[] tuple,
- String species,
- String indicator) {
+ public boolean matchIndicatorSpeciesAndIndicator(String[] tuple,
+ String species,
+ String indicator) {
String speciesCode = tuple[3];
String indicatorCode = tuple[1];
boolean result = species.equals(speciesCode) &&
@@ -241,9 +200,9 @@
return result;
}
- protected boolean matchCommunityIndicatorAndSpeciesList(String[] tuple,
- String indicator,
- String speciesList) {
+ public boolean matchCommunityIndicatorAndSpeciesList(String[] tuple,
+ String indicator,
+ String speciesList) {
String indicatorCode = tuple[1];
String speciesListCode = tuple[2];
boolean result = indicator.equals(indicatorCode) &&
@@ -251,15 +210,15 @@
return result;
}
- protected boolean matchIndicatorList(String[] tuple, List<String> indicatorList) {
+ public boolean matchIndicatorList(String[] tuple, List<String> indicatorList) {
String indicatorCode = tuple[1];
boolean result = indicatorList.contains(indicatorCode);
return result;
}
- protected boolean matchIndicatorListAndSpeciesList(String[] tuple,
- List<String> indicatorList,
- List<String> speciesList) {
+ public boolean matchIndicatorListAndSpeciesList(String[] tuple,
+ List<String> indicatorList,
+ List<String> speciesList) {
String indicatorCode = tuple[1];
String speciesCode = tuple[3];
boolean result = indicatorList.contains(indicatorCode) &&
@@ -271,7 +230,7 @@
// --- Get Map result -------------------------------------------------- //
// --------------------------------------------------------------------- //
- protected File getMapSpeciesFile(String species) {
+ public File getMapSpeciesFile(String species) {
String fileName = speciesCodeToMapFile.apply(species);
File file = fileName == null ? null : new File(mapsDirectory, fileName);
return file;
@@ -281,7 +240,7 @@
// --- Get species lists ----------------------------------------------- //
// --------------------------------------------------------------------- //
- protected Set<String> getMapSpecies() {
+ public Set<String> getMapSpecies() {
Set<String> result = Sets.newHashSet();
File[] files = project.getMapsDirectory().listFiles(mapSpeciesFilenameFilter);
if (files != null) {
@@ -291,7 +250,7 @@
return result;
}
- protected Set<String> getPopulationIndicatorSpecies() {
+ public Set<String> getPopulationIndicatorSpecies() {
Set<String> result = Sets.newHashSet();
Iterator<String[]> iterator = loadPopulationIndicatorStorage(true);
while (iterator.hasNext()) {
@@ -302,7 +261,7 @@
return result;
}
- protected Set<String> getCommunityIndicatorSpecies() {
+ public Set<String> getCommunityIndicatorSpecies() {
Iterator<String[]> iterator = loadCommunityIndicatorStorage(true);
Set<String> result = Sets.newHashSet();
while (iterator.hasNext()) {
@@ -313,7 +272,7 @@
return result;
}
- protected Set<String> getCommunityIndicatorSpecies(String indicator) {
+ public Set<String> getCommunityIndicatorSpecies(String indicator) {
Iterator<String[]> iterator = loadCommunityIndicatorStorage(true);
Set<String> result = Sets.newHashSet();
while (iterator.hasNext()) {
@@ -330,7 +289,7 @@
// --- Get indicator lists --------------------------------------------- //
// --------------------------------------------------------------------- //
- protected Set<String> getCommunityIndicators() {
+ public Set<String> getCommunityIndicators() {
Iterator<String[]> iterator = loadCommunityIndicatorStorage(true);
Set<String> result = Sets.newHashSet();
while (iterator.hasNext()) {
@@ -341,7 +300,7 @@
return result;
}
- protected Set<String> getPopulationIndicators() {
+ public Set<String> getPopulationIndicators() {
Iterator<String[]> iterator = loadPopulationIndicatorStorage(true);
Set<String> result = Sets.newHashSet();
while (iterator.hasNext()) {
@@ -369,7 +328,7 @@
// --- Get definition maps --------------------------------------------- //
// --------------------------------------------------------------------- //
- protected SpeciesMap getSpeciesMap() {
+ public SpeciesMap getSpeciesMap() {
if (speciesMap == null) {
File file = project.getSpeciesDefinitionFile();
speciesMap = new SpeciesMap(file);
@@ -377,7 +336,7 @@
return speciesMap;
}
- protected IndicatorMap getIndicatorsMap() {
+ public IndicatorMap getIndicatorsMap() {
return serviceContext.getIndicatorsMap();
}
@@ -389,7 +348,7 @@
// --- storage util methods -------------------------------------------- //
// --------------------------------------------------------------------- //
- protected Iterator<String[]> loadPopulationIndicatorStorage(boolean skipFirstLine) {
+ public Iterator<String[]> loadPopulationIndicatorStorage(boolean skipFirstLine) {
File file = project.getPopulationIndicatorsFile();
// Campagne Indicateur Liste Espece Strate Annee Estimation EcartType CV
DataStorage dataStorage = DataStorages.load(file);
@@ -397,7 +356,7 @@
return iterator;
}
- protected Iterator<String[]> loadCommunityIndicatorStorage(boolean skipFirstLine) {
+ public Iterator<String[]> loadCommunityIndicatorStorage(boolean skipFirstLine) {
File file = project.getCommunityIndicatorsFile();
// Campagne Indicateur Liste Espece Strate Annee Estimation EcartType CV
DataStorage dataStorage = DataStorages.load(file);
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/EchoBaseResultRepositoryCommandEngine.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/EchoBaseResultRepositoryCommandEngine.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/EchoBaseResultRepositoryCommandEngine.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,135 @@
+package fr.ifremer.coser.result.repository.echobase;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Maps;
+import fr.ifremer.coser.result.CoserRequest;
+import fr.ifremer.coser.result.CoserResult;
+import fr.ifremer.coser.result.repository.ResultRepositoryCommand;
+import fr.ifremer.coser.result.repository.ResultRepositoryCommandEngine;
+import fr.ifremer.coser.result.repository.echobase.command.DeleteResultsCommand;
+import fr.ifremer.coser.result.repository.echobase.command.ExtractRawDataAndResultsCommand;
+import fr.ifremer.coser.result.repository.echobase.command.ExtractRawDataCommand;
+import fr.ifremer.coser.result.repository.echobase.command.GetAllResultsCommand;
+import fr.ifremer.coser.result.repository.echobase.command.GetCommunityIndicatorResultCommand;
+import fr.ifremer.coser.result.repository.echobase.command.GetIndicatorsForCommunityIndicatorResultCommand;
+import fr.ifremer.coser.result.repository.echobase.command.GetIndicatorsForExtractRawDataAndResultsCommand;
+import fr.ifremer.coser.result.repository.echobase.command.GetIndicatorsForPopulationIndicatorResultCommand;
+import fr.ifremer.coser.result.repository.echobase.command.GetMapResultCommand;
+import fr.ifremer.coser.result.repository.echobase.command.GetPopulationIndicatorResultCommand;
+import fr.ifremer.coser.result.repository.echobase.command.GetSpeciesListForExtractRawDataAndResultsCommand;
+import fr.ifremer.coser.result.repository.echobase.command.GetSpeciesForMapResultCommand;
+import fr.ifremer.coser.result.repository.echobase.command.GetSpeciesForPopulationIndicatorResultCommand;
+import fr.ifremer.coser.result.repository.echobase.command.GetSpeciesListForCommunityIndicatorResultCommand;
+import fr.ifremer.coser.result.repository.echobase.command.GetZonesForCommunityIndicatorResultCommand;
+import fr.ifremer.coser.result.repository.echobase.command.GetZonesForExtractRawDataAndResultsCommand;
+import fr.ifremer.coser.result.repository.echobase.command.GetZonesForExtractRawDataCommand;
+import fr.ifremer.coser.result.repository.echobase.command.GetZonesForMapResultCommand;
+import fr.ifremer.coser.result.repository.echobase.command.GetZonesForPopulationIndicatorResultCommand;
+
+import java.util.Map;
+
+/**
+ * Created on 3/12/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class EchoBaseResultRepositoryCommandEngine implements ResultRepositoryCommandEngine {
+
+ protected final EchoBaseResultRepository resultRepository;
+
+ protected final Map<String, ResultRepositoryCommand<EchoBaseResultRepository, ?>> commands;
+
+ public EchoBaseResultRepositoryCommandEngine(EchoBaseResultRepository resultRepository) {
+ this.resultRepository = resultRepository;
+ this.commands = Maps.newHashMap();
+
+ // get map result
+ loadCommand(new GetZonesForMapResultCommand());
+ loadCommand(new GetSpeciesForMapResultCommand());
+ loadCommand(new GetMapResultCommand());
+
+ // get community indicator result
+ loadCommand(new GetZonesForCommunityIndicatorResultCommand());
+ loadCommand(new GetIndicatorsForCommunityIndicatorResultCommand());
+ loadCommand(new GetSpeciesListForCommunityIndicatorResultCommand());
+ loadCommand(new GetCommunityIndicatorResultCommand());
+
+ // get population indicator result
+ loadCommand(new GetZonesForPopulationIndicatorResultCommand());
+ loadCommand(new GetSpeciesForPopulationIndicatorResultCommand());
+ loadCommand(new GetIndicatorsForPopulationIndicatorResultCommand());
+ loadCommand(new GetPopulationIndicatorResultCommand());
+
+ // get all results
+ loadCommand(new GetAllResultsCommand());
+
+ // extract raw data
+ loadCommand(new GetZonesForExtractRawDataCommand());
+ loadCommand(new ExtractRawDataCommand());
+
+ // extract raw data and results
+ loadCommand(new GetZonesForExtractRawDataAndResultsCommand());
+ loadCommand(new GetSpeciesListForExtractRawDataAndResultsCommand());
+ loadCommand(new GetIndicatorsForExtractRawDataAndResultsCommand());
+ loadCommand(new ExtractRawDataAndResultsCommand());
+
+ // delete results
+ loadCommand(new DeleteResultsCommand());
+ }
+
+ @Override
+ public EchoBaseResultRepository getResultRepository() {
+ return resultRepository;
+ }
+
+ @Override
+ public <R extends CoserRequest> boolean acceptRequest(R request) {
+
+ ResultRepositoryCommand<EchoBaseResultRepository, R> command = getCommand(request);
+ boolean result = command.accept(resultRepository, request);
+ return result;
+ }
+
+ @Override
+ public <R extends CoserRequest> CoserResult executeRequest(R request) {
+ ResultRepositoryCommand<EchoBaseResultRepository, R> command = getCommand(request);
+ CoserResult result = command.execute(resultRepository, request);
+ return result;
+ }
+
+ protected <R extends CoserRequest> ResultRepositoryCommand<EchoBaseResultRepository, R> getCommand(R request) {
+ Preconditions.checkNotNull(request);
+ String requestTypeName = request.getClass().getName();
+ ResultRepositoryCommand<EchoBaseResultRepository, ?> resultRepositoryCommand = commands.get(requestTypeName);
+ Preconditions.checkNotNull(resultRepositoryCommand);
+ return (ResultRepositoryCommand<EchoBaseResultRepository, R>) resultRepositoryCommand;
+ }
+
+ protected void loadCommand(ResultRepositoryCommand<EchoBaseResultRepository, ?> command) {
+ String name = command.getRequestType().getName();
+ this.commands.put(name, command);
+ }
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/EchoBaseResultRepositoryCommandEngine.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/EchoBaseResultRepositoryProvider.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/EchoBaseResultRepositoryProvider.java 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/EchoBaseResultRepositoryProvider.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -27,6 +27,7 @@
import fr.ifremer.coser.CoserServiceContext;
import fr.ifremer.coser.bean.EchoBaseProject;
import fr.ifremer.coser.result.ResultRepositoryInitializationException;
+import fr.ifremer.coser.result.repository.ResultRepositoryCommandEngine;
import fr.ifremer.coser.result.repository.ResultRepositoryProvider;
import org.apache.commons.io.filefilter.AbstractFileFilter;
import org.apache.commons.io.filefilter.AndFileFilter;
@@ -100,4 +101,9 @@
}
return result;
}
+
+ @Override
+ public ResultRepositoryCommandEngine newEngine(EchoBaseResultRepository repository) {
+ return new EchoBaseResultRepositoryCommandEngine(repository);
+ }
}
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/EchoBaseResultRepositoryType.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/EchoBaseResultRepositoryType.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/EchoBaseResultRepositoryType.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,65 @@
+package fr.ifremer.coser.result.repository.echobase;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.collect.Sets;
+import fr.ifremer.coser.result.ResultType;
+import fr.ifremer.coser.result.repository.ResultRepositoryType;
+
+import java.util.Set;
+
+import static org.nuiton.i18n.I18n.n;
+
+/**
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class EchoBaseResultRepositoryType implements ResultRepositoryType {
+
+ /**
+ * Id of result source.
+ */
+ public static final String ID = "echobase";
+
+ protected static final EchoBaseResultRepositoryType INSTANCE = new EchoBaseResultRepositoryType();
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public String getId() {
+ return ID;
+ }
+
+ @Override
+ public String getLabelKey() {
+ return n("coser.business.result.repository.type.echobase");
+ }
+
+ @Override
+ public Set<ResultType> getResultTypes() {
+ return Sets.immutableEnumSet(ResultType.MAP_AND_INDICATOR);
+ }
+
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/EchoBaseResultRepositoryType.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Deleted: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/ExtractResultProducer.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/ExtractResultProducer.java 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/ExtractResultProducer.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -1,780 +0,0 @@
-package fr.ifremer.coser.result.repository.echobase;
-
-/*
- * #%L
- * Coser :: Business
- * %%
- * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>.
- * #L%
- */
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
-import fr.ifremer.coser.CoserTechnicalException;
-import fr.ifremer.coser.bean.EchoBaseProject;
-import fr.ifremer.coser.bean.IndicatorMap;
-import fr.ifremer.coser.bean.SpeciesMap;
-import fr.ifremer.coser.bean.ZoneMap;
-import fr.ifremer.coser.result.FileResult;
-import fr.ifremer.coser.result.Reports;
-import fr.ifremer.coser.result.repository.ResultProducer;
-import fr.ifremer.coser.result.request.ExtractRequest;
-import fr.ifremer.coser.storage.DataStorage;
-import fr.ifremer.coser.storage.DataStorages;
-import fr.ifremer.coser.storage.MemoryDataStorage;
-import fr.ifremer.coser.util.DataType;
-import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.collections4.MapUtils;
-import org.apache.commons.collections4.keyvalue.MultiKey;
-import org.apache.commons.collections4.map.MultiKeyMap;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.lang3.tuple.Pair;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jfree.chart.ChartUtilities;
-import org.jfree.chart.JFreeChart;
-import org.jfree.chart.axis.CategoryAxis;
-import org.jfree.chart.axis.CategoryLabelPositions;
-import org.jfree.chart.axis.NumberAxis;
-import org.jfree.chart.axis.ValueAxis;
-import org.jfree.chart.plot.CategoryPlot;
-import org.jfree.chart.plot.PlotOrientation;
-import org.jfree.chart.renderer.category.CategoryItemRenderer;
-import org.jfree.chart.renderer.category.StatisticalLineAndShapeRenderer;
-import org.jfree.data.statistics.DefaultStatisticalCategoryDataset;
-import org.nuiton.util.FileUtil;
-import org.nuiton.util.ZipUtil;
-
-import java.awt.Color;
-import java.io.File;
-import java.io.IOException;
-import java.io.StringWriter;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Created on 3/11/14.
- *
- * @author Tony Chemit <chemit(a)codelutin.com>
- * @since 1.5
- */
-public class ExtractResultProducer implements ResultProducer<ExtractRequest> {
-
- /** Logger. */
- private static final Log log = LogFactory.getLog(ExtractResultProducer.class);
-
- protected final EchoBaseResultRepository repository;
-
- protected final Reports reports;
-
- protected final EchoBaseProject project;
-
- public ExtractResultProducer(EchoBaseResultRepository repository) {
- this.repository = repository;
- this.project = repository.project;
- this.reports = repository.reports;
- }
-
- @Override
- public EchoBaseResultRepository getRepository() {
- return repository;
- }
-
- @Override
- public boolean acceptResult(ExtractRequest request) {
- return matchExtractTypeSet(request) &&
- matchZoneList(request) &&
- (matchPopulationIndicatorListAndSpeciesList(request) ||
- matchCommunityIndicatorListAndSpeciesList(request));
- }
-
- @Override
- public Map<String, String> getAvailableZones(ExtractRequest request) {
-
- ZoneMap zonesMap = repository.getZonesMap();
- List<String> allowedZones = zonesMap.getZonesForFacade(null);
- Map<String, String> result = zonesMap.getSubZonesMap(project.getZoneName(), allowedZones);
- return result;
- }
-
- @Override
- public Map<String, String> getAvailableSpecies(ExtractRequest request) {
- Preconditions.checkNotNull(request.getZoneList());
-
- boolean match = matchZoneList(request);
-
- Map<String, String> result = null;
- if (match) {
- Set<String> speciesList = Sets.newHashSet();
-
- // get all species for population indicators
- speciesList.addAll(repository.getPopulationIndicatorSpecies());
- // get all species for community indicators
- speciesList.addAll(repository.getCommunityIndicatorSpecies());
- result = repository.getSpeciesMap().getSpeciesSubMap(speciesList);
- }
- return result;
- }
-
- @Override
- public Map<String, String> getAvailableIndicators(ExtractRequest request) {
- Preconditions.checkNotNull(request.getZoneList());
- Preconditions.checkNotNull(request.getExtractTypeList());
-
- Map<String, String> result = null;
-
- boolean match = matchZoneList(request);
- if (match) {
-
- Set<String> indicatorList = null;
-
- if (request.getExtractTypeList().contains(DataType.COMMUNITY)) {
-
- // get all community indicators for given zone
- indicatorList = repository.getCommunityIndicators();
- } else if (request.getExtractTypeList().contains(DataType.POPULATION)) {
-
- // get all population indicators for given zone
- indicatorList = repository.getPopulationIndicators();
- }
-
- if (indicatorList != null) {
- result = repository.getIndicatorsMap().getIndicatorsValues(indicatorList, request.getLocale());
- }
- }
- return result;
- }
-
- @Override
- public FileResult produceResult(ExtractRequest r) {
-
- Locale locale = r.getLocale();
- List<String> zoneList = r.getZoneList();
- List<DataType> extractTypeList = r.getExtractTypeList();
- List<String> speciesList = r.getSpeciesList();
- List<String> communityIndicatorList = r.getCommunityIndicatorList();
- List<String> populationIndicatorList = r.getPopulationIndicatorList();
-
- File resultZip = null;
- File tempDir = null;
- try {
- tempDir = FileUtil.createTempDirectory("coser-extract-", "-tmp");
-
- File subDir = new File(tempDir, "Indicateurs_Ifremer");
- FileUtils.forceMkdir(subDir);
-
- // les sources se retrouve dans le zip a cote du pdf
- if (extractTypeList.contains(DataType.SOURCE)) {
- if (log.isDebugEnabled()) {
- log.debug("Extracting sources");
- }
- File srcDir = new File(subDir, "sources");
- extractSource(srcDir);
- }
-
- // les cartes doivent se retrouver dans le pdf
- MultiKeyMap pdfMaps = null;
- if (extractTypeList.contains(DataType.MAP)) {
- if (log.isDebugEnabled()) {
- log.debug("Extracting maps");
- }
- String zone = project.getZoneName();
- SpeciesMap speciesMap = repository.getSpeciesMap();
- for (String species : speciesList) {
- File mapFile = repository.getMapSpeciesFile(species);
- pdfMaps.put(zone, speciesMap.getSpeciesName(species), mapFile);
- }
- }
-
- // les graphiques sont également dans le pdf
- MultiKeyMap pdfCharts = null;
- if (CollectionUtils.isNotEmpty(communityIndicatorList) ||
- CollectionUtils.isNotEmpty(populationIndicatorList)) {
- if (log.isDebugEnabled()) {
- log.debug("Extracting charts");
- }
- pdfCharts = extractCharts(speciesList,
- communityIndicatorList,
- populationIndicatorList,
- locale);
- }
-
- // generate pdf if necessary
- if (MapUtils.isNotEmpty(pdfMaps) || MapUtils.isNotEmpty(pdfCharts)) {
- if (log.isDebugEnabled()) {
- log.debug("Generated Extract PDF");
- }
- reports.generateExtractPDF(subDir,
- zoneList,
- pdfMaps,
- pdfCharts,
- repository.getZonesMap(),
- locale);
- }
-
- // fichier de décharge en pdf
- if (log.isDebugEnabled()) {
- log.debug("Generated decharge PDF");
- }
- String filename = reports.getDechargeFilename(locale);
- File dechargePDF = new File(subDir, filename);
- reports.generateDechargePDF(dechargePDF, locale, null, null);
-
- // make zip
- if (log.isDebugEnabled()) {
- log.debug("Make final archive");
- }
- resultZip = File.createTempFile("coser-extract-", ".zip");
- resultZip.deleteOnExit();
- ZipUtil.compress(resultZip, subDir);
-
- // clean directory
- FileUtils.deleteDirectory(tempDir);
- } catch (IOException ex) {
- throw new CoserTechnicalException("Can't create zip file", ex);
- } finally {
- // clean directory
- FileUtils.deleteQuietly(tempDir);
- }
-
- FileResult result = new FileResult(repository.getId(), resultZip);
- return result;
- }
-
- /**
- * Generate raw data after selection in a sub directory (named of the zone) of the given directory.
- *
- * @param directory where to generate file
- */
- protected void extractSource(File directory) {
-
- //TODO
- }
-
- /**
- * Retourne les indicateurs calculés avec leurs traductions scientifique
- * pour la zone et l'especes souhaitées.
- *
- * @param species especes (if {@code null} look for com indicators
- * @param comIndicators comIndicator
- * @param popIndicators popIndicators
- * @param locale locale
- * @return la liste des indicateurs (zone, speciesname, [graphfile, graphdata])
- */
- protected MultiKeyMap extractCharts(Collection<String> species,
- Collection<String> comIndicators,
- Collection<String> popIndicators,
- Locale locale) {
-
- MultiKeyMap chartFileAndDatas = new MultiKeyMap();
-
- String zone = project.getZoneName();
- String zoneDisplayName = repository.getZonesMap().getZoneFullName(zone);
-
- if (CollectionUtils.isNotEmpty(comIndicators)) {
- Map<String, Pair<File, String>> chartFileAndDataCom = getRsufiResultComCharts(comIndicators,
- zoneDisplayName,
- repository.getIndicatorsMap(),
- locale,
- 650,
- 430);
- // put in multimap as zone,speciesname, data
- for (Map.Entry<String, Pair<File, String>> entry : chartFileAndDataCom.entrySet()) {
- chartFileAndDatas.put(zone, entry.getKey(), entry.getValue());
- }
- }
-
- if (CollectionUtils.isNotEmpty(popIndicators)) {
- Map<String, Pair<File, String>> chartFileAndDataPop = getRsufiResultPopCharts(species,
- popIndicators,
- zoneDisplayName,
- repository.getIndicatorsMap(),
- locale,
- 650,
- 430);
- // put in multimap as zone,speciesname, data
- for (Map.Entry<String, Pair<File, String>> entry : chartFileAndDataPop.entrySet()) {
- chartFileAndDatas.put(zone, entry.getKey(), entry.getValue());
- }
- }
-
- return chartFileAndDatas;
- }
-
- /**
- * Generate community graph for selected indicators.
- * Used by web ui extraction.
- *
- * @param indicators indicators to extract
- * @param zoneDisplayName zone full name
- * @param indicatorMap indicator localized map
- * @param locale locale
- * @param width graph width
- * @param height graph height
- * @return maps of generated graph image (temp file) and data indexed by natural key (indicator - species)
- */
- public Map<String, Pair<File, String>> getRsufiResultComCharts(Collection<String> indicators,
- String zoneDisplayName,
- IndicatorMap indicatorMap,
- Locale locale,
- int width, int height) {
-
- Map<String, Pair<File, String>> result = Maps.newHashMap();
-
- int multiplicator = 1;
- int minYear = Integer.MAX_VALUE;
- int maxYear = Integer.MIN_VALUE;
-
- Map<String, Map<Integer, Double[]>> indicatorGraphData = new HashMap<String, Map<Integer, Double[]>>();
- Map<String, String> indicatorLists = new HashMap<String, String>();
- Map<String, DataStorage> indicatorStorages = new HashMap<String, DataStorage>();
-
- // Campagne Indicateur Liste Strate Annee Estimation EcartType CV
- Iterator<String[]> estComIndIterator = repository.loadCommunityIndicatorStorage(true);
- while (estComIndIterator.hasNext()) {
- // Campagne Indicateur Liste Strate Annee Estimation EcartType CV
- String[] tuple = estComIndIterator.next();
- String indicatorCode = tuple[1];
- String indicatorList = tuple[2];
-
- if (indicators.contains(indicatorCode)) {
-
- // si pas de list selectionnée, on prend la premiere
- String localList = indicatorLists.get(indicatorCode);
- if (StringUtils.isBlank(localList)) {
- localList = indicatorList;
- indicatorLists.put(indicatorCode, localList);
- }
-
- if (indicatorList.equals(localList)) {
- Double estimation = Double.parseDouble(tuple[5]);
- Double ecart = Double.parseDouble(tuple[6]);
- int year = Integer.parseInt(tuple[4]);
-
- if (year < minYear) {
- minYear = year;
- }
- if (year > maxYear) {
- maxYear = year;
- }
- Map<Integer, Double[]> graphData = indicatorGraphData.get(indicatorCode);
- if (graphData == null) {
- graphData = new HashMap<Integer, Double[]>();
- indicatorGraphData.put(indicatorCode, graphData);
- }
- graphData.put(year, new Double[]{estimation, ecart});
-
- // si les données sont énormes, on affiche les données
- // / multiplicator et on le mentionne dans la légende
- if (estimation > 1e9) {
- multiplicator = 1000000;
- }
- if (estimation > 1e6 && multiplicator < 1000000) {
- multiplicator = 1000;
- }
-
- // for data part
- DataStorage subDataStorage = indicatorStorages.get(indicatorCode);
- if (subDataStorage == null) {
- subDataStorage = new MemoryDataStorage();
- if ("fr".equals(locale.getLanguage())) {
- subDataStorage.add(new String[]{"Campagne", "Indice", "Liste", "Strate", "Année", "Estimation", "EcartType", "CV"});
- } else {
- subDataStorage.add(new String[]{"Survey", "Index", "List", "Stratum", "Year", "Estimate", "StandardDeviation", "CV"});
- }
- indicatorStorages.put(indicatorCode, subDataStorage);
- }
- subDataStorage.add(tuple);
- }
- }
- }
-
- // avec l'extraction des données, on peut demander a générer un graphique
- // sur un indicateur qui n'est pas présent dans le projet courant,
- // dans ce cas, on retourne null
- for (String indicator : indicatorGraphData.keySet()) {
- // get graph title
- String chartTitle = zoneDisplayName;
- String indicatorName = indicatorMap.getIndicatorValue(indicator, locale);
- String unit = indicatorMap.getIndicatorUnit(indicator);
- chartTitle += " - " + indicatorName;
-
- // ajout de la traduction de la liste d'indicateur
- // les liste sont a1, T1, T2 ...
- String localList = indicatorLists.get(indicator);
- String listLetter = String.valueOf(localList.charAt(0));
- Iterator<String[]> typeIterator = repository.getSpeciesMap().iterator(true);
- while (typeIterator.hasNext()) {
- // "Types";"Commentaire";"NumSys min";"NumSys max";"Code"
- String[] tuple = typeIterator.next();
- if (tuple[4].equals(listLetter)) {
- /// gestion du groupe "Tous"
- // cas special, c'est la seule valeur du fichier
- // code type espece qui a besoin d'une traduction
- if (tuple[4].equalsIgnoreCase("T")) {
- if ("fr".equals(locale.getLanguage())) {
- chartTitle += " - " + "Tous Liste " + localList.charAt(1);
- } else if ("es".equals(locale.getLanguage())) {
- chartTitle += " - " + "Todo Lista " + localList.charAt(1);
- } else {
- chartTitle += " - " + "All List " + localList.charAt(1);
- }
- } else {
- // ajout de la traduction du nom de liste plus le numéro
- if ("fr".equals(locale.getLanguage())) {
- chartTitle += " - " + tuple[0] + " Liste " + localList.charAt(1);
- } else if ("es".equals(locale.getLanguage())) {
- chartTitle += " - " + tuple[0] + " Lista " + localList.charAt(1);
- } else {
- chartTitle += " - " + tuple[0] + " List " + localList.charAt(1);
- }
- }
- break;
- }
- }
-
- // generate dataset with sorted data
- Map<Integer, Double[]> graphData = indicatorGraphData.get(indicator);
- DefaultStatisticalCategoryDataset statisticalDataset = new DefaultStatisticalCategoryDataset();
- for (int indexYear = minYear; indexYear <= maxYear; ++indexYear) {
- Double[] entry = graphData.get(indexYear);
- if (entry != null) {
- Double estimation = entry[0] / multiplicator;
- Double ecart = entry[1] / multiplicator;
- statisticalDataset.add(estimation, ecart, "Serie1", (Comparable) indexYear);
- } else {
- statisticalDataset.add(null, null, "Serie1", indexYear);
- }
- }
-
- // configure chart
- //CategoryAxis categoryAxis = new CategoryAxis(t("coser.business.common.year"));
- String yearAxis = reports.getYearChartTitle(locale);
- CategoryAxis categoryAxis = new CategoryAxis(yearAxis);
- categoryAxis.setCategoryMargin(0);
- categoryAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
- // label horizontaux
- String legendY = indicatorName;
- if (multiplicator != 1) {
- // affiche par exemple : cm * 1000
- legendY += " (" + unit + "*" + multiplicator + ")";
- } else if (StringUtils.isNotEmpty(unit)) {
- legendY += " (" + unit + ")";
- }
- ValueAxis valueAxis = new NumberAxis(legendY);
- valueAxis.setUpperMargin(0.1);
-
- CategoryItemRenderer renderer = new StatisticalLineAndShapeRenderer(false, true);
-
- // n'affiche pas les nombre sur le graphique
- //StandardCategoryItemLabelGenerator itemLabelGenerator = new StandardCategoryItemLabelGenerator();
- //renderer.setBaseItemLabelGenerator(itemLabelGenerator);
- //renderer.setBaseItemLabelsVisible(true);
-
- CategoryPlot plot = new CategoryPlot(statisticalDataset, categoryAxis, valueAxis, renderer);
- plot.setOrientation(PlotOrientation.VERTICAL);
- JFreeChart chart = new JFreeChart(chartTitle,
- JFreeChart.DEFAULT_TITLE_FONT, plot, true);
-
- // remove series legend
- chart.removeLegend();
- // white background
- chart.setBackgroundPaint(Color.WHITE);
-
- try {
- File chartFile = File.createTempFile("coser-community-chart-", ".png");
- chartFile.deleteOnExit();
- ChartUtilities.saveChartAsPNG(chartFile, chart, width, height);
- //ByteArrayOutputStream out = new ByteArrayOutputStream();
- //ChartUtilities.writeChartAsPNG(out, chart, width, height);
-
- // data extraction
- DataStorage subDataStorage = indicatorStorages.get(indicator);
- StringWriter writer = new StringWriter();
- DataStorages.save(subDataStorage, writer);
-
- // add chart file dans chart data in result
- result.put(indicator, Pair.of(chartFile, writer.toString()));
- writer.close();
- } catch (IOException ex) {
- throw new CoserTechnicalException("Can't save chart", ex);
- }
- }
-
- return result;
- }
-
- /**
- * Generate population graph for selected species and indicator.
- *
- * @param species species to extract
- * @param indicators indicators to extract
- * @param zoneDisplayName zone full name
- * @param indicatorMap indicator localized map
- * @param locale locale
- * @param width graph width
- * @param height graph height
- * @return maps of generated graph image (temp file) and data indexed by natural key (indicator - species)
- */
- public Map<String, Pair<File, String>> getRsufiResultPopCharts(Collection<String> species,
- Collection<String> indicators,
- String zoneDisplayName,
- IndicatorMap indicatorMap,
- Locale locale,
- int width,
- int height) {
-
- Map<String, Pair<File, String>> result = Maps.newHashMap();
-
- int multiplicator = 1;
- int minYear = Integer.MAX_VALUE;
- int maxYear = Integer.MIN_VALUE;
-
- MultiKeyMap indicatorGraphData = new MultiKeyMap();
- MultiKeyMap indicatorStorages = new MultiKeyMap();
-
- // Campagne Indicateur Liste Species Strate Annee Estimation EcartType CV
- Iterator<String[]> estPopIndIterator = repository.loadPopulationIndicatorStorage(true);
- while (estPopIndIterator.hasNext()) {
- String[] tuple = estPopIndIterator.next();
-
- String speciesCode = tuple[3];
- String indicatorCode = tuple[1];
- if (species.contains(speciesCode) && indicators.contains(indicatorCode)) {
-
- // XXX echatellier, maybe take care of list here ?
-
- Double estimation = Double.parseDouble(tuple[6]);
- Double ecart = Double.parseDouble(tuple[7]);
- int year = Integer.parseInt(tuple[5]);
-
- if (year < minYear) {
- minYear = year;
- }
- if (year > maxYear) {
- maxYear = year;
- }
- Map<Integer, Double[]> graphData = (Map<Integer, Double[]>) indicatorGraphData.get(indicatorCode, speciesCode);
- if (graphData == null) {
- graphData = new HashMap<Integer, Double[]>();
- indicatorGraphData.put(indicatorCode, speciesCode, graphData);
- }
- graphData.put(year, new Double[]{estimation, ecart});
-
- // si les données sont énormes, on affiche les données
- // / multiplicator et on le mentionne dans la légende
- if (estimation > 1e9) {
- multiplicator = 1000000;
- }
- if (estimation > 1e6 && multiplicator < 1000000) {
- multiplicator = 1000;
- }
-
- // for data part
- DataStorage subDataStorage = (DataStorage) indicatorStorages.get(indicatorCode, speciesCode);
- if (subDataStorage == null) {
- subDataStorage = new MemoryDataStorage();
- if ("fr".equals(locale.getLanguage())) {
- subDataStorage.add(new String[]{"Campagne", "Indice", "Liste", "Espèce", "Strate", "Annee", "Estimation", "EcartType", "CV"});
- } else {
- subDataStorage.add(new String[]{"Survey", "Index", "List", "Species", "Stratum", "Year", "Estimate", "StandardDeviation", "CV"});
- }
- indicatorStorages.put(indicatorCode, speciesCode, subDataStorage);
- }
- subDataStorage.add(tuple);
- }
- }
-
- // avec l'extraction des données, on peut demander a générer un graphique
- // sur un indicateur qui n'est pas présent dans le projet courant,
- // dans ce cas, on retourne null
- for (MultiKey indicatorSpecies : (Set<MultiKey>) indicatorGraphData.keySet()) {
- String indicator = (String) indicatorSpecies.getKey(0);
- String aSpecies = (String) indicatorSpecies.getKey(1);
- // get graph title
- String title = zoneDisplayName;
- String indicatorName = indicatorMap.getIndicatorValue(indicator, locale);
- String unit = indicatorMap.getIndicatorUnit(indicator);
- title += " - " + indicatorName;
- title += " - " + repository.getSpeciesMap().getReportDisplayName(aSpecies);
-
- // generate dataset with sorted data
- DefaultStatisticalCategoryDataset statisticalDataset = new DefaultStatisticalCategoryDataset();
- Map<Integer, Double[]> graphData = (Map<Integer, Double[]>) indicatorGraphData.get(indicator, aSpecies);
- for (int indexYear = minYear; indexYear <= maxYear; ++indexYear) {
- Double[] entry = graphData.get(indexYear);
- if (entry != null) {
- Double estimation = entry[0] / multiplicator;
- Double ecart = entry[1] / multiplicator;
- statisticalDataset.add(estimation, ecart, "Serie1", (Comparable) indexYear);
- } else {
- statisticalDataset.add(null, null, "Serie1", indexYear);
- }
- }
-
-
- // configure chart
- //CategoryAxis categoryAxis = new CategoryAxis(t("coser.business.common.year"));
- String yearAxis = reports.getYearChartTitle(locale);
- CategoryAxis categoryAxis = new CategoryAxis(yearAxis);
- categoryAxis.setCategoryMargin(0);
- categoryAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
- // label horizontaux
- String legendY = indicatorName;
- if (multiplicator != 1) {
- // affiche par exemple : cm * 1000
- legendY += " (" + unit + "*" + multiplicator + ")";
- } else if (StringUtils.isNotEmpty(unit)) {
- legendY += " (" + unit + ")";
- }
- ValueAxis valueAxis = new NumberAxis(legendY);
- valueAxis.setUpperMargin(0.1);
-
- CategoryItemRenderer renderer = new StatisticalLineAndShapeRenderer(false, true);
-
- // n'affiche pas les nombre sur le graphique
- //StandardCategoryItemLabelGenerator itemLabelGenerator = new StandardCategoryItemLabelGenerator();
- //renderer.setBaseItemLabelGenerator(itemLabelGenerator);
- //renderer.setBaseItemLabelsVisible(true);
-
- CategoryPlot plot = new CategoryPlot(statisticalDataset, categoryAxis, valueAxis, renderer);
- plot.setOrientation(PlotOrientation.VERTICAL);
- JFreeChart chart = new JFreeChart(title,
- JFreeChart.DEFAULT_TITLE_FONT, plot, true);
-
- // remove series legend
- chart.removeLegend();
- // white background
- chart.setBackgroundPaint(Color.WHITE);
-
- try {
- File chartFile = File.createTempFile("coser-population-chart-", ".png");
- chartFile.deleteOnExit();
- ChartUtilities.saveChartAsPNG(chartFile, chart, width, height);
- //ByteArrayOutputStream out = new ByteArrayOutputStream();
- //ChartUtilities.writeChartAsPNG(out, chart, width, height);
-
- // data extraction
- DataStorage subDataStorage = (DataStorage) indicatorStorages.get(indicator, aSpecies);
- StringWriter writer = new StringWriter();
- DataStorages.save(subDataStorage, writer);
-
- // add chart file dans chart data in result
- result.put(indicator + "-" + aSpecies, Pair.of(chartFile, writer.toString()));
- writer.close();
- } catch (IOException ex) {
- throw new CoserTechnicalException("Can't save chart", ex);
- }
- }
-
- return result;
- }
-
- // --------------------------------------------------------------------- //
- // --- Matchers -------------------------------------------------------- //
- // --------------------------------------------------------------------- //
-
- protected boolean matchExtractTypeSet(ExtractRequest request) {
- //TODO Should deal also with raw-data type
- return !request.getExtractTypeList().contains(DataType.SOURCE);
- }
-
- protected boolean matchZoneList(ExtractRequest request) {
- return request.getZoneList().contains(project.getZoneName());
- }
-
- protected boolean matchCommunityIndicatorList(ExtractRequest request) {
- Preconditions.checkNotNull(request.getCommunityIndicatorList());
-
- List<String> indicatorList = request.getCommunityIndicatorList();
-
- boolean result = false;
-
- Iterator<String[]> iterator = repository.loadCommunityIndicatorStorage(true);
- while (iterator.hasNext()) {
- String[] tuple = iterator.next();
- if (repository.matchIndicatorList(tuple, indicatorList)) {
- result = true;
- break;
- }
- }
- return result;
- }
-
- protected boolean matchPopulationIndicatorList(ExtractRequest request) {
- Preconditions.checkNotNull(request.getPopulationIndicatorList());
-
- List<String> indicatorList = request.getPopulationIndicatorList();
-
- boolean result = false;
-
- Iterator<String[]> iterator = repository.loadPopulationIndicatorStorage(true);
- while (iterator.hasNext()) {
- String[] tuple = iterator.next();
- if (repository.matchIndicatorList(tuple, indicatorList)) {
- result = true;
- break;
- }
- }
- return result;
- }
-
- protected boolean matchPopulationIndicatorListAndSpeciesList(ExtractRequest request) {
- Preconditions.checkNotNull(request.getPopulationIndicatorList());
-
- List<String> indicatorList = request.getPopulationIndicatorList();
- List<String> speciesList = request.getSpeciesList();
-
- boolean result = false;
-
- Iterator<String[]> iterator = repository.loadPopulationIndicatorStorage(true);
- while (iterator.hasNext()) {
- String[] tuple = iterator.next();
- if (repository.matchIndicatorListAndSpeciesList(tuple, indicatorList, speciesList)) {
- result = true;
- break;
- }
- }
- return result;
- }
-
- protected boolean matchCommunityIndicatorListAndSpeciesList(ExtractRequest request) {
- Preconditions.checkNotNull(request.getCommunityIndicatorList());
-
- List<String> indicatorList = request.getCommunityIndicatorList();
- List<String> speciesList = request.getSpeciesList();
-
- boolean result = false;
-
- Iterator<String[]> iterator = repository.loadCommunityIndicatorStorage(true);
- while (iterator.hasNext()) {
- String[] tuple = iterator.next();
- if (repository.matchIndicatorListAndSpeciesList(tuple, indicatorList, speciesList)) {
- result = true;
- break;
- }
- }
- return result;
- }
-}
Deleted: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/MapResultProducer.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/MapResultProducer.java 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/MapResultProducer.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -1,124 +0,0 @@
-package fr.ifremer.coser.result.repository.echobase;
-
-/*
- * #%L
- * Coser :: Business
- * %%
- * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>.
- * #L%
- */
-
-import com.google.common.base.Preconditions;
-import fr.ifremer.coser.bean.EchoBaseProject;
-import fr.ifremer.coser.bean.ZoneMap;
-import fr.ifremer.coser.result.FileResult;
-import fr.ifremer.coser.result.repository.RequestUnavailableForProducerException;
-import fr.ifremer.coser.result.repository.ResultProducer;
-import fr.ifremer.coser.result.request.MapRequest;
-
-import java.io.File;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Created on 3/11/14.
- *
- * @author Tony Chemit <chemit(a)codelutin.com>
- * @since 1.5
- */
-public class MapResultProducer implements ResultProducer<MapRequest> {
-
- protected final EchoBaseResultRepository repository;
-
- protected final EchoBaseProject project;
-
- public MapResultProducer(EchoBaseResultRepository repository) {
- this.repository = repository;
- this.project = repository.project;
- }
-
- @Override
- public EchoBaseResultRepository getRepository() {
- return repository;
- }
-
- @Override
- public boolean acceptResult(MapRequest request) {
- return repository.matchFacade(request) &&
- repository.matchZone(request) &&
- matchSpecies(request);
- }
-
- @Override
- public Map<String, String> getAvailableZones(MapRequest request) {
- Preconditions.checkNotNull(request.getFacade());
-
- boolean match = repository.matchFacade(request);
-
- Map<String, String> result = null;
- if (match) {
- ZoneMap zonesMap = repository.getZonesMap();
- List<String> allowedZones = zonesMap.getZonesForFacade(request.getFacade());
- result = zonesMap.getSubZonesMap(project.getZoneName(), allowedZones);
- }
- return result;
- }
-
- @Override
- public Map<String, String> getAvailableSpecies(MapRequest request) {
- Preconditions.checkNotNull(request.getFacade());
- Preconditions.checkNotNull(request.getZone());
-
- Map<String, String> result = null;
-
- boolean match = repository.matchFacade(request) && repository.matchZone(request);
- if (match) {
- // get all map species for given facade + zone
- Set<String> speciesList = repository.getMapSpecies();
- result = repository.getSpeciesMap().getSpeciesSubMap(speciesList);
- }
- return result;
- }
-
- @Override
- public Map<String, String> getAvailableIndicators(MapRequest request) {
- throw RequestUnavailableForProducerException.newException("getAvailableIndicators", this);
- }
-
- @Override
- public FileResult produceResult(MapRequest request) {
- Preconditions.checkNotNull(request.getFacade());
- Preconditions.checkNotNull(request.getZone());
- Preconditions.checkNotNull(request.getSpecies());
-
- File resultZip = repository.getMapSpeciesFile(request.getSpecies());
-
- FileResult result = new FileResult(repository.getId(), resultZip);
- return result;
- }
-
- // --------------------------------------------------------------------- //
- // --- Matchers -------------------------------------------------------- //
- // --------------------------------------------------------------------- //
-
- protected boolean matchSpecies(MapRequest request) {
- String species = request.getSpecies();
- File file = repository.getMapSpeciesFile(species);
- return file != null && file.exists();
- }
-}
Deleted: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/PopulationIndicatorResultProducer.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/PopulationIndicatorResultProducer.java 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/PopulationIndicatorResultProducer.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -1,341 +0,0 @@
-package fr.ifremer.coser.result.repository.echobase;
-
-/*
- * #%L
- * Coser :: Business
- * %%
- * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>.
- * #L%
- */
-
-import com.google.common.base.Preconditions;
-import fr.ifremer.coser.CoserTechnicalException;
-import fr.ifremer.coser.bean.EchoBaseProject;
-import fr.ifremer.coser.bean.ZoneMap;
-import fr.ifremer.coser.result.FileResult;
-import fr.ifremer.coser.result.Reports;
-import fr.ifremer.coser.result.repository.ResultProducer;
-import fr.ifremer.coser.result.request.PopulationIndicatorRequest;
-import fr.ifremer.coser.storage.DataStorage;
-import fr.ifremer.coser.storage.DataStorages;
-import fr.ifremer.coser.storage.MemoryDataStorage;
-import org.apache.commons.lang3.StringUtils;
-import org.jfree.chart.ChartUtilities;
-import org.jfree.chart.JFreeChart;
-import org.jfree.chart.axis.CategoryAxis;
-import org.jfree.chart.axis.CategoryLabelPositions;
-import org.jfree.chart.axis.NumberAxis;
-import org.jfree.chart.axis.ValueAxis;
-import org.jfree.chart.plot.CategoryPlot;
-import org.jfree.chart.plot.PlotOrientation;
-import org.jfree.chart.renderer.category.CategoryItemRenderer;
-import org.jfree.chart.renderer.category.StatisticalLineAndShapeRenderer;
-import org.jfree.data.statistics.DefaultStatisticalCategoryDataset;
-
-import java.awt.Color;
-import java.io.File;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Created on 3/11/14.
- *
- * @author Tony Chemit <chemit(a)codelutin.com>
- * @since 1.5
- */
-public class PopulationIndicatorResultProducer implements ResultProducer<PopulationIndicatorRequest> {
-
- protected final EchoBaseResultRepository repository;
-
- protected final Reports reports;
-
- protected final EchoBaseProject project;
-
- public PopulationIndicatorResultProducer(EchoBaseResultRepository repository) {
- this.repository = repository;
- this.project = repository.project;
- this.reports = repository.reports;
- }
-
- @Override
- public EchoBaseResultRepository getRepository() {
- return repository;
- }
-
- @Override
- public boolean acceptResult(PopulationIndicatorRequest request) {
- return repository.matchFacade(request) &&
- repository.matchZone(request) &&
- matchSpeciesAndIndicator(request);
- }
-
- @Override
- public Map<String, String> getAvailableZones(PopulationIndicatorRequest request) {
- boolean match = repository.matchFacade(request);
-
- Map<String, String> result = null;
- if (match) {
- ZoneMap zonesMap = repository.getZonesMap();
- List<String> allowedZones = zonesMap.getZonesForFacade(request.getFacade());
- result = zonesMap.getSubZonesMap(project.getZoneName(), allowedZones);
- }
- return result;
- }
-
- @Override
- public Map<String, String> getAvailableSpecies(PopulationIndicatorRequest request) {
- Preconditions.checkNotNull(request.getFacade());
- Preconditions.checkNotNull(request.getZone());
-
- Map<String, String> result = null;
- boolean match = repository.matchFacade(request) && repository.matchZone(request);
-
- if (match) {
- // get all population indicator species for given facade + zone
- Set<String> speciesList = repository.getPopulationIndicatorSpecies();
- result = repository.getSpeciesMap().getSpeciesSubMap(speciesList);
- }
-
- return result;
- }
-
- @Override
- public Map<String, String> getAvailableIndicators(PopulationIndicatorRequest request) {
- Preconditions.checkNotNull(request.getFacade());
- Preconditions.checkNotNull(request.getZone());
-
- Map<String, String> result = null;
- boolean match = repository.matchFacade(request) && repository.matchZone(request);
- if (match) {
-
- // get all indicators for given facade + zone
- Set<String> indicatorList = repository.getCommunityIndicators();
- result = repository.getIndicatorsMap().getIndicatorsValues(indicatorList, request.getLocale());
- }
- return result;
- }
-
- @Override
- public FileResult produceResult(PopulationIndicatorRequest r) {
-
- File file = null;
- switch (r.getResultType()) {
- case DATA:
- file = getPopulationIndicatorDataFile(r.getIndicator(),
- r.getSpecies());
- break;
-
- case GRAPH:
- file = getPopulationIndicatorGraphFile(r.getLocale(),
- r.getZone(),
- r.getIndicator(),
- r.getSpecies());
- break;
- }
-
-
- FileResult result = new FileResult(repository.getId(), file);
- return result;
- }
-
- protected File getPopulationIndicatorDataFile(String species, String indicator) {
-
- DataStorage dataStorage = new MemoryDataStorage();
-
- Iterator<String[]> iterator = repository.loadPopulationIndicatorStorage(false);
-
- // add header
- dataStorage.add(iterator.next());
-
- while (iterator.hasNext()) {
- String[] tuple = iterator.next();
- if (repository.matchIndicatorSpeciesAndIndicator(tuple, species, indicator)) {
- dataStorage.add(tuple);
- }
- }
- File result = DataStorages.save(dataStorage, "coser-chart-population-indicator",
- ".csv"
- );
- return result;
- }
-
- protected File getPopulationIndicatorGraphFile(Locale locale,
- String zone,
- String species,
- String indicator) {
-
-
- int multiplicator = 1;
- int minYear = Integer.MAX_VALUE;
- int maxYear = Integer.MIN_VALUE;
- boolean indicatorFound = false;
- Map<Integer, Double[]> graphData = new HashMap<Integer, Double[]>();
- Iterator<String[]> iterator = repository.loadPopulationIndicatorStorage(true);
- while (iterator.hasNext()) {
- String[] tuple = iterator.next();
-
- if (repository.matchIndicatorSpeciesAndIndicator(tuple, species, indicator)) {
- indicatorFound = true;
-
- // XXX echatellier, maybe take care of list here ?
-
- Double estimation = Double.parseDouble(tuple[6]);
- Double ecart = Double.parseDouble(tuple[7]);
- int year = Integer.parseInt(tuple[5]);
-
- if (year < minYear) {
- minYear = year;
- }
- if (year > maxYear) {
- maxYear = year;
- }
- graphData.put(year, new Double[]{estimation, ecart});
-
- // si les données sont énormes, on affiche les données
- // / multiplicator et on le mentionne dans la légende
- if (estimation > 1e9) {
- multiplicator = 1000000;
- }
- if (estimation > 1e6 && multiplicator < 1000000) {
- multiplicator = 1000;
- }
- }
- }
-
- File result = null;
-
- // avec l'extraction des données, on peut demander a générer un graphique
- // sur un indicateur qui n'est pas présent dans le projet courant,
- // dans ce cas, on retourne null
- if (indicatorFound) {
-
- String zoneDisplayName = repository.getZonesMap().getZoneFullName(zone);
- String indicatorName = repository.getIndicatorsMap().getIndicatorValue(indicator, locale);
- String unit = repository.getIndicatorsMap().getIndicatorUnit(indicator);
-
- // get graph title
- String title = zoneDisplayName;
- title += " - " + indicatorName;
- title += " - " + repository.getSpeciesMap().getReportDisplayName(species);
-
- // generate dataset with sorted data
- DefaultStatisticalCategoryDataset statisticalDataset = new DefaultStatisticalCategoryDataset();
- for (int indexYear = minYear; indexYear <= maxYear; ++indexYear) {
- Double[] entry = graphData.get(indexYear);
- if (entry != null) {
- Double estimation = entry[0] / multiplicator;
- Double ecart = entry[1] / multiplicator;
- statisticalDataset.add(estimation, ecart, "Serie1", (Comparable) indexYear);
- } else {
- statisticalDataset.add(null, null, "Serie1", indexYear);
- }
- }
-
- // configure chart
- //CategoryAxis categoryAxis = new CategoryAxis(t("coser.business.common.year"));
- String yearAxis = reports.getYearChartTitle(locale);
- CategoryAxis categoryAxis = new CategoryAxis(yearAxis);
- categoryAxis.setCategoryMargin(0);
- categoryAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
- // label horizontaux
- String legendY = indicatorName;
- if (multiplicator != 1) {
- // affiche par exemple : cm * 1000
- legendY += " (" + unit + "*" + multiplicator + ")";
- } else if (StringUtils.isNotEmpty(unit)) {
- legendY += " (" + unit + ")";
- }
- ValueAxis valueAxis = new NumberAxis(legendY);
- valueAxis.setUpperMargin(0.1);
-
- CategoryItemRenderer renderer = new StatisticalLineAndShapeRenderer(false, true);
-
- // n'affiche pas les nombre sur le graphique
- //StandardCategoryItemLabelGenerator itemLabelGenerator = new StandardCategoryItemLabelGenerator();
- //renderer.setBaseItemLabelGenerator(itemLabelGenerator);
- //renderer.setBaseItemLabelsVisible(true);
-
- CategoryPlot plot = new CategoryPlot(statisticalDataset, categoryAxis, valueAxis, renderer);
- plot.setOrientation(PlotOrientation.VERTICAL);
- JFreeChart chart = new JFreeChart(title,
- JFreeChart.DEFAULT_TITLE_FONT, plot, true);
-
- // remove series legend
- chart.removeLegend();
- // white background
- chart.setBackgroundPaint(Color.WHITE);
-
- try {
- result = File.createTempFile("coser-chart-population-indicator-", ".png");
- result.deleteOnExit();
- ChartUtilities.saveChartAsPNG(result, chart, 800, 400);
- } catch (IOException ex) {
- throw new CoserTechnicalException("Can't save chart", ex);
- }
- }
-
- return result;
- }
-
- // --------------------------------------------------------------------- //
- // --- Matchers -------------------------------------------------------- //
- // --------------------------------------------------------------------- //
-
- protected boolean matchSpecies(PopulationIndicatorRequest request) {
- Preconditions.checkNotNull(request.getSpecies());
-
- String species = request.getSpecies();
-
- boolean result = false;
-
- Iterator<String[]> iterator = repository.loadPopulationIndicatorStorage(true);
- while (iterator.hasNext()) {
- String[] tuple = iterator.next();
- if (repository.matchIndicatorSpecies(tuple, species)) {
- result = true;
- break;
- }
- }
- return result;
- }
-
- protected boolean matchSpeciesAndIndicator(PopulationIndicatorRequest request) {
- Preconditions.checkNotNull(request.getSpecies());
- Preconditions.checkNotNull(request.getIndicator());
-
- String species = request.getSpecies();
- String indicator = request.getIndicator();
-
- boolean result = false;
-
- Iterator<String[]> iterator = repository.loadPopulationIndicatorStorage(true);
- while (iterator.hasNext()) {
- String[] tuple = iterator.next();
- if (repository.matchIndicatorSpeciesAndIndicator(tuple, species, indicator)) {
- result = true;
- break;
- }
- }
- return result;
- }
-
-}
Deleted: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/RawDataResultProducer.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/RawDataResultProducer.java 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/RawDataResultProducer.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -1,103 +0,0 @@
-package fr.ifremer.coser.result.repository.echobase;
-
-/*
- * #%L
- * Coser :: Business
- * %%
- * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>.
- * #L%
- */
-
-import com.google.common.base.Preconditions;
-import fr.ifremer.coser.bean.EchoBaseProject;
-import fr.ifremer.coser.bean.ZoneMap;
-import fr.ifremer.coser.result.FileResult;
-import fr.ifremer.coser.result.repository.RequestUnavailableForProducerException;
-import fr.ifremer.coser.result.repository.ResultProducer;
-import fr.ifremer.coser.result.request.RawDataRequest;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * Created on 3/11/14.
- *
- * @author Tony Chemit <chemit(a)codelutin.com>
- * @since 1.5
- */
-public class RawDataResultProducer implements ResultProducer<RawDataRequest> {
-
- protected final EchoBaseResultRepository repository;
-
- protected final EchoBaseProject project;
-
- public RawDataResultProducer(EchoBaseResultRepository repository) {
- this.repository = repository;
- this.project = repository.project;
-
- }
-
- @Override
- public EchoBaseResultRepository getRepository() {
- return repository;
- }
-
- @Override
- public boolean acceptResult(RawDataRequest request) {
- return repository.matchFacade(request) &&
- repository.matchZone(request);
- }
-
- @Override
- public Map<String, String> getAvailableZones(RawDataRequest request) {
- Preconditions.checkNotNull(request.getFacade());
-
- boolean match = repository.matchFacade(request);
-
- Map<String, String> result = null;
- if (match) {
- ZoneMap zonesMap = repository.getZonesMap();
- List<String> allowedZones = zonesMap.getZonesForFacade(request.getFacade());
- result = zonesMap.getSubZonesMap(project.getZoneName(), allowedZones);
- }
- return result;
- }
-
- @Override
- public Map<String, String> getAvailableSpecies(RawDataRequest request) {
- throw RequestUnavailableForProducerException.newException("getAvailableSpecies", this);
- }
-
- @Override
- public Map<String, String> getAvailableIndicators(RawDataRequest request) {
- throw RequestUnavailableForProducerException.newException("getAvailableIndicators", this);
- }
-
- @Override
- public FileResult produceResult(RawDataRequest r) {
-
- //TODO
- throw RequestUnavailableForProducerException.newException("produceResult", this);
- }
-
-
- // --------------------------------------------------------------------- //
- // --- Matchers ------------------------------------------------------- //
- // --------------------------------------------------------------------- //
-
- //TODO
-}
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/DeleteResultsCommand.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/DeleteResultsCommand.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/DeleteResultsCommand.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,109 @@
+package fr.ifremer.coser.result.repository.echobase.command;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.coser.CoserTechnicalException;
+import fr.ifremer.coser.result.CoserResult;
+import fr.ifremer.coser.result.ResultType;
+import fr.ifremer.coser.result.VoidResult;
+import fr.ifremer.coser.result.repository.ResultRepositoryCommand;
+import fr.ifremer.coser.result.repository.echobase.EchoBaseResultRepository;
+import fr.ifremer.coser.result.repository.echobase.EchoBaseResultRepositoryType;
+import fr.ifremer.coser.result.request.DeleteResultsRequest;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+
+/**
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class DeleteResultsCommand implements ResultRepositoryCommand<EchoBaseResultRepository, DeleteResultsRequest> {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(DeleteResultsCommand.class);
+
+ @Override
+ public Class<DeleteResultsRequest> getRequestType() {
+ return DeleteResultsRequest.class;
+ }
+
+ @Override
+ public boolean accept(EchoBaseResultRepository repository,
+ DeleteResultsRequest request) {
+ boolean result = matchRepositoryType(request) &&
+ matchResultType(request) &&
+ matchPublish(repository) &&
+ matchZone(repository, request);
+ return result;
+ }
+
+ @Override
+ public CoserResult execute(EchoBaseResultRepository repository,
+ DeleteResultsRequest request) {
+ File basedir = repository.getBasedir();
+ if (log.isInfoEnabled()) {
+ log.info("Will delete project at: " + basedir);
+ }
+ try {
+ FileUtils.deleteDirectory(basedir);
+ } catch (IOException e) {
+ throw new CoserTechnicalException("Could not delete project at: " + basedir, e);
+ }
+ return new VoidResult(repository.getId());
+ }
+
+ // --------------------------------------------------------------------- //
+ // --- Matchers -------------------------------------------------------- //
+ // --------------------------------------------------------------------- //
+
+ protected boolean matchRepositoryType(DeleteResultsRequest request) {
+ boolean result = request.getResultRepositoryType().equals(EchoBaseResultRepositoryType.ID);
+ return result;
+ }
+
+ protected boolean matchResultType(DeleteResultsRequest request) {
+ ResultType resultType = request.getResultType();
+ boolean result = ResultType.MAP_AND_INDICATOR == resultType;
+ return result;
+ }
+
+ protected boolean matchPublish(EchoBaseResultRepository repository) {
+ boolean result = repository.isPubliableResult();
+ return result;
+ }
+
+ protected boolean matchZone(EchoBaseResultRepository repository,
+ DeleteResultsRequest request) {
+ List<String> zoneList = request.getZoneList();
+ boolean result = zoneList.contains(repository.getZone());
+ return result;
+ }
+
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/DeleteResultsCommand.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Copied: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/ExtractRawDataAndResultsCommand.java (from rev 1144, trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/ExtractResultProducer.java)
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/ExtractRawDataAndResultsCommand.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/ExtractRawDataAndResultsCommand.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,720 @@
+package fr.ifremer.coser.result.repository.echobase.command;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Maps;
+import fr.ifremer.coser.CoserTechnicalException;
+import fr.ifremer.coser.bean.IndicatorMap;
+import fr.ifremer.coser.bean.SpeciesMap;
+import fr.ifremer.coser.result.FileResult;
+import fr.ifremer.coser.result.repository.ResultRepositoryCommand;
+import fr.ifremer.coser.result.repository.echobase.EchoBaseResultRepository;
+import fr.ifremer.coser.result.request.ExtractRawDataAndResultsRequest;
+import fr.ifremer.coser.storage.DataStorage;
+import fr.ifremer.coser.storage.DataStorages;
+import fr.ifremer.coser.storage.MemoryDataStorage;
+import fr.ifremer.coser.util.DataType;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.MapUtils;
+import org.apache.commons.collections4.keyvalue.MultiKey;
+import org.apache.commons.collections4.map.MultiKeyMap;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.tuple.Pair;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jfree.chart.ChartUtilities;
+import org.jfree.chart.JFreeChart;
+import org.jfree.chart.axis.CategoryAxis;
+import org.jfree.chart.axis.CategoryLabelPositions;
+import org.jfree.chart.axis.NumberAxis;
+import org.jfree.chart.axis.ValueAxis;
+import org.jfree.chart.plot.CategoryPlot;
+import org.jfree.chart.plot.PlotOrientation;
+import org.jfree.chart.renderer.category.CategoryItemRenderer;
+import org.jfree.chart.renderer.category.StatisticalLineAndShapeRenderer;
+import org.jfree.data.statistics.DefaultStatisticalCategoryDataset;
+import org.nuiton.util.FileUtil;
+import org.nuiton.util.ZipUtil;
+
+import java.awt.Color;
+import java.io.File;
+import java.io.IOException;
+import java.io.StringWriter;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class ExtractRawDataAndResultsCommand implements ResultRepositoryCommand<EchoBaseResultRepository, ExtractRawDataAndResultsRequest> {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(ExtractRawDataAndResultsCommand.class);
+
+ @Override
+ public Class<ExtractRawDataAndResultsRequest> getRequestType() {
+ return ExtractRawDataAndResultsRequest.class;
+ }
+
+ @Override
+ public boolean accept(EchoBaseResultRepository repository,
+ ExtractRawDataAndResultsRequest request) {
+ return matchExtractTypeSet(request) &&
+ matchZoneList(repository, request) &&
+ (matchPopulationIndicatorListAndSpeciesList(repository, request) ||
+ matchCommunityIndicatorListAndSpeciesList(repository, request));
+ }
+
+ @Override
+ public FileResult execute(EchoBaseResultRepository repository,
+ ExtractRawDataAndResultsRequest r) {
+
+ Locale locale = r.getLocale();
+ List<String> zoneList = r.getZoneList();
+ List<DataType> extractTypeList = r.getExtractTypeList();
+ List<String> speciesList = r.getSpeciesList();
+ List<String> communityIndicatorList = r.getCommunityIndicatorList();
+ List<String> populationIndicatorList = r.getPopulationIndicatorList();
+
+ File resultZip = null;
+ File tempDir = null;
+ try {
+ tempDir = FileUtil.createTempDirectory("coser-extract-", "-tmp");
+
+ File subDir = new File(tempDir, "Indicateurs_Ifremer");
+ FileUtils.forceMkdir(subDir);
+
+ // les sources se retrouve dans le zip a cote du pdf
+ if (extractTypeList.contains(DataType.SOURCE)) {
+ if (log.isDebugEnabled()) {
+ log.debug("Extracting sources");
+ }
+ File srcDir = new File(subDir, "sources");
+ extractSource(srcDir);
+ }
+
+ // les cartes doivent se retrouver dans le pdf
+ MultiKeyMap pdfMaps = null;
+ if (extractTypeList.contains(DataType.MAP)) {
+ if (log.isDebugEnabled()) {
+ log.debug("Extracting maps");
+ }
+ String zone = repository.getZone();
+ SpeciesMap speciesMap = repository.getSpeciesMap();
+ for (String species : speciesList) {
+ File mapFile = repository.getMapSpeciesFile(species);
+ pdfMaps.put(zone, speciesMap.getSpeciesName(species), mapFile);
+ }
+ }
+
+ // les graphiques sont également dans le pdf
+ MultiKeyMap pdfCharts = null;
+ if (CollectionUtils.isNotEmpty(communityIndicatorList) ||
+ CollectionUtils.isNotEmpty(populationIndicatorList)) {
+ if (log.isDebugEnabled()) {
+ log.debug("Extracting charts");
+ }
+ pdfCharts = extractCharts(repository,
+ speciesList,
+ communityIndicatorList,
+ populationIndicatorList,
+ locale);
+ }
+
+ // generate pdf if necessary
+ if (MapUtils.isNotEmpty(pdfMaps) || MapUtils.isNotEmpty(pdfCharts)) {
+ if (log.isDebugEnabled()) {
+ log.debug("Generated Extract PDF");
+ }
+ repository.getReports().generateExtractPDF(subDir,
+ zoneList,
+ pdfMaps,
+ pdfCharts,
+ repository.getZonesMap(),
+ locale);
+ }
+
+ // fichier de décharge en pdf
+ if (log.isDebugEnabled()) {
+ log.debug("Generated decharge PDF");
+ }
+ String filename = repository.getReports().getDechargeFilename(locale);
+ File dechargePDF = new File(subDir, filename);
+ repository.getReports().generateDechargePDF(dechargePDF, locale, null, null);
+
+ // make zip
+ if (log.isDebugEnabled()) {
+ log.debug("Make final archive");
+ }
+ resultZip = File.createTempFile("coser-extract-", ".zip");
+ resultZip.deleteOnExit();
+ ZipUtil.compress(resultZip, subDir);
+
+ // clean directory
+ FileUtils.deleteDirectory(tempDir);
+ } catch (IOException ex) {
+ throw new CoserTechnicalException("Can't create zip file", ex);
+ } finally {
+ // clean directory
+ FileUtils.deleteQuietly(tempDir);
+ }
+
+ FileResult result = new FileResult(repository.getId(), resultZip);
+ return result;
+ }
+
+ /**
+ * Generate raw data after selection in a sub directory (named of the zone) of the given directory.
+ *
+ * @param directory where to generate file
+ */
+ protected void extractSource(File directory) {
+
+ //TODO
+ }
+
+ /**
+ * Retourne les indicateurs calculés avec leurs traductions scientifique
+ * pour la zone et l'especes souhaitées.
+ *
+ * @param species especes (if {@code null} look for com indicators
+ * @param comIndicators comIndicator
+ * @param popIndicators popIndicators
+ * @param locale locale
+ * @return la liste des indicateurs (zone, speciesname, [graphfile, graphdata])
+ */
+ protected MultiKeyMap extractCharts(EchoBaseResultRepository repository,
+ Collection<String> species,
+ Collection<String> comIndicators,
+ Collection<String> popIndicators,
+ Locale locale) {
+
+ MultiKeyMap chartFileAndDatas = new MultiKeyMap();
+
+ String zone = repository.getZone();
+ String zoneDisplayName = repository.getZonesMap().getZoneFullName(zone);
+
+ if (CollectionUtils.isNotEmpty(comIndicators)) {
+ Map<String, Pair<File, String>> chartFileAndDataCom = getRsufiResultComCharts(repository,
+ comIndicators,
+ zoneDisplayName,
+ repository.getIndicatorsMap(),
+ locale,
+ 650,
+ 430);
+ // put in multimap as zone,speciesname, data
+ for (Map.Entry<String, Pair<File, String>> entry : chartFileAndDataCom.entrySet()) {
+ chartFileAndDatas.put(zone, entry.getKey(), entry.getValue());
+ }
+ }
+
+ if (CollectionUtils.isNotEmpty(popIndicators)) {
+ Map<String, Pair<File, String>> chartFileAndDataPop = getRsufiResultPopCharts(repository,
+ species,
+ popIndicators,
+ zoneDisplayName,
+ repository.getIndicatorsMap(),
+ locale,
+ 650,
+ 430);
+ // put in multimap as zone,speciesname, data
+ for (Map.Entry<String, Pair<File, String>> entry : chartFileAndDataPop.entrySet()) {
+ chartFileAndDatas.put(zone, entry.getKey(), entry.getValue());
+ }
+ }
+
+ return chartFileAndDatas;
+ }
+
+ /**
+ * Generate community graph for selected indicators.
+ * Used by web ui extraction.
+ *
+ * @param indicators indicators to extract
+ * @param zoneDisplayName zone full name
+ * @param indicatorMap indicator localized map
+ * @param locale locale
+ * @param width graph width
+ * @param height graph height
+ * @return maps of generated graph image (temp file) and data indexed by natural key (indicator - species)
+ */
+ public Map<String, Pair<File, String>> getRsufiResultComCharts(EchoBaseResultRepository repository,
+ Collection<String> indicators,
+ String zoneDisplayName,
+ IndicatorMap indicatorMap,
+ Locale locale,
+ int width, int height) {
+
+ Map<String, Pair<File, String>> result = Maps.newHashMap();
+
+ int multiplicator = 1;
+ int minYear = Integer.MAX_VALUE;
+ int maxYear = Integer.MIN_VALUE;
+
+ Map<String, Map<Integer, Double[]>> indicatorGraphData = new HashMap<String, Map<Integer, Double[]>>();
+ Map<String, String> indicatorLists = new HashMap<String, String>();
+ Map<String, DataStorage> indicatorStorages = new HashMap<String, DataStorage>();
+
+ // Campagne Indicateur Liste Strate Annee Estimation EcartType CV
+ Iterator<String[]> estComIndIterator = repository.loadCommunityIndicatorStorage(true);
+ while (estComIndIterator.hasNext()) {
+ // Campagne Indicateur Liste Strate Annee Estimation EcartType CV
+ String[] tuple = estComIndIterator.next();
+ String indicatorCode = tuple[1];
+ String indicatorList = tuple[2];
+
+ if (indicators.contains(indicatorCode)) {
+
+ // si pas de list selectionnée, on prend la premiere
+ String localList = indicatorLists.get(indicatorCode);
+ if (StringUtils.isBlank(localList)) {
+ localList = indicatorList;
+ indicatorLists.put(indicatorCode, localList);
+ }
+
+ if (indicatorList.equals(localList)) {
+ Double estimation = Double.parseDouble(tuple[5]);
+ Double ecart = Double.parseDouble(tuple[6]);
+ int year = Integer.parseInt(tuple[4]);
+
+ if (year < minYear) {
+ minYear = year;
+ }
+ if (year > maxYear) {
+ maxYear = year;
+ }
+ Map<Integer, Double[]> graphData = indicatorGraphData.get(indicatorCode);
+ if (graphData == null) {
+ graphData = new HashMap<Integer, Double[]>();
+ indicatorGraphData.put(indicatorCode, graphData);
+ }
+ graphData.put(year, new Double[]{estimation, ecart});
+
+ // si les données sont énormes, on affiche les données
+ // / multiplicator et on le mentionne dans la légende
+ if (estimation > 1e9) {
+ multiplicator = 1000000;
+ }
+ if (estimation > 1e6 && multiplicator < 1000000) {
+ multiplicator = 1000;
+ }
+
+ // for data part
+ DataStorage subDataStorage = indicatorStorages.get(indicatorCode);
+ if (subDataStorage == null) {
+ subDataStorage = new MemoryDataStorage();
+ if ("fr".equals(locale.getLanguage())) {
+ subDataStorage.add(new String[]{"Campagne", "Indice", "Liste", "Strate", "Année", "Estimation", "EcartType", "CV"});
+ } else {
+ subDataStorage.add(new String[]{"Survey", "Index", "List", "Stratum", "Year", "Estimate", "StandardDeviation", "CV"});
+ }
+ indicatorStorages.put(indicatorCode, subDataStorage);
+ }
+ subDataStorage.add(tuple);
+ }
+ }
+ }
+
+ // avec l'extraction des données, on peut demander a générer un graphique
+ // sur un indicateur qui n'est pas présent dans le projet courant,
+ // dans ce cas, on retourne null
+ for (String indicator : indicatorGraphData.keySet()) {
+ // get graph title
+ String chartTitle = zoneDisplayName;
+ String indicatorName = indicatorMap.getIndicatorValue(indicator, locale);
+ String unit = indicatorMap.getIndicatorUnit(indicator);
+ chartTitle += " - " + indicatorName;
+
+ // ajout de la traduction de la liste d'indicateur
+ // les liste sont a1, T1, T2 ...
+ String localList = indicatorLists.get(indicator);
+ String listLetter = String.valueOf(localList.charAt(0));
+ Iterator<String[]> typeIterator = repository.getSpeciesMap().iterator(true);
+ while (typeIterator.hasNext()) {
+ // "Types";"Commentaire";"NumSys min";"NumSys max";"Code"
+ String[] tuple = typeIterator.next();
+ if (tuple[4].equals(listLetter)) {
+ /// gestion du groupe "Tous"
+ // cas special, c'est la seule valeur du fichier
+ // code type espece qui a besoin d'une traduction
+ if (tuple[4].equalsIgnoreCase("T")) {
+ if ("fr".equals(locale.getLanguage())) {
+ chartTitle += " - " + "Tous Liste " + localList.charAt(1);
+ } else if ("es".equals(locale.getLanguage())) {
+ chartTitle += " - " + "Todo Lista " + localList.charAt(1);
+ } else {
+ chartTitle += " - " + "All List " + localList.charAt(1);
+ }
+ } else {
+ // ajout de la traduction du nom de liste plus le numéro
+ if ("fr".equals(locale.getLanguage())) {
+ chartTitle += " - " + tuple[0] + " Liste " + localList.charAt(1);
+ } else if ("es".equals(locale.getLanguage())) {
+ chartTitle += " - " + tuple[0] + " Lista " + localList.charAt(1);
+ } else {
+ chartTitle += " - " + tuple[0] + " List " + localList.charAt(1);
+ }
+ }
+ break;
+ }
+ }
+
+ // generate dataset with sorted data
+ Map<Integer, Double[]> graphData = indicatorGraphData.get(indicator);
+ DefaultStatisticalCategoryDataset statisticalDataset = new DefaultStatisticalCategoryDataset();
+ for (int indexYear = minYear; indexYear <= maxYear; ++indexYear) {
+ Double[] entry = graphData.get(indexYear);
+ if (entry != null) {
+ Double estimation = entry[0] / multiplicator;
+ Double ecart = entry[1] / multiplicator;
+ statisticalDataset.add(estimation, ecart, "Serie1", (Comparable) indexYear);
+ } else {
+ statisticalDataset.add(null, null, "Serie1", indexYear);
+ }
+ }
+
+ // configure chart
+ //CategoryAxis categoryAxis = new CategoryAxis(t("coser.business.common.year"));
+ String yearAxis = repository.getReports().getYearChartTitle(locale);
+ CategoryAxis categoryAxis = new CategoryAxis(yearAxis);
+ categoryAxis.setCategoryMargin(0);
+ categoryAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
+ // label horizontaux
+ String legendY = indicatorName;
+ if (multiplicator != 1) {
+ // affiche par exemple : cm * 1000
+ legendY += " (" + unit + "*" + multiplicator + ")";
+ } else if (StringUtils.isNotEmpty(unit)) {
+ legendY += " (" + unit + ")";
+ }
+ ValueAxis valueAxis = new NumberAxis(legendY);
+ valueAxis.setUpperMargin(0.1);
+
+ CategoryItemRenderer renderer = new StatisticalLineAndShapeRenderer(false, true);
+
+ // n'affiche pas les nombre sur le graphique
+ //StandardCategoryItemLabelGenerator itemLabelGenerator = new StandardCategoryItemLabelGenerator();
+ //renderer.setBaseItemLabelGenerator(itemLabelGenerator);
+ //renderer.setBaseItemLabelsVisible(true);
+
+ CategoryPlot plot = new CategoryPlot(statisticalDataset, categoryAxis, valueAxis, renderer);
+ plot.setOrientation(PlotOrientation.VERTICAL);
+ JFreeChart chart = new JFreeChart(chartTitle,
+ JFreeChart.DEFAULT_TITLE_FONT, plot, true);
+
+ // remove series legend
+ chart.removeLegend();
+ // white background
+ chart.setBackgroundPaint(Color.WHITE);
+
+ try {
+ File chartFile = File.createTempFile("coser-community-chart-", ".png");
+ chartFile.deleteOnExit();
+ ChartUtilities.saveChartAsPNG(chartFile, chart, width, height);
+ //ByteArrayOutputStream out = new ByteArrayOutputStream();
+ //ChartUtilities.writeChartAsPNG(out, chart, width, height);
+
+ // data extraction
+ DataStorage subDataStorage = indicatorStorages.get(indicator);
+ StringWriter writer = new StringWriter();
+ DataStorages.save(subDataStorage, writer);
+
+ // add chart file dans chart data in result
+ result.put(indicator, Pair.of(chartFile, writer.toString()));
+ writer.close();
+ } catch (IOException ex) {
+ throw new CoserTechnicalException("Can't save chart", ex);
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Generate population graph for selected species and indicator.
+ *
+ * @param species species to extract
+ * @param indicators indicators to extract
+ * @param zoneDisplayName zone full name
+ * @param indicatorMap indicator localized map
+ * @param locale locale
+ * @param width graph width
+ * @param height graph height
+ * @return maps of generated graph image (temp file) and data indexed by natural key (indicator - species)
+ */
+ public Map<String, Pair<File, String>> getRsufiResultPopCharts(EchoBaseResultRepository repository,
+ Collection<String> species,
+ Collection<String> indicators,
+ String zoneDisplayName,
+ IndicatorMap indicatorMap,
+ Locale locale,
+ int width,
+ int height) {
+
+ Map<String, Pair<File, String>> result = Maps.newHashMap();
+
+ int multiplicator = 1;
+ int minYear = Integer.MAX_VALUE;
+ int maxYear = Integer.MIN_VALUE;
+
+ MultiKeyMap indicatorGraphData = new MultiKeyMap();
+ MultiKeyMap indicatorStorages = new MultiKeyMap();
+
+ // Campagne Indicateur Liste Species Strate Annee Estimation EcartType CV
+ Iterator<String[]> estPopIndIterator = repository.loadPopulationIndicatorStorage(true);
+ while (estPopIndIterator.hasNext()) {
+ String[] tuple = estPopIndIterator.next();
+
+ String speciesCode = tuple[3];
+ String indicatorCode = tuple[1];
+ if (species.contains(speciesCode) && indicators.contains(indicatorCode)) {
+
+ // XXX echatellier, maybe take care of list here ?
+
+ Double estimation = Double.parseDouble(tuple[6]);
+ Double ecart = Double.parseDouble(tuple[7]);
+ int year = Integer.parseInt(tuple[5]);
+
+ if (year < minYear) {
+ minYear = year;
+ }
+ if (year > maxYear) {
+ maxYear = year;
+ }
+ Map<Integer, Double[]> graphData = (Map<Integer, Double[]>) indicatorGraphData.get(indicatorCode, speciesCode);
+ if (graphData == null) {
+ graphData = new HashMap<Integer, Double[]>();
+ indicatorGraphData.put(indicatorCode, speciesCode, graphData);
+ }
+ graphData.put(year, new Double[]{estimation, ecart});
+
+ // si les données sont énormes, on affiche les données
+ // / multiplicator et on le mentionne dans la légende
+ if (estimation > 1e9) {
+ multiplicator = 1000000;
+ }
+ if (estimation > 1e6 && multiplicator < 1000000) {
+ multiplicator = 1000;
+ }
+
+ // for data part
+ DataStorage subDataStorage = (DataStorage) indicatorStorages.get(indicatorCode, speciesCode);
+ if (subDataStorage == null) {
+ subDataStorage = new MemoryDataStorage();
+ if ("fr".equals(locale.getLanguage())) {
+ subDataStorage.add(new String[]{"Campagne", "Indice", "Liste", "Espèce", "Strate", "Annee", "Estimation", "EcartType", "CV"});
+ } else {
+ subDataStorage.add(new String[]{"Survey", "Index", "List", "Species", "Stratum", "Year", "Estimate", "StandardDeviation", "CV"});
+ }
+ indicatorStorages.put(indicatorCode, speciesCode, subDataStorage);
+ }
+ subDataStorage.add(tuple);
+ }
+ }
+
+ // avec l'extraction des données, on peut demander a générer un graphique
+ // sur un indicateur qui n'est pas présent dans le projet courant,
+ // dans ce cas, on retourne null
+ for (MultiKey indicatorSpecies : (Set<MultiKey>) indicatorGraphData.keySet()) {
+ String indicator = (String) indicatorSpecies.getKey(0);
+ String aSpecies = (String) indicatorSpecies.getKey(1);
+ // get graph title
+ String title = zoneDisplayName;
+ String indicatorName = indicatorMap.getIndicatorValue(indicator, locale);
+ String unit = indicatorMap.getIndicatorUnit(indicator);
+ title += " - " + indicatorName;
+ title += " - " + repository.getSpeciesMap().getReportDisplayName(aSpecies);
+
+ // generate dataset with sorted data
+ DefaultStatisticalCategoryDataset statisticalDataset = new DefaultStatisticalCategoryDataset();
+ Map<Integer, Double[]> graphData = (Map<Integer, Double[]>) indicatorGraphData.get(indicator, aSpecies);
+ for (int indexYear = minYear; indexYear <= maxYear; ++indexYear) {
+ Double[] entry = graphData.get(indexYear);
+ if (entry != null) {
+ Double estimation = entry[0] / multiplicator;
+ Double ecart = entry[1] / multiplicator;
+ statisticalDataset.add(estimation, ecart, "Serie1", (Comparable) indexYear);
+ } else {
+ statisticalDataset.add(null, null, "Serie1", indexYear);
+ }
+ }
+
+ // configure chart
+ //CategoryAxis categoryAxis = new CategoryAxis(t("coser.business.common.year"));
+ String yearAxis = repository.getReports().getYearChartTitle(locale);
+ CategoryAxis categoryAxis = new CategoryAxis(yearAxis);
+ categoryAxis.setCategoryMargin(0);
+ categoryAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
+ // label horizontaux
+ String legendY = indicatorName;
+ if (multiplicator != 1) {
+ // affiche par exemple : cm * 1000
+ legendY += " (" + unit + "*" + multiplicator + ")";
+ } else if (StringUtils.isNotEmpty(unit)) {
+ legendY += " (" + unit + ")";
+ }
+ ValueAxis valueAxis = new NumberAxis(legendY);
+ valueAxis.setUpperMargin(0.1);
+
+ CategoryItemRenderer renderer = new StatisticalLineAndShapeRenderer(false, true);
+
+ // n'affiche pas les nombre sur le graphique
+ //StandardCategoryItemLabelGenerator itemLabelGenerator = new StandardCategoryItemLabelGenerator();
+ //renderer.setBaseItemLabelGenerator(itemLabelGenerator);
+ //renderer.setBaseItemLabelsVisible(true);
+
+ CategoryPlot plot = new CategoryPlot(statisticalDataset, categoryAxis, valueAxis, renderer);
+ plot.setOrientation(PlotOrientation.VERTICAL);
+ JFreeChart chart = new JFreeChart(title,
+ JFreeChart.DEFAULT_TITLE_FONT, plot, true);
+
+ // remove series legend
+ chart.removeLegend();
+ // white background
+ chart.setBackgroundPaint(Color.WHITE);
+
+ try {
+ File chartFile = File.createTempFile("coser-population-chart-", ".png");
+ chartFile.deleteOnExit();
+ ChartUtilities.saveChartAsPNG(chartFile, chart, width, height);
+ //ByteArrayOutputStream out = new ByteArrayOutputStream();
+ //ChartUtilities.writeChartAsPNG(out, chart, width, height);
+
+ // data extraction
+ DataStorage subDataStorage = (DataStorage) indicatorStorages.get(indicator, aSpecies);
+ StringWriter writer = new StringWriter();
+ DataStorages.save(subDataStorage, writer);
+
+ // add chart file dans chart data in result
+ result.put(indicator + "-" + aSpecies, Pair.of(chartFile, writer.toString()));
+ writer.close();
+ } catch (IOException ex) {
+ throw new CoserTechnicalException("Can't save chart", ex);
+ }
+ }
+
+ return result;
+ }
+
+ // --------------------------------------------------------------------- //
+ // --- Matchers -------------------------------------------------------- //
+ // --------------------------------------------------------------------- //
+
+ protected boolean matchExtractTypeSet(ExtractRawDataAndResultsRequest request) {
+ //TODO Should deal also with raw-data type
+ return !request.getExtractTypeList().contains(DataType.SOURCE);
+ }
+
+ protected boolean matchZoneList(EchoBaseResultRepository repository,
+ ExtractRawDataAndResultsRequest request) {
+ return request.getZoneList().contains(repository.getZone());
+ }
+
+ protected boolean matchCommunityIndicatorList(EchoBaseResultRepository repository,
+ ExtractRawDataAndResultsRequest request) {
+ Preconditions.checkNotNull(request.getCommunityIndicatorList());
+
+ List<String> indicatorList = request.getCommunityIndicatorList();
+
+ boolean result = false;
+
+ Iterator<String[]> iterator = repository.loadCommunityIndicatorStorage(true);
+ while (iterator.hasNext()) {
+ String[] tuple = iterator.next();
+ if (repository.matchIndicatorList(tuple, indicatorList)) {
+ result = true;
+ break;
+ }
+ }
+ return result;
+ }
+
+ protected boolean matchPopulationIndicatorList(EchoBaseResultRepository repository,
+ ExtractRawDataAndResultsRequest request) {
+ Preconditions.checkNotNull(request.getPopulationIndicatorList());
+
+ List<String> indicatorList = request.getPopulationIndicatorList();
+
+ boolean result = false;
+
+ Iterator<String[]> iterator = repository.loadPopulationIndicatorStorage(true);
+ while (iterator.hasNext()) {
+ String[] tuple = iterator.next();
+ if (repository.matchIndicatorList(tuple, indicatorList)) {
+ result = true;
+ break;
+ }
+ }
+ return result;
+ }
+
+ protected boolean matchPopulationIndicatorListAndSpeciesList(EchoBaseResultRepository repository,
+ ExtractRawDataAndResultsRequest request) {
+ Preconditions.checkNotNull(request.getPopulationIndicatorList());
+
+ List<String> indicatorList = request.getPopulationIndicatorList();
+ List<String> speciesList = request.getSpeciesList();
+
+ boolean result = false;
+
+ Iterator<String[]> iterator = repository.loadPopulationIndicatorStorage(true);
+ while (iterator.hasNext()) {
+ String[] tuple = iterator.next();
+ if (repository.matchIndicatorListAndSpeciesList(tuple, indicatorList, speciesList)) {
+ result = true;
+ break;
+ }
+ }
+ return result;
+ }
+
+ protected boolean matchCommunityIndicatorListAndSpeciesList(EchoBaseResultRepository repository,
+ ExtractRawDataAndResultsRequest request) {
+ Preconditions.checkNotNull(request.getCommunityIndicatorList());
+
+ List<String> indicatorList = request.getCommunityIndicatorList();
+ List<String> speciesList = request.getSpeciesList();
+
+ boolean result = false;
+
+ Iterator<String[]> iterator = repository.loadCommunityIndicatorStorage(true);
+ while (iterator.hasNext()) {
+ String[] tuple = iterator.next();
+ if (repository.matchIndicatorListAndSpeciesList(tuple, indicatorList, speciesList)) {
+ result = true;
+ break;
+ }
+ }
+ return result;
+ }
+}
Copied: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/ExtractRawDataCommand.java (from rev 1144, trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/RawDataResultProducer.java)
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/ExtractRawDataCommand.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/ExtractRawDataCommand.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,63 @@
+package fr.ifremer.coser.result.repository.echobase.command;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.coser.result.FileResult;
+import fr.ifremer.coser.result.repository.ResultRepositoryCommand;
+import fr.ifremer.coser.result.repository.echobase.EchoBaseResultRepository;
+import fr.ifremer.coser.result.request.ExtractRawDataRequest;
+
+/**
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class ExtractRawDataCommand implements ResultRepositoryCommand<EchoBaseResultRepository, ExtractRawDataRequest> {
+
+ @Override
+ public Class<ExtractRawDataRequest> getRequestType() {
+ return ExtractRawDataRequest.class;
+ }
+
+ @Override
+ public boolean accept(EchoBaseResultRepository repository,
+ ExtractRawDataRequest request) {
+ return repository.matchFacade(request) &&
+ repository.matchZone(request);
+ }
+
+ @Override
+ public FileResult execute(EchoBaseResultRepository repository,
+ ExtractRawDataRequest r) {
+
+ //TODO
+ throw new IllegalStateException("TODO!");
+ }
+
+ // --------------------------------------------------------------------- //
+ // --- Matchers ------------------------------------------------------- //
+ // --------------------------------------------------------------------- //
+
+ //TODO
+}
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetAllResultsCommand.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetAllResultsCommand.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetAllResultsCommand.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,86 @@
+package fr.ifremer.coser.result.repository.echobase.command;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.collect.Maps;
+import fr.ifremer.coser.result.CoserResult;
+import fr.ifremer.coser.result.MapResult;
+import fr.ifremer.coser.result.ResultType;
+import fr.ifremer.coser.result.repository.ResultRepositoryCommand;
+import fr.ifremer.coser.result.repository.echobase.EchoBaseResultRepository;
+import fr.ifremer.coser.result.repository.echobase.EchoBaseResultRepositoryType;
+import fr.ifremer.coser.result.request.GetAllResultsRequest;
+
+import java.util.Map;
+
+/**
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class GetAllResultsCommand implements ResultRepositoryCommand<EchoBaseResultRepository, GetAllResultsRequest> {
+
+ @Override
+ public Class<GetAllResultsRequest> getRequestType() {
+ return GetAllResultsRequest.class;
+ }
+
+ @Override
+ public boolean accept(EchoBaseResultRepository repository,
+ GetAllResultsRequest request) {
+ boolean result = matchRepositoryType(request) &&
+ matchResultType(request) &&
+ matchPublish(repository);
+ return result;
+ }
+
+ @Override
+ public CoserResult execute(EchoBaseResultRepository repository,
+ GetAllResultsRequest request) {
+ Map<String, String> map = Maps.newHashMap();
+ map.put(repository.getZone(), repository.getSurveyName());
+ MapResult result = new MapResult(repository.getId(), map);
+ return result;
+ }
+
+ // --------------------------------------------------------------------- //
+ // --- Matchers -------------------------------------------------------- //
+ // --------------------------------------------------------------------- //
+
+ protected boolean matchRepositoryType(GetAllResultsRequest request) {
+ boolean result = request.getResultRepositoryType().equals(EchoBaseResultRepositoryType.ID);
+ return result;
+ }
+
+ protected boolean matchResultType(GetAllResultsRequest request) {
+ ResultType resultType = request.getResultType();
+ boolean result = ResultType.MAP_AND_INDICATOR == resultType;
+ return result;
+ }
+
+ protected boolean matchPublish(EchoBaseResultRepository repository) {
+ boolean result = repository.isPubliableResult();
+ return result;
+ }
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetAllResultsCommand.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Copied: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetCommunityIndicatorResultCommand.java (from rev 1144, trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/CommunityIndicatorResultProducer.java)
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetCommunityIndicatorResultCommand.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetCommunityIndicatorResultCommand.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,379 @@
+package fr.ifremer.coser.result.repository.echobase.command;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import fr.ifremer.coser.CoserTechnicalException;
+import fr.ifremer.coser.result.FileResult;
+import fr.ifremer.coser.result.repository.ResultRepositoryCommand;
+import fr.ifremer.coser.result.repository.echobase.EchoBaseResultRepository;
+import fr.ifremer.coser.result.request.GetCommunityIndicatorResultRequest;
+import fr.ifremer.coser.storage.DataStorage;
+import fr.ifremer.coser.storage.DataStorages;
+import fr.ifremer.coser.storage.MemoryDataStorage;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jfree.chart.ChartUtilities;
+import org.jfree.chart.JFreeChart;
+import org.jfree.chart.axis.CategoryAxis;
+import org.jfree.chart.axis.CategoryLabelPositions;
+import org.jfree.chart.axis.NumberAxis;
+import org.jfree.chart.axis.ValueAxis;
+import org.jfree.chart.plot.CategoryPlot;
+import org.jfree.chart.plot.PlotOrientation;
+import org.jfree.chart.renderer.category.CategoryItemRenderer;
+import org.jfree.chart.renderer.category.StatisticalLineAndShapeRenderer;
+import org.jfree.data.statistics.DefaultStatisticalCategoryDataset;
+import org.nuiton.util.FileUtil;
+import org.nuiton.util.ZipUtil;
+
+import java.awt.Color;
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.Map;
+
+/**
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class GetCommunityIndicatorResultCommand implements ResultRepositoryCommand<EchoBaseResultRepository, GetCommunityIndicatorResultRequest> {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(GetCommunityIndicatorResultCommand.class);
+
+ @Override
+ public Class<GetCommunityIndicatorResultRequest> getRequestType() {
+ return GetCommunityIndicatorResultRequest.class;
+ }
+
+ @Override
+ public boolean accept(EchoBaseResultRepository repository, GetCommunityIndicatorResultRequest request) {
+ return repository.matchFacade(request) &&
+ repository.matchZone(request) &&
+ matchIndicatorAndSpeciesList(repository, request);
+ }
+
+ @Override
+ public FileResult execute(EchoBaseResultRepository repository, GetCommunityIndicatorResultRequest r) {
+
+ File file = null;
+ switch (r.getIndicatorResultType()) {
+ case DATA:
+ file = getCommunityIndicatorDataFile(repository,
+ r.getLocale(),
+ r.getIndicator(),
+ r.getSpecies());
+ break;
+
+ case GRAPH:
+ file = getCommunityIndicatorGraphFile(repository,
+ r.getLocale(),
+ r.getZone(),
+ r.getIndicator(),
+ r.getSpecies());
+ break;
+ }
+ FileResult result = new FileResult(repository.getId(), file);
+ return result;
+ }
+
+
+ protected File getCommunityIndicatorDataFile(EchoBaseResultRepository repository, Locale locale,
+ String indicator,
+ String speciesList) {
+
+ try {
+
+ File tempDir = FileUtil.createTempDirectory("coser-chart-population-indicator", "-tmp");
+
+ File baseDir = new File(tempDir, repository.getSurveyName());
+ FileUtils.forceMkdir(baseDir);
+
+ // ajout du fichier csv avec les indicateurs
+ DataStorage dataStorage = new MemoryDataStorage();
+
+ Iterator<String[]> iterator = repository.loadCommunityIndicatorStorage(false);
+
+ // add header
+ dataStorage.add(iterator.next());
+
+ while (iterator.hasNext()) {
+ String[] tuple = iterator.next();
+ if (repository.matchCommunityIndicatorAndSpeciesList(tuple, indicator, speciesList)) {
+ dataStorage.add(tuple);
+ }
+ }
+ File csvFile = DataStorages.save(dataStorage, "coser-chart-community-indicator",
+ ".csv"
+ );
+
+ File csvFileCopied = new File(baseDir, indicator + ".csv");
+ FileUtils.copyFile(csvFile, csvFileCopied);
+ FileUtils.forceDelete(csvFile);
+
+ //TODO See what to generate here (we don't have any selection in echobase results).
+// // ajout du fichier d'information sur les espèces incluses dans
+// // les calculs des indicateurs de communautés
+// // load project (without data to get reftax data)
+// Project project = path.getProject();
+// Selection selection = path.getSelection();
+// File metaFile = webService.generateMetaFilePDF(project,
+// selection,
+// resultDirectory,
+// rSufiResult,
+// indicator,
+// locale);
+// File metaFileCopied = new File(baseDir, "Information.pdf");
+// FileUtils.copyFile(metaFile, metaFileCopied);
+
+ // make zip
+ File result = File.createTempFile("coser-chart-community-indicator", ".zip");
+ result.deleteOnExit();
+ ZipUtil.compress(result, baseDir);
+
+ // clean directory
+ FileUtils.deleteDirectory(tempDir);
+ return result;
+ } catch (Exception e) {
+ throw new CoserTechnicalException("Can't create zip file", e);
+ }
+ }
+
+ protected File getCommunityIndicatorGraphFile(EchoBaseResultRepository repository,
+ Locale locale,
+ String zone,
+ String indicator,
+ String speciesList) {
+
+ // indicator list to take care
+ // pour avoir une valeur non nulle si list est null
+ // on prend dans ce cas la premiere valeur trouvée
+ String localList = speciesList;
+
+ if (log.isDebugEnabled()) {
+ log.debug("Searching list for indicator : " + indicator);
+ }
+
+ int multiplicator = 1;
+ int minYear = Integer.MAX_VALUE;
+ int maxYear = Integer.MIN_VALUE;
+ boolean indicatorFound = false;
+ Map<Integer, Double[]> graphData = new HashMap<Integer, Double[]>();
+ Iterator<String[]> iterator = repository.loadCommunityIndicatorStorage(true);
+ while (iterator.hasNext()) {
+ // Campagne Indicateur Liste Strate Annee Estimation EcartType CV
+ String[] tuple = iterator.next();
+ String indicatorList = tuple[2];
+
+ if (repository.matchIndicatorIndicator(tuple, indicator)) {
+ indicatorFound = true;
+
+ // si pas de list selectionnée, on prend la premiere
+ if (StringUtils.isBlank(localList)) {
+ localList = indicatorList;
+ }
+
+ if (indicatorList.equals(localList)) {
+ Double estimation = Double.parseDouble(tuple[5]);
+ Double ecart = Double.parseDouble(tuple[6]);
+ int year = Integer.parseInt(tuple[4]);
+
+ if (year < minYear) {
+ minYear = year;
+ }
+ if (year > maxYear) {
+ maxYear = year;
+ }
+ graphData.put(year, new Double[]{estimation, ecart});
+
+ // si les données sont énormes, on affiche les données
+ // / multiplicator et on le mentionne dans la légende
+ if (estimation > 1e9) {
+ multiplicator = 1000000;
+ }
+ if (estimation > 1e6 && multiplicator < 1000000) {
+ multiplicator = 1000;
+ }
+ }
+ }
+ }
+
+ File result = null;
+
+ // avec l'extraction des données, on peut demander a générer un graphique
+ // sur un indicateur qui n'est pas présent dans le projet courant,
+ // dans ce cas, on retourne null
+ if (indicatorFound) {
+
+ String zoneDisplayName = repository.getZonesMap().getZoneFullName(zone);
+ String indicatorName = repository.getIndicatorsMap().getIndicatorValue(indicator, locale);
+ String unit = repository.getIndicatorsMap().getIndicatorUnit(indicator);
+
+ // get graph title
+ String chartTitle = zoneDisplayName;
+ chartTitle += " - " + indicatorName;
+
+ // ajout de la traduction de la liste d'indicateur
+ // les liste sont a1, T1, T2 ...
+ String listLetter = String.valueOf(localList.charAt(0));
+ Iterator<String[]> typeIterator = repository.getSpeciesMap().iterator(true);
+ while (typeIterator.hasNext()) {
+ // "Types";"Commentaire";"NumSys min";"NumSys max";"Code"
+ String[] tuple = typeIterator.next();
+ if (tuple[4].equals(listLetter)) {
+ /// gestion du groupe "Tous"
+ // cas special, c'est la seule valeur du fichier
+ // code type espece qui a besoin d'une traduction
+ if (tuple[4].equalsIgnoreCase("T")) {
+ if ("fr".equals(locale.getLanguage())) {
+ chartTitle += " - " + "Tous Liste " + localList.charAt(1);
+ } else if ("es".equals(locale.getLanguage())) {
+ chartTitle += " - " + "Todo Lista " + localList.charAt(1);
+ } else {
+ chartTitle += " - " + "All List " + localList.charAt(1);
+ }
+ } else {
+ // ajout de la traduction du nom de liste plus le numéro
+ if ("fr".equals(locale.getLanguage())) {
+ chartTitle += " - " + tuple[0] + " Liste " + localList.charAt(1);
+ } else if ("es".equals(locale.getLanguage())) {
+ chartTitle += " - " + tuple[0] + " Lista " + localList.charAt(1);
+ } else {
+ chartTitle += " - " + tuple[0] + " List " + localList.charAt(1);
+ }
+ }
+ break;
+ }
+ }
+
+ // generate dataset with sorted data
+ DefaultStatisticalCategoryDataset statisticalDataset = new DefaultStatisticalCategoryDataset();
+ for (int indexYear = minYear; indexYear <= maxYear; ++indexYear) {
+ Double[] entry = graphData.get(indexYear);
+ if (entry != null) {
+ Double estimation = entry[0] / multiplicator;
+ Double ecart = entry[1] / multiplicator;
+ statisticalDataset.add(estimation, ecart, "Serie1", (Comparable) indexYear);
+ } else {
+ statisticalDataset.add(null, null, "Serie1", indexYear);
+ }
+ }
+
+ // configure chart
+ //CategoryAxis categoryAxis = new CategoryAxis(t("coser.business.common.year"));
+ String yearAxis = repository.getReports().getYearChartTitle(locale);
+
+ CategoryAxis categoryAxis = new CategoryAxis(yearAxis);
+ categoryAxis.setCategoryMargin(0);
+ categoryAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
+ // label horizontaux
+ String legendY = indicatorName;
+ if (multiplicator != 1) {
+ // affiche par exemple : cm * 1000
+ legendY += " (" + unit + "*" + multiplicator + ")";
+ } else if (StringUtils.isNotEmpty(unit)) {
+ legendY += " (" + unit + ")";
+ }
+ ValueAxis valueAxis = new NumberAxis(legendY);
+ valueAxis.setUpperMargin(0.1);
+
+ CategoryItemRenderer renderer = new StatisticalLineAndShapeRenderer(false, true);
+
+ // n'affiche pas les nombre sur le graphique
+ //StandardCategoryItemLabelGenerator itemLabelGenerator = new StandardCategoryItemLabelGenerator();
+ //renderer.setBaseItemLabelGenerator(itemLabelGenerator);
+ //renderer.setBaseItemLabelsVisible(true);
+
+ CategoryPlot plot = new CategoryPlot(statisticalDataset, categoryAxis, valueAxis, renderer);
+ plot.setOrientation(PlotOrientation.VERTICAL);
+ JFreeChart chart = new JFreeChart(chartTitle,
+ JFreeChart.DEFAULT_TITLE_FONT, plot, true);
+
+ // remove series legend
+ chart.removeLegend();
+ // white background
+ chart.setBackgroundPaint(Color.WHITE);
+
+ try {
+ result = File.createTempFile("coser-chart-community-indicator-", ".png");
+ result.deleteOnExit();
+ ChartUtilities.saveChartAsPNG(result, chart, 800, 400);
+ } catch (IOException ex) {
+ throw new CoserTechnicalException("Can't save chart", ex);
+ }
+ }
+
+ return result;
+ }
+
+ // --------------------------------------------------------------------- //
+ // --- Matchers -------------------------------------------------------- //
+ // --------------------------------------------------------------------- //
+
+ protected boolean matchIndicator(EchoBaseResultRepository repository,
+ GetCommunityIndicatorResultRequest request) {
+ Preconditions.checkNotNull(request.getIndicator());
+
+ String indicator = request.getIndicator();
+
+ boolean result = false;
+
+ Iterator<String[]> iterator = repository.loadCommunityIndicatorStorage(true);
+ while (iterator.hasNext()) {
+ String[] tuple = iterator.next();
+ if (repository.matchIndicatorIndicator(tuple, indicator)) {
+ result = true;
+ break;
+ }
+ }
+ return result;
+ }
+
+ protected boolean matchIndicatorAndSpeciesList(EchoBaseResultRepository repository,
+ GetCommunityIndicatorResultRequest request) {
+ Preconditions.checkNotNull(request.getIndicator());
+ Preconditions.checkNotNull(request.getSpecies());
+
+ String indicator = request.getIndicator();
+ String speciesList = request.getSpecies();
+
+ boolean result = false;
+
+ Iterator<String[]> iterator = repository.loadCommunityIndicatorStorage(true);
+ while (iterator.hasNext()) {
+ String[] tuple = iterator.next();
+ if (repository.matchCommunityIndicatorAndSpeciesList(tuple, indicator, speciesList)) {
+ result = true;
+ break;
+ }
+ }
+ return result;
+ }
+}
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetIndicatorsForCommunityIndicatorResultCommand.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetIndicatorsForCommunityIndicatorResultCommand.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetIndicatorsForCommunityIndicatorResultCommand.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,64 @@
+package fr.ifremer.coser.result.repository.echobase.command;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.coser.result.MapResult;
+import fr.ifremer.coser.result.repository.ResultRepositoryCommand;
+import fr.ifremer.coser.result.repository.echobase.EchoBaseResultRepository;
+import fr.ifremer.coser.result.request.GetIndicatorsForCommunityIndicatorResultRequest;
+
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class GetIndicatorsForCommunityIndicatorResultCommand implements ResultRepositoryCommand<EchoBaseResultRepository, GetIndicatorsForCommunityIndicatorResultRequest> {
+
+ @Override
+ public Class<GetIndicatorsForCommunityIndicatorResultRequest> getRequestType() {
+ return GetIndicatorsForCommunityIndicatorResultRequest.class;
+ }
+
+ @Override
+ public boolean accept(EchoBaseResultRepository repository,
+ GetIndicatorsForCommunityIndicatorResultRequest request) {
+ return repository.matchFacade(request) &&
+ repository.matchZone(request);
+ }
+
+ @Override
+ public MapResult execute(EchoBaseResultRepository repository,
+ GetIndicatorsForCommunityIndicatorResultRequest request) {
+
+ Set<String> indicatorList = repository.getCommunityIndicators();
+ Map<String, String> map = repository.getIndicatorsMap().getIndicatorsValues(indicatorList, request.getLocale());
+
+ MapResult result = new MapResult(repository.getId(), map);
+ return result;
+ }
+
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetIndicatorsForCommunityIndicatorResultCommand.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetIndicatorsForExtractRawDataAndResultsCommand.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetIndicatorsForExtractRawDataAndResultsCommand.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetIndicatorsForExtractRawDataAndResultsCommand.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,93 @@
+package fr.ifremer.coser.result.repository.echobase.command;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.coser.result.MapResult;
+import fr.ifremer.coser.result.repository.ResultRepositoryCommand;
+import fr.ifremer.coser.result.repository.echobase.EchoBaseResultRepository;
+import fr.ifremer.coser.result.request.GetIndicatorsForExtractRawDataAndResultsRequest;
+import fr.ifremer.coser.util.DataType;
+
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class GetIndicatorsForExtractRawDataAndResultsCommand implements ResultRepositoryCommand<EchoBaseResultRepository, GetIndicatorsForExtractRawDataAndResultsRequest> {
+
+ @Override
+ public Class<GetIndicatorsForExtractRawDataAndResultsRequest> getRequestType() {
+ return GetIndicatorsForExtractRawDataAndResultsRequest.class;
+ }
+
+ @Override
+ public boolean accept(EchoBaseResultRepository repository,
+ GetIndicatorsForExtractRawDataAndResultsRequest request) {
+ return matchExtractTypeSet(request) && matchZoneList(repository, request);
+ }
+
+ @Override
+ public MapResult execute(EchoBaseResultRepository repository,
+ GetIndicatorsForExtractRawDataAndResultsRequest request) {
+
+ Set<String> indicatorList = null;
+
+ if (request.getExtractTypeList().contains(DataType.COMMUNITY)) {
+
+ // get all community indicators for given zone
+ indicatorList = repository.getCommunityIndicators();
+ } else if (request.getExtractTypeList().contains(DataType.POPULATION)) {
+
+ // get all population indicators for given zone
+ indicatorList = repository.getPopulationIndicators();
+ }
+
+ Map<String, String> map = null;
+
+ if (indicatorList != null) {
+ map = repository.getIndicatorsMap().getIndicatorsValues(indicatorList, request.getLocale());
+ }
+
+ MapResult result = new MapResult(repository.getId(), map);
+ return result;
+ }
+
+ // --------------------------------------------------------------------- //
+ // --- Matchers -------------------------------------------------------- //
+ // --------------------------------------------------------------------- //
+
+ protected boolean matchExtractTypeSet(GetIndicatorsForExtractRawDataAndResultsRequest request) {
+ //TODO Should deal also with raw-data type
+ return !request.getExtractTypeList().contains(DataType.SOURCE);
+ }
+
+ protected boolean matchZoneList(EchoBaseResultRepository repository,
+ GetIndicatorsForExtractRawDataAndResultsRequest request) {
+ return request.getZoneList().contains(repository.getZone());
+ }
+
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetIndicatorsForExtractRawDataAndResultsCommand.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetIndicatorsForPopulationIndicatorResultCommand.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetIndicatorsForPopulationIndicatorResultCommand.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetIndicatorsForPopulationIndicatorResultCommand.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,90 @@
+package fr.ifremer.coser.result.repository.echobase.command;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import fr.ifremer.coser.result.MapResult;
+import fr.ifremer.coser.result.repository.ResultRepositoryCommand;
+import fr.ifremer.coser.result.repository.echobase.EchoBaseResultRepository;
+import fr.ifremer.coser.result.request.GetIndicatorsForPopulationIndicatorResultRequest;
+
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class GetIndicatorsForPopulationIndicatorResultCommand implements ResultRepositoryCommand<EchoBaseResultRepository, GetIndicatorsForPopulationIndicatorResultRequest> {
+
+ @Override
+ public Class<GetIndicatorsForPopulationIndicatorResultRequest> getRequestType() {
+ return GetIndicatorsForPopulationIndicatorResultRequest.class;
+ }
+
+ @Override
+ public boolean accept(EchoBaseResultRepository repository,
+ GetIndicatorsForPopulationIndicatorResultRequest request) {
+ return repository.matchFacade(request) &&
+ repository.matchZone(request) &&
+ matchSpecies(repository, request);
+ }
+
+ @Override
+ public MapResult execute(EchoBaseResultRepository repository,
+ GetIndicatorsForPopulationIndicatorResultRequest request) {
+
+ Set<String> indicatorList = repository.getCommunityIndicators();
+ Map<String, String> map = repository.getIndicatorsMap().getIndicatorsValues(indicatorList, request.getLocale());
+
+ MapResult result = new MapResult(repository.getId(), map);
+ return result;
+ }
+
+ // --------------------------------------------------------------------- //
+ // --- Matchers -------------------------------------------------------- //
+ // --------------------------------------------------------------------- //
+
+ protected boolean matchSpecies(EchoBaseResultRepository repository,
+ GetIndicatorsForPopulationIndicatorResultRequest request) {
+ Preconditions.checkNotNull(request.getSpecies());
+
+ String species = request.getSpecies();
+
+ boolean result = false;
+
+ Iterator<String[]> iterator = repository.loadPopulationIndicatorStorage(true);
+ while (iterator.hasNext()) {
+ String[] tuple = iterator.next();
+ if (repository.matchIndicatorSpecies(tuple, species)) {
+ result = true;
+ break;
+ }
+ }
+ return result;
+ }
+
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetIndicatorsForPopulationIndicatorResultCommand.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Copied: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetMapResultCommand.java (from rev 1144, trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/MapResultProducer.java)
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetMapResultCommand.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetMapResultCommand.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,74 @@
+package fr.ifremer.coser.result.repository.echobase.command;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import fr.ifremer.coser.result.FileResult;
+import fr.ifremer.coser.result.repository.ResultRepositoryCommand;
+import fr.ifremer.coser.result.repository.echobase.EchoBaseResultRepository;
+import fr.ifremer.coser.result.request.GetMapResultRequest;
+
+import java.io.File;
+
+/**
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class GetMapResultCommand implements ResultRepositoryCommand<EchoBaseResultRepository, GetMapResultRequest> {
+
+ @Override
+ public Class<GetMapResultRequest> getRequestType() {
+ return GetMapResultRequest.class;
+ }
+
+ @Override
+ public boolean accept(EchoBaseResultRepository repository,
+ GetMapResultRequest request) {
+ return repository.matchFacade(request) &&
+ repository.matchZone(request) &&
+ matchSpecies(repository, request);
+ }
+
+ @Override
+ public FileResult execute(EchoBaseResultRepository repository,
+ GetMapResultRequest request) {
+
+ File file = repository.getMapSpeciesFile(request.getSpecies());
+
+ FileResult result = new FileResult(repository.getId(), file);
+ return result;
+ }
+
+ // --------------------------------------------------------------------- //
+ // --- Matchers -------------------------------------------------------- //
+ // --------------------------------------------------------------------- //
+
+ protected boolean matchSpecies(EchoBaseResultRepository repository,
+ GetMapResultRequest request) {
+ String species = request.getSpecies();
+ File file = repository.getMapSpeciesFile(species);
+ return file != null && file.exists();
+ }
+}
Copied: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetPopulationIndicatorResultCommand.java (from rev 1144, trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/PopulationIndicatorResultProducer.java)
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetPopulationIndicatorResultCommand.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetPopulationIndicatorResultCommand.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,283 @@
+package fr.ifremer.coser.result.repository.echobase.command;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import fr.ifremer.coser.CoserTechnicalException;
+import fr.ifremer.coser.result.FileResult;
+import fr.ifremer.coser.result.repository.ResultRepositoryCommand;
+import fr.ifremer.coser.result.repository.echobase.EchoBaseResultRepository;
+import fr.ifremer.coser.result.request.GetPopulationIndicatorResultRequest;
+import fr.ifremer.coser.storage.DataStorage;
+import fr.ifremer.coser.storage.DataStorages;
+import fr.ifremer.coser.storage.MemoryDataStorage;
+import org.apache.commons.lang3.StringUtils;
+import org.jfree.chart.ChartUtilities;
+import org.jfree.chart.JFreeChart;
+import org.jfree.chart.axis.CategoryAxis;
+import org.jfree.chart.axis.CategoryLabelPositions;
+import org.jfree.chart.axis.NumberAxis;
+import org.jfree.chart.axis.ValueAxis;
+import org.jfree.chart.plot.CategoryPlot;
+import org.jfree.chart.plot.PlotOrientation;
+import org.jfree.chart.renderer.category.CategoryItemRenderer;
+import org.jfree.chart.renderer.category.StatisticalLineAndShapeRenderer;
+import org.jfree.data.statistics.DefaultStatisticalCategoryDataset;
+
+import java.awt.Color;
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.Map;
+
+/**
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class GetPopulationIndicatorResultCommand implements ResultRepositoryCommand<EchoBaseResultRepository, GetPopulationIndicatorResultRequest> {
+
+ @Override
+ public Class<GetPopulationIndicatorResultRequest> getRequestType() {
+ return GetPopulationIndicatorResultRequest.class;
+ }
+
+ @Override
+ public boolean accept(EchoBaseResultRepository repository, GetPopulationIndicatorResultRequest request) {
+ return repository.matchFacade(request) &&
+ repository.matchZone(request) &&
+ matchSpeciesAndIndicator(repository, request);
+ }
+
+ @Override
+ public FileResult execute(EchoBaseResultRepository repository, GetPopulationIndicatorResultRequest r) {
+
+ File file = null;
+ switch (r.getIndicatorResultType()) {
+ case DATA:
+ file = getPopulationIndicatorDataFile(repository,
+ r.getIndicator(),
+ r.getSpecies());
+ break;
+
+ case GRAPH:
+ file = getPopulationIndicatorGraphFile(repository,
+ r.getLocale(),
+ r.getZone(),
+ r.getIndicator(),
+ r.getSpecies());
+ break;
+ }
+
+
+ FileResult result = new FileResult(repository.getId(), file);
+ return result;
+ }
+
+ protected File getPopulationIndicatorDataFile(EchoBaseResultRepository repository, String species, String indicator) {
+
+ DataStorage dataStorage = new MemoryDataStorage();
+
+ Iterator<String[]> iterator = repository.loadPopulationIndicatorStorage(false);
+
+ // add header
+ dataStorage.add(iterator.next());
+
+ while (iterator.hasNext()) {
+ String[] tuple = iterator.next();
+ if (repository.matchIndicatorSpeciesAndIndicator(tuple, species, indicator)) {
+ dataStorage.add(tuple);
+ }
+ }
+ File result = DataStorages.save(dataStorage, "coser-chart-population-indicator",
+ ".csv"
+ );
+ return result;
+ }
+
+ protected File getPopulationIndicatorGraphFile(EchoBaseResultRepository repository, Locale locale,
+ String zone,
+ String species,
+ String indicator) {
+
+
+ int multiplicator = 1;
+ int minYear = Integer.MAX_VALUE;
+ int maxYear = Integer.MIN_VALUE;
+ boolean indicatorFound = false;
+ Map<Integer, Double[]> graphData = new HashMap<Integer, Double[]>();
+ Iterator<String[]> iterator = repository.loadPopulationIndicatorStorage(true);
+ while (iterator.hasNext()) {
+ String[] tuple = iterator.next();
+
+ if (repository.matchIndicatorSpeciesAndIndicator(tuple, species, indicator)) {
+ indicatorFound = true;
+
+ // XXX echatellier, maybe take care of list here ?
+
+ Double estimation = Double.parseDouble(tuple[6]);
+ Double ecart = Double.parseDouble(tuple[7]);
+ int year = Integer.parseInt(tuple[5]);
+
+ if (year < minYear) {
+ minYear = year;
+ }
+ if (year > maxYear) {
+ maxYear = year;
+ }
+ graphData.put(year, new Double[]{estimation, ecart});
+
+ // si les données sont énormes, on affiche les données
+ // / multiplicator et on le mentionne dans la légende
+ if (estimation > 1e9) {
+ multiplicator = 1000000;
+ }
+ if (estimation > 1e6 && multiplicator < 1000000) {
+ multiplicator = 1000;
+ }
+ }
+ }
+
+ File result = null;
+
+ // avec l'extraction des données, on peut demander a générer un graphique
+ // sur un indicateur qui n'est pas présent dans le projet courant,
+ // dans ce cas, on retourne null
+ if (indicatorFound) {
+
+ String zoneDisplayName = repository.getZonesMap().getZoneFullName(zone);
+ String indicatorName = repository.getIndicatorsMap().getIndicatorValue(indicator, locale);
+ String unit = repository.getIndicatorsMap().getIndicatorUnit(indicator);
+
+ // get graph title
+ String title = zoneDisplayName;
+ title += " - " + indicatorName;
+ title += " - " + repository.getSpeciesMap().getReportDisplayName(species);
+
+ // generate dataset with sorted data
+ DefaultStatisticalCategoryDataset statisticalDataset = new DefaultStatisticalCategoryDataset();
+ for (int indexYear = minYear; indexYear <= maxYear; ++indexYear) {
+ Double[] entry = graphData.get(indexYear);
+ if (entry != null) {
+ Double estimation = entry[0] / multiplicator;
+ Double ecart = entry[1] / multiplicator;
+ statisticalDataset.add(estimation, ecart, "Serie1", (Comparable) indexYear);
+ } else {
+ statisticalDataset.add(null, null, "Serie1", indexYear);
+ }
+ }
+
+ // configure chart
+ //CategoryAxis categoryAxis = new CategoryAxis(t("coser.business.common.year"));
+ String yearAxis = repository.getReports().getYearChartTitle(locale);
+ CategoryAxis categoryAxis = new CategoryAxis(yearAxis);
+ categoryAxis.setCategoryMargin(0);
+ categoryAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
+ // label horizontaux
+ String legendY = indicatorName;
+ if (multiplicator != 1) {
+ // affiche par exemple : cm * 1000
+ legendY += " (" + unit + "*" + multiplicator + ")";
+ } else if (StringUtils.isNotEmpty(unit)) {
+ legendY += " (" + unit + ")";
+ }
+ ValueAxis valueAxis = new NumberAxis(legendY);
+ valueAxis.setUpperMargin(0.1);
+
+ CategoryItemRenderer renderer = new StatisticalLineAndShapeRenderer(false, true);
+
+ // n'affiche pas les nombre sur le graphique
+ //StandardCategoryItemLabelGenerator itemLabelGenerator = new StandardCategoryItemLabelGenerator();
+ //renderer.setBaseItemLabelGenerator(itemLabelGenerator);
+ //renderer.setBaseItemLabelsVisible(true);
+
+ CategoryPlot plot = new CategoryPlot(statisticalDataset, categoryAxis, valueAxis, renderer);
+ plot.setOrientation(PlotOrientation.VERTICAL);
+ JFreeChart chart = new JFreeChart(title,
+ JFreeChart.DEFAULT_TITLE_FONT, plot, true);
+
+ // remove series legend
+ chart.removeLegend();
+ // white background
+ chart.setBackgroundPaint(Color.WHITE);
+
+ try {
+ result = File.createTempFile("coser-chart-population-indicator-", ".png");
+ result.deleteOnExit();
+ ChartUtilities.saveChartAsPNG(result, chart, 800, 400);
+ } catch (IOException ex) {
+ throw new CoserTechnicalException("Can't save chart", ex);
+ }
+ }
+
+ return result;
+ }
+
+ // --------------------------------------------------------------------- //
+ // --- Matchers -------------------------------------------------------- //
+ // --------------------------------------------------------------------- //
+
+ protected boolean matchSpecies(EchoBaseResultRepository repository,
+ GetPopulationIndicatorResultRequest request) {
+ Preconditions.checkNotNull(request.getSpecies());
+
+ String species = request.getSpecies();
+
+ boolean result = false;
+
+ Iterator<String[]> iterator = repository.loadPopulationIndicatorStorage(true);
+ while (iterator.hasNext()) {
+ String[] tuple = iterator.next();
+ if (repository.matchIndicatorSpecies(tuple, species)) {
+ result = true;
+ break;
+ }
+ }
+ return result;
+ }
+
+ protected boolean matchSpeciesAndIndicator(EchoBaseResultRepository repository,
+ GetPopulationIndicatorResultRequest request) {
+ Preconditions.checkNotNull(request.getSpecies());
+ Preconditions.checkNotNull(request.getIndicator());
+
+ String species = request.getSpecies();
+ String indicator = request.getIndicator();
+
+ boolean result = false;
+
+ Iterator<String[]> iterator = repository.loadPopulationIndicatorStorage(true);
+ while (iterator.hasNext()) {
+ String[] tuple = iterator.next();
+ if (repository.matchIndicatorSpeciesAndIndicator(tuple, species, indicator)) {
+ result = true;
+ break;
+ }
+ }
+ return result;
+ }
+
+}
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetSpeciesForMapResultCommand.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetSpeciesForMapResultCommand.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetSpeciesForMapResultCommand.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,64 @@
+package fr.ifremer.coser.result.repository.echobase.command;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.coser.result.MapResult;
+import fr.ifremer.coser.result.repository.ResultRepositoryCommand;
+import fr.ifremer.coser.result.repository.echobase.EchoBaseResultRepository;
+import fr.ifremer.coser.result.request.GetSpeciesForMapResultRequest;
+
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class GetSpeciesForMapResultCommand implements ResultRepositoryCommand<EchoBaseResultRepository, GetSpeciesForMapResultRequest> {
+
+ @Override
+ public Class<GetSpeciesForMapResultRequest> getRequestType() {
+ return GetSpeciesForMapResultRequest.class;
+ }
+
+ @Override
+ public boolean accept(EchoBaseResultRepository repository,
+ GetSpeciesForMapResultRequest request) {
+ return repository.matchFacade(request) &&
+ repository.matchZone(request);
+ }
+
+ @Override
+ public MapResult execute(EchoBaseResultRepository repository,
+ GetSpeciesForMapResultRequest request) {
+
+ Set<String> speciesList = repository.getMapSpecies();
+ Map<String, String> map = repository.getSpeciesMap().getSpeciesSubMap(speciesList);
+
+ MapResult result = new MapResult(repository.getId(), map);
+ return result;
+ }
+
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetSpeciesForMapResultCommand.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetSpeciesForPopulationIndicatorResultCommand.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetSpeciesForPopulationIndicatorResultCommand.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetSpeciesForPopulationIndicatorResultCommand.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,64 @@
+package fr.ifremer.coser.result.repository.echobase.command;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.coser.result.MapResult;
+import fr.ifremer.coser.result.repository.ResultRepositoryCommand;
+import fr.ifremer.coser.result.repository.echobase.EchoBaseResultRepository;
+import fr.ifremer.coser.result.request.GetSpeciesForPopulationIndicatorResultRequest;
+
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class GetSpeciesForPopulationIndicatorResultCommand implements ResultRepositoryCommand<EchoBaseResultRepository, GetSpeciesForPopulationIndicatorResultRequest> {
+
+ @Override
+ public Class<GetSpeciesForPopulationIndicatorResultRequest> getRequestType() {
+ return GetSpeciesForPopulationIndicatorResultRequest.class;
+ }
+
+ @Override
+ public boolean accept(EchoBaseResultRepository repository,
+ GetSpeciesForPopulationIndicatorResultRequest request) {
+ return repository.matchFacade(request) &&
+ repository.matchZone(request);
+ }
+
+ @Override
+ public MapResult execute(EchoBaseResultRepository repository,
+ GetSpeciesForPopulationIndicatorResultRequest request) {
+
+ Set<String> speciesList = repository.getPopulationIndicatorSpecies();
+ Map<String, String> map = repository.getSpeciesMap().getSpeciesSubMap(speciesList);
+
+ MapResult result = new MapResult(repository.getId(), map);
+ return result;
+ }
+
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetSpeciesForPopulationIndicatorResultCommand.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetSpeciesListForCommunityIndicatorResultCommand.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetSpeciesListForCommunityIndicatorResultCommand.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetSpeciesListForCommunityIndicatorResultCommand.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,89 @@
+package fr.ifremer.coser.result.repository.echobase.command;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import fr.ifremer.coser.result.MapResult;
+import fr.ifremer.coser.result.repository.ResultRepositoryCommand;
+import fr.ifremer.coser.result.repository.echobase.EchoBaseResultRepository;
+import fr.ifremer.coser.result.request.GetSpeciesListForCommunityIndicatorResultRequest;
+
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class GetSpeciesListForCommunityIndicatorResultCommand implements ResultRepositoryCommand<EchoBaseResultRepository, GetSpeciesListForCommunityIndicatorResultRequest> {
+
+ @Override
+ public Class<GetSpeciesListForCommunityIndicatorResultRequest> getRequestType() {
+ return GetSpeciesListForCommunityIndicatorResultRequest.class;
+ }
+
+ @Override
+ public boolean accept(EchoBaseResultRepository repository,
+ GetSpeciesListForCommunityIndicatorResultRequest request) {
+ return repository.matchFacade(request) &&
+ repository.matchZone(request) &&
+ matchIndicator(repository, request);
+ }
+
+ @Override
+ public MapResult execute(EchoBaseResultRepository repository,
+ GetSpeciesListForCommunityIndicatorResultRequest request) {
+
+ Set<String> speciesList = repository.getCommunityIndicatorSpecies(request.getIndicator());
+ Map<String, String> map = repository.getSpeciesMap().getSpeciesSubMap(speciesList);
+
+ MapResult result = new MapResult(repository.getId(), map);
+ return result;
+ }
+
+ // --------------------------------------------------------------------- //
+ // --- Matchers -------------------------------------------------------- //
+ // --------------------------------------------------------------------- //
+
+ protected boolean matchIndicator(EchoBaseResultRepository repository,
+ GetSpeciesListForCommunityIndicatorResultRequest request) {
+ Preconditions.checkNotNull(request.getIndicator());
+
+ String indicator = request.getIndicator();
+
+ boolean result = false;
+
+ Iterator<String[]> iterator = repository.loadCommunityIndicatorStorage(true);
+ while (iterator.hasNext()) {
+ String[] tuple = iterator.next();
+ if (repository.matchIndicatorIndicator(tuple, indicator)) {
+ result = true;
+ break;
+ }
+ }
+ return result;
+ }
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetSpeciesListForCommunityIndicatorResultCommand.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetSpeciesListForExtractRawDataAndResultsCommand.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetSpeciesListForExtractRawDataAndResultsCommand.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetSpeciesListForExtractRawDataAndResultsCommand.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,84 @@
+package fr.ifremer.coser.result.repository.echobase.command;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.collect.Sets;
+import fr.ifremer.coser.result.MapResult;
+import fr.ifremer.coser.result.repository.ResultRepositoryCommand;
+import fr.ifremer.coser.result.repository.echobase.EchoBaseResultRepository;
+import fr.ifremer.coser.result.request.GetSpeciesListForExtractRawDataAndResultsRequest;
+import fr.ifremer.coser.util.DataType;
+
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class GetSpeciesListForExtractRawDataAndResultsCommand implements ResultRepositoryCommand<EchoBaseResultRepository, GetSpeciesListForExtractRawDataAndResultsRequest> {
+
+ @Override
+ public Class<GetSpeciesListForExtractRawDataAndResultsRequest> getRequestType() {
+ return GetSpeciesListForExtractRawDataAndResultsRequest.class;
+ }
+
+ @Override
+ public boolean accept(EchoBaseResultRepository repository,
+ GetSpeciesListForExtractRawDataAndResultsRequest request) {
+ return matchExtractTypeSet(request) && matchZoneList(repository, request);
+ }
+
+ @Override
+ public MapResult execute(EchoBaseResultRepository repository,
+ GetSpeciesListForExtractRawDataAndResultsRequest request) {
+
+ Set<String> speciesList = Sets.newHashSet();
+ // get all species for population indicators
+ speciesList.addAll(repository.getPopulationIndicatorSpecies());
+ // get all species for community indicators
+ speciesList.addAll(repository.getCommunityIndicatorSpecies());
+
+ Map<String, String> map = repository.getSpeciesMap().getSpeciesSubMap(speciesList);
+
+ MapResult result = new MapResult(repository.getId(), map);
+ return result;
+ }
+
+ // --------------------------------------------------------------------- //
+ // --- Matchers -------------------------------------------------------- //
+ // --------------------------------------------------------------------- //
+
+ protected boolean matchExtractTypeSet(GetSpeciesListForExtractRawDataAndResultsRequest request) {
+ //TODO Should deal also with raw-data type
+ return !request.getExtractTypeList().contains(DataType.SOURCE);
+ }
+
+ protected boolean matchZoneList(EchoBaseResultRepository repository,
+ GetSpeciesListForExtractRawDataAndResultsRequest request) {
+ return request.getZoneList().contains(repository.getZone());
+ }
+
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetSpeciesListForExtractRawDataAndResultsCommand.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetZonesForCommunityIndicatorResultCommand.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetZonesForCommunityIndicatorResultCommand.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetZonesForCommunityIndicatorResultCommand.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,64 @@
+package fr.ifremer.coser.result.repository.echobase.command;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.coser.bean.ZoneMap;
+import fr.ifremer.coser.result.MapResult;
+import fr.ifremer.coser.result.repository.ResultRepositoryCommand;
+import fr.ifremer.coser.result.repository.echobase.EchoBaseResultRepository;
+import fr.ifremer.coser.result.request.GetZonesForCommunityIndicatorResultRequest;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class GetZonesForCommunityIndicatorResultCommand implements ResultRepositoryCommand<EchoBaseResultRepository, GetZonesForCommunityIndicatorResultRequest> {
+
+ @Override
+ public Class<GetZonesForCommunityIndicatorResultRequest> getRequestType() {
+ return GetZonesForCommunityIndicatorResultRequest.class;
+ }
+
+ @Override
+ public boolean accept(EchoBaseResultRepository repository,
+ GetZonesForCommunityIndicatorResultRequest request) {
+ return repository.matchFacade(request);
+ }
+
+ @Override
+ public MapResult execute(EchoBaseResultRepository repository,
+ GetZonesForCommunityIndicatorResultRequest request) {
+
+ ZoneMap zonesMap = repository.getZonesMap();
+ List<String> allowedZones = zonesMap.getZonesForFacade(request.getFacade());
+ Map<String, String> map = zonesMap.getSubZonesMap(repository.getZone(), allowedZones);
+ MapResult result = new MapResult(repository.getId(), map);
+ return result;
+ }
+
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetZonesForCommunityIndicatorResultCommand.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetZonesForExtractRawDataAndResultsCommand.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetZonesForExtractRawDataAndResultsCommand.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetZonesForExtractRawDataAndResultsCommand.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,65 @@
+package fr.ifremer.coser.result.repository.echobase.command;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.coser.bean.ZoneMap;
+import fr.ifremer.coser.result.MapResult;
+import fr.ifremer.coser.result.repository.ResultRepositoryCommand;
+import fr.ifremer.coser.result.repository.echobase.EchoBaseResultRepository;
+import fr.ifremer.coser.result.request.GetZonesForExtractRawDataAndResultsRequest;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class GetZonesForExtractRawDataAndResultsCommand implements ResultRepositoryCommand<EchoBaseResultRepository, GetZonesForExtractRawDataAndResultsRequest> {
+
+ @Override
+ public Class<GetZonesForExtractRawDataAndResultsRequest> getRequestType() {
+ return GetZonesForExtractRawDataAndResultsRequest.class;
+ }
+
+ @Override
+ public boolean accept(EchoBaseResultRepository repository,
+ GetZonesForExtractRawDataAndResultsRequest request) {
+ return true;
+ }
+
+ @Override
+ public MapResult execute(EchoBaseResultRepository repository,
+ GetZonesForExtractRawDataAndResultsRequest r) {
+
+ ZoneMap zonesMap = repository.getZonesMap();
+ List<String> allowedZones = zonesMap.getZonesForFacade(null);
+ Map<String, String> map = zonesMap.getSubZonesMap(repository.getZone(), allowedZones);
+
+ MapResult result = new MapResult(repository.getId(), map);
+ return result;
+ }
+
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetZonesForExtractRawDataAndResultsCommand.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetZonesForExtractRawDataCommand.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetZonesForExtractRawDataCommand.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetZonesForExtractRawDataCommand.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,63 @@
+package fr.ifremer.coser.result.repository.echobase.command;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.coser.bean.ZoneMap;
+import fr.ifremer.coser.result.MapResult;
+import fr.ifremer.coser.result.repository.ResultRepositoryCommand;
+import fr.ifremer.coser.result.repository.echobase.EchoBaseResultRepository;
+import fr.ifremer.coser.result.request.GetZonesForExtractRawDataRequest;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class GetZonesForExtractRawDataCommand implements ResultRepositoryCommand<EchoBaseResultRepository, GetZonesForExtractRawDataRequest> {
+
+ @Override
+ public Class<GetZonesForExtractRawDataRequest> getRequestType() {
+ return GetZonesForExtractRawDataRequest.class;
+ }
+
+ @Override
+ public boolean accept(EchoBaseResultRepository repository,
+ GetZonesForExtractRawDataRequest request) {
+ return repository.matchFacade(request);
+ }
+
+ @Override
+ public MapResult execute(EchoBaseResultRepository repository,
+ GetZonesForExtractRawDataRequest request) {
+ ZoneMap zonesMap = repository.getZonesMap();
+ List<String> allowedZones = zonesMap.getZonesForFacade(request.getFacade());
+ Map<String, String> map = zonesMap.getSubZonesMap(repository.getZone(), allowedZones);
+
+ MapResult result = new MapResult(repository.getId(), map);
+ return result;
+ }
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetZonesForExtractRawDataCommand.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetZonesForMapResultCommand.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetZonesForMapResultCommand.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetZonesForMapResultCommand.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,65 @@
+package fr.ifremer.coser.result.repository.echobase.command;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.coser.bean.ZoneMap;
+import fr.ifremer.coser.result.MapResult;
+import fr.ifremer.coser.result.repository.ResultRepositoryCommand;
+import fr.ifremer.coser.result.repository.echobase.EchoBaseResultRepository;
+import fr.ifremer.coser.result.request.GetZonesForMapResultRequest;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class GetZonesForMapResultCommand implements ResultRepositoryCommand<EchoBaseResultRepository, GetZonesForMapResultRequest> {
+
+ @Override
+ public Class<GetZonesForMapResultRequest> getRequestType() {
+ return GetZonesForMapResultRequest.class;
+ }
+
+ @Override
+ public boolean accept(EchoBaseResultRepository repository,
+ GetZonesForMapResultRequest request) {
+ return repository.matchFacade(request);
+ }
+
+ @Override
+ public MapResult execute(EchoBaseResultRepository repository,
+ GetZonesForMapResultRequest request) {
+
+ ZoneMap zonesMap = repository.getZonesMap();
+ List<String> allowedZones = zonesMap.getZonesForFacade(request.getFacade());
+ Map<String, String> map = zonesMap.getSubZonesMap(repository.getZone(), allowedZones);
+
+ MapResult result = new MapResult(repository.getId(), map);
+ return result;
+ }
+
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetZonesForMapResultCommand.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetZonesForPopulationIndicatorResultCommand.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetZonesForPopulationIndicatorResultCommand.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetZonesForPopulationIndicatorResultCommand.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,64 @@
+package fr.ifremer.coser.result.repository.echobase.command;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.coser.bean.ZoneMap;
+import fr.ifremer.coser.result.MapResult;
+import fr.ifremer.coser.result.repository.ResultRepositoryCommand;
+import fr.ifremer.coser.result.repository.echobase.EchoBaseResultRepository;
+import fr.ifremer.coser.result.request.GetZonesForPopulationIndicatorResultRequest;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class GetZonesForPopulationIndicatorResultCommand implements ResultRepositoryCommand<EchoBaseResultRepository, GetZonesForPopulationIndicatorResultRequest> {
+
+ @Override
+ public Class<GetZonesForPopulationIndicatorResultRequest> getRequestType() {
+ return GetZonesForPopulationIndicatorResultRequest.class;
+ }
+
+ @Override
+ public boolean accept(EchoBaseResultRepository repository,
+ GetZonesForPopulationIndicatorResultRequest request) {
+ return repository.matchFacade(request);
+ }
+
+ @Override
+ public MapResult execute(EchoBaseResultRepository repository,
+ GetZonesForPopulationIndicatorResultRequest request) {
+ ZoneMap zonesMap = repository.getZonesMap();
+ List<String> allowedZones = zonesMap.getZonesForFacade(request.getFacade());
+ Map<String, String> map = zonesMap.getSubZonesMap(repository.getZone(), allowedZones);
+
+ MapResult result = new MapResult(repository.getId(), map);
+ return result;
+ }
+
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/command/GetZonesForPopulationIndicatorResultCommand.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Deleted: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/CommunityIndicatorResultProducer.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/CommunityIndicatorResultProducer.java 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/CommunityIndicatorResultProducer.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -1,455 +0,0 @@
-package fr.ifremer.coser.result.repository.legacy;
-
-/*
- * #%L
- * Coser :: Business
- * %%
- * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>.
- * #L%
- */
-
-import com.google.common.base.Preconditions;
-import fr.ifremer.coser.CoserTechnicalException;
-import fr.ifremer.coser.bean.RSufiResultPath;
-import fr.ifremer.coser.bean.ZoneMap;
-import fr.ifremer.coser.result.FileResult;
-import fr.ifremer.coser.result.Reports;
-import fr.ifremer.coser.result.repository.ResultProducer;
-import fr.ifremer.coser.result.request.CommunityIndicatorRequest;
-import fr.ifremer.coser.services.ProjectService;
-import fr.ifremer.coser.storage.DataStorage;
-import fr.ifremer.coser.storage.DataStorages;
-import fr.ifremer.coser.storage.MemoryDataStorage;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jfree.chart.ChartUtilities;
-import org.jfree.chart.JFreeChart;
-import org.jfree.chart.axis.CategoryAxis;
-import org.jfree.chart.axis.CategoryLabelPositions;
-import org.jfree.chart.axis.NumberAxis;
-import org.jfree.chart.axis.ValueAxis;
-import org.jfree.chart.plot.CategoryPlot;
-import org.jfree.chart.plot.PlotOrientation;
-import org.jfree.chart.renderer.category.CategoryItemRenderer;
-import org.jfree.chart.renderer.category.StatisticalLineAndShapeRenderer;
-import org.jfree.data.statistics.DefaultStatisticalCategoryDataset;
-import org.nuiton.util.FileUtil;
-import org.nuiton.util.ZipUtil;
-
-import java.awt.Color;
-import java.io.File;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Created on 3/11/14.
- *
- * @author Tony Chemit <chemit(a)codelutin.com>
- * @since 1.5
- */
-public class CommunityIndicatorResultProducer implements ResultProducer<CommunityIndicatorRequest> {
-
- /** Logger. */
- private static final Log log = LogFactory.getLog(CommunityIndicatorResultProducer.class);
-
- protected final LegacyResultRepository repository;
-
- protected final Reports reports;
-
- protected final RSufiResultPath path;
-
- protected final File basedir;
-
- protected final ProjectService projectService;
-
- protected final String surveyName;
-
- public CommunityIndicatorResultProducer(LegacyResultRepository repository) {
- this.repository = repository;
- this.path = repository.path;
- this.reports = repository.reports;
- this.projectService = repository.projectService;
- this.basedir = repository.basedir;
- this.surveyName = repository.surveyName;
- }
-
- @Override
- public LegacyResultRepository getRepository() {
- return repository;
- }
-
- @Override
- public boolean acceptResult(CommunityIndicatorRequest request) {
- return repository.indicatorsResult &&
- repository.matchFacade(request) &&
- repository.matchZone(request) &&
- matchIndicatorAndSpeciesList(request);
- }
-
- @Override
- public Map<String, String> getAvailableZones(CommunityIndicatorRequest request) {
- Preconditions.checkNotNull(request.getFacade());
-
- boolean match = repository.matchFacade(request);
-
- Map<String, String> result = null;
- if (match) {
- ZoneMap zonesMap = repository.getZonesMap();
- List<String> allowedZones = zonesMap.getZonesForFacade(request.getFacade());
- result = zonesMap.getSubZonesMap(path.getRsufiResult().getZone(), allowedZones);
- }
- return result;
- }
-
- @Override
- public Map<String, String> getAvailableSpecies(CommunityIndicatorRequest request) {
- Preconditions.checkNotNull(request.getFacade());
- Preconditions.checkNotNull(request.getZone());
- Preconditions.checkNotNull(request.getIndicator());
-
- Map<String, String> result = null;
-
- boolean match = repository.indicatorsResult &&
- repository.matchFacade(request) &&
- repository.matchZone(request) &&
- matchIndicator(request);
- if (match) {
-
- // get all map species for given facade + zone
- result = repository.getCommunityIndicatorSpecies(request.getLocale(),
- request.getIndicator());
- }
- return result;
- }
-
- @Override
- public Map<String, String> getAvailableIndicators(CommunityIndicatorRequest request) {
- Preconditions.checkNotNull(request.getFacade());
- Preconditions.checkNotNull(request.getZone());
-
- Map<String, String> result = null;
-
- boolean match = repository.indicatorsResult &&
- repository.matchFacade(request) &&
- repository.matchZone(request);
- if (match) {
-
- // get all indicators for given facade + zone
- Set<String> indicatorList = repository.getCommunityIndicators();
- result = repository.getIndicatorsMap().getIndicatorsValues(indicatorList, request.getLocale());
- }
-
- return result;
- }
-
- @Override
- public FileResult produceResult(CommunityIndicatorRequest request) {
-
- File file = null;
- switch (request.getResultType()) {
- case DATA:
- file = getCommunityIndicatorDataFile(request.getLocale(),
- request.getIndicator(),
- request.getSpecies());
- break;
-
- case GRAPH:
- file = getCommunityIndicatorGraphFile(request.getLocale(),
- request.getZone(),
- request.getIndicator(),
- request.getSpecies());
- break;
- }
- FileResult result = new FileResult(repository.getId(), file);
- return result;
- }
-
-
- protected File getCommunityIndicatorDataFile(Locale locale,
- String indicator,
- String speciesList) {
-
- try {
-
- File tempDir = FileUtil.createTempDirectory("coser-chart-population-indicator", "-tmp");
-
- File baseDir = new File(tempDir, surveyName);
- FileUtils.forceMkdir(baseDir);
-
- // ajout du fichier csv avec les indicateurs
- DataStorage dataStorage = new MemoryDataStorage();
-
- Iterator<String[]> iterator = repository.loadCommunityIndicatorStorage(false);
-
- // add header
- dataStorage.add(iterator.next());
-
- while (iterator.hasNext()) {
- String[] tuple = iterator.next();
- if (repository.matchCommunityIndicatorAndSpeciesList(tuple, indicator, speciesList)) {
- dataStorage.add(tuple);
- }
- }
- File csvFile = DataStorages.save(dataStorage, "coser-chart-community-indicator",
- ".csv"
- );
-
- File csvFileCopied = new File(baseDir, indicator + ".csv");
- FileUtils.copyFile(csvFile, csvFileCopied);
- FileUtils.forceDelete(csvFile);
-
- // ajout du fichier d'information sur les espèces incluses dans
- // les calculs des indicateurs de communautés
- // load project (without data to get reftax data)
- File metaFile = reports.generateMetaFilePDF(path,
- repository.resultDirectory,
- locale,
- repository.getIndicatorsMap()
- );
- File metaFileCopied = new File(baseDir, "Information.pdf");
- FileUtils.copyFile(metaFile, metaFileCopied);
-
- // make zip
- File result = File.createTempFile("coser-chart-community-indicator", ".zip");
- result.deleteOnExit();
- ZipUtil.compress(result, baseDir);
-
- // clean directory
- FileUtils.deleteDirectory(tempDir);
- return result;
- } catch (Exception e) {
- throw new CoserTechnicalException("Can't create zip file", e);
- }
- }
-
- protected File getCommunityIndicatorGraphFile(Locale locale,
- String zone,
- String indicator,
- String speciesList) {
-
- // indicator list to take care
- // pour avoir une valeur non nulle si list est null
- // on prend dans ce cas la premiere valeur trouvée
- String localList = speciesList;
-
- if (log.isDebugEnabled()) {
- log.debug("Searching list for indicator : " + indicator);
- }
-
- int multiplicator = 1;
- int minYear = Integer.MAX_VALUE;
- int maxYear = Integer.MIN_VALUE;
- boolean indicatorFound = false;
- Map<Integer, Double[]> graphData = new HashMap<Integer, Double[]>();
- Iterator<String[]> iterator = repository.loadCommunityIndicatorStorage(true);
- while (iterator.hasNext()) {
- // Campagne Indicateur Liste Strate Annee Estimation EcartType CV
- String[] tuple = iterator.next();
- String indicatorList = tuple[2];
-
- if (repository.matchCommunityIndicator(tuple, indicator)) {
- indicatorFound = true;
-
- // si pas de list selectionnée, on prend la premiere
- if (StringUtils.isBlank(localList)) {
- localList = indicatorList;
- }
-
- if (indicatorList.equals(localList)) {
- Double estimation = Double.parseDouble(tuple[5]);
- Double ecart = Double.parseDouble(tuple[6]);
- int year = Integer.parseInt(tuple[4]);
-
- if (year < minYear) {
- minYear = year;
- }
- if (year > maxYear) {
- maxYear = year;
- }
- graphData.put(year, new Double[]{estimation, ecart});
-
- // si les données sont énormes, on affiche les données
- // / multiplicator et on le mentionne dans la légende
- if (estimation > 1e9) {
- multiplicator = 1000000;
- }
- if (estimation > 1e6 && multiplicator < 1000000) {
- multiplicator = 1000;
- }
- }
- }
- }
-
- File result = null;
-
- // avec l'extraction des données, on peut demander a générer un graphique
- // sur un indicateur qui n'est pas présent dans le projet courant,
- // dans ce cas, on retourne null
- if (indicatorFound) {
-
- String zoneDisplayName = repository.getZonesMap().getZoneFullName(zone);
- String indicatorName = repository.getIndicatorsMap().getIndicatorValue(indicator, locale);
- String unit = repository.getIndicatorsMap().getIndicatorUnit(indicator);
-
- // get graph title
- String chartTitle = zoneDisplayName;
- chartTitle += " - " + indicatorName;
-
- String speciesListName = repository.getSpeciesListMap().getSpeciesListName(locale, localList);
- chartTitle += " - " + speciesListName;
-// // ajout de la traduction de la liste d'indicateur
-// // les liste sont a1, T1, T2 ...
-// String listLetter = String.valueOf(localList.charAt(0));
-// Iterator<String[]> typeIterator = repository.getSpeciesListMap().iterator(true);
-// while (typeIterator.hasNext()) {
-// // "Types";"Commentaire";"NumSys min";"NumSys max";"Code"
-// String[] tuple = typeIterator.next();
-// if (tuple[4].equals(listLetter)) {
-// /// gestion du groupe "Tous"
-// // cas special, c'est la seule valeur du fichier
-// // code type espece qui a besoin d'une traduction
-// if (tuple[4].equalsIgnoreCase("T")) {
-// if ("fr".equals(locale.getLanguage())) {
-// chartTitle += " - " + "Tous Liste " + localList.charAt(1);
-// } else if ("es".equals(locale.getLanguage())) {
-// chartTitle += " - " + "Todo Lista " + localList.charAt(1);
-// } else {
-// chartTitle += " - " + "All List " + localList.charAt(1);
-// }
-// } else {
-// // ajout de la traduction du nom de liste plus le numéro
-// if ("fr".equals(locale.getLanguage())) {
-// chartTitle += " - " + tuple[0] + " Liste " + localList.charAt(1);
-// } else if ("es".equals(locale.getLanguage())) {
-// chartTitle += " - " + tuple[0] + " Lista " + localList.charAt(1);
-// } else {
-// chartTitle += " - " + tuple[0] + " List " + localList.charAt(1);
-// }
-// }
-// break;
-// }
-// }
-
- // generate dataset with sorted data
- DefaultStatisticalCategoryDataset statisticalDataset = new DefaultStatisticalCategoryDataset();
- for (int indexYear = minYear; indexYear <= maxYear; ++indexYear) {
- Double[] entry = graphData.get(indexYear);
- if (entry != null) {
- Double estimation = entry[0] / multiplicator;
- Double ecart = entry[1] / multiplicator;
- statisticalDataset.add(estimation, ecart, "Serie1", (Comparable) indexYear);
- } else {
- statisticalDataset.add(null, null, "Serie1", indexYear);
- }
- }
-
- // configure chart
- //CategoryAxis categoryAxis = new CategoryAxis(t("coser.business.common.year"));
- String yearAxis = reports.getYearChartTitle(locale);
-
- CategoryAxis categoryAxis = new CategoryAxis(yearAxis);
- categoryAxis.setCategoryMargin(0);
- categoryAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
- // label horizontaux
- String legendY = indicatorName;
- if (multiplicator != 1) {
- // affiche par exemple : cm * 1000
- legendY += " (" + unit + "*" + multiplicator + ")";
- } else if (StringUtils.isNotEmpty(unit)) {
- legendY += " (" + unit + ")";
- }
- ValueAxis valueAxis = new NumberAxis(legendY);
- valueAxis.setUpperMargin(0.1);
-
- CategoryItemRenderer renderer = new StatisticalLineAndShapeRenderer(false, true);
-
- // n'affiche pas les nombre sur le graphique
- //StandardCategoryItemLabelGenerator itemLabelGenerator = new StandardCategoryItemLabelGenerator();
- //renderer.setBaseItemLabelGenerator(itemLabelGenerator);
- //renderer.setBaseItemLabelsVisible(true);
-
- CategoryPlot plot = new CategoryPlot(statisticalDataset, categoryAxis, valueAxis, renderer);
- plot.setOrientation(PlotOrientation.VERTICAL);
- JFreeChart chart = new JFreeChart(chartTitle,
- JFreeChart.DEFAULT_TITLE_FONT, plot, true);
-
- // remove series legend
- chart.removeLegend();
- // white background
- chart.setBackgroundPaint(Color.WHITE);
-
- try {
- result = File.createTempFile("coser-chart-community-indicator-", ".png");
- result.deleteOnExit();
- ChartUtilities.saveChartAsPNG(result, chart, 800, 400);
- } catch (IOException ex) {
- throw new CoserTechnicalException("Can't save chart", ex);
- }
- }
-
- return result;
- }
-
- // --------------------------------------------------------------------- //
- // --- Matchers ------------------------------------------------------- //
- // --------------------------------------------------------------------- //
-
- protected boolean matchIndicator(CommunityIndicatorRequest request) {
- Preconditions.checkNotNull(request.getIndicator());
-
- String indicator = request.getIndicator();
-
- boolean result = false;
-
- Iterator<String[]> iterator = repository.loadCommunityIndicatorStorage(true);
- while (iterator.hasNext()) {
- String[] tuple = iterator.next();
- if (repository.matchCommunityIndicator(tuple, indicator)) {
- result = true;
- break;
- }
- }
- return result;
- }
-
- protected boolean matchIndicatorAndSpeciesList(CommunityIndicatorRequest request) {
- Preconditions.checkNotNull(request.getIndicator());
- Preconditions.checkNotNull(request.getSpecies());
-
- String indicator = request.getIndicator();
- String speciesList = request.getSpecies();
-
- boolean result = false;
-
- Iterator<String[]> iterator = repository.loadCommunityIndicatorStorage(true);
- while (iterator.hasNext()) {
- String[] tuple = iterator.next();
- if (repository.matchCommunityIndicatorAndSpeciesList(tuple, indicator, speciesList)) {
- result = true;
- break;
- }
- }
- return result;
- }
-}
Deleted: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/ExtractResultProducer.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/ExtractResultProducer.java 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/ExtractResultProducer.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -1,835 +0,0 @@
-package fr.ifremer.coser.result.repository.legacy;
-
-/*
- * #%L
- * Coser :: Business
- * %%
- * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>.
- * #L%
- */
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Maps;
-import fr.ifremer.coser.CoserBusinessException;
-import fr.ifremer.coser.CoserTechnicalException;
-import fr.ifremer.coser.bean.IndicatorMap;
-import fr.ifremer.coser.bean.Project;
-import fr.ifremer.coser.bean.RSufiResult;
-import fr.ifremer.coser.bean.RSufiResultPath;
-import fr.ifremer.coser.bean.Selection;
-import fr.ifremer.coser.bean.SpeciesMap;
-import fr.ifremer.coser.bean.ZoneMap;
-import fr.ifremer.coser.result.FileResult;
-import fr.ifremer.coser.result.Reports;
-import fr.ifremer.coser.result.repository.ResultProducer;
-import fr.ifremer.coser.result.request.ExtractRequest;
-import fr.ifremer.coser.services.ProjectService;
-import fr.ifremer.coser.storage.DataStorage;
-import fr.ifremer.coser.storage.DataStorages;
-import fr.ifremer.coser.storage.MemoryDataStorage;
-import fr.ifremer.coser.util.DataType;
-import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.collections4.MapUtils;
-import org.apache.commons.collections4.keyvalue.MultiKey;
-import org.apache.commons.collections4.map.MultiKeyMap;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.lang3.tuple.Pair;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jfree.chart.ChartUtilities;
-import org.jfree.chart.JFreeChart;
-import org.jfree.chart.axis.CategoryAxis;
-import org.jfree.chart.axis.CategoryLabelPositions;
-import org.jfree.chart.axis.NumberAxis;
-import org.jfree.chart.axis.ValueAxis;
-import org.jfree.chart.plot.CategoryPlot;
-import org.jfree.chart.plot.PlotOrientation;
-import org.jfree.chart.renderer.category.CategoryItemRenderer;
-import org.jfree.chart.renderer.category.StatisticalLineAndShapeRenderer;
-import org.jfree.data.statistics.DefaultStatisticalCategoryDataset;
-import org.nuiton.util.FileUtil;
-import org.nuiton.util.ZipUtil;
-
-import java.awt.Color;
-import java.io.File;
-import java.io.IOException;
-import java.io.StringWriter;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Created on 3/11/14.
- *
- * @author Tony Chemit <chemit(a)codelutin.com>
- * @since 1.5
- */
-public class ExtractResultProducer implements ResultProducer<ExtractRequest> {
-
- /** Logger. */
- private static final Log log = LogFactory.getLog(ExtractResultProducer.class);
-
- protected final LegacyResultRepository repository;
-
- protected final Reports reports;
-
- protected final RSufiResultPath path;
-
- protected final File basedir;
-
- protected final ProjectService projectService;
-
- public ExtractResultProducer(LegacyResultRepository repository) {
- this.repository = repository;
- this.path = repository.path;
- this.reports = repository.reports;
- this.projectService = repository.projectService;
- this.basedir = repository.basedir;
- }
-
- @Override
- public LegacyResultRepository getRepository() {
- return repository;
- }
-
- @Override
- public boolean acceptResult(ExtractRequest request) {
- return matchExtractTypeSet(request) &&
- matchZoneList(request) &&
- (matchPopulationIndicatorListAndSpeciesList(request) ||
- matchCommunityIndicatorListAndSpeciesList(request));
- }
-
- @Override
- public Map<String, String> getAvailableZones(ExtractRequest request) {
-
- ZoneMap zonesMap = repository.getZonesMap();
- List<String> allowedZones = zonesMap.getZonesForFacade(null);
- Map<String, String> result = zonesMap.getSubZonesMap(path.getRsufiResult().getZone(), allowedZones);
- return result;
- }
-
- @Override
- public Map<String, String> getAvailableSpecies(ExtractRequest request) {
- Preconditions.checkNotNull(request.getZoneList());
-
- Map<String, String> result = null;
-
- boolean match = matchZoneList(request);
-
- if (match) {
- result = Maps.newHashMap();
-
- // get all species for population indicators
- result.putAll(repository.getPopulationIndicatorSpecies());
- // get all species for community indicators
- result.putAll(repository.getCommunityIndicatorSpecies());
- }
- return result;
- }
-
- @Override
- public Map<String, String> getAvailableIndicators(ExtractRequest request) {
- Preconditions.checkNotNull(request.getZoneList());
- Preconditions.checkNotNull(request.getExtractTypeList());
-
- Map<String, String> result = null;
-
- boolean match = matchZoneList(request);
- if (match) {
-
- Set<String> indicatorList = null;
-
- if (request.getExtractTypeList().contains(DataType.COMMUNITY)) {
-
- // get all community indicators for given zone
- indicatorList = repository.getCommunityIndicators();
- } else if (request.getExtractTypeList().contains(DataType.POPULATION)) {
-
- // get all population indicators for given zone
- indicatorList = repository.getPopulationIndicators();
- }
-
- if (indicatorList != null) {
- result = repository.getIndicatorsMap().getIndicatorsValues(indicatorList, request.getLocale());
- }
- }
- return result;
- }
-
- @Override
- public FileResult produceResult(ExtractRequest r) {
-
- Locale locale = r.getLocale();
- List<String> zoneList = r.getZoneList();
- List<DataType> extractTypeList = r.getExtractTypeList();
- List<String> speciesList = r.getSpeciesList();
- List<String> communityIndicatorList = r.getCommunityIndicatorList();
- List<String> populationIndicatorList = r.getPopulationIndicatorList();
-
- File resultZip = null;
- File tempDir = null;
- try {
- tempDir = FileUtil.createTempDirectory("coser-extract-", "-tmp");
-
- File subDir = new File(tempDir, "Indicateurs_Ifremer");
- FileUtils.forceMkdir(subDir);
-
- // les sources se retrouve dans le zip a cote du pdf
- if (extractTypeList.contains(DataType.SOURCE)) {
- if (log.isDebugEnabled()) {
- log.debug("Extracting sources");
- }
- File srcDir = new File(subDir, "sources");
- extractSource(srcDir);
- }
-
- // les cartes doivent se retrouver dans le pdf
- MultiKeyMap pdfMaps = null;
- if (extractTypeList.contains(DataType.MAP)) {
- if (log.isDebugEnabled()) {
- log.debug("Extracting maps");
- }
- SpeciesMap speciesMap = repository.getSpeciesMap();
- String zone = path.getRsufiResult().getZone();
- for (String species : speciesList) {
- File mapFile = repository.getMapSpeciesFile(species);
- pdfMaps.put(zone, speciesMap.getSpeciesName(species), mapFile);
- }
- }
-
- // les graphiques sont également dans le pdf
- MultiKeyMap pdfCharts = null;
- if (CollectionUtils.isNotEmpty(communityIndicatorList) ||
- CollectionUtils.isNotEmpty(populationIndicatorList)) {
- if (log.isDebugEnabled()) {
- log.debug("Extracting charts");
- }
- pdfCharts = extractCharts(speciesList,
- communityIndicatorList,
- populationIndicatorList,
- locale);
- }
-
- // generate pdf if necessary
- if (MapUtils.isNotEmpty(pdfMaps) || MapUtils.isNotEmpty(pdfCharts)) {
- if (log.isDebugEnabled()) {
- log.debug("Generated Extract PDF");
- }
- reports.generateExtractPDF(subDir,
- zoneList,
- pdfMaps,
- pdfCharts,
- repository.getZonesMap(),
- locale);
- }
-
- // fichier de décharge en pdf
- if (log.isDebugEnabled()) {
- log.debug("Generated decharge PDF");
- }
- String filename = reports.getDechargeFilename(locale);
- File dechargePDF = new File(subDir, filename);
- reports.generateDechargePDF(dechargePDF, locale, null, null);
-
- // make zip
- if (log.isDebugEnabled()) {
- log.debug("Make final archive");
- }
- resultZip = File.createTempFile("coser-extract-", ".zip");
- resultZip.deleteOnExit();
- ZipUtil.compress(resultZip, subDir);
-
- // clean directory
- FileUtils.deleteDirectory(tempDir);
- } catch (IOException ex) {
- throw new CoserTechnicalException("Can't create zip file", ex);
- } finally {
- // clean directory
- FileUtils.deleteQuietly(tempDir);
- }
-
- FileResult result = new FileResult(repository.getId(), resultZip);
- return result;
- }
-
- /**
- * Generate raw data after selection in a sub directory (named of the zone) of the given directory.
- *
- * @param directory where to generate file
- */
- protected void extractSource(File directory) {
-
- // load project (with data to get original file names)
- Project project = path.getProject();
-
- // load selection data (to do data export rsufi)
- Selection selection = path.getSelection();
-
- try {
- // be sure that data are available for this project
- // or it will fail
-
- projectService.loadSelectionData(basedir.getParentFile(), project, selection);
- } catch (CoserBusinessException e) {
- throw new CoserTechnicalException("Could not load project selection", e);
- }
-
- // il ne faut pas les fichiers de selection, mais leurs
- // export rsufi (sans les lignes, et les quotes)
- File zoneDirectory = new File(directory, path.getRsufiResult().getZone());
-
- try {
- FileUtils.forceMkdir(zoneDirectory);
- } catch (IOException e) {
- throw new CoserTechnicalException("Could not create directory: " + zoneDirectory, e);
- }
-
- try {
- projectService.extractRSUfiData(project, selection, zoneDirectory, true);
- } catch (CoserBusinessException e) {
- throw new CoserTechnicalException("Could not extract raw data", e);
- }
- }
-
- /**
- * Retourne les indicateurs calculés avec leurs traductions scientifique
- * pour la zone et l'especes souhaitées.
- *
- * @param species especes (if {@code null} look for com indicators
- * @param comIndicators comIndicator
- * @param popIndicators popIndicators
- * @param locale locale
- * @return la liste des indicateurs (zone, speciesname, [graphfile, graphdata])
- */
- protected MultiKeyMap extractCharts(Collection<String> species,
- Collection<String> comIndicators,
- Collection<String> popIndicators,
- Locale locale) {
-
- MultiKeyMap chartFileAndDatas = new MultiKeyMap();
-
- Project project = path.getProject();
- RSufiResult rsufiResult = path.getRsufiResult();
- String zone = rsufiResult.getZone();
- String zoneDisplayName = repository.getZonesMap().getZoneFullName(zone);
-
- if (CollectionUtils.isNotEmpty(comIndicators)) {
- Map<String, Pair<File, String>> chartFileAndDataCom = getRsufiResultComCharts(comIndicators,
- zoneDisplayName,
- repository.getIndicatorsMap(),
- locale,
- 650,
- 430);
- // put in multimap as zone,speciesname, data
- for (Map.Entry<String, Pair<File, String>> entry : chartFileAndDataCom.entrySet()) {
- chartFileAndDatas.put(zone, entry.getKey(), entry.getValue());
- }
- }
-
- if (CollectionUtils.isNotEmpty(popIndicators)) {
- Map<String, Pair<File, String>> chartFileAndDataPop = getRsufiResultPopCharts(species,
- popIndicators,
- zoneDisplayName,
- repository.getIndicatorsMap(),
- locale,
- 650,
- 430);
- // put in multimap as zone,speciesname, data
- for (Map.Entry<String, Pair<File, String>> entry : chartFileAndDataPop.entrySet()) {
- chartFileAndDatas.put(zone, entry.getKey(), entry.getValue());
- }
- }
-
- return chartFileAndDatas;
- }
-
- /**
- * Generate community graph for selected indicators.
- * Used by web ui extraction.
- *
- * @param indicators indicators to extract
- * @param zoneDisplayName zone full name
- * @param indicatorMap indicator localized map
- * @param locale locale
- * @param width graph width
- * @param height graph height
- * @return maps of generated graph image (temp file) and data indexed by natural key (indicator - species)
- */
- public Map<String, Pair<File, String>> getRsufiResultComCharts(Collection<String> indicators,
- String zoneDisplayName,
- IndicatorMap indicatorMap,
- Locale locale,
- int width, int height) {
-
- Map<String, Pair<File, String>> result = Maps.newHashMap();
-
- int multiplicator = 1;
- int minYear = Integer.MAX_VALUE;
- int maxYear = Integer.MIN_VALUE;
-
- Map<String, Map<Integer, Double[]>> indicatorGraphData = new HashMap<String, Map<Integer, Double[]>>();
- Map<String, String> indicatorLists = new HashMap<String, String>();
- Map<String, DataStorage> indicatorStorages = new HashMap<String, DataStorage>();
-
- // Campagne Indicateur Liste Strate Annee Estimation EcartType CV
- Iterator<String[]> estComIndIterator = repository.loadCommunityIndicatorStorage(true);
- while (estComIndIterator.hasNext()) {
- // Campagne Indicateur Liste Strate Annee Estimation EcartType CV
- String[] tuple = estComIndIterator.next();
- String indicatorCode = tuple[1];
- String indicatorList = tuple[2];
-
- if (indicators.contains(indicatorCode)) {
-
- // si pas de list selectionnée, on prend la premiere
- String localList = indicatorLists.get(indicatorCode);
- if (StringUtils.isBlank(localList)) {
- localList = indicatorList;
- indicatorLists.put(indicatorCode, localList);
- }
-
- if (indicatorList.equals(localList)) {
- Double estimation = Double.parseDouble(tuple[5]);
- Double ecart = Double.parseDouble(tuple[6]);
- int year = Integer.parseInt(tuple[4]);
-
- if (year < minYear) {
- minYear = year;
- }
- if (year > maxYear) {
- maxYear = year;
- }
- Map<Integer, Double[]> graphData = indicatorGraphData.get(indicatorCode);
- if (graphData == null) {
- graphData = new HashMap<Integer, Double[]>();
- indicatorGraphData.put(indicatorCode, graphData);
- }
- graphData.put(year, new Double[]{estimation, ecart});
-
- // si les données sont énormes, on affiche les données
- // / multiplicator et on le mentionne dans la légende
- if (estimation > 1e9) {
- multiplicator = 1000000;
- }
- if (estimation > 1e6 && multiplicator < 1000000) {
- multiplicator = 1000;
- }
-
- // for data part
- DataStorage subDataStorage = indicatorStorages.get(indicatorCode);
- if (subDataStorage == null) {
- subDataStorage = new MemoryDataStorage();
- if ("fr".equals(locale.getLanguage())) {
- subDataStorage.add(new String[]{"Campagne", "Indice", "Liste", "Strate", "Année", "Estimation", "EcartType", "CV"});
- } else {
- subDataStorage.add(new String[]{"Survey", "Index", "List", "Stratum", "Year", "Estimate", "StandardDeviation", "CV"});
- }
- indicatorStorages.put(indicatorCode, subDataStorage);
- }
- subDataStorage.add(tuple);
- }
- }
- }
-
- // avec l'extraction des données, on peut demander a générer un graphique
- // sur un indicateur qui n'est pas présent dans le projet courant,
- // dans ce cas, on retourne null
- for (String indicator : indicatorGraphData.keySet()) {
- // get graph title
- String chartTitle = zoneDisplayName;
- String indicatorName = indicatorMap.getIndicatorValue(indicator, locale);
- String unit = indicatorMap.getIndicatorUnit(indicator);
- chartTitle += " - " + indicatorName;
-
- // ajout de la traduction de la liste d'indicateur
- // les liste sont a1, T1, T2 ...
- String localList = indicatorLists.get(indicator);
- String speciesListName = repository.getSpeciesListMap().getSpeciesListName(locale, localList);
- chartTitle += " - " + speciesListName;
-// String listLetter = String.valueOf(localList.charAt(0));
-// Iterator<String[]> typeIterator = repository.getSpeciesListMap().iterator(true);
-// while (typeIterator.hasNext()) {
-// // "Types";"Commentaire";"NumSys min";"NumSys max";"Code"
-// String[] tuple = typeIterator.next();
-// if (tuple[4].equals(listLetter)) {
-// /// gestion du groupe "Tous"
-// // cas special, c'est la seule valeur du fichier
-// // code type espece qui a besoin d'une traduction
-// if (tuple[4].equalsIgnoreCase("T")) {
-// if ("fr".equals(locale.getLanguage())) {
-// chartTitle += " - " + "Tous Liste " + localList.charAt(1);
-// } else if ("es".equals(locale.getLanguage())) {
-// chartTitle += " - " + "Todo Lista " + localList.charAt(1);
-// } else {
-// chartTitle += " - " + "All List " + localList.charAt(1);
-// }
-// } else {
-// // ajout de la traduction du nom de liste plus le numéro
-// if ("fr".equals(locale.getLanguage())) {
-// chartTitle += " - " + tuple[0] + " Liste " + localList.charAt(1);
-// } else if ("es".equals(locale.getLanguage())) {
-// chartTitle += " - " + tuple[0] + " Lista " + localList.charAt(1);
-// } else {
-// chartTitle += " - " + tuple[0] + " List " + localList.charAt(1);
-// }
-// }
-// break;
-// }
-// }
-
- // generate dataset with sorted data
- Map<Integer, Double[]> graphData = indicatorGraphData.get(indicator);
- DefaultStatisticalCategoryDataset statisticalDataset = new DefaultStatisticalCategoryDataset();
- for (int indexYear = minYear; indexYear <= maxYear; ++indexYear) {
- Double[] entry = graphData.get(indexYear);
- if (entry != null) {
- Double estimation = entry[0] / multiplicator;
- Double ecart = entry[1] / multiplicator;
- statisticalDataset.add(estimation, ecart, "Serie1", (Comparable) indexYear);
- } else {
- statisticalDataset.add(null, null, "Serie1", indexYear);
- }
- }
-
- // configure chart
- //CategoryAxis categoryAxis = new CategoryAxis(t("coser.business.common.year"));
- String yearAxis = reports.getYearChartTitle(locale);
- CategoryAxis categoryAxis = new CategoryAxis(yearAxis);
- categoryAxis.setCategoryMargin(0);
- categoryAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
- // label horizontaux
- String legendY = indicatorName;
- if (multiplicator != 1) {
- // affiche par exemple : cm * 1000
- legendY += " (" + unit + "*" + multiplicator + ")";
- } else if (StringUtils.isNotEmpty(unit)) {
- legendY += " (" + unit + ")";
- }
- ValueAxis valueAxis = new NumberAxis(legendY);
- valueAxis.setUpperMargin(0.1);
-
- CategoryItemRenderer renderer = new StatisticalLineAndShapeRenderer(false, true);
-
- // n'affiche pas les nombre sur le graphique
- //StandardCategoryItemLabelGenerator itemLabelGenerator = new StandardCategoryItemLabelGenerator();
- //renderer.setBaseItemLabelGenerator(itemLabelGenerator);
- //renderer.setBaseItemLabelsVisible(true);
-
- CategoryPlot plot = new CategoryPlot(statisticalDataset, categoryAxis, valueAxis, renderer);
- plot.setOrientation(PlotOrientation.VERTICAL);
- JFreeChart chart = new JFreeChart(chartTitle,
- JFreeChart.DEFAULT_TITLE_FONT, plot, true);
-
- // remove series legend
- chart.removeLegend();
- // white background
- chart.setBackgroundPaint(Color.WHITE);
-
- try {
- File chartFile = File.createTempFile("coser-community-chart-", ".png");
- chartFile.deleteOnExit();
- ChartUtilities.saveChartAsPNG(chartFile, chart, width, height);
- //ByteArrayOutputStream out = new ByteArrayOutputStream();
- //ChartUtilities.writeChartAsPNG(out, chart, width, height);
-
- // data extraction
- DataStorage subDataStorage = indicatorStorages.get(indicator);
- StringWriter writer = new StringWriter();
- DataStorages.save(subDataStorage, writer);
-
- // add chart file dans chart data in result
- result.put(indicator, Pair.of(chartFile, writer.toString()));
- writer.close();
- } catch (IOException ex) {
- throw new CoserTechnicalException("Can't save chart", ex);
- }
- }
-
- return result;
- }
-
- /**
- * Generate population graph for selected species and indicator.
- *
- * @param species species to extract
- * @param indicators indicators to extract
- * @param zoneDisplayName zone full name
- * @param indicatorMap indicator localized map
- * @param locale locale
- * @param width graph width
- * @param height graph height
- * @return maps of generated graph image (temp file) and data indexed by natural key (indicator - species)
- */
- public Map<String, Pair<File, String>> getRsufiResultPopCharts(Collection<String> species,
- Collection<String> indicators,
- String zoneDisplayName,
- IndicatorMap indicatorMap,
- Locale locale,
- int width,
- int height) {
-
- Map<String, Pair<File, String>> result = Maps.newHashMap();
-
- int multiplicator = 1;
- int minYear = Integer.MAX_VALUE;
- int maxYear = Integer.MIN_VALUE;
-
- MultiKeyMap indicatorGraphData = new MultiKeyMap();
- MultiKeyMap indicatorStorages = new MultiKeyMap();
-
- // Campagne Indicateur Liste Species Strate Annee Estimation EcartType CV
- Iterator<String[]> estPopIndIterator = repository.loadPopulationIndicatorStorage(true);
- while (estPopIndIterator.hasNext()) {
- String[] tuple = estPopIndIterator.next();
-
- String speciesCode = tuple[3];
- String indicatorCode = tuple[1];
- if (species.contains(speciesCode) && indicators.contains(indicatorCode)) {
-
- // XXX echatellier, maybe take care of list here ?
-
- Double estimation = Double.parseDouble(tuple[6]);
- Double ecart = Double.parseDouble(tuple[7]);
- int year = Integer.parseInt(tuple[5]);
-
- if (year < minYear) {
- minYear = year;
- }
- if (year > maxYear) {
- maxYear = year;
- }
- Map<Integer, Double[]> graphData = (Map<Integer, Double[]>) indicatorGraphData.get(indicatorCode, speciesCode);
- if (graphData == null) {
- graphData = new HashMap<Integer, Double[]>();
- indicatorGraphData.put(indicatorCode, speciesCode, graphData);
- }
- graphData.put(year, new Double[]{estimation, ecart});
-
- // si les données sont énormes, on affiche les données
- // / multiplicator et on le mentionne dans la légende
- if (estimation > 1e9) {
- multiplicator = 1000000;
- }
- if (estimation > 1e6 && multiplicator < 1000000) {
- multiplicator = 1000;
- }
-
- // for data part
- DataStorage subDataStorage = (DataStorage) indicatorStorages.get(indicatorCode, speciesCode);
- if (subDataStorage == null) {
- subDataStorage = new MemoryDataStorage();
- if ("fr".equals(locale.getLanguage())) {
- subDataStorage.add(new String[]{"Campagne", "Indice", "Liste", "Espèce", "Strate", "Annee", "Estimation", "EcartType", "CV"});
- } else {
- subDataStorage.add(new String[]{"Survey", "Index", "List", "Species", "Stratum", "Year", "Estimate", "StandardDeviation", "CV"});
- }
- indicatorStorages.put(indicatorCode, speciesCode, subDataStorage);
- }
- subDataStorage.add(tuple);
- }
- }
-
- SpeciesMap speciesMap = repository.getSpeciesMap();
-
- // avec l'extraction des données, on peut demander a générer un graphique
- // sur un indicateur qui n'est pas présent dans le projet courant,
- // dans ce cas, on retourne null
- for (MultiKey indicatorSpecies : (Set<MultiKey>) indicatorGraphData.keySet()) {
- String indicator = (String) indicatorSpecies.getKey(0);
- String aSpecies = (String) indicatorSpecies.getKey(1);
- // get graph title
- String title = zoneDisplayName;
- String indicatorName = indicatorMap.getIndicatorValue(indicator, locale);
- String unit = indicatorMap.getIndicatorUnit(indicator);
- title += " - " + indicatorName;
- title += " - " + speciesMap.getReportDisplayName(aSpecies);
-
- // generate dataset with sorted data
- DefaultStatisticalCategoryDataset statisticalDataset = new DefaultStatisticalCategoryDataset();
- Map<Integer, Double[]> graphData = (Map<Integer, Double[]>) indicatorGraphData.get(indicator, aSpecies);
- for (int indexYear = minYear; indexYear <= maxYear; ++indexYear) {
- Double[] entry = graphData.get(indexYear);
- if (entry != null) {
- Double estimation = entry[0] / multiplicator;
- Double ecart = entry[1] / multiplicator;
- statisticalDataset.add(estimation, ecart, "Serie1", (Comparable) indexYear);
- } else {
- statisticalDataset.add(null, null, "Serie1", indexYear);
- }
- }
-
-
- // configure chart
- //CategoryAxis categoryAxis = new CategoryAxis(t("coser.business.common.year"));
- String yearAxis = reports.getYearChartTitle(locale);
- CategoryAxis categoryAxis = new CategoryAxis(yearAxis);
- categoryAxis.setCategoryMargin(0);
- categoryAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
- // label horizontaux
- String legendY = indicatorName;
- if (multiplicator != 1) {
- // affiche par exemple : cm * 1000
- legendY += " (" + unit + "*" + multiplicator + ")";
- } else if (StringUtils.isNotEmpty(unit)) {
- legendY += " (" + unit + ")";
- }
- ValueAxis valueAxis = new NumberAxis(legendY);
- valueAxis.setUpperMargin(0.1);
-
- CategoryItemRenderer renderer = new StatisticalLineAndShapeRenderer(false, true);
-
- // n'affiche pas les nombre sur le graphique
- //StandardCategoryItemLabelGenerator itemLabelGenerator = new StandardCategoryItemLabelGenerator();
- //renderer.setBaseItemLabelGenerator(itemLabelGenerator);
- //renderer.setBaseItemLabelsVisible(true);
-
- CategoryPlot plot = new CategoryPlot(statisticalDataset, categoryAxis, valueAxis, renderer);
- plot.setOrientation(PlotOrientation.VERTICAL);
- JFreeChart chart = new JFreeChart(title,
- JFreeChart.DEFAULT_TITLE_FONT, plot, true);
-
- // remove series legend
- chart.removeLegend();
- // white background
- chart.setBackgroundPaint(Color.WHITE);
-
- try {
- File chartFile = File.createTempFile("coser-population-chart-", ".png");
- chartFile.deleteOnExit();
- ChartUtilities.saveChartAsPNG(chartFile, chart, width, height);
- //ByteArrayOutputStream out = new ByteArrayOutputStream();
- //ChartUtilities.writeChartAsPNG(out, chart, width, height);
-
- // data extraction
- DataStorage subDataStorage = (DataStorage) indicatorStorages.get(indicator, aSpecies);
- StringWriter writer = new StringWriter();
- DataStorages.save(subDataStorage, writer);
-
- // add chart file dans chart data in result
- result.put(indicator + "-" + aSpecies, Pair.of(chartFile, writer.toString()));
- writer.close();
- } catch (IOException ex) {
- throw new CoserTechnicalException("Can't save chart", ex);
- }
- }
-
- return result;
- }
-
- // --------------------------------------------------------------------- //
- // --- Matchers ------------------------------------------------------- //
- // --------------------------------------------------------------------- //
-
- protected boolean matchExtractTypeSet(ExtractRequest request) {
- boolean result = false;
- if (repository.mapsResult) {
- result = request.getExtractTypeList().contains(DataType.SOURCE);
- }
- if (repository.indicatorsResult) {
- result = request.getExtractTypeList().contains(DataType.POPULATION) ||
- request.getExtractTypeList().contains(DataType.COMMUNITY);
- }
- if (repository.dataResult) {
- result = request.getExtractTypeList().contains(DataType.SOURCE);
- }
- return result;
- }
-
- protected boolean matchZoneList(ExtractRequest request) {
- return request.getZoneList().contains(path.getRsufiResult().getZone());
- }
-
- protected boolean matchCommunityIndicatorList(ExtractRequest request) {
- Preconditions.checkNotNull(request.getCommunityIndicatorList());
-
- List<String> indicatorList = request.getCommunityIndicatorList();
-
- boolean result = false;
-
- Iterator<String[]> iterator = repository.loadCommunityIndicatorStorage(true);
- while (iterator.hasNext()) {
- String[] tuple = iterator.next();
- if (repository.matchIndicatorList(tuple, indicatorList)) {
- result = true;
- break;
- }
- }
- return result;
- }
-
- protected boolean matchPopulationIndicatorList(ExtractRequest request) {
- Preconditions.checkNotNull(request.getPopulationIndicatorList());
-
- List<String> indicatorList = request.getPopulationIndicatorList();
-
- boolean result = false;
-
- Iterator<String[]> iterator = repository.loadPopulationIndicatorStorage(true);
- while (iterator.hasNext()) {
- String[] tuple = iterator.next();
- if (repository.matchIndicatorList(tuple, indicatorList)) {
- result = true;
- break;
- }
- }
- return result;
- }
-
- protected boolean matchPopulationIndicatorListAndSpeciesList(ExtractRequest request) {
- Preconditions.checkNotNull(request.getPopulationIndicatorList());
-
- List<String> indicatorList = request.getPopulationIndicatorList();
- List<String> speciesList = request.getSpeciesList();
-
- boolean result = false;
-
- Iterator<String[]> iterator = repository.loadPopulationIndicatorStorage(true);
- while (iterator.hasNext()) {
- String[] tuple = iterator.next();
- if (repository.matchIndicatorListAndSpeciesList(tuple, indicatorList, speciesList)) {
- result = true;
- break;
- }
- }
- return result;
- }
-
- protected boolean matchCommunityIndicatorListAndSpeciesList(ExtractRequest request) {
- Preconditions.checkNotNull(request.getCommunityIndicatorList());
-
- List<String> indicatorList = request.getCommunityIndicatorList();
- List<String> speciesList = request.getSpeciesList();
-
- boolean result = false;
-
- Iterator<String[]> iterator = repository.loadCommunityIndicatorStorage(true);
- while (iterator.hasNext()) {
- String[] tuple = iterator.next();
- if (repository.matchIndicatorListAndSpeciesList(tuple, indicatorList, speciesList)) {
- result = true;
- break;
- }
- }
- return result;
- }
-}
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/LegacyResultRepository.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/LegacyResultRepository.java 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/LegacyResultRepository.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -27,26 +27,20 @@
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import fr.ifremer.coser.CoserBusinessConfig;
+import fr.ifremer.coser.CoserBusinessException;
import fr.ifremer.coser.CoserConstants;
import fr.ifremer.coser.CoserServiceContext;
+import fr.ifremer.coser.CoserTechnicalException;
import fr.ifremer.coser.bean.EchoBaseProject;
import fr.ifremer.coser.bean.IndicatorMap;
import fr.ifremer.coser.bean.RSufiResultPath;
import fr.ifremer.coser.bean.SpeciesListMap;
import fr.ifremer.coser.bean.SpeciesMap;
import fr.ifremer.coser.bean.ZoneMap;
-import fr.ifremer.coser.result.CoserRequest;
-import fr.ifremer.coser.result.CoserResult;
import fr.ifremer.coser.result.Reports;
-import fr.ifremer.coser.result.repository.ResultProducer;
import fr.ifremer.coser.result.repository.ResultRepository;
-import fr.ifremer.coser.result.request.CommunityIndicatorRequest;
import fr.ifremer.coser.result.request.CoserRequestFacadeAware;
import fr.ifremer.coser.result.request.CoserRequestZoneAware;
-import fr.ifremer.coser.result.request.ExtractRequest;
-import fr.ifremer.coser.result.request.MapRequest;
-import fr.ifremer.coser.result.request.PopulationIndicatorRequest;
-import fr.ifremer.coser.result.request.RawDataRequest;
import fr.ifremer.coser.services.ProjectService;
import fr.ifremer.coser.storage.DataStorage;
import fr.ifremer.coser.storage.DataStorages;
@@ -76,11 +70,6 @@
private static final Log log = LogFactory.getLog(LegacyResultRepository.class);
/**
- * Id of result source.
- */
- public static final String ID = "rsufi";
-
- /**
* Project basedir.
*/
protected final File basedir;
@@ -95,7 +84,6 @@
*/
protected final File mapsDirectory;
-
/**
* Project definition.
*/
@@ -137,27 +125,11 @@
protected SpeciesListMap speciesListMap;
/**
- * Is the result contains maps ?
- */
- protected final boolean mapsResult;
-
- /**
- * Is the result contains indicators ?
- */
- protected final boolean indicatorsResult;
-
- /**
- * Is the results contains raw data ?
- */
- protected final boolean dataResult;
-
- /**
* Report helper.
*/
protected final Reports reports;
- protected final Map<String, ResultProducer<?>> resultProducers;
-
+ //FIXME Remove this
protected final ProjectService projectService;
public LegacyResultRepository(CoserServiceContext serviceContext,
@@ -179,21 +151,12 @@
path.getRsufiResult().getName());
this.mapsDirectory = new File(resultDirectory, CoserConstants.STORAGE_MAPS_DIRECTORY);
this.path = path;
- this.mapsResult = path.getRsufiResult().isMapsResult();
- this.indicatorsResult = path.getRsufiResult().isIndicatorsResult();
- this.dataResult = path.getRsufiResult().isDataAllowed();
this.reports = new Reports();
this.mapFileToSpeciesCode = EchoBaseProject.newMapFileToSpeciesCode(surveyName);
this.speciesCodeToMapFile = EchoBaseProject.newSpeciesCodeToMapFileName(surveyName);
this.mapSpeciesFilenameFilter = EchoBaseProject.newMapSpeciesFilenameFilter(surveyName);
this.projectService = new ProjectService(serviceContext.getConfig());
- this.resultProducers = Maps.newHashMap();
- this.resultProducers.put(MapRequest.class.getName(), new MapResultProducer(this));
- this.resultProducers.put(CommunityIndicatorRequest.class.getName(), new CommunityIndicatorResultProducer(this));
- this.resultProducers.put(PopulationIndicatorRequest.class.getName(), new PopulationIndicatorResultProducer(this));
- this.resultProducers.put(RawDataRequest.class.getName(), new RawDataResultProducer(this));
- this.resultProducers.put(ExtractRequest.class.getName(), new ExtractResultProducer(this));
if (log.isInfoEnabled()) {
log.info("New result repository: " + getId());
@@ -207,112 +170,139 @@
@Override
public String getId() {
return String.format("%s::%s::%s",
- ID,
+ LegacyResultRepositoryType.ID,
resultDirectory,
path.getRsufiResult().isMapsResult() ? "Map" : "Indicator"
);
}
@Override
- public <R extends CoserRequest> Map<String, String> getAvailableZones(R request) {
- Preconditions.checkNotNull(request);
- ResultProducer<R> resultProducer = getProducer(request);
- Preconditions.checkNotNull(resultProducer);
+ public LegacyResultRepositoryType getResultRepositoryType() {
+ return LegacyResultRepositoryType.INSTANCE;
+ }
- Map<String, String> result = resultProducer.getAvailableZones(request);
- return result;
+ public File getResultDirectory() {
+ return resultDirectory;
}
- @Override
- public <R extends CoserRequest> Map<String, String> getAvailableSpecies(R request) {
- Preconditions.checkNotNull(request);
- ResultProducer<R> resultProducer = getProducer(request);
- Preconditions.checkNotNull(resultProducer);
+ public RSufiResultPath getPath() {
+ return path;
+ }
- Map<String, String> result = resultProducer.getAvailableSpecies(request);
- return result;
+ public String getSurveyName() {
+ return surveyName;
}
- @Override
- public <R extends CoserRequest> Map<String, String> getAvailableIndicators(R request) {
- Preconditions.checkNotNull(request);
- ResultProducer<R> resultProducer = getProducer(request);
- Preconditions.checkNotNull(resultProducer);
+ public Reports getReports() {
+ return reports;
+ }
- Map<String, String> result = resultProducer.getAvailableIndicators(request);
- return result;
+ public File getBasedir() {
+ return basedir;
}
- @Override
- public <R extends CoserRequest> boolean acceptResult(R request) {
- Preconditions.checkNotNull(request);
- Preconditions.checkArgument(request.isFilled());
+ public String getProjectName() {
+ return path.getProject().getName();
+ }
- ResultProducer<R> resultProducer = getProducer(request);
- Preconditions.checkNotNull(resultProducer);
- boolean result = resultProducer.acceptResult(request);
- return result;
+ public String getSelectionName() {
+ return path.getSelection().getName();
}
- @Override
- public <R extends CoserRequest> CoserResult getResult(R request) {
- Preconditions.checkNotNull(request);
- Preconditions.checkArgument(request.isFilled());
- Preconditions.checkArgument(acceptResult(request));
+ public String getZone() {
+ return path.getRsufiResult().getZone();
+ }
- ResultProducer<R> resultProducer = getProducer(request);
- Preconditions.checkNotNull(resultProducer);
+ public String getResultName() {
+ return path.getRsufiResult().getName();
+ }
- CoserResult result = resultProducer.produceResult(request);
- return result;
+ public boolean isMapsResult() {
+ return path.getRsufiResult().isMapsResult();
}
+ public boolean isIndicatorsResult() {
+ return path.getRsufiResult().isIndicatorsResult();
+ }
+
+ public boolean isPubliableResult() {
+ return path.getRsufiResult().isPubliableResult();
+ }
+
+ public boolean isDataResult() {
+ return path.getRsufiResult().isDataAllowed();
+ }
+
+ //FIXME Remove this
+ public ProjectService getProjectService() {
+ return projectService;
+ }
+
+ public void loadSelectionData() {
+ try {
+ // be sure that data are available for this project
+ // or it will fail
+
+ getProjectService().loadSelectionData(getBasedir().getParentFile(), path.getProject(), path.getSelection());
+ } catch (CoserBusinessException e) {
+ throw new CoserTechnicalException("Could not load project selection", e);
+ }
+ }
+
+ public File extractRSUfiData(File zoneDirectory) {
+ try {
+ return getProjectService().extractRSUfiData(path.getProject(), path.getSelection(), zoneDirectory, true);
+ } catch (CoserBusinessException e) {
+ throw new CoserTechnicalException("Could not extract raw data", e);
+ }
+ }
+
// --------------------------------------------------------------------- //
// --- Matchers -------------------------------------------------------- //
// --------------------------------------------------------------------- //
- protected boolean matchFacade(CoserRequestFacadeAware request) {
+ public boolean matchFacade(CoserRequestFacadeAware request) {
return true;
}
- protected boolean matchZone(CoserRequestZoneAware request) {
+ public boolean matchZone(CoserRequestZoneAware request) {
return path.getRsufiResult().getZone().equals(request.getZone());
}
- protected boolean matchPopulationSpecies(String[] tuple, String species) {
+ public boolean matchPopulationSpecies(String[] tuple, String species) {
String speciesCode = tuple[3];
boolean result = species.equals(speciesCode);
return result;
}
- protected boolean matchPopulationSpeciesAndIndicator(String[] tuple, String species, String indicator) {
+ public boolean matchPopulationSpeciesAndIndicator(String[] tuple, String species, String indicator) {
String indicatorCode = tuple[1];
boolean result = matchPopulationSpecies(tuple, species) && indicator.equals(indicatorCode);
return result;
}
- protected boolean matchCommunityIndicator(String[] tuple, String indicator) {
+ public boolean matchCommunityIndicator(String[] tuple, String indicator) {
String indicatorCode = tuple[1];
boolean result = indicator.equals(indicatorCode);
return result;
}
- protected boolean matchCommunityIndicatorAndSpeciesList(String[] tuple, String indicator, String speciesList) {
+ public boolean matchCommunityIndicatorAndSpeciesList(String[] tuple, String indicator, String speciesList) {
String indicatorCode = tuple[1];
String speciesListCode = tuple[2];
boolean result = indicator.equals(indicatorCode) && speciesList.equals(speciesListCode);
return result;
}
- protected boolean matchIndicatorList(String[] tuple, List<String> indicatorList) {
+ public boolean matchIndicatorList(String[] tuple, List<String> indicatorList) {
String indicatorCode = tuple[1];
boolean result = indicatorList.contains(indicatorCode);
return result;
}
- protected boolean matchIndicatorListAndSpeciesList(String[] tuple,
- List<String> indicatorList,
- List<String> speciesList) {
+ public boolean matchIndicatorListAndSpeciesList(String[] tuple,
+ List<String> indicatorList,
+ List<String> speciesList) {
String indicatorCode = tuple[1];
String speciesCode = tuple[3];
boolean result = indicatorList.contains(indicatorCode) &&
@@ -324,7 +314,7 @@
// --- Get Map result -------------------------------------------------- //
// --------------------------------------------------------------------- //
- protected File getMapSpeciesFile(String species) {
+ public File getMapSpeciesFile(String species) {
String fileName = speciesCodeToMapFile.apply(species);
File file = fileName == null ? null : new File(mapsDirectory, fileName);
return file;
@@ -334,7 +324,7 @@
// --- Get species lists ----------------------------------------------- //
// --------------------------------------------------------------------- //
- protected Map<String, String> getPopulationIndicatorSpecies() {
+ public Map<String, String> getPopulationIndicatorSpecies() {
Map<String, String> result = Maps.newHashMap();
SpeciesMap speciesNames = getSpeciesMap();
@@ -353,7 +343,7 @@
return result;
}
- protected Map<String, String> getCommunityIndicatorSpecies() {
+ public Map<String, String> getCommunityIndicatorSpecies() {
Map<String, String> result = Maps.newHashMap();
SpeciesMap speciesNames = getSpeciesMap();
@@ -372,7 +362,7 @@
return result;
}
- protected Map<String, String> getCommunityIndicatorSpecies(Locale locale, String indicator) {
+ public Map<String, String> getCommunityIndicatorSpecies(Locale locale, String indicator) {
// linked hash map (doit respecter l'ordre d'insertion)
Map<String, String> result = new LinkedHashMap<String, String>();
@@ -395,7 +385,7 @@
// --- Get indicator lists --------------------------------------------- //
// --------------------------------------------------------------------- //
- protected Set<String> getCommunityIndicators() {
+ public Set<String> getCommunityIndicators() {
Iterator<String[]> iterator = loadCommunityIndicatorStorage(true);
Set<String> result = Sets.newHashSet();
while (iterator.hasNext()) {
@@ -406,7 +396,7 @@
return result;
}
- protected Set<String> getPopulationIndicators() {
+ public Set<String> getPopulationIndicators() {
Iterator<String[]> iterator = loadPopulationIndicatorStorage(true);
Set<String> result = Sets.newHashSet();
while (iterator.hasNext()) {
@@ -417,7 +407,7 @@
return result;
}
- protected Set<String> getPopulationIndicators(String species) {
+ public Set<String> getPopulationIndicators(String species) {
Iterator<String[]> iterator = loadPopulationIndicatorStorage(true);
Set<String> result = Sets.newHashSet();
while (iterator.hasNext()) {
@@ -442,7 +432,7 @@
return speciesListMap;
}
- protected SpeciesMap getSpeciesMap() {
+ public SpeciesMap getSpeciesMap() {
if (speciesMap == null) {
File file = new File(basedir, CoserConstants.Category.REFTAX_SPECIES.getStorageFileName());
@@ -451,7 +441,7 @@
return speciesMap;
}
- protected IndicatorMap getIndicatorsMap() {
+ public IndicatorMap getIndicatorsMap() {
return serviceContext.getIndicatorsMap();
}
@@ -463,7 +453,7 @@
// --- storage util methods -------------------------------------------- //
// --------------------------------------------------------------------- //
- protected Iterator<String[]> loadPopulationIndicatorStorage(boolean skipFirstLine) {
+ public Iterator<String[]> loadPopulationIndicatorStorage(boolean skipFirstLine) {
File file = new File(resultDirectory, path.getRsufiResult().getEstPopIndName());
// Campagne Indicateur Liste Espece Strate Annee Estimation EcartType CV
DataStorage dataStorage = DataStorages.load(file, CoserConstants.CSV_RESULT_SEPARATOR_CHAR);
@@ -471,7 +461,7 @@
return iterator;
}
- protected Iterator<String[]> loadCommunityIndicatorStorage(boolean skipFirstLine) {
+ public Iterator<String[]> loadCommunityIndicatorStorage(boolean skipFirstLine) {
File file = new File(resultDirectory, path.getRsufiResult().getEstComIndName());
// Campagne Indicateur Liste Espece Strate Annee Estimation EcartType CV
DataStorage dataStorage = DataStorages.load(file, CoserConstants.CSV_RESULT_SEPARATOR_CHAR);
@@ -479,12 +469,15 @@
return iterator;
}
- protected <R extends CoserRequest> ResultProducer<R> getProducer(R request) {
- String requestTypeName = request.getClass().getName();
- return (ResultProducer<R>) resultProducers.get(requestTypeName);
- }
+// protected <R extends CoserRequest> ResultRepositoryCommand<R> getProducer(R request) {
+// Preconditions.checkNotNull(request);
+// String requestTypeName = request.getClass().getName();
+// ResultRepositoryCommand<?> resultRepositoryCommand = resultProducers.get(requestTypeName);
+// Preconditions.checkNotNull(resultRepositoryCommand);
+// return (ResultRepositoryCommand<R>) resultRepositoryCommand;
+// }
- protected CoserBusinessConfig getConfig() {
+ public CoserBusinessConfig getConfig() {
return serviceContext.getConfig();
}
}
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/LegacyResultRepositoryCommandEngine.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/LegacyResultRepositoryCommandEngine.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/LegacyResultRepositoryCommandEngine.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,134 @@
+package fr.ifremer.coser.result.repository.legacy;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Maps;
+import fr.ifremer.coser.result.CoserRequest;
+import fr.ifremer.coser.result.CoserResult;
+import fr.ifremer.coser.result.repository.ResultRepositoryCommand;
+import fr.ifremer.coser.result.repository.ResultRepositoryCommandEngine;
+import fr.ifremer.coser.result.repository.legacy.command.DeleteResultsCommand;
+import fr.ifremer.coser.result.repository.legacy.command.ExtractRawDataAndResultsCommand;
+import fr.ifremer.coser.result.repository.legacy.command.ExtractRawDataCommand;
+import fr.ifremer.coser.result.repository.legacy.command.GetAllResultsCommand;
+import fr.ifremer.coser.result.repository.legacy.command.GetCommunityIndicatorResultCommand;
+import fr.ifremer.coser.result.repository.legacy.command.GetIndicatorsForCommunityIndicatorResultCommand;
+import fr.ifremer.coser.result.repository.legacy.command.GetIndicatorsForExtractRawDataAndResultsCommand;
+import fr.ifremer.coser.result.repository.legacy.command.GetIndicatorsForPopulationIndicatorResultCommand;
+import fr.ifremer.coser.result.repository.legacy.command.GetMapResultCommand;
+import fr.ifremer.coser.result.repository.legacy.command.GetPopulationIndicatorResultCommand;
+import fr.ifremer.coser.result.repository.legacy.command.GetSpeciesForMapResultCommand;
+import fr.ifremer.coser.result.repository.legacy.command.GetSpeciesForPopulationIndicatorResultCommand;
+import fr.ifremer.coser.result.repository.legacy.command.GetSpeciesListForCommunityIndicatorResultCommand;
+import fr.ifremer.coser.result.repository.legacy.command.GetSpeciesListForExtractRawDataAndResultsCommand;
+import fr.ifremer.coser.result.repository.legacy.command.GetZonesForCommunityIndicatorResultCommand;
+import fr.ifremer.coser.result.repository.legacy.command.GetZonesForExtractRawDataCommand;
+import fr.ifremer.coser.result.repository.legacy.command.GetZonesForMapResultCommand;
+import fr.ifremer.coser.result.repository.legacy.command.GetZonesForPopulationIndicatorResultCommand;
+import fr.ifremer.coser.result.repository.legacy.command.GetZonesListForExtractRawDataAndResultsCommand;
+
+import java.util.Map;
+
+/**
+ * Created on 3/12/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class LegacyResultRepositoryCommandEngine implements ResultRepositoryCommandEngine {
+
+ protected final LegacyResultRepository resultRepository;
+
+ protected final Map<String, ResultRepositoryCommand<LegacyResultRepository, ?>> commands;
+
+ public LegacyResultRepositoryCommandEngine(LegacyResultRepository resultRepository) {
+ this.resultRepository = resultRepository;
+ this.commands = Maps.newHashMap();
+
+ // get map result
+ loadCommand(new GetZonesForMapResultCommand());
+ loadCommand(new GetSpeciesForMapResultCommand());
+ loadCommand(new GetMapResultCommand());
+
+ // get community indicator result
+ loadCommand(new GetZonesForCommunityIndicatorResultCommand());
+ loadCommand(new GetIndicatorsForCommunityIndicatorResultCommand());
+ loadCommand(new GetSpeciesListForCommunityIndicatorResultCommand());
+ loadCommand(new GetCommunityIndicatorResultCommand());
+
+ // get population indicator result
+ loadCommand(new GetZonesForPopulationIndicatorResultCommand());
+ loadCommand(new GetSpeciesForPopulationIndicatorResultCommand());
+ loadCommand(new GetIndicatorsForPopulationIndicatorResultCommand());
+ loadCommand(new GetPopulationIndicatorResultCommand());
+
+ // get all results
+ loadCommand(new GetAllResultsCommand());
+
+ // extract raw data
+ loadCommand(new GetZonesForExtractRawDataCommand());
+ loadCommand(new ExtractRawDataCommand());
+
+ // extract raw data and results
+ loadCommand(new GetZonesListForExtractRawDataAndResultsCommand());
+ loadCommand(new GetSpeciesListForExtractRawDataAndResultsCommand());
+ loadCommand(new GetIndicatorsForExtractRawDataAndResultsCommand());
+ loadCommand(new ExtractRawDataAndResultsCommand());
+
+ // delete results
+ loadCommand(new DeleteResultsCommand());
+ }
+
+ @Override
+ public LegacyResultRepository getResultRepository() {
+ return resultRepository;
+ }
+
+ @Override
+ public <R extends CoserRequest> boolean acceptRequest(R request) {
+ ResultRepositoryCommand<LegacyResultRepository, R> command = getCommand(request);
+ boolean result = command.accept(resultRepository, request);
+ return result;
+ }
+
+ @Override
+ public <R extends CoserRequest> CoserResult executeRequest(R request) {
+ ResultRepositoryCommand<LegacyResultRepository, R> command = getCommand(request);
+ CoserResult result = command.execute(resultRepository, request);
+ return result;
+ }
+
+ protected <R extends CoserRequest> ResultRepositoryCommand<LegacyResultRepository, R> getCommand(R request) {
+ Preconditions.checkNotNull(request);
+ String requestTypeName = request.getClass().getName();
+ ResultRepositoryCommand<LegacyResultRepository, ?> resultRepositoryCommand = commands.get(requestTypeName);
+ Preconditions.checkNotNull(resultRepositoryCommand);
+ return (ResultRepositoryCommand<LegacyResultRepository, R>) resultRepositoryCommand;
+ }
+
+ protected void loadCommand(ResultRepositoryCommand<LegacyResultRepository, ?> command) {
+ String name = command.getRequestType().getName();
+ commands.put(name, command);
+ }
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/LegacyResultRepositoryCommandEngine.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/LegacyResultRepositoryProvider.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/LegacyResultRepositoryProvider.java 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/LegacyResultRepositoryProvider.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -32,6 +32,7 @@
import fr.ifremer.coser.bean.RSufiResultPath;
import fr.ifremer.coser.bean.Selection;
import fr.ifremer.coser.result.ResultRepositoryInitializationException;
+import fr.ifremer.coser.result.repository.ResultRepositoryCommandEngine;
import fr.ifremer.coser.result.repository.ResultRepositoryProvider;
import fr.ifremer.coser.services.ProjectService;
import org.apache.commons.logging.Log;
@@ -80,6 +81,11 @@
return result;
}
+ @Override
+ public ResultRepositoryCommandEngine newEngine(LegacyResultRepository repository) {
+ return new LegacyResultRepositoryCommandEngine(repository);
+ }
+
/**
* Retourne tous les projets qui ont des résultats.
* <p/>
@@ -90,7 +96,7 @@
* @return results paths
* @throws CoserBusinessException
*/
- public Set<LegacyResultRepository> findAllProjectWithResult(CoserServiceContext serviceContext) throws CoserBusinessException {
+ protected Set<LegacyResultRepository> findAllProjectWithResult(CoserServiceContext serviceContext) throws CoserBusinessException {
ProjectService projectService = new ProjectService(serviceContext.getConfig());
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/LegacyResultRepositoryType.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/LegacyResultRepositoryType.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/LegacyResultRepositoryType.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,68 @@
+package fr.ifremer.coser.result.repository.legacy;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.collect.Sets;
+import fr.ifremer.coser.result.ResultType;
+import fr.ifremer.coser.result.repository.ResultRepositoryType;
+
+import java.util.Set;
+
+import static org.nuiton.i18n.I18n.n;
+
+/**
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class LegacyResultRepositoryType implements ResultRepositoryType {
+
+ /**
+ * Id of result source.
+ */
+ public static final String ID = "rsufi";
+
+ /**
+ * Public shared instance of type.
+ */
+ public static final LegacyResultRepositoryType INSTANCE = new LegacyResultRepositoryType();
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public String getId() {
+ return ID;
+ }
+
+ @Override
+ public String getLabelKey() {
+ return n("coser.business.result.repository.type.legacy");
+ }
+
+ @Override
+ public Set<ResultType> getResultTypes() {
+ return Sets.immutableEnumSet(ResultType.MAP, ResultType.INDICATOR);
+ }
+
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/LegacyResultRepositoryType.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Deleted: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/MapResultProducer.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/MapResultProducer.java 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/MapResultProducer.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -1,123 +0,0 @@
-package fr.ifremer.coser.result.repository.legacy;
-
-/*
- * #%L
- * Coser :: Business
- * %%
- * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>.
- * #L%
- */
-
-import com.google.common.base.Preconditions;
-import fr.ifremer.coser.bean.RSufiResultPath;
-import fr.ifremer.coser.bean.ZoneMap;
-import fr.ifremer.coser.result.FileResult;
-import fr.ifremer.coser.result.repository.RequestUnavailableForProducerException;
-import fr.ifremer.coser.result.repository.ResultProducer;
-import fr.ifremer.coser.result.request.MapRequest;
-
-import java.io.File;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Created on 3/11/14.
- *
- * @author Tony Chemit <chemit(a)codelutin.com>
- * @since 1.5
- */
-public class MapResultProducer implements ResultProducer<MapRequest> {
-
- protected final LegacyResultRepository repository;
-
- protected final RSufiResultPath path;
-
- public MapResultProducer(LegacyResultRepository repository) {
- this.repository = repository;
- this.path = repository.path;
- }
-
- @Override
- public LegacyResultRepository getRepository() {
- return repository;
- }
-
- @Override
- public boolean acceptResult(MapRequest request) {
- return repository.mapsResult &&
- repository.matchFacade(request) &&
- repository.matchZone(request) &&
- matchSpecies(request);
- }
-
- @Override
- public Map<String, String> getAvailableZones(MapRequest request) {
- Preconditions.checkNotNull(request.getFacade());
-
- boolean match = repository.matchFacade(request);
-
- Map<String, String> result = null;
- if (match) {
- ZoneMap zonesMap = repository.getZonesMap();
- List<String> allowedZones = zonesMap.getZonesForFacade(request.getFacade());
- result = zonesMap.getSubZonesMap(path.getRsufiResult().getZone(), allowedZones);
- }
- return result;
- }
-
- @Override
- public Map<String, String> getAvailableSpecies(MapRequest request) {
- Preconditions.checkNotNull(request.getFacade());
- Preconditions.checkNotNull(request.getZone());
-
- Map<String, String> result = null;
-
- boolean match = repository.mapsResult &&
- repository.matchFacade(request) &&
- repository.matchZone(request);
- if (match) {
-
- // get all map species for given facade + zone
- result = repository.getPopulationIndicatorSpecies();
- }
- return result;
- }
-
- @Override
- public Map<String, String> getAvailableIndicators(MapRequest request) {
- throw RequestUnavailableForProducerException.newException("getAvailableIndicators", this);
- }
-
- @Override
- public FileResult produceResult(MapRequest r) {
-
- File resultZip = repository.getMapSpeciesFile(r.getSpecies());
-
- FileResult result = new FileResult(repository.getId(), resultZip);
- return result;
- }
-
- // --------------------------------------------------------------------- //
- // --- Matchers ------------------------------------------------------- //
- // --------------------------------------------------------------------- //
-
- protected boolean matchSpecies(MapRequest request) {
- String species = request.getSpecies();
- File file = repository.getMapSpeciesFile(species);
- return file != null;
- }
-}
Deleted: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/PopulationIndicatorResultProducer.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/PopulationIndicatorResultProducer.java 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/PopulationIndicatorResultProducer.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -1,356 +0,0 @@
-package fr.ifremer.coser.result.repository.legacy;
-
-/*
- * #%L
- * Coser :: Business
- * %%
- * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>.
- * #L%
- */
-
-import com.google.common.base.Preconditions;
-import fr.ifremer.coser.CoserTechnicalException;
-import fr.ifremer.coser.bean.RSufiResultPath;
-import fr.ifremer.coser.bean.ZoneMap;
-import fr.ifremer.coser.result.FileResult;
-import fr.ifremer.coser.result.Reports;
-import fr.ifremer.coser.result.repository.ResultProducer;
-import fr.ifremer.coser.result.request.PopulationIndicatorRequest;
-import fr.ifremer.coser.storage.DataStorage;
-import fr.ifremer.coser.storage.DataStorages;
-import fr.ifremer.coser.storage.MemoryDataStorage;
-import org.apache.commons.lang3.StringUtils;
-import org.jfree.chart.ChartUtilities;
-import org.jfree.chart.JFreeChart;
-import org.jfree.chart.axis.CategoryAxis;
-import org.jfree.chart.axis.CategoryLabelPositions;
-import org.jfree.chart.axis.NumberAxis;
-import org.jfree.chart.axis.ValueAxis;
-import org.jfree.chart.plot.CategoryPlot;
-import org.jfree.chart.plot.PlotOrientation;
-import org.jfree.chart.renderer.category.CategoryItemRenderer;
-import org.jfree.chart.renderer.category.StatisticalLineAndShapeRenderer;
-import org.jfree.data.statistics.DefaultStatisticalCategoryDataset;
-
-import java.awt.Color;
-import java.io.File;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Created on 3/11/14.
- *
- * @author Tony Chemit <chemit(a)codelutin.com>
- * @since 1.5
- */
-public class PopulationIndicatorResultProducer implements ResultProducer<PopulationIndicatorRequest> {
-
- protected final LegacyResultRepository repository;
-
- protected final Reports reports;
-
- protected final RSufiResultPath path;
-
- protected final File basedir;
-
- protected final String surveyName;
-
- public PopulationIndicatorResultProducer(LegacyResultRepository repository) {
- this.repository = repository;
- this.path = repository.path;
- this.reports = repository.reports;
- this.basedir = repository.basedir;
- this.surveyName = repository.surveyName;
- }
-
- @Override
- public LegacyResultRepository getRepository() {
- return repository;
- }
-
- @Override
- public boolean acceptResult(PopulationIndicatorRequest request) {
- return repository.indicatorsResult &&
- repository.matchFacade(request) &&
- repository.matchZone(request) &&
- matchSpeciesAndIndicator(request);
- }
-
- @Override
- public Map<String, String> getAvailableZones(PopulationIndicatorRequest request) {
- Preconditions.checkNotNull(request.getFacade());
-
- boolean match = repository.matchFacade(request);
-
- Map<String, String> result = null;
- if (match) {
- ZoneMap zonesMap = repository.getZonesMap();
- List<String> allowedZones = zonesMap.getZonesForFacade(request.getFacade());
- result = zonesMap.getSubZonesMap(path.getRsufiResult().getZone(), allowedZones);
- }
- return result;
- }
-
- @Override
- public Map<String, String> getAvailableSpecies(PopulationIndicatorRequest request) {
- Preconditions.checkNotNull(request.getFacade());
- Preconditions.checkNotNull(request.getZone());
-
- Map<String, String> result = null;
-
- boolean match = repository.indicatorsResult &&
- repository.matchFacade(request) &&
- repository.matchZone(request);
-
- if (match) {
- // get all population indicator species for given facade + zone
- result = repository.getPopulationIndicatorSpecies();
- }
- return result;
- }
-
- @Override
- public Map<String, String> getAvailableIndicators(PopulationIndicatorRequest request) {
- Preconditions.checkNotNull(request.getFacade());
- Preconditions.checkNotNull(request.getZone());
- Preconditions.checkNotNull(request.getSpecies());
-
- Map<String, String> result = null;
-
- boolean match = repository.indicatorsResult &&
- repository.matchFacade(request) &&
- repository.matchZone(request) &&
- matchSpecies(request);
-
- if (match) {
-
- // get all indicators for given facade + zone + species
- Set<String> indicatorList = repository.getPopulationIndicators(request.getSpecies());
- result = repository.getIndicatorsMap().getIndicatorsValues(indicatorList, request.getLocale());
- }
-
- return result;
- }
-
- @Override
- public FileResult produceResult(PopulationIndicatorRequest request) {
-
- File file = null;
- switch (request.getResultType()) {
- case DATA:
- file = getPopulationIndicatorDataFile(request.getIndicator(),
- request.getSpecies());
- break;
-
- case GRAPH:
- file = getPopulationIndicatorGraphFile(request.getLocale(),
- request.getZone(),
- request.getIndicator(),
- request.getSpecies());
- break;
- }
-
-
- FileResult result = new FileResult(repository.getId(), file);
- return result;
- }
-
- protected File getPopulationIndicatorDataFile(String species, String indicator) {
-
- DataStorage dataStorage = new MemoryDataStorage();
-
- Iterator<String[]> iterator = repository.loadPopulationIndicatorStorage(false);
-
- // add header
- dataStorage.add(iterator.next());
-
- while (iterator.hasNext()) {
- String[] tuple = iterator.next();
- if (repository.matchPopulationSpeciesAndIndicator(tuple, species, indicator)) {
- dataStorage.add(tuple);
- }
- }
- File result = DataStorages.save(dataStorage, "coser-chart-population-indicator",
- ".csv"
- );
- return result;
- }
-
- protected File getPopulationIndicatorGraphFile(Locale locale,
- String zone,
- String species,
- String indicator) {
-
- int multiplicator = 1;
- int minYear = Integer.MAX_VALUE;
- int maxYear = Integer.MIN_VALUE;
- boolean indicatorFound = false;
- Map<Integer, Double[]> graphData = new HashMap<Integer, Double[]>();
- Iterator<String[]> iterator = repository.loadPopulationIndicatorStorage(true);
- while (iterator.hasNext()) {
- String[] tuple = iterator.next();
-
- if (repository.matchPopulationSpeciesAndIndicator(tuple, species, indicator)) {
- indicatorFound = true;
-
- // XXX echatellier, maybe take care of list here ?
-
- Double estimation = Double.parseDouble(tuple[6]);
- Double ecart = Double.parseDouble(tuple[7]);
- int year = Integer.parseInt(tuple[5]);
-
- if (year < minYear) {
- minYear = year;
- }
- if (year > maxYear) {
- maxYear = year;
- }
- graphData.put(year, new Double[]{estimation, ecart});
-
- // si les données sont énormes, on affiche les données
- // / multiplicator et on le mentionne dans la légende
- if (estimation > 1e9) {
- multiplicator = 1000000;
- }
- if (estimation > 1e6 && multiplicator < 1000000) {
- multiplicator = 1000;
- }
- }
- }
-
- File result = null;
-
- // avec l'extraction des données, on peut demander a générer un graphique
- // sur un indicateur qui n'est pas présent dans le projet courant,
- // dans ce cas, on retourne null
- if (indicatorFound) {
-
- String zoneDisplayName = repository.getZonesMap().getZoneFullName(zone);
- String indicatorName = repository.getIndicatorsMap().getIndicatorValue(indicator, locale);
- String unit = repository.getIndicatorsMap().getIndicatorUnit(indicator);
-
- // get graph title
- String title = zoneDisplayName;
- title += " - " + indicatorName;
- title += " - " + repository.getSpeciesMap().getReportDisplayName(species);
-
- // generate dataset with sorted data
- DefaultStatisticalCategoryDataset statisticalDataset = new DefaultStatisticalCategoryDataset();
- for (int indexYear = minYear; indexYear <= maxYear; ++indexYear) {
- Double[] entry = graphData.get(indexYear);
- if (entry != null) {
- Double estimation = entry[0] / multiplicator;
- Double ecart = entry[1] / multiplicator;
- statisticalDataset.add(estimation, ecart, "Serie1", (Comparable) indexYear);
- } else {
- statisticalDataset.add(null, null, "Serie1", indexYear);
- }
- }
-
- // configure chart
- //CategoryAxis categoryAxis = new CategoryAxis(t("coser.business.common.year"));
- String yearAxis = reports.getYearChartTitle(locale);
- CategoryAxis categoryAxis = new CategoryAxis(yearAxis);
- categoryAxis.setCategoryMargin(0);
- categoryAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
- // label horizontaux
- String legendY = indicatorName;
- if (multiplicator != 1) {
- // affiche par exemple : cm * 1000
- legendY += " (" + unit + "*" + multiplicator + ")";
- } else if (StringUtils.isNotEmpty(unit)) {
- legendY += " (" + unit + ")";
- }
- ValueAxis valueAxis = new NumberAxis(legendY);
- valueAxis.setUpperMargin(0.1);
-
- CategoryItemRenderer renderer = new StatisticalLineAndShapeRenderer(false, true);
-
- // n'affiche pas les nombre sur le graphique
- //StandardCategoryItemLabelGenerator itemLabelGenerator = new StandardCategoryItemLabelGenerator();
- //renderer.setBaseItemLabelGenerator(itemLabelGenerator);
- //renderer.setBaseItemLabelsVisible(true);
-
- CategoryPlot plot = new CategoryPlot(statisticalDataset, categoryAxis, valueAxis, renderer);
- plot.setOrientation(PlotOrientation.VERTICAL);
- JFreeChart chart = new JFreeChart(title,
- JFreeChart.DEFAULT_TITLE_FONT, plot, true);
-
- // remove series legend
- chart.removeLegend();
- // white background
- chart.setBackgroundPaint(Color.WHITE);
-
- try {
- result = File.createTempFile("coser-chart-population-indicator-", ".png");
- result.deleteOnExit();
- ChartUtilities.saveChartAsPNG(result, chart, 800, 400);
- } catch (IOException ex) {
- throw new CoserTechnicalException("Can't save chart", ex);
- }
- }
-
- return result;
- }
-
- // --------------------------------------------------------------------- //
- // --- Matchers -------------------------------------------------------- //
- // --------------------------------------------------------------------- //
-
- protected boolean matchSpecies(PopulationIndicatorRequest request) {
- Preconditions.checkNotNull(request.getSpecies());
-
- String species = request.getSpecies();
-
- boolean result = false;
-
- Iterator<String[]> iterator = repository.loadPopulationIndicatorStorage(true);
- while (iterator.hasNext()) {
- String[] tuple = iterator.next();
- if (repository.matchPopulationSpecies(tuple, species)) {
- result = true;
- break;
- }
- }
- return result;
- }
-
- protected boolean matchSpeciesAndIndicator(PopulationIndicatorRequest request) {
- Preconditions.checkNotNull(request.getSpecies());
- Preconditions.checkNotNull(request.getIndicator());
-
- String species = request.getSpecies();
- String indicator = request.getIndicator();
-
- boolean result = false;
-
- Iterator<String[]> iterator = repository.loadPopulationIndicatorStorage(true);
- while (iterator.hasNext()) {
- String[] tuple = iterator.next();
- if (repository.matchPopulationSpeciesAndIndicator(tuple, species, indicator)) {
- result = true;
- break;
- }
- }
- return result;
- }
-}
Deleted: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/RawDataResultProducer.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/RawDataResultProducer.java 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/RawDataResultProducer.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -1,178 +0,0 @@
-package fr.ifremer.coser.result.repository.legacy;
-
-/*
- * #%L
- * Coser :: Business
- * %%
- * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.coser.CoserBusinessConfig;
-import fr.ifremer.coser.CoserBusinessException;
-import fr.ifremer.coser.CoserConstants;
-import fr.ifremer.coser.CoserTechnicalException;
-import fr.ifremer.coser.bean.Project;
-import fr.ifremer.coser.bean.RSufiResultPath;
-import fr.ifremer.coser.bean.Selection;
-import fr.ifremer.coser.bean.ZoneMap;
-import fr.ifremer.coser.result.FileResult;
-import fr.ifremer.coser.result.Reports;
-import fr.ifremer.coser.result.repository.RequestUnavailableForProducerException;
-import fr.ifremer.coser.result.repository.ResultProducer;
-import fr.ifremer.coser.result.request.RawDataRequest;
-import fr.ifremer.coser.services.ProjectService;
-import org.apache.commons.io.FileUtils;
-import org.nuiton.util.FileUtil;
-import org.nuiton.util.ZipUtil;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Date;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-
-/**
- * Created on 3/11/14.
- *
- * @author Tony Chemit <chemit(a)codelutin.com>
- * @since 1.5
- */
-public class RawDataResultProducer implements ResultProducer<RawDataRequest> {
-
- protected final LegacyResultRepository repository;
-
- protected final Reports reports;
-
- protected final RSufiResultPath path;
-
- protected final File basedir;
-
- protected final ProjectService projectService;
-
- private CoserBusinessConfig config;
-
- private String surveyName;
-
- public RawDataResultProducer(LegacyResultRepository repository) {
- this.repository = repository;
- this.path = repository.path;
- this.reports = repository.reports;
- this.projectService = repository.projectService;
- this.basedir = repository.basedir;
- this.config = repository.getConfig();
- this.surveyName = repository.surveyName;
- }
-
- @Override
- public LegacyResultRepository getRepository() {
- return repository;
- }
-
- @Override
- public boolean acceptResult(RawDataRequest request) {
- return repository.dataResult &&
- repository.matchFacade(request) &&
- matchZone(request);
- }
-
- @Override
- public Map<String, String> getAvailableZones(RawDataRequest request) {
- boolean match = repository.matchFacade(request);
-
- Map<String, String> result = null;
- if (match) {
- ZoneMap zonesMap = repository.getZonesMap();
- List<String> allowedZones = zonesMap.getZonesForFacade(request.getFacade());
- result = zonesMap.getSubZonesMap(path.getRsufiResult().getZone(), allowedZones);
- }
- return result;
- }
-
- @Override
- public Map<String, String> getAvailableSpecies(RawDataRequest request) {
- throw RequestUnavailableForProducerException.newException("getAvailableSpecies", this);
- }
-
- @Override
- public Map<String, String> getAvailableIndicators(RawDataRequest request) {
- throw RequestUnavailableForProducerException.newException("getAvailableIndicators", this);
- }
-
- @Override
- public FileResult produceResult(RawDataRequest r) {
-
- Locale locale = r.getLocale();
-
- Project project = path.getProject();
- Selection selection = path.getSelection();
- try {
- // be sure that data are available for this project
- // or it will fail
- projectService.loadSelectionData(basedir.getParentFile(), project, selection);
- } catch (CoserBusinessException e) {
- throw new CoserTechnicalException("Could not load project selection", e);
- }
-
- File resultZip;
-
- try {
- File tempDir = FileUtil.createTempDirectory("coser-source-", "-tmp");
-
- // il ne faut pas les fichiers de selection, mais leurs
- // export rsufi (sans les lignes, et les quotes)
- File archiveDir = projectService.extractRSUfiData(project, selection, tempDir, true);
-
- // add decharge file
- String filename = reports.getDechargeFilename(locale);
- File dechargePDF = new File(archiveDir, filename);
-
- Date lastDataUpdateDate = config.getLastDataUpdateDate();
-
- reports.generateDechargePDF(dechargePDF, locale, lastDataUpdateDate, surveyName);
-
- // ajout du reftax dans le zip
- File reftaxFile = new File(basedir, CoserConstants.Category.REFTAX_SPECIES.getStorageFileName());
- FileUtils.copyFileToDirectory(reftaxFile, archiveDir);
-
- // make zip
- resultZip = File.createTempFile("coser-source-", ".zip");
- resultZip.deleteOnExit();
- ZipUtil.compress(resultZip, archiveDir);
-
- // clean directory
- FileUtils.deleteDirectory(tempDir);
- } catch (IOException e) {
- throw new CoserTechnicalException("Can't create zip file", e);
- } catch (CoserBusinessException e) {
- throw new CoserTechnicalException("Can't create zip file", e);
- }
-
- FileResult result = new FileResult(repository.getId(), resultZip);
- return result;
- }
-
- // --------------------------------------------------------------------- //
- // --- Matchers ------------------------------------------------------- //
- // --------------------------------------------------------------------- //
-
- protected boolean matchZone(RawDataRequest request) {
- return path.getRsufiResult().getZone().equals(request.getZone());
- }
-
-}
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/DeleteResultsCommand.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/DeleteResultsCommand.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/DeleteResultsCommand.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,133 @@
+package fr.ifremer.coser.result.repository.legacy.command;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.coser.CoserTechnicalException;
+import fr.ifremer.coser.result.CoserResult;
+import fr.ifremer.coser.result.ResultType;
+import fr.ifremer.coser.result.VoidResult;
+import fr.ifremer.coser.result.repository.ResultRepositoryCommand;
+import fr.ifremer.coser.result.repository.legacy.LegacyResultRepository;
+import fr.ifremer.coser.result.repository.legacy.LegacyResultRepositoryType;
+import fr.ifremer.coser.result.request.DeleteResultsRequest;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+
+/**
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class DeleteResultsCommand implements ResultRepositoryCommand<LegacyResultRepository, DeleteResultsRequest> {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(DeleteResultsCommand.class);
+//
+// protected final LegacyResultRepository repository;
+//
+// protected final RSufiResult rsufiResult;
+//
+// public DeleteResultsCommand(LegacyResultRepository repository) {
+// this.repository = repository;
+// this.rsufiResult = repository.path.getRsufiResult();
+// }
+//
+// @Override
+// public LegacyResultRepository getRepository() {
+// return repository;
+// }
+
+
+ @Override
+ public Class<DeleteResultsRequest> getRequestType() {
+ return DeleteResultsRequest.class;
+ }
+
+ @Override
+ public boolean accept(LegacyResultRepository repository, DeleteResultsRequest request) {
+ boolean result = matchRepositoryType(request) &&
+ matchResultType(repository, request) &&
+ matchPublish(repository) &&
+ matchZone(repository, request);
+ return result;
+ }
+
+ @Override
+ public CoserResult execute(LegacyResultRepository repository, DeleteResultsRequest request) {
+ File basedir = repository.getBasedir();
+ if (log.isInfoEnabled()) {
+ log.info("Will delete project at: " + basedir);
+ }
+ try {
+ FileUtils.deleteDirectory(basedir);
+ } catch (IOException e) {
+ throw new CoserTechnicalException("Could not delete project at: " + basedir, e);
+ }
+ return new VoidResult(repository.getId());
+ }
+
+ // --------------------------------------------------------------------- //
+ // --- Matchers -------------------------------------------------------- //
+ // --------------------------------------------------------------------- //
+
+ protected boolean matchRepositoryType(DeleteResultsRequest request) {
+ boolean result = request.getResultRepositoryType().equals(LegacyResultRepositoryType.ID);
+ return result;
+ }
+
+ protected boolean matchResultType(LegacyResultRepository repository, DeleteResultsRequest request) {
+ boolean result;
+ ResultType resultType = request.getResultType();
+ switch (resultType) {
+
+ case MAP:
+ result = repository.isMapsResult();
+ break;
+ case INDICATOR:
+ result = repository.isIndicatorsResult();
+ break;
+ default:
+ result = false;
+ break;
+ }
+ return result;
+ }
+
+ protected boolean matchPublish(LegacyResultRepository repository) {
+ boolean result = repository.isPubliableResult();
+ return result;
+ }
+
+ protected boolean matchZone(LegacyResultRepository repository, DeleteResultsRequest request) {
+ List<String> zoneList = request.getZoneList();
+ boolean result = zoneList.contains(repository.getZone());
+ return result;
+ }
+
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/DeleteResultsCommand.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Copied: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/ExtractRawDataAndResultsCommand.java (from rev 1144, trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/ExtractResultProducer.java)
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/ExtractRawDataAndResultsCommand.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/ExtractRawDataAndResultsCommand.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,753 @@
+package fr.ifremer.coser.result.repository.legacy.command;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Maps;
+import fr.ifremer.coser.CoserTechnicalException;
+import fr.ifremer.coser.bean.IndicatorMap;
+import fr.ifremer.coser.bean.SpeciesMap;
+import fr.ifremer.coser.result.FileResult;
+import fr.ifremer.coser.result.Reports;
+import fr.ifremer.coser.result.repository.ResultRepositoryCommand;
+import fr.ifremer.coser.result.repository.legacy.LegacyResultRepository;
+import fr.ifremer.coser.result.request.ExtractRawDataAndResultsRequest;
+import fr.ifremer.coser.storage.DataStorage;
+import fr.ifremer.coser.storage.DataStorages;
+import fr.ifremer.coser.storage.MemoryDataStorage;
+import fr.ifremer.coser.util.DataType;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.MapUtils;
+import org.apache.commons.collections4.keyvalue.MultiKey;
+import org.apache.commons.collections4.map.MultiKeyMap;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.tuple.Pair;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jfree.chart.ChartUtilities;
+import org.jfree.chart.JFreeChart;
+import org.jfree.chart.axis.CategoryAxis;
+import org.jfree.chart.axis.CategoryLabelPositions;
+import org.jfree.chart.axis.NumberAxis;
+import org.jfree.chart.axis.ValueAxis;
+import org.jfree.chart.plot.CategoryPlot;
+import org.jfree.chart.plot.PlotOrientation;
+import org.jfree.chart.renderer.category.CategoryItemRenderer;
+import org.jfree.chart.renderer.category.StatisticalLineAndShapeRenderer;
+import org.jfree.data.statistics.DefaultStatisticalCategoryDataset;
+import org.nuiton.util.FileUtil;
+import org.nuiton.util.ZipUtil;
+
+import java.awt.Color;
+import java.io.File;
+import java.io.IOException;
+import java.io.StringWriter;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class ExtractRawDataAndResultsCommand implements ResultRepositoryCommand<LegacyResultRepository, ExtractRawDataAndResultsRequest> {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(ExtractRawDataAndResultsCommand.class);
+
+ @Override
+ public Class<ExtractRawDataAndResultsRequest> getRequestType() {
+ return ExtractRawDataAndResultsRequest.class;
+ }
+
+ @Override
+ public boolean accept(LegacyResultRepository repository,
+ ExtractRawDataAndResultsRequest request) {
+ return matchExtractTypeSet(repository, request) &&
+ matchZoneList(repository, request) &&
+ (matchPopulationIndicatorListAndSpeciesList(repository, request) ||
+ matchCommunityIndicatorListAndSpeciesList(repository, request));
+ }
+
+ @Override
+ public FileResult execute(LegacyResultRepository repository,
+ ExtractRawDataAndResultsRequest r) {
+
+ Locale locale = r.getLocale();
+ List<String> zoneList = r.getZoneList();
+ List<DataType> extractTypeList = r.getExtractTypeList();
+ List<String> speciesList = r.getSpeciesList();
+ List<String> communityIndicatorList = r.getCommunityIndicatorList();
+ List<String> populationIndicatorList = r.getPopulationIndicatorList();
+
+ File resultZip = null;
+ File tempDir = null;
+ try {
+ tempDir = FileUtil.createTempDirectory("coser-extract-", "-tmp");
+
+ File subDir = new File(tempDir, "Indicateurs_Ifremer");
+ FileUtils.forceMkdir(subDir);
+
+ // les sources se retrouve dans le zip a cote du pdf
+ if (extractTypeList.contains(DataType.SOURCE)) {
+ if (log.isDebugEnabled()) {
+ log.debug("Extracting sources");
+ }
+ File srcDir = new File(subDir, "sources");
+ extractSource(repository, srcDir);
+ }
+
+ // les cartes doivent se retrouver dans le pdf
+ MultiKeyMap pdfMaps = null;
+ if (extractTypeList.contains(DataType.MAP)) {
+ if (log.isDebugEnabled()) {
+ log.debug("Extracting maps");
+ }
+ SpeciesMap speciesMap = repository.getSpeciesMap();
+ String zone = repository.getZone();
+ for (String species : speciesList) {
+ File mapFile = repository.getMapSpeciesFile(species);
+ pdfMaps.put(zone, speciesMap.getSpeciesName(species), mapFile);
+ }
+ }
+
+ // les graphiques sont également dans le pdf
+ MultiKeyMap pdfCharts = null;
+ if (CollectionUtils.isNotEmpty(communityIndicatorList) ||
+ CollectionUtils.isNotEmpty(populationIndicatorList)) {
+ if (log.isDebugEnabled()) {
+ log.debug("Extracting charts");
+ }
+ pdfCharts = extractCharts(repository,
+ speciesList,
+ communityIndicatorList,
+ populationIndicatorList,
+ locale);
+ }
+
+ Reports reports = repository.getReports();
+
+ // generate pdf if necessary
+ if (MapUtils.isNotEmpty(pdfMaps) || MapUtils.isNotEmpty(pdfCharts)) {
+ if (log.isDebugEnabled()) {
+ log.debug("Generated Extract PDF");
+ }
+ reports.generateExtractPDF(subDir,
+ zoneList,
+ pdfMaps,
+ pdfCharts,
+ repository.getZonesMap(),
+ locale);
+ }
+
+ // fichier de décharge en pdf
+ if (log.isDebugEnabled()) {
+ log.debug("Generated decharge PDF");
+ }
+ String filename = reports.getDechargeFilename(locale);
+ File dechargePDF = new File(subDir, filename);
+ reports.generateDechargePDF(dechargePDF, locale, null, null);
+
+ // make zip
+ if (log.isDebugEnabled()) {
+ log.debug("Make final archive");
+ }
+ resultZip = File.createTempFile("coser-extract-", ".zip");
+ resultZip.deleteOnExit();
+ ZipUtil.compress(resultZip, subDir);
+
+ // clean directory
+ FileUtils.deleteDirectory(tempDir);
+ } catch (IOException ex) {
+ throw new CoserTechnicalException("Can't create zip file", ex);
+ } finally {
+ // clean directory
+ FileUtils.deleteQuietly(tempDir);
+ }
+
+ FileResult result = new FileResult(repository.getId(), resultZip);
+ return result;
+ }
+
+ /**
+ * Generate raw data after selection in a sub directory (named of the zone) of the given directory.
+ *
+ * @param directory where to generate file
+ */
+ protected void extractSource(LegacyResultRepository repository, File directory) {
+
+ repository.loadSelectionData();
+
+ // il ne faut pas les fichiers de selection, mais leurs
+ // export rsufi (sans les lignes, et les quotes)
+ File zoneDirectory = new File(directory, repository.getZone());
+
+ try {
+ FileUtils.forceMkdir(zoneDirectory);
+ } catch (IOException e) {
+ throw new CoserTechnicalException("Could not create directory: " + zoneDirectory, e);
+ }
+
+ repository.extractRSUfiData(zoneDirectory);
+ }
+
+ /**
+ * Retourne les indicateurs calculés avec leurs traductions scientifique
+ * pour la zone et l'especes souhaitées.
+ *
+ * @param species especes (if {@code null} look for com indicators
+ * @param comIndicators comIndicator
+ * @param popIndicators popIndicators
+ * @param locale locale
+ * @return la liste des indicateurs (zone, speciesname, [graphfile, graphdata])
+ */
+ protected MultiKeyMap extractCharts(LegacyResultRepository repository,
+ Collection<String> species,
+ Collection<String> comIndicators,
+ Collection<String> popIndicators,
+ Locale locale) {
+
+ MultiKeyMap chartFileAndDatas = new MultiKeyMap();
+
+ String zone = repository.getZone();
+ String zoneDisplayName = repository.getZonesMap().getZoneFullName(zone);
+
+ if (CollectionUtils.isNotEmpty(comIndicators)) {
+ Map<String, Pair<File, String>> chartFileAndDataCom = getRsufiResultComCharts(repository,
+ comIndicators,
+ zoneDisplayName,
+ repository.getIndicatorsMap(),
+ locale,
+ 650,
+ 430);
+ // put in multimap as zone,speciesname, data
+ for (Map.Entry<String, Pair<File, String>> entry : chartFileAndDataCom.entrySet()) {
+ chartFileAndDatas.put(zone, entry.getKey(), entry.getValue());
+ }
+ }
+
+ if (CollectionUtils.isNotEmpty(popIndicators)) {
+ Map<String, Pair<File, String>> chartFileAndDataPop = getRsufiResultPopCharts(repository,
+ species,
+ popIndicators,
+ zoneDisplayName,
+ repository.getIndicatorsMap(),
+ locale,
+ 650,
+ 430);
+ // put in multimap as zone,speciesname, data
+ for (Map.Entry<String, Pair<File, String>> entry : chartFileAndDataPop.entrySet()) {
+ chartFileAndDatas.put(zone, entry.getKey(), entry.getValue());
+ }
+ }
+
+ return chartFileAndDatas;
+ }
+
+ /**
+ * Generate community graph for selected indicators.
+ * Used by web ui extraction.
+ *
+ * @param indicators indicators to extract
+ * @param zoneDisplayName zone full name
+ * @param indicatorMap indicator localized map
+ * @param locale locale
+ * @param width graph width
+ * @param height graph height
+ * @return maps of generated graph image (temp file) and data indexed by natural key (indicator - species)
+ */
+ public Map<String, Pair<File, String>> getRsufiResultComCharts(LegacyResultRepository repository,
+ Collection<String> indicators,
+ String zoneDisplayName,
+ IndicatorMap indicatorMap,
+ Locale locale,
+ int width, int height) {
+
+ Map<String, Pair<File, String>> result = Maps.newHashMap();
+
+ int multiplicator = 1;
+ int minYear = Integer.MAX_VALUE;
+ int maxYear = Integer.MIN_VALUE;
+
+ Map<String, Map<Integer, Double[]>> indicatorGraphData = new HashMap<String, Map<Integer, Double[]>>();
+ Map<String, String> indicatorLists = new HashMap<String, String>();
+ Map<String, DataStorage> indicatorStorages = new HashMap<String, DataStorage>();
+
+ // Campagne Indicateur Liste Strate Annee Estimation EcartType CV
+ Iterator<String[]> estComIndIterator = repository.loadCommunityIndicatorStorage(true);
+ while (estComIndIterator.hasNext()) {
+ // Campagne Indicateur Liste Strate Annee Estimation EcartType CV
+ String[] tuple = estComIndIterator.next();
+ String indicatorCode = tuple[1];
+ String indicatorList = tuple[2];
+
+ if (indicators.contains(indicatorCode)) {
+
+ // si pas de list selectionnée, on prend la premiere
+ String localList = indicatorLists.get(indicatorCode);
+ if (StringUtils.isBlank(localList)) {
+ localList = indicatorList;
+ indicatorLists.put(indicatorCode, localList);
+ }
+
+ if (indicatorList.equals(localList)) {
+ Double estimation = Double.parseDouble(tuple[5]);
+ Double ecart = Double.parseDouble(tuple[6]);
+ int year = Integer.parseInt(tuple[4]);
+
+ if (year < minYear) {
+ minYear = year;
+ }
+ if (year > maxYear) {
+ maxYear = year;
+ }
+ Map<Integer, Double[]> graphData = indicatorGraphData.get(indicatorCode);
+ if (graphData == null) {
+ graphData = new HashMap<Integer, Double[]>();
+ indicatorGraphData.put(indicatorCode, graphData);
+ }
+ graphData.put(year, new Double[]{estimation, ecart});
+
+ // si les données sont énormes, on affiche les données
+ // / multiplicator et on le mentionne dans la légende
+ if (estimation > 1e9) {
+ multiplicator = 1000000;
+ }
+ if (estimation > 1e6 && multiplicator < 1000000) {
+ multiplicator = 1000;
+ }
+
+ // for data part
+ DataStorage subDataStorage = indicatorStorages.get(indicatorCode);
+ if (subDataStorage == null) {
+ subDataStorage = new MemoryDataStorage();
+ if ("fr".equals(locale.getLanguage())) {
+ subDataStorage.add(new String[]{"Campagne", "Indice", "Liste", "Strate", "Année", "Estimation", "EcartType", "CV"});
+ } else {
+ subDataStorage.add(new String[]{"Survey", "Index", "List", "Stratum", "Year", "Estimate", "StandardDeviation", "CV"});
+ }
+ indicatorStorages.put(indicatorCode, subDataStorage);
+ }
+ subDataStorage.add(tuple);
+ }
+ }
+ }
+
+ // avec l'extraction des données, on peut demander a générer un graphique
+ // sur un indicateur qui n'est pas présent dans le projet courant,
+ // dans ce cas, on retourne null
+ for (String indicator : indicatorGraphData.keySet()) {
+ // get graph title
+ String chartTitle = zoneDisplayName;
+ String indicatorName = indicatorMap.getIndicatorValue(indicator, locale);
+ String unit = indicatorMap.getIndicatorUnit(indicator);
+ chartTitle += " - " + indicatorName;
+
+ // ajout de la traduction de la liste d'indicateur
+ // les liste sont a1, T1, T2 ...
+ String localList = indicatorLists.get(indicator);
+ String speciesListName = repository.getSpeciesListMap().getSpeciesListName(locale, localList);
+ chartTitle += " - " + speciesListName;
+// String listLetter = String.valueOf(localList.charAt(0));
+// Iterator<String[]> typeIterator = repository.getSpeciesListMap().iterator(true);
+// while (typeIterator.hasNext()) {
+// // "Types";"Commentaire";"NumSys min";"NumSys max";"Code"
+// String[] tuple = typeIterator.next();
+// if (tuple[4].equals(listLetter)) {
+// /// gestion du groupe "Tous"
+// // cas special, c'est la seule valeur du fichier
+// // code type espece qui a besoin d'une traduction
+// if (tuple[4].equalsIgnoreCase("T")) {
+// if ("fr".equals(locale.getLanguage())) {
+// chartTitle += " - " + "Tous Liste " + localList.charAt(1);
+// } else if ("es".equals(locale.getLanguage())) {
+// chartTitle += " - " + "Todo Lista " + localList.charAt(1);
+// } else {
+// chartTitle += " - " + "All List " + localList.charAt(1);
+// }
+// } else {
+// // ajout de la traduction du nom de liste plus le numéro
+// if ("fr".equals(locale.getLanguage())) {
+// chartTitle += " - " + tuple[0] + " Liste " + localList.charAt(1);
+// } else if ("es".equals(locale.getLanguage())) {
+// chartTitle += " - " + tuple[0] + " Lista " + localList.charAt(1);
+// } else {
+// chartTitle += " - " + tuple[0] + " List " + localList.charAt(1);
+// }
+// }
+// break;
+// }
+// }
+
+ // generate dataset with sorted data
+ Map<Integer, Double[]> graphData = indicatorGraphData.get(indicator);
+ DefaultStatisticalCategoryDataset statisticalDataset = new DefaultStatisticalCategoryDataset();
+ for (int indexYear = minYear; indexYear <= maxYear; ++indexYear) {
+ Double[] entry = graphData.get(indexYear);
+ if (entry != null) {
+ Double estimation = entry[0] / multiplicator;
+ Double ecart = entry[1] / multiplicator;
+ statisticalDataset.add(estimation, ecart, "Serie1", (Comparable) indexYear);
+ } else {
+ statisticalDataset.add(null, null, "Serie1", indexYear);
+ }
+ }
+
+ // configure chart
+ //CategoryAxis categoryAxis = new CategoryAxis(t("coser.business.common.year"));
+ String yearAxis = repository.getReports().getYearChartTitle(locale);
+ CategoryAxis categoryAxis = new CategoryAxis(yearAxis);
+ categoryAxis.setCategoryMargin(0);
+ categoryAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
+ // label horizontaux
+ String legendY = indicatorName;
+ if (multiplicator != 1) {
+ // affiche par exemple : cm * 1000
+ legendY += " (" + unit + "*" + multiplicator + ")";
+ } else if (StringUtils.isNotEmpty(unit)) {
+ legendY += " (" + unit + ")";
+ }
+ ValueAxis valueAxis = new NumberAxis(legendY);
+ valueAxis.setUpperMargin(0.1);
+
+ CategoryItemRenderer renderer = new StatisticalLineAndShapeRenderer(false, true);
+
+ // n'affiche pas les nombre sur le graphique
+ //StandardCategoryItemLabelGenerator itemLabelGenerator = new StandardCategoryItemLabelGenerator();
+ //renderer.setBaseItemLabelGenerator(itemLabelGenerator);
+ //renderer.setBaseItemLabelsVisible(true);
+
+ CategoryPlot plot = new CategoryPlot(statisticalDataset, categoryAxis, valueAxis, renderer);
+ plot.setOrientation(PlotOrientation.VERTICAL);
+ JFreeChart chart = new JFreeChart(chartTitle,
+ JFreeChart.DEFAULT_TITLE_FONT, plot, true);
+
+ // remove series legend
+ chart.removeLegend();
+ // white background
+ chart.setBackgroundPaint(Color.WHITE);
+
+ try {
+ File chartFile = File.createTempFile("coser-community-chart-", ".png");
+ chartFile.deleteOnExit();
+ ChartUtilities.saveChartAsPNG(chartFile, chart, width, height);
+ //ByteArrayOutputStream out = new ByteArrayOutputStream();
+ //ChartUtilities.writeChartAsPNG(out, chart, width, height);
+
+ // data extraction
+ DataStorage subDataStorage = indicatorStorages.get(indicator);
+ StringWriter writer = new StringWriter();
+ DataStorages.save(subDataStorage, writer);
+
+ // add chart file dans chart data in result
+ result.put(indicator, Pair.of(chartFile, writer.toString()));
+ writer.close();
+ } catch (IOException ex) {
+ throw new CoserTechnicalException("Can't save chart", ex);
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Generate population graph for selected species and indicator.
+ *
+ * @param species species to extract
+ * @param indicators indicators to extract
+ * @param zoneDisplayName zone full name
+ * @param indicatorMap indicator localized map
+ * @param locale locale
+ * @param width graph width
+ * @param height graph height
+ * @return maps of generated graph image (temp file) and data indexed by natural key (indicator - species)
+ */
+ public Map<String, Pair<File, String>> getRsufiResultPopCharts(LegacyResultRepository repository,
+ Collection<String> species,
+ Collection<String> indicators,
+ String zoneDisplayName,
+ IndicatorMap indicatorMap,
+ Locale locale,
+ int width,
+ int height) {
+
+ Map<String, Pair<File, String>> result = Maps.newHashMap();
+
+ int multiplicator = 1;
+ int minYear = Integer.MAX_VALUE;
+ int maxYear = Integer.MIN_VALUE;
+
+ MultiKeyMap indicatorGraphData = new MultiKeyMap();
+ MultiKeyMap indicatorStorages = new MultiKeyMap();
+
+ // Campagne Indicateur Liste Species Strate Annee Estimation EcartType CV
+ Iterator<String[]> estPopIndIterator = repository.loadPopulationIndicatorStorage(true);
+ while (estPopIndIterator.hasNext()) {
+ String[] tuple = estPopIndIterator.next();
+
+ String speciesCode = tuple[3];
+ String indicatorCode = tuple[1];
+ if (species.contains(speciesCode) && indicators.contains(indicatorCode)) {
+
+ // XXX echatellier, maybe take care of list here ?
+
+ Double estimation = Double.parseDouble(tuple[6]);
+ Double ecart = Double.parseDouble(tuple[7]);
+ int year = Integer.parseInt(tuple[5]);
+
+ if (year < minYear) {
+ minYear = year;
+ }
+ if (year > maxYear) {
+ maxYear = year;
+ }
+ Map<Integer, Double[]> graphData = (Map<Integer, Double[]>) indicatorGraphData.get(indicatorCode, speciesCode);
+ if (graphData == null) {
+ graphData = new HashMap<Integer, Double[]>();
+ indicatorGraphData.put(indicatorCode, speciesCode, graphData);
+ }
+ graphData.put(year, new Double[]{estimation, ecart});
+
+ // si les données sont énormes, on affiche les données
+ // / multiplicator et on le mentionne dans la légende
+ if (estimation > 1e9) {
+ multiplicator = 1000000;
+ }
+ if (estimation > 1e6 && multiplicator < 1000000) {
+ multiplicator = 1000;
+ }
+
+ // for data part
+ DataStorage subDataStorage = (DataStorage) indicatorStorages.get(indicatorCode, speciesCode);
+ if (subDataStorage == null) {
+ subDataStorage = new MemoryDataStorage();
+ if ("fr".equals(locale.getLanguage())) {
+ subDataStorage.add(new String[]{"Campagne", "Indice", "Liste", "Espèce", "Strate", "Annee", "Estimation", "EcartType", "CV"});
+ } else {
+ subDataStorage.add(new String[]{"Survey", "Index", "List", "Species", "Stratum", "Year", "Estimate", "StandardDeviation", "CV"});
+ }
+ indicatorStorages.put(indicatorCode, speciesCode, subDataStorage);
+ }
+ subDataStorage.add(tuple);
+ }
+ }
+
+ SpeciesMap speciesMap = repository.getSpeciesMap();
+
+ // avec l'extraction des données, on peut demander a générer un graphique
+ // sur un indicateur qui n'est pas présent dans le projet courant,
+ // dans ce cas, on retourne null
+ for (MultiKey indicatorSpecies : (Set<MultiKey>) indicatorGraphData.keySet()) {
+ String indicator = (String) indicatorSpecies.getKey(0);
+ String aSpecies = (String) indicatorSpecies.getKey(1);
+ // get graph title
+ String title = zoneDisplayName;
+ String indicatorName = indicatorMap.getIndicatorValue(indicator, locale);
+ String unit = indicatorMap.getIndicatorUnit(indicator);
+ title += " - " + indicatorName;
+ title += " - " + speciesMap.getReportDisplayName(aSpecies);
+
+ // generate dataset with sorted data
+ DefaultStatisticalCategoryDataset statisticalDataset = new DefaultStatisticalCategoryDataset();
+ Map<Integer, Double[]> graphData = (Map<Integer, Double[]>) indicatorGraphData.get(indicator, aSpecies);
+ for (int indexYear = minYear; indexYear <= maxYear; ++indexYear) {
+ Double[] entry = graphData.get(indexYear);
+ if (entry != null) {
+ Double estimation = entry[0] / multiplicator;
+ Double ecart = entry[1] / multiplicator;
+ statisticalDataset.add(estimation, ecart, "Serie1", (Comparable) indexYear);
+ } else {
+ statisticalDataset.add(null, null, "Serie1", indexYear);
+ }
+ }
+
+ Reports reports = repository.getReports();
+
+ // configure chart
+ //CategoryAxis categoryAxis = new CategoryAxis(t("coser.business.common.year"));
+ String yearAxis = reports.getYearChartTitle(locale);
+ CategoryAxis categoryAxis = new CategoryAxis(yearAxis);
+ categoryAxis.setCategoryMargin(0);
+ categoryAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
+ // label horizontaux
+ String legendY = indicatorName;
+ if (multiplicator != 1) {
+ // affiche par exemple : cm * 1000
+ legendY += " (" + unit + "*" + multiplicator + ")";
+ } else if (StringUtils.isNotEmpty(unit)) {
+ legendY += " (" + unit + ")";
+ }
+ ValueAxis valueAxis = new NumberAxis(legendY);
+ valueAxis.setUpperMargin(0.1);
+
+ CategoryItemRenderer renderer = new StatisticalLineAndShapeRenderer(false, true);
+
+ // n'affiche pas les nombre sur le graphique
+ //StandardCategoryItemLabelGenerator itemLabelGenerator = new StandardCategoryItemLabelGenerator();
+ //renderer.setBaseItemLabelGenerator(itemLabelGenerator);
+ //renderer.setBaseItemLabelsVisible(true);
+
+ CategoryPlot plot = new CategoryPlot(statisticalDataset, categoryAxis, valueAxis, renderer);
+ plot.setOrientation(PlotOrientation.VERTICAL);
+ JFreeChart chart = new JFreeChart(title,
+ JFreeChart.DEFAULT_TITLE_FONT, plot, true);
+
+ // remove series legend
+ chart.removeLegend();
+ // white background
+ chart.setBackgroundPaint(Color.WHITE);
+
+ try {
+ File chartFile = File.createTempFile("coser-population-chart-", ".png");
+ chartFile.deleteOnExit();
+ ChartUtilities.saveChartAsPNG(chartFile, chart, width, height);
+ //ByteArrayOutputStream out = new ByteArrayOutputStream();
+ //ChartUtilities.writeChartAsPNG(out, chart, width, height);
+
+ // data extraction
+ DataStorage subDataStorage = (DataStorage) indicatorStorages.get(indicator, aSpecies);
+ StringWriter writer = new StringWriter();
+ DataStorages.save(subDataStorage, writer);
+
+ // add chart file dans chart data in result
+ result.put(indicator + "-" + aSpecies, Pair.of(chartFile, writer.toString()));
+ writer.close();
+ } catch (IOException ex) {
+ throw new CoserTechnicalException("Can't save chart", ex);
+ }
+ }
+
+ return result;
+ }
+
+ // --------------------------------------------------------------------- //
+ // --- Matchers ------------------------------------------------------- //
+ // --------------------------------------------------------------------- //
+
+ protected boolean matchExtractTypeSet(LegacyResultRepository repository,
+ ExtractRawDataAndResultsRequest request) {
+ boolean result = false;
+ if (repository.isMapsResult()) {
+ result = request.getExtractTypeList().contains(DataType.SOURCE);
+ }
+ if (repository.isIndicatorsResult()) {
+ result = request.getExtractTypeList().contains(DataType.POPULATION) ||
+ request.getExtractTypeList().contains(DataType.COMMUNITY);
+ }
+ if (repository.isDataResult()) {
+ result = request.getExtractTypeList().contains(DataType.SOURCE);
+ }
+ return result;
+ }
+
+ protected boolean matchZoneList(LegacyResultRepository repository,
+ ExtractRawDataAndResultsRequest request) {
+ return request.getZoneList().contains(repository.getZone());
+ }
+
+ protected boolean matchCommunityIndicatorList(LegacyResultRepository repository,
+ ExtractRawDataAndResultsRequest request) {
+ Preconditions.checkNotNull(request.getCommunityIndicatorList());
+
+ List<String> indicatorList = request.getCommunityIndicatorList();
+
+ boolean result = false;
+
+ Iterator<String[]> iterator = repository.loadCommunityIndicatorStorage(true);
+ while (iterator.hasNext()) {
+ String[] tuple = iterator.next();
+ if (repository.matchIndicatorList(tuple, indicatorList)) {
+ result = true;
+ break;
+ }
+ }
+ return result;
+ }
+
+ protected boolean matchPopulationIndicatorList(LegacyResultRepository repository,
+ ExtractRawDataAndResultsRequest request) {
+ Preconditions.checkNotNull(request.getPopulationIndicatorList());
+
+ List<String> indicatorList = request.getPopulationIndicatorList();
+
+ boolean result = false;
+
+ Iterator<String[]> iterator = repository.loadPopulationIndicatorStorage(true);
+ while (iterator.hasNext()) {
+ String[] tuple = iterator.next();
+ if (repository.matchIndicatorList(tuple, indicatorList)) {
+ result = true;
+ break;
+ }
+ }
+ return result;
+ }
+
+ protected boolean matchPopulationIndicatorListAndSpeciesList(LegacyResultRepository repository,
+ ExtractRawDataAndResultsRequest request) {
+ Preconditions.checkNotNull(request.getPopulationIndicatorList());
+
+ List<String> indicatorList = request.getPopulationIndicatorList();
+ List<String> speciesList = request.getSpeciesList();
+
+ boolean result = false;
+
+ Iterator<String[]> iterator = repository.loadPopulationIndicatorStorage(true);
+ while (iterator.hasNext()) {
+ String[] tuple = iterator.next();
+ if (repository.matchIndicatorListAndSpeciesList(tuple, indicatorList, speciesList)) {
+ result = true;
+ break;
+ }
+ }
+ return result;
+ }
+
+ protected boolean matchCommunityIndicatorListAndSpeciesList(LegacyResultRepository repository,
+ ExtractRawDataAndResultsRequest request) {
+ Preconditions.checkNotNull(request.getCommunityIndicatorList());
+
+ List<String> indicatorList = request.getCommunityIndicatorList();
+ List<String> speciesList = request.getSpeciesList();
+
+ boolean result = false;
+
+ Iterator<String[]> iterator = repository.loadCommunityIndicatorStorage(true);
+ while (iterator.hasNext()) {
+ String[] tuple = iterator.next();
+ if (repository.matchIndicatorListAndSpeciesList(tuple, indicatorList, speciesList)) {
+ result = true;
+ break;
+ }
+ }
+ return result;
+ }
+
+}
Copied: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/ExtractRawDataCommand.java (from rev 1144, trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/RawDataResultProducer.java)
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/ExtractRawDataCommand.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/ExtractRawDataCommand.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,107 @@
+package fr.ifremer.coser.result.repository.legacy.command;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.coser.CoserConstants;
+import fr.ifremer.coser.CoserTechnicalException;
+import fr.ifremer.coser.result.FileResult;
+import fr.ifremer.coser.result.Reports;
+import fr.ifremer.coser.result.repository.ResultRepositoryCommand;
+import fr.ifremer.coser.result.repository.legacy.LegacyResultRepository;
+import fr.ifremer.coser.result.request.ExtractRawDataRequest;
+import org.apache.commons.io.FileUtils;
+import org.nuiton.util.FileUtil;
+import org.nuiton.util.ZipUtil;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Date;
+import java.util.Locale;
+
+/**
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class ExtractRawDataCommand implements ResultRepositoryCommand<LegacyResultRepository, ExtractRawDataRequest> {
+
+ @Override
+ public Class<ExtractRawDataRequest> getRequestType() {
+ return ExtractRawDataRequest.class;
+ }
+
+ @Override
+ public boolean accept(LegacyResultRepository repository,
+ ExtractRawDataRequest request) {
+ return repository.isDataResult() &&
+ repository.matchFacade(request) &&
+ repository.matchZone(request);
+ }
+
+ @Override
+ public FileResult execute(LegacyResultRepository repository,
+ ExtractRawDataRequest r) {
+
+ Locale locale = r.getLocale();
+
+ repository.loadSelectionData();
+
+ File resultZip;
+
+ try {
+ File tempDir = FileUtil.createTempDirectory("coser-source-", "-tmp");
+
+ // il ne faut pas les fichiers de selection, mais leurs
+ // export rsufi (sans les lignes, et les quotes)
+ File archiveDir = repository.extractRSUfiData(tempDir);
+
+ // add decharge file
+ Reports reports = repository.getReports();
+ String filename = reports.getDechargeFilename(locale);
+ File dechargePDF = new File(archiveDir, filename);
+
+ Date lastDataUpdateDate = repository.getConfig().getLastDataUpdateDate();
+
+ reports.generateDechargePDF(dechargePDF, locale, lastDataUpdateDate, repository.getSurveyName());
+
+ // ajout du reftax dans le zip
+ File reftaxFile = new File(repository.getBasedir(), CoserConstants.Category.REFTAX_SPECIES.getStorageFileName());
+ FileUtils.copyFileToDirectory(reftaxFile, archiveDir);
+
+ // make zip
+ resultZip = File.createTempFile("coser-source-", ".zip");
+ resultZip.deleteOnExit();
+ ZipUtil.compress(resultZip, archiveDir);
+
+ // clean directory
+ FileUtils.deleteDirectory(tempDir);
+ } catch (IOException e) {
+ throw new CoserTechnicalException("Can't create zip file", e);
+ }
+
+ FileResult result = new FileResult(repository.getId(), resultZip);
+ return result;
+ }
+
+}
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetAllResultsCommand.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetAllResultsCommand.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetAllResultsCommand.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,103 @@
+package fr.ifremer.coser.result.repository.legacy.command;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.collect.Maps;
+import fr.ifremer.coser.result.CoserResult;
+import fr.ifremer.coser.result.MapResult;
+import fr.ifremer.coser.result.ResultType;
+import fr.ifremer.coser.result.repository.ResultRepositoryCommand;
+import fr.ifremer.coser.result.repository.legacy.LegacyResultRepository;
+import fr.ifremer.coser.result.repository.legacy.LegacyResultRepositoryType;
+import fr.ifremer.coser.result.request.GetAllResultsRequest;
+
+import java.util.Map;
+
+/**
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class GetAllResultsCommand implements ResultRepositoryCommand<LegacyResultRepository, GetAllResultsRequest> {
+
+ @Override
+ public Class<GetAllResultsRequest> getRequestType() {
+ return GetAllResultsRequest.class;
+ }
+
+ @Override
+ public boolean accept(LegacyResultRepository repository,
+ GetAllResultsRequest request) {
+ boolean result = matchRepositoryType(request) &&
+ matchResultType(repository, request) &&
+ matchPublish(repository);
+ return result;
+ }
+
+ @Override
+ public CoserResult execute(LegacyResultRepository repository,
+ GetAllResultsRequest request) {
+ Map<String, String> map = Maps.newHashMap();
+ String resultResultId = repository.getZone();
+ String name = repository.getProjectName() + "/" + repository.getSelectionName()
+ + "/" + repository.getResultName();
+ map.put(resultResultId, name);
+ MapResult result = new MapResult(repository.getId(), map);
+ return result;
+ }
+
+ // --------------------------------------------------------------------- //
+ // --- Matchers -------------------------------------------------------- //
+ // --------------------------------------------------------------------- //
+
+ protected boolean matchRepositoryType(GetAllResultsRequest request) {
+ boolean result = request.getResultRepositoryType().equals(LegacyResultRepositoryType.ID);
+ return result;
+ }
+
+ protected boolean matchResultType(LegacyResultRepository repository,
+ GetAllResultsRequest request) {
+ boolean result;
+ ResultType resultType = request.getResultType();
+ switch (resultType) {
+
+ case MAP:
+ result = repository.isMapsResult();
+ break;
+ case INDICATOR:
+ result = repository.isIndicatorsResult();
+ break;
+ default:
+ result = false;
+ break;
+ }
+ return result;
+ }
+
+ protected boolean matchPublish(LegacyResultRepository repository) {
+ boolean result = repository.isPubliableResult();
+ return result;
+ }
+
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetAllResultsCommand.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Copied: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetCommunityIndicatorResultCommand.java (from rev 1144, trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/CommunityIndicatorResultProducer.java)
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetCommunityIndicatorResultCommand.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetCommunityIndicatorResultCommand.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,380 @@
+package fr.ifremer.coser.result.repository.legacy.command;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import fr.ifremer.coser.CoserTechnicalException;
+import fr.ifremer.coser.result.FileResult;
+import fr.ifremer.coser.result.repository.ResultRepositoryCommand;
+import fr.ifremer.coser.result.repository.legacy.LegacyResultRepository;
+import fr.ifremer.coser.result.request.GetCommunityIndicatorResultRequest;
+import fr.ifremer.coser.storage.DataStorage;
+import fr.ifremer.coser.storage.DataStorages;
+import fr.ifremer.coser.storage.MemoryDataStorage;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jfree.chart.ChartUtilities;
+import org.jfree.chart.JFreeChart;
+import org.jfree.chart.axis.CategoryAxis;
+import org.jfree.chart.axis.CategoryLabelPositions;
+import org.jfree.chart.axis.NumberAxis;
+import org.jfree.chart.axis.ValueAxis;
+import org.jfree.chart.plot.CategoryPlot;
+import org.jfree.chart.plot.PlotOrientation;
+import org.jfree.chart.renderer.category.CategoryItemRenderer;
+import org.jfree.chart.renderer.category.StatisticalLineAndShapeRenderer;
+import org.jfree.data.statistics.DefaultStatisticalCategoryDataset;
+import org.nuiton.util.FileUtil;
+import org.nuiton.util.ZipUtil;
+
+import java.awt.Color;
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.Map;
+
+/**
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class GetCommunityIndicatorResultCommand implements ResultRepositoryCommand<LegacyResultRepository, GetCommunityIndicatorResultRequest> {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(GetCommunityIndicatorResultCommand.class);
+
+ @Override
+ public Class<GetCommunityIndicatorResultRequest> getRequestType() {
+ return GetCommunityIndicatorResultRequest.class;
+ }
+
+ @Override
+ public boolean accept(LegacyResultRepository repository,
+ GetCommunityIndicatorResultRequest request) {
+ return repository.isIndicatorsResult() &&
+ repository.matchFacade(request) &&
+ repository.matchZone(request) &&
+ matchIndicatorAndSpeciesList(repository, request);
+ }
+
+ @Override
+ public FileResult execute(LegacyResultRepository repository,
+ GetCommunityIndicatorResultRequest request) {
+
+ File file = null;
+ switch (request.getIndicatorResultType()) {
+ case DATA:
+ file = getCommunityIndicatorDataFile(repository,
+ request.getLocale(),
+ request.getIndicator(),
+ request.getSpecies());
+ break;
+
+ case GRAPH:
+ file = getCommunityIndicatorGraphFile(repository,
+ request.getLocale(),
+ request.getZone(),
+ request.getIndicator(),
+ request.getSpecies());
+ break;
+ }
+ FileResult result = new FileResult(repository.getId(), file);
+ return result;
+ }
+
+ protected File getCommunityIndicatorDataFile(LegacyResultRepository repository,
+ Locale locale,
+ String indicator,
+ String speciesList) {
+
+ try {
+
+ File tempDir = FileUtil.createTempDirectory("coser-chart-population-indicator", "-tmp");
+
+ File baseDir = new File(tempDir, repository.getSurveyName());
+ FileUtils.forceMkdir(baseDir);
+
+ // ajout du fichier csv avec les indicateurs
+ DataStorage dataStorage = new MemoryDataStorage();
+
+ Iterator<String[]> iterator = repository.loadCommunityIndicatorStorage(false);
+
+ // add header
+ dataStorage.add(iterator.next());
+
+ while (iterator.hasNext()) {
+ String[] tuple = iterator.next();
+ if (repository.matchCommunityIndicatorAndSpeciesList(tuple, indicator, speciesList)) {
+ dataStorage.add(tuple);
+ }
+ }
+ File csvFile = DataStorages.save(dataStorage, "coser-chart-community-indicator",
+ ".csv"
+ );
+
+ File csvFileCopied = new File(baseDir, indicator + ".csv");
+ FileUtils.copyFile(csvFile, csvFileCopied);
+ FileUtils.forceDelete(csvFile);
+
+ // ajout du fichier d'information sur les espèces incluses dans
+ // les calculs des indicateurs de communautés
+ // load project (without data to get reftax data)
+ File metaFile = repository.getReports().generateMetaFilePDF(repository.getPath(),
+ repository.getResultDirectory(),
+ locale,
+ repository.getIndicatorsMap()
+ );
+ File metaFileCopied = new File(baseDir, "Information.pdf");
+ FileUtils.copyFile(metaFile, metaFileCopied);
+
+ // make zip
+ File result = File.createTempFile("coser-chart-community-indicator", ".zip");
+ result.deleteOnExit();
+ ZipUtil.compress(result, baseDir);
+
+ // clean directory
+ FileUtils.deleteDirectory(tempDir);
+ return result;
+ } catch (Exception e) {
+ throw new CoserTechnicalException("Can't create zip file", e);
+ }
+ }
+
+ protected File getCommunityIndicatorGraphFile(LegacyResultRepository repository,
+ Locale locale,
+ String zone,
+ String indicator,
+ String speciesList) {
+
+ // indicator list to take care
+ // pour avoir une valeur non nulle si list est null
+ // on prend dans ce cas la premiere valeur trouvée
+ String localList = speciesList;
+
+ if (log.isDebugEnabled()) {
+ log.debug("Searching list for indicator : " + indicator);
+ }
+
+ int multiplicator = 1;
+ int minYear = Integer.MAX_VALUE;
+ int maxYear = Integer.MIN_VALUE;
+ boolean indicatorFound = false;
+ Map<Integer, Double[]> graphData = new HashMap<Integer, Double[]>();
+ Iterator<String[]> iterator = repository.loadCommunityIndicatorStorage(true);
+ while (iterator.hasNext()) {
+ // Campagne Indicateur Liste Strate Annee Estimation EcartType CV
+ String[] tuple = iterator.next();
+ String indicatorList = tuple[2];
+
+ if (repository.matchCommunityIndicator(tuple, indicator)) {
+ indicatorFound = true;
+
+ // si pas de list selectionnée, on prend la premiere
+ if (StringUtils.isBlank(localList)) {
+ localList = indicatorList;
+ }
+
+ if (indicatorList.equals(localList)) {
+ Double estimation = Double.parseDouble(tuple[5]);
+ Double ecart = Double.parseDouble(tuple[6]);
+ int year = Integer.parseInt(tuple[4]);
+
+ if (year < minYear) {
+ minYear = year;
+ }
+ if (year > maxYear) {
+ maxYear = year;
+ }
+ graphData.put(year, new Double[]{estimation, ecart});
+
+ // si les données sont énormes, on affiche les données
+ // / multiplicator et on le mentionne dans la légende
+ if (estimation > 1e9) {
+ multiplicator = 1000000;
+ }
+ if (estimation > 1e6 && multiplicator < 1000000) {
+ multiplicator = 1000;
+ }
+ }
+ }
+ }
+
+ File result = null;
+
+ // avec l'extraction des données, on peut demander a générer un graphique
+ // sur un indicateur qui n'est pas présent dans le projet courant,
+ // dans ce cas, on retourne null
+ if (indicatorFound) {
+
+ String zoneDisplayName = repository.getZonesMap().getZoneFullName(zone);
+ String indicatorName = repository.getIndicatorsMap().getIndicatorValue(indicator, locale);
+ String unit = repository.getIndicatorsMap().getIndicatorUnit(indicator);
+
+ // get graph title
+ String chartTitle = zoneDisplayName;
+ chartTitle += " - " + indicatorName;
+
+ String speciesListName = repository.getSpeciesListMap().getSpeciesListName(locale, localList);
+ chartTitle += " - " + speciesListName;
+// // ajout de la traduction de la liste d'indicateur
+// // les liste sont a1, T1, T2 ...
+// String listLetter = String.valueOf(localList.charAt(0));
+// Iterator<String[]> typeIterator = repository.getSpeciesListMap().iterator(true);
+// while (typeIterator.hasNext()) {
+// // "Types";"Commentaire";"NumSys min";"NumSys max";"Code"
+// String[] tuple = typeIterator.next();
+// if (tuple[4].equals(listLetter)) {
+// /// gestion du groupe "Tous"
+// // cas special, c'est la seule valeur du fichier
+// // code type espece qui a besoin d'une traduction
+// if (tuple[4].equalsIgnoreCase("T")) {
+// if ("fr".equals(locale.getLanguage())) {
+// chartTitle += " - " + "Tous Liste " + localList.charAt(1);
+// } else if ("es".equals(locale.getLanguage())) {
+// chartTitle += " - " + "Todo Lista " + localList.charAt(1);
+// } else {
+// chartTitle += " - " + "All List " + localList.charAt(1);
+// }
+// } else {
+// // ajout de la traduction du nom de liste plus le numéro
+// if ("fr".equals(locale.getLanguage())) {
+// chartTitle += " - " + tuple[0] + " Liste " + localList.charAt(1);
+// } else if ("es".equals(locale.getLanguage())) {
+// chartTitle += " - " + tuple[0] + " Lista " + localList.charAt(1);
+// } else {
+// chartTitle += " - " + tuple[0] + " List " + localList.charAt(1);
+// }
+// }
+// break;
+// }
+// }
+
+ // generate dataset with sorted data
+ DefaultStatisticalCategoryDataset statisticalDataset = new DefaultStatisticalCategoryDataset();
+ for (int indexYear = minYear; indexYear <= maxYear; ++indexYear) {
+ Double[] entry = graphData.get(indexYear);
+ if (entry != null) {
+ Double estimation = entry[0] / multiplicator;
+ Double ecart = entry[1] / multiplicator;
+ statisticalDataset.add(estimation, ecart, "Serie1", (Comparable) indexYear);
+ } else {
+ statisticalDataset.add(null, null, "Serie1", indexYear);
+ }
+ }
+
+ // configure chart
+ //CategoryAxis categoryAxis = new CategoryAxis(t("coser.business.common.year"));
+ String yearAxis = repository.getReports().getYearChartTitle(locale);
+
+ CategoryAxis categoryAxis = new CategoryAxis(yearAxis);
+ categoryAxis.setCategoryMargin(0);
+ categoryAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
+ // label horizontaux
+ String legendY = indicatorName;
+ if (multiplicator != 1) {
+ // affiche par exemple : cm * 1000
+ legendY += " (" + unit + "*" + multiplicator + ")";
+ } else if (StringUtils.isNotEmpty(unit)) {
+ legendY += " (" + unit + ")";
+ }
+ ValueAxis valueAxis = new NumberAxis(legendY);
+ valueAxis.setUpperMargin(0.1);
+
+ CategoryItemRenderer renderer = new StatisticalLineAndShapeRenderer(false, true);
+
+ // n'affiche pas les nombre sur le graphique
+ //StandardCategoryItemLabelGenerator itemLabelGenerator = new StandardCategoryItemLabelGenerator();
+ //renderer.setBaseItemLabelGenerator(itemLabelGenerator);
+ //renderer.setBaseItemLabelsVisible(true);
+
+ CategoryPlot plot = new CategoryPlot(statisticalDataset, categoryAxis, valueAxis, renderer);
+ plot.setOrientation(PlotOrientation.VERTICAL);
+ JFreeChart chart = new JFreeChart(chartTitle,
+ JFreeChart.DEFAULT_TITLE_FONT, plot, true);
+
+ // remove series legend
+ chart.removeLegend();
+ // white background
+ chart.setBackgroundPaint(Color.WHITE);
+
+ try {
+ result = File.createTempFile("coser-chart-community-indicator-", ".png");
+ result.deleteOnExit();
+ ChartUtilities.saveChartAsPNG(result, chart, 800, 400);
+ } catch (IOException ex) {
+ throw new CoserTechnicalException("Can't save chart", ex);
+ }
+ }
+
+ return result;
+ }
+
+ // --------------------------------------------------------------------- //
+ // --- Matchers ------------------------------------------------------- //
+ // --------------------------------------------------------------------- //
+
+ protected boolean matchIndicator(LegacyResultRepository repository,
+ GetCommunityIndicatorResultRequest request) {
+ Preconditions.checkNotNull(request.getIndicator());
+
+ String indicator = request.getIndicator();
+
+ boolean result = false;
+
+ Iterator<String[]> iterator = repository.loadCommunityIndicatorStorage(true);
+ while (iterator.hasNext()) {
+ String[] tuple = iterator.next();
+ if (repository.matchCommunityIndicator(tuple, indicator)) {
+ result = true;
+ break;
+ }
+ }
+ return result;
+ }
+
+ protected boolean matchIndicatorAndSpeciesList(LegacyResultRepository repository,
+ GetCommunityIndicatorResultRequest request) {
+ Preconditions.checkNotNull(request.getIndicator());
+ Preconditions.checkNotNull(request.getSpecies());
+
+ String indicator = request.getIndicator();
+ String speciesList = request.getSpecies();
+
+ boolean result = false;
+
+ Iterator<String[]> iterator = repository.loadCommunityIndicatorStorage(true);
+ while (iterator.hasNext()) {
+ String[] tuple = iterator.next();
+ if (repository.matchCommunityIndicatorAndSpeciesList(tuple, indicator, speciesList)) {
+ result = true;
+ break;
+ }
+ }
+ return result;
+ }
+}
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetIndicatorsForCommunityIndicatorResultCommand.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetIndicatorsForCommunityIndicatorResultCommand.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetIndicatorsForCommunityIndicatorResultCommand.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,64 @@
+package fr.ifremer.coser.result.repository.legacy.command;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.coser.result.MapResult;
+import fr.ifremer.coser.result.repository.ResultRepositoryCommand;
+import fr.ifremer.coser.result.repository.legacy.LegacyResultRepository;
+import fr.ifremer.coser.result.request.GetIndicatorsForCommunityIndicatorResultRequest;
+
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class GetIndicatorsForCommunityIndicatorResultCommand implements ResultRepositoryCommand<LegacyResultRepository, GetIndicatorsForCommunityIndicatorResultRequest> {
+
+ @Override
+ public Class<GetIndicatorsForCommunityIndicatorResultRequest> getRequestType() {
+ return GetIndicatorsForCommunityIndicatorResultRequest.class;
+ }
+
+ @Override
+ public boolean accept(LegacyResultRepository repository,
+ GetIndicatorsForCommunityIndicatorResultRequest request) {
+ return repository.isIndicatorsResult() &&
+ repository.matchFacade(request) &&
+ repository.matchZone(request);
+ }
+
+ @Override
+ public MapResult execute(LegacyResultRepository repository,
+ GetIndicatorsForCommunityIndicatorResultRequest request) {
+
+ Set<String> indicatorList = repository.getCommunityIndicators();
+ Map<String, String> map = repository.getIndicatorsMap().getIndicatorsValues(indicatorList, request.getLocale());
+
+ MapResult result = new MapResult(repository.getId(), map);
+ return result;
+ }
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetIndicatorsForCommunityIndicatorResultCommand.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetIndicatorsForExtractRawDataAndResultsCommand.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetIndicatorsForExtractRawDataAndResultsCommand.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetIndicatorsForExtractRawDataAndResultsCommand.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,105 @@
+package fr.ifremer.coser.result.repository.legacy.command;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.coser.result.MapResult;
+import fr.ifremer.coser.result.repository.ResultRepositoryCommand;
+import fr.ifremer.coser.result.repository.legacy.LegacyResultRepository;
+import fr.ifremer.coser.result.request.GetIndicatorsForExtractRawDataAndResultsRequest;
+import fr.ifremer.coser.util.DataType;
+
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class GetIndicatorsForExtractRawDataAndResultsCommand implements ResultRepositoryCommand<LegacyResultRepository, GetIndicatorsForExtractRawDataAndResultsRequest> {
+
+ @Override
+ public Class<GetIndicatorsForExtractRawDataAndResultsRequest> getRequestType() {
+ return GetIndicatorsForExtractRawDataAndResultsRequest.class;
+ }
+
+ @Override
+ public boolean accept(LegacyResultRepository repository,
+ GetIndicatorsForExtractRawDataAndResultsRequest request) {
+ return matchExtractTypeSet(repository, request) &&
+ matchZoneList(repository, request);
+ }
+
+ @Override
+ public MapResult execute(LegacyResultRepository repository,
+ GetIndicatorsForExtractRawDataAndResultsRequest request) {
+
+
+ Set<String> indicatorList = null;
+
+ if (request.getExtractTypeList().contains(DataType.COMMUNITY)) {
+
+ // get all community indicators for given zone
+ indicatorList = repository.getCommunityIndicators();
+ } else if (request.getExtractTypeList().contains(DataType.POPULATION)) {
+
+ // get all population indicators for given zone
+ indicatorList = repository.getPopulationIndicators();
+ }
+
+ Map<String, String> map = null;
+ if (indicatorList != null) {
+ map = repository.getIndicatorsMap().getIndicatorsValues(indicatorList, request.getLocale());
+ }
+
+ MapResult result = new MapResult(repository.getId(), map);
+ return result;
+ }
+
+ // --------------------------------------------------------------------- //
+ // --- Matchers ------------------------------------------------------- //
+ // --------------------------------------------------------------------- //
+
+ protected boolean matchExtractTypeSet(LegacyResultRepository repository,
+ GetIndicatorsForExtractRawDataAndResultsRequest request) {
+ boolean result = false;
+ if (repository.isMapsResult()) {
+ result = request.getExtractTypeList().contains(DataType.SOURCE);
+ }
+ if (repository.isIndicatorsResult()) {
+ result = request.getExtractTypeList().contains(DataType.POPULATION) ||
+ request.getExtractTypeList().contains(DataType.COMMUNITY);
+ }
+ if (repository.isDataResult()) {
+ result = request.getExtractTypeList().contains(DataType.SOURCE);
+ }
+ return result;
+ }
+
+ protected boolean matchZoneList(LegacyResultRepository repository,
+ GetIndicatorsForExtractRawDataAndResultsRequest request) {
+ return request.getZoneList().contains(repository.getZone());
+ }
+
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetIndicatorsForExtractRawDataAndResultsCommand.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetIndicatorsForPopulationIndicatorResultCommand.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetIndicatorsForPopulationIndicatorResultCommand.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetIndicatorsForPopulationIndicatorResultCommand.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,91 @@
+package fr.ifremer.coser.result.repository.legacy.command;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import fr.ifremer.coser.result.MapResult;
+import fr.ifremer.coser.result.repository.ResultRepositoryCommand;
+import fr.ifremer.coser.result.repository.legacy.LegacyResultRepository;
+import fr.ifremer.coser.result.request.GetIndicatorsForPopulationIndicatorResultRequest;
+
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class GetIndicatorsForPopulationIndicatorResultCommand implements ResultRepositoryCommand<LegacyResultRepository, GetIndicatorsForPopulationIndicatorResultRequest> {
+
+ @Override
+ public Class<GetIndicatorsForPopulationIndicatorResultRequest> getRequestType() {
+ return GetIndicatorsForPopulationIndicatorResultRequest.class;
+ }
+
+ @Override
+ public boolean accept(LegacyResultRepository repository,
+ GetIndicatorsForPopulationIndicatorResultRequest request) {
+ return repository.isIndicatorsResult() &&
+ repository.matchFacade(request) &&
+ repository.matchZone(request) &&
+ matchSpecies(repository, request);
+ }
+
+ @Override
+ public MapResult execute(LegacyResultRepository repository,
+ GetIndicatorsForPopulationIndicatorResultRequest request) {
+
+ Set<String> indicatorList = repository.getPopulationIndicators(request.getSpecies());
+ Map<String, String> map = repository.getIndicatorsMap().getIndicatorsValues(indicatorList, request.getLocale());
+
+ MapResult result = new MapResult(repository.getId(), map);
+ return result;
+ }
+
+ // --------------------------------------------------------------------- //
+ // --- Matchers -------------------------------------------------------- //
+ // --------------------------------------------------------------------- //
+
+ protected boolean matchSpecies(LegacyResultRepository repository,
+ GetIndicatorsForPopulationIndicatorResultRequest request) {
+ Preconditions.checkNotNull(request.getSpecies());
+
+ String species = request.getSpecies();
+
+ boolean result = false;
+
+ Iterator<String[]> iterator = repository.loadPopulationIndicatorStorage(true);
+ while (iterator.hasNext()) {
+ String[] tuple = iterator.next();
+ if (repository.matchPopulationSpecies(tuple, species)) {
+ result = true;
+ break;
+ }
+ }
+ return result;
+ }
+
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetIndicatorsForPopulationIndicatorResultCommand.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Copied: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetMapResultCommand.java (from rev 1144, trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/MapResultProducer.java)
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetMapResultCommand.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetMapResultCommand.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,75 @@
+package fr.ifremer.coser.result.repository.legacy.command;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.coser.result.FileResult;
+import fr.ifremer.coser.result.repository.ResultRepositoryCommand;
+import fr.ifremer.coser.result.repository.legacy.LegacyResultRepository;
+import fr.ifremer.coser.result.request.GetMapResultRequest;
+
+import java.io.File;
+
+/**
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class GetMapResultCommand implements ResultRepositoryCommand<LegacyResultRepository, GetMapResultRequest> {
+
+ @Override
+ public Class<GetMapResultRequest> getRequestType() {
+ return GetMapResultRequest.class;
+ }
+
+ @Override
+ public boolean accept(LegacyResultRepository repository,
+ GetMapResultRequest request) {
+ return repository.isMapsResult() &&
+ repository.matchFacade(request) &&
+ repository.matchZone(request) &&
+ matchSpecies(repository, request);
+ }
+
+ @Override
+ public FileResult execute(LegacyResultRepository repository,
+ GetMapResultRequest r) {
+
+ File resultZip = repository.getMapSpeciesFile(r.getSpecies());
+
+ FileResult result = new FileResult(repository.getId(), resultZip);
+ return result;
+ }
+
+ // --------------------------------------------------------------------- //
+ // --- Matchers ------------------------------------------------------- //
+ // --------------------------------------------------------------------- //
+
+ protected boolean matchSpecies(LegacyResultRepository repository,
+ GetMapResultRequest request) {
+ String species = request.getSpecies();
+ File file = repository.getMapSpeciesFile(species);
+ return file != null;
+ }
+
+}
Copied: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetPopulationIndicatorResultCommand.java (from rev 1144, trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/PopulationIndicatorResultProducer.java)
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetPopulationIndicatorResultCommand.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetPopulationIndicatorResultCommand.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,288 @@
+package fr.ifremer.coser.result.repository.legacy.command;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import fr.ifremer.coser.CoserTechnicalException;
+import fr.ifremer.coser.result.FileResult;
+import fr.ifremer.coser.result.repository.ResultRepositoryCommand;
+import fr.ifremer.coser.result.repository.legacy.LegacyResultRepository;
+import fr.ifremer.coser.result.request.GetPopulationIndicatorResultRequest;
+import fr.ifremer.coser.storage.DataStorage;
+import fr.ifremer.coser.storage.DataStorages;
+import fr.ifremer.coser.storage.MemoryDataStorage;
+import org.apache.commons.lang3.StringUtils;
+import org.jfree.chart.ChartUtilities;
+import org.jfree.chart.JFreeChart;
+import org.jfree.chart.axis.CategoryAxis;
+import org.jfree.chart.axis.CategoryLabelPositions;
+import org.jfree.chart.axis.NumberAxis;
+import org.jfree.chart.axis.ValueAxis;
+import org.jfree.chart.plot.CategoryPlot;
+import org.jfree.chart.plot.PlotOrientation;
+import org.jfree.chart.renderer.category.CategoryItemRenderer;
+import org.jfree.chart.renderer.category.StatisticalLineAndShapeRenderer;
+import org.jfree.data.statistics.DefaultStatisticalCategoryDataset;
+
+import java.awt.Color;
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.Map;
+
+/**
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class GetPopulationIndicatorResultCommand implements ResultRepositoryCommand<LegacyResultRepository, GetPopulationIndicatorResultRequest> {
+
+ @Override
+ public Class<GetPopulationIndicatorResultRequest> getRequestType() {
+ return GetPopulationIndicatorResultRequest.class;
+ }
+
+ @Override
+ public boolean accept(LegacyResultRepository repository,
+ GetPopulationIndicatorResultRequest request) {
+ return repository.isIndicatorsResult() &&
+ repository.matchFacade(request) &&
+ repository.matchZone(request) &&
+ matchSpeciesAndIndicator(repository, request);
+ }
+
+ @Override
+ public FileResult execute(LegacyResultRepository repository,
+ GetPopulationIndicatorResultRequest request) {
+
+ File file = null;
+ switch (request.getIndicatorResultType()) {
+ case DATA:
+ file = getPopulationIndicatorDataFile(repository,
+ request.getIndicator(),
+ request.getSpecies());
+ break;
+
+ case GRAPH:
+ file = getPopulationIndicatorGraphFile(repository,
+ request.getLocale(),
+ request.getZone(),
+ request.getIndicator(),
+ request.getSpecies());
+ break;
+ }
+
+
+ FileResult result = new FileResult(repository.getId(), file);
+ return result;
+ }
+
+ protected File getPopulationIndicatorDataFile(LegacyResultRepository repository,
+ String species,
+ String indicator) {
+
+ DataStorage dataStorage = new MemoryDataStorage();
+
+ Iterator<String[]> iterator = repository.loadPopulationIndicatorStorage(false);
+
+ // add header
+ dataStorage.add(iterator.next());
+
+ while (iterator.hasNext()) {
+ String[] tuple = iterator.next();
+ if (repository.matchPopulationSpeciesAndIndicator(tuple, species, indicator)) {
+ dataStorage.add(tuple);
+ }
+ }
+ File result = DataStorages.save(dataStorage, "coser-chart-population-indicator",
+ ".csv"
+ );
+ return result;
+ }
+
+ protected File getPopulationIndicatorGraphFile(LegacyResultRepository repository,
+ Locale locale,
+ String zone,
+ String species,
+ String indicator) {
+
+ int multiplicator = 1;
+ int minYear = Integer.MAX_VALUE;
+ int maxYear = Integer.MIN_VALUE;
+ boolean indicatorFound = false;
+ Map<Integer, Double[]> graphData = new HashMap<Integer, Double[]>();
+ Iterator<String[]> iterator = repository.loadPopulationIndicatorStorage(true);
+ while (iterator.hasNext()) {
+ String[] tuple = iterator.next();
+
+ if (repository.matchPopulationSpeciesAndIndicator(tuple, species, indicator)) {
+ indicatorFound = true;
+
+ // XXX echatellier, maybe take care of list here ?
+
+ Double estimation = Double.parseDouble(tuple[6]);
+ Double ecart = Double.parseDouble(tuple[7]);
+ int year = Integer.parseInt(tuple[5]);
+
+ if (year < minYear) {
+ minYear = year;
+ }
+ if (year > maxYear) {
+ maxYear = year;
+ }
+ graphData.put(year, new Double[]{estimation, ecart});
+
+ // si les données sont énormes, on affiche les données
+ // / multiplicator et on le mentionne dans la légende
+ if (estimation > 1e9) {
+ multiplicator = 1000000;
+ }
+ if (estimation > 1e6 && multiplicator < 1000000) {
+ multiplicator = 1000;
+ }
+ }
+ }
+
+ File result = null;
+
+ // avec l'extraction des données, on peut demander a générer un graphique
+ // sur un indicateur qui n'est pas présent dans le projet courant,
+ // dans ce cas, on retourne null
+ if (indicatorFound) {
+
+ String zoneDisplayName = repository.getZonesMap().getZoneFullName(zone);
+ String indicatorName = repository.getIndicatorsMap().getIndicatorValue(indicator, locale);
+ String unit = repository.getIndicatorsMap().getIndicatorUnit(indicator);
+
+ // get graph title
+ String title = zoneDisplayName;
+ title += " - " + indicatorName;
+ title += " - " + repository.getSpeciesMap().getReportDisplayName(species);
+
+ // generate dataset with sorted data
+ DefaultStatisticalCategoryDataset statisticalDataset = new DefaultStatisticalCategoryDataset();
+ for (int indexYear = minYear; indexYear <= maxYear; ++indexYear) {
+ Double[] entry = graphData.get(indexYear);
+ if (entry != null) {
+ Double estimation = entry[0] / multiplicator;
+ Double ecart = entry[1] / multiplicator;
+ statisticalDataset.add(estimation, ecart, "Serie1", (Comparable) indexYear);
+ } else {
+ statisticalDataset.add(null, null, "Serie1", indexYear);
+ }
+ }
+
+ // configure chart
+ //CategoryAxis categoryAxis = new CategoryAxis(t("coser.business.common.year"));
+ String yearAxis = repository.getReports().getYearChartTitle(locale);
+ CategoryAxis categoryAxis = new CategoryAxis(yearAxis);
+ categoryAxis.setCategoryMargin(0);
+ categoryAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
+ // label horizontaux
+ String legendY = indicatorName;
+ if (multiplicator != 1) {
+ // affiche par exemple : cm * 1000
+ legendY += " (" + unit + "*" + multiplicator + ")";
+ } else if (StringUtils.isNotEmpty(unit)) {
+ legendY += " (" + unit + ")";
+ }
+ ValueAxis valueAxis = new NumberAxis(legendY);
+ valueAxis.setUpperMargin(0.1);
+
+ CategoryItemRenderer renderer = new StatisticalLineAndShapeRenderer(false, true);
+
+ // n'affiche pas les nombre sur le graphique
+ //StandardCategoryItemLabelGenerator itemLabelGenerator = new StandardCategoryItemLabelGenerator();
+ //renderer.setBaseItemLabelGenerator(itemLabelGenerator);
+ //renderer.setBaseItemLabelsVisible(true);
+
+ CategoryPlot plot = new CategoryPlot(statisticalDataset, categoryAxis, valueAxis, renderer);
+ plot.setOrientation(PlotOrientation.VERTICAL);
+ JFreeChart chart = new JFreeChart(title,
+ JFreeChart.DEFAULT_TITLE_FONT, plot, true);
+
+ // remove series legend
+ chart.removeLegend();
+ // white background
+ chart.setBackgroundPaint(Color.WHITE);
+
+ try {
+ result = File.createTempFile("coser-chart-population-indicator-", ".png");
+ result.deleteOnExit();
+ ChartUtilities.saveChartAsPNG(result, chart, 800, 400);
+ } catch (IOException ex) {
+ throw new CoserTechnicalException("Can't save chart", ex);
+ }
+ }
+
+ return result;
+ }
+
+ // --------------------------------------------------------------------- //
+ // --- Matchers -------------------------------------------------------- //
+ // --------------------------------------------------------------------- //
+
+ protected boolean matchSpecies(LegacyResultRepository repository,
+ GetPopulationIndicatorResultRequest request) {
+ Preconditions.checkNotNull(request.getSpecies());
+
+ String species = request.getSpecies();
+
+ boolean result = false;
+
+ Iterator<String[]> iterator = repository.loadPopulationIndicatorStorage(true);
+ while (iterator.hasNext()) {
+ String[] tuple = iterator.next();
+ if (repository.matchPopulationSpecies(tuple, species)) {
+ result = true;
+ break;
+ }
+ }
+ return result;
+ }
+
+ protected boolean matchSpeciesAndIndicator(LegacyResultRepository repository,
+ GetPopulationIndicatorResultRequest request) {
+ Preconditions.checkNotNull(request.getSpecies());
+ Preconditions.checkNotNull(request.getIndicator());
+
+ String species = request.getSpecies();
+ String indicator = request.getIndicator();
+
+ boolean result = false;
+
+ Iterator<String[]> iterator = repository.loadPopulationIndicatorStorage(true);
+ while (iterator.hasNext()) {
+ String[] tuple = iterator.next();
+ if (repository.matchPopulationSpeciesAndIndicator(tuple, species, indicator)) {
+ result = true;
+ break;
+ }
+ }
+ return result;
+ }
+
+}
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetSpeciesForMapResultCommand.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetSpeciesForMapResultCommand.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetSpeciesForMapResultCommand.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,61 @@
+package fr.ifremer.coser.result.repository.legacy.command;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.coser.result.MapResult;
+import fr.ifremer.coser.result.repository.ResultRepositoryCommand;
+import fr.ifremer.coser.result.repository.legacy.LegacyResultRepository;
+import fr.ifremer.coser.result.request.GetSpeciesForMapResultRequest;
+
+import java.util.Map;
+
+/**
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class GetSpeciesForMapResultCommand implements ResultRepositoryCommand<LegacyResultRepository, GetSpeciesForMapResultRequest> {
+
+ @Override
+ public Class<GetSpeciesForMapResultRequest> getRequestType() {
+ return GetSpeciesForMapResultRequest.class;
+ }
+
+ @Override
+ public boolean accept(LegacyResultRepository repository, GetSpeciesForMapResultRequest request) {
+ return repository.isMapsResult() &&
+ repository.matchFacade(request) &&
+ repository.matchZone(request);
+ }
+
+ @Override
+ public MapResult execute(LegacyResultRepository repository, GetSpeciesForMapResultRequest request) {
+
+ Map<String, String> map = repository.getPopulationIndicatorSpecies();
+
+ MapResult result = new MapResult(repository.getId(), map);
+ return result;
+ }
+
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetSpeciesForMapResultCommand.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetSpeciesForPopulationIndicatorResultCommand.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetSpeciesForPopulationIndicatorResultCommand.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetSpeciesForPopulationIndicatorResultCommand.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,63 @@
+package fr.ifremer.coser.result.repository.legacy.command;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.coser.result.MapResult;
+import fr.ifremer.coser.result.repository.ResultRepositoryCommand;
+import fr.ifremer.coser.result.repository.legacy.LegacyResultRepository;
+import fr.ifremer.coser.result.request.GetSpeciesForPopulationIndicatorResultRequest;
+
+import java.util.Map;
+
+/**
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class GetSpeciesForPopulationIndicatorResultCommand implements ResultRepositoryCommand<LegacyResultRepository, GetSpeciesForPopulationIndicatorResultRequest> {
+
+ @Override
+ public Class<GetSpeciesForPopulationIndicatorResultRequest> getRequestType() {
+ return GetSpeciesForPopulationIndicatorResultRequest.class;
+ }
+
+ @Override
+ public boolean accept(LegacyResultRepository repository,
+ GetSpeciesForPopulationIndicatorResultRequest request) {
+ return repository.isIndicatorsResult() &&
+ repository.matchFacade(request) &&
+ repository.matchZone(request);
+ }
+
+ @Override
+ public MapResult execute(LegacyResultRepository repository,
+ GetSpeciesForPopulationIndicatorResultRequest request) {
+
+ Map<String, String> map = repository.getPopulationIndicatorSpecies();
+
+ MapResult result = new MapResult(repository.getId(), map);
+ return result;
+ }
+
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetSpeciesForPopulationIndicatorResultCommand.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetSpeciesListForCommunityIndicatorResultCommand.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetSpeciesListForCommunityIndicatorResultCommand.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetSpeciesListForCommunityIndicatorResultCommand.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,90 @@
+package fr.ifremer.coser.result.repository.legacy.command;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import fr.ifremer.coser.result.MapResult;
+import fr.ifremer.coser.result.repository.ResultRepositoryCommand;
+import fr.ifremer.coser.result.repository.legacy.LegacyResultRepository;
+import fr.ifremer.coser.result.request.GetSpeciesListForCommunityIndicatorResultRequest;
+
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class GetSpeciesListForCommunityIndicatorResultCommand implements ResultRepositoryCommand<LegacyResultRepository, GetSpeciesListForCommunityIndicatorResultRequest> {
+
+ @Override
+ public Class<GetSpeciesListForCommunityIndicatorResultRequest> getRequestType() {
+ return GetSpeciesListForCommunityIndicatorResultRequest.class;
+ }
+
+ @Override
+ public boolean accept(LegacyResultRepository repository,
+ GetSpeciesListForCommunityIndicatorResultRequest request) {
+ return repository.isIndicatorsResult() &&
+ repository.matchFacade(request) &&
+ repository.matchZone(request) &&
+ matchIndicator(repository, request);
+ }
+
+ @Override
+ public MapResult execute(LegacyResultRepository repository,
+ GetSpeciesListForCommunityIndicatorResultRequest request) {
+
+ Map<String, String> map = repository.getCommunityIndicatorSpecies(request.getLocale(),
+ request.getIndicator());
+
+ MapResult result = new MapResult(repository.getId(), map);
+ return result;
+ }
+
+ // --------------------------------------------------------------------- //
+ // --- Matchers ------------------------------------------------------- //
+ // --------------------------------------------------------------------- //
+
+ protected boolean matchIndicator(LegacyResultRepository repository,
+ GetSpeciesListForCommunityIndicatorResultRequest request) {
+ Preconditions.checkNotNull(request.getIndicator());
+
+ String indicator = request.getIndicator();
+
+ boolean result = false;
+
+ Iterator<String[]> iterator = repository.loadCommunityIndicatorStorage(true);
+ while (iterator.hasNext()) {
+ String[] tuple = iterator.next();
+ if (repository.matchCommunityIndicator(tuple, indicator)) {
+ result = true;
+ break;
+ }
+ }
+ return result;
+ }
+
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetSpeciesListForCommunityIndicatorResultCommand.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetSpeciesListForExtractRawDataAndResultsCommand.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetSpeciesListForExtractRawDataAndResultsCommand.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetSpeciesListForExtractRawDataAndResultsCommand.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,93 @@
+package fr.ifremer.coser.result.repository.legacy.command;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.collect.Maps;
+import fr.ifremer.coser.result.MapResult;
+import fr.ifremer.coser.result.repository.ResultRepositoryCommand;
+import fr.ifremer.coser.result.repository.legacy.LegacyResultRepository;
+import fr.ifremer.coser.result.request.GetSpeciesListForExtractRawDataAndResultsRequest;
+import fr.ifremer.coser.util.DataType;
+
+import java.util.Map;
+
+/**
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class GetSpeciesListForExtractRawDataAndResultsCommand implements ResultRepositoryCommand<LegacyResultRepository, GetSpeciesListForExtractRawDataAndResultsRequest> {
+
+ @Override
+ public Class<GetSpeciesListForExtractRawDataAndResultsRequest> getRequestType() {
+ return GetSpeciesListForExtractRawDataAndResultsRequest.class;
+ }
+
+ @Override
+ public boolean accept(LegacyResultRepository repository,
+ GetSpeciesListForExtractRawDataAndResultsRequest request) {
+ return matchExtractTypeSet(repository, request) &&
+ matchZoneList(repository, request);
+ }
+
+ @Override
+ public MapResult execute(LegacyResultRepository repository,
+ GetSpeciesListForExtractRawDataAndResultsRequest request) {
+
+ Map<String, String> map = Maps.newHashMap();
+
+ // get all species for population indicators
+ map.putAll(repository.getPopulationIndicatorSpecies());
+ // get all species for community indicators
+ map.putAll(repository.getCommunityIndicatorSpecies());
+
+ MapResult result = new MapResult(repository.getId(), map);
+ return result;
+ }
+
+ // --------------------------------------------------------------------- //
+ // --- Matchers ------------------------------------------------------- //
+ // --------------------------------------------------------------------- //
+
+ protected boolean matchExtractTypeSet(LegacyResultRepository repository,
+ GetSpeciesListForExtractRawDataAndResultsRequest request) {
+ boolean result = false;
+ if (repository.isMapsResult()) {
+ result = request.getExtractTypeList().contains(DataType.SOURCE);
+ }
+ if (repository.isIndicatorsResult()) {
+ result = request.getExtractTypeList().contains(DataType.POPULATION) ||
+ request.getExtractTypeList().contains(DataType.COMMUNITY);
+ }
+ if (repository.isDataResult()) {
+ result = request.getExtractTypeList().contains(DataType.SOURCE);
+ }
+ return result;
+ }
+
+ protected boolean matchZoneList(LegacyResultRepository repository,
+ GetSpeciesListForExtractRawDataAndResultsRequest request) {
+ return request.getZoneList().contains(repository.getZone());
+ }
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetSpeciesListForExtractRawDataAndResultsCommand.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetZonesForCommunityIndicatorResultCommand.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetZonesForCommunityIndicatorResultCommand.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetZonesForCommunityIndicatorResultCommand.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,64 @@
+package fr.ifremer.coser.result.repository.legacy.command;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.coser.bean.ZoneMap;
+import fr.ifremer.coser.result.MapResult;
+import fr.ifremer.coser.result.repository.ResultRepositoryCommand;
+import fr.ifremer.coser.result.repository.legacy.LegacyResultRepository;
+import fr.ifremer.coser.result.request.GetZonesForCommunityIndicatorResultRequest;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class GetZonesForCommunityIndicatorResultCommand implements ResultRepositoryCommand<LegacyResultRepository, GetZonesForCommunityIndicatorResultRequest> {
+
+ @Override
+ public Class<GetZonesForCommunityIndicatorResultRequest> getRequestType() {
+ return GetZonesForCommunityIndicatorResultRequest.class;
+ }
+
+ @Override
+ public boolean accept(LegacyResultRepository repository, GetZonesForCommunityIndicatorResultRequest request) {
+ return repository.isIndicatorsResult() && repository.matchFacade(request);
+ }
+
+ @Override
+ public MapResult execute(LegacyResultRepository repository, GetZonesForCommunityIndicatorResultRequest request) {
+
+ ZoneMap zonesMap = repository.getZonesMap();
+ List<String> allowedZones = zonesMap.getZonesForFacade(request.getFacade());
+ Map<String, String> map = zonesMap.getSubZonesMap(repository.getZone(), allowedZones);
+
+ MapResult result = new MapResult(repository.getId(), map);
+ return result;
+ }
+
+
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetZonesForCommunityIndicatorResultCommand.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetZonesForExtractRawDataCommand.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetZonesForExtractRawDataCommand.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetZonesForExtractRawDataCommand.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,66 @@
+package fr.ifremer.coser.result.repository.legacy.command;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.coser.bean.ZoneMap;
+import fr.ifremer.coser.result.MapResult;
+import fr.ifremer.coser.result.repository.ResultRepositoryCommand;
+import fr.ifremer.coser.result.repository.legacy.LegacyResultRepository;
+import fr.ifremer.coser.result.request.GetZonesForExtractRawDataRequest;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class GetZonesForExtractRawDataCommand implements ResultRepositoryCommand<LegacyResultRepository, GetZonesForExtractRawDataRequest> {
+
+ @Override
+ public Class<GetZonesForExtractRawDataRequest> getRequestType() {
+ return GetZonesForExtractRawDataRequest.class;
+ }
+
+ @Override
+ public boolean accept(LegacyResultRepository repository,
+ GetZonesForExtractRawDataRequest request) {
+ return repository.isDataResult() &&
+ repository.matchFacade(request);
+ }
+
+ @Override
+ public MapResult execute(LegacyResultRepository repository,
+ GetZonesForExtractRawDataRequest request) {
+
+ ZoneMap zonesMap = repository.getZonesMap();
+ List<String> allowedZones = zonesMap.getZonesForFacade(request.getFacade());
+ Map<String, String> map = zonesMap.getSubZonesMap(repository.getZone(), allowedZones);
+
+ MapResult result = new MapResult(repository.getId(), map);
+ return result;
+ }
+
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetZonesForExtractRawDataCommand.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetZonesForMapResultCommand.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetZonesForMapResultCommand.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetZonesForMapResultCommand.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,66 @@
+package fr.ifremer.coser.result.repository.legacy.command;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.coser.bean.ZoneMap;
+import fr.ifremer.coser.result.MapResult;
+import fr.ifremer.coser.result.repository.ResultRepositoryCommand;
+import fr.ifremer.coser.result.repository.legacy.LegacyResultRepository;
+import fr.ifremer.coser.result.request.GetZonesForMapResultRequest;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class GetZonesForMapResultCommand implements ResultRepositoryCommand<LegacyResultRepository, GetZonesForMapResultRequest> {
+
+ @Override
+ public Class<GetZonesForMapResultRequest> getRequestType() {
+ return GetZonesForMapResultRequest.class;
+ }
+
+ @Override
+ public boolean accept(LegacyResultRepository repository,
+ GetZonesForMapResultRequest request) {
+ return repository.isMapsResult() &&
+ repository.matchFacade(request);
+ }
+
+ @Override
+ public MapResult execute(LegacyResultRepository repository,
+ GetZonesForMapResultRequest request) {
+
+ ZoneMap zonesMap = repository.getZonesMap();
+ List<String> allowedZones = zonesMap.getZonesForFacade(request.getFacade());
+ Map<String, String> map = zonesMap.getSubZonesMap(repository.getZone(), allowedZones);
+
+ MapResult result = new MapResult(repository.getId(), map);
+ return result;
+ }
+
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetZonesForMapResultCommand.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetZonesForPopulationIndicatorResultCommand.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetZonesForPopulationIndicatorResultCommand.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetZonesForPopulationIndicatorResultCommand.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,66 @@
+package fr.ifremer.coser.result.repository.legacy.command;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.coser.bean.ZoneMap;
+import fr.ifremer.coser.result.MapResult;
+import fr.ifremer.coser.result.repository.ResultRepositoryCommand;
+import fr.ifremer.coser.result.repository.legacy.LegacyResultRepository;
+import fr.ifremer.coser.result.request.GetZonesForPopulationIndicatorResultRequest;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class GetZonesForPopulationIndicatorResultCommand implements ResultRepositoryCommand<LegacyResultRepository, GetZonesForPopulationIndicatorResultRequest> {
+
+ @Override
+ public Class<GetZonesForPopulationIndicatorResultRequest> getRequestType() {
+ return GetZonesForPopulationIndicatorResultRequest.class;
+ }
+
+ @Override
+ public boolean accept(LegacyResultRepository repository,
+ GetZonesForPopulationIndicatorResultRequest request) {
+ return repository.isIndicatorsResult() &&
+ repository.matchFacade(request);
+ }
+
+ @Override
+ public MapResult execute(LegacyResultRepository repository,
+ GetZonesForPopulationIndicatorResultRequest request) {
+
+ ZoneMap zonesMap = repository.getZonesMap();
+ List<String> allowedZones = zonesMap.getZonesForFacade(request.getFacade());
+ Map<String, String> map = zonesMap.getSubZonesMap(repository.getZone(), allowedZones);
+
+ MapResult result = new MapResult(repository.getId(), map);
+ return result;
+ }
+
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetZonesForPopulationIndicatorResultCommand.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetZonesListForExtractRawDataAndResultsCommand.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetZonesListForExtractRawDataAndResultsCommand.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetZonesListForExtractRawDataAndResultsCommand.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,63 @@
+package fr.ifremer.coser.result.repository.legacy.command;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.coser.bean.ZoneMap;
+import fr.ifremer.coser.result.MapResult;
+import fr.ifremer.coser.result.repository.ResultRepositoryCommand;
+import fr.ifremer.coser.result.repository.legacy.LegacyResultRepository;
+import fr.ifremer.coser.result.request.GetZonesForExtractRawDataAndResultsRequest;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class GetZonesListForExtractRawDataAndResultsCommand implements ResultRepositoryCommand<LegacyResultRepository, GetZonesForExtractRawDataAndResultsRequest> {
+
+ @Override
+ public Class<GetZonesForExtractRawDataAndResultsRequest> getRequestType() {
+ return GetZonesForExtractRawDataAndResultsRequest.class;
+ }
+
+ @Override
+ public boolean accept(LegacyResultRepository repository,
+ GetZonesForExtractRawDataAndResultsRequest request) {
+ return true;
+ }
+
+ @Override
+ public MapResult execute(LegacyResultRepository repository,
+ GetZonesForExtractRawDataAndResultsRequest request) {
+ ZoneMap zonesMap = repository.getZonesMap();
+ List<String> allowedZones = zonesMap.getZonesForFacade(null);
+ Map<String, String> map = zonesMap.getSubZonesMap(repository.getZone(), allowedZones);
+ MapResult result = new MapResult(repository.getId(), map);
+ return result;
+ }
+
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/command/GetZonesListForExtractRawDataAndResultsCommand.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Copied: trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/AbstractGetIndicatorResultRequest.java (from rev 1141, trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/IndicatorRequest.java)
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/AbstractGetIndicatorResultRequest.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/AbstractGetIndicatorResultRequest.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,122 @@
+package fr.ifremer.coser.result.request;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import fr.ifremer.coser.result.CoserRequest;
+
+import java.util.Locale;
+
+/**
+ * Request to obtain indicator results.
+ * <p/>
+ * Created on 3/4/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public abstract class AbstractGetIndicatorResultRequest implements CoserRequest, CoserRequestFacadeAware, CoserRequestZoneAware, CoserRequestSpeciesAware, CoserRequestIndicatorAware {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Type of result.
+ */
+ public enum IndicatorResultType {
+ DATA,
+ GRAPH
+ }
+
+ protected Locale locale;
+
+ protected String facade;
+
+ protected String zone;
+
+ protected String indicator;
+
+ protected IndicatorResultType indicatorResultType;
+
+ @Override
+ public Locale getLocale() {
+ return locale;
+ }
+
+ @Override
+ public void setLocale(Locale locale) {
+ Preconditions.checkNotNull(locale);
+ this.locale = locale;
+ }
+
+ @Override
+ public boolean isFilled() {
+ return !(locale == null ||
+ facade == null ||
+ zone == null ||
+ indicatorResultType == null ||
+ indicator == null);
+ }
+
+ @Override
+ public String getFacade() {
+ return facade;
+ }
+
+ @Override
+ public void setFacade(String facade) {
+ Preconditions.checkNotNull(facade);
+ this.facade = facade;
+ }
+
+ @Override
+ public String getZone() {
+ return zone;
+ }
+
+ @Override
+ public void setZone(String zone) {
+ Preconditions.checkNotNull(zone);
+ this.zone = zone;
+ }
+
+ public IndicatorResultType getIndicatorResultType() {
+ return indicatorResultType;
+ }
+
+ public void setIndicatorResultType(IndicatorResultType indicatorResultType) {
+ Preconditions.checkNotNull(indicatorResultType);
+ this.indicatorResultType = indicatorResultType;
+ }
+
+ @Override
+ public String getIndicator() {
+ return indicator;
+ }
+
+ @Override
+ public void setIndicator(String indicator) {
+ Preconditions.checkNotNull(indicator);
+ this.indicator = indicator;
+ }
+
+}
Deleted: trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/CommunityIndicatorRequest.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/CommunityIndicatorRequest.java 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/CommunityIndicatorRequest.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -1,56 +0,0 @@
-package fr.ifremer.coser.result.request;
-
-/*
- * #%L
- * Coser :: Business
- * %%
- * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>.
- * #L%
- */
-
-import com.google.common.base.Preconditions;
-
-/**
- * Request to obtain community indicator results.
- * <p/>
- * Created on 3/4/14.
- *
- * @author Tony Chemit <chemit(a)codelutin.com>
- * @since 1.5
- */
-public class CommunityIndicatorRequest extends IndicatorRequest {
-
- private static final long serialVersionUID = 1L;
-
- protected String species;
-
- @Override
- public String getSpecies() {
- return species;
- }
-
- @Override
- public void setSpecies(String species) {
- Preconditions.checkNotNull(facade);
- this.species = species;
- }
-
- @Override
- public boolean isFilled() {
- return super.isFilled() && species != null;
- }
-}
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/CoserRequestBuilder.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/CoserRequestBuilder.java 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/CoserRequestBuilder.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -22,7 +22,10 @@
* #L%
*/
+import com.google.common.base.Preconditions;
+import fr.ifremer.coser.CoserTechnicalException;
import fr.ifremer.coser.result.CoserRequest;
+import fr.ifremer.coser.result.ResultType;
import fr.ifremer.coser.util.DataType;
import org.apache.commons.collections4.CollectionUtils;
@@ -37,7 +40,7 @@
* @author Tony Chemit <chemit(a)codelutin.com>
* @since 1.5
*/
-public class CoserRequestBuilder {
+public class CoserRequestBuilder<R extends CoserRequest> {
protected final Locale locale;
@@ -49,7 +52,7 @@
protected String indicator;
- protected IndicatorRequest.ResultType resultType;
+ protected AbstractGetIndicatorResultRequest.IndicatorResultType indicatorResultType;
protected List<DataType> extractTypeList;
@@ -61,91 +64,92 @@
protected List<String> communityIndicatorList;
- public CoserRequestBuilder(Locale locale) {
+ protected String resultRepositoryType;
+
+ protected ResultType resultType;
+
+ protected final Class<R> requestType;
+
+ public CoserRequestBuilder(Locale locale, Class<R> requestType) {
+ Preconditions.checkNotNull(locale);
+ Preconditions.checkNotNull(requestType);
this.locale = locale;
+ this.requestType = requestType;
}
- public CoserRequestBuilder addFacade(String facade) {
+ public CoserRequestBuilder<R> addFacade(String facade) {
this.facade = facade;
return this;
}
- public CoserRequestBuilder addZone(String zone) {
+ public CoserRequestBuilder<R> addZone(String zone) {
this.zone = zone;
return this;
}
- public CoserRequestBuilder addSpecies(String species) {
+ public CoserRequestBuilder<R> addSpecies(String species) {
this.species = species;
return this;
}
- public CoserRequestBuilder addIndicator(String indicator) {
+ public CoserRequestBuilder<R> addIndicator(String indicator) {
this.indicator = indicator;
return this;
}
- public CoserRequestBuilder addResultType(IndicatorRequest.ResultType resultType) {
- this.resultType = resultType;
+ public CoserRequestBuilder<R> addIndicatorResultType(AbstractGetIndicatorResultRequest.IndicatorResultType indicatorResultType) {
+ this.indicatorResultType = indicatorResultType;
return this;
}
- public CoserRequestBuilder addExtractTypeList(List<DataType> extractTypeSet) {
+ public CoserRequestBuilder<R> addExtractTypeList(List<DataType> extractTypeSet) {
this.extractTypeList = extractTypeSet;
return this;
}
- public CoserRequestBuilder addZoneList(List<String> zoneList) {
+ public CoserRequestBuilder<R> addZoneList(List<String> zoneList) {
this.zoneList = zoneList;
return this;
}
- public CoserRequestBuilder addSpeciesList(List<String> speciesList) {
+ public CoserRequestBuilder<R> addSpeciesList(List<String> speciesList) {
this.speciesList = speciesList;
return this;
}
- public CoserRequestBuilder addPopulationIndicatorList(List<String> populationIndicatorList) {
+ public CoserRequestBuilder<R> addPopulationIndicatorList(List<String> populationIndicatorList) {
this.populationIndicatorList = populationIndicatorList;
return this;
}
- public CoserRequestBuilder addCommunityIndicatorList(List<String> communityIndicatorList) {
+ public CoserRequestBuilder<R> addCommunityIndicatorList(List<String> communityIndicatorList) {
this.communityIndicatorList = communityIndicatorList;
return this;
}
- public MapRequest toMapRequest() {
- MapRequest request = new MapRequest();
- flush(request);
- return request;
+ public CoserRequestBuilder<R> addResultRepositoryType(String resultRepositoryType) {
+ this.resultRepositoryType = resultRepositoryType;
+ return this;
}
- public RawDataRequest toRawDataRequest() {
- RawDataRequest request = new RawDataRequest();
- flush(request);
- return request;
+ public CoserRequestBuilder<R> addResultType(ResultType resultType) {
+ this.resultType = resultType;
+ return this;
}
- public PopulationIndicatorRequest toPopulationIndicatorRequest() {
- PopulationIndicatorRequest request = new PopulationIndicatorRequest();
- flush(request);
- return request;
+ public R toRequest() {
+ try {
+ R request = requestType.newInstance();
+ flush(request);
+ return request;
+ } catch (InstantiationException e) {
+ throw new CoserTechnicalException(e);
+ } catch (IllegalAccessException e) {
+ throw new CoserTechnicalException(e);
+ }
}
- public CommunityIndicatorRequest toCommunityIndicatorRequest() {
- CommunityIndicatorRequest request = new CommunityIndicatorRequest();
- flush(request);
- return request;
- }
-
- public ExtractRequest toExtractRequest() {
- ExtractRequest request = new ExtractRequest();
- flush(request);
- return request;
- }
-
- protected <R extends CoserRequest> void flush(R request) {
+ protected void flush(R request) {
request.setLocale(locale);
if (request instanceof CoserRequestFacadeAware) {
if (facade != null) {
@@ -162,34 +166,56 @@
((CoserRequestSpeciesAware) request).setSpecies(species);
}
}
-
- if (request instanceof IndicatorRequest) {
+ if (request instanceof CoserRequestZoneListAware) {
+ if (CollectionUtils.isNotEmpty(zoneList)) {
+ ((CoserRequestZoneListAware) request).setZoneList(zoneList);
+ }
+ }
+ if (request instanceof CoserRequestIndicatorAware) {
if (indicator != null) {
- ((IndicatorRequest) request).setIndicator(indicator);
+ ((CoserRequestIndicatorAware) request).setIndicator(indicator);
}
- if (resultType != null) {
- ((IndicatorRequest) request).setResultType(resultType);
+ }
+
+ if (request instanceof AbstractGetIndicatorResultRequest) {
+ if (indicatorResultType != null) {
+ ((AbstractGetIndicatorResultRequest) request).setIndicatorResultType(indicatorResultType);
}
}
- if (request instanceof ExtractRequest) {
+ if (request instanceof ExtractRawDataAndResultsRequest) {
if (CollectionUtils.isNotEmpty(extractTypeList)) {
- ((ExtractRequest) request).setExtractTypeList(extractTypeList);
+ ((ExtractRawDataAndResultsRequest) request).setExtractTypeList(extractTypeList);
}
- if (CollectionUtils.isNotEmpty(zoneList)) {
- ((ExtractRequest) request).setZoneList(zoneList);
- }
if (CollectionUtils.isNotEmpty(populationIndicatorList)) {
- ((ExtractRequest) request).setPopulationIndicatorList(populationIndicatorList);
+ ((ExtractRawDataAndResultsRequest) request).setPopulationIndicatorList(populationIndicatorList);
}
if (CollectionUtils.isNotEmpty(communityIndicatorList)) {
- ((ExtractRequest) request).setCommunityIndicatorList(communityIndicatorList);
+ ((ExtractRawDataAndResultsRequest) request).setCommunityIndicatorList(communityIndicatorList);
}
if (CollectionUtils.isNotEmpty(speciesList)) {
- ((ExtractRequest) request).setSpeciesList(speciesList);
+ ((ExtractRawDataAndResultsRequest) request).setSpeciesList(speciesList);
}
}
+
+ if (request instanceof DeleteResultsRequest) {
+ if (resultRepositoryType != null) {
+ ((DeleteResultsRequest) request).setResultRepositoryType(resultRepositoryType);
+ }
+ if (resultType != null) {
+ ((DeleteResultsRequest) request).setResultType(resultType);
+ }
+ }
+
+ if (request instanceof GetAllResultsRequest) {
+ if (resultRepositoryType != null) {
+ ((GetAllResultsRequest) request).setResultRepositoryType(resultRepositoryType);
+ }
+ if (resultType != null) {
+ ((GetAllResultsRequest) request).setResultType(resultType);
+ }
+ }
}
}
Copied: trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/CoserRequestIndicatorAware.java (from rev 1134, trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/CoserRequestZoneAware.java)
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/CoserRequestIndicatorAware.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/CoserRequestIndicatorAware.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,40 @@
+package fr.ifremer.coser.result.request;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.coser.result.CoserRequest;
+
+/**
+ * Place this on any request which involve a {@code indicator}.
+ * <p/>
+ * Created on 3/7/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public interface CoserRequestIndicatorAware extends CoserRequest {
+
+ String getIndicator();
+
+ void setIndicator(String indicator);
+}
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/CoserRequestZoneAware.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/CoserRequestZoneAware.java 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/CoserRequestZoneAware.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -30,7 +30,7 @@
* Created on 3/7/14.
*
* @author Tony Chemit <chemit(a)codelutin.com>
- * @since XXX
+ * @since 1.5
*/
public interface CoserRequestZoneAware extends CoserRequest {
Copied: trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/CoserRequestZoneListAware.java (from rev 1134, trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/CoserRequestZoneAware.java)
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/CoserRequestZoneListAware.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/CoserRequestZoneListAware.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,42 @@
+package fr.ifremer.coser.result.request;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.coser.result.CoserRequest;
+
+import java.util.List;
+
+/**
+ * Place this on any request which involve a {@code zone}.
+ * <p/>
+ * Created on 3/7/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public interface CoserRequestZoneListAware extends CoserRequest {
+
+ List<String> getZoneList();
+
+ void setZoneList(List<String> zoneList);
+}
Deleted: trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/DeleteRequest.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/DeleteRequest.java 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/DeleteRequest.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -1,74 +0,0 @@
-package fr.ifremer.coser.result.request;
-
-/*
- * #%L
- * Coser :: Business
- * %%
- * Copyright (C) 2010 - 2014 Ifremer, Codelutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.coser.result.CoserRequest;
-import fr.ifremer.coser.util.DataType;
-import org.apache.commons.collections4.CollectionUtils;
-
-import java.util.List;
-import java.util.Locale;
-
-/**
- * To delete some results.
- * Created on 3/11/14.
- *
- * @author Tony Chemit <chemit(a)codelutin.com>
- * @since 1.5
- */
-public class DeleteRequest implements CoserRequest {
-
- private static final long serialVersionUID = 1L;
-
- protected Locale locale;
-
- protected List<String> zoneList;
-
- protected List<String> populationIndicatorList;
-
- protected List<String> communityIndicatorList;
-
- protected List<String> speciesList;
-
- protected List<DataType> extractTypeList;
-
- @Override
- public Locale getLocale() {
- return locale;
- }
-
- @Override
- public void setLocale(Locale locale) {
- this.locale = locale;
- }
-
- @Override
- public boolean isFilled() {
- return !(locale == null ||
- CollectionUtils.isEmpty(extractTypeList) ||
- CollectionUtils.isEmpty(zoneList) ||
- CollectionUtils.isEmpty(populationIndicatorList) ||
- CollectionUtils.isEmpty(communityIndicatorList) ||
- CollectionUtils.isEmpty(speciesList));
- }
-}
Copied: trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/DeleteResultsRequest.java (from rev 1144, trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/DeleteRequest.java)
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/DeleteResultsRequest.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/DeleteResultsRequest.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,110 @@
+package fr.ifremer.coser.result.request;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import fr.ifremer.coser.result.CoserRequest;
+import fr.ifremer.coser.result.ResultType;
+import fr.ifremer.coser.result.repository.ResultRepositoryType;
+import org.apache.commons.collections4.CollectionUtils;
+
+import java.util.List;
+import java.util.Locale;
+
+/**
+ * To delete some results.
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class DeleteResultsRequest implements CoserRequest, CoserRequestZoneListAware {
+
+ private static final long serialVersionUID = 1L;
+
+ protected Locale locale;
+
+ /**
+ * Id of matching result repository type.
+ *
+ * @see ResultRepositoryType#getId()
+ */
+ protected String resultRepositoryType;
+
+ /**
+ * Type of matching result.
+ */
+ protected ResultType resultType;
+
+ /**
+ * Ids of matching zone to delete.
+ */
+ protected List<String> zoneList;
+
+ @Override
+ public Locale getLocale() {
+ return locale;
+ }
+
+ @Override
+ public void setLocale(Locale locale) {
+ this.locale = locale;
+ }
+
+ @Override
+ public boolean isFilled() {
+ return !(locale == null ||
+ resultRepositoryType == null ||
+ resultType == null ||
+ CollectionUtils.isEmpty(zoneList));
+ }
+
+ public String getResultRepositoryType() {
+ return resultRepositoryType;
+ }
+
+ public void setResultRepositoryType(String resultRepositoryType) {
+ Preconditions.checkNotNull(resultRepositoryType);
+ this.resultRepositoryType = resultRepositoryType;
+ }
+
+ public ResultType getResultType() {
+ return resultType;
+ }
+
+ public void setResultType(ResultType resultType) {
+ Preconditions.checkNotNull(resultType);
+ this.resultType = resultType;
+ }
+
+ @Override
+ public List<String> getZoneList() {
+ return zoneList;
+ }
+
+ @Override
+ public void setZoneList(List<String> zoneList) {
+ Preconditions.checkArgument(CollectionUtils.isNotEmpty(zoneList));
+ this.zoneList = zoneList;
+ }
+}
Copied: trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/ExtractRawDataAndResultsRequest.java (from rev 1141, trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/ExtractRequest.java)
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/ExtractRawDataAndResultsRequest.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/ExtractRawDataAndResultsRequest.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,124 @@
+package fr.ifremer.coser.result.request;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import fr.ifremer.coser.result.CoserRequest;
+import fr.ifremer.coser.util.DataType;
+import org.apache.commons.collections4.CollectionUtils;
+
+import java.util.List;
+import java.util.Locale;
+
+/**
+ * Request to extract data.
+ * <p/>
+ * Created on 3/9/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class ExtractRawDataAndResultsRequest implements CoserRequest, CoserRequestZoneListAware {
+
+ private static final long serialVersionUID = 1L;
+
+ protected Locale locale;
+
+ protected List<String> zoneList;
+
+ protected List<String> populationIndicatorList;
+
+ protected List<String> communityIndicatorList;
+
+ protected List<String> speciesList;
+
+ protected List<DataType> extractTypeList;
+
+ @Override
+ public Locale getLocale() {
+ return locale;
+ }
+
+ @Override
+ public void setLocale(Locale locale) {
+ Preconditions.checkNotNull(locale);
+ this.locale = locale;
+ }
+
+ @Override
+ public boolean isFilled() {
+ return !(locale == null ||
+ CollectionUtils.isEmpty(extractTypeList) ||
+ CollectionUtils.isEmpty(zoneList) ||
+ CollectionUtils.isEmpty(populationIndicatorList) ||
+ CollectionUtils.isEmpty(communityIndicatorList) ||
+ CollectionUtils.isEmpty(speciesList));
+ }
+
+ public List<DataType> getExtractTypeList() {
+ return extractTypeList;
+ }
+
+ public void setExtractTypeList(List<DataType> extractTypeSet) {
+ Preconditions.checkArgument(CollectionUtils.isNotEmpty(extractTypeSet));
+ this.extractTypeList = extractTypeSet;
+ }
+
+ @Override
+ public List<String> getZoneList() {
+ return zoneList;
+ }
+
+ @Override
+ public void setZoneList(List<String> zoneList) {
+ Preconditions.checkArgument(CollectionUtils.isNotEmpty(zoneList));
+ this.zoneList = zoneList;
+ }
+
+ public List<String> getPopulationIndicatorList() {
+ return populationIndicatorList;
+ }
+
+ public void setPopulationIndicatorList(List<String> populationIndicatorList) {
+ Preconditions.checkArgument(CollectionUtils.isNotEmpty(populationIndicatorList));
+ this.populationIndicatorList = populationIndicatorList;
+ }
+
+ public List<String> getCommunityIndicatorList() {
+ return communityIndicatorList;
+ }
+
+ public void setCommunityIndicatorList(List<String> communityIndicatorList) {
+ Preconditions.checkArgument(CollectionUtils.isNotEmpty(communityIndicatorList));
+ this.communityIndicatorList = communityIndicatorList;
+ }
+
+ public List<String> getSpeciesList() {
+ return speciesList;
+ }
+
+ public void setSpeciesList(List<String> speciesList) {
+ Preconditions.checkArgument(CollectionUtils.isNotEmpty(speciesList));
+ this.speciesList = speciesList;
+ }
+}
Copied: trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/ExtractRawDataRequest.java (from rev 1134, trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/RawDataRequest.java)
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/ExtractRawDataRequest.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/ExtractRawDataRequest.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,85 @@
+package fr.ifremer.coser.result.request;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import fr.ifremer.coser.result.CoserRequest;
+
+import java.util.Locale;
+
+/**
+ * Request to obtain raw data results.
+ * <p/>
+ * Created on 3/4/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class ExtractRawDataRequest implements CoserRequest, CoserRequestFacadeAware, CoserRequestZoneAware {
+
+ private static final long serialVersionUID = 1L;
+
+ protected Locale locale;
+
+ protected String facade;
+
+ protected String zone;
+
+ @Override
+ public Locale getLocale() {
+ return locale;
+ }
+
+ @Override
+ public void setLocale(Locale locale) {
+ Preconditions.checkNotNull(locale);
+ this.locale = locale;
+ }
+
+ @Override
+ public boolean isFilled() {
+ return !(locale == null || facade == null || zone == null);
+ }
+
+ @Override
+ public String getFacade() {
+ return facade;
+ }
+
+ @Override
+ public void setFacade(String facade) {
+ Preconditions.checkNotNull(facade);
+ this.facade = facade;
+ }
+
+ @Override
+ public String getZone() {
+ return zone;
+ }
+
+ @Override
+ public void setZone(String zone) {
+ Preconditions.checkNotNull(zone);
+ this.zone = zone;
+ }
+}
Deleted: trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/ExtractRequest.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/ExtractRequest.java 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/ExtractRequest.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -1,122 +0,0 @@
-package fr.ifremer.coser.result.request;
-
-/*
- * #%L
- * Coser :: Business
- * %%
- * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>.
- * #L%
- */
-
-import com.google.common.base.Preconditions;
-import fr.ifremer.coser.result.CoserRequest;
-import fr.ifremer.coser.util.DataType;
-import org.apache.commons.collections4.CollectionUtils;
-
-import java.util.List;
-import java.util.Locale;
-
-/**
- * Request to extract data.
- * <p/>
- * Created on 3/9/14.
- *
- * @author Tony Chemit <chemit(a)codelutin.com>
- * @since 1.5
- */
-public class ExtractRequest implements CoserRequest {
-
- private static final long serialVersionUID = 1L;
-
- protected Locale locale;
-
- protected List<String> zoneList;
-
- protected List<String> populationIndicatorList;
-
- protected List<String> communityIndicatorList;
-
- protected List<String> speciesList;
-
- protected List<DataType> extractTypeList;
-
- @Override
- public Locale getLocale() {
- return locale;
- }
-
- @Override
- public void setLocale(Locale locale) {
- Preconditions.checkNotNull(locale);
- this.locale = locale;
- }
-
- @Override
- public boolean isFilled() {
- return !(locale == null ||
- CollectionUtils.isEmpty(extractTypeList) ||
- CollectionUtils.isEmpty(zoneList) ||
- CollectionUtils.isEmpty(populationIndicatorList) ||
- CollectionUtils.isEmpty(communityIndicatorList) ||
- CollectionUtils.isEmpty(speciesList));
- }
-
- public List<DataType> getExtractTypeList() {
- return extractTypeList;
- }
-
- public void setExtractTypeList(List<DataType> extractTypeSet) {
- Preconditions.checkArgument(CollectionUtils.isNotEmpty(extractTypeSet));
- this.extractTypeList = extractTypeSet;
- }
-
- public List<String> getZoneList() {
- return zoneList;
- }
-
- public void setZoneList(List<String> zoneList) {
- Preconditions.checkArgument(CollectionUtils.isNotEmpty(zoneList));
- this.zoneList = zoneList;
- }
-
- public List<String> getPopulationIndicatorList() {
- return populationIndicatorList;
- }
-
- public void setPopulationIndicatorList(List<String> populationIndicatorList) {
- Preconditions.checkArgument(CollectionUtils.isNotEmpty(populationIndicatorList));
- this.populationIndicatorList = populationIndicatorList;
- }
-
- public List<String> getCommunityIndicatorList() {
- return communityIndicatorList;
- }
-
- public void setCommunityIndicatorList(List<String> communityIndicatorList) {
- Preconditions.checkArgument(CollectionUtils.isNotEmpty(communityIndicatorList));
- this.communityIndicatorList = communityIndicatorList;
- }
-
- public List<String> getSpeciesList() {
- return speciesList;
- }
-
- public void setSpeciesList(List<String> speciesList) {
- Preconditions.checkArgument(CollectionUtils.isNotEmpty(speciesList));
- this.speciesList = speciesList;
- }
-}
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetAllResultsRequest.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetAllResultsRequest.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetAllResultsRequest.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,90 @@
+package fr.ifremer.coser.result.request;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import fr.ifremer.coser.result.CoserRequest;
+import fr.ifremer.coser.result.ResultType;
+import fr.ifremer.coser.result.repository.ResultRepositoryType;
+
+import java.util.Locale;
+
+/**
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class GetAllResultsRequest implements CoserRequest {
+
+ private static final long serialVersionUID = 1L;
+
+ protected Locale locale;
+
+ /**
+ * Id of matching result repository type.
+ *
+ * @see ResultRepositoryType#getId()
+ */
+ protected String resultRepositoryType;
+
+ /**
+ * Type of matching result.
+ */
+ protected ResultType resultType;
+
+ @Override
+ public boolean isFilled() {
+ return !(locale == null || resultRepositoryType == null || resultType == null);
+ }
+
+ @Override
+ public Locale getLocale() {
+ return locale;
+ }
+
+ @Override
+ public void setLocale(Locale locale) {
+ Preconditions.checkNotNull(locale);
+ this.locale = locale;
+ }
+
+ public String getResultRepositoryType() {
+ return resultRepositoryType;
+ }
+
+ public void setResultRepositoryType(String resultRepositoryType) {
+ Preconditions.checkNotNull(resultRepositoryType);
+ this.resultRepositoryType = resultRepositoryType;
+ }
+
+ public ResultType getResultType() {
+ return resultType;
+ }
+
+ public void setResultType(ResultType resultType) {
+ Preconditions.checkNotNull(resultType);
+ this.resultType = resultType;
+ }
+
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetAllResultsRequest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Copied: trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetCommunityIndicatorResultRequest.java (from rev 1134, trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/CommunityIndicatorRequest.java)
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetCommunityIndicatorResultRequest.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetCommunityIndicatorResultRequest.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,56 @@
+package fr.ifremer.coser.result.request;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+
+/**
+ * Request to obtain community indicator results.
+ * <p/>
+ * Created on 3/4/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class GetCommunityIndicatorResultRequest extends AbstractGetIndicatorResultRequest {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String species;
+
+ @Override
+ public String getSpecies() {
+ return species;
+ }
+
+ @Override
+ public void setSpecies(String species) {
+ Preconditions.checkNotNull(facade);
+ this.species = species;
+ }
+
+ @Override
+ public boolean isFilled() {
+ return super.isFilled() && species != null;
+ }
+}
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetIndicatorsForCommunityIndicatorResultRequest.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetIndicatorsForCommunityIndicatorResultRequest.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetIndicatorsForCommunityIndicatorResultRequest.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,88 @@
+package fr.ifremer.coser.result.request;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import fr.ifremer.coser.result.CoserRequest;
+
+import java.util.Locale;
+
+/**
+ * Request to obtain community indicator results.
+ * <p/>
+ * Created on 3/4/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class GetIndicatorsForCommunityIndicatorResultRequest implements CoserRequest, CoserRequestFacadeAware, CoserRequestZoneAware {
+
+ private static final long serialVersionUID = 1L;
+
+ protected Locale locale;
+
+ protected String facade;
+
+ protected String zone;
+
+ @Override
+ public Locale getLocale() {
+ return locale;
+ }
+
+ @Override
+ public void setLocale(Locale locale) {
+ Preconditions.checkNotNull(locale);
+ this.locale = locale;
+ }
+
+ @Override
+ public boolean isFilled() {
+ return !(locale == null ||
+ facade == null ||
+ zone == null);
+ }
+
+ @Override
+ public String getFacade() {
+ return facade;
+ }
+
+ @Override
+ public void setFacade(String facade) {
+ Preconditions.checkNotNull(facade);
+ this.facade = facade;
+ }
+
+ @Override
+ public String getZone() {
+ return zone;
+ }
+
+ @Override
+ public void setZone(String zone) {
+ Preconditions.checkNotNull(zone);
+ this.zone = zone;
+ }
+
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetIndicatorsForCommunityIndicatorResultRequest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetIndicatorsForExtractRawDataAndResultsRequest.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetIndicatorsForExtractRawDataAndResultsRequest.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetIndicatorsForExtractRawDataAndResultsRequest.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,110 @@
+package fr.ifremer.coser.result.request;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import fr.ifremer.coser.result.CoserRequest;
+import fr.ifremer.coser.util.DataType;
+import org.apache.commons.collections4.CollectionUtils;
+
+import java.util.List;
+import java.util.Locale;
+
+/**
+ * Request to extract data.
+ * <p/>
+ * Created on 3/9/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class GetIndicatorsForExtractRawDataAndResultsRequest implements CoserRequest {
+
+ private static final long serialVersionUID = 1L;
+
+ protected Locale locale;
+
+ protected List<String> zoneList;
+
+ protected List<String> populationIndicatorList;
+
+ protected List<String> communityIndicatorList;
+
+ protected List<DataType> extractTypeList;
+
+ @Override
+ public Locale getLocale() {
+ return locale;
+ }
+
+ @Override
+ public void setLocale(Locale locale) {
+ Preconditions.checkNotNull(locale);
+ this.locale = locale;
+ }
+
+ @Override
+ public boolean isFilled() {
+ return !(locale == null ||
+ CollectionUtils.isEmpty(extractTypeList) ||
+ CollectionUtils.isEmpty(zoneList) ||
+ CollectionUtils.isEmpty(populationIndicatorList) ||
+ CollectionUtils.isEmpty(communityIndicatorList));
+ }
+
+ public List<DataType> getExtractTypeList() {
+ return extractTypeList;
+ }
+
+ public void setExtractTypeList(List<DataType> extractTypeSet) {
+ Preconditions.checkArgument(CollectionUtils.isNotEmpty(extractTypeSet));
+ this.extractTypeList = extractTypeSet;
+ }
+
+ public List<String> getZoneList() {
+ return zoneList;
+ }
+
+ public void setZoneList(List<String> zoneList) {
+ Preconditions.checkArgument(CollectionUtils.isNotEmpty(zoneList));
+ this.zoneList = zoneList;
+ }
+
+ public List<String> getPopulationIndicatorList() {
+ return populationIndicatorList;
+ }
+
+ public void setPopulationIndicatorList(List<String> populationIndicatorList) {
+ Preconditions.checkArgument(CollectionUtils.isNotEmpty(populationIndicatorList));
+ this.populationIndicatorList = populationIndicatorList;
+ }
+
+ public List<String> getCommunityIndicatorList() {
+ return communityIndicatorList;
+ }
+
+ public void setCommunityIndicatorList(List<String> communityIndicatorList) {
+ Preconditions.checkArgument(CollectionUtils.isNotEmpty(communityIndicatorList));
+ this.communityIndicatorList = communityIndicatorList;
+ }
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetIndicatorsForExtractRawDataAndResultsRequest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetIndicatorsForPopulationIndicatorResultRequest.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetIndicatorsForPopulationIndicatorResultRequest.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetIndicatorsForPopulationIndicatorResultRequest.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,100 @@
+package fr.ifremer.coser.result.request;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import fr.ifremer.coser.result.CoserRequest;
+
+import java.util.Locale;
+
+/**
+ * Request to obtain community indicator results.
+ * <p/>
+ * Created on 3/4/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class GetIndicatorsForPopulationIndicatorResultRequest implements CoserRequest, CoserRequestFacadeAware, CoserRequestZoneAware , CoserRequestSpeciesAware{
+
+ private static final long serialVersionUID = 1L;
+
+ protected Locale locale;
+
+ protected String facade;
+
+ protected String zone;
+ protected String species;
+
+ @Override
+ public Locale getLocale() {
+ return locale;
+ }
+
+ @Override
+ public void setLocale(Locale locale) {
+ Preconditions.checkNotNull(locale);
+ this.locale = locale;
+ }
+
+ @Override
+ public boolean isFilled() {
+ return !(locale == null ||
+ facade == null ||
+ zone == null ||
+ species==null);
+ }
+
+ @Override
+ public String getFacade() {
+ return facade;
+ }
+
+ @Override
+ public void setFacade(String facade) {
+ Preconditions.checkNotNull(facade);
+ this.facade = facade;
+ }
+
+ @Override
+ public String getZone() {
+ return zone;
+ }
+
+ @Override
+ public void setZone(String zone) {
+ Preconditions.checkNotNull(zone);
+ this.zone = zone;
+ }
+
+ @Override
+ public String getSpecies() {
+ return species;
+ }
+
+ @Override
+ public void setSpecies(String species) {
+ Preconditions.checkNotNull(species);
+ this.species = species;
+ }
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetIndicatorsForPopulationIndicatorResultRequest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Copied: trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetMapResultRequest.java (from rev 1134, trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/MapRequest.java)
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetMapResultRequest.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetMapResultRequest.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,105 @@
+package fr.ifremer.coser.result.request;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import fr.ifremer.coser.result.CoserRequest;
+
+import java.util.Locale;
+
+/**
+ * Request to obtain map results.
+ * <p/>
+ * Created on 3/4/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class GetMapResultRequest implements CoserRequest, CoserRequestFacadeAware, CoserRequestZoneAware, CoserRequestSpeciesAware {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Used to have map with no species, we prefer to keep a not null value
+ * to still make request consistent.
+ */
+ public static final String NULL_SPECIES = "Repartition-stations";
+
+ protected Locale locale;
+
+ protected String facade;
+
+ protected String zone;
+
+ protected String species;
+
+ @Override
+ public boolean isFilled() {
+ return !(locale == null || facade == null || zone == null && species == null);
+ }
+
+ @Override
+ public Locale getLocale() {
+ return locale;
+ }
+
+ @Override
+ public void setLocale(Locale locale) {
+ Preconditions.checkNotNull(locale);
+ this.locale = locale;
+ }
+
+ @Override
+ public String getFacade() {
+ return facade;
+ }
+
+ @Override
+ public void setFacade(String facade) {
+ Preconditions.checkNotNull(facade);
+ this.facade = facade;
+ }
+
+ @Override
+ public String getZone() {
+ return zone;
+ }
+
+ @Override
+ public void setZone(String zone) {
+ Preconditions.checkNotNull(zone);
+ this.zone = zone;
+ }
+
+ @Override
+ public String getSpecies() {
+ return species;
+ }
+
+ @Override
+ public void setSpecies(String species) {
+ Preconditions.checkNotNull(species);
+ this.species = species;
+ }
+
+}
Copied: trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetPopulationIndicatorResultRequest.java (from rev 1134, trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/PopulationIndicatorRequest.java)
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetPopulationIndicatorResultRequest.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetPopulationIndicatorResultRequest.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,56 @@
+package fr.ifremer.coser.result.request;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+
+/**
+ * Request to obtain population indicator results.
+ * <p/>
+ * Created on 3/4/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class GetPopulationIndicatorResultRequest extends AbstractGetIndicatorResultRequest {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String species;
+
+ @Override
+ public String getSpecies() {
+ return species;
+ }
+
+ @Override
+ public void setSpecies(String species) {
+ Preconditions.checkNotNull(species);
+ this.species = species;
+ }
+
+ @Override
+ public boolean isFilled() {
+ return super.isFilled() && species != null;
+ }
+}
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetSpeciesForMapResultRequest.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetSpeciesForMapResultRequest.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetSpeciesForMapResultRequest.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,86 @@
+package fr.ifremer.coser.result.request;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import fr.ifremer.coser.result.CoserRequest;
+
+import java.util.Locale;
+
+/**
+ * Request to obtain available species for map results.
+ * <p/>
+ * Created on 3/4/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class GetSpeciesForMapResultRequest implements CoserRequest, CoserRequestFacadeAware, CoserRequestZoneAware {
+
+ private static final long serialVersionUID = 1L;
+
+ protected Locale locale;
+
+ protected String facade;
+
+ protected String zone;
+
+ @Override
+ public boolean isFilled() {
+ return !(locale == null || facade == null || zone == null);
+ }
+
+ @Override
+ public Locale getLocale() {
+ return locale;
+ }
+
+ @Override
+ public void setLocale(Locale locale) {
+ Preconditions.checkNotNull(locale);
+ this.locale = locale;
+ }
+
+ @Override
+ public String getFacade() {
+ return facade;
+ }
+
+ @Override
+ public void setFacade(String facade) {
+ Preconditions.checkNotNull(facade);
+ this.facade = facade;
+ }
+
+ @Override
+ public String getZone() {
+ return zone;
+ }
+
+ @Override
+ public void setZone(String zone) {
+ Preconditions.checkNotNull(zone);
+ this.zone = zone;
+ }
+
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetSpeciesForMapResultRequest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetSpeciesForPopulationIndicatorResultRequest.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetSpeciesForPopulationIndicatorResultRequest.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetSpeciesForPopulationIndicatorResultRequest.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,88 @@
+package fr.ifremer.coser.result.request;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import fr.ifremer.coser.result.CoserRequest;
+
+import java.util.Locale;
+
+/**
+ * Request to obtain community indicator results.
+ * <p/>
+ * Created on 3/4/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class GetSpeciesForPopulationIndicatorResultRequest implements CoserRequest, CoserRequestFacadeAware, CoserRequestZoneAware {
+
+ private static final long serialVersionUID = 1L;
+
+ protected Locale locale;
+
+ protected String facade;
+
+ protected String zone;
+
+ @Override
+ public Locale getLocale() {
+ return locale;
+ }
+
+ @Override
+ public void setLocale(Locale locale) {
+ Preconditions.checkNotNull(locale);
+ this.locale = locale;
+ }
+
+ @Override
+ public boolean isFilled() {
+ return !(locale == null ||
+ facade == null ||
+ zone == null);
+ }
+
+ @Override
+ public String getFacade() {
+ return facade;
+ }
+
+ @Override
+ public void setFacade(String facade) {
+ Preconditions.checkNotNull(facade);
+ this.facade = facade;
+ }
+
+ @Override
+ public String getZone() {
+ return zone;
+ }
+
+ @Override
+ public void setZone(String zone) {
+ Preconditions.checkNotNull(zone);
+ this.zone = zone;
+ }
+
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetSpeciesForPopulationIndicatorResultRequest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetSpeciesListForCommunityIndicatorResultRequest.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetSpeciesListForCommunityIndicatorResultRequest.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetSpeciesListForCommunityIndicatorResultRequest.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,102 @@
+package fr.ifremer.coser.result.request;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import fr.ifremer.coser.result.CoserRequest;
+
+import java.util.Locale;
+
+/**
+ * Request to obtain community indicator results.
+ * <p/>
+ * Created on 3/4/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class GetSpeciesListForCommunityIndicatorResultRequest implements CoserRequest, CoserRequestFacadeAware, CoserRequestZoneAware, CoserRequestIndicatorAware {
+
+ private static final long serialVersionUID = 1L;
+
+ protected Locale locale;
+
+ protected String facade;
+
+ protected String zone;
+
+ protected String indicator;
+
+ @Override
+ public Locale getLocale() {
+ return locale;
+ }
+
+ @Override
+ public void setLocale(Locale locale) {
+ Preconditions.checkNotNull(locale);
+ this.locale = locale;
+ }
+
+ @Override
+ public boolean isFilled() {
+ return !(locale == null ||
+ facade == null ||
+ zone == null ||
+ indicator == null);
+ }
+
+ @Override
+ public String getFacade() {
+ return facade;
+ }
+
+ @Override
+ public void setFacade(String facade) {
+ Preconditions.checkNotNull(facade);
+ this.facade = facade;
+ }
+
+ @Override
+ public String getZone() {
+ return zone;
+ }
+
+ @Override
+ public void setZone(String zone) {
+ Preconditions.checkNotNull(zone);
+ this.zone = zone;
+ }
+
+ @Override
+ public String getIndicator() {
+ return indicator;
+ }
+
+ @Override
+ public void setIndicator(String indicator) {
+ Preconditions.checkNotNull(indicator);
+ this.indicator = indicator;
+ }
+
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetSpeciesListForCommunityIndicatorResultRequest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetSpeciesListForExtractRawDataAndResultsRequest.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetSpeciesListForExtractRawDataAndResultsRequest.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetSpeciesListForExtractRawDataAndResultsRequest.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,86 @@
+package fr.ifremer.coser.result.request;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import fr.ifremer.coser.result.CoserRequest;
+import fr.ifremer.coser.util.DataType;
+import org.apache.commons.collections4.CollectionUtils;
+
+import java.util.List;
+import java.util.Locale;
+
+/**
+ * Request to extract data.
+ * <p/>
+ * Created on 3/9/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class GetSpeciesListForExtractRawDataAndResultsRequest implements CoserRequest {
+
+ private static final long serialVersionUID = 1L;
+
+ protected Locale locale;
+
+ protected List<String> zoneList;
+
+ protected List<DataType> extractTypeList;
+
+ @Override
+ public Locale getLocale() {
+ return locale;
+ }
+
+ @Override
+ public void setLocale(Locale locale) {
+ Preconditions.checkNotNull(locale);
+ this.locale = locale;
+ }
+
+ @Override
+ public boolean isFilled() {
+ return !(locale == null ||
+ CollectionUtils.isEmpty(extractTypeList) ||
+ CollectionUtils.isEmpty(zoneList));
+ }
+
+ public List<DataType> getExtractTypeList() {
+ return extractTypeList;
+ }
+
+ public void setExtractTypeList(List<DataType> extractTypeSet) {
+ Preconditions.checkArgument(CollectionUtils.isNotEmpty(extractTypeSet));
+ this.extractTypeList = extractTypeSet;
+ }
+
+ public List<String> getZoneList() {
+ return zoneList;
+ }
+
+ public void setZoneList(List<String> zoneList) {
+ Preconditions.checkArgument(CollectionUtils.isNotEmpty(zoneList));
+ this.zoneList = zoneList;
+ }
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetSpeciesListForExtractRawDataAndResultsRequest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetZonesForCommunityIndicatorResultRequest.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetZonesForCommunityIndicatorResultRequest.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetZonesForCommunityIndicatorResultRequest.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,72 @@
+package fr.ifremer.coser.result.request;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import fr.ifremer.coser.result.CoserRequest;
+
+import java.util.Locale;
+
+/**
+ * Request to obtain available zones for community indicator results.
+ * <p/>
+ * Created on 3/4/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class GetZonesForCommunityIndicatorResultRequest implements CoserRequest, CoserRequestFacadeAware {
+
+ private static final long serialVersionUID = 1L;
+
+ protected Locale locale;
+
+ protected String facade;
+
+ @Override
+ public boolean isFilled() {
+ return !(locale == null || facade == null);
+ }
+
+ @Override
+ public Locale getLocale() {
+ return locale;
+ }
+
+ @Override
+ public void setLocale(Locale locale) {
+ Preconditions.checkNotNull(locale);
+ this.locale = locale;
+ }
+
+ @Override
+ public String getFacade() {
+ return facade;
+ }
+
+ @Override
+ public void setFacade(String facade) {
+ Preconditions.checkNotNull(facade);
+ this.facade = facade;
+ }
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetZonesForCommunityIndicatorResultRequest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetZonesForExtractRawDataAndResultsRequest.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetZonesForExtractRawDataAndResultsRequest.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetZonesForExtractRawDataAndResultsRequest.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,73 @@
+package fr.ifremer.coser.result.request;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import fr.ifremer.coser.result.CoserRequest;
+import org.apache.commons.collections4.CollectionUtils;
+
+import java.util.List;
+import java.util.Locale;
+
+/**
+ * Request to extract data.
+ * <p/>
+ * Created on 3/9/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class GetZonesForExtractRawDataAndResultsRequest implements CoserRequest {
+
+ private static final long serialVersionUID = 1L;
+
+ protected Locale locale;
+
+ protected List<String> zoneList;
+
+ @Override
+ public Locale getLocale() {
+ return locale;
+ }
+
+ @Override
+ public void setLocale(Locale locale) {
+ Preconditions.checkNotNull(locale);
+ this.locale = locale;
+ }
+
+ @Override
+ public boolean isFilled() {
+ return !(locale == null || CollectionUtils.isEmpty(zoneList));
+ }
+
+ public List<String> getZoneList() {
+ return zoneList;
+ }
+
+ public void setZoneList(List<String> zoneList) {
+ Preconditions.checkArgument(CollectionUtils.isNotEmpty(zoneList));
+ this.zoneList = zoneList;
+ }
+
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetZonesForExtractRawDataAndResultsRequest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetZonesForExtractRawDataRequest.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetZonesForExtractRawDataRequest.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetZonesForExtractRawDataRequest.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,72 @@
+package fr.ifremer.coser.result.request;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import fr.ifremer.coser.result.CoserRequest;
+
+import java.util.Locale;
+
+/**
+ * Request to obtain raw data results.
+ * <p/>
+ * Created on 3/4/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class GetZonesForExtractRawDataRequest implements CoserRequest, CoserRequestFacadeAware {
+
+ private static final long serialVersionUID = 1L;
+
+ protected Locale locale;
+
+ protected String facade;
+
+ @Override
+ public Locale getLocale() {
+ return locale;
+ }
+
+ @Override
+ public void setLocale(Locale locale) {
+ Preconditions.checkNotNull(locale);
+ this.locale = locale;
+ }
+
+ @Override
+ public boolean isFilled() {
+ return !(locale == null || facade == null);
+ }
+
+ @Override
+ public String getFacade() {
+ return facade;
+ }
+
+ @Override
+ public void setFacade(String facade) {
+ Preconditions.checkNotNull(facade);
+ this.facade = facade;
+ }
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetZonesForExtractRawDataRequest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetZonesForMapResultRequest.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetZonesForMapResultRequest.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetZonesForMapResultRequest.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,73 @@
+package fr.ifremer.coser.result.request;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import fr.ifremer.coser.result.CoserRequest;
+
+import java.util.Locale;
+
+/**
+ * Request to obtain available zones for map results.
+ * <p/>
+ * Created on 3/4/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class GetZonesForMapResultRequest implements CoserRequest, CoserRequestFacadeAware {
+
+ private static final long serialVersionUID = 1L;
+
+ protected Locale locale;
+
+ protected String facade;
+
+ @Override
+ public boolean isFilled() {
+ return !(locale == null || facade == null);
+ }
+
+ @Override
+ public Locale getLocale() {
+ return locale;
+ }
+
+ @Override
+ public void setLocale(Locale locale) {
+ Preconditions.checkNotNull(locale);
+ this.locale = locale;
+ }
+
+ @Override
+ public String getFacade() {
+ return facade;
+ }
+
+ @Override
+ public void setFacade(String facade) {
+ Preconditions.checkNotNull(facade);
+ this.facade = facade;
+ }
+
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetZonesForMapResultRequest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetZonesForPopulationIndicatorResultRequest.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetZonesForPopulationIndicatorResultRequest.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetZonesForPopulationIndicatorResultRequest.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,72 @@
+package fr.ifremer.coser.result.request;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import fr.ifremer.coser.result.CoserRequest;
+
+import java.util.Locale;
+
+/**
+ * Request to obtain available zones for community indicator results.
+ * <p/>
+ * Created on 3/4/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class GetZonesForPopulationIndicatorResultRequest implements CoserRequest, CoserRequestFacadeAware {
+
+ private static final long serialVersionUID = 1L;
+
+ protected Locale locale;
+
+ protected String facade;
+
+ @Override
+ public boolean isFilled() {
+ return !(locale == null || facade == null);
+ }
+
+ @Override
+ public Locale getLocale() {
+ return locale;
+ }
+
+ @Override
+ public void setLocale(Locale locale) {
+ Preconditions.checkNotNull(locale);
+ this.locale = locale;
+ }
+
+ @Override
+ public String getFacade() {
+ return facade;
+ }
+
+ @Override
+ public void setFacade(String facade) {
+ Preconditions.checkNotNull(facade);
+ this.facade = facade;
+ }
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/GetZonesForPopulationIndicatorResultRequest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Deleted: trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/IndicatorRequest.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/IndicatorRequest.java 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/IndicatorRequest.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -1,116 +0,0 @@
-package fr.ifremer.coser.result.request;
-
-/*
- * #%L
- * Coser :: Business
- * %%
- * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>.
- * #L%
- */
-
-import com.google.common.base.Preconditions;
-import fr.ifremer.coser.result.CoserRequest;
-
-import java.util.Locale;
-
-/**
- * Request to obtain indicator results.
- * <p/>
- * Created on 3/4/14.
- *
- * @author Tony Chemit <chemit(a)codelutin.com>
- * @since 1.5
- */
-public abstract class IndicatorRequest implements CoserRequest, CoserRequestFacadeAware, CoserRequestZoneAware, CoserRequestSpeciesAware {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * Type of result.
- */
- public enum ResultType {
- DATA,
- GRAPH
- }
-
- protected Locale locale;
-
- protected String facade;
-
- protected String zone;
-
- protected String indicator;
-
- protected ResultType resultType;
-
- @Override
- public Locale getLocale() {
- return locale;
- }
-
- @Override
- public void setLocale(Locale locale) {
- Preconditions.checkNotNull(locale);
- this.locale = locale;
- }
-
- @Override
- public boolean isFilled() {
- return !(locale == null || facade == null || zone == null || resultType == null || indicator == null);
- }
-
- @Override
- public String getFacade() {
- return facade;
- }
-
- @Override
- public void setFacade(String facade) {
- Preconditions.checkNotNull(facade);
- this.facade = facade;
- }
-
- @Override
- public String getZone() {
- return zone;
- }
-
- @Override
- public void setZone(String zone) {
- Preconditions.checkNotNull(zone);
- this.zone = zone;
- }
-
- public ResultType getResultType() {
- return resultType;
- }
-
- public void setResultType(ResultType resultType) {
- Preconditions.checkNotNull(resultType);
- this.resultType = resultType;
- }
-
- public String getIndicator() {
- return indicator;
- }
-
- public void setIndicator(String indicator) {
- Preconditions.checkNotNull(indicator);
- this.indicator = indicator;
- }
-
-}
Deleted: trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/MapRequest.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/MapRequest.java 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/MapRequest.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -1,105 +0,0 @@
-package fr.ifremer.coser.result.request;
-
-/*
- * #%L
- * Coser :: Business
- * %%
- * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>.
- * #L%
- */
-
-import com.google.common.base.Preconditions;
-import fr.ifremer.coser.result.CoserRequest;
-
-import java.util.Locale;
-
-/**
- * Request to obtain map results.
- * <p/>
- * Created on 3/4/14.
- *
- * @author Tony Chemit <chemit(a)codelutin.com>
- * @since 1.5
- */
-public class MapRequest implements CoserRequest, CoserRequestFacadeAware, CoserRequestZoneAware, CoserRequestSpeciesAware {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * Used to have map with no species, we prefer to keep a not null value
- * to still make request consistent.
- */
- public static final String NULL_SPECIES = "Repartition-stations";
-
- protected Locale locale;
-
- protected String facade;
-
- protected String zone;
-
- protected String species;
-
- @Override
- public boolean isFilled() {
- return !(locale == null || facade == null || zone == null && species == null);
- }
-
- @Override
- public Locale getLocale() {
- return locale;
- }
-
- @Override
- public void setLocale(Locale locale) {
- Preconditions.checkNotNull(locale);
- this.locale = locale;
- }
-
- @Override
- public String getFacade() {
- return facade;
- }
-
- @Override
- public void setFacade(String facade) {
- Preconditions.checkNotNull(facade);
- this.facade = facade;
- }
-
- @Override
- public String getZone() {
- return zone;
- }
-
- @Override
- public void setZone(String zone) {
- Preconditions.checkNotNull(zone);
- this.zone = zone;
- }
-
- @Override
- public String getSpecies() {
- return species;
- }
-
- @Override
- public void setSpecies(String species) {
- Preconditions.checkNotNull(species);
- this.species = species;
- }
-
-}
Deleted: trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/PopulationIndicatorRequest.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/PopulationIndicatorRequest.java 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/PopulationIndicatorRequest.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -1,56 +0,0 @@
-package fr.ifremer.coser.result.request;
-
-/*
- * #%L
- * Coser :: Business
- * %%
- * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>.
- * #L%
- */
-
-import com.google.common.base.Preconditions;
-
-/**
- * Request to obtain population indicator results.
- * <p/>
- * Created on 3/4/14.
- *
- * @author Tony Chemit <chemit(a)codelutin.com>
- * @since 1.5
- */
-public class PopulationIndicatorRequest extends IndicatorRequest {
-
- private static final long serialVersionUID = 1L;
-
- protected String species;
-
- @Override
- public String getSpecies() {
- return species;
- }
-
- @Override
- public void setSpecies(String species) {
- Preconditions.checkNotNull(facade);
- this.species = species;
- }
-
- @Override
- public boolean isFilled() {
- return super.isFilled() && species != null;
- }
-}
Deleted: trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/RawDataRequest.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/RawDataRequest.java 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/RawDataRequest.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -1,85 +0,0 @@
-package fr.ifremer.coser.result.request;
-
-/*
- * #%L
- * Coser :: Business
- * %%
- * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>.
- * #L%
- */
-
-import com.google.common.base.Preconditions;
-import fr.ifremer.coser.result.CoserRequest;
-
-import java.util.Locale;
-
-/**
- * Request to obtain raw data results.
- * <p/>
- * Created on 3/4/14.
- *
- * @author Tony Chemit <chemit(a)codelutin.com>
- * @since 1.5
- */
-public class RawDataRequest implements CoserRequest, CoserRequestFacadeAware, CoserRequestZoneAware {
-
- private static final long serialVersionUID = 1L;
-
- protected Locale locale;
-
- protected String facade;
-
- protected String zone;
-
- @Override
- public Locale getLocale() {
- return locale;
- }
-
- @Override
- public void setLocale(Locale locale) {
- Preconditions.checkNotNull(locale);
- this.locale = locale;
- }
-
- @Override
- public boolean isFilled() {
- return !(locale == null || facade == null || zone == null);
- }
-
- @Override
- public String getFacade() {
- return facade;
- }
-
- @Override
- public void setFacade(String facade) {
- Preconditions.checkNotNull(facade);
- this.facade = facade;
- }
-
- @Override
- public String getZone() {
- return zone;
- }
-
- @Override
- public void setZone(String zone) {
- Preconditions.checkNotNull(zone);
- this.zone = zone;
- }
-}
Added: trunk/coser-business/src/main/resources/META-INF/services/fr.ifremer.coser.result.repository.ResultRepositoryType
===================================================================
--- trunk/coser-business/src/main/resources/META-INF/services/fr.ifremer.coser.result.repository.ResultRepositoryType (rev 0)
+++ trunk/coser-business/src/main/resources/META-INF/services/fr.ifremer.coser.result.repository.ResultRepositoryType 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,2 @@
+fr.ifremer.coser.result.repository.echobase.EchoBaseResultRepositoryType
+fr.ifremer.coser.result.repository.legacy.LegacyResultRepositoryType
\ No newline at end of file
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 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-business/src/main/resources/i18n/coser-business_en_GB.properties 2014-03-12 17:35:43 UTC (rev 1145)
@@ -143,6 +143,8 @@
coser.business.publication.selectionchoices=Selection choices
coser.business.publication.selectionlogexporttitle=Selection report for %s (project %s)
coser.business.publication.stratafilename=Strata file name
+coser.business.result.repository.type.echobase=EchoBase results
+coser.business.result.repository.type.legacy=RSufi results
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 \!
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 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-business/src/main/resources/i18n/coser-business_fr_FR.properties 2014-03-12 17:35:43 UTC (rev 1145)
@@ -143,6 +143,8 @@
coser.business.publication.selectionchoices=Choix de sélections
coser.business.publication.selectionlogexporttitle=Rapport de la sélection %s (projet %s)
coser.business.publication.stratafilename=Nom du fichier strates
+coser.business.result.repository.type.echobase=Résultats EchoBase
+coser.business.result.repository.type.legacy=Résultats RSufi
coser.business.result.rsufiResultAlreadyExists=Le résultat %s existe déjà \!
coser.business.resultupload.duplicatedresult=Le résultat %s/%s/%s duplique un autre résultat pour la zone %s \!
coser.business.selection.notValidatedControl=Contrôle non validé \!
Modified: trunk/coser-business/src/test/java/fr/ifremer/coser/result/repository/echobase/EchoBaseResultRepositoryTest.java
===================================================================
--- trunk/coser-business/src/test/java/fr/ifremer/coser/result/repository/echobase/EchoBaseResultRepositoryTest.java 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-business/src/test/java/fr/ifremer/coser/result/repository/echobase/EchoBaseResultRepositoryTest.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -22,9 +22,10 @@
* #L%
*/
-import fr.ifremer.coser.result.request.CommunityIndicatorRequest;
-import fr.ifremer.coser.result.request.MapRequest;
-import fr.ifremer.coser.result.request.PopulationIndicatorRequest;
+import fr.ifremer.coser.result.repository.ResultRepositoryCommandEngine;
+import fr.ifremer.coser.result.request.GetZonesForCommunityIndicatorResultRequest;
+import fr.ifremer.coser.result.request.GetZonesForMapResultRequest;
+import fr.ifremer.coser.result.request.GetZonesForPopulationIndicatorResultRequest;
import fr.ifremer.coser.services.CoserTestAbstract;
import org.junit.Assert;
import org.junit.Assume;
@@ -44,9 +45,9 @@
*/
public class EchoBaseResultRepositoryTest extends CoserTestAbstract {
- protected EchoBaseResultRepository repository1;
+ protected ResultRepositoryCommandEngine repository1;
- protected EchoBaseResultRepository repository2;
+ protected ResultRepositoryCommandEngine repository2;
@Override
public void initProjectDatabase() throws IOException {
@@ -60,9 +61,9 @@
for (EchoBaseResultRepository repository : repositories) {
String projectName = repository.project.getName();
if ("project1".equals(projectName)) {
- repository1 = repository;
+ repository1 = repositoryProvider.newEngine(repository);
} else if ("project2".equals(projectName)) {
- repository2 = repository;
+ repository2 = repositoryProvider.newEngine(repository);
}
}
Assume.assumeTrue("Could not find repository named *project1*", repository1 != null);
@@ -74,13 +75,14 @@
// Map request
- MapRequest mapRequest = new MapRequest();
+ GetZonesForMapResultRequest mapRequest = new GetZonesForMapResultRequest();
mapRequest.setLocale(Locale.FRANCE);
mapRequest.setFacade("atlantique");
Map<String, String> availableZones;
- availableZones = repository1.getAvailableZones(mapRequest);
+ Assert.assertTrue(repository1.acceptRequest(mapRequest));
+ availableZones = (Map<String, String>) repository1.executeRequest(mapRequest).getResult();
Assert.assertNotNull(availableZones);
Assert.assertEquals(1, availableZones.size());
Assert.assertTrue(availableZones.containsKey("gdgciem8"));
@@ -88,21 +90,24 @@
// pas de zones pour la facade
mapRequest.setFacade("mediteranee");
- availableZones = repository1.getAvailableZones(mapRequest);
- Assert.assertNull(availableZones);
+ Assert.assertFalse(repository1.acceptRequest(mapRequest));
+// availableZones = (Map<String, String>) repository1.executeRequest(mapRequest).getResult();
+// Assert.assertNull(availableZones);
// facade inconnue
mapRequest.setFacade("mediteranee2");
- availableZones = repository1.getAvailableZones(mapRequest);
- Assert.assertNull(availableZones);
+ Assert.assertFalse(repository1.acceptRequest(mapRequest));
+// availableZones = (Map<String, String>) repository1.executeRequest(mapRequest).getResult();
+// Assert.assertNull(availableZones);
// Population request
- PopulationIndicatorRequest popRequest = new PopulationIndicatorRequest();
+ GetZonesForPopulationIndicatorResultRequest popRequest = new GetZonesForPopulationIndicatorResultRequest();
popRequest.setLocale(Locale.FRANCE);
popRequest.setFacade("atlantique");
- availableZones = repository1.getAvailableZones(popRequest);
+ Assert.assertTrue(repository1.acceptRequest(popRequest));
+ availableZones = (Map<String, String>) repository1.executeRequest(popRequest).getResult();
Assert.assertNotNull(availableZones);
Assert.assertEquals(1, availableZones.size());
Assert.assertTrue(availableZones.containsKey("gdgciem8"));
@@ -110,21 +115,24 @@
// pas de zones pour la facade
popRequest.setFacade("mediteranee");
- availableZones = repository1.getAvailableZones(popRequest);
- Assert.assertNull(availableZones);
+ Assert.assertFalse(repository1.acceptRequest(popRequest));
+// availableZones = (Map<String, String>) repository1.executeRequest(popRequest).getResult();
+// Assert.assertNull(availableZones);
// facade inconnue
popRequest.setFacade("mediteranee2");
- availableZones = repository1.getAvailableZones(popRequest);
- Assert.assertNull(availableZones);
+ Assert.assertFalse(repository1.acceptRequest(popRequest));
+// availableZones = (Map<String, String>) repository1.executeRequest(popRequest).getResult();
+// Assert.assertNull(availableZones);
// Community request
- CommunityIndicatorRequest comRequest = new CommunityIndicatorRequest();
+ GetZonesForCommunityIndicatorResultRequest comRequest = new GetZonesForCommunityIndicatorResultRequest();
comRequest.setLocale(Locale.FRANCE);
comRequest.setFacade("atlantique");
- availableZones = repository1.getAvailableZones(comRequest);
+ Assert.assertTrue(repository1.acceptRequest(comRequest));
+ availableZones = (Map<String, String>) repository1.executeRequest(comRequest).getResult();
Assert.assertNotNull(availableZones);
Assert.assertEquals(1, availableZones.size());
Assert.assertTrue(availableZones.containsKey("gdgciem8"));
@@ -132,13 +140,15 @@
// pas de zones pour la facade
comRequest.setFacade("mediteranee");
- availableZones = repository1.getAvailableZones(comRequest);
- Assert.assertNull(availableZones);
+ Assert.assertFalse(repository1.acceptRequest(comRequest));
+// availableZones = (Map<String, String>) repository1.executeRequest(comRequest).getResult();
+// Assert.assertNull(availableZones);
// facade inconnue
comRequest.setFacade("mediteranee2");
- availableZones = repository1.getAvailableZones(comRequest);
- Assert.assertNull(availableZones);
+ Assert.assertFalse(repository1.acceptRequest(comRequest));
+// availableZones = (Map<String, String>) repository1.executeRequest(comRequest).getResult();
+// Assert.assertNull(availableZones);
}
}
Modified: trunk/coser-web/src/main/java/fr/ifremer/coser/web/CoserApplicationContext.java
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/CoserApplicationContext.java 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/CoserApplicationContext.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -24,6 +24,8 @@
import com.google.common.base.Preconditions;
import fr.ifremer.coser.CoserServiceContext;
import fr.ifremer.coser.DefaultCoserServiceContext;
+import fr.ifremer.coser.bean.IndicatorMap;
+import fr.ifremer.coser.bean.ZoneMap;
import fr.ifremer.coser.result.CoserResultEngine;
import fr.ifremer.coser.services.WebService;
import org.nuiton.config.ArgumentsParserException;
@@ -59,7 +61,7 @@
/**
* Business layer context.
*/
- protected CoserServiceContext businessContext;
+ protected CoserServiceContext serviceContext;
/**
* Web config.
@@ -73,7 +75,10 @@
public CoserApplicationContext() {
- I18n.init(new DefaultI18nInitializer("coser-i18n"), null);
+ DefaultI18nInitializer i18nInitializer = new DefaultI18nInitializer("coser-i18n");
+ // To see on screen none translated sentences
+ i18nInitializer.setMissingKeyReturnNull(true);
+ I18n.init(i18nInitializer, null);
config = new CoserWebConfig();
@@ -83,10 +88,10 @@
throw new CoserWebException("Can't read configuration", ex);
}
- businessContext = new DefaultCoserServiceContext(config);
+ serviceContext = new DefaultCoserServiceContext(config);
webService = new WebService(config);
- resultService = new CoserResultEngine(businessContext);
+ resultService = new CoserResultEngine(serviceContext);
}
public WebService getWebService() {
@@ -100,4 +105,13 @@
public CoserWebConfig getConfig() {
return config;
}
+
+ public IndicatorMap getIndicatorsMap() {
+ return serviceContext.getIndicatorsMap();
+ }
+
+ public ZoneMap getZonesMap() {
+ return serviceContext.getZonesMap();
+ }
+
}
Modified: trunk/coser-web/src/main/java/fr/ifremer/coser/web/ServiceHelper.java
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/ServiceHelper.java 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/ServiceHelper.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -22,16 +22,19 @@
*/
import com.google.common.base.Preconditions;
+import com.google.common.collect.Maps;
import fr.ifremer.coser.CoserBusinessException;
import fr.ifremer.coser.result.CoserRequest;
import fr.ifremer.coser.result.CoserResult;
import fr.ifremer.coser.result.CoserResultEngine;
import fr.ifremer.coser.result.FileResult;
+import fr.ifremer.coser.result.MapResult;
+import fr.ifremer.coser.result.repository.ResultRepositoryType;
+import fr.ifremer.coser.result.request.AbstractGetIndicatorResultRequest;
import fr.ifremer.coser.result.request.CoserRequestSpeciesAware;
import fr.ifremer.coser.result.request.CoserRequestZoneAware;
-import fr.ifremer.coser.result.request.IndicatorRequest;
+import fr.ifremer.coser.result.request.DeleteResultsRequest;
import fr.ifremer.coser.services.WebService;
-import fr.ifremer.coser.util.DataType;
import fr.ifremer.coser.web.actions.common.CoserAction;
import java.io.File;
@@ -60,25 +63,27 @@
protected final CoserWebConfig config;
+ protected final CoserApplicationContext applicationContext;
+
public ServiceHelper(CoserAction action) {
Preconditions.checkNotNull(action);
- CoserApplicationContext applicationContext = CoserApplicationContext.get();
+ this.applicationContext = CoserApplicationContext.get();
this.action = action;
this.webService = applicationContext.getWebService();
this.resultService = applicationContext.getResultService();
this.config = applicationContext.getConfig();
}
+ public Map<String, ResultRepositoryType> getRepositoryTypes() {
+ return resultService.getRepositoryTypes();
+ }
+
// --------------------------------------------------------------------- //
// --- Facade methods -------------------------------------------------- //
// --------------------------------------------------------------------- //
public Map<String, String> getFacades() {
- try {
- return webService.getFacades();
- } catch (CoserBusinessException e) {
- throw new CoserWebException("Could not obtain facades", e);
- }
+ return applicationContext.getZonesMap().getFacades();
}
public String getFacadeDisplayName(String facade) {
@@ -91,47 +96,32 @@
// --------------------------------------------------------------------- //
public Map<String, List<String>> getZoneByFacade() {
- try {
- return webService.getZoneByFacade();
- } catch (CoserBusinessException e) {
- throw new CoserWebException("Could not obtain zone by facade", e);
- }
+ return applicationContext.getZonesMap().getZoneByFacade();
}
public Map<String, String> getZonePictures() {
- try {
- return webService.getZonePictures();
- } catch (CoserBusinessException e) {
- throw new CoserWebException("Could not obtain zone pictures", e);
- }
+ return applicationContext.getZonesMap().getZonePictures();
}
public Map<String, String> getZoneMetaInfo(Locale locale) {
- try {
- return webService.getZoneMetaInfo(locale);
- } catch (CoserBusinessException e) {
- throw new CoserWebException("Could not obtain zone meta infos", e);
- }
+ return applicationContext.getZonesMap().getZoneMetaInfo(locale);
}
+ //FIXME Remove this
public Map<String, String> getAvailableZones(CoserRequest request) {
- return resultService.getAvailableZones(request);
+ return getMultipleResultAsMap(request);
}
- public Map<String, String> getZoneForFacade() {
- try {
- return webService.getZoneForFacade(null, false, false);
- } catch (CoserBusinessException e) {
- throw new CoserWebException("Could not obtain zone for facades", e);
- }
- }
+// public Map<String, String> getZoneForFacade() {
+// try {
+// return webService.getZoneForFacade(null, false, false);
+// } catch (CoserBusinessException e) {
+// throw new CoserWebException("Could not obtain zone for facades", e);
+// }
+// }
public String getZoneFullName(String zoneId) {
- try {
- return webService.getZoneFullName(zoneId);
- } catch (CoserBusinessException e) {
- throw new CoserWebException("Could not obtain zone full name", e);
- }
+ return applicationContext.getZonesMap().getZoneFullName(zoneId);
}
public String getZoneDisplayName(CoserRequestZoneAware request) {
@@ -144,6 +134,7 @@
// --- Species methods ------------------------------------------------- //
// --------------------------------------------------------------------- //
+ //FIXME Remove this
public Map<String, String> getAvailableSpecies(CoserRequest request) {
return resultService.getAvailableSpecies(request);
}
@@ -158,27 +149,28 @@
// --- Indicator methods ----------------------------------------------- //
// --------------------------------------------------------------------- //
+ //FIXME Remove this
public Map<String, String> getAvailableIndicators(CoserRequest request) {
return resultService.getAvailableIndicators(request);
}
- public Map<String, String> getIndicators(List<String> selectZones, DataType dataType) {
- try {
- return webService.getIndicators(selectZones, dataType, action.getLocale());
- } catch (CoserBusinessException e) {
- throw new CoserWebException("Could not obtain indicators", e);
- }
- }
+// public Map<String, String> getIndicators(List<String> selectZones, DataType dataType) {
+// try {
+// return webService.getIndicators(selectZones, dataType, action.getLocale());
+// } catch (CoserBusinessException e) {
+// throw new CoserWebException("Could not obtain indicators", e);
+// }
+// }
- public Map<String, String> getSpecies(List<String> selectZones) {
- try {
- return webService.getSpecies(selectZones, false);
- } catch (CoserBusinessException e) {
- throw new CoserWebException("Could not obtain species", e);
- }
- }
+// public Map<String, String> getSpecies(List<String> selectZones) {
+// try {
+// return webService.getSpecies(selectZones, false);
+// } catch (CoserBusinessException e) {
+// throw new CoserWebException("Could not obtain species", e);
+// }
+// }
- public String getIndicatorDisplayName(IndicatorRequest request) {
+ public String getIndicatorDisplayName(AbstractGetIndicatorResultRequest request) {
Map<String, String> availableIndicators = getAvailableIndicators(request);
String displayName = availableIndicators.get(request.getIndicator());
return displayName;
@@ -188,25 +180,25 @@
// --- Result methods -------------------------------------------------- //
// --------------------------------------------------------------------- //
- public Map<String, String> getIndicatorsResultsPerZone() {
- try {
- return webService.getIndicatorsResultsPerZone();
- } catch (CoserBusinessException e) {
- throw new CoserWebException("Could not get indicators results per zone", e);
- }
- }
+// public Map<String, String> getIndicatorsResultsPerZone() {
+// try {
+// return webService.getIndicatorsResultsPerZone();
+// } catch (CoserBusinessException e) {
+// throw new CoserWebException("Could not get indicators results per zone", e);
+// }
+// }
- public Map<String, String> getMapsResultsPerZone() {
- try {
- return webService.getMapsResultsPerZone();
- } catch (CoserBusinessException e) {
- throw new CoserWebException("Could not get map results per zone", e);
- }
- }
+// public Map<String, String> getMapsResultsPerZone() {
+// try {
+// return webService.getMapsResultsPerZone();
+// } catch (CoserBusinessException e) {
+// throw new CoserWebException("Could not get map results per zone", e);
+// }
+// }
public FileResult getFileResult(CoserRequest request) {
- CoserResult result = resultService.getResult(request);
+ CoserResult result = resultService.getUniqueResult(request);
if (!(result instanceof FileResult)) {
throw new CoserWebException(
@@ -216,22 +208,59 @@
return fileResult;
}
- public void deleteIndicatorsResult(List<String> indicatorsZonesId) {
- try {
- webService.deleteIndicatorsResult(indicatorsZonesId);
- } catch (CoserBusinessException e) {
- throw new CoserWebException("Could not delete indicator results", e);
+ public MapResult getMapResult(CoserRequest request) {
+
+ CoserResult result = resultService.getUniqueResult(request);
+
+ if (!(result instanceof MapResult)) {
+ throw new CoserWebException(
+ "Result should a MapResult, but was: " + result);
}
+ MapResult fileResult = (MapResult) result;
+ return fileResult;
}
- public void deleteMapsResult(List<String> mapsZonesId) {
- try {
- webService.deleteMapsResult(mapsZonesId);
- } catch (CoserBusinessException e) {
- throw new CoserWebException("Could not delete map results", e);
+ public Map<String, String> getMultipleResultAsMap(CoserRequest request) {
+
+ List<CoserResult> result = resultService.getMultipleResult(request);
+
+ Map<String, String> resultAsMap = Maps.newHashMap();
+ for (CoserResult coserResult : result) {
+ if (!(coserResult instanceof MapResult)) {
+ throw new CoserWebException(
+ "Result should a MapResult, but was: " + result);
+ }
+ Map<String, String> map = ((MapResult) coserResult).getResult();
+ resultAsMap.putAll(map);
}
+ return resultAsMap;
}
+ public void deleteResults(DeleteResultsRequest request) {
+
+ // do delete results (don't care about result)
+ resultService.getMultipleResult(request);
+
+ // reload projects
+ resultService.resetRepositories();
+ }
+
+// public void deleteIndicatorsResult(List<String> indicatorsZonesId) {
+// try {
+// webService.deleteIndicatorsResult(indicatorsZonesId);
+// } catch (CoserBusinessException e) {
+// throw new CoserWebException("Could not delete indicator results", e);
+// }
+// }
+//
+// public void deleteMapsResult(List<String> mapsZonesId) {
+// try {
+// webService.deleteMapsResult(mapsZonesId);
+// } catch (CoserBusinessException e) {
+// throw new CoserWebException("Could not delete map results", e);
+// }
+// }
+
public void registerNewUploadedResults(String login, File resultFile) {
try {
webService.registerNewUploadedResults(login, resultFile);
@@ -247,4 +276,8 @@
public CoserWebConfig getConfig() {
return config;
}
+
+ public void reloadProjects() {
+ resultService.resetRepositories();
+ }
}
Modified: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/admin/DeleteProjectsAction.java
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/admin/DeleteProjectsAction.java 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/admin/DeleteProjectsAction.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -21,8 +21,9 @@
package fr.ifremer.coser.web.actions.admin;
+import fr.ifremer.coser.result.ResultType;
+import fr.ifremer.coser.result.request.DeleteResultsRequest;
import fr.ifremer.coser.web.actions.common.CoserAction;
-import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts2.convention.annotation.InterceptorRef;
@@ -55,44 +56,73 @@
private static final Log log = LogFactory.getLog(DeleteProjectsAction.class);
/**
- * Contient les identifiants des zones dont on souhaites supprimer le
- * resultat conrespondant dans le stockage indicateur.
+ * Type of result repository.
*/
- protected List<String> indicatorsZonesId;
+ protected String repositoryType;
/**
- * Contient les identifiants des zones dont on souhaites supprimer le
- * resultat conrespondant dans le stockage cartes.
+ * Type of result to delete.
*/
- protected List<String> mapsZonesId;
+ protected ResultType resultType;
- public void setIndicatorsZonesId(List<String> indicatorsZonesId) {
- this.indicatorsZonesId = indicatorsZonesId;
+ /**
+ * List of result id to delete.
+ */
+ protected List<String> zonesId;
+
+ public void setRepositoryType(String repositoryType) {
+ this.repositoryType = repositoryType;
}
- public void setMapsZonesId(List<String> mapsZonesId) {
- this.mapsZonesId = mapsZonesId;
+ public void setResultType(ResultType resultType) {
+ this.resultType = resultType;
}
+ public void setZonesId(List<String> zonesId) {
+ this.zonesId = zonesId;
+ }
+
+ @Override
public String execute() {
- if (log.isDebugEnabled()) {
- log.debug("Delete indicators zone : " + indicatorsZonesId);
+ if (log.isInfoEnabled()) {
+ log.info(String.format("Delete zone (type %s) (repository type %s) : %s",
+ resultType,
+ repositoryType,
+ zonesId));
}
- if (CollectionUtils.isNotEmpty(indicatorsZonesId)) {
- getService().deleteIndicatorsResult(indicatorsZonesId);
- }
- if (log.isDebugEnabled()) {
- log.debug("Delete maps zone : " + mapsZonesId);
- }
- if (CollectionUtils.isNotEmpty(mapsZonesId)) {
- getService().deleteMapsResult(mapsZonesId);
- }
+ DeleteResultsRequest request = requestBuilder().
+ addResultRepositoryType(repositoryType).
+ addResultType(resultType).
+ addZoneList(zonesId).
+ toDeleteResultsRequest();
+ getService().deleteResults(request);
+
return SUCCESS;
}
+// /**
+// * Contient les identifiants des zones dont on souhaite supprimer le
+// * resultat conrespondant dans le stockage indicateur.
+// */
+// protected List<String> indicatorsZonesId;
+//
+// /**
+// * Contient les identifiants des zones dont on souhaites supprimer le
+// * resultat conrespondant dans le stockage cartes.
+// */
+// protected List<String> mapsZonesId;
+//
+// public void setIndicatorsZonesId(List<String> indicatorsZonesId) {
+// this.indicatorsZonesId = indicatorsZonesId;
+// }
+//
+// public void setMapsZonesId(List<String> mapsZonesId) {
+// this.mapsZonesId = mapsZonesId;
+// }
+//
// public String execute() {
// WebService webService = ServiceFactory.getWebService();
//
Modified: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/admin/ListProjectsAction.java
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/admin/ListProjectsAction.java 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/admin/ListProjectsAction.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -21,13 +21,21 @@
package fr.ifremer.coser.web.actions.admin;
+import com.google.common.collect.Maps;
+import fr.ifremer.coser.result.ResultType;
+import fr.ifremer.coser.result.repository.ResultRepositoryType;
+import fr.ifremer.coser.result.request.GetAllResultsRequest;
+import fr.ifremer.coser.web.CoserWebException;
import fr.ifremer.coser.web.actions.common.CoserAction;
+import org.apache.commons.collections4.MapUtils;
+import org.apache.commons.lang3.StringUtils;
import org.apache.struts2.convention.annotation.InterceptorRef;
import org.apache.struts2.convention.annotation.InterceptorRefs;
import org.apache.struts2.convention.annotation.ParentPackage;
import java.util.List;
import java.util.Map;
+import java.util.Set;
/**
* Project list action.
@@ -48,12 +56,34 @@
/** serialVersionUID. */
private static final long serialVersionUID = 6024588562104111883L;
+ // All types of result repository
+ protected Map<String, ResultRepositoryType> repositoryTypes;
+
+ // Selected result repository type
+ protected String selectedRepositoryType;
+
protected Map<String, String> facades;
+
protected Map<String, List<String>> zonesByFacades;
+ protected Map<ResultType, Map<String, String>> results;
+
protected Map<String, String> indicatorsResults;
+
protected Map<String, String> mapsResults;
+ public Map<String, ResultRepositoryType> getRepositoryTypes() {
+ return repositoryTypes;
+ }
+
+ public String getSelectedRepositoryType() {
+ return selectedRepositoryType;
+ }
+
+ public void setSelectedRepositoryType(String selectedRepositoryType) {
+ this.selectedRepositoryType = selectedRepositoryType;
+ }
+
public Map<String, String> getFacades() {
return facades;
}
@@ -62,28 +92,60 @@
return zonesByFacades;
}
- public Map<String, String> getIndicatorsResults() {
- return indicatorsResults;
+ public Map<String, String> getResults(ResultType resultType) {
+ return results.get(resultType);
}
- public Map<String, String> getMapsResults() {
- return mapsResults;
- }
-
public String getZoneDisplayName(String zoneId) {
return getService().getZoneFullName(zoneId);
}
+ @Override
public String execute() {
+ repositoryTypes = getService().getRepositoryTypes();
+ if (MapUtils.isEmpty(repositoryTypes)) {
+ throw new CoserWebException("No result repository type defined!");
+ }
+
+ if (StringUtils.isEmpty(selectedRepositoryType)) {
+
+ // use first value
+ ResultRepositoryType repositoryType = repositoryTypes.values().iterator().next();
+ selectedRepositoryType = repositoryType.getId();
+ }
+
facades = getService().getFacades();
zonesByFacades = getService().getZoneByFacade();
- indicatorsResults = getService().getIndicatorsResultsPerZone();
- mapsResults = getService().getMapsResultsPerZone();
+ GetAllResultsRequest request = requestBuilder().
+ addResultRepositoryType(getSelectedRepositoryType()).
+ toGetAllResultsRequest();
+
+ results = Maps.newEnumMap(ResultType.class);
+ if (selectedRepositoryType != null) {
+ ResultRepositoryType repositoryType = repositoryTypes.get(selectedRepositoryType);
+ Set<ResultType> resultTypes = repositoryType.getResultTypes();
+ for (ResultType resultType : resultTypes) {
+
+ // get projects for this type
+ request.setResultType(resultType);
+ Map<String, String> resultsForType = getService().getMultipleResultAsMap(request);
+ results.put(resultType, resultsForType);
+ }
+ }
+
return SUCCESS;
}
+// public Map<String, String> getIndicatorsResults() {
+// return indicatorsResults;
+// }
+//
+// public Map<String, String> getMapsResults() {
+// return mapsResults;
+// }
+//
// public String getZoneDisplayName(String zoneId) {
// WebService webService = ServiceFactory.getWebService();
// String zoneDisplayName = null;
Modified: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/admin/PerformLoginAction.java
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/admin/PerformLoginAction.java 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/admin/PerformLoginAction.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -22,7 +22,6 @@
package fr.ifremer.coser.web.actions.admin;
import fr.ifremer.coser.web.CoserWebConfig;
-import fr.ifremer.coser.web.ServiceFactory;
import fr.ifremer.coser.web.actions.common.CoserAction;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.interceptor.SessionAware;
@@ -59,9 +58,6 @@
this.password = password;
}
- /*
- * @see org.apache.struts2.interceptor.SessionAware#setSession(java.util.Map)
- */
@Override
public void setSession(Map<String, Object> session) {
this.session = session;
Added: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/admin/ReloadProjectsAction.java
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/admin/ReloadProjectsAction.java (rev 0)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/admin/ReloadProjectsAction.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -0,0 +1,53 @@
+package fr.ifremer.coser.web.actions.admin;
+
+/*
+ * #%L
+ * Coser :: Web
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+import fr.ifremer.coser.web.actions.common.CoserAction;
+import org.apache.struts2.convention.annotation.InterceptorRef;
+import org.apache.struts2.convention.annotation.InterceptorRefs;
+import org.apache.struts2.convention.annotation.ParentPackage;
+import org.apache.struts2.convention.annotation.Result;
+
+/**
+ * To reload all projects from disk configuration.
+ * <p/>
+ * Created on 3/12/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+@ParentPackage("admin")
+@InterceptorRefs({
+ @InterceptorRef("loginInterceptor"),
+ @InterceptorRef("defaultStack")
+ })
+@Result(name = "success", type = "redirect", location = "list-projects")
+public class ReloadProjectsAction extends CoserAction {
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public String execute() throws Exception {
+ getService().reloadProjects();
+ return SUCCESS;
+ }
+}
Property changes on: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/admin/ReloadProjectsAction.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
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 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/com/GraphAction.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -21,7 +21,8 @@
package fr.ifremer.coser.web.actions.com;
-import fr.ifremer.coser.result.request.IndicatorRequest;
+import fr.ifremer.coser.result.request.AbstractGetIndicatorResultRequest;
+import fr.ifremer.coser.result.request.GetCommunityIndicatorResultRequest;
import fr.ifremer.coser.web.actions.common.CoserAction;
import java.util.Map;
@@ -54,7 +55,7 @@
/** La liste actuellement selectionnée (cas null géré). */
protected String list;
- protected IndicatorRequest request;
+ protected AbstractGetIndicatorResultRequest request;
public String getFacade() {
return facade;
@@ -107,12 +108,12 @@
@Override
public String execute() {
- request = requestBuilder().
+ request = requestBuilder(GetCommunityIndicatorResultRequest.class).
addFacade(facade).
addZone(zone).
addIndicator(indicator).
addSpecies(list).
- toCommunityIndicatorRequest();
+ toRequest();
lists = getService().getAvailableSpecies(request);
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 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/com/GraphDataAction.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -22,7 +22,7 @@
package fr.ifremer.coser.web.actions.com;
import fr.ifremer.coser.result.FileResult;
-import fr.ifremer.coser.result.request.IndicatorRequest;
+import fr.ifremer.coser.result.request.AbstractGetIndicatorResultRequest;
import fr.ifremer.coser.web.actions.common.CoserAction;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
@@ -92,13 +92,13 @@
// @Action(results = {@Result(type = "stream", params = {"contentType", "image/png", "inputName", "inputStream"})})
@Action(results = {@Result(type = "stream", params = {"contentType", "image/png"})})
public String execute() {
- IndicatorRequest request = requestBuilder().
+ AbstractGetIndicatorResultRequest request = requestBuilder().
addFacade(facade).
addZone(zone).
addIndicator(indicator).
- addResultType(IndicatorRequest.ResultType.GRAPH).
+ addIndicatorResultType(AbstractGetIndicatorResultRequest.IndicatorResultType.GRAPH).
addSpecies(list).
- toCommunityIndicatorRequest();
+ toGetCommunityIndicatorResultRequest();
if (list == null) {
Modified: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/com/GraphDownloadAction.java
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/com/GraphDownloadAction.java 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/com/GraphDownloadAction.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -22,7 +22,7 @@
package fr.ifremer.coser.web.actions.com;
import fr.ifremer.coser.result.FileResult;
-import fr.ifremer.coser.result.request.IndicatorRequest;
+import fr.ifremer.coser.result.request.AbstractGetIndicatorResultRequest;
import fr.ifremer.coser.web.actions.common.CoserAction;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
@@ -93,13 +93,13 @@
@Action(results = {@Result(type = "stream", params = {"contentType", "application/zip", "contentDisposition", "attachment; filename=\"${filename}\""})})
public String execute() {
- IndicatorRequest request = requestBuilder().
+ AbstractGetIndicatorResultRequest request = requestBuilder().
addFacade(facade).
addZone(zone).
addIndicator(indicator).
- addResultType(IndicatorRequest.ResultType.DATA).
+ addIndicatorResultType(AbstractGetIndicatorResultRequest.IndicatorResultType.DATA).
addSpecies(list).
- toCommunityIndicatorRequest();
+ toGetCommunityIndicatorResultRequest();
if (list == null) {
Modified: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/com/IndicatorAction.java
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/com/IndicatorAction.java 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/com/IndicatorAction.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -21,7 +21,7 @@
package fr.ifremer.coser.web.actions.com;
-import fr.ifremer.coser.result.request.CommunityIndicatorRequest;
+import fr.ifremer.coser.result.request.GetCommunityIndicatorResultRequest;
import fr.ifremer.coser.web.actions.common.CommonIndicator;
/**
@@ -39,10 +39,10 @@
private static final long serialVersionUID = 1663244944108703571L;
@Override
- protected CommunityIndicatorRequest createRequest() {
- return requestBuilder().
+ protected GetCommunityIndicatorResultRequest createRequest() {
+ return requestBuilder(GetCommunityIndicatorResultRequest.class).
addFacade(facade).
addZone(zone).
- toCommunityIndicatorRequest();
+ toRequest();
}
}
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 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/com/ZoneAction.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -42,6 +42,6 @@
protected CoserRequest createRequest() {
return requestBuilder().
addFacade(facade).
- toCommunityIndicatorRequest();
+ toGetCommunityIndicatorResultRequest();
}
}
Modified: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/common/CommonIndicator.java
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/common/CommonIndicator.java 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/common/CommonIndicator.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -21,7 +21,7 @@
package fr.ifremer.coser.web.actions.common;
-import fr.ifremer.coser.result.request.IndicatorRequest;
+import fr.ifremer.coser.result.request.AbstractGetIndicatorResultRequest;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -54,9 +54,9 @@
protected Map<String, String> indicators;
- protected IndicatorRequest request;
+ protected AbstractGetIndicatorResultRequest request;
- protected abstract IndicatorRequest createRequest();
+ protected abstract AbstractGetIndicatorResultRequest createRequest();
public String getFacade() {
return facade;
Modified: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/common/CoserAction.java
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/common/CoserAction.java 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/common/CoserAction.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -21,6 +21,7 @@
package fr.ifremer.coser.web.actions.common;
+import fr.ifremer.coser.result.CoserRequest;
import fr.ifremer.coser.result.request.CoserRequestBuilder;
import fr.ifremer.coser.web.CoserWebConfig;
import fr.ifremer.coser.web.ServiceHelper;
@@ -88,17 +89,18 @@
* @return a new request builder.
* @since 1.5
*/
- protected CoserRequestBuilder requestBuilder() {
- return requestBuilder(getLocale());
+ protected <R extends CoserRequest> CoserRequestBuilder<R> requestBuilder(Class<R> requestType) {
+ return requestBuilder(getLocale(), requestType);
}
/**
- * @param locale locale to use (while using execute and wait action we keep the locale in session...)
+ * @param locale locale to use (while using execute and wait action we keep the locale in session...)
+ * @param requestType type of request to build
* @return a new request builder.
* @since 1.5
*/
- protected CoserRequestBuilder requestBuilder(Locale locale) {
- return new CoserRequestBuilder(locale);
+ protected <R extends CoserRequest> CoserRequestBuilder<R> requestBuilder(Locale locale, Class<R> requestType) {
+ return new CoserRequestBuilder<R>(locale, requestType);
}
/**
Modified: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/map/MapAction.java
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/map/MapAction.java 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/map/MapAction.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -21,7 +21,7 @@
package fr.ifremer.coser.web.actions.map;
-import fr.ifremer.coser.result.request.MapRequest;
+import fr.ifremer.coser.result.request.GetMapResultRequest;
import fr.ifremer.coser.web.actions.common.CoserAction;
/**
@@ -44,7 +44,7 @@
protected String species;
- protected MapRequest request;
+ protected GetMapResultRequest request;
public void setFacade(String facade) {
this.facade = facade;
@@ -85,11 +85,11 @@
@Override
public String execute() throws Exception {
- request = requestBuilder().
+ request = requestBuilder(GetMapResultRequest.class).
addFacade(facade).
addZone(zone).
addSpecies(species).
- toMapRequest();
+ toRequest();
return SUCCESS;
}
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 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/map/MapDataAction.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -22,7 +22,7 @@
package fr.ifremer.coser.web.actions.map;
import fr.ifremer.coser.result.FileResult;
-import fr.ifremer.coser.result.request.MapRequest;
+import fr.ifremer.coser.result.request.GetMapResultRequest;
import fr.ifremer.coser.web.actions.common.CoserAction;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -84,11 +84,11 @@
@Action(results = {@Result(type = "stream", params = {"contentType", "image/png"})})
public String execute() {
// work with null species (get Repartition-stations map)
- MapRequest request = requestBuilder().
+ GetMapResultRequest request = requestBuilder().
addFacade(facade).
addZone(zone).
- addSpecies(species == null ? MapRequest.NULL_SPECIES : species).
- toMapRequest();
+ addSpecies(species == null ? GetMapResultRequest.NULL_SPECIES : species).
+ toGetMapResultRequest();
if (log.isInfoEnabled()) {
log.info("Looking for map of species: " + request.getSpecies());
Modified: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/map/SpeciesAction.java
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/map/SpeciesAction.java 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/map/SpeciesAction.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -21,7 +21,7 @@
package fr.ifremer.coser.web.actions.map;
-import fr.ifremer.coser.result.request.MapRequest;
+import fr.ifremer.coser.result.request.GetMapResultRequest;
import fr.ifremer.coser.web.actions.common.CoserAction;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -50,7 +50,7 @@
protected Map<String, String> species;
- protected MapRequest request;
+ protected GetMapResultRequest request;
public String getFacade() {
return facade;
@@ -86,7 +86,7 @@
request = requestBuilder().
addFacade(facade).
addZone(zone).
- toMapRequest();
+ toGetMapResultRequest();
if (log.isInfoEnabled()) {
log.info("Looking for species for zone " + zone);
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 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/map/ZoneAction.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -21,7 +21,7 @@
package fr.ifremer.coser.web.actions.map;
-import fr.ifremer.coser.result.request.MapRequest;
+import fr.ifremer.coser.result.request.GetMapResultRequest;
import fr.ifremer.coser.web.actions.common.CommonZone;
/**
@@ -39,8 +39,8 @@
private static final long serialVersionUID = 3385467755357775199L;
@Override
- protected MapRequest createRequest() {
- return requestBuilder().addFacade(facade).toMapRequest();
+ protected GetMapResultRequest createRequest() {
+ return requestBuilder().addFacade(facade).toGetMapResultRequest();
}
// @Override
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 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/pop/GraphAction.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -21,7 +21,7 @@
package fr.ifremer.coser.web.actions.pop;
-import fr.ifremer.coser.result.request.PopulationIndicatorRequest;
+import fr.ifremer.coser.result.request.GetPopulationIndicatorResultRequest;
import fr.ifremer.coser.web.actions.common.CoserAction;
/**
@@ -48,7 +48,7 @@
protected String indicator;
- protected PopulationIndicatorRequest request;
+ protected GetPopulationIndicatorResultRequest request;
public String getFacade() {
return facade;
@@ -106,7 +106,7 @@
addZone(zone).
addSpecies(species).
addIndicator(indicator).
- toPopulationIndicatorRequest();
+ toGetPopulationIndicatorResultRequest();
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 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/pop/GraphDataAction.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -22,8 +22,8 @@
package fr.ifremer.coser.web.actions.pop;
import fr.ifremer.coser.result.FileResult;
-import fr.ifremer.coser.result.request.IndicatorRequest;
-import fr.ifremer.coser.result.request.PopulationIndicatorRequest;
+import fr.ifremer.coser.result.request.AbstractGetIndicatorResultRequest;
+import fr.ifremer.coser.result.request.GetPopulationIndicatorResultRequest;
import fr.ifremer.coser.web.actions.common.CoserAction;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
@@ -93,13 +93,13 @@
// @Action(results = {@Result(type = "stream", params = {"contentType", "image/png", "inputName", "inputStream"})})
@Action(results = {@Result(type = "stream", params = {"contentType", "image/png"})})
public String execute() {
- PopulationIndicatorRequest request = requestBuilder().
+ GetPopulationIndicatorResultRequest request = requestBuilder().
addFacade(facade).
addZone(zone).
addSpecies(species).
addIndicator(indicator).
- addResultType(IndicatorRequest.ResultType.GRAPH).
- toPopulationIndicatorRequest();
+ addIndicatorResultType(AbstractGetIndicatorResultRequest.IndicatorResultType.GRAPH).
+ toGetPopulationIndicatorResultRequest();
result = getService().getFileResult(request);
return SUCCESS;
}
Modified: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/pop/GraphDownloadAction.java
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/pop/GraphDownloadAction.java 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/pop/GraphDownloadAction.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -22,8 +22,8 @@
package fr.ifremer.coser.web.actions.pop;
import fr.ifremer.coser.result.FileResult;
-import fr.ifremer.coser.result.request.IndicatorRequest;
-import fr.ifremer.coser.result.request.PopulationIndicatorRequest;
+import fr.ifremer.coser.result.request.AbstractGetIndicatorResultRequest;
+import fr.ifremer.coser.result.request.GetPopulationIndicatorResultRequest;
import fr.ifremer.coser.web.actions.common.CoserAction;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
@@ -91,13 +91,13 @@
// @Action(results = {@Result(type = "stream", params = {"contentType", "text/csv", "inputName", "inputStream", "contentDisposition", "attachment; filename=\"${filename}\""})})
@Action(results = {@Result(type = "stream", params = {"contentType", "text/csv", "contentDisposition", "attachment; filename=\"${filename}\""})})
public String execute() {
- PopulationIndicatorRequest request = requestBuilder().
+ GetPopulationIndicatorResultRequest request = requestBuilder().
addFacade(facade).
addZone(zone).
addSpecies(species).
addIndicator(indicator).
- addResultType( IndicatorRequest.ResultType.DATA).
- toPopulationIndicatorRequest();
+ addIndicatorResultType(AbstractGetIndicatorResultRequest.IndicatorResultType.DATA).
+ toGetPopulationIndicatorResultRequest();
result = getService().getFileResult(request);
return SUCCESS;
}
Modified: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/pop/IndicatorAction.java
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/pop/IndicatorAction.java 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/pop/IndicatorAction.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -21,7 +21,7 @@
package fr.ifremer.coser.web.actions.pop;
-import fr.ifremer.coser.result.request.PopulationIndicatorRequest;
+import fr.ifremer.coser.result.request.GetPopulationIndicatorResultRequest;
import fr.ifremer.coser.web.actions.common.CommonIndicator;
/**
@@ -39,11 +39,11 @@
private static final long serialVersionUID = 1663244944108703571L;
@Override
- protected PopulationIndicatorRequest createRequest() {
- return requestBuilder().
+ protected GetPopulationIndicatorResultRequest createRequest() {
+ return requestBuilder(GetPopulationIndicatorResultRequest.class).
addFacade(facade).
addZone(zone).
addSpecies(species).
- toPopulationIndicatorRequest();
+ toRequest();
}
}
Modified: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/pop/SpeciesAction.java
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/pop/SpeciesAction.java 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/pop/SpeciesAction.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -21,7 +21,7 @@
package fr.ifremer.coser.web.actions.pop;
-import fr.ifremer.coser.result.request.PopulationIndicatorRequest;
+import fr.ifremer.coser.result.request.GetPopulationIndicatorResultRequest;
import fr.ifremer.coser.web.actions.common.CoserAction;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -52,7 +52,7 @@
protected String zonePicture;
- protected PopulationIndicatorRequest request;
+ protected GetPopulationIndicatorResultRequest request;
public String getFacade() {
return facade;
@@ -96,7 +96,7 @@
request = requestBuilder().
addFacade(facade).
addZone(zone).
- toPopulationIndicatorRequest();
+ toGetPopulationIndicatorResultRequest();
species = getService().getAvailableSpecies(request);
if (log.isDebugEnabled()) {
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 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/pop/ZoneAction.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -42,6 +42,6 @@
protected CoserRequest createRequest() {
return requestBuilder().
addFacade(facade).
- toPopulationIndicatorRequest();
+ toGetPopulationIndicatorResultRequest();
}
}
Modified: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/search/ExtractAction.java
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/search/ExtractAction.java 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/search/ExtractAction.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -23,7 +23,7 @@
import com.google.common.collect.Lists;
import fr.ifremer.coser.result.FileResult;
-import fr.ifremer.coser.result.request.ExtractRequest;
+import fr.ifremer.coser.result.request.ExtractRawDataAndResultsRequest;
import fr.ifremer.coser.util.DataType;
import fr.ifremer.coser.web.actions.common.CoserAction;
import org.apache.commons.collections4.CollectionUtils;
@@ -183,28 +183,28 @@
result = INPUT;
types = DataType.getExtractTypes(getLocale());
+
+ ExtractRawDataAndResultsRequest extractRawDataAndResultsRequest = requestBuilder().toExtractRawDataAndResultsRequest();
// renvoi la liste des id subzone-survey et leurs label associé
- zones = getService().getZoneForFacade();
+ zones = getService().getAvailableZones(extractRawDataAndResultsRequest);
if (CollectionUtils.isNotEmpty(selectZones)) {
- ExtractRequest extractRequest = requestBuilder().
- addZoneList(selectZones).
- toExtractRequest();
+ extractRawDataAndResultsRequest.setZoneList(selectZones);
- species = getService().getAvailableSpecies(extractRequest);
+ species = getService().getAvailableSpecies(extractRawDataAndResultsRequest);
if (selectTypes != null) {
if (selectTypes.contains(DataType.COMMUNITY)) {
- extractRequest.setExtractTypeList(Lists.newArrayList(DataType.COMMUNITY));
- comIndicators = getService().getAvailableIndicators(extractRequest);
+ extractRawDataAndResultsRequest.setExtractTypeList(Lists.newArrayList(DataType.COMMUNITY));
+ comIndicators = getService().getAvailableIndicators(extractRawDataAndResultsRequest);
}
if (selectTypes.contains(DataType.POPULATION)) {
- extractRequest.setExtractTypeList(Lists.newArrayList(DataType.POPULATION));
- popIndicators = getService().getAvailableIndicators(extractRequest);
+ extractRawDataAndResultsRequest.setExtractTypeList(Lists.newArrayList(DataType.POPULATION));
+ popIndicators = getService().getAvailableIndicators(extractRawDataAndResultsRequest);
}
}
}
@@ -270,15 +270,15 @@
Locale locale = (Locale) request.getSession().getAttribute(LOCALE_ATTRIBUTE);
- ExtractRequest extractRequest = requestBuilder(locale).
+ ExtractRawDataAndResultsRequest extractRawDataAndResultsRequest = requestBuilder(locale).
addZoneList(selectZones).
addExtractTypeList(selectTypes).
addSpeciesList(selectSpecies).
addCommunityIndicatorList(selectComIndicators).
addPopulationIndicatorList(selectPopIndicators).
- toExtractRequest();
+ toExtractRawDataAndResultsRequest();
- resultFile = getService().getFileResult(extractRequest);
+ resultFile = getService().getFileResult(extractRawDataAndResultsRequest);
return SUCCESS;
}
Modified: 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 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/source/SourceAction.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -21,7 +21,7 @@
package fr.ifremer.coser.web.actions.source;
-import fr.ifremer.coser.result.request.RawDataRequest;
+import fr.ifremer.coser.result.request.ExtractRawDataRequest;
import fr.ifremer.coser.web.actions.common.CoserAction;
import java.util.Map;
@@ -46,7 +46,7 @@
protected String zonePicture;
- protected RawDataRequest request;
+ protected ExtractRawDataRequest request;
public String getFacade() {
return facade;
@@ -83,12 +83,12 @@
return SUCCESS;
}
- protected RawDataRequest getRequest() {
+ protected ExtractRawDataRequest getRequest() {
if (request == null) {
request = requestBuilder().
addFacade(facade).
addZone(zone).
- toRawDataRequest();
+ toExtractRawDataRequest();
}
return request;
}
Modified: 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 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/source/ZoneAction.java 2014-03-12 17:35:43 UTC (rev 1145)
@@ -21,7 +21,7 @@
package fr.ifremer.coser.web.actions.source;
-import fr.ifremer.coser.result.request.RawDataRequest;
+import fr.ifremer.coser.result.request.ExtractRawDataRequest;
import fr.ifremer.coser.web.actions.common.CommonZone;
/**
@@ -39,10 +39,10 @@
private static final long serialVersionUID = 3385467755357775199L;
@Override
- protected RawDataRequest createRequest() {
+ protected ExtractRawDataRequest createRequest() {
return requestBuilder().
addFacade(facade).
- toRawDataRequest();
+ toExtractRawDataRequest();
}
// @Override
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 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-web/src/main/resources/i18n/coser-web_en_GB.properties 2014-03-12 17:35:43 UTC (rev 1145)
@@ -9,6 +9,9 @@
message.admin.listprojects.indicatorsprojects=Indicators projects by zones
message.admin.listprojects.indicatorsprojects.comment=Removing an indicator project will also delete projet data source.
message.admin.listprojects.mapsprojects=Maps projects by zones
+message.admin.listprojects.projects=Projects by zones
+message.admin.listprojects.projects.comment=Removing a project will also delete projet data source.
+message.admin.listprojects.select.resultType=Select type of project
message.admin.listprojects.title=Projects management
message.admin.login=Login
message.admin.loginrequiered=Authentication required
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 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-web/src/main/resources/i18n/coser-web_fr_FR.properties 2014-03-12 17:35:43 UTC (rev 1145)
@@ -6,9 +6,12 @@
coser.config.coserWeb.configuration.description=Configuration du site des indicateurs
message.admin.indexaction=Actions d'administration
message.admin.listprojects.deleteselected=Supprimer les projets sélectionnés
-message.admin.listprojects.indicatorsprojects=Projects d'indicateur par zones
-message.admin.listprojects.indicatorsprojects.comment=La suppression d'un projets d'indicateur supprimera également la possibilité de télécharger les données sources du projet concerné.
+message.admin.listprojects.indicatorsprojects=Projets d'indicateur par zones
+message.admin.listprojects.indicatorsprojects.comment=La suppression d'un projet d'indicateur supprimera également la possibilité de télécharger les données sources du projet concerné.
message.admin.listprojects.mapsprojects=Projects de cartes par zones
+message.admin.listprojects.projects=Projects par zones
+message.admin.listprojects.projects.comment=La suppression d'un projet supprimera également la possibilité de télécharger les données sources du projet concerné.
+message.admin.listprojects.select.resultType=Sélectionner le type de projet
message.admin.listprojects.title=Gestion des projets
message.admin.login=Identifiant
message.admin.loginrequiered=Autentification requise
Modified: trunk/coser-web/src/main/resources/log4j.properties
===================================================================
--- trunk/coser-web/src/main/resources/log4j.properties 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-web/src/main/resources/log4j.properties 2014-03-12 17:35:43 UTC (rev 1145)
@@ -29,3 +29,4 @@
# Categories
log4j.category.fr.ifremer.coser=INFO
+log4j.category.org.nuiton=INFO
Modified: trunk/coser-web/src/main/webapp/WEB-INF/content/admin/list-projects.jsp
===================================================================
--- trunk/coser-web/src/main/webapp/WEB-INF/content/admin/list-projects.jsp 2014-03-11 16:45:58 UTC (rev 1144)
+++ trunk/coser-web/src/main/webapp/WEB-INF/content/admin/list-projects.jsp 2014-03-12 17:35:43 UTC (rev 1145)
@@ -29,56 +29,112 @@
<h2><s:text name="message.admin.listprojects.title" /></h2>
- <h3><s:text name="message.admin.listprojects.indicatorsprojects" /></h3>
+ <h3><s:text name="message.admin.listprojects.select.resultType" /></h3>
- <p><s:text name="message.admin.listprojects.indicatorsprojects.comment" /></p>
-
- <form action="delete-projects" class="listprojects" method="post">
- <s:iterator value="facades">
- <div class="listprojects-facade">
- <span class="title"><s:text name="message.common.facade" /> : <s:property value='value' /></span>
- <s:iterator value="%{getZonesByFacades().get(key)}" var="zone">
- <div class="listprojects-zone">
- <span class="title"><s:text name="message.common.zone" /> : <s:property value="getZoneDisplayName(#zone)"/></span>
- <div class="listprojects-result">
- <s:if test="%{indicatorsResults.get(#zone) == null}">
- Aucun projet trouvé
- </s:if>
- <s:else>
- <input type="checkbox" name="indicatorsZonesId" value="<s:property value="zone" />" />
- <s:property value="%{indicatorsResults.get(#zone)}" />
- </s:else>
+ <s:form action="list-projects" method="get">
+ <select name="selectedRepositoryType" id="selectedRepositoryType">
+ <s:iterator value="repositoryTypes" var="repositoryType">
+ <option value="<s:property value="key" />"
+ <s:if test="#repositoryType.key.equals(selectedRepositoryType)">
+ selected="selected"
+ </s:if>>
+ <s:property value="%{getText(#repositoryType.value.labelKey)}" /></option>
+ </s:iterator>
+ </select>
+ <s:submit value="%{getText('message.common.validform')}"/>
+ </s:form>
+
+ <s:if test="selectedRepositoryType == @fr.ifremer.coser.result.repository.echobase.EchoBaseResultRepositoryType@ID">
+ <h3><s:text name="message.admin.listprojects.projects" /></h3>
+ <p><s:text name="message.admin.listprojects.projects.comment" /></p>
+
+ <form action="delete-projects" class="listprojects" method="post">
+ <s:hidden name="repositoryType" value="%{selectedRepositoryType}"/>
+ <s:hidden name="resultType" value="%{@fr.ifremer.coser.result.ResultType@MAP_AND_INDICATOR}"/>
+ <s:set name="results" value="%{getResults(@fr.ifremer.coser.result.ResultType@MAP_AND_INDICATOR)}"/>
+ <s:iterator value="facades">
+ <div class="listprojects-facade">
+ <span class="title"><s:text name="message.common.facade" /> : <s:property value='value' /></span>
+ <s:iterator value="%{getZonesByFacades().get(key)}" var="zone">
+ <div class="listprojects-zone">
+ <span class="title"><s:text name="message.common.zone" /> : <s:property value="getZoneDisplayName(#zone)"/></span>
+ <div class="listprojects-result">
+ <s:if test="%{#results.get(#zone) == null}">
+ Aucun projet trouvé
+ </s:if>
+ <s:else>
+ <input type="checkbox" name="zonesId" value="<s:property value="zone" />" />
+ <s:property value="%{#results.get(#zone)}" />
+ </s:else>
+ </div>
</div>
- </div>
- </s:iterator>
- </div>
- </s:iterator>
- <s:submit value='%{getText("message.admin.listprojects.deleteselected")}'/>
- </form>
-
- <h3><s:text name="message.admin.listprojects.mapsprojects" /></h3>
-
- <form action="delete-projects" class="listprojects" method="post">
- <s:iterator value="facades">
- <div class="listprojects-facade">
- <span class="title"><s:text name="message.common.facade" /> : <s:property value='value' /></span>
- <s:iterator value="%{getZonesByFacades().get(key)}" var="zone">
- <div class="listprojects-zone">
- <span class="title"><s:text name="message.common.zone" /> : <s:property value="getZoneDisplayName(#zone)"/></span>
- <div class="listprojects-result">
- <s:if test="%{mapsResults.get(#zone) == null}">
- Aucun projet trouvé
- </s:if>
- <s:else>
- <input type="checkbox" name="mapsZonesId" value="<s:property value="zone" />" />
- <s:property value="%{mapsResults.get(#zone)}" />
- </s:else>
+ </s:iterator>
+ </div>
+ </s:iterator>
+ <s:submit value='%{getText("message.admin.listprojects.deleteselected")}'/>
+ </form>
+ </s:if>
+ <s:elseif test="selectedRepositoryType == @fr.ifremer.coser.result.repository.legacy.LegacyResultRepositoryType@ID">
+
+ <h3><s:text name="message.admin.listprojects.indicatorsprojects" /></h3>
+ <p><s:text name="message.admin.listprojects.indicatorsprojects.comment" /></p>
+
+ <form action="delete-projects" class="listprojects" method="post">
+ <s:hidden name="repositoryType" value="%{selectedRepositoryType}"/>
+ <s:hidden name="resultType" value="%{@fr.ifremer.coser.result.ResultType@INDICATOR}"/>
+ <s:set name="results" value="%{getResults(@fr.ifremer.coser.result.ResultType@INDICATOR)}"/>
+ <s:iterator value="facades">
+ <div class="listprojects-facade">
+ <span class="title"><s:text name="message.common.facade" /> : <s:property value='value' /></span>
+ <s:iterator value="%{getZonesByFacades().get(key)}" var="zone">
+ <div class="listprojects-zone">
+ <span class="title"><s:text name="message.common.zone" /> : <s:property value="getZoneDisplayName(#zone)"/></span>
+ <div class="listprojects-result">
+ <s:if test="%{#results.get(#zone) == null}">
+ Aucun projet trouvé
+ </s:if>
+ <s:else>
+ <input type="checkbox" name="zonesId" value="<s:property value="zone" />" />
+ <s:property value="%{#results.get(#zone)}" />
+ </s:else>
+ </div>
</div>
- </div>
- </s:iterator>
- </div>
- </s:iterator>
- <s:submit value='%{getText("message.admin.listprojects.deleteselected")}'/>
- </form>
+ </s:iterator>
+ </div>
+ </s:iterator>
+ <s:submit value='%{getText("message.admin.listprojects.deleteselected")}'/>
+ </form>
+
+ <h3><s:text name="message.admin.listprojects.mapsprojects" /></h3>
+
+ <form action="delete-projects" class="listprojects" method="post">
+ <s:hidden name="repositoryType" value="%{selectedRepositoryType}"/>
+ <s:hidden name="resultType" value="%{@fr.ifremer.coser.result.ResultType@MAP}"/>
+ <s:set name="results" value="%{getResults(@fr.ifremer.coser.result.ResultType@MAP)}"/>
+ <s:iterator value="facades">
+ <div class="listprojects-facade">
+ <span class="title"><s:text name="message.common.facade" /> : <s:property value='value' /></span>
+ <s:iterator value="%{getZonesByFacades().get(key)}" var="zone">
+ <div class="listprojects-zone">
+ <span class="title"><s:text name="message.common.zone" /> : <s:property value="getZoneDisplayName(#zone)"/></span>
+ <div class="listprojects-result">
+ <s:if test="%{#results.get(#zone) == null}">
+ Aucun projet trouvé
+ </s:if>
+ <s:else>
+ <input type="checkbox" name="zonesId" value="<s:property value="zone" />" />
+ <s:property value="%{#results.get(#zone)}" />
+ </s:else>
+ </div>
+ </div>
+ </s:iterator>
+ </div>
+ </s:iterator>
+ <s:submit value='%{getText("message.admin.listprojects.deleteselected")}'/>
+ </form>
+ </s:elseif>
+ <s:else>
+ TODO
+ </s:else>
</body>
</html>
1
0
12 Mar '14
See <http://ci.codelutin.com/jenkins/job/coser-nightly/6/changes>
Changes:
[Tony CHEMIT] move to mavenpom 5.0.1 + remove all svn keyworks from license headers
[Tony CHEMIT] refs-30 #4651 (+ add missing svn properties)
------------------------------------------
[...truncated 870 lines...]
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - WARNING long must contain at least 4 decimals
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - FATAL sweptSurface must contain at least 3 decimals
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - WARNING lat must contain at least 4 decimals
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - WARNING long must contain at least 4 decimals
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - FATAL sweptSurface must contain at least 3 decimals
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - WARNING lat must contain at least 4 decimals
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - WARNING long must contain at least 4 decimals
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - FATAL sweptSurface must contain at least 3 decimals
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - WARNING lat must contain at least 4 decimals
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - WARNING long must contain at least 4 decimals
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - FATAL sweptSurface must contain at least 3 decimals
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - WARNING lat must contain at least 4 decimals
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - WARNING long must contain at least 4 decimals
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - FATAL sweptSurface must contain at least 3 decimals
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - ERROR Duplicated line for key : COSER_TEST|2010|TRAIT1|COSER_SPECIES2|i|NA|19.60|
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - WARNING Differences between length and catch for species COSER_SPECIES1 (year : 2010)
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - WARNING Differences between length and catch for species COSER_SPECIES1 (year : 2011)
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - WARNING Differences between length and catch for species COSER_SPECIES2 (year : 2010)
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - WARNING Differences between length and catch for species COSER_SPECIES2 (year : 2011)
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - WARNING Differences between length and catch for species COSER_SPECIES3 (year : 2010)
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - WARNING Differences between length and catch for species COSER_SPECIES3 (year : 2011)
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - WARNING Differences between length and catch for species COSER_SPECIES4 (year : 2010)
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - WARNING Differences between length and catch for species COSER_SPECIES4 (year : 2011)
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - FATAL Missing 2011|TRAIT2|COSER_SPECIES2 tuple in catch
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - FATAL Missing 2011|TRAIT1|COSER_SPECIES1 tuple in catch
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - FATAL Missing 2011|TRAIT2|COSER_SPECIES1 tuple in catch
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - FATAL Missing 2011|TRAIT2|COSER_SPECIES4 tuple in catch
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - FATAL Missing 2011|TRAIT1|COSER_SPECIES3 tuple in catch
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - FATAL Missing 2011|TRAIT2|COSER_SPECIES3 tuple in catch
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - FATAL Missing 2011|TRAIT1|COSER_SPECIES2 tuple in catch
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - FATAL Missing 2011|TRAIT1|COSER_SPECIES4 tuple in catch
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - FATAL Missing 2011|TRAIT3|COSER_SPECIES4 tuple in catch
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - FATAL Missing 2011|TRAIT3|COSER_SPECIES1 tuple in catch
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - FATAL Missing 2011|TRAIT3|COSER_SPECIES3 tuple in catch
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - FATAL Missing 2011|TRAIT3|COSER_SPECIES2 tuple in catch
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - FATAL Missing 2011|TRAIT1 tuple in hauls
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - FATAL Missing 2011|TRAIT3 tuple in hauls
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - FATAL Missing 2011|TRAIT2 tuple in hauls
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - WARNING Missing strata STR10 in haul file
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - WARNING Missing strata STR8 in haul file
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - WARNING Missing strata STR7 in haul file
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - WARNING Missing strata STR9 in haul file
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - WARNING Missing haul TRAIT10 in length file
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - WARNING Missing haul TRAIT20 in length file
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - WARNING Missing haul TRAIT30 in length file
01:05:45 WARN fr.ifremer.coser.services.ControlServiceTest:96 - []
Tests run: 6, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.94 sec - in fr.ifremer.coser.services.ControlServiceTest
Running fr.ifremer.coser.services.CommandServiceTest
Tests run: 6, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.129 sec - in fr.ifremer.coser.services.CommandServiceTest
Running fr.ifremer.coser.services.ProjectServiceTest
Tests run: 26, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.884 sec - in fr.ifremer.coser.services.ProjectServiceTest
Running fr.ifremer.coser.services.WebServiceTest
01:05:46 INFO fr.ifremer.coser.services.WebService:755 - Unzipping file <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/t…> to <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/t…>
01:05:47 INFO fr.ifremer.coser.services.WebService:755 - Unzipping file <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/t…> to <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/t…>
01:05:47 INFO fr.ifremer.coser.services.WebService:755 - Unzipping file <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/t…> to <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/t…>
01:05:47 INFO fr.ifremer.coser.services.WebService:755 - Unzipping file <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/t…> to <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/t…>
01:05:47 INFO fr.ifremer.coser.services.WebService:755 - Unzipping file <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/t…> to <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/t…>
01:05:48 INFO fr.ifremer.coser.services.WebService:755 - Unzipping file <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/t…> to <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/t…>
01:05:48 INFO fr.ifremer.coser.services.WebService:755 - Unzipping file <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/t…> to <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/t…>
01:05:48 INFO fr.ifremer.coser.services.WebService:755 - Unzipping file <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/t…> to <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/t…>
01:05:48 INFO fr.ifremer.coser.services.WebService:755 - Unzipping file <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/t…> to <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/t…>
01:05:48 INFO fr.ifremer.coser.services.WebService:755 - Unzipping file <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/t…> to <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/t…>
01:05:48 INFO fr.ifremer.coser.services.WebService:755 - Unzipping file <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/t…> to <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/t…>
01:05:48 INFO fr.ifremer.coser.services.WebService:755 - Unzipping file <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/t…> to <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/t…>
Tests run: 15, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.177 sec - in fr.ifremer.coser.services.WebServiceTest
Running fr.ifremer.coser.services.PublicationServiceTest
01:05:48 INFO fr.ifremer.coser.services.PublicationService:481 - Generating HTML report to <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/t…>
01:05:48 INFO fr.ifremer.coser.services.PublicationService:585 - Generating HTML report to <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/t…>
01:05:48 INFO fr.ifremer.coser.services.PublicationService:308 - Generating HTML report to <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/t…>
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.117 sec - in fr.ifremer.coser.services.PublicationServiceTest
Running fr.ifremer.coser.services.CommonServiceTest
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.042 sec - in fr.ifremer.coser.services.CommonServiceTest
Running fr.ifremer.coser.bean.IndicatorMapTest
01:05:48 INFO fr.ifremer.coser.bean.IndicatorMap:61 - Loading Indicator file: <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/t…>
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.022 sec - in fr.ifremer.coser.bean.IndicatorMapTest
Running fr.ifremer.coser.bean.ZoneMapTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.021 sec - in fr.ifremer.coser.bean.ZoneMapTest
Running fr.ifremer.coser.storage.MemoryDataStorageTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec - in fr.ifremer.coser.storage.MemoryDataStorageTest
Results :
Tests run: 70, Failures: 0, Errors: 0, Skipped: 0
[JENKINS] Recording test results
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ coser-business ---
[INFO] Building jar: <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/t…>
[INFO]
[INFO] >>> maven-source-plugin:2.2.1:jar (attach-sources) @ coser-business >>>
[INFO]
[INFO] --- maven-enforcer-plugin:1.3.1:enforce (ensure-no-container-api) @ coser-business ---
[INFO]
[INFO] --- maven-enforcer-plugin:1.3.1:enforce (check-project-files) @ coser-business ---
[INFO]
[INFO] --- helper-maven-plugin:2.1:share-server-secret (get-redmine-login) @ coser-business ---
[INFO] Skipping goal (runOnce flag is on and goal was already executed).
[WARNING] Failed to getClass for org.apache.maven.plugin.source.SourceJarMojo
[INFO]
[INFO] <<< maven-source-plugin:2.2.1:jar (attach-sources) @ coser-business <<<
[INFO]
[INFO] --- maven-source-plugin:2.2.1:jar (attach-sources) @ coser-business ---
[INFO] Building jar: <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/t…>
[INFO]
[INFO] --- maven-javadoc-plugin:2.9.1:jar (attach-javadocs) @ coser-business ---
[INFO]
26 warnings
[WARNING] Javadoc Warnings
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/s…>:302: warning - Tag @link: can't find storeDataWhithoutQuote(DataStorage, Writer, Map, Category) in fr.ifremer.coser.services.CommonService
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/s…>:302: warning - @param argument "project" is not a parameter name.
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/s…>:327: warning - @param argument "file" is not a parameter name.
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/s…>:327: warning - @param argument "project" is not a parameter name.
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/s…>:3221: warning - @param argument "rsufiResult" is not a parameter name.
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/s…>:337: warning - @return tag cannot be used in method with void return type.
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/s…>:535: warning - @sincee is an unknown tag.
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/s…>:535: warning - @return tag cannot be used in method with void return type.
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/s…>:612: warning - @return tag cannot be used in method with void return type.
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/s…>:689: warning - @return tag cannot be used in method with void return type.
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/s…>:1171: warning - @param argument "indicator" is not a parameter name.
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/s…>:1171: warning - @param argument "indicatorName" is not a parameter name.
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/s…>:1171: warning - @param argument "unit" is not a parameter name.
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/s…>:1394: warning - @param argument "indicator" is not a parameter name.
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/s…>:1394: warning - @param argument "indicatorName" is not a parameter name.
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/s…>:1394: warning - @param argument "unit" is not a parameter name.
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/s…>:202: warning - @param argument "locale" is not a parameter name.
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/s…>:1516: warning - @param argument "dataTypes" is not a parameter name.
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/s…>:2515: warning - @param argument "selectZones" is not a parameter name.
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/s…>:2515: warning - @param argument "selectTypes" is not a parameter name.
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/s…>:2515: warning - @param argument "selectSpecies" is not a parameter name.
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/s…>:2668: warning - @param argument "zone" is not a parameter name.
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/s…>:2668: warning - @param argument "locale" is not a parameter name.
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/s…>:2738: warning - @param argument "zone" is not a parameter name.
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/s…>:2738: warning - @param argument "comIndicator" is not a parameter name.
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/s…>:49: warning - @param argument "species" is not a parameter name.
[INFO] Building jar: <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/coser-business/t…>
[INFO]
[INFO] --- maven-site-plugin:3.3:attach-descriptor (attach-descriptor) @ coser-business ---
[INFO]
[INFO] --- helper-maven-plugin:2.1:share-server-secret (get-pgp-passphrase) @ coser-business ---
[INFO] Exporting server [gpg-signer] username in ${gpg.keyname}
[INFO] Exporting server [gpg-signer] password in ${gpg.passphrase}
[INFO]
[INFO] --- helper-maven-plugin:2.1:collect-files (collect-build-artifacts) @ coser-business ---
[INFO] Loaded <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/target/collect-a…>
[INFO] Copying coser-business-1.5-SNAPSHOT.jar to <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/target/collect/f…>
[INFO] Copying THIRD-PARTY.properties to <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/target/collect/f…>
[INFO] Copying coser-business-1.5-SNAPSHOT-sources.jar to <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/target/collect/f…>
[INFO] Copying coser-business-1.5-SNAPSHOT-javadoc.jar to <http://ci.codelutin.com/jenkins/job/coser-nightly/ws/trunk/target/collect/f…>
[INFO]
[INFO] --- helper-maven-plugin:2.1:collect-files (collect-build-attachements) @ coser-business ---
[WARNING] Skipping goal (No file to collect).
[INFO]
[INFO] --- maven-gpg-plugin:1.5:sign (sign-artifacts) @ coser-business ---
[INFO]
[INFO] --- maven-dependency-plugin:2.8:analyze-only (analyze) @ coser-business ---
[INFO] Used declared dependencies found:
[INFO] org.nuiton:nuiton-utils:jar:3.0-rc-2:compile
[INFO] org.nuiton:nuiton-config:jar:3.0-alpha-2:compile
[INFO] org.nuiton.i18n:nuiton-i18n:jar:3.0:compile
[INFO] org.nuiton.matrix:nuiton-matrix:jar:2.4-SNAPSHOT:compile
[INFO] junit:junit:jar:4.11:test
[INFO] commons-logging:commons-logging:jar:1.1.3:compile
[INFO] commons-beanutils:commons-beanutils:jar:1.9.1:compile
[INFO] org.apache.commons:commons-collections4:jar:4.0:compile
[INFO] commons-io:commons-io:jar:2.4:compile
[INFO] org.apache.commons:commons-lang3:jar:3.3:compile
[INFO] org.apache.commons:commons-email:jar:1.3.2:compile
[INFO] org.apache.commons:commons-math:jar:2.2:compile
[INFO] org.apache.httpcomponents:httpcore:jar:4.3.2:compile
[INFO] org.apache.httpcomponents:httpclient:jar:4.3.3:compile
[INFO] org.apache.httpcomponents:httpmime:jar:4.3.3:compile
[INFO] net.sf.opencsv:opencsv:jar:2.3:compile
[INFO] org.apache.struts.xwork:xwork-core:jar:2.3.16.1:compile
[INFO] org.jfree:jfreechart:jar:1.0.17:compile
[INFO] org.jfree:jcommon:jar:1.0.21:compile
[INFO] com.itextpdf:itextpdf:jar:5.5.0:compile
[INFO] org.xhtmlrenderer:flying-saucer-pdf-itext5:jar:9.0.4:compile
[INFO] org.freemarker:freemarker:jar:2.3.20:compile
[WARNING] Used undeclared dependencies found:
[WARNING] commons-collections:commons-collections:jar:3.2.1:compile
[WARNING] com.google.guava:guava:jar:16.0.1:compile
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Coser ............................................. SUCCESS [ 10.273 s]
[INFO] Coser :: Business ................................. FAILURE [ 27.726 s]
[INFO] Coser :: UI ....................................... SKIPPED
[INFO] Coser :: Web ...................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 40.082 s
[INFO] Finished at: 2014-03-08T01:05:56+01:00
[INFO] Final Memory: 65M/1442M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.8:analyze-only (analyze) on project coser-business: Dependency problems found -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.8:analyze-only (analyze) on project coser-business: Dependency problems found
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:108)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
at org.jvnet.hudson.maven3.launcher.Maven31Launcher.main(Maven31Launcher.java:132)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:330)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:238)
at jenkins.maven3.agent.Maven31Main.launch(Maven31Main.java:181)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:134)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:69)
at hudson.remoting.UserRequest.perform(UserRequest.java:118)
at hudson.remoting.UserRequest.perform(UserRequest.java:48)
at hudson.remoting.Request$2.run(Request.java:328)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: org.apache.maven.plugin.MojoExecutionException: Dependency problems found
at org.apache.maven.plugin.dependency.analyze.AbstractAnalyzeMojo.execute(AbstractAnalyzeMojo.java:188)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 30 more
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :coser-business
Sending e-mails to: coser-commits(a)list.forge.codelutin.com chemit+codelutin-ci(a)codelutin.com
channel stopped
Skipping sonar analysis due to bad build status FAILURE
1
4
Build failed in Jenkins: coser-nightly » Coser :: Business #6
by admin+ci-codelutin.com@codelutin.com 12 Mar '14
by admin+ci-codelutin.com@codelutin.com 12 Mar '14
12 Mar '14
See <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>
Changes:
[Tony CHEMIT] move to mavenpom 5.0.1 + remove all svn keyworks from license headers
[Tony CHEMIT] refs-30 #4651 (+ add missing svn properties)
------------------------------------------
[...truncated 99 lines...]
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>:[445,13] org.apache.http.entity.mime.MultipartEntity in org.apache.http.entity.mime has been deprecated
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>:[445,45] org.apache.http.entity.mime.MultipartEntity in org.apache.http.entity.mime has been deprecated
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>:[448,36] StringBody(java.lang.String,java.nio.charset.Charset) in org.apache.http.entity.mime.content.StringBody has been deprecated
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>:[451,39] StringBody(java.lang.String,java.nio.charset.Charset) in org.apache.http.entity.mime.content.StringBody has been deprecated
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>:[2265,54] escapeXml(java.lang.String) in org.apache.commons.lang3.StringEscapeUtils has been deprecated
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>:[2266,53] escapeXml(java.lang.String) in org.apache.commons.lang3.StringEscapeUtils has been deprecated
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>: Some input files use unchecked or unsafe operations.
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>: Recompile with -Xlint:unchecked for details.
[INFO]
[INFO] --- animal-sniffer-maven-plugin:1.10:check (default) @ coser-business ---
[INFO] Checking unresolved references to org.codehaus.mojo.signature:java16:1.1
[INFO]
[INFO] --- jredmine-maven-plugin:1.6:generate-changes (jredmine-generate-changes) @ coser-business ---
[INFO] Skipping goal (skipGenerateChanges flag is on).
[INFO]
[INFO] --- maven-antrun-plugin:1.7:run (generate-surefire-workdir) @ coser-business ---
[INFO] Executing tasks
main:
[mkdir] Created dir: <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>
[INFO] Executed tasks
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ coser-business ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 83 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ coser-business ---
[INFO] Compiling 14 source files to <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>
[WARNING] bootstrap class path not set in conjunction with -source 1.6
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>: <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…> uses unchecked or unsafe operations.
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>: Recompile with -Xlint:unchecked for details.
[INFO]
[INFO] --- maven-surefire-plugin:2.16:test (default-test) @ coser-business ---
[INFO] Surefire report directory: <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running fr.ifremer.coser.result.repository.echobase.EchoBaseResultRepositoryProviderTest
01:05:44 INFO fr.ifremer.coser.result.repository.echobase.EchoBaseResultRepositoryProvider:71 - Scan for projects from basedir: <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>
01:05:44 INFO fr.ifremer.coser.result.repository.echobase.EchoBaseResultRepository:148 - New result repository: echobase::<http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>
01:05:44 INFO fr.ifremer.coser.result.repository.echobase.EchoBaseResultRepository:148 - New result repository: echobase::<http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>
01:05:44 INFO fr.ifremer.coser.result.repository.echobase.EchoBaseResultRepositoryProvider:103 - Found 2 result repository(ies) from basedir: <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.331 sec - in fr.ifremer.coser.result.repository.echobase.EchoBaseResultRepositoryProviderTest
Running fr.ifremer.coser.result.repository.echobase.EchoBaseResultRepositoryTest
01:05:44 INFO fr.ifremer.coser.result.repository.echobase.EchoBaseResultRepositoryProvider:71 - Scan for projects from basedir: <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>
01:05:44 INFO fr.ifremer.coser.result.repository.echobase.EchoBaseResultRepository:148 - New result repository: echobase::<http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>
01:05:44 INFO fr.ifremer.coser.result.repository.echobase.EchoBaseResultRepository:148 - New result repository: echobase::<http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>
01:05:44 INFO fr.ifremer.coser.result.repository.echobase.EchoBaseResultRepositoryProvider:103 - Found 2 result repository(ies) from basedir: <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.054 sec - in fr.ifremer.coser.result.repository.echobase.EchoBaseResultRepositoryTest
Running fr.ifremer.coser.result.repository.legacy.LegacyResultRepositoryProviderTest
01:05:44 INFO fr.ifremer.coser.result.repository.legacy.LegacyResultRepositoryProvider:75 - Scan for projects from basedir: <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>
01:05:44 INFO fr.ifremer.coser.result.repository.legacy.LegacyResultRepository:185 - New result repository: rsufi::<http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>::Indicator
01:05:44 INFO fr.ifremer.coser.result.repository.legacy.LegacyResultRepositoryProvider:138 - Detected result: projectctrvalidated - testresult2
01:05:44 INFO fr.ifremer.coser.result.repository.legacy.LegacyResultRepository:185 - New result repository: rsufi::<http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>::Indicator
01:05:44 INFO fr.ifremer.coser.result.repository.legacy.LegacyResultRepositoryProvider:138 - Detected result: projectctrvalidated - testresult1
01:05:44 INFO fr.ifremer.coser.result.repository.legacy.LegacyResultRepositoryProvider:85 - Found 2 result repository(ies) from basedir: <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.093 sec - in fr.ifremer.coser.result.repository.legacy.LegacyResultRepositoryProviderTest
Running fr.ifremer.coser.CoserUtilsTest
[Fatal Error] :1:7: XML document structures must start and end within the same entity.
Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.022 sec - in fr.ifremer.coser.CoserUtilsTest
Running fr.ifremer.coser.services.ControlServiceTest
01:05:44 WARN fr.ifremer.coser.services.ControlServiceTest:83 - []
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - WARNING lat must contain at least 4 decimals
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - WARNING long must contain at least 4 decimals
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - FATAL sweptSurface must contain at least 3 decimals
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - WARNING lat must contain at least 4 decimals
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - WARNING long must contain at least 4 decimals
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - FATAL sweptSurface must contain at least 3 decimals
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - WARNING lat must contain at least 4 decimals
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - WARNING long must contain at least 4 decimals
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - FATAL sweptSurface must contain at least 3 decimals
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - WARNING lat must contain at least 4 decimals
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - WARNING long must contain at least 4 decimals
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - FATAL sweptSurface must contain at least 3 decimals
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - WARNING lat must contain at least 4 decimals
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - WARNING long must contain at least 4 decimals
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - FATAL sweptSurface must contain at least 3 decimals
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - WARNING lat must contain at least 4 decimals
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - WARNING long must contain at least 4 decimals
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - FATAL sweptSurface must contain at least 3 decimals
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - ERROR Duplicated line for key : COSER_TEST|2010|TRAIT1|COSER_SPECIES2|i|NA|19.60|
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - WARNING Differences between length and catch for species COSER_SPECIES1 (year : 2010)
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - WARNING Differences between length and catch for species COSER_SPECIES1 (year : 2011)
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - WARNING Differences between length and catch for species COSER_SPECIES2 (year : 2010)
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - WARNING Differences between length and catch for species COSER_SPECIES2 (year : 2011)
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - WARNING Differences between length and catch for species COSER_SPECIES3 (year : 2010)
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - WARNING Differences between length and catch for species COSER_SPECIES3 (year : 2011)
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - WARNING Differences between length and catch for species COSER_SPECIES4 (year : 2010)
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - WARNING Differences between length and catch for species COSER_SPECIES4 (year : 2011)
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - FATAL Missing 2011|TRAIT2|COSER_SPECIES2 tuple in catch
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - FATAL Missing 2011|TRAIT1|COSER_SPECIES1 tuple in catch
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - FATAL Missing 2011|TRAIT2|COSER_SPECIES1 tuple in catch
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - FATAL Missing 2011|TRAIT2|COSER_SPECIES4 tuple in catch
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - FATAL Missing 2011|TRAIT1|COSER_SPECIES3 tuple in catch
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - FATAL Missing 2011|TRAIT2|COSER_SPECIES3 tuple in catch
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - FATAL Missing 2011|TRAIT1|COSER_SPECIES2 tuple in catch
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - FATAL Missing 2011|TRAIT1|COSER_SPECIES4 tuple in catch
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - FATAL Missing 2011|TRAIT3|COSER_SPECIES4 tuple in catch
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - FATAL Missing 2011|TRAIT3|COSER_SPECIES1 tuple in catch
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - FATAL Missing 2011|TRAIT3|COSER_SPECIES3 tuple in catch
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - FATAL Missing 2011|TRAIT3|COSER_SPECIES2 tuple in catch
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - FATAL Missing 2011|TRAIT1 tuple in hauls
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - FATAL Missing 2011|TRAIT3 tuple in hauls
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - FATAL Missing 2011|TRAIT2 tuple in hauls
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - WARNING Missing strata STR10 in haul file
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - WARNING Missing strata STR8 in haul file
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - WARNING Missing strata STR7 in haul file
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - WARNING Missing strata STR9 in haul file
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - WARNING Missing haul TRAIT10 in length file
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - WARNING Missing haul TRAIT20 in length file
01:05:45 INFO fr.ifremer.coser.services.ControlServiceTest:168 - WARNING Missing haul TRAIT30 in length file
01:05:45 WARN fr.ifremer.coser.services.ControlServiceTest:96 - []
Tests run: 6, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.94 sec - in fr.ifremer.coser.services.ControlServiceTest
Running fr.ifremer.coser.services.CommandServiceTest
Tests run: 6, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.129 sec - in fr.ifremer.coser.services.CommandServiceTest
Running fr.ifremer.coser.services.ProjectServiceTest
Tests run: 26, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.884 sec - in fr.ifremer.coser.services.ProjectServiceTest
Running fr.ifremer.coser.services.WebServiceTest
01:05:46 INFO fr.ifremer.coser.services.WebService:755 - Unzipping file <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…> to <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>
01:05:47 INFO fr.ifremer.coser.services.WebService:755 - Unzipping file <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…> to <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>
01:05:47 INFO fr.ifremer.coser.services.WebService:755 - Unzipping file <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…> to <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>
01:05:47 INFO fr.ifremer.coser.services.WebService:755 - Unzipping file <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…> to <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>
01:05:47 INFO fr.ifremer.coser.services.WebService:755 - Unzipping file <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…> to <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>
01:05:48 INFO fr.ifremer.coser.services.WebService:755 - Unzipping file <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…> to <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>
01:05:48 INFO fr.ifremer.coser.services.WebService:755 - Unzipping file <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…> to <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>
01:05:48 INFO fr.ifremer.coser.services.WebService:755 - Unzipping file <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…> to <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>
01:05:48 INFO fr.ifremer.coser.services.WebService:755 - Unzipping file <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…> to <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>
01:05:48 INFO fr.ifremer.coser.services.WebService:755 - Unzipping file <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…> to <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>
01:05:48 INFO fr.ifremer.coser.services.WebService:755 - Unzipping file <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…> to <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>
01:05:48 INFO fr.ifremer.coser.services.WebService:755 - Unzipping file <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…> to <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>
Tests run: 15, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.177 sec - in fr.ifremer.coser.services.WebServiceTest
Running fr.ifremer.coser.services.PublicationServiceTest
01:05:48 INFO fr.ifremer.coser.services.PublicationService:481 - Generating HTML report to <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>
01:05:48 INFO fr.ifremer.coser.services.PublicationService:585 - Generating HTML report to <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>
01:05:48 INFO fr.ifremer.coser.services.PublicationService:308 - Generating HTML report to <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.117 sec - in fr.ifremer.coser.services.PublicationServiceTest
Running fr.ifremer.coser.services.CommonServiceTest
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.042 sec - in fr.ifremer.coser.services.CommonServiceTest
Running fr.ifremer.coser.bean.IndicatorMapTest
01:05:48 INFO fr.ifremer.coser.bean.IndicatorMap:61 - Loading Indicator file: <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.022 sec - in fr.ifremer.coser.bean.IndicatorMapTest
Running fr.ifremer.coser.bean.ZoneMapTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.021 sec - in fr.ifremer.coser.bean.ZoneMapTest
Running fr.ifremer.coser.storage.MemoryDataStorageTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec - in fr.ifremer.coser.storage.MemoryDataStorageTest
Results :
Tests run: 70, Failures: 0, Errors: 0, Skipped: 0
[JENKINS] Recording test results
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ coser-business ---
[INFO] Building jar: <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>
[INFO]
[INFO] >>> maven-source-plugin:2.2.1:jar (attach-sources) @ coser-business >>>
[INFO]
[INFO] --- maven-enforcer-plugin:1.3.1:enforce (ensure-no-container-api) @ coser-business ---
[INFO]
[INFO] --- maven-enforcer-plugin:1.3.1:enforce (check-project-files) @ coser-business ---
[INFO]
[INFO] --- helper-maven-plugin:2.1:share-server-secret (get-redmine-login) @ coser-business ---
[INFO] Skipping goal (runOnce flag is on and goal was already executed).
[WARNING] Failed to getClass for org.apache.maven.plugin.source.SourceJarMojo
[INFO]
[INFO] <<< maven-source-plugin:2.2.1:jar (attach-sources) @ coser-business <<<
[INFO]
[INFO] --- maven-source-plugin:2.2.1:jar (attach-sources) @ coser-business ---
[INFO] Building jar: <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>
[INFO]
[INFO] --- maven-javadoc-plugin:2.9.1:jar (attach-javadocs) @ coser-business ---
[INFO]
26 warnings
[WARNING] Javadoc Warnings
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>:302: warning - Tag @link: can't find storeDataWhithoutQuote(DataStorage, Writer, Map, Category) in fr.ifremer.coser.services.CommonService
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>:302: warning - @param argument "project" is not a parameter name.
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>:327: warning - @param argument "file" is not a parameter name.
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>:327: warning - @param argument "project" is not a parameter name.
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>:3221: warning - @param argument "rsufiResult" is not a parameter name.
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>:337: warning - @return tag cannot be used in method with void return type.
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>:535: warning - @sincee is an unknown tag.
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>:535: warning - @return tag cannot be used in method with void return type.
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>:612: warning - @return tag cannot be used in method with void return type.
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>:689: warning - @return tag cannot be used in method with void return type.
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>:1171: warning - @param argument "indicator" is not a parameter name.
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>:1171: warning - @param argument "indicatorName" is not a parameter name.
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>:1171: warning - @param argument "unit" is not a parameter name.
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>:1394: warning - @param argument "indicator" is not a parameter name.
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>:1394: warning - @param argument "indicatorName" is not a parameter name.
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>:1394: warning - @param argument "unit" is not a parameter name.
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>:202: warning - @param argument "locale" is not a parameter name.
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>:1516: warning - @param argument "dataTypes" is not a parameter name.
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>:2515: warning - @param argument "selectZones" is not a parameter name.
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>:2515: warning - @param argument "selectTypes" is not a parameter name.
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>:2515: warning - @param argument "selectSpecies" is not a parameter name.
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>:2668: warning - @param argument "zone" is not a parameter name.
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>:2668: warning - @param argument "locale" is not a parameter name.
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>:2738: warning - @param argument "zone" is not a parameter name.
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>:2738: warning - @param argument "comIndicator" is not a parameter name.
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>:49: warning - @param argument "species" is not a parameter name.
[INFO] Building jar: <http://ci.codelutin.com/jenkins/job/coser-nightly/fr.ifremer.coser$coser-bu…>
[INFO]
[INFO] --- maven-site-plugin:3.3:attach-descriptor (attach-descriptor) @ coser-business ---
[INFO]
[INFO] --- helper-maven-plugin:2.1:share-server-secret (get-pgp-passphrase) @ coser-business ---
[INFO] Exporting server [gpg-signer] username in ${gpg.keyname}
[INFO] Exporting server [gpg-signer] password in ${gpg.passphrase}
[INFO]
[INFO] --- helper-maven-plugin:2.1:collect-files (collect-build-artifacts) @ coser-business ---
[INFO] Loaded /var/local/forge/data/codelutin.com/jenkins/workspace/coser-nightly/trunk/target/collect-artifacts.txt
[INFO] Copying coser-business-1.5-SNAPSHOT.jar to /var/local/forge/data/codelutin.com/jenkins/workspace/coser-nightly/trunk/target/collect/fr.ifremer.coser--coser-business/coser-business-1.5-SNAPSHOT.jar
[INFO] Copying THIRD-PARTY.properties to /var/local/forge/data/codelutin.com/jenkins/workspace/coser-nightly/trunk/target/collect/fr.ifremer.coser--coser-business/THIRD-PARTY.properties
[INFO] Copying coser-business-1.5-SNAPSHOT-sources.jar to /var/local/forge/data/codelutin.com/jenkins/workspace/coser-nightly/trunk/target/collect/fr.ifremer.coser--coser-business/coser-business-1.5-SNAPSHOT-sources.jar
[INFO] Copying coser-business-1.5-SNAPSHOT-javadoc.jar to /var/local/forge/data/codelutin.com/jenkins/workspace/coser-nightly/trunk/target/collect/fr.ifremer.coser--coser-business/coser-business-1.5-SNAPSHOT-javadoc.jar
[INFO]
[INFO] --- helper-maven-plugin:2.1:collect-files (collect-build-attachements) @ coser-business ---
[WARNING] Skipping goal (No file to collect).
[INFO]
[INFO] --- maven-gpg-plugin:1.5:sign (sign-artifacts) @ coser-business ---
[INFO]
[INFO] --- maven-dependency-plugin:2.8:analyze-only (analyze) @ coser-business ---
[INFO] Used declared dependencies found:
[INFO] org.nuiton:nuiton-utils:jar:3.0-rc-2:compile
[INFO] org.nuiton:nuiton-config:jar:3.0-alpha-2:compile
[INFO] org.nuiton.i18n:nuiton-i18n:jar:3.0:compile
[INFO] org.nuiton.matrix:nuiton-matrix:jar:2.4-SNAPSHOT:compile
[INFO] junit:junit:jar:4.11:test
[INFO] commons-logging:commons-logging:jar:1.1.3:compile
[INFO] commons-beanutils:commons-beanutils:jar:1.9.1:compile
[INFO] org.apache.commons:commons-collections4:jar:4.0:compile
[INFO] commons-io:commons-io:jar:2.4:compile
[INFO] org.apache.commons:commons-lang3:jar:3.3:compile
[INFO] org.apache.commons:commons-email:jar:1.3.2:compile
[INFO] org.apache.commons:commons-math:jar:2.2:compile
[INFO] org.apache.httpcomponents:httpcore:jar:4.3.2:compile
[INFO] org.apache.httpcomponents:httpclient:jar:4.3.3:compile
[INFO] org.apache.httpcomponents:httpmime:jar:4.3.3:compile
[INFO] net.sf.opencsv:opencsv:jar:2.3:compile
[INFO] org.apache.struts.xwork:xwork-core:jar:2.3.16.1:compile
[INFO] org.jfree:jfreechart:jar:1.0.17:compile
[INFO] org.jfree:jcommon:jar:1.0.21:compile
[INFO] com.itextpdf:itextpdf:jar:5.5.0:compile
[INFO] org.xhtmlrenderer:flying-saucer-pdf-itext5:jar:9.0.4:compile
[INFO] org.freemarker:freemarker:jar:2.3.20:compile
[WARNING] Used undeclared dependencies found:
[WARNING] commons-collections:commons-collections:jar:3.2.1:compile
[WARNING] com.google.guava:guava:jar:16.0.1:compile
[JENKINS] Archiving disabled
1
4
11 Mar '14
Author: tchemit
Date: 2014-03-11 17:45:58 +0100 (Tue, 11 Mar 2014)
New Revision: 1144
Url: http://forge.codelutin.com/projects/coser/repository/revisions/1144
Log:
refs #4664 (nearly done...)
Added:
trunk/coser-business/src/main/java/fr/ifremer/coser/CoserServiceContext.java
trunk/coser-business/src/main/java/fr/ifremer/coser/DefaultCoserServiceContext.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/DeleteRequest.java
trunk/coser-web/src/main/java/fr/ifremer/coser/web/CoserApplicationContext.java
Modified:
trunk/coser-business/src/main/java/fr/ifremer/coser/result/CoserRequest.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/CoserResultEngine.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/ResultProducer.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/ResultRepository.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/ResultRepositoryProvider.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/CommunityIndicatorResultProducer.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/EchoBaseResultRepository.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/EchoBaseResultRepositoryProvider.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/ExtractResultProducer.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/MapResultProducer.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/PopulationIndicatorResultProducer.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/RawDataResultProducer.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/CommunityIndicatorResultProducer.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/ExtractResultProducer.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/LegacyResultRepository.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/LegacyResultRepositoryProvider.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/MapResultProducer.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/PopulationIndicatorResultProducer.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/RawDataResultProducer.java
trunk/coser-business/src/test/java/fr/ifremer/coser/result/repository/echobase/EchoBaseResultRepositoryProviderTest.java
trunk/coser-business/src/test/java/fr/ifremer/coser/result/repository/echobase/EchoBaseResultRepositoryTest.java
trunk/coser-business/src/test/java/fr/ifremer/coser/result/repository/legacy/LegacyResultRepositoryProviderTest.java
trunk/coser-business/src/test/java/fr/ifremer/coser/services/CoserTestAbstract.java
trunk/coser-web/src/main/java/fr/ifremer/coser/web/CoserApplicationListener.java
trunk/coser-web/src/main/java/fr/ifremer/coser/web/ServiceHelper.java
trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/IndexAction.java
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/CoserServiceContext.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/CoserServiceContext.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/CoserServiceContext.java 2014-03-11 16:45:58 UTC (rev 1144)
@@ -0,0 +1,46 @@
+package fr.ifremer.coser;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.coser.bean.IndicatorMap;
+import fr.ifremer.coser.bean.ZoneMap;
+import fr.ifremer.coser.result.repository.ResultRepositoryProvider;
+
+import java.util.Set;
+
+/**
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public interface CoserServiceContext {
+
+ CoserBusinessConfig getConfig();
+
+ Set<ResultRepositoryProvider<?>> getProviders();
+
+ IndicatorMap getIndicatorsMap();
+
+ ZoneMap getZonesMap();
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/CoserServiceContext.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/DefaultCoserServiceContext.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/DefaultCoserServiceContext.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/DefaultCoserServiceContext.java 2014-03-11 16:45:58 UTC (rev 1144)
@@ -0,0 +1,93 @@
+package fr.ifremer.coser;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.coser.bean.IndicatorMap;
+import fr.ifremer.coser.bean.ZoneMap;
+import fr.ifremer.coser.result.CoserResultEngine;
+import fr.ifremer.coser.result.repository.ResultRepositoryProvider;
+
+import java.util.Set;
+
+/**
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class DefaultCoserServiceContext implements CoserServiceContext {
+
+ /**
+ * Application configuration.
+ */
+ protected CoserBusinessConfig config;
+
+ /**
+ * Result repositories providers.
+ */
+ protected Set<ResultRepositoryProvider<?>> providers;
+
+ /**
+ * Cache of indicator definition.
+ */
+ protected IndicatorMap indicatorsMap;
+
+ /**
+ * Cache of zone definition.
+ */
+ protected ZoneMap zonesMap;
+
+ public DefaultCoserServiceContext(CoserBusinessConfig config) {
+ this.config = config;
+ }
+
+ @Override
+ public CoserBusinessConfig getConfig() {
+ return config;
+ }
+
+ @Override
+ public Set<ResultRepositoryProvider<?>> getProviders() {
+ if (providers == null) {
+ providers = CoserResultEngine.createDefaultRepositoryProviders(config);
+ }
+ return providers;
+ }
+
+ @Override
+ public IndicatorMap getIndicatorsMap() {
+ if (indicatorsMap == null) {
+ indicatorsMap = new IndicatorMap(config.getWebIndicatorsFile());
+ }
+ return indicatorsMap;
+ }
+
+ @Override
+ public ZoneMap getZonesMap() {
+ if (zonesMap == null) {
+ zonesMap = new ZoneMap(config.getWebZonesFile());
+ }
+ return zonesMap;
+ }
+
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/DefaultCoserServiceContext.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/result/CoserRequest.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/CoserRequest.java 2014-03-11 14:45:05 UTC (rev 1143)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/CoserRequest.java 2014-03-11 16:45:58 UTC (rev 1144)
@@ -33,7 +33,7 @@
* @author Tony Chemit <chemit(a)codelutin.com>
* @since 1.5
*/
-public interface CoserRequest extends Serializable{
+public interface CoserRequest extends Serializable {
Locale getLocale();
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/result/CoserResultEngine.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/CoserResultEngine.java 2014-03-11 14:45:05 UTC (rev 1143)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/CoserResultEngine.java 2014-03-11 16:45:58 UTC (rev 1144)
@@ -27,6 +27,7 @@
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import fr.ifremer.coser.CoserBusinessConfig;
+import fr.ifremer.coser.CoserServiceContext;
import fr.ifremer.coser.result.repository.ResultRepository;
import fr.ifremer.coser.result.repository.ResultRepositoryProvider;
import fr.ifremer.coser.result.repository.echobase.EchoBaseResultRepositoryProvider;
@@ -57,39 +58,36 @@
/** Logger. */
private static final Log log = LogFactory.getLog(CoserResultEngine.class);
- /**
- * List of result repository providers.
- */
- protected final Set<ResultRepositoryProvider<?>> repositoryProviders;
-
- /**
- * Result repositories loaded lazy from their provider.
- *
- * @see #getRepositories()
- */
- protected Set<ResultRepository> repositories;
-
public static Set<ResultRepositoryProvider<?>> createDefaultRepositoryProviders(CoserBusinessConfig config) {
Preconditions.checkNotNull(config);
Set<ResultRepositoryProvider<?>> result = Sets.newHashSet();
// add legacy map repository
Preconditions.checkNotNull(config.getWebMapsProjectsDirectory());
- result.add(new LegacyResultRepositoryProvider(config, config.getWebMapsProjectsDirectory()));
+ result.add(new LegacyResultRepositoryProvider(config.getWebMapsProjectsDirectory()));
// add legacy indicators repository
Preconditions.checkNotNull(config.getWebIndicatorsProjectsDirectory());
- result.add(new LegacyResultRepositoryProvider(config, config.getWebIndicatorsProjectsDirectory()));
+ result.add(new LegacyResultRepositoryProvider(config.getWebIndicatorsProjectsDirectory()));
// add EchoBase repository
Preconditions.checkNotNull(config.getWebEchobaseProjectsDirectory());
- result.add(new EchoBaseResultRepositoryProvider(config, config.getWebEchobaseProjectsDirectory()));
+ result.add(new EchoBaseResultRepositoryProvider(config.getWebEchobaseProjectsDirectory()));
return result;
}
- public CoserResultEngine(Set<ResultRepositoryProvider<?>> repositoryProviders) {
- Preconditions.checkNotNull(repositoryProviders);
- this.repositoryProviders = repositoryProviders;
+ /**
+ * Result repositories loaded lazy from their provider.
+ *
+ * @see #getRepositories()
+ */
+ protected Set<ResultRepository> repositories;
+
+ protected final CoserServiceContext serviceContext;
+
+ public CoserResultEngine(CoserServiceContext serviceContext) {
+ Preconditions.checkNotNull(serviceContext);
+ this.serviceContext = serviceContext;
}
public void resetRepositories() {
@@ -154,8 +152,8 @@
if (repositories == null) {
Set<String> ids = Sets.newHashSet();
repositories = Sets.newHashSet();
- for (ResultRepositoryProvider repositoryProvider : repositoryProviders) {
- Set<ResultRepository> resultRepositories = repositoryProvider.loadRepositories();
+ for (ResultRepositoryProvider repositoryProvider : serviceContext.getProviders()) {
+ Set<ResultRepository> resultRepositories = repositoryProvider.loadRepositories(serviceContext);
// check all repository use a unique id
for (ResultRepository resultRepository : resultRepositories) {
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/ResultProducer.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/ResultProducer.java 2014-03-11 14:45:05 UTC (rev 1143)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/ResultProducer.java 2014-03-11 16:45:58 UTC (rev 1144)
@@ -39,6 +39,8 @@
ResultRepository getRepository();
+ boolean acceptResult(R request);
+
Map<String, String> getAvailableZones(R request);
Map<String, String> getAvailableSpecies(R request);
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/ResultRepository.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/ResultRepository.java 2014-03-11 14:45:05 UTC (rev 1143)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/ResultRepository.java 2014-03-11 16:45:58 UTC (rev 1144)
@@ -48,7 +48,7 @@
* @param request request
* @return all available zones for the given request
*/
- Map<String, String> getAvailableZones(CoserRequest request);
+ <R extends CoserRequest> Map<String, String> getAvailableZones(R request);
/**
* Get all available species (or speciesList) for the given request.
@@ -56,7 +56,7 @@
* @param request request
* @return all available species for the given request.
*/
- Map<String, String> getAvailableSpecies(CoserRequest request);
+ <R extends CoserRequest> Map<String, String> getAvailableSpecies(R request);
/**
* Get all available indicators for the given request.
@@ -64,14 +64,14 @@
* @param request request
* @return all available indicators for the given request.
*/
- Map<String, String> getAvailableIndicators(CoserRequest request);
+ <R extends CoserRequest> Map<String, String> getAvailableIndicators(R request);
/**
* @param request request to test
* @return {@code true} if this repository has some result for the given
* request, {@code false} otherwise
*/
- boolean acceptResult(CoserRequest request);
+ <R extends CoserRequest> boolean acceptResult(R request);
/**
* Get result for the given request.
@@ -81,5 +81,5 @@
* @param request request to obtain result
* @return the result for the given request
*/
- CoserResult getResult(CoserRequest request);
+ <R extends CoserRequest> CoserResult getResult(R request);
}
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/ResultRepositoryProvider.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/ResultRepositoryProvider.java 2014-03-11 14:45:05 UTC (rev 1143)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/ResultRepositoryProvider.java 2014-03-11 16:45:58 UTC (rev 1144)
@@ -22,6 +22,7 @@
* #L%
*/
+import fr.ifremer.coser.CoserServiceContext;
import fr.ifremer.coser.result.ResultRepositoryInitializationException;
import java.util.Set;
@@ -37,7 +38,8 @@
public interface ResultRepositoryProvider<R extends ResultRepository> {
/**
+ * @param serviceContext service context
* @return the set of provided result repositories.
*/
- Set<R> loadRepositories() throws ResultRepositoryInitializationException;
+ Set<R> loadRepositories(CoserServiceContext serviceContext) throws ResultRepositoryInitializationException;
}
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/CommunityIndicatorResultProducer.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/CommunityIndicatorResultProducer.java 2014-03-11 14:45:05 UTC (rev 1143)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/CommunityIndicatorResultProducer.java 2014-03-11 16:45:58 UTC (rev 1144)
@@ -90,6 +90,13 @@
}
@Override
+ public boolean acceptResult(CommunityIndicatorRequest request) {
+ return repository.matchFacade(request) &&
+ repository.matchZone(request) &&
+ matchIndicatorAndSpeciesList(request);
+ }
+
+ @Override
public Map<String, String> getAvailableZones(CommunityIndicatorRequest request) {
Preconditions.checkNotNull(request.getFacade());
@@ -112,7 +119,7 @@
boolean match = repository.matchFacade(request) &&
repository.matchZone(request) &&
- repository.matchIndicator(request);
+ matchIndicator(request);
Map<String, String> result = null;
@@ -389,4 +396,46 @@
return result;
}
+
+ // --------------------------------------------------------------------- //
+ // --- Matchers -------------------------------------------------------- //
+ // --------------------------------------------------------------------- //
+
+ protected boolean matchIndicator(CommunityIndicatorRequest request) {
+ Preconditions.checkNotNull(request.getIndicator());
+
+ String indicator = request.getIndicator();
+
+ boolean result = false;
+
+ Iterator<String[]> iterator = repository.loadCommunityIndicatorStorage(true);
+ while (iterator.hasNext()) {
+ String[] tuple = iterator.next();
+ if (repository.matchIndicatorIndicator(tuple, indicator)) {
+ result = true;
+ break;
+ }
+ }
+ return result;
+ }
+
+ protected boolean matchIndicatorAndSpeciesList(CommunityIndicatorRequest request) {
+ Preconditions.checkNotNull(request.getIndicator());
+ Preconditions.checkNotNull(request.getSpecies());
+
+ String indicator = request.getIndicator();
+ String speciesList = request.getSpecies();
+
+ boolean result = false;
+
+ Iterator<String[]> iterator = repository.loadCommunityIndicatorStorage(true);
+ while (iterator.hasNext()) {
+ String[] tuple = iterator.next();
+ if (repository.matchCommunityIndicatorAndSpeciesList(tuple, indicator, speciesList)) {
+ result = true;
+ break;
+ }
+ }
+ return result;
+ }
}
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/EchoBaseResultRepository.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/EchoBaseResultRepository.java 2014-03-11 14:45:05 UTC (rev 1143)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/EchoBaseResultRepository.java 2014-03-11 16:45:58 UTC (rev 1144)
@@ -27,7 +27,7 @@
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
-import fr.ifremer.coser.CoserBusinessConfig;
+import fr.ifremer.coser.CoserServiceContext;
import fr.ifremer.coser.bean.EchoBaseProject;
import fr.ifremer.coser.bean.IndicatorMap;
import fr.ifremer.coser.bean.SpeciesMap;
@@ -46,7 +46,6 @@
import fr.ifremer.coser.result.request.RawDataRequest;
import fr.ifremer.coser.storage.DataStorage;
import fr.ifremer.coser.storage.DataStorages;
-import fr.ifremer.coser.util.DataType;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -84,11 +83,6 @@
protected final File mapsDirectory;
/**
- * Application config.
- */
- protected final CoserBusinessConfig config;
-
- /**
* Transform a map result species file to the species code.
*/
protected final Function<File, String> mapFileToSpeciesCode;
@@ -104,36 +98,26 @@
protected final FilenameFilter mapSpeciesFilenameFilter;
/**
- * Cache of species definition.
+ * Service context.
*/
- protected SpeciesMap speciesMap;
+ protected final CoserServiceContext serviceContext;
/**
- * Cache of indicator definition.
- */
- protected IndicatorMap indicatorsMap;
-
- /**
- * Cache of zone definition.
- */
- protected ZoneMap zonesMap;
-
- /**
* Cache of species definition.
*/
- protected DataStorage speciesDefinition;
+ protected SpeciesMap speciesMap;
/**
* Report helper.
*/
protected final Reports reports;
- protected final Map<Class<?>, ResultProducer<?>> resultProducers;
+ protected final Map<String, ResultProducer<?>> resultProducers;
- public EchoBaseResultRepository(CoserBusinessConfig config, EchoBaseProject project) {
- Preconditions.checkNotNull(config);
+ public EchoBaseResultRepository(CoserServiceContext serviceContext, EchoBaseProject project) {
+ this.serviceContext = serviceContext;
+ Preconditions.checkNotNull(serviceContext);
Preconditions.checkNotNull(project);
- this.config = config;
this.project = project;
this.mapsDirectory = project.getMapsDirectory();
this.reports = new Reports();
@@ -144,11 +128,11 @@
this.mapSpeciesFilenameFilter = EchoBaseProject.newMapSpeciesFilenameFilter(surveyName);
this.resultProducers = Maps.newHashMap();
- this.resultProducers.put(MapRequest.class, new MapResultProducer(this));
- this.resultProducers.put(CommunityIndicatorRequest.class, new CommunityIndicatorResultProducer(this));
- this.resultProducers.put(PopulationIndicatorRequest.class, new PopulationIndicatorResultProducer(this));
- this.resultProducers.put(RawDataRequest.class, new RawDataResultProducer(this));
- this.resultProducers.put(ExtractRequest.class, new ExtractResultProducer(this));
+ this.resultProducers.put(MapRequest.class.getName(), new MapResultProducer(this));
+ this.resultProducers.put(CommunityIndicatorRequest.class.getName(), new CommunityIndicatorResultProducer(this));
+ this.resultProducers.put(PopulationIndicatorRequest.class.getName(), new PopulationIndicatorResultProducer(this));
+ this.resultProducers.put(RawDataRequest.class.getName(), new RawDataResultProducer(this));
+ this.resultProducers.put(ExtractRequest.class.getName(), new ExtractResultProducer(this));
if (log.isInfoEnabled()) {
log.info("New result repository: " + getId());
@@ -165,9 +149,9 @@
}
@Override
- public Map<String, String> getAvailableZones(CoserRequest request) {
-
- ResultProducer resultProducer = getProducer(request.getClass());
+ public <R extends CoserRequest> Map<String, String> getAvailableZones(R request) {
+ Preconditions.checkNotNull(request);
+ ResultProducer<R> resultProducer = getProducer(request);
Preconditions.checkNotNull(resultProducer);
Map<String, String> result = resultProducer.getAvailableZones(request);
@@ -175,9 +159,9 @@
}
@Override
- public Map<String, String> getAvailableSpecies(CoserRequest request) {
-
- ResultProducer resultProducer = getProducer(request.getClass());
+ public <R extends CoserRequest> Map<String, String> getAvailableSpecies(R request) {
+ Preconditions.checkNotNull(request);
+ ResultProducer<R> resultProducer = getProducer(request);
Preconditions.checkNotNull(resultProducer);
Map<String, String> result = resultProducer.getAvailableSpecies(request);
@@ -185,9 +169,9 @@
}
@Override
- public Map<String, String> getAvailableIndicators(CoserRequest request) {
-
- ResultProducer resultProducer = getProducer(request.getClass());
+ public <R extends CoserRequest> Map<String, String> getAvailableIndicators(R request) {
+ Preconditions.checkNotNull(request);
+ ResultProducer<R> resultProducer = getProducer(request);
Preconditions.checkNotNull(resultProducer);
Map<String, String> result = resultProducer.getAvailableIndicators(request);
@@ -195,74 +179,36 @@
}
@Override
- public boolean acceptResult(CoserRequest request) {
-
+ public <R extends CoserRequest> boolean acceptResult(R request) {
+ Preconditions.checkNotNull(request);
Preconditions.checkArgument(request.isFilled());
- boolean result = false;
-
- if (request instanceof MapRequest) {
-
- // must match facade + zone + species
- MapRequest r = (MapRequest) request;
-
- result = matchFacade(r) &&
- matchZone(r) &&
- matchSpecies(r);
- } else if (request instanceof RawDataRequest) {
-
- // must match facade + zone
- RawDataRequest r = (RawDataRequest) request;
- result = matchFacade(r) && matchZone(r);
-
- } else if (request instanceof CommunityIndicatorRequest) {
-
- // must match facade + zone + (indicator + speciesList)
- CommunityIndicatorRequest r = (CommunityIndicatorRequest) request;
-
- result = matchFacade(r) &&
- matchZone(r) &&
- matchIndicatorAndSpeciesList(r);
- } else if (request instanceof PopulationIndicatorRequest) {
-
- // must match facade + zone + (species + indicator)
- PopulationIndicatorRequest r = (PopulationIndicatorRequest) request;
-
- result = matchFacade(r) &&
- matchZone(r) &&
- matchSpeciesAndIndicator(r);
- } else if (request instanceof ExtractRequest) {
-
- // must match extract type + zone + (species + indicator)
- ExtractRequest r = (ExtractRequest) request;
-
- result = matchExtractTypeSet(r) &&
- matchZoneList(r) &&
- (matchPopulationIndicatorListAndSpeciesList(r) ||
- matchCommunityIndicatorListAndSpeciesList(r));
- }
+ ResultProducer<R> resultProducer = getProducer(request);
+ Preconditions.checkNotNull(resultProducer);
+ boolean result = resultProducer.acceptResult(request);
return result;
}
@Override
- public CoserResult getResult(CoserRequest request) {
-
+ public <R extends CoserRequest> CoserResult getResult(R request) {
+ Preconditions.checkNotNull(request);
Preconditions.checkArgument(request.isFilled());
Preconditions.checkArgument(acceptResult(request));
- ResultProducer resultProducer = getProducer(request.getClass());
+ ResultProducer<R> resultProducer = getProducer(request);
Preconditions.checkNotNull(resultProducer);
CoserResult result = resultProducer.produceResult(request);
return result;
}
- protected <R extends CoserRequest> ResultProducer<R> getProducer(Class<R> requestType) {
- return (ResultProducer<R>) resultProducers.get(requestType);
+ protected <R extends CoserRequest> ResultProducer<R> getProducer(R request) {
+ String requestTypeName = request.getClass().getName();
+ return (ResultProducer<R>) resultProducers.get(requestTypeName);
}
// --------------------------------------------------------------------- //
- // --- Common matchers ------------------------------------------------- //
+ // --- Matchers -------------------------------------------------------- //
// --------------------------------------------------------------------- //
protected boolean matchFacade(CoserRequestFacadeAware request) {
@@ -273,26 +219,6 @@
return project.getZoneName().equals(request.getZone());
}
- // --------------------------------------------------------------------- //
- // --- MapRequest matchers --------------------------------------------- //
- // --------------------------------------------------------------------- //
-
- protected boolean matchSpecies(MapRequest request) {
- String species = request.getSpecies();
- File file = getMapSpeciesFile(species);
- return file != null && file.exists();
- }
-
- // --------------------------------------------------------------------- //
- // --- RawDataRequest matchers ----------------------------------------- //
- // --------------------------------------------------------------------- //
-
- // None
-
- // --------------------------------------------------------------------- //
- // --- IndicatorRequest matchers --------------------------------------- //
- // --------------------------------------------------------------------- //
-
protected boolean matchIndicatorSpecies(String[] tuple, String species) {
String speciesCode = tuple[3];
boolean result = species.equals(speciesCode);
@@ -310,190 +236,21 @@
String indicator) {
String speciesCode = tuple[3];
String indicatorCode = tuple[1];
- boolean result = species.equals(speciesCode) && indicator.equals(indicatorCode);
+ boolean result = species.equals(speciesCode) &&
+ indicator.equals(indicatorCode);
return result;
}
- // --------------------------------------------------------------------- //
- // --- PopulationIndicatorRequest matchers ----------------------------- //
- // --------------------------------------------------------------------- //
-
- protected boolean matchSpecies(PopulationIndicatorRequest request) {
- Preconditions.checkNotNull(request.getSpecies());
-
- String species = request.getSpecies();
-
- boolean result = false;
-
- Iterator<String[]> iterator = loadPopulationIndicatorStorage(true);
- while (iterator.hasNext()) {
- String[] tuple = iterator.next();
- if (matchIndicatorSpecies(tuple, species)) {
- result = true;
- break;
- }
- }
- return result;
- }
-
- protected boolean matchSpeciesAndIndicator(PopulationIndicatorRequest request) {
- Preconditions.checkNotNull(request.getSpecies());
- Preconditions.checkNotNull(request.getIndicator());
-
- String species = request.getSpecies();
- String indicator = request.getIndicator();
-
- boolean result = false;
-
- Iterator<String[]> iterator = loadPopulationIndicatorStorage(true);
- while (iterator.hasNext()) {
- String[] tuple = iterator.next();
- if (matchIndicatorSpeciesAndIndicator(tuple, species, indicator)) {
- result = true;
- break;
- }
- }
- return result;
- }
-
- // --------------------------------------------------------------------- //
- // --- CommunityIndicatorRequest matchers ------------------------------ //
- // --------------------------------------------------------------------- //
-
- protected boolean matchIndicator(CommunityIndicatorRequest request) {
- Preconditions.checkNotNull(request.getIndicator());
-
- String indicator = request.getIndicator();
-
- boolean result = false;
-
- Iterator<String[]> iterator = loadCommunityIndicatorStorage(true);
- while (iterator.hasNext()) {
- String[] tuple = iterator.next();
- if (matchIndicatorIndicator(tuple, indicator)) {
- result = true;
- break;
- }
- }
- return result;
- }
-
- protected boolean matchIndicatorAndSpeciesList(CommunityIndicatorRequest request) {
- Preconditions.checkNotNull(request.getIndicator());
- Preconditions.checkNotNull(request.getSpecies());
-
- String indicator = request.getIndicator();
- String speciesList = request.getSpecies();
-
- boolean result = false;
-
- Iterator<String[]> iterator = loadCommunityIndicatorStorage(true);
- while (iterator.hasNext()) {
- String[] tuple = iterator.next();
- if (matchCommunityIndicatorAndSpeciesList(tuple, indicator, speciesList)) {
- result = true;
- break;
- }
- }
- return result;
- }
-
protected boolean matchCommunityIndicatorAndSpeciesList(String[] tuple,
String indicator,
String speciesList) {
String indicatorCode = tuple[1];
String speciesListCode = tuple[2];
- boolean result = indicator.equals(indicatorCode) && speciesList.equals(speciesListCode);
+ boolean result = indicator.equals(indicatorCode) &&
+ speciesList.equals(speciesListCode);
return result;
}
- // --------------------------------------------------------------------- //
- // --- ExtractRequest matchers ----------------------------------------- //
- // --------------------------------------------------------------------- //
-
- protected boolean matchExtractTypeSet(ExtractRequest request) {
- //TODO Should deal also with raw-data type
- return !request.getExtractTypeList().contains(DataType.SOURCE);
- }
-
- protected boolean matchZoneList(ExtractRequest request) {
- return request.getZoneList().contains(project.getZoneName());
- }
-
- protected boolean matchCommunityIndicatorList(ExtractRequest request) {
- Preconditions.checkNotNull(request.getCommunityIndicatorList());
-
- List<String> indicatorList = request.getCommunityIndicatorList();
-
- boolean result = false;
-
- Iterator<String[]> iterator = loadCommunityIndicatorStorage(true);
- while (iterator.hasNext()) {
- String[] tuple = iterator.next();
- if (matchIndicatorList(tuple, indicatorList)) {
- result = true;
- break;
- }
- }
- return result;
- }
-
- protected boolean matchPopulationIndicatorList(ExtractRequest request) {
- Preconditions.checkNotNull(request.getPopulationIndicatorList());
-
- List<String> indicatorList = request.getPopulationIndicatorList();
-
- boolean result = false;
-
- Iterator<String[]> iterator = loadPopulationIndicatorStorage(true);
- while (iterator.hasNext()) {
- String[] tuple = iterator.next();
- if (matchIndicatorList(tuple, indicatorList)) {
- result = true;
- break;
- }
- }
- return result;
- }
-
- protected boolean matchPopulationIndicatorListAndSpeciesList(ExtractRequest request) {
- Preconditions.checkNotNull(request.getPopulationIndicatorList());
-
- List<String> indicatorList = request.getPopulationIndicatorList();
- List<String> speciesList = request.getSpeciesList();
-
- boolean result = false;
-
- Iterator<String[]> iterator = loadPopulationIndicatorStorage(true);
- while (iterator.hasNext()) {
- String[] tuple = iterator.next();
- if (matchIndicatorListAndSpeciesList(tuple, indicatorList, speciesList)) {
- result = true;
- break;
- }
- }
- return result;
- }
-
- protected boolean matchCommunityIndicatorListAndSpeciesList(ExtractRequest request) {
- Preconditions.checkNotNull(request.getCommunityIndicatorList());
-
- List<String> indicatorList = request.getCommunityIndicatorList();
- List<String> speciesList = request.getSpeciesList();
-
- boolean result = false;
-
- Iterator<String[]> iterator = loadCommunityIndicatorStorage(true);
- while (iterator.hasNext()) {
- String[] tuple = iterator.next();
- if (matchIndicatorListAndSpeciesList(tuple, indicatorList, speciesList)) {
- result = true;
- break;
- }
- }
- return result;
- }
-
protected boolean matchIndicatorList(String[] tuple, List<String> indicatorList) {
String indicatorCode = tuple[1];
boolean result = indicatorList.contains(indicatorCode);
@@ -505,7 +262,8 @@
List<String> speciesList) {
String indicatorCode = tuple[1];
String speciesCode = tuple[3];
- boolean result = indicatorList.contains(indicatorCode) && speciesList.contains(speciesCode);
+ boolean result = indicatorList.contains(indicatorCode) &&
+ speciesList.contains(speciesCode);
return result;
}
@@ -613,26 +371,18 @@
protected SpeciesMap getSpeciesMap() {
if (speciesMap == null) {
-
File file = project.getSpeciesDefinitionFile();
-
speciesMap = new SpeciesMap(file);
}
return speciesMap;
}
protected IndicatorMap getIndicatorsMap() {
- if (indicatorsMap == null) {
- indicatorsMap = new IndicatorMap(config.getWebIndicatorsFile());
- }
- return indicatorsMap;
+ return serviceContext.getIndicatorsMap();
}
public ZoneMap getZonesMap() {
- if (zonesMap == null) {
- zonesMap = new ZoneMap(config.getWebZonesFile());
- }
- return zonesMap;
+ return serviceContext.getZonesMap();
}
// --------------------------------------------------------------------- //
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/EchoBaseResultRepositoryProvider.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/EchoBaseResultRepositoryProvider.java 2014-03-11 14:45:05 UTC (rev 1143)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/EchoBaseResultRepositoryProvider.java 2014-03-11 16:45:58 UTC (rev 1144)
@@ -24,7 +24,7 @@
import com.google.common.base.Preconditions;
import com.google.common.collect.Sets;
-import fr.ifremer.coser.CoserBusinessConfig;
+import fr.ifremer.coser.CoserServiceContext;
import fr.ifremer.coser.bean.EchoBaseProject;
import fr.ifremer.coser.result.ResultRepositoryInitializationException;
import fr.ifremer.coser.result.repository.ResultRepositoryProvider;
@@ -55,17 +55,13 @@
*/
protected final File basedir;
- protected final CoserBusinessConfig config;
-
- public EchoBaseResultRepositoryProvider(CoserBusinessConfig config, File basedir) {
- this.config = config;
- Preconditions.checkNotNull(config);
+ public EchoBaseResultRepositoryProvider(File basedir) {
Preconditions.checkNotNull(basedir);
this.basedir = basedir;
}
@Override
- public Set<EchoBaseResultRepository> loadRepositories() {
+ public Set<EchoBaseResultRepository> loadRepositories(CoserServiceContext serviceContext) {
if (log.isInfoEnabled()) {
log.info(String.format("Scan for projects from basedir: %s", basedir));
@@ -96,7 +92,7 @@
} catch (IOException e) {
throw new ResultRepositoryInitializationException(this, "Could not load project file", e);
}
- result.add(new EchoBaseResultRepository(config, project));
+ result.add(new EchoBaseResultRepository(serviceContext, project));
}
}
if (log.isInfoEnabled()) {
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/ExtractResultProducer.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/ExtractResultProducer.java 2014-03-11 14:45:05 UTC (rev 1143)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/ExtractResultProducer.java 2014-03-11 16:45:58 UTC (rev 1144)
@@ -102,6 +102,14 @@
}
@Override
+ public boolean acceptResult(ExtractRequest request) {
+ return matchExtractTypeSet(request) &&
+ matchZoneList(request) &&
+ (matchPopulationIndicatorListAndSpeciesList(request) ||
+ matchCommunityIndicatorListAndSpeciesList(request));
+ }
+
+ @Override
public Map<String, String> getAvailableZones(ExtractRequest request) {
ZoneMap zonesMap = repository.getZonesMap();
@@ -114,7 +122,7 @@
public Map<String, String> getAvailableSpecies(ExtractRequest request) {
Preconditions.checkNotNull(request.getZoneList());
- boolean match = repository.matchZoneList(request);
+ boolean match = matchZoneList(request);
Map<String, String> result = null;
if (match) {
@@ -136,7 +144,7 @@
Map<String, String> result = null;
- boolean match = repository.matchZoneList(request);
+ boolean match = matchZoneList(request);
if (match) {
Set<String> indicatorList = null;
@@ -682,4 +690,91 @@
return result;
}
+
+ // --------------------------------------------------------------------- //
+ // --- Matchers -------------------------------------------------------- //
+ // --------------------------------------------------------------------- //
+
+ protected boolean matchExtractTypeSet(ExtractRequest request) {
+ //TODO Should deal also with raw-data type
+ return !request.getExtractTypeList().contains(DataType.SOURCE);
+ }
+
+ protected boolean matchZoneList(ExtractRequest request) {
+ return request.getZoneList().contains(project.getZoneName());
+ }
+
+ protected boolean matchCommunityIndicatorList(ExtractRequest request) {
+ Preconditions.checkNotNull(request.getCommunityIndicatorList());
+
+ List<String> indicatorList = request.getCommunityIndicatorList();
+
+ boolean result = false;
+
+ Iterator<String[]> iterator = repository.loadCommunityIndicatorStorage(true);
+ while (iterator.hasNext()) {
+ String[] tuple = iterator.next();
+ if (repository.matchIndicatorList(tuple, indicatorList)) {
+ result = true;
+ break;
+ }
+ }
+ return result;
+ }
+
+ protected boolean matchPopulationIndicatorList(ExtractRequest request) {
+ Preconditions.checkNotNull(request.getPopulationIndicatorList());
+
+ List<String> indicatorList = request.getPopulationIndicatorList();
+
+ boolean result = false;
+
+ Iterator<String[]> iterator = repository.loadPopulationIndicatorStorage(true);
+ while (iterator.hasNext()) {
+ String[] tuple = iterator.next();
+ if (repository.matchIndicatorList(tuple, indicatorList)) {
+ result = true;
+ break;
+ }
+ }
+ return result;
+ }
+
+ protected boolean matchPopulationIndicatorListAndSpeciesList(ExtractRequest request) {
+ Preconditions.checkNotNull(request.getPopulationIndicatorList());
+
+ List<String> indicatorList = request.getPopulationIndicatorList();
+ List<String> speciesList = request.getSpeciesList();
+
+ boolean result = false;
+
+ Iterator<String[]> iterator = repository.loadPopulationIndicatorStorage(true);
+ while (iterator.hasNext()) {
+ String[] tuple = iterator.next();
+ if (repository.matchIndicatorListAndSpeciesList(tuple, indicatorList, speciesList)) {
+ result = true;
+ break;
+ }
+ }
+ return result;
+ }
+
+ protected boolean matchCommunityIndicatorListAndSpeciesList(ExtractRequest request) {
+ Preconditions.checkNotNull(request.getCommunityIndicatorList());
+
+ List<String> indicatorList = request.getCommunityIndicatorList();
+ List<String> speciesList = request.getSpeciesList();
+
+ boolean result = false;
+
+ Iterator<String[]> iterator = repository.loadCommunityIndicatorStorage(true);
+ while (iterator.hasNext()) {
+ String[] tuple = iterator.next();
+ if (repository.matchIndicatorListAndSpeciesList(tuple, indicatorList, speciesList)) {
+ result = true;
+ break;
+ }
+ }
+ return result;
+ }
}
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/MapResultProducer.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/MapResultProducer.java 2014-03-11 14:45:05 UTC (rev 1143)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/MapResultProducer.java 2014-03-11 16:45:58 UTC (rev 1144)
@@ -58,6 +58,13 @@
}
@Override
+ public boolean acceptResult(MapRequest request) {
+ return repository.matchFacade(request) &&
+ repository.matchZone(request) &&
+ matchSpecies(request);
+ }
+
+ @Override
public Map<String, String> getAvailableZones(MapRequest request) {
Preconditions.checkNotNull(request.getFacade());
@@ -105,4 +112,13 @@
return result;
}
+ // --------------------------------------------------------------------- //
+ // --- Matchers -------------------------------------------------------- //
+ // --------------------------------------------------------------------- //
+
+ protected boolean matchSpecies(MapRequest request) {
+ String species = request.getSpecies();
+ File file = repository.getMapSpeciesFile(species);
+ return file != null && file.exists();
+ }
}
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/PopulationIndicatorResultProducer.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/PopulationIndicatorResultProducer.java 2014-03-11 14:45:05 UTC (rev 1143)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/PopulationIndicatorResultProducer.java 2014-03-11 16:45:58 UTC (rev 1144)
@@ -82,6 +82,13 @@
}
@Override
+ public boolean acceptResult(PopulationIndicatorRequest request) {
+ return repository.matchFacade(request) &&
+ repository.matchZone(request) &&
+ matchSpeciesAndIndicator(request);
+ }
+
+ @Override
public Map<String, String> getAvailableZones(PopulationIndicatorRequest request) {
boolean match = repository.matchFacade(request);
@@ -289,4 +296,46 @@
return result;
}
+ // --------------------------------------------------------------------- //
+ // --- Matchers -------------------------------------------------------- //
+ // --------------------------------------------------------------------- //
+
+ protected boolean matchSpecies(PopulationIndicatorRequest request) {
+ Preconditions.checkNotNull(request.getSpecies());
+
+ String species = request.getSpecies();
+
+ boolean result = false;
+
+ Iterator<String[]> iterator = repository.loadPopulationIndicatorStorage(true);
+ while (iterator.hasNext()) {
+ String[] tuple = iterator.next();
+ if (repository.matchIndicatorSpecies(tuple, species)) {
+ result = true;
+ break;
+ }
+ }
+ return result;
+ }
+
+ protected boolean matchSpeciesAndIndicator(PopulationIndicatorRequest request) {
+ Preconditions.checkNotNull(request.getSpecies());
+ Preconditions.checkNotNull(request.getIndicator());
+
+ String species = request.getSpecies();
+ String indicator = request.getIndicator();
+
+ boolean result = false;
+
+ Iterator<String[]> iterator = repository.loadPopulationIndicatorStorage(true);
+ while (iterator.hasNext()) {
+ String[] tuple = iterator.next();
+ if (repository.matchIndicatorSpeciesAndIndicator(tuple, species, indicator)) {
+ result = true;
+ break;
+ }
+ }
+ return result;
+ }
+
}
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/RawDataResultProducer.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/RawDataResultProducer.java 2014-03-11 14:45:05 UTC (rev 1143)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/RawDataResultProducer.java 2014-03-11 16:45:58 UTC (rev 1144)
@@ -57,6 +57,12 @@
}
@Override
+ public boolean acceptResult(RawDataRequest request) {
+ return repository.matchFacade(request) &&
+ repository.matchZone(request);
+ }
+
+ @Override
public Map<String, String> getAvailableZones(RawDataRequest request) {
Preconditions.checkNotNull(request.getFacade());
@@ -88,4 +94,10 @@
throw RequestUnavailableForProducerException.newException("produceResult", this);
}
+
+ // --------------------------------------------------------------------- //
+ // --- Matchers ------------------------------------------------------- //
+ // --------------------------------------------------------------------- //
+
+ //TODO
}
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/CommunityIndicatorResultProducer.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/CommunityIndicatorResultProducer.java 2014-03-11 14:45:05 UTC (rev 1143)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/CommunityIndicatorResultProducer.java 2014-03-11 16:45:58 UTC (rev 1144)
@@ -100,6 +100,14 @@
}
@Override
+ public boolean acceptResult(CommunityIndicatorRequest request) {
+ return repository.indicatorsResult &&
+ repository.matchFacade(request) &&
+ repository.matchZone(request) &&
+ matchIndicatorAndSpeciesList(request);
+ }
+
+ @Override
public Map<String, String> getAvailableZones(CommunityIndicatorRequest request) {
Preconditions.checkNotNull(request.getFacade());
@@ -125,7 +133,7 @@
boolean match = repository.indicatorsResult &&
repository.matchFacade(request) &&
repository.matchZone(request) &&
- repository.matchIndicator(request);
+ matchIndicator(request);
if (match) {
// get all map species for given facade + zone
@@ -402,4 +410,46 @@
return result;
}
+
+ // --------------------------------------------------------------------- //
+ // --- Matchers ------------------------------------------------------- //
+ // --------------------------------------------------------------------- //
+
+ protected boolean matchIndicator(CommunityIndicatorRequest request) {
+ Preconditions.checkNotNull(request.getIndicator());
+
+ String indicator = request.getIndicator();
+
+ boolean result = false;
+
+ Iterator<String[]> iterator = repository.loadCommunityIndicatorStorage(true);
+ while (iterator.hasNext()) {
+ String[] tuple = iterator.next();
+ if (repository.matchCommunityIndicator(tuple, indicator)) {
+ result = true;
+ break;
+ }
+ }
+ return result;
+ }
+
+ protected boolean matchIndicatorAndSpeciesList(CommunityIndicatorRequest request) {
+ Preconditions.checkNotNull(request.getIndicator());
+ Preconditions.checkNotNull(request.getSpecies());
+
+ String indicator = request.getIndicator();
+ String speciesList = request.getSpecies();
+
+ boolean result = false;
+
+ Iterator<String[]> iterator = repository.loadCommunityIndicatorStorage(true);
+ while (iterator.hasNext()) {
+ String[] tuple = iterator.next();
+ if (repository.matchCommunityIndicatorAndSpeciesList(tuple, indicator, speciesList)) {
+ result = true;
+ break;
+ }
+ }
+ return result;
+ }
}
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/ExtractResultProducer.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/ExtractResultProducer.java 2014-03-11 14:45:05 UTC (rev 1143)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/ExtractResultProducer.java 2014-03-11 16:45:58 UTC (rev 1144)
@@ -112,6 +112,14 @@
}
@Override
+ public boolean acceptResult(ExtractRequest request) {
+ return matchExtractTypeSet(request) &&
+ matchZoneList(request) &&
+ (matchPopulationIndicatorListAndSpeciesList(request) ||
+ matchCommunityIndicatorListAndSpeciesList(request));
+ }
+
+ @Override
public Map<String, String> getAvailableZones(ExtractRequest request) {
ZoneMap zonesMap = repository.getZonesMap();
@@ -126,7 +134,7 @@
Map<String, String> result = null;
- boolean match = repository.matchZoneList(request);
+ boolean match = matchZoneList(request);
if (match) {
result = Maps.newHashMap();
@@ -146,7 +154,7 @@
Map<String, String> result = null;
- boolean match = repository.matchZoneList(request);
+ boolean match = matchZoneList(request);
if (match) {
Set<String> indicatorList = null;
@@ -727,4 +735,101 @@
return result;
}
+
+ // --------------------------------------------------------------------- //
+ // --- Matchers ------------------------------------------------------- //
+ // --------------------------------------------------------------------- //
+
+ protected boolean matchExtractTypeSet(ExtractRequest request) {
+ boolean result = false;
+ if (repository.mapsResult) {
+ result = request.getExtractTypeList().contains(DataType.SOURCE);
+ }
+ if (repository.indicatorsResult) {
+ result = request.getExtractTypeList().contains(DataType.POPULATION) ||
+ request.getExtractTypeList().contains(DataType.COMMUNITY);
+ }
+ if (repository.dataResult) {
+ result = request.getExtractTypeList().contains(DataType.SOURCE);
+ }
+ return result;
+ }
+
+ protected boolean matchZoneList(ExtractRequest request) {
+ return request.getZoneList().contains(path.getRsufiResult().getZone());
+ }
+
+ protected boolean matchCommunityIndicatorList(ExtractRequest request) {
+ Preconditions.checkNotNull(request.getCommunityIndicatorList());
+
+ List<String> indicatorList = request.getCommunityIndicatorList();
+
+ boolean result = false;
+
+ Iterator<String[]> iterator = repository.loadCommunityIndicatorStorage(true);
+ while (iterator.hasNext()) {
+ String[] tuple = iterator.next();
+ if (repository.matchIndicatorList(tuple, indicatorList)) {
+ result = true;
+ break;
+ }
+ }
+ return result;
+ }
+
+ protected boolean matchPopulationIndicatorList(ExtractRequest request) {
+ Preconditions.checkNotNull(request.getPopulationIndicatorList());
+
+ List<String> indicatorList = request.getPopulationIndicatorList();
+
+ boolean result = false;
+
+ Iterator<String[]> iterator = repository.loadPopulationIndicatorStorage(true);
+ while (iterator.hasNext()) {
+ String[] tuple = iterator.next();
+ if (repository.matchIndicatorList(tuple, indicatorList)) {
+ result = true;
+ break;
+ }
+ }
+ return result;
+ }
+
+ protected boolean matchPopulationIndicatorListAndSpeciesList(ExtractRequest request) {
+ Preconditions.checkNotNull(request.getPopulationIndicatorList());
+
+ List<String> indicatorList = request.getPopulationIndicatorList();
+ List<String> speciesList = request.getSpeciesList();
+
+ boolean result = false;
+
+ Iterator<String[]> iterator = repository.loadPopulationIndicatorStorage(true);
+ while (iterator.hasNext()) {
+ String[] tuple = iterator.next();
+ if (repository.matchIndicatorListAndSpeciesList(tuple, indicatorList, speciesList)) {
+ result = true;
+ break;
+ }
+ }
+ return result;
+ }
+
+ protected boolean matchCommunityIndicatorListAndSpeciesList(ExtractRequest request) {
+ Preconditions.checkNotNull(request.getCommunityIndicatorList());
+
+ List<String> indicatorList = request.getCommunityIndicatorList();
+ List<String> speciesList = request.getSpeciesList();
+
+ boolean result = false;
+
+ Iterator<String[]> iterator = repository.loadCommunityIndicatorStorage(true);
+ while (iterator.hasNext()) {
+ String[] tuple = iterator.next();
+ if (repository.matchIndicatorListAndSpeciesList(tuple, indicatorList, speciesList)) {
+ result = true;
+ break;
+ }
+ }
+ return result;
+ }
}
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/LegacyResultRepository.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/LegacyResultRepository.java 2014-03-11 14:45:05 UTC (rev 1143)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/LegacyResultRepository.java 2014-03-11 16:45:58 UTC (rev 1144)
@@ -28,6 +28,7 @@
import com.google.common.collect.Sets;
import fr.ifremer.coser.CoserBusinessConfig;
import fr.ifremer.coser.CoserConstants;
+import fr.ifremer.coser.CoserServiceContext;
import fr.ifremer.coser.bean.EchoBaseProject;
import fr.ifremer.coser.bean.IndicatorMap;
import fr.ifremer.coser.bean.RSufiResultPath;
@@ -49,7 +50,6 @@
import fr.ifremer.coser.services.ProjectService;
import fr.ifremer.coser.storage.DataStorage;
import fr.ifremer.coser.storage.DataStorages;
-import fr.ifremer.coser.util.DataType;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
@@ -117,9 +117,9 @@
protected final FilenameFilter mapSpeciesFilenameFilter;
/**
- * Application config.
+ * Service context.
*/
- protected final CoserBusinessConfig config;
+ protected final CoserServiceContext serviceContext;
/**
* Survey name (used to get maps).
@@ -137,16 +137,6 @@
protected SpeciesListMap speciesListMap;
/**
- * Cache of indicator definition.
- */
- protected IndicatorMap indicatorsMap;
-
- /**
- * Cache of zone definition.
- */
- protected ZoneMap zonesMap;
-
- /**
* Is the result contains maps ?
*/
protected final boolean mapsResult;
@@ -166,19 +156,19 @@
*/
protected final Reports reports;
- protected final Map<Class<?>, ResultProducer<?>> resultProducers;
+ protected final Map<String, ResultProducer<?>> resultProducers;
protected final ProjectService projectService;
- public LegacyResultRepository(CoserBusinessConfig config,
+ public LegacyResultRepository(CoserServiceContext serviceContext,
File basedir,
RSufiResultPath path,
String surveyName) {
- Preconditions.checkNotNull(config);
+ Preconditions.checkNotNull(serviceContext);
Preconditions.checkNotNull(basedir);
Preconditions.checkNotNull(path);
Preconditions.checkNotNull(surveyName);
- this.config = config;
+ this.serviceContext = serviceContext;
this.basedir = basedir;
this.surveyName = surveyName;
this.resultDirectory = FileUtils.getFile(
@@ -197,13 +187,13 @@
this.mapFileToSpeciesCode = EchoBaseProject.newMapFileToSpeciesCode(surveyName);
this.speciesCodeToMapFile = EchoBaseProject.newSpeciesCodeToMapFileName(surveyName);
this.mapSpeciesFilenameFilter = EchoBaseProject.newMapSpeciesFilenameFilter(surveyName);
- this.projectService = new ProjectService(config);
+ this.projectService = new ProjectService(serviceContext.getConfig());
this.resultProducers = Maps.newHashMap();
- this.resultProducers.put(MapRequest.class, new MapResultProducer(this));
- this.resultProducers.put(CommunityIndicatorRequest.class, new CommunityIndicatorResultProducer(this));
- this.resultProducers.put(PopulationIndicatorRequest.class, new PopulationIndicatorResultProducer(this));
- this.resultProducers.put(RawDataRequest.class, new RawDataResultProducer(this));
- this.resultProducers.put(ExtractRequest.class, new ExtractResultProducer(this));
+ this.resultProducers.put(MapRequest.class.getName(), new MapResultProducer(this));
+ this.resultProducers.put(CommunityIndicatorRequest.class.getName(), new CommunityIndicatorResultProducer(this));
+ this.resultProducers.put(PopulationIndicatorRequest.class.getName(), new PopulationIndicatorResultProducer(this));
+ this.resultProducers.put(RawDataRequest.class.getName(), new RawDataResultProducer(this));
+ this.resultProducers.put(ExtractRequest.class.getName(), new ExtractResultProducer(this));
if (log.isInfoEnabled()) {
log.info("New result repository: " + getId());
@@ -224,19 +214,19 @@
}
@Override
- public Map<String, String> getAvailableZones(CoserRequest request) {
-
- ResultProducer resultProducer = getProducer(request.getClass());
+ public <R extends CoserRequest> Map<String, String> getAvailableZones(R request) {
+ Preconditions.checkNotNull(request);
+ ResultProducer<R> resultProducer = getProducer(request);
Preconditions.checkNotNull(resultProducer);
- Map result = resultProducer.getAvailableZones(request);
+ Map<String, String> result = resultProducer.getAvailableZones(request);
return result;
}
@Override
- public Map<String, String> getAvailableSpecies(CoserRequest request) {
-
- ResultProducer resultProducer = getProducer(request.getClass());
+ public <R extends CoserRequest> Map<String, String> getAvailableSpecies(R request) {
+ Preconditions.checkNotNull(request);
+ ResultProducer<R> resultProducer = getProducer(request);
Preconditions.checkNotNull(resultProducer);
Map<String, String> result = resultProducer.getAvailableSpecies(request);
@@ -244,9 +234,9 @@
}
@Override
- public Map<String, String> getAvailableIndicators(CoserRequest request) {
-
- ResultProducer resultProducer = getProducer(request.getClass());
+ public <R extends CoserRequest> Map<String, String> getAvailableIndicators(R request) {
+ Preconditions.checkNotNull(request);
+ ResultProducer<R> resultProducer = getProducer(request);
Preconditions.checkNotNull(resultProducer);
Map<String, String> result = resultProducer.getAvailableIndicators(request);
@@ -254,76 +244,31 @@
}
@Override
- public boolean acceptResult(CoserRequest request) {
-
+ public <R extends CoserRequest> boolean acceptResult(R request) {
+ Preconditions.checkNotNull(request);
Preconditions.checkArgument(request.isFilled());
- boolean result = false;
-
- if (request instanceof MapRequest) {
-
- // must match facade + zone + species
- MapRequest r = (MapRequest) request;
-
- result = mapsResult &&
- matchFacade(r) &&
- matchZone(r) &&
- matchSpecies(r);
- } else if (request instanceof RawDataRequest) {
-
- // must match facade + zone
- RawDataRequest r = (RawDataRequest) request;
- result = dataResult && matchFacade(r) && matchZone(r);
-
- } else if (request instanceof CommunityIndicatorRequest) {
-
- // must match facade + zone + (indicator + speciesList)
- CommunityIndicatorRequest r = (CommunityIndicatorRequest) request;
-
- result = indicatorsResult &&
- matchFacade(r) &&
- matchZone(r) &&
- matchIndicatorAndSpeciesList(r);
- } else if (request instanceof PopulationIndicatorRequest) {
-
- // must match facade + zone + (species + indicator)
- PopulationIndicatorRequest r = (PopulationIndicatorRequest) request;
-
- result = indicatorsResult &&
- matchFacade(r) &&
- matchZone(r) &&
- matchSpeciesAndIndicator(r);
- } else if (request instanceof ExtractRequest) {
-
- // must match extract type + zone + (species + indicator)
- ExtractRequest r = (ExtractRequest) request;
-
- result = matchExtractTypeSet(r) &&
- matchZoneList(r) &&
- (matchPopulationIndicatorListAndSpeciesList(r) ||
- matchCommunityIndicatorListAndSpeciesList(r));
- }
+ ResultProducer<R> resultProducer = getProducer(request);
+ Preconditions.checkNotNull(resultProducer);
+ boolean result = resultProducer.acceptResult(request);
return result;
}
@Override
- public CoserResult getResult(CoserRequest request) {
+ public <R extends CoserRequest> CoserResult getResult(R request) {
+ Preconditions.checkNotNull(request);
Preconditions.checkArgument(request.isFilled());
Preconditions.checkArgument(acceptResult(request));
- ResultProducer resultProducer = getProducer(request.getClass());
+ ResultProducer<R> resultProducer = getProducer(request);
Preconditions.checkNotNull(resultProducer);
CoserResult result = resultProducer.produceResult(request);
return result;
}
- protected <R extends CoserRequest> ResultProducer<R> getProducer(Class<R> requestType) {
- return (ResultProducer<R>) resultProducers.get(requestType);
- }
-
// --------------------------------------------------------------------- //
- // --- Common matchers ------------------------------------------------- //
+ // --- Matchers -------------------------------------------------------- //
// --------------------------------------------------------------------- //
protected boolean matchFacade(CoserRequestFacadeAware request) {
@@ -334,66 +279,6 @@
return path.getRsufiResult().getZone().equals(request.getZone());
}
- // --------------------------------------------------------------------- //
- // --- MapRequest matchers --------------------------------------------- //
- // --------------------------------------------------------------------- //
-
- protected boolean matchSpecies(MapRequest request) {
- String species = request.getSpecies();
- File file = getMapSpeciesFile(species);
- return file != null;
- }
-
- // --------------------------------------------------------------------- //
- // --- RawDataRequest matchers ----------------------------------------- //
- // --------------------------------------------------------------------- //
-
- protected boolean matchZone(RawDataRequest request) {
- return path.getRsufiResult().getZone().equals(request.getZone());
- }
-
- // --------------------------------------------------------------------- //
- // --- PopulationIndicatorRequest matchers ----------------------------- //
- // --------------------------------------------------------------------- //
-
- protected boolean matchSpecies(PopulationIndicatorRequest request) {
- Preconditions.checkNotNull(request.getSpecies());
-
- String species = request.getSpecies();
-
- boolean result = false;
-
- Iterator<String[]> iterator = loadPopulationIndicatorStorage(true);
- while (iterator.hasNext()) {
- String[] tuple = iterator.next();
- if (matchPopulationSpecies(tuple, species)) {
- result = true;
- break;
- }
- }
- return result;
- }
-
- protected boolean matchSpeciesAndIndicator(PopulationIndicatorRequest request) {
- Preconditions.checkNotNull(request.getSpecies());
- Preconditions.checkNotNull(request.getIndicator());
-
- String species = request.getSpecies();
- String indicator = request.getIndicator();
-
- boolean result = false;
-
- Iterator<String[]> iterator = loadPopulationIndicatorStorage(true);
- while (iterator.hasNext()) {
- String[] tuple = iterator.next();
- if (matchPopulationSpeciesAndIndicator(tuple, species, indicator)) {
- result = true;
- break;
- }
- }
- return result;
- }
-
protected boolean matchPopulationSpecies(String[] tuple, String species) {
String speciesCode = tuple[3];
boolean result = species.equals(speciesCode);
@@ -406,48 +291,6 @@
return result;
}
- // --------------------------------------------------------------------- //
- // --- CommunityIndicatorRequest matchers ------------------------------ //
- // --------------------------------------------------------------------- //
-
- protected boolean matchIndicator(CommunityIndicatorRequest request) {
- Preconditions.checkNotNull(request.getIndicator());
-
- String indicator = request.getIndicator();
-
- boolean result = false;
-
- Iterator<String[]> iterator = loadCommunityIndicatorStorage(true);
- while (iterator.hasNext()) {
- String[] tuple = iterator.next();
- if (matchCommunityIndicator(tuple, indicator)) {
- result = true;
- break;
- }
- }
- return result;
- }
-
- protected boolean matchIndicatorAndSpeciesList(CommunityIndicatorRequest request) {
- Preconditions.checkNotNull(request.getIndicator());
- Preconditions.checkNotNull(request.getSpecies());
-
- String indicator = request.getIndicator();
- String speciesList = request.getSpecies();
-
- boolean result = false;
-
- Iterator<String[]> iterator = loadCommunityIndicatorStorage(true);
- while (iterator.hasNext()) {
- String[] tuple = iterator.next();
- if (matchCommunityIndicatorAndSpeciesList(tuple, indicator, speciesList)) {
- result = true;
- break;
- }
- }
- return result;
- }
-
protected boolean matchCommunityIndicator(String[] tuple, String indicator) {
String indicatorCode = tuple[1];
boolean result = indicator.equals(indicatorCode);
@@ -461,103 +304,6 @@
return result;
}
- // --------------------------------------------------------------------- //
- // --- ExtractRequest matchers ----------------------------------------- //
- // --------------------------------------------------------------------- //
-
- protected boolean matchExtractTypeSet(ExtractRequest request) {
- boolean result = false;
- if (mapsResult) {
- result = request.getExtractTypeList().contains(DataType.SOURCE);
- }
- if (indicatorsResult) {
- result = request.getExtractTypeList().contains(DataType.POPULATION) ||
- request.getExtractTypeList().contains(DataType.COMMUNITY);
- }
- if (dataResult) {
- result = request.getExtractTypeList().contains(DataType.SOURCE);
- }
- return result;
- }
-
- protected boolean matchZoneList(ExtractRequest request) {
- return request.getZoneList().contains(path.getRsufiResult().getZone());
- }
-
- protected boolean matchCommunityIndicatorList(ExtractRequest request) {
- Preconditions.checkNotNull(request.getCommunityIndicatorList());
-
- List<String> indicatorList = request.getCommunityIndicatorList();
-
- boolean result = false;
-
- Iterator<String[]> iterator = loadCommunityIndicatorStorage(true);
- while (iterator.hasNext()) {
- String[] tuple = iterator.next();
- if (matchIndicatorList(tuple, indicatorList)) {
- result = true;
- break;
- }
- }
- return result;
- }
-
- protected boolean matchPopulationIndicatorList(ExtractRequest request) {
- Preconditions.checkNotNull(request.getPopulationIndicatorList());
-
- List<String> indicatorList = request.getPopulationIndicatorList();
-
- boolean result = false;
-
- Iterator<String[]> iterator = loadPopulationIndicatorStorage(true);
- while (iterator.hasNext()) {
- String[] tuple = iterator.next();
- if (matchIndicatorList(tuple, indicatorList)) {
- result = true;
- break;
- }
- }
- return result;
- }
-
- protected boolean matchPopulationIndicatorListAndSpeciesList(ExtractRequest request) {
- Preconditions.checkNotNull(request.getPopulationIndicatorList());
-
- List<String> indicatorList = request.getPopulationIndicatorList();
- List<String> speciesList = request.getSpeciesList();
-
- boolean result = false;
-
- Iterator<String[]> iterator = loadPopulationIndicatorStorage(true);
- while (iterator.hasNext()) {
- String[] tuple = iterator.next();
- if (matchIndicatorListAndSpeciesList(tuple, indicatorList, speciesList)) {
- result = true;
- break;
- }
- }
- return result;
- }
-
- protected boolean matchCommunityIndicatorListAndSpeciesList(ExtractRequest request) {
- Preconditions.checkNotNull(request.getCommunityIndicatorList());
-
- List<String> indicatorList = request.getCommunityIndicatorList();
- List<String> speciesList = request.getSpeciesList();
-
- boolean result = false;
-
- Iterator<String[]> iterator = loadCommunityIndicatorStorage(true);
- while (iterator.hasNext()) {
- String[] tuple = iterator.next();
- if (matchIndicatorListAndSpeciesList(tuple, indicatorList, speciesList)) {
- result = true;
- break;
- }
- }
- return result;
- }
-
protected boolean matchIndicatorList(String[] tuple, List<String> indicatorList) {
String indicatorCode = tuple[1];
boolean result = indicatorList.contains(indicatorCode);
@@ -706,17 +452,11 @@
}
protected IndicatorMap getIndicatorsMap() {
- if (indicatorsMap == null) {
- indicatorsMap = new IndicatorMap(config.getWebIndicatorsFile());
- }
- return indicatorsMap;
+ return serviceContext.getIndicatorsMap();
}
public ZoneMap getZonesMap() {
- if (zonesMap == null) {
- zonesMap = new ZoneMap(config.getWebZonesFile());
- }
- return zonesMap;
+ return serviceContext.getZonesMap();
}
// --------------------------------------------------------------------- //
@@ -739,4 +479,12 @@
return iterator;
}
+ protected <R extends CoserRequest> ResultProducer<R> getProducer(R request) {
+ String requestTypeName = request.getClass().getName();
+ return (ResultProducer<R>) resultProducers.get(requestTypeName);
+ }
+
+ protected CoserBusinessConfig getConfig() {
+ return serviceContext.getConfig();
+ }
}
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/LegacyResultRepositoryProvider.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/LegacyResultRepositoryProvider.java 2014-03-11 14:45:05 UTC (rev 1143)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/LegacyResultRepositoryProvider.java 2014-03-11 16:45:58 UTC (rev 1144)
@@ -24,9 +24,9 @@
import com.google.common.base.Preconditions;
import com.google.common.collect.Sets;
-import fr.ifremer.coser.CoserBusinessConfig;
import fr.ifremer.coser.CoserBusinessException;
import fr.ifremer.coser.CoserConstants;
+import fr.ifremer.coser.CoserServiceContext;
import fr.ifremer.coser.bean.Project;
import fr.ifremer.coser.bean.RSufiResult;
import fr.ifremer.coser.bean.RSufiResultPath;
@@ -56,27 +56,20 @@
*/
protected final File basedir;
- protected final ProjectService projectService;
-
- protected final CoserBusinessConfig config;
-
- public LegacyResultRepositoryProvider(CoserBusinessConfig config, File basedir) {
- this.config = config;
- Preconditions.checkNotNull(config);
+ public LegacyResultRepositoryProvider(File basedir) {
Preconditions.checkNotNull(basedir);
- this.projectService = new ProjectService(config);
this.basedir = basedir;
}
@Override
- public Set<LegacyResultRepository> loadRepositories() {
+ public Set<LegacyResultRepository> loadRepositories(CoserServiceContext serviceContext) {
if (log.isInfoEnabled()) {
log.info(String.format("Scan for projects from basedir: %s", basedir));
}
Set<LegacyResultRepository> result;
try {
- result = findAllProjectWithResult();
+ result = findAllProjectWithResult(serviceContext);
} catch (CoserBusinessException e) {
throw new ResultRepositoryInitializationException(this, "Could not find projects", e);
}
@@ -93,10 +86,14 @@
* De la forme d'une liste de de path (à la tree path) :
* ProjetName/SelectionName/ResultName
*
+ * @param serviceContext service context
* @return results paths
* @throws CoserBusinessException
*/
- public Set<LegacyResultRepository> findAllProjectWithResult() throws CoserBusinessException {
+ public Set<LegacyResultRepository> findAllProjectWithResult(CoserServiceContext serviceContext) throws CoserBusinessException {
+
+ ProjectService projectService = new ProjectService(serviceContext.getConfig());
+
Set<LegacyResultRepository> result = Sets.newHashSet();
// loop on projets
File[] projects = basedir.listFiles();
@@ -131,7 +128,7 @@
}
String surveyName = projectService.getProjectSurveyName(rSufiResult, r);
- LegacyResultRepository repository = new LegacyResultRepository(config, existingProject, path, surveyName);
+ LegacyResultRepository repository = new LegacyResultRepository(serviceContext, existingProject, path, surveyName);
if (log.isInfoEnabled()) {
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/MapResultProducer.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/MapResultProducer.java 2014-03-11 14:45:05 UTC (rev 1143)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/MapResultProducer.java 2014-03-11 16:45:58 UTC (rev 1144)
@@ -57,6 +57,14 @@
}
@Override
+ public boolean acceptResult(MapRequest request) {
+ return repository.mapsResult &&
+ repository.matchFacade(request) &&
+ repository.matchZone(request) &&
+ matchSpecies(request);
+ }
+
+ @Override
public Map<String, String> getAvailableZones(MapRequest request) {
Preconditions.checkNotNull(request.getFacade());
@@ -103,4 +111,13 @@
return result;
}
+ // --------------------------------------------------------------------- //
+ // --- Matchers ------------------------------------------------------- //
+ // --------------------------------------------------------------------- //
+
+ protected boolean matchSpecies(MapRequest request) {
+ String species = request.getSpecies();
+ File file = repository.getMapSpeciesFile(species);
+ return file != null;
+ }
}
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/PopulationIndicatorResultProducer.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/PopulationIndicatorResultProducer.java 2014-03-11 14:45:05 UTC (rev 1143)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/PopulationIndicatorResultProducer.java 2014-03-11 16:45:58 UTC (rev 1144)
@@ -88,6 +88,14 @@
}
@Override
+ public boolean acceptResult(PopulationIndicatorRequest request) {
+ return repository.indicatorsResult &&
+ repository.matchFacade(request) &&
+ repository.matchZone(request) &&
+ matchSpeciesAndIndicator(request);
+ }
+
+ @Override
public Map<String, String> getAvailableZones(PopulationIndicatorRequest request) {
Preconditions.checkNotNull(request.getFacade());
@@ -131,7 +139,7 @@
boolean match = repository.indicatorsResult &&
repository.matchFacade(request) &&
repository.matchZone(request) &&
- repository.matchSpecies(request);
+ matchSpecies(request);
if (match) {
@@ -192,7 +200,6 @@
String species,
String indicator) {
-
int multiplicator = 1;
int minYear = Integer.MAX_VALUE;
int maxYear = Integer.MIN_VALUE;
@@ -305,4 +312,45 @@
return result;
}
+ // --------------------------------------------------------------------- //
+ // --- Matchers -------------------------------------------------------- //
+ // --------------------------------------------------------------------- //
+
+ protected boolean matchSpecies(PopulationIndicatorRequest request) {
+ Preconditions.checkNotNull(request.getSpecies());
+
+ String species = request.getSpecies();
+
+ boolean result = false;
+
+ Iterator<String[]> iterator = repository.loadPopulationIndicatorStorage(true);
+ while (iterator.hasNext()) {
+ String[] tuple = iterator.next();
+ if (repository.matchPopulationSpecies(tuple, species)) {
+ result = true;
+ break;
+ }
+ }
+ return result;
+ }
+
+ protected boolean matchSpeciesAndIndicator(PopulationIndicatorRequest request) {
+ Preconditions.checkNotNull(request.getSpecies());
+ Preconditions.checkNotNull(request.getIndicator());
+
+ String species = request.getSpecies();
+ String indicator = request.getIndicator();
+
+ boolean result = false;
+
+ Iterator<String[]> iterator = repository.loadPopulationIndicatorStorage(true);
+ while (iterator.hasNext()) {
+ String[] tuple = iterator.next();
+ if (repository.matchPopulationSpeciesAndIndicator(tuple, species, indicator)) {
+ result = true;
+ break;
+ }
+ }
+ return result;
+ }
}
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/RawDataResultProducer.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/RawDataResultProducer.java 2014-03-11 14:45:05 UTC (rev 1143)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/RawDataResultProducer.java 2014-03-11 16:45:58 UTC (rev 1144)
@@ -75,7 +75,7 @@
this.reports = repository.reports;
this.projectService = repository.projectService;
this.basedir = repository.basedir;
- this.config = repository.config;
+ this.config = repository.getConfig();
this.surveyName = repository.surveyName;
}
@@ -85,6 +85,13 @@
}
@Override
+ public boolean acceptResult(RawDataRequest request) {
+ return repository.dataResult &&
+ repository.matchFacade(request) &&
+ matchZone(request);
+ }
+
+ @Override
public Map<String, String> getAvailableZones(RawDataRequest request) {
boolean match = repository.matchFacade(request);
@@ -160,4 +167,12 @@
return result;
}
+ // --------------------------------------------------------------------- //
+ // --- Matchers ------------------------------------------------------- //
+ // --------------------------------------------------------------------- //
+
+ protected boolean matchZone(RawDataRequest request) {
+ return path.getRsufiResult().getZone().equals(request.getZone());
+ }
+
}
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/DeleteRequest.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/DeleteRequest.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/DeleteRequest.java 2014-03-11 16:45:58 UTC (rev 1144)
@@ -0,0 +1,74 @@
+package fr.ifremer.coser.result.request;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.coser.result.CoserRequest;
+import fr.ifremer.coser.util.DataType;
+import org.apache.commons.collections4.CollectionUtils;
+
+import java.util.List;
+import java.util.Locale;
+
+/**
+ * To delete some results.
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class DeleteRequest implements CoserRequest {
+
+ private static final long serialVersionUID = 1L;
+
+ protected Locale locale;
+
+ protected List<String> zoneList;
+
+ protected List<String> populationIndicatorList;
+
+ protected List<String> communityIndicatorList;
+
+ protected List<String> speciesList;
+
+ protected List<DataType> extractTypeList;
+
+ @Override
+ public Locale getLocale() {
+ return locale;
+ }
+
+ @Override
+ public void setLocale(Locale locale) {
+ this.locale = locale;
+ }
+
+ @Override
+ public boolean isFilled() {
+ return !(locale == null ||
+ CollectionUtils.isEmpty(extractTypeList) ||
+ CollectionUtils.isEmpty(zoneList) ||
+ CollectionUtils.isEmpty(populationIndicatorList) ||
+ CollectionUtils.isEmpty(communityIndicatorList) ||
+ CollectionUtils.isEmpty(speciesList));
+ }
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/DeleteRequest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/coser-business/src/test/java/fr/ifremer/coser/result/repository/echobase/EchoBaseResultRepositoryProviderTest.java
===================================================================
--- trunk/coser-business/src/test/java/fr/ifremer/coser/result/repository/echobase/EchoBaseResultRepositoryProviderTest.java 2014-03-11 14:45:05 UTC (rev 1143)
+++ trunk/coser-business/src/test/java/fr/ifremer/coser/result/repository/echobase/EchoBaseResultRepositoryProviderTest.java 2014-03-11 16:45:58 UTC (rev 1144)
@@ -48,9 +48,9 @@
File basedir = config.getWebEchobaseProjectsDirectory();
- EchoBaseResultRepositoryProvider provider = new EchoBaseResultRepositoryProvider(config, basedir);
+ EchoBaseResultRepositoryProvider provider = new EchoBaseResultRepositoryProvider(basedir);
- Set<EchoBaseResultRepository> resultRepositories = provider.loadRepositories();
+ Set<EchoBaseResultRepository> resultRepositories = provider.loadRepositories(serviceContext);
Assert.assertNotNull(resultRepositories);
Assert.assertEquals(2, resultRepositories.size());
}
Modified: trunk/coser-business/src/test/java/fr/ifremer/coser/result/repository/echobase/EchoBaseResultRepositoryTest.java
===================================================================
--- trunk/coser-business/src/test/java/fr/ifremer/coser/result/repository/echobase/EchoBaseResultRepositoryTest.java 2014-03-11 14:45:05 UTC (rev 1143)
+++ trunk/coser-business/src/test/java/fr/ifremer/coser/result/repository/echobase/EchoBaseResultRepositoryTest.java 2014-03-11 16:45:58 UTC (rev 1144)
@@ -53,9 +53,9 @@
File projectsDirectory = config.getWebEchobaseProjectsDirectory();
copyDirectoryContent("src.test.resources.web.echobaseprojects", projectsDirectory);
- EchoBaseResultRepositoryProvider repositoryProvider = new EchoBaseResultRepositoryProvider(config, projectsDirectory);
+ EchoBaseResultRepositoryProvider repositoryProvider = new EchoBaseResultRepositoryProvider(projectsDirectory);
- Set<EchoBaseResultRepository> repositories = repositoryProvider.loadRepositories();
+ Set<EchoBaseResultRepository> repositories = repositoryProvider.loadRepositories(serviceContext);
for (EchoBaseResultRepository repository : repositories) {
String projectName = repository.project.getName();
Modified: trunk/coser-business/src/test/java/fr/ifremer/coser/result/repository/legacy/LegacyResultRepositoryProviderTest.java
===================================================================
--- trunk/coser-business/src/test/java/fr/ifremer/coser/result/repository/legacy/LegacyResultRepositoryProviderTest.java 2014-03-11 14:45:05 UTC (rev 1143)
+++ trunk/coser-business/src/test/java/fr/ifremer/coser/result/repository/legacy/LegacyResultRepositoryProviderTest.java 2014-03-11 16:45:58 UTC (rev 1144)
@@ -49,9 +49,9 @@
File basedir = config.getWebIndicatorsProjectsDirectory();
- LegacyResultRepositoryProvider provider = new LegacyResultRepositoryProvider(config, basedir);
+ LegacyResultRepositoryProvider provider = new LegacyResultRepositoryProvider(basedir);
- Set<LegacyResultRepository> resultRepositories = provider.loadRepositories();
+ Set<LegacyResultRepository> resultRepositories = provider.loadRepositories(serviceContext);
Assert.assertNotNull(resultRepositories);
Assert.assertEquals(2, resultRepositories.size());
}
Modified: trunk/coser-business/src/test/java/fr/ifremer/coser/services/CoserTestAbstract.java
===================================================================
--- trunk/coser-business/src/test/java/fr/ifremer/coser/services/CoserTestAbstract.java 2014-03-11 14:45:05 UTC (rev 1143)
+++ trunk/coser-business/src/test/java/fr/ifremer/coser/services/CoserTestAbstract.java 2014-03-11 16:45:58 UTC (rev 1144)
@@ -30,6 +30,8 @@
import java.util.Locale;
import java.util.Map;
+import fr.ifremer.coser.CoserServiceContext;
+import fr.ifremer.coser.DefaultCoserServiceContext;
import org.apache.commons.io.FileUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -59,6 +61,7 @@
private static final Log log = LogFactory.getLog(CoserTestAbstract.class);
protected static CoserBusinessConfig config;
+ protected static CoserServiceContext serviceContext;
protected static File testDirectory;
@@ -83,6 +86,7 @@
config.setWebIndicatorsFile(CoserTestAbstract.class.getResource("/webindicators.csv").getFile());
config.setWebZonesFile(CoserTestAbstract.class.getResource("/webzones.csv").getFile());
+ serviceContext = new DefaultCoserServiceContext(config);
}
@AfterClass
Added: trunk/coser-web/src/main/java/fr/ifremer/coser/web/CoserApplicationContext.java
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/CoserApplicationContext.java (rev 0)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/CoserApplicationContext.java 2014-03-11 16:45:58 UTC (rev 1144)
@@ -0,0 +1,103 @@
+package fr.ifremer.coser.web;
+
+/*
+ * #%L
+ * Coser :: Web
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import fr.ifremer.coser.CoserServiceContext;
+import fr.ifremer.coser.DefaultCoserServiceContext;
+import fr.ifremer.coser.result.CoserResultEngine;
+import fr.ifremer.coser.services.WebService;
+import org.nuiton.config.ArgumentsParserException;
+import org.nuiton.i18n.I18n;
+import org.nuiton.i18n.init.DefaultI18nInitializer;
+
+/**
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class CoserApplicationContext {
+
+ /**
+ * Shared application context.
+ */
+ protected static CoserApplicationContext context;
+
+ public static CoserApplicationContext get() {
+ Preconditions.checkState(context != null, "Application was not initialized!");
+ return context;
+ }
+
+ public static void init() {
+ context = new CoserApplicationContext();
+ }
+
+ public static void close() {
+ context = null;
+ }
+
+ /**
+ * Business layer context.
+ */
+ protected CoserServiceContext businessContext;
+
+ /**
+ * Web config.
+ */
+ protected CoserWebConfig config;
+
+ //TODO Remove this soon
+ protected WebService webService;
+
+ protected CoserResultEngine resultService;
+
+ public CoserApplicationContext() {
+
+ I18n.init(new DefaultI18nInitializer("coser-i18n"), null);
+
+ config = new CoserWebConfig();
+
+ try {
+ config.parse();
+ } catch (ArgumentsParserException ex) {
+ throw new CoserWebException("Can't read configuration", ex);
+ }
+
+ businessContext = new DefaultCoserServiceContext(config);
+
+ webService = new WebService(config);
+ resultService = new CoserResultEngine(businessContext);
+ }
+
+ public WebService getWebService() {
+ return webService;
+ }
+
+ public CoserResultEngine getResultService() {
+ return resultService;
+ }
+
+ public CoserWebConfig getConfig() {
+ return config;
+ }
+}
Property changes on: trunk/coser-web/src/main/java/fr/ifremer/coser/web/CoserApplicationContext.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/coser-web/src/main/java/fr/ifremer/coser/web/CoserApplicationListener.java
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/CoserApplicationListener.java 2014-03-11 14:45:05 UTC (rev 1143)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/CoserApplicationListener.java 2014-03-11 16:45:58 UTC (rev 1144)
@@ -31,9 +31,9 @@
/**
* To listen start and end of the application.
* <p/>
- * On start we will init the service helper ({@link ServiceHelper#init()}).
+ * On start we will init the application context ({@link CoserApplicationContext#init()}).
* <p/>
- * On stop, just release close the service helper ({@link ServiceHelper#close()}).
+ * On stop, just release close the application context ({@link CoserApplicationContext#close()}).
*
* @author tchemit <chemit(a)codelutin.com>
* @since 1.5
@@ -50,9 +50,7 @@
if (log.isInfoEnabled()) {
log.info("Application starting at " + new Date() + "...");
}
-
- ServiceHelper.init();
-
+ CoserApplicationContext.init();
}
@Override
@@ -60,8 +58,6 @@
if (log.isInfoEnabled()) {
log.info("Application is ending at " + new Date() + "...");
}
-
- ServiceHelper.close();
-
+ CoserApplicationContext.close();
}
}
Modified: trunk/coser-web/src/main/java/fr/ifremer/coser/web/ServiceHelper.java
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/ServiceHelper.java 2014-03-11 14:45:05 UTC (rev 1143)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/ServiceHelper.java 2014-03-11 16:45:58 UTC (rev 1144)
@@ -27,23 +27,17 @@
import fr.ifremer.coser.result.CoserResult;
import fr.ifremer.coser.result.CoserResultEngine;
import fr.ifremer.coser.result.FileResult;
-import fr.ifremer.coser.result.repository.ResultRepositoryProvider;
import fr.ifremer.coser.result.request.CoserRequestSpeciesAware;
import fr.ifremer.coser.result.request.CoserRequestZoneAware;
import fr.ifremer.coser.result.request.IndicatorRequest;
import fr.ifremer.coser.services.WebService;
import fr.ifremer.coser.util.DataType;
import fr.ifremer.coser.web.actions.common.CoserAction;
-import org.nuiton.config.ArgumentsParserException;
-import org.nuiton.i18n.I18n;
-import org.nuiton.i18n.init.DefaultI18nInitializer;
import java.io.File;
-import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.Map;
-import java.util.Set;
/**
* Wrap any call to business layer.
@@ -58,50 +52,21 @@
*/
public class ServiceHelper {
- private static WebService webService;
+ protected final CoserAction action;
- private static CoserResultEngine resultService;
+ protected final WebService webService;
- private static CoserWebConfig config;
+ protected final CoserResultEngine resultService;
+ protected final CoserWebConfig config;
- // --------------------------------------------------------------------- //
- // --- Application context methods ------------------------------------- //
- // --------------------------------------------------------------------- //
-
- public static void init() {
-
- // on a pas trop de locale là :(
- I18n.init(new DefaultI18nInitializer("coser-i18n"), null);
-
- config = new CoserWebConfig();
- try {
- config.parse();
- } catch (ArgumentsParserException ex) {
- throw new CoserWebException("Can't read configuration", ex);
- }
-
- webService = new WebService(config);
-
- Set<ResultRepositoryProvider<?>> providers =
- CoserResultEngine.createDefaultRepositoryProviders(config);
- resultService = new CoserResultEngine(providers);
- }
-
- public static void close() {
- webService = null;
- resultService = null;
- config = null;
- }
-
- private final CoserAction action;
-
public ServiceHelper(CoserAction action) {
- Preconditions.checkNotNull(config);
- Preconditions.checkNotNull(webService);
- Preconditions.checkNotNull(resultService);
Preconditions.checkNotNull(action);
+ CoserApplicationContext applicationContext = CoserApplicationContext.get();
this.action = action;
+ this.webService = applicationContext.getWebService();
+ this.resultService = applicationContext.getResultService();
+ this.config = applicationContext.getConfig();
}
// --------------------------------------------------------------------- //
@@ -279,12 +244,7 @@
// --- Misc methods ---------------------------------------------------- //
// --------------------------------------------------------------------- //
- public Date getLastDataUpdateDate() {
- return getConfig().getLastDataUpdateDate();
- }
-
public CoserWebConfig getConfig() {
return config;
}
-
}
Modified: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/IndexAction.java
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/IndexAction.java 2014-03-11 14:45:05 UTC (rev 1143)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/IndexAction.java 2014-03-11 16:45:58 UTC (rev 1144)
@@ -67,7 +67,7 @@
@Override
public String execute() {
- dataUpdateDate = getService().getLastDataUpdateDate();
+ dataUpdateDate = getService().getConfig().getLastDataUpdateDate();
return SUCCESS;
}
1
0
Author: tchemit
Date: 2014-03-11 15:45:05 +0100 (Tue, 11 Mar 2014)
New Revision: 1143
Url: http://forge.codelutin.com/projects/coser/repository/revisions/1143
Log:
fix dependencies
Modified:
trunk/coser-ui/pom.xml
Modified: trunk/coser-ui/pom.xml
===================================================================
--- trunk/coser-ui/pom.xml 2014-03-11 13:54:41 UTC (rev 1142)
+++ trunk/coser-ui/pom.xml 2014-03-11 14:45:05 UTC (rev 1143)
@@ -93,6 +93,10 @@
<artifactId>commons-email</artifactId>
</dependency>
<dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ </dependency>
+ <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
1
0
Author: tchemit
Date: 2014-03-11 14:54:41 +0100 (Tue, 11 Mar 2014)
New Revision: 1142
Url: http://forge.codelutin.com/projects/coser/repository/revisions/1142
Log:
use last mavenpom
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2014-03-11 09:28:43 UTC (rev 1141)
+++ trunk/pom.xml 2014-03-11 13:54:41 UTC (rev 1142)
@@ -5,7 +5,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom4redmine</artifactId>
- <version>5.0.1-SNAPSHOT</version>
+ <version>5.0.1</version>
</parent>
<groupId>fr.ifremer</groupId>
1
0
See <http://ci.codelutin.com/jenkins/job/coser-ci/16/changes>
Changes:
[Tony CHEMIT] refs-50 #4651 legacy results of ok
------------------------------------------
Started by an SCM change
Building in workspace <http://ci.codelutin.com/jenkins/job/coser-ci/ws/>
Reverting <http://ci.codelutin.com/jenkins/job/coser-ci/ws/trunk> to depth infinity with ignoreExternals: false
Updating https://svn.codelutin.com/coser/trunk at revision '2014-03-09T07:54:46.071 +0100'
U coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/LegacyResultRepository.java
U coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/EchoBaseResultRepository.java
U coser-web/src/main/java/fr/ifremer/coser/web/actions/com/GraphDownloadAction.java
U coser-web/src/main/java/fr/ifremer/coser/web/actions/com/GraphDataAction.java
U coser-web/src/main/java/fr/ifremer/coser/web/actions/pop/GraphDownloadAction.java
U coser-web/src/main/java/fr/ifremer/coser/web/actions/pop/GraphDataAction.java
At revision 1139
Parsing POMs
Downloaded artifact http://nexus.nuiton.org/nexus/content/repositories/snapshots/org/nuiton/mav…
Downloaded artifact https://nexus.nuiton.org/nexus/content/groups/coser-group/org/nuiton/mavenp…
Downloaded artifact https://nexus.nuiton.org/nexus/content/groups/coser-group/org/nuiton/mavenp…
Downloaded artifact http://nexus.nuiton.org/nexus/content/repositories/snapshots/org/nuiton/mav…
[trunk] $ /opt/jdk7/bin/java -Dsettings.security=/var/local/forge/data/codelutin.com/maven/settings-security.xml -Djava.awt.headless=true -cp /var/local/forge/data/codelutin.com/jenkins/plugins/maven-plugin/WEB-INF/lib/maven31-agent-1.4.jar:/opt/maven3/boot/plexus-classworlds-2.5.1.jar:/opt/maven3/conf/logging jenkins.maven3.agent.Maven31Main /opt/maven3 /var/local/forge/exec/tomcat-codelutin.com/webapps/jenkins/WEB-INF/lib/remoting-2.33.jar /var/local/forge/data/codelutin.com/jenkins/plugins/maven-plugin/WEB-INF/lib/maven31-interceptor-1.4.jar /var/local/forge/data/codelutin.com/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-commons-1.4.jar 44110
<===[JENKINS REMOTING CAPACITY]===> channel started
log4j:WARN No appenders could be found for logger (org.apache.commons.beanutils.converters.BooleanConverter).
log4j:WARN Please initialize the log4j system properly.
Executing Maven: -B -f <http://ci.codelutin.com/jenkins/job/coser-ci/ws/trunk/pom.xml> -s /var/local/forge/data/codelutin.com/maven/settings.xml -e -U clean verify
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/repositories/snapshots/org/nuiton/mav…
[INFO] Downloading: https://nexus.nuiton.org/nexus/content/groups/coser-group/org/nuiton/mavenp…
[INFO] Downloaded: http://nexus.nuiton.org/nexus/content/repositories/snapshots/org/nuiton/mav… (603 B at 3.8 KB/sec)
[INFO] Downloaded: https://nexus.nuiton.org/nexus/content/groups/coser-group/org/nuiton/mavenp… (603 B at 2.2 KB/sec)
[INFO] Downloading: https://nexus.nuiton.org/nexus/content/groups/coser-group/org/nuiton/mavenp…
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/repositories/snapshots/org/nuiton/mav…
[INFO] Downloaded: https://nexus.nuiton.org/nexus/content/groups/coser-group/org/nuiton/mavenp… (595 B at 20.0 KB/sec)
[INFO] Downloaded: http://nexus.nuiton.org/nexus/content/repositories/snapshots/org/nuiton/mav… (595 B at 19.4 KB/sec)
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] Coser
[INFO] Coser :: Business
[INFO] Coser :: UI
[INFO] Coser :: Web
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Coser 1.5-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ coser ---
[INFO] Deleting <http://ci.codelutin.com/jenkins/job/coser-ci/ws/trunk/target>
[INFO]
[INFO] --- maven-enforcer-plugin:1.3.1:enforce (check-project-files) @ coser ---
[INFO]
[INFO] --- maven-antrun-plugin:1.7:run (generate-surefire-workdir) @ coser ---
[INFO] Executing tasks
main:
[mkdir] Created dir: <http://ci.codelutin.com/jenkins/job/coser-ci/ws/trunk/target/surefire-workd…>
[INFO] Executed tasks
[INFO]
[INFO] --- maven-site-plugin:3.3:attach-descriptor (attach-descriptor) @ coser ---
[JENKINS] Archiving disabled
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Coser :: Business 1.5-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/repositories/snapshots/org/nuiton/mat…
[INFO] Downloading: https://nexus.nuiton.org/nexus/content/groups/coser-group/org/nuiton/matrix…
[INFO] Downloaded: http://nexus.nuiton.org/nexus/content/repositories/snapshots/org/nuiton/mat… (2 KB at 22.9 KB/sec)
[INFO] Downloaded: https://nexus.nuiton.org/nexus/content/groups/coser-group/org/nuiton/matrix… (2 KB at 22.5 KB/sec)
[INFO] Downloading: https://nexus.nuiton.org/nexus/content/groups/coser-group/org/nuiton/matrix…
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/repositories/snapshots/org/nuiton/mat…
[INFO] Downloaded: http://nexus.nuiton.org/nexus/content/repositories/snapshots/org/nuiton/mat… (801 B at 21.7 KB/sec)
[INFO] Downloaded: https://nexus.nuiton.org/nexus/content/groups/coser-group/org/nuiton/matrix… (801 B at 20.6 KB/sec)
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ coser-business ---
[INFO] Deleting <http://ci.codelutin.com/jenkins/job/coser-ci/ws/trunk/coser-business/target>
[INFO]
[INFO] --- maven-enforcer-plugin:1.3.1:enforce (check-project-files) @ coser-business ---
[INFO]
[INFO] --- i18n-maven-plugin:3.0:parserJava (default) @ coser-business ---
[INFO] start entry basedir:<http://ci.codelutin.com/jenkins/job/coser-ci/ws/trunk/coser-business/src/ma…,> includes:[**/*.java]
[INFO] 89 file(s) to process (among 89 files)
[INFO] Parsing is done. [treated file(s) : 12/89](total time:4.66s) ( ~ 52.358ms / file)
[INFO]
[INFO] --- i18n-maven-plugin:3.0:parserValidation (default) @ coser-business ---
[INFO] Load rules file validation.rules
[INFO] start entry basedir:<http://ci.codelutin.com/jenkins/job/coser-ci/ws/trunk/coser-business/src/ma…,> includes:[**/*-validation.xml]
[INFO] 6 file(s) to process (among 6 files)
[INFO] Parsing is done. [treated file(s) : 6/6](total time:397.799ms) ( ~ 66.3ms / file)
[INFO]
[INFO] >>> i18n-maven-plugin:3.0:gen (default) @ coser-business >>>
[INFO]
[INFO] --- i18n-maven-plugin:3.0:get (get) @ coser-business ---
[INFO] config - basedir : <http://ci.codelutin.com/jenkins/job/coser-ci/ws/trunk/coser-business/target…>
[INFO] config - locales : [fr_FR, en_GB]
[INFO] import getter java.getter in 402617ns
[INFO] import getter validation.getter in 112442ns
[INFO] Copying coser-business.properties to <http://ci.codelutin.com/jenkins/job/coser-ci/ws/trunk/coser-business/target…>
[INFO] Copying coser-business.properties to <http://ci.codelutin.com/jenkins/job/coser-ci/ws/trunk/coser-business/target…>
[INFO]
[INFO] <<< i18n-maven-plugin:3.0:gen (default) @ coser-business <<<
[INFO]
[INFO] --- i18n-maven-plugin:3.0:gen (default) @ coser-business ---
[INFO] config - src basedir : <http://ci.codelutin.com/jenkins/job/coser-ci/ws/trunk/coser-business/src/ma…>
[INFO] config - out basedir : <http://ci.codelutin.com/jenkins/job/coser-ci/ws/trunk/coser-business/target…>
[INFO] config - locales : [fr_FR, en_GB]
[INFO] prepare bundle for locale fr_FR
[INFO] merge bundle fr_FR to out
[WARNING] bundle fr_FR contains 1/186 empty entries! (use -Di18n.showEmpty to see these entries)
[INFO] copy bundle fr_FR to src
[INFO] prepare bundle for locale en_GB
[INFO] merge bundle en_GB to out
[WARNING] bundle en_GB contains 37/186 empty entries! (use -Di18n.showEmpty to see these entries)
[INFO] copy bundle en_GB to src
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ coser-business ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 14 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ coser-business ---
[INFO] Compiling 89 source files to <http://ci.codelutin.com/jenkins/job/coser-ci/ws/trunk/coser-business/target…>
[INFO] -------------------------------------------------------------
[WARNING] COMPILATION WARNING :
[INFO] -------------------------------------------------------------
[WARNING] bootstrap class path not set in conjunction with -source 1.6
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-ci/ws/trunk/coser-business/src/ma…>:[1611,26] storeDataWhithoutQuote(fr.ifremer.coser.storage.DataStorage,java.io.File,java.util.Map<java.lang.String,java.lang.String>,fr.ifremer.coser.CoserConstants.Category) in fr.ifremer.coser.services.CommonService has been deprecated
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-ci/ws/trunk/coser-business/src/ma…>:[1677,26] storeDataWhithoutQuote(fr.ifremer.coser.storage.DataStorage,java.io.File,java.util.Map<java.lang.String,java.lang.String>,fr.ifremer.coser.CoserConstants.Category) in fr.ifremer.coser.services.CommonService has been deprecated
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-ci/ws/trunk/coser-business/src/ma…>:[62,27] org.apache.http.entity.mime.MultipartEntity in org.apache.http.entity.mime has been deprecated
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-ci/ws/trunk/coser-business/src/ma…>:[65,3] org.apache.http.impl.client.DefaultHttpClient in org.apache.http.impl.client has been deprecated
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-ci/ws/trunk/coser-business/src/ma…>:[2873,30] storeDataWhithoutQuote(fr.ifremer.coser.storage.DataStorage,java.io.File,java.util.Map<java.lang.String,java.lang.String>,fr.ifremer.coser.CoserConstants.Category) in fr.ifremer.coser.services.CommonService has been deprecated
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-ci/ws/trunk/coser-business/src/ma…>:[444,41] org.apache.http.impl.client.DefaultHttpClient in org.apache.http.impl.client has been deprecated
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-ci/ws/trunk/coser-business/src/ma…>:[445,13] org.apache.http.entity.mime.MultipartEntity in org.apache.http.entity.mime has been deprecated
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-ci/ws/trunk/coser-business/src/ma…>:[445,45] org.apache.http.entity.mime.MultipartEntity in org.apache.http.entity.mime has been deprecated
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-ci/ws/trunk/coser-business/src/ma…>:[448,36] StringBody(java.lang.String,java.nio.charset.Charset) in org.apache.http.entity.mime.content.StringBody has been deprecated
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-ci/ws/trunk/coser-business/src/ma…>:[451,39] StringBody(java.lang.String,java.nio.charset.Charset) in org.apache.http.entity.mime.content.StringBody has been deprecated
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-ci/ws/trunk/coser-business/src/ma…>:[2265,54] escapeXml(java.lang.String) in org.apache.commons.lang3.StringEscapeUtils has been deprecated
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-ci/ws/trunk/coser-business/src/ma…>:[2266,53] escapeXml(java.lang.String) in org.apache.commons.lang3.StringEscapeUtils has been deprecated
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-ci/ws/trunk/coser-business/src/ma…>:[54,9] InputStreamBody(java.io.InputStream,java.lang.String,java.lang.String) in org.apache.http.entity.mime.content.InputStreamBody has been deprecated
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-ci/ws/trunk/coser-business/src/ma…>: Some input files use unchecked or unsafe operations.
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-ci/ws/trunk/coser-business/src/ma…>: Recompile with -Xlint:unchecked for details.
[INFO] 16 warnings
[INFO] -------------------------------------------------------------
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] <http://ci.codelutin.com/jenkins/job/coser-ci/ws/trunk/coser-business/src/ma…>:[733,39] generateMetaFilePDF(fr.ifremer.coser.bean.Project,fr.ifremer.coser.bean.Selection,java.io.File,fr.ifremer.coser.bean.RSufiResult,java.lang.String,java.util.Locale) has protected access in fr.ifremer.coser.services.WebService
[INFO] 1 error
[INFO] -------------------------------------------------------------
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Coser ............................................. SUCCESS [ 4.382 s]
[INFO] Coser :: Business ................................. FAILURE [ 10.075 s]
[INFO] Coser :: UI ....................................... SKIPPED
[INFO] Coser :: Web ...................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 17.186 s
[INFO] Finished at: 2014-03-09T07:55:13+01:00
[INFO] Final Memory: 39M/485M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project coser-business: Compilation failure
[ERROR] <http://ci.codelutin.com/jenkins/job/coser-ci/ws/trunk/coser-business/src/ma…>:[733,39] generateMetaFilePDF(fr.ifremer.coser.bean.Project,fr.ifremer.coser.bean.Selection,java.io.File,fr.ifremer.coser.bean.RSufiResult,java.lang.String,java.util.Locale) has protected access in fr.ifremer.coser.services.WebService
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project coser-business: Compilation failure
<http://ci.codelutin.com/jenkins/job/coser-ci/ws/trunk/coser-business/src/ma…>:[733,39] generateMetaFilePDF(fr.ifremer.coser.bean.Project,fr.ifremer.coser.bean.Selection,java.io.File,fr.ifremer.coser.bean.RSufiResult,java.lang.String,java.util.Locale) has protected access in fr.ifremer.coser.services.WebService
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:108)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
at org.jvnet.hudson.maven3.launcher.Maven31Launcher.main(Maven31Launcher.java:132)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:330)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:238)
at jenkins.maven3.agent.Maven31Main.launch(Maven31Main.java:181)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:134)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:69)
at hudson.remoting.UserRequest.perform(UserRequest.java:118)
at hudson.remoting.UserRequest.perform(UserRequest.java:48)
at hudson.remoting.Request$2.run(Request.java:328)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: org.apache.maven.plugin.compiler.CompilationFailureException: Compilation failure
<http://ci.codelutin.com/jenkins/job/coser-ci/ws/trunk/coser-business/src/ma…>:[733,39] generateMetaFilePDF(fr.ifremer.coser.bean.Project,fr.ifremer.coser.bean.Selection,java.io.File,fr.ifremer.coser.bean.RSufiResult,java.lang.String,java.util.Locale) has protected access in fr.ifremer.coser.services.WebService
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:858)
at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:129)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 30 more
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :coser-business
Sending e-mails to: coser-commits(a)list.forge.codelutin.com chemit+codelutin-ci(a)codelutin.com
channel stopped
1
2
Build failed in Jenkins: coser-ci » Coser :: Business #16
by admin+ci-codelutin.com@codelutin.com 11 Mar '14
by admin+ci-codelutin.com@codelutin.com 11 Mar '14
11 Mar '14
See <http://ci.codelutin.com/jenkins/job/coser-ci/fr.ifremer.coser$coser-busines…>
Changes:
[Tony CHEMIT] refs-50 #4651 legacy results of ok
------------------------------------------
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Coser :: Business 1.5-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/repositories/snapshots/org/nuiton/mat…
[INFO] Downloading: https://nexus.nuiton.org/nexus/content/groups/coser-group/org/nuiton/matrix…
[INFO] Downloaded: http://nexus.nuiton.org/nexus/content/repositories/snapshots/org/nuiton/mat… (2 KB at 22.9 KB/sec)
[INFO] Downloaded: https://nexus.nuiton.org/nexus/content/groups/coser-group/org/nuiton/matrix… (2 KB at 22.5 KB/sec)
[INFO] Downloading: https://nexus.nuiton.org/nexus/content/groups/coser-group/org/nuiton/matrix…
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/repositories/snapshots/org/nuiton/mat…
[INFO] Downloaded: http://nexus.nuiton.org/nexus/content/repositories/snapshots/org/nuiton/mat… (801 B at 21.7 KB/sec)
[INFO] Downloaded: https://nexus.nuiton.org/nexus/content/groups/coser-group/org/nuiton/matrix… (801 B at 20.6 KB/sec)
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ coser-business ---
[INFO] Deleting <http://ci.codelutin.com/jenkins/job/coser-ci/fr.ifremer.coser$coser-busines…>
[INFO]
[INFO] --- maven-enforcer-plugin:1.3.1:enforce (check-project-files) @ coser-business ---
[INFO]
[INFO] --- i18n-maven-plugin:3.0:parserJava (default) @ coser-business ---
[INFO] start entry basedir:<http://ci.codelutin.com/jenkins/job/coser-ci/fr.ifremer.coser$coser-busines…,> includes:[**/*.java]
[INFO] 89 file(s) to process (among 89 files)
[INFO] Parsing is done. [treated file(s) : 12/89](total time:4.66s) ( ~ 52.358ms / file)
[INFO]
[INFO] --- i18n-maven-plugin:3.0:parserValidation (default) @ coser-business ---
[INFO] Load rules file validation.rules
[INFO] start entry basedir:<http://ci.codelutin.com/jenkins/job/coser-ci/fr.ifremer.coser$coser-busines…,> includes:[**/*-validation.xml]
[INFO] 6 file(s) to process (among 6 files)
[INFO] Parsing is done. [treated file(s) : 6/6](total time:397.799ms) ( ~ 66.3ms / file)
[INFO]
[INFO] >>> i18n-maven-plugin:3.0:gen (default) @ coser-business >>>
[INFO]
[INFO] --- i18n-maven-plugin:3.0:get (get) @ coser-business ---
[INFO] config - basedir : <http://ci.codelutin.com/jenkins/job/coser-ci/fr.ifremer.coser$coser-busines…>
[INFO] config - locales : [fr_FR, en_GB]
[INFO] import getter java.getter in 402617ns
[INFO] import getter validation.getter in 112442ns
[INFO] Copying coser-business.properties to <http://ci.codelutin.com/jenkins/job/coser-ci/fr.ifremer.coser$coser-busines…>
[INFO] Copying coser-business.properties to <http://ci.codelutin.com/jenkins/job/coser-ci/fr.ifremer.coser$coser-busines…>
[INFO]
[INFO] <<< i18n-maven-plugin:3.0:gen (default) @ coser-business <<<
[INFO]
[INFO] --- i18n-maven-plugin:3.0:gen (default) @ coser-business ---
[INFO] config - src basedir : <http://ci.codelutin.com/jenkins/job/coser-ci/fr.ifremer.coser$coser-busines…>
[INFO] config - out basedir : <http://ci.codelutin.com/jenkins/job/coser-ci/fr.ifremer.coser$coser-busines…>
[INFO] config - locales : [fr_FR, en_GB]
[INFO] prepare bundle for locale fr_FR
[INFO] merge bundle fr_FR to out
[WARNING] bundle fr_FR contains 1/186 empty entries! (use -Di18n.showEmpty to see these entries)
[INFO] copy bundle fr_FR to src
[INFO] prepare bundle for locale en_GB
[INFO] merge bundle en_GB to out
[WARNING] bundle en_GB contains 37/186 empty entries! (use -Di18n.showEmpty to see these entries)
[INFO] copy bundle en_GB to src
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ coser-business ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 14 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ coser-business ---
[INFO] Compiling 89 source files to <http://ci.codelutin.com/jenkins/job/coser-ci/fr.ifremer.coser$coser-busines…>
[INFO] -------------------------------------------------------------
[WARNING] COMPILATION WARNING :
[INFO] -------------------------------------------------------------
[WARNING] bootstrap class path not set in conjunction with -source 1.6
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-ci/fr.ifremer.coser$coser-busines…>:[1611,26] storeDataWhithoutQuote(fr.ifremer.coser.storage.DataStorage,java.io.File,java.util.Map<java.lang.String,java.lang.String>,fr.ifremer.coser.CoserConstants.Category) in fr.ifremer.coser.services.CommonService has been deprecated
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-ci/fr.ifremer.coser$coser-busines…>:[1677,26] storeDataWhithoutQuote(fr.ifremer.coser.storage.DataStorage,java.io.File,java.util.Map<java.lang.String,java.lang.String>,fr.ifremer.coser.CoserConstants.Category) in fr.ifremer.coser.services.CommonService has been deprecated
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-ci/fr.ifremer.coser$coser-busines…>:[62,27] org.apache.http.entity.mime.MultipartEntity in org.apache.http.entity.mime has been deprecated
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-ci/fr.ifremer.coser$coser-busines…>:[65,3] org.apache.http.impl.client.DefaultHttpClient in org.apache.http.impl.client has been deprecated
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-ci/fr.ifremer.coser$coser-busines…>:[2873,30] storeDataWhithoutQuote(fr.ifremer.coser.storage.DataStorage,java.io.File,java.util.Map<java.lang.String,java.lang.String>,fr.ifremer.coser.CoserConstants.Category) in fr.ifremer.coser.services.CommonService has been deprecated
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-ci/fr.ifremer.coser$coser-busines…>:[444,41] org.apache.http.impl.client.DefaultHttpClient in org.apache.http.impl.client has been deprecated
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-ci/fr.ifremer.coser$coser-busines…>:[445,13] org.apache.http.entity.mime.MultipartEntity in org.apache.http.entity.mime has been deprecated
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-ci/fr.ifremer.coser$coser-busines…>:[445,45] org.apache.http.entity.mime.MultipartEntity in org.apache.http.entity.mime has been deprecated
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-ci/fr.ifremer.coser$coser-busines…>:[448,36] StringBody(java.lang.String,java.nio.charset.Charset) in org.apache.http.entity.mime.content.StringBody has been deprecated
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-ci/fr.ifremer.coser$coser-busines…>:[451,39] StringBody(java.lang.String,java.nio.charset.Charset) in org.apache.http.entity.mime.content.StringBody has been deprecated
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-ci/fr.ifremer.coser$coser-busines…>:[2265,54] escapeXml(java.lang.String) in org.apache.commons.lang3.StringEscapeUtils has been deprecated
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-ci/fr.ifremer.coser$coser-busines…>:[2266,53] escapeXml(java.lang.String) in org.apache.commons.lang3.StringEscapeUtils has been deprecated
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-ci/fr.ifremer.coser$coser-busines…>:[54,9] InputStreamBody(java.io.InputStream,java.lang.String,java.lang.String) in org.apache.http.entity.mime.content.InputStreamBody has been deprecated
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-ci/fr.ifremer.coser$coser-busines…>: Some input files use unchecked or unsafe operations.
[WARNING] <http://ci.codelutin.com/jenkins/job/coser-ci/fr.ifremer.coser$coser-busines…>: Recompile with -Xlint:unchecked for details.
[INFO] 16 warnings
[INFO] -------------------------------------------------------------
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] <http://ci.codelutin.com/jenkins/job/coser-ci/fr.ifremer.coser$coser-busines…>:[733,39] generateMetaFilePDF(fr.ifremer.coser.bean.Project,fr.ifremer.coser.bean.Selection,java.io.File,fr.ifremer.coser.bean.RSufiResult,java.lang.String,java.util.Locale) has protected access in fr.ifremer.coser.services.WebService
[INFO] 1 error
[INFO] -------------------------------------------------------------
[JENKINS] Archiving disabled
1
2
11 Mar '14
Author: tchemit
Date: 2014-03-11 10:28:43 +0100 (Tue, 11 Mar 2014)
New Revision: 1141
Url: http://forge.codelutin.com/projects/coser/repository/revisions/1141
Log:
refs-90 #4664 (i18n)
refs-60 #4651 (introduce ResultProducer + implements ExtractRequest)
Added:
trunk/coser-business/src/main/java/fr/ifremer/coser/bean/SpeciesListMap.java
trunk/coser-business/src/main/java/fr/ifremer/coser/bean/SpeciesMap.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/RequestUnavailableForProducerException.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/ResultProducer.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/CommunityIndicatorResultProducer.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/ExtractResultProducer.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/MapResultProducer.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/PopulationIndicatorResultProducer.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/RawDataResultProducer.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/CommunityIndicatorResultProducer.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/ExtractResultProducer.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/MapResultProducer.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/PopulationIndicatorResultProducer.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/RawDataResultProducer.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/ExtractRequest.java
trunk/coser-web/src/main/resources/fr/ifremer/coser/web/actions/search/
trunk/coser-web/src/main/resources/fr/ifremer/coser/web/actions/search/ExtractAction-extract-quality-validation.xml
Modified:
trunk/coser-business/src/main/java/fr/ifremer/coser/bean/ZoneMap.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/CoserResultEngine.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/Reports.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/ResultRepository.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/EchoBaseResultRepository.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/LegacyResultRepository.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/CoserRequestBuilder.java
trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/IndicatorRequest.java
trunk/coser-business/src/main/java/fr/ifremer/coser/storage/DataStorages.java
trunk/coser-business/src/main/java/fr/ifremer/coser/util/DataType.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/result/repository/echobase/EchoBaseResultRepositoryTest.java
trunk/coser-web/src/main/java/fr/ifremer/coser/web/ServiceHelper.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/GraphDownloadAction.java
trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/common/CoserAction.java
trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/search/ExtractAction.java
trunk/coser-web/src/main/webapp/WEB-INF/content/search/extract-input.jsp
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/bean/SpeciesListMap.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/bean/SpeciesListMap.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/bean/SpeciesListMap.java 2014-03-11 09:28:43 UTC (rev 1141)
@@ -0,0 +1,96 @@
+package fr.ifremer.coser.bean;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.coser.storage.DataStorage;
+import fr.ifremer.coser.storage.DataStorages;
+import org.nuiton.i18n.I18n;
+
+import java.io.File;
+import java.util.Iterator;
+import java.util.Locale;
+
+/**
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class SpeciesListMap {
+
+ /**
+ * Species' list storage.
+ */
+ protected final DataStorage storage;
+
+ public SpeciesListMap(File speciesFile) {
+ storage = DataStorages.load(speciesFile);
+ }
+
+ public String getSpeciesListName(Locale locale, String specesList) {
+ // recherche de la traduction de l'id de liste
+ // les liste sont a1, T1, T2 ...
+ String listLetter = String.valueOf(specesList.charAt(0));
+ String translation = "## " + specesList + " not found ##";
+ Iterator<String[]> typeIterator = iterator(true);
+ while (typeIterator.hasNext()) {
+ // "Types";"Commentaire";"NumSys min";"NumSys max";"Code"
+ String[] tupleType = typeIterator.next();
+ if (tupleType[4].equals(listLetter)) {
+
+ // gestion du groupe "Tous"
+ // cas special, c'est la seule valeur du fichier
+ // code type espece qui a besoin d'une traduction
+ if (tupleType[4].equalsIgnoreCase("T")) {
+
+ translation = I18n.l(locale, "coser.business.specesList.nameForAll", specesList.charAt(1));
+// if (locale != null && "fr".equals(locale.getLanguage())) {
+// translation = "Tous Liste " + specesList.charAt(1);
+// } else if (locale != null && "en".equals(locale.getLanguage())) {
+// translation = "Todo Lista " + specesList.charAt(1);
+// } else {
+// translation = "All List " + specesList.charAt(1);
+// }
+ } else {
+ // ajout de la traduction du nom de liste plus le numéro
+ translation = I18n.l(locale, "coser.business.specesList.name", tupleType[0], specesList.charAt(1));
+// if (locale != null && "fr".equals(locale.getLanguage())) {
+// translation = tupleType[0] + " Liste " + specesList.charAt(1);
+// } else if (locale != null && "en".equals(locale.getLanguage())) {
+// translation = tupleType[0] + " Lista " + specesList.charAt(1);
+// } else {
+// translation = tupleType[0] + " List " + specesList.charAt(1);
+// }
+ }
+ break;
+ }
+ }
+ return translation;
+ }
+
+ protected Iterator<String[]> iterator(boolean skipFirstLine) {
+ // "Types";"Commentaire";"NumSys min";"NumSys max";"Code"
+ Iterator<String[]> iterator = storage.iterator(skipFirstLine);
+ return iterator;
+ }
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/bean/SpeciesListMap.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/bean/SpeciesMap.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/bean/SpeciesMap.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/bean/SpeciesMap.java 2014-03-11 09:28:43 UTC (rev 1141)
@@ -0,0 +1,130 @@
+package fr.ifremer.coser.bean;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.collect.Maps;
+import fr.ifremer.coser.storage.DataStorage;
+import fr.ifremer.coser.storage.DataStorages;
+
+import java.io.File;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class SpeciesMap {
+
+ /**
+ * Species' storage.
+ */
+ protected final DataStorage storage;
+
+ /**
+ * Cache of species definition.
+ */
+ protected Map<String, String> speciesMap;
+
+
+ public SpeciesMap(File speciesFile) {
+ storage = DataStorages.load(speciesFile);
+ }
+
+ public DataStorage getStorage() {
+ return storage;
+ }
+
+ public Iterator<String[]> iterator(boolean skipFirstLine) {
+ // "C_Perm","NumSys","NivSys","C_VALIDE","L_VALIDE","AA_VALIDE","C_TxP\u00E8re","Taxa"
+ Iterator<String[]> iterator = storage.iterator(skipFirstLine);
+ return iterator;
+ }
+
+ public Map<String, String> getSpeciesMap() {
+ if (speciesMap == null) {
+ speciesMap = Maps.newTreeMap();
+
+ // load species file
+ Iterator<String[]> iterator = iterator(true);
+ while (iterator.hasNext()) {
+ String[] tuple = iterator.next();
+ String speciesCode = tuple[3];
+ String speciesLabel = tuple[4] + " " + tuple[5];
+ speciesMap.put(speciesCode, speciesLabel);
+ }
+ speciesMap = Collections.unmodifiableMap(speciesMap);
+ }
+ return speciesMap;
+ }
+
+ public String getSpeciesName(String species) {
+ return getSpeciesMap().get(species);
+ }
+
+ public Map<String, String> getSpeciesSubMap(Collection<String> speciesList) {
+
+ Map<String, String> result = Maps.newTreeMap();
+
+ if (speciesList != null) {
+
+ Map<String, String> map = getSpeciesMap();
+ for (String species : speciesList) {
+ String speciesLabel = map.get(species);
+ result.put(species, speciesLabel);
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Retourne le nom d'affichage d'une especes pour les rapports.
+ *
+ * @param species species code
+ * @return species display name
+ * @since 1.5
+ */
+ public String getReportDisplayName(String species) {
+ String displayName = null;
+
+ Iterator<String[]> iterator = iterator(true);
+ while (iterator.hasNext()) {
+ String[] tuple = iterator.next();
+
+ // "C_Perm","NumSys","NivSys","C_VALIDE","L_VALIDE","AA_VALIDE","C_TxP\u00E8re","Taxa"
+ String speciesCode = tuple[3];
+ if (speciesCode.equals(species)) {
+ // nom + auteur (sans ajout de parenthese : important)
+ displayName = tuple[4] + " " + tuple[5];
+ break;
+ }
+ }
+
+ return displayName;
+ }
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/bean/SpeciesMap.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/bean/ZoneMap.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/bean/ZoneMap.java 2014-03-10 10:23:18 UTC (rev 1140)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/bean/ZoneMap.java 2014-03-11 09:28:43 UTC (rev 1141)
@@ -23,6 +23,7 @@
*/
import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
import fr.ifremer.coser.storage.DataStorage;
import fr.ifremer.coser.storage.DataStorages;
import fr.ifremer.coser.storage.MemoryDataStorage;
@@ -208,4 +209,18 @@
public DataStorage getStorage() {
return storage;
}
+
+ public Map<String, String> getSubZonesMap(String zoneId, List<String> allowedZones) {
+ Map<String, String> result = Maps.newHashMap();
+
+ if (allowedZones != null) {
+
+ if (allowedZones.contains(zoneId)) {
+ String zoneFullName = getZoneFullNameWithNoFacade(zoneId);
+ result.put(zoneId, zoneFullName);
+ }
+ }
+
+ return result;
+ }
}
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/result/CoserResultEngine.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/CoserResultEngine.java 2014-03-10 10:23:18 UTC (rev 1140)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/CoserResultEngine.java 2014-03-11 09:28:43 UTC (rev 1141)
@@ -31,8 +31,7 @@
import fr.ifremer.coser.result.repository.ResultRepositoryProvider;
import fr.ifremer.coser.result.repository.echobase.EchoBaseResultRepositoryProvider;
import fr.ifremer.coser.result.repository.legacy.LegacyResultRepositoryProvider;
-import fr.ifremer.coser.result.request.IndicatorRequest;
-import org.apache.commons.collections.MapUtils;
+import org.apache.commons.collections4.MapUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -97,6 +96,11 @@
this.repositories = null;
}
+ public Map<String, String> getAvailableExtractTypes() {
+ Map<String, String> result = Maps.newLinkedHashMap();
+ return result;
+ }
+
public Map<String, String> getAvailableZones(CoserRequest request) {
Map<String, String> result = Maps.newHashMap();
for (ResultRepository repository : getRepositories()) {
@@ -119,7 +123,7 @@
return result;
}
- public Map<String, String> getAvailableIndicators(IndicatorRequest request) {
+ public Map<String, String> getAvailableIndicators(CoserRequest request) {
Map<String, String> result = Maps.newHashMap();
for (ResultRepository repository : getRepositories()) {
Map<String, String> resultForRepository = repository.getAvailableIndicators(request);
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/result/Reports.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/Reports.java 2014-03-10 10:23:18 UTC (rev 1140)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/Reports.java 2014-03-11 09:28:43 UTC (rev 1141)
@@ -22,10 +22,59 @@
* #L%
*/
+import com.google.common.base.Preconditions;
+import com.itextpdf.text.DocumentException;
+import fr.ifremer.coser.CoserConstants;
+import fr.ifremer.coser.CoserTechnicalException;
+import fr.ifremer.coser.CoserUtils;
+import fr.ifremer.coser.bean.IndicatorMap;
+import fr.ifremer.coser.bean.Project;
+import fr.ifremer.coser.bean.RSufiResult;
+import fr.ifremer.coser.bean.RSufiResultPath;
+import fr.ifremer.coser.bean.Selection;
+import fr.ifremer.coser.bean.ZoneMap;
+import fr.ifremer.coser.storage.DataStorage;
+import fr.ifremer.coser.storage.DataStorages;
+import freemarker.cache.ClassTemplateLoader;
+import freemarker.ext.beans.BeansWrapper;
+import freemarker.template.Configuration;
+import freemarker.template.Template;
+import freemarker.template.TemplateException;
+import org.apache.commons.collections4.keyvalue.MultiKey;
+import org.apache.commons.collections4.map.MultiKeyMap;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.StringEscapeUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.i18n.I18n;
+import org.w3c.dom.Document;
+import org.xhtmlrenderer.pdf.ITextRenderer;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.StringWriter;
+import java.io.Writer;
+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.Locale;
+import java.util.Map;
+import java.util.Set;
+import java.util.SortedSet;
+import java.util.TreeSet;
+import static org.nuiton.i18n.I18n.l;
+
/**
+ * For reports generation.
+ * <p/>
* Created on 3/7/14.
*
* @author Tony Chemit <chemit(a)codelutin.com>
@@ -33,39 +82,384 @@
*/
public class Reports {
- public static String getYearChartTitle(Locale locale) {
- String yearAxis = "Year";
- if ("fr".equals(locale.getLanguage())) {
- yearAxis = "Ann\u00E9e";
- } else if ("es".equals(locale.getLanguage())) {
- yearAxis = "A\u00F1o";
- }
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(Reports.class);
+
+ /** Freemarker. */
+ protected Configuration freemarkerConfiguration;
+
+ public Reports() {
+
+ freemarkerConfiguration = new Configuration();
+
+ // needed to overwrite "Defaults to default system encoding."
+ // fix encoding issue on some systems
+ freemarkerConfiguration.setEncoding(Locale.getDefault(), "UTF-8");
+
+ // specific template loader to get template from jars (classpath)
+ ClassTemplateLoader templateLoader = new ClassTemplateLoader(Reports.class, "/ftl");
+ freemarkerConfiguration.setTemplateLoader(templateLoader);
+
+ // pour les maps dans les template (entre autre)
+ freemarkerConfiguration.setObjectWrapper(new BeansWrapper());
+ }
+
+ public String getDechargeFilename(Locale locale) {
+ Preconditions.checkNotNull(locale);
+ String filename = I18n.l(locale, "coser.business.dataDisclaimer.filename");
+// if (locale != null && "fr".equals(locale.getLanguage())) {
+// filename = "DechargeDonnees.pdf";
+// } else if (locale != null && "es".equals(locale.getLanguage())) {
+// filename = "DatosDeExencionDeResponsabilidad.pdf";
+// } else {
+// filename = "DataDisclaimer.pdf";
+// }
+ return filename;
+ }
+
+ public String getYearChartTitle(Locale locale) {
+ Preconditions.checkNotNull(locale);
+ String yearAxis = I18n.l(locale, "coser.business.year");
+// String yearAxis = "Year";
+// if ("fr".equals(locale.getLanguage())) {
+// yearAxis = "Ann\u00E9e";
+// } else if ("es".equals(locale.getLanguage())) {
+// yearAxis = "A\u00F1o";
+// }
return yearAxis;
}
/**
- * Retourne le nom d'affichage d'une especes pour les rapports.
+ * Genere le fichier PDF d'information sur les espèces incluses dans les
+ * calculs des indicateurs de communautés, à jointe à chaque téléchargement.
*
- * @param reftax species data storage
- * @param species species code
- * @return species display name
- * @since 1.5
+ * @param path path to result
+ * @param resultDirectory result directory
+ * @param locale locale
+ * @param indicatorLocalizedMap localized indicator map
+ * @return generated pdf file
*/
- public static String getReportDisplayName(Iterator<String[]> reftax, String species) {
- String displayName = null;
+ public File generateMetaFilePDF(RSufiResultPath path,
+ File resultDirectory,
+ Locale locale,
+ IndicatorMap indicatorLocalizedMap) {
- while (reftax.hasNext()) {
- String[] tuple = reftax.next();
+ Project project = path.getProject();
+ Selection selection = path.getSelection();
+ RSufiResult rsufiResult = path.getRsufiResult();
+ File result = null;
+
+ // chargement du reftax et des code types especes pour connaitre
+ // le type des especes de poissons
+ // parcourt du fichier des types de données
+ Map<String, Integer> refTaxSpeciesNumSys = new HashMap<String, Integer>();
+ Map<String, String> refTaxSpeciesName = new HashMap<String, String>();
+ Iterator<String[]> itReftax = project.getRefTaxSpecies().iterator(true);
+ while (itReftax.hasNext()) {
+ String[] tuple = itReftax.next();
// "C_Perm","NumSys","NivSys","C_VALIDE","L_VALIDE","AA_VALIDE","C_TxP\u00E8re","Taxa"
String speciesCode = tuple[3];
- if (speciesCode.equals(species)) {
- // nom + auteur (sans ajout de parenthese : important)
- displayName = tuple[4] + " " + tuple[5];
- break;
+ Integer iNumSys = Integer.valueOf(tuple[1]);
+ refTaxSpeciesNumSys.put(speciesCode, iNumSys);
+
+ // fix html entities bug
+ String speciesSciName = StringEscapeUtils.escapeXml(tuple[4]);
+ String speciesAuthor = StringEscapeUtils.escapeXml(tuple[5]);
+
+ // TODO little hack for italic species
+ refTaxSpeciesName.put(speciesCode, "<span style='font-style:italic'>" + speciesSciName + "</span> " + speciesAuthor);
+ }
+
+ // code type / especes
+ Map<String, Integer[]> specyTypes = new HashMap<String, Integer[]>();
+ Iterator<String[]> itTypeSpecies = project.getTypeEspeces().iterator(true);
+ while (itTypeSpecies.hasNext()) {
+ // "Types";"Commentaire";"NumSys min";"NumSys max","Code"
+ String[] tuple = itTypeSpecies.next();
+ String specyTypeCode = tuple[4];
+
+ Integer iMinNumSys = Integer.valueOf(tuple[2]);
+ Integer iMaxNumSys = Integer.valueOf(tuple[3]);
+ specyTypes.put(specyTypeCode, new Integer[]{iMinNumSys, iMaxNumSys});
+ }
+
+ // le fichier estpopind
+ File estComIndFile = new File(resultDirectory, rsufiResult.getEstComIndName());
+
+ // donnees intermediare (map liste id > liste des indicateurs)
+ Map<String, SortedSet<String>> indicatorMap = new HashMap<String, SortedSet<String>>();
+
+ // le resutat sera une map complexe
+ // map liste id > liste des especes (nom complet)
+ Map<String, SortedSet<String>> speciesMap = new HashMap<String, SortedSet<String>>();
+
+ // Campagne Indicateur Liste Strate Annee Estimation EcartType CV
+ DataStorage dataStorage = DataStorages.load(estComIndFile, CoserConstants.CSV_RESULT_SEPARATOR_CHAR);
+ Iterator<String[]> estComIndIterator = dataStorage.iterator(true);
+ while (estComIndIterator.hasNext()) {
+ String[] tuple = estComIndIterator.next();
+
+ String indicatorCode = tuple[1];
+ String listIdCode = tuple[2]; // c1, p2, T3 ...
+
+ String listNumber = listIdCode.substring(1); // 1, 2, 3
+
+ // get indicator list
+ SortedSet<String> indicatorList = indicatorMap.get(listNumber);
+ if (indicatorList == null) {
+ indicatorList = new TreeSet<String>();
+ indicatorMap.put(listNumber, indicatorList);
}
+
+ // get indicator full name
+ String indicatorName = indicatorLocalizedMap.getIndicatorValue(indicatorCode, locale.getLanguage());
+ // peut arriver pour les indicateurs inconnu par coser
+ if (indicatorName != null) {
+ indicatorList.add(indicatorName);
+ }
}
- return displayName;
+ // seconde pass, remplit la map speciesMap avec les listes configurées
+ // dans la selection
+ for (String listNumber : indicatorMap.keySet()) {
+ List<String> selectionSpeciesList = null;
+ if ("1".equals(listNumber)) {
+ selectionSpeciesList = selection.getSelectedSpecies();
+ } else if ("2".equals(listNumber)) {
+ selectionSpeciesList = selection.getSelectedSpeciesOccDens();
+ } else if ("3".equals(listNumber)) {
+ selectionSpeciesList = selection.getSelectedSpeciesSizeAllYear();
+ } else if ("4".equals(listNumber)) {
+ selectionSpeciesList = selection.getSelectedSpeciesMaturity();
+ }
+
+ if (selectionSpeciesList != null) {
+ SortedSet<String> speciesList = new TreeSet<String>();
+
+ for (String speciesCode : selectionSpeciesList) {
+ // get species full name
+ String speciesName = refTaxSpeciesName.get(speciesCode);
+
+ // recupere le code type de l'espece, "m", "c", "p" ...
+ Integer speciesNumSys = refTaxSpeciesNumSys.get(speciesCode);
+ for (Map.Entry<String, Integer[]> speciesTypeEntry : specyTypes.entrySet()) {
+ String speciesTypeCode = speciesTypeEntry.getKey();
+ Integer[] bound = speciesTypeEntry.getValue();
+
+ if (speciesNumSys >= bound[0] && speciesNumSys <= bound[1]) {
+ speciesName = "(" + speciesTypeCode + ") " + speciesName;
+ break;
+ }
+ }
+ // end code type espece
+
+ speciesList.add(speciesName);
+ }
+ speciesMap.put(listNumber, speciesList);
+ } else {
+ if (log.isWarnEnabled()) {
+ log.warn("Can't get species list for list id " + listNumber);
+ }
+ }
+ }
+
+ OutputStream os = null;
+ try {
+ // render freemarker template
+ Template mapTemplate = freemarkerConfiguration.getTemplate("metainfo.ftl", locale);
+
+ Map<String, Object> root = new HashMap<String, Object>();
+ root.put("indicatorsMap", indicatorMap);
+ root.put("speciesMap", speciesMap);
+
+ Writer out = new StringWriter();
+ mapTemplate.process(root, out);
+ out.flush();
+
+ // get content as w3c document
+ Document document = CoserUtils.parseDocument(out.toString());
+
+ // render template output as pdf
+ result = File.createTempFile("coser-metainfo-", ".pdf");
+ result.deleteOnExit();
+ os = new FileOutputStream(result);
+
+ ITextRenderer renderer = new ITextRenderer();
+ renderer.setDocument(document, null);
+ renderer.layout();
+ renderer.createPDF(os);
+
+ os.close();
+ } catch (IOException ex) {
+ throw new CoserTechnicalException("Can't generate meta info file", ex);
+ } catch (TemplateException ex) {
+ throw new CoserTechnicalException("Can't generate meta info file", ex);
+ } catch (DocumentException ex) {
+ throw new CoserTechnicalException("Can't generate meta info file", ex);
+ } finally {
+ IOUtils.closeQuietly(os);
+ }
+
+ return result;
}
+
+ /**
+ * Genere le PDF dynamique de decharge à partir du template freemarker.
+ *
+ * @param disclamerPdf pdf file to generate
+ * @param locale generated pdf locale
+ */
+ public void generateDechargePDF(File disclamerPdf, Locale locale, Date updateDate, String surveyName) {
+
+ OutputStream os = null;
+
+ try {
+ // get some info to put into pdf
+// Date updateDate = getLastDataUpdateDate();
+
+// // il se peut que pour l'extraction un fichier de décharge ne soit
+// // pas généré pour une campagne en particulier
+// // on passe un nom vide a freemarker
+// String surveyName = "";
+// if (resultDirectory != null && rSufiResult != null) {
+// surveyName = projectService.getProjectSurveyName(resultDirectory, rSufiResult);
+// }
+
+ // render freemarker template
+ Template mapTemplate = freemarkerConfiguration.getTemplate("decharge.ftl", locale);
+
+ Map<String, Object> root = new HashMap<String, Object>();
+ root.put("updateDate", updateDate);
+ root.put("surveyName", surveyName);
+
+ Writer out = new StringWriter();
+ mapTemplate.process(root, out);
+ out.flush();
+
+ // get content as w3c document
+ Document document = CoserUtils.parseDocument(out.toString());
+
+ // render template output as pdf
+ os = new FileOutputStream(disclamerPdf);
+
+ ITextRenderer renderer = new ITextRenderer();
+ renderer.setDocument(document, null);
+ renderer.layout();
+ renderer.createPDF(os);
+
+ os.close();
+ } catch (IOException ex) {
+ throw new CoserTechnicalException("Can't generate decharge file", ex);
+ } catch (TemplateException ex) {
+ throw new CoserTechnicalException("Can't generate decharge file", ex);
+ } catch (DocumentException ex) {
+ throw new CoserTechnicalException("Can't generate decharge file", ex);
+ } finally {
+ IOUtils.closeQuietly(os);
+ }
+ }
+
+ /**
+ * Generate pdf file filled with maps and charts.
+ *
+ * @param directory directory to generate pdf to
+ * @param zones zones ids
+ * @param pdfMaps pdf maps (can be {@code null})
+ * @param pdfCharts pdf charts (can be {@code null})
+ * @param zoneMap zoneMap (to get zone fullnames)
+ * @param locale locale to use for translations
+ */
+ public void generateExtractPDF(File directory,
+ List<String> zones,
+ MultiKeyMap pdfMaps,
+ MultiKeyMap pdfCharts,
+ ZoneMap zoneMap,
+ Locale locale) {
+
+ for (String zone : zones) {
+ Collection<File> toDelete = new ArrayList<File>();
+ OutputStream os = null;
+
+ try {
+ StringBuilder htmlContent = new StringBuilder();
+ htmlContent.append("<html><head>");
+ htmlContent.append("<title>").append(l(locale, "coser.business.extract.extracttitle")).append("</title>");
+ htmlContent.append("<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />");
+ htmlContent.append("</head><body>");
+
+ if (pdfMaps != null) {
+ for (Map.Entry<MultiKey, File> mapEntry : (Set<Map.Entry<MultiKey, File>>) pdfMaps.entrySet()) {
+ String zoneId = (String) mapEntry.getKey().getKey(0);
+ if (zoneId.equals(zone)) {
+ String speciesName = (String) mapEntry.getKey().getKey(1);
+ File file = mapEntry.getValue();
+
+ String zoneName = zoneMap.getZoneFullName(zoneId);
+ htmlContent.append("<div style='page-break-after: always'>");
+ htmlContent.append("<p>").append(zoneName).append(" - ").append(speciesName).append("</p>");
+ htmlContent.append("<img src='file://").append(file.getAbsolutePath()).append("' />");
+ htmlContent.append("</div>");
+ }
+ }
+ }
+
+ if (pdfCharts != null) {
+ for (Map.Entry<MultiKey, Object[]> chartFileAndData : (Set<Map.Entry<MultiKey, Object[]>>) pdfCharts.entrySet()) {
+ String zoneId = (String) chartFileAndData.getKey().getKey(0);
+ if (zoneId.equals(zone)) {
+ File chartFile = (File) chartFileAndData.getValue()[0];
+ String content = (String) chartFileAndData.getValue()[1];
+
+ htmlContent.append("<div style='page-break-after: always'>");
+ htmlContent.append("<img src='file://");
+ htmlContent.append(chartFile.getAbsolutePath());
+ htmlContent.append("' />");
+ htmlContent.append("<br />");
+ htmlContent.append(l(locale, "coser.business.extract.extractdata")).append(" :");
+ htmlContent.append("<pre>").append(content).append("</pre>");
+ htmlContent.append("</div>");
+
+ // les graphiques ont été générés, a supprimer donc
+ // a ne surtout pas faire avec les cartes !!!
+ toDelete.add(chartFile);
+ }
+ }
+ }
+
+ htmlContent.append("</body></html>");
+
+ // get content as w3c document
+ Document document = CoserUtils.parseDocument(htmlContent.toString());
+
+ // render template output as pdf
+ // remove accents and strange characters from zone display name
+ String zoneDisplay = zoneMap.getZoneFullName(zone);
+ zoneDisplay = StringUtils.stripAccents(zoneDisplay);
+ zoneDisplay = zoneDisplay.replaceAll("[^\\w- ]", "_");
+ File pdfFile = new File(directory, zoneDisplay + ".pdf");
+ os = new FileOutputStream(pdfFile);
+
+ ITextRenderer renderer = new ITextRenderer();
+ renderer.setDocument(document, null);
+ renderer.layout();
+ renderer.createPDF(os);
+
+ os.close();
+ } catch (IOException ex) {
+ throw new CoserTechnicalException("Can't generate log pdf", ex);
+ } catch (DocumentException ex) {
+ throw new CoserTechnicalException("Can't generate log pdf", ex);
+ } finally {
+ IOUtils.closeQuietly(os);
+
+
+ // delete file collection
+ for (File file : toDelete) {
+// file.delete();
+ FileUtils.deleteQuietly(file);
+ }
+ }
+ }
+ }
}
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/RequestUnavailableForProducerException.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/RequestUnavailableForProducerException.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/RequestUnavailableForProducerException.java 2014-03-11 09:28:43 UTC (rev 1141)
@@ -0,0 +1,49 @@
+package fr.ifremer.coser.result.repository;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+/**
+ * When a request ask a unavailable result of a producer.
+ * <p/>
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class RequestUnavailableForProducerException extends RuntimeException {
+
+ private static final long serialVersionUID = 1L;
+
+ public static RequestUnavailableForProducerException newException(String methodName, ResultProducer<?> producer) {
+ return new RequestUnavailableForProducerException(methodName, producer.getRepository().getId());
+ }
+
+ protected final String methodName;
+
+ protected final String repositoryId;
+
+ protected RequestUnavailableForProducerException(String methodName, String repositoryId) {
+ this.methodName = methodName;
+ this.repositoryId = repositoryId;
+ }
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/RequestUnavailableForProducerException.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/ResultProducer.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/ResultProducer.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/ResultProducer.java 2014-03-11 09:28:43 UTC (rev 1141)
@@ -0,0 +1,50 @@
+package fr.ifremer.coser.result.repository;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.coser.result.CoserRequest;
+import fr.ifremer.coser.result.CoserResult;
+
+import java.util.Map;
+
+/**
+ * To execute a result.
+ * <p/>
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public interface ResultProducer<R extends CoserRequest> {
+
+ ResultRepository getRepository();
+
+ Map<String, String> getAvailableZones(R request);
+
+ Map<String, String> getAvailableSpecies(R request);
+
+ Map<String, String> getAvailableIndicators(R request);
+
+ CoserResult produceResult(R request);
+
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/ResultProducer.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/ResultRepository.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/ResultRepository.java 2014-03-10 10:23:18 UTC (rev 1140)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/ResultRepository.java 2014-03-11 09:28:43 UTC (rev 1141)
@@ -24,7 +24,6 @@
import fr.ifremer.coser.result.CoserRequest;
import fr.ifremer.coser.result.CoserResult;
-import fr.ifremer.coser.result.request.IndicatorRequest;
import java.util.Map;
@@ -65,7 +64,7 @@
* @param request request
* @return all available indicators for the given request.
*/
- Map<String, String> getAvailableIndicators(IndicatorRequest request);
+ Map<String, String> getAvailableIndicators(CoserRequest request);
/**
* @param request request to test
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/CommunityIndicatorResultProducer.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/CommunityIndicatorResultProducer.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/CommunityIndicatorResultProducer.java 2014-03-11 09:28:43 UTC (rev 1141)
@@ -0,0 +1,392 @@
+package fr.ifremer.coser.result.repository.echobase;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import fr.ifremer.coser.CoserTechnicalException;
+import fr.ifremer.coser.bean.EchoBaseProject;
+import fr.ifremer.coser.bean.ZoneMap;
+import fr.ifremer.coser.result.FileResult;
+import fr.ifremer.coser.result.Reports;
+import fr.ifremer.coser.result.repository.ResultProducer;
+import fr.ifremer.coser.result.request.CommunityIndicatorRequest;
+import fr.ifremer.coser.storage.DataStorage;
+import fr.ifremer.coser.storage.DataStorages;
+import fr.ifremer.coser.storage.MemoryDataStorage;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jfree.chart.ChartUtilities;
+import org.jfree.chart.JFreeChart;
+import org.jfree.chart.axis.CategoryAxis;
+import org.jfree.chart.axis.CategoryLabelPositions;
+import org.jfree.chart.axis.NumberAxis;
+import org.jfree.chart.axis.ValueAxis;
+import org.jfree.chart.plot.CategoryPlot;
+import org.jfree.chart.plot.PlotOrientation;
+import org.jfree.chart.renderer.category.CategoryItemRenderer;
+import org.jfree.chart.renderer.category.StatisticalLineAndShapeRenderer;
+import org.jfree.data.statistics.DefaultStatisticalCategoryDataset;
+import org.nuiton.util.FileUtil;
+import org.nuiton.util.ZipUtil;
+
+import java.awt.Color;
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class CommunityIndicatorResultProducer implements ResultProducer<CommunityIndicatorRequest> {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(CommunityIndicatorResultProducer.class);
+
+ protected final EchoBaseResultRepository repository;
+
+ protected final Reports reports;
+
+ protected final EchoBaseProject project;
+
+ public CommunityIndicatorResultProducer(EchoBaseResultRepository repository) {
+ this.repository = repository;
+ this.project = repository.project;
+ this.reports = repository.reports;
+ }
+
+ @Override
+ public EchoBaseResultRepository getRepository() {
+ return repository;
+ }
+
+ @Override
+ public Map<String, String> getAvailableZones(CommunityIndicatorRequest request) {
+ Preconditions.checkNotNull(request.getFacade());
+
+ boolean match = repository.matchFacade(request);
+
+ Map<String, String> result = null;
+ if (match) {
+ ZoneMap zonesMap = repository.getZonesMap();
+ List<String> allowedZones = zonesMap.getZonesForFacade(request.getFacade());
+ result = zonesMap.getSubZonesMap(project.getZoneName(), allowedZones);
+ }
+ return result;
+ }
+
+ @Override
+ public Map<String, String> getAvailableSpecies(CommunityIndicatorRequest request) {
+ Preconditions.checkNotNull(request.getFacade());
+ Preconditions.checkNotNull(request.getZone());
+ Preconditions.checkNotNull(request.getIndicator());
+
+ boolean match = repository.matchFacade(request) &&
+ repository.matchZone(request) &&
+ repository.matchIndicator(request);
+
+ Map<String, String> result = null;
+
+ if (match) {
+ // get all speciesList for given facade + zone + indicator
+ Set<String> speciesList = repository.getCommunityIndicatorSpecies(request.getIndicator());
+ result = repository.getSpeciesMap().getSpeciesSubMap(speciesList);
+ }
+ return result;
+ }
+
+ @Override
+ public Map<String, String> getAvailableIndicators(CommunityIndicatorRequest request) {
+ Preconditions.checkNotNull(request.getFacade());
+ Preconditions.checkNotNull(request.getZone());
+
+ Map<String, String> result = null;
+ boolean match = repository.matchFacade(request) && repository.matchZone(request);
+ if (match) {
+
+ // get all indicators for given facade + zone
+ Set<String> indicatorList = repository.getCommunityIndicators();
+ result = repository.getIndicatorsMap().getIndicatorsValues(indicatorList, request.getLocale());
+ }
+ return result;
+ }
+
+ @Override
+ public FileResult produceResult(CommunityIndicatorRequest r) {
+
+ File file = null;
+ switch (r.getResultType()) {
+ case DATA:
+ file = getCommunityIndicatorDataFile(r.getLocale(),
+ r.getIndicator(),
+ r.getSpecies());
+ break;
+
+ case GRAPH:
+ file = getCommunityIndicatorGraphFile(r.getLocale(),
+ r.getZone(),
+ r.getIndicator(),
+ r.getSpecies());
+ break;
+ }
+ FileResult result = new FileResult(repository.getId(), file);
+ return result;
+ }
+
+
+ protected File getCommunityIndicatorDataFile(Locale locale,
+ String indicator,
+ String speciesList) {
+
+ try {
+
+ File tempDir = FileUtil.createTempDirectory("coser-chart-population-indicator", "-tmp");
+
+ File baseDir = new File(tempDir, project.getSurveyName());
+ FileUtils.forceMkdir(baseDir);
+
+ // ajout du fichier csv avec les indicateurs
+ DataStorage dataStorage = new MemoryDataStorage();
+
+ Iterator<String[]> iterator = repository.loadCommunityIndicatorStorage(false);
+
+ // add header
+ dataStorage.add(iterator.next());
+
+ while (iterator.hasNext()) {
+ String[] tuple = iterator.next();
+ if (repository.matchCommunityIndicatorAndSpeciesList(tuple, indicator, speciesList)) {
+ dataStorage.add(tuple);
+ }
+ }
+ File csvFile = DataStorages.save(dataStorage, "coser-chart-community-indicator",
+ ".csv"
+ );
+
+ File csvFileCopied = new File(baseDir, indicator + ".csv");
+ FileUtils.copyFile(csvFile, csvFileCopied);
+ FileUtils.forceDelete(csvFile);
+
+ //TODO See what to generate here (we don't have any selection in echobase results).
+// // ajout du fichier d'information sur les espèces incluses dans
+// // les calculs des indicateurs de communautés
+// // load project (without data to get reftax data)
+// Project project = path.getProject();
+// Selection selection = path.getSelection();
+// File metaFile = webService.generateMetaFilePDF(project,
+// selection,
+// resultDirectory,
+// rSufiResult,
+// indicator,
+// locale);
+// File metaFileCopied = new File(baseDir, "Information.pdf");
+// FileUtils.copyFile(metaFile, metaFileCopied);
+
+ // make zip
+ File result = File.createTempFile("coser-chart-community-indicator", ".zip");
+ result.deleteOnExit();
+ ZipUtil.compress(result, baseDir);
+
+ // clean directory
+ FileUtils.deleteDirectory(tempDir);
+ return result;
+ } catch (Exception e) {
+ throw new CoserTechnicalException("Can't create zip file", e);
+ }
+ }
+
+ protected File getCommunityIndicatorGraphFile(Locale locale,
+ String zone,
+ String indicator,
+ String speciesList) {
+
+ // indicator list to take care
+ // pour avoir une valeur non nulle si list est null
+ // on prend dans ce cas la premiere valeur trouvée
+ String localList = speciesList;
+
+ if (log.isDebugEnabled()) {
+ log.debug("Searching list for indicator : " + indicator);
+ }
+
+ int multiplicator = 1;
+ int minYear = Integer.MAX_VALUE;
+ int maxYear = Integer.MIN_VALUE;
+ boolean indicatorFound = false;
+ Map<Integer, Double[]> graphData = new HashMap<Integer, Double[]>();
+ Iterator<String[]> iterator = repository.loadCommunityIndicatorStorage(true);
+ while (iterator.hasNext()) {
+ // Campagne Indicateur Liste Strate Annee Estimation EcartType CV
+ String[] tuple = iterator.next();
+ String indicatorList = tuple[2];
+
+ if (repository.matchIndicatorIndicator(tuple, indicator)) {
+ indicatorFound = true;
+
+ // si pas de list selectionnée, on prend la premiere
+ if (StringUtils.isBlank(localList)) {
+ localList = indicatorList;
+ }
+
+ if (indicatorList.equals(localList)) {
+ Double estimation = Double.parseDouble(tuple[5]);
+ Double ecart = Double.parseDouble(tuple[6]);
+ int year = Integer.parseInt(tuple[4]);
+
+ if (year < minYear) {
+ minYear = year;
+ }
+ if (year > maxYear) {
+ maxYear = year;
+ }
+ graphData.put(year, new Double[]{estimation, ecart});
+
+ // si les données sont énormes, on affiche les données
+ // / multiplicator et on le mentionne dans la légende
+ if (estimation > 1e9) {
+ multiplicator = 1000000;
+ }
+ if (estimation > 1e6 && multiplicator < 1000000) {
+ multiplicator = 1000;
+ }
+ }
+ }
+ }
+
+ File result = null;
+
+ // avec l'extraction des données, on peut demander a générer un graphique
+ // sur un indicateur qui n'est pas présent dans le projet courant,
+ // dans ce cas, on retourne null
+ if (indicatorFound) {
+
+ String zoneDisplayName = repository.getZonesMap().getZoneFullName(zone);
+ String indicatorName = repository.getIndicatorsMap().getIndicatorValue(indicator, locale);
+ String unit = repository.getIndicatorsMap().getIndicatorUnit(indicator);
+
+ // get graph title
+ String chartTitle = zoneDisplayName;
+ chartTitle += " - " + indicatorName;
+
+ // ajout de la traduction de la liste d'indicateur
+ // les liste sont a1, T1, T2 ...
+ String listLetter = String.valueOf(localList.charAt(0));
+ Iterator<String[]> typeIterator = repository.getSpeciesMap().iterator(true);
+ while (typeIterator.hasNext()) {
+ // "Types";"Commentaire";"NumSys min";"NumSys max";"Code"
+ String[] tuple = typeIterator.next();
+ if (tuple[4].equals(listLetter)) {
+ /// gestion du groupe "Tous"
+ // cas special, c'est la seule valeur du fichier
+ // code type espece qui a besoin d'une traduction
+ if (tuple[4].equalsIgnoreCase("T")) {
+ if ("fr".equals(locale.getLanguage())) {
+ chartTitle += " - " + "Tous Liste " + localList.charAt(1);
+ } else if ("es".equals(locale.getLanguage())) {
+ chartTitle += " - " + "Todo Lista " + localList.charAt(1);
+ } else {
+ chartTitle += " - " + "All List " + localList.charAt(1);
+ }
+ } else {
+ // ajout de la traduction du nom de liste plus le numéro
+ if ("fr".equals(locale.getLanguage())) {
+ chartTitle += " - " + tuple[0] + " Liste " + localList.charAt(1);
+ } else if ("es".equals(locale.getLanguage())) {
+ chartTitle += " - " + tuple[0] + " Lista " + localList.charAt(1);
+ } else {
+ chartTitle += " - " + tuple[0] + " List " + localList.charAt(1);
+ }
+ }
+ break;
+ }
+ }
+
+ // generate dataset with sorted data
+ DefaultStatisticalCategoryDataset statisticalDataset = new DefaultStatisticalCategoryDataset();
+ for (int indexYear = minYear; indexYear <= maxYear; ++indexYear) {
+ Double[] entry = graphData.get(indexYear);
+ if (entry != null) {
+ Double estimation = entry[0] / multiplicator;
+ Double ecart = entry[1] / multiplicator;
+ statisticalDataset.add(estimation, ecart, "Serie1", (Comparable) indexYear);
+ } else {
+ statisticalDataset.add(null, null, "Serie1", indexYear);
+ }
+ }
+
+ // configure chart
+ //CategoryAxis categoryAxis = new CategoryAxis(t("coser.business.common.year"));
+ String yearAxis = reports.getYearChartTitle(locale);
+
+ CategoryAxis categoryAxis = new CategoryAxis(yearAxis);
+ categoryAxis.setCategoryMargin(0);
+ categoryAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
+ // label horizontaux
+ String legendY = indicatorName;
+ if (multiplicator != 1) {
+ // affiche par exemple : cm * 1000
+ legendY += " (" + unit + "*" + multiplicator + ")";
+ } else if (StringUtils.isNotEmpty(unit)) {
+ legendY += " (" + unit + ")";
+ }
+ ValueAxis valueAxis = new NumberAxis(legendY);
+ valueAxis.setUpperMargin(0.1);
+
+ CategoryItemRenderer renderer = new StatisticalLineAndShapeRenderer(false, true);
+
+ // n'affiche pas les nombre sur le graphique
+ //StandardCategoryItemLabelGenerator itemLabelGenerator = new StandardCategoryItemLabelGenerator();
+ //renderer.setBaseItemLabelGenerator(itemLabelGenerator);
+ //renderer.setBaseItemLabelsVisible(true);
+
+ CategoryPlot plot = new CategoryPlot(statisticalDataset, categoryAxis, valueAxis, renderer);
+ plot.setOrientation(PlotOrientation.VERTICAL);
+ JFreeChart chart = new JFreeChart(chartTitle,
+ JFreeChart.DEFAULT_TITLE_FONT, plot, true);
+
+ // remove series legend
+ chart.removeLegend();
+ // white background
+ chart.setBackgroundPaint(Color.WHITE);
+
+ try {
+ result = File.createTempFile("coser-chart-community-indicator-", ".png");
+ result.deleteOnExit();
+ ChartUtilities.saveChartAsPNG(result, chart, 800, 400);
+ } catch (IOException ex) {
+ throw new CoserTechnicalException("Can't save chart", ex);
+ }
+ }
+
+ return result;
+ }
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/CommunityIndicatorResultProducer.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/EchoBaseResultRepository.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/EchoBaseResultRepository.java 2014-03-10 10:23:18 UTC (rev 1140)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/EchoBaseResultRepository.java 2014-03-11 09:28:43 UTC (rev 1141)
@@ -28,50 +28,32 @@
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import fr.ifremer.coser.CoserBusinessConfig;
-import fr.ifremer.coser.CoserTechnicalException;
import fr.ifremer.coser.bean.EchoBaseProject;
import fr.ifremer.coser.bean.IndicatorMap;
+import fr.ifremer.coser.bean.SpeciesMap;
import fr.ifremer.coser.bean.ZoneMap;
import fr.ifremer.coser.result.CoserRequest;
import fr.ifremer.coser.result.CoserResult;
-import fr.ifremer.coser.result.FileResult;
import fr.ifremer.coser.result.Reports;
+import fr.ifremer.coser.result.repository.ResultProducer;
import fr.ifremer.coser.result.repository.ResultRepository;
import fr.ifremer.coser.result.request.CommunityIndicatorRequest;
-import fr.ifremer.coser.result.request.IndicatorRequest;
+import fr.ifremer.coser.result.request.CoserRequestFacadeAware;
+import fr.ifremer.coser.result.request.CoserRequestZoneAware;
+import fr.ifremer.coser.result.request.ExtractRequest;
import fr.ifremer.coser.result.request.MapRequest;
import fr.ifremer.coser.result.request.PopulationIndicatorRequest;
import fr.ifremer.coser.result.request.RawDataRequest;
import fr.ifremer.coser.storage.DataStorage;
import fr.ifremer.coser.storage.DataStorages;
-import fr.ifremer.coser.storage.MemoryDataStorage;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang3.StringUtils;
+import fr.ifremer.coser.util.DataType;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jfree.chart.ChartUtilities;
-import org.jfree.chart.JFreeChart;
-import org.jfree.chart.axis.CategoryAxis;
-import org.jfree.chart.axis.CategoryLabelPositions;
-import org.jfree.chart.axis.NumberAxis;
-import org.jfree.chart.axis.ValueAxis;
-import org.jfree.chart.plot.CategoryPlot;
-import org.jfree.chart.plot.PlotOrientation;
-import org.jfree.chart.renderer.category.CategoryItemRenderer;
-import org.jfree.chart.renderer.category.StatisticalLineAndShapeRenderer;
-import org.jfree.data.statistics.DefaultStatisticalCategoryDataset;
-import org.nuiton.util.FileUtil;
-import org.nuiton.util.ZipUtil;
-import java.awt.Color;
import java.io.File;
import java.io.FilenameFilter;
-import java.io.IOException;
-import java.util.Collection;
-import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
-import java.util.Locale;
import java.util.Map;
import java.util.Set;
@@ -124,7 +106,7 @@
/**
* Cache of species definition.
*/
- protected Map<String, String> speciesMap;
+ protected SpeciesMap speciesMap;
/**
* Cache of indicator definition.
@@ -141,19 +123,36 @@
*/
protected DataStorage speciesDefinition;
+ /**
+ * Report helper.
+ */
+ protected final Reports reports;
+
+ protected final Map<Class<?>, ResultProducer<?>> resultProducers;
+
public EchoBaseResultRepository(CoserBusinessConfig config, EchoBaseProject project) {
Preconditions.checkNotNull(config);
Preconditions.checkNotNull(project);
this.config = config;
this.project = project;
this.mapsDirectory = project.getMapsDirectory();
- if (log.isInfoEnabled()) {
- log.info("New result repository: " + getId());
- }
+ this.reports = new Reports();
+
String surveyName = project.getSurveyName();
this.mapFileToSpeciesCode = EchoBaseProject.newMapFileToSpeciesCode(surveyName);
this.speciesCodeToMapFile = EchoBaseProject.newSpeciesCodeToMapFileName(surveyName);
this.mapSpeciesFilenameFilter = EchoBaseProject.newMapSpeciesFilenameFilter(surveyName);
+
+ this.resultProducers = Maps.newHashMap();
+ this.resultProducers.put(MapRequest.class, new MapResultProducer(this));
+ this.resultProducers.put(CommunityIndicatorRequest.class, new CommunityIndicatorResultProducer(this));
+ this.resultProducers.put(PopulationIndicatorRequest.class, new PopulationIndicatorResultProducer(this));
+ this.resultProducers.put(RawDataRequest.class, new RawDataResultProducer(this));
+ this.resultProducers.put(ExtractRequest.class, new ExtractResultProducer(this));
+
+ if (log.isInfoEnabled()) {
+ log.info("New result repository: " + getId());
+ }
}
// --------------------------------------------------------------------- //
@@ -168,115 +167,30 @@
@Override
public Map<String, String> getAvailableZones(CoserRequest request) {
- List<String> allowedZones = null;
+ ResultProducer resultProducer = getProducer(request.getClass());
+ Preconditions.checkNotNull(resultProducer);
- if (request instanceof MapRequest) {
- MapRequest r = (MapRequest) request;
-
- boolean match = matchFacade(r);
- if (match) {
- allowedZones = getZonesMap().getZonesForFacade(r.getFacade());
- }
- } else if (request instanceof PopulationIndicatorRequest) {
- PopulationIndicatorRequest r = (PopulationIndicatorRequest) request;
-
- boolean match = matchFacade(r);
- if (match) {
- allowedZones = getZonesMap().getZonesForFacade(r.getFacade());
- }
- } else if (request instanceof CommunityIndicatorRequest) {
- CommunityIndicatorRequest r = (CommunityIndicatorRequest) request;
-
- boolean match = matchFacade(r);
- if (match) {
- allowedZones = getZonesMap().getZonesForFacade(r.getFacade());
- }
- }
-
- Map<String, String> result = Maps.newHashMap();
-
- if (allowedZones != null) {
-
- String zoneId = project.getZoneName();
- if (allowedZones.contains(zoneId)) {
- String zoneFullName = getZonesMap().getZoneFullNameWithNoFacade(zoneId);
- result.put(zoneId, zoneFullName);
- }
- }
-
+ Map<String, String> result = resultProducer.getAvailableZones(request);
return result;
}
@Override
public Map<String, String> getAvailableSpecies(CoserRequest request) {
- Set<String> speciesList = null;
+ ResultProducer resultProducer = getProducer(request.getClass());
+ Preconditions.checkNotNull(resultProducer);
- if (request instanceof MapRequest) {
- MapRequest r = (MapRequest) request;
-
- boolean match = matchFacade(r) && matchZone(r);
- if (match) {
- // get all map species for given facade + zone
- speciesList = getMapSpecies();
- }
- } else if (request instanceof PopulationIndicatorRequest) {
- PopulationIndicatorRequest r = (PopulationIndicatorRequest) request;
-
- boolean match = matchFacade(r) && matchZone(r);
-
- if (match) {
- // get all population indicator species for given facade + zone
- speciesList = getPopulationIndicatorSpecies();
- }
- } else if (request instanceof CommunityIndicatorRequest) {
- CommunityIndicatorRequest r = (CommunityIndicatorRequest) request;
-
- Preconditions.checkNotNull(r.getIndicator());
-
- boolean match = matchFacade(r) &&
- matchZone(r) &&
- matchIndicator(r);
-
- if (match) {
- // get all speciesList for given facade + zone + indicator
- speciesList = getCommunityIndicatorSpecies(r.getIndicator());
- }
- }
-
- Map<String, String> result = getSpeciesSubMap(speciesList);
+ Map<String, String> result = resultProducer.getAvailableSpecies(request);
return result;
}
@Override
- public Map<String, String> getAvailableIndicators(IndicatorRequest request) {
+ public Map<String, String> getAvailableIndicators(CoserRequest request) {
- Set<String> indicatorList = null;
+ ResultProducer resultProducer = getProducer(request.getClass());
+ Preconditions.checkNotNull(resultProducer);
- if (request instanceof PopulationIndicatorRequest) {
- PopulationIndicatorRequest r = (PopulationIndicatorRequest) request;
-
- Preconditions.checkNotNull(r.getSpecies());
-
- boolean match = matchFacade(request) && matchZone(request) && matchSpecies(r);
-
- if (match) {
-
- // get all indicators for given facade + zone + species
- indicatorList = getPopulationIndicators(r.getSpecies());
- }
-
- } else if (request instanceof CommunityIndicatorRequest) {
-
- boolean match = matchFacade(request) && matchZone(request);
- if (match) {
-
- // get all indicators for given facade + zone
- indicatorList = getCommunityIndicators();
- }
- }
-
- Map<String, String> result = getIndicatorsMap().getIndicatorsValues(indicatorList, request.getLocale());
+ Map<String, String> result = resultProducer.getAvailableIndicators(request);
return result;
}
@@ -317,6 +231,15 @@
result = matchFacade(r) &&
matchZone(r) &&
matchSpeciesAndIndicator(r);
+ } else if (request instanceof ExtractRequest) {
+
+ // must match extract type + zone + (species + indicator)
+ ExtractRequest r = (ExtractRequest) request;
+
+ result = matchExtractTypeSet(r) &&
+ matchZoneList(r) &&
+ (matchPopulationIndicatorListAndSpeciesList(r) ||
+ matchCommunityIndicatorListAndSpeciesList(r));
}
return result;
}
@@ -327,80 +250,33 @@
Preconditions.checkArgument(request.isFilled());
Preconditions.checkArgument(acceptResult(request));
- CoserResult result = null;
+ ResultProducer resultProducer = getProducer(request.getClass());
+ Preconditions.checkNotNull(resultProducer);
- if (request instanceof MapRequest) {
- MapRequest r = (MapRequest) request;
-
- String species = r.getSpecies();
-
- File mapFile = getMapSpeciesFile(species);
- result = new FileResult(getId(), mapFile);
-
- } else if (request instanceof RawDataRequest) {
-
- // No such result for echobase at the moment
- if (log.isDebugEnabled()) {
- log.debug("No result for RawDataRequest");
- }
-
- } else if (request instanceof CommunityIndicatorRequest) {
- CommunityIndicatorRequest r = (CommunityIndicatorRequest) request;
-
- File file = null;
- switch (r.getResultType()) {
- case DATA:
- file = getCommunityIndicatorDataFile(r.getIndicator(),
- r.getSpecies());
- break;
-
- case GRAPH:
- file = getCommunityIndicatorGraphFile(r.getLocale(),
- r.getZone(),
- r.getIndicator(),
- r.getSpecies());
- break;
- }
- if (file != null) {
- result = new FileResult(getId(), file);
- }
-
- } else if (request instanceof PopulationIndicatorRequest) {
- PopulationIndicatorRequest r = (PopulationIndicatorRequest) request;
-
- File file = null;
- switch (r.getResultType()) {
- case DATA:
- file = getPopulationIndicatorDataFile(r.getSpecies(),
- r.getIndicator());
- break;
-
- case GRAPH:
- file = getPopulationIndicatorGraphFile(r.getLocale(),
- r.getZone(),
- r.getSpecies(),
- r.getIndicator());
- break;
- }
- if (file != null) {
- result = new FileResult(getId(), file);
- }
- }
+ CoserResult result = resultProducer.produceResult(request);
return result;
}
+ protected <R extends CoserRequest> ResultProducer<R> getProducer(Class<R> requestType) {
+ return (ResultProducer<R>) resultProducers.get(requestType);
+ }
+
// --------------------------------------------------------------------- //
- // --- MapRequest matchers --------------------------------------------- //
+ // --- Common matchers ------------------------------------------------- //
// --------------------------------------------------------------------- //
- protected boolean matchFacade(MapRequest request) {
+ protected boolean matchFacade(CoserRequestFacadeAware request) {
return project.getFacadeName().equals(request.getFacade());
}
- protected boolean matchZone(MapRequest request) {
+ protected boolean matchZone(CoserRequestZoneAware request) {
return project.getZoneName().equals(request.getZone());
}
+ // --------------------------------------------------------------------- //
+ // --- MapRequest matchers --------------------------------------------- //
+ // --------------------------------------------------------------------- //
+
protected boolean matchSpecies(MapRequest request) {
String species = request.getSpecies();
File file = getMapSpeciesFile(species);
@@ -411,26 +287,33 @@
// --- RawDataRequest matchers ----------------------------------------- //
// --------------------------------------------------------------------- //
- protected boolean matchFacade(RawDataRequest request) {
- return project.getFacadeName().equals(request.getFacade());
- }
+ // None
- protected boolean matchZone(RawDataRequest request) {
- return project.getZoneName().equals(request.getZone());
- }
-
// --------------------------------------------------------------------- //
// --- IndicatorRequest matchers --------------------------------------- //
// --------------------------------------------------------------------- //
- protected boolean matchFacade(IndicatorRequest request) {
- return project.getFacadeName().equals(request.getFacade());
+ protected boolean matchIndicatorSpecies(String[] tuple, String species) {
+ String speciesCode = tuple[3];
+ boolean result = species.equals(speciesCode);
+ return result;
}
- protected boolean matchZone(IndicatorRequest request) {
- return project.getZoneName().equals(request.getZone());
+ protected boolean matchIndicatorIndicator(String[] tuple, String indicator) {
+ String indicatorCode = tuple[1];
+ boolean result = indicator.equals(indicatorCode);
+ return result;
}
+ protected boolean matchIndicatorSpeciesAndIndicator(String[] tuple,
+ String species,
+ String indicator) {
+ String speciesCode = tuple[3];
+ String indicatorCode = tuple[1];
+ boolean result = species.equals(speciesCode) && indicator.equals(indicatorCode);
+ return result;
+ }
+
// --------------------------------------------------------------------- //
// --- PopulationIndicatorRequest matchers ----------------------------- //
// --------------------------------------------------------------------- //
@@ -445,7 +328,7 @@
Iterator<String[]> iterator = loadPopulationIndicatorStorage(true);
while (iterator.hasNext()) {
String[] tuple = iterator.next();
- if (matchPopulationSpecies(tuple, species)) {
+ if (matchIndicatorSpecies(tuple, species)) {
result = true;
break;
}
@@ -465,7 +348,7 @@
Iterator<String[]> iterator = loadPopulationIndicatorStorage(true);
while (iterator.hasNext()) {
String[] tuple = iterator.next();
- if (matchPopulationSpeciesAndIndicator(tuple, species, indicator)) {
+ if (matchIndicatorSpeciesAndIndicator(tuple, species, indicator)) {
result = true;
break;
}
@@ -473,19 +356,6 @@
return result;
}
- protected boolean matchPopulationSpecies(String[] tuple, String species) {
- String speciesCode = tuple[3];
- boolean result = species.equals(speciesCode);
- return result;
- }
-
- protected boolean matchPopulationSpeciesAndIndicator(String[] tuple, String species, String indicator) {
- String speciesCode = tuple[3];
- String indicatorCode = tuple[1];
- boolean result = species.equals(speciesCode) && indicator.equals(indicatorCode);
- return result;
- }
-
// --------------------------------------------------------------------- //
// --- CommunityIndicatorRequest matchers ------------------------------ //
// --------------------------------------------------------------------- //
@@ -500,7 +370,7 @@
Iterator<String[]> iterator = loadCommunityIndicatorStorage(true);
while (iterator.hasNext()) {
String[] tuple = iterator.next();
- if (matchCommunityIndicator(tuple, indicator)) {
+ if (matchIndicatorIndicator(tuple, indicator)) {
result = true;
break;
}
@@ -528,401 +398,125 @@
return result;
}
- protected boolean matchCommunityIndicator(String[] tuple, String indicator) {
+ protected boolean matchCommunityIndicatorAndSpeciesList(String[] tuple,
+ String indicator,
+ String speciesList) {
String indicatorCode = tuple[1];
- boolean result = indicator.equals(indicatorCode);
- return result;
- }
-
- protected boolean matchCommunityIndicatorAndSpeciesList(String[] tuple, String indicator, String speciesList) {
- String indicatorCode = tuple[1];
String speciesListCode = tuple[2];
boolean result = indicator.equals(indicatorCode) && speciesList.equals(speciesListCode);
return result;
}
// --------------------------------------------------------------------- //
- // --- Get Map result -------------------------------------------------- //
+ // --- ExtractRequest matchers ----------------------------------------- //
// --------------------------------------------------------------------- //
- protected File getMapSpeciesFile(String species) {
- String fileName = speciesCodeToMapFile.apply(species);
- File file = fileName == null ? null : new File(mapsDirectory, fileName);
- return file;
+ protected boolean matchExtractTypeSet(ExtractRequest request) {
+ //TODO Should deal also with raw-data type
+ return !request.getExtractTypeList().contains(DataType.SOURCE);
}
- // --------------------------------------------------------------------- //
- // --- Get Raw Data result --------------------------------------------- //
- // --------------------------------------------------------------------- //
-
- // None for the moment
-
- // --------------------------------------------------------------------- //
- // --- Get Community indicator result ---------------------------------- //
- // --------------------------------------------------------------------- //
-
- protected File getCommunityIndicatorDataFile(String indicator, String speciesList) {
-
- try {
-
- File tempDir = FileUtil.createTempDirectory("coser-chart-population-indicator", "-tmp");
-
- File baseDir = new File(tempDir, project.getSurveyName());
- FileUtils.forceMkdir(baseDir);
-
- // ajout du fichier csv avec les indicateurs
- DataStorage dataStorage = new MemoryDataStorage();
-
- Iterator<String[]> iterator = loadCommunityIndicatorStorage(false);
-
- // add header
- dataStorage.add(iterator.next());
-
- while (iterator.hasNext()) {
- String[] tuple = iterator.next();
- if (matchCommunityIndicatorAndSpeciesList(tuple, indicator, speciesList)) {
- dataStorage.add(tuple);
- }
- }
- File csvFile = DataStorages.save("coser-chart-community-indicator",
- ".csv",
- dataStorage);
-
- File csvFileCopied = new File(baseDir, indicator + ".csv");
- FileUtils.copyFile(csvFile, csvFileCopied);
- FileUtils.forceDelete(csvFile);
-
- //TODO See what to generate here (we don't have any selection in echobase results).
-// // ajout du fichier d'information sur les espèces incluses dans
-// // les calculs des indicateurs de communautés
-// // load project (without data to get reftax data)
-// Project project = path.getProject();
-// Selection selection = path.getSelection();
-// File metaFile = webService.generateMetaFilePDF(project,
-// selection,
-// resultDirectory,
-// rSufiResult,
-// indicator,
-// locale);
-// File metaFileCopied = new File(baseDir, "Information.pdf");
-// FileUtils.copyFile(metaFile, metaFileCopied);
-
- // make zip
- File result = File.createTempFile("coser-chart-community-indicator", ".zip");
- result.deleteOnExit();
- ZipUtil.compress(result, baseDir);
-
- // clean directory
- FileUtils.deleteDirectory(tempDir);
- return result;
- } catch (IOException e) {
- throw new CoserTechnicalException("Can't create zip file", e);
- }
+ protected boolean matchZoneList(ExtractRequest request) {
+ return request.getZoneList().contains(project.getZoneName());
}
- protected File getCommunityIndicatorGraphFile(Locale locale, String zone,
- String indicator,
- String speciesList) {
+ protected boolean matchCommunityIndicatorList(ExtractRequest request) {
+ Preconditions.checkNotNull(request.getCommunityIndicatorList());
- // indicator list to take care
- // pour avoir une valeur non nulle si list est null
- // on prend dans ce cas la premiere valeur trouvée
- String localList = speciesList;
+ List<String> indicatorList = request.getCommunityIndicatorList();
- if (log.isDebugEnabled()) {
- log.debug("Searching list for indicator : " + indicator);
- }
+ boolean result = false;
- int multiplicator = 1;
- int minYear = Integer.MAX_VALUE;
- int maxYear = Integer.MIN_VALUE;
- boolean indicatorFound = false;
- Map<Integer, Double[]> graphData = new HashMap<Integer, Double[]>();
Iterator<String[]> iterator = loadCommunityIndicatorStorage(true);
while (iterator.hasNext()) {
- // Campagne Indicateur Liste Strate Annee Estimation EcartType CV
String[] tuple = iterator.next();
- String indicatorList = tuple[2];
-
- if (matchCommunityIndicator(tuple, indicator)) {
- indicatorFound = true;
-
- // si pas de list selectionnée, on prend la premiere
- if (StringUtils.isBlank(localList)) {
- localList = indicatorList;
- }
-
- if (indicatorList.equals(localList)) {
- Double estimation = Double.parseDouble(tuple[5]);
- Double ecart = Double.parseDouble(tuple[6]);
- int year = Integer.parseInt(tuple[4]);
-
- if (year < minYear) {
- minYear = year;
- }
- if (year > maxYear) {
- maxYear = year;
- }
- graphData.put(year, new Double[]{estimation, ecart});
-
- // si les données sont énormes, on affiche les données
- // / multiplicator et on le mentionne dans la légende
- if (estimation > 1e9) {
- multiplicator = 1000000;
- }
- if (estimation > 1e6 && multiplicator < 1000000) {
- multiplicator = 1000;
- }
- }
+ if (matchIndicatorList(tuple, indicatorList)) {
+ result = true;
+ break;
}
}
+ return result;
+ }
- File result = null;
+ protected boolean matchPopulationIndicatorList(ExtractRequest request) {
+ Preconditions.checkNotNull(request.getPopulationIndicatorList());
- // avec l'extraction des données, on peut demander a générer un graphique
- // sur un indicateur qui n'est pas présent dans le projet courant,
- // dans ce cas, on retourne null
- if (indicatorFound) {
+ List<String> indicatorList = request.getPopulationIndicatorList();
- String zoneDisplayName = getZonesMap().getZoneFullName(zone);
- String indicatorName = getIndicatorsMap().getIndicatorValue(indicator, locale);
- String unit = getIndicatorsMap().getIndicatorUnit(indicator);
+ boolean result = false;
- // get graph title
- String chartTitle = zoneDisplayName;
- chartTitle += " - " + indicatorName;
-
- // ajout de la traduction de la liste d'indicateur
- // les liste sont a1, T1, T2 ...
- String listLetter = String.valueOf(localList.charAt(0));
- Iterator<String[]> typeIterator = loadSpeciesFileStorage(true);
- while (typeIterator.hasNext()) {
- // "Types";"Commentaire";"NumSys min";"NumSys max";"Code"
- String[] tuple = typeIterator.next();
- if (tuple[4].equals(listLetter)) {
- /// gestion du groupe "Tous"
- // cas special, c'est la seule valeur du fichier
- // code type espece qui a besoin d'une traduction
- if (tuple[4].equalsIgnoreCase("T")) {
- if ("fr".equals(locale.getLanguage())) {
- chartTitle += " - " + "Tous Liste " + localList.charAt(1);
- } else if ("es".equals(locale.getLanguage())) {
- chartTitle += " - " + "Todo Lista " + localList.charAt(1);
- } else {
- chartTitle += " - " + "All List " + localList.charAt(1);
- }
- } else {
- // ajout de la traduction du nom de liste plus le numéro
- if ("fr".equals(locale.getLanguage())) {
- chartTitle += " - " + tuple[0] + " Liste " + localList.charAt(1);
- } else if ("es".equals(locale.getLanguage())) {
- chartTitle += " - " + tuple[0] + " Lista " + localList.charAt(1);
- } else {
- chartTitle += " - " + tuple[0] + " List " + localList.charAt(1);
- }
- }
- break;
- }
+ Iterator<String[]> iterator = loadPopulationIndicatorStorage(true);
+ while (iterator.hasNext()) {
+ String[] tuple = iterator.next();
+ if (matchIndicatorList(tuple, indicatorList)) {
+ result = true;
+ break;
}
-
- // generate dataset with sorted data
- DefaultStatisticalCategoryDataset statisticalDataset = new DefaultStatisticalCategoryDataset();
- for (int indexYear = minYear; indexYear <= maxYear; ++indexYear) {
- Double[] entry = graphData.get(indexYear);
- if (entry != null) {
- Double estimation = entry[0] / multiplicator;
- Double ecart = entry[1] / multiplicator;
- statisticalDataset.add(estimation, ecart, "Serie1", (Comparable) indexYear);
- } else {
- statisticalDataset.add(null, null, "Serie1", indexYear);
- }
- }
-
- // configure chart
- //CategoryAxis categoryAxis = new CategoryAxis(t("coser.business.common.year"));
- String yearAxis = Reports.getYearChartTitle(locale);
-
- CategoryAxis categoryAxis = new CategoryAxis(yearAxis);
- categoryAxis.setCategoryMargin(0);
- categoryAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
- // label horizontaux
- String legendY = indicatorName;
- if (multiplicator != 1) {
- // affiche par exemple : cm * 1000
- legendY += " (" + unit + "*" + multiplicator + ")";
- } else if (StringUtils.isNotEmpty(unit)) {
- legendY += " (" + unit + ")";
- }
- ValueAxis valueAxis = new NumberAxis(legendY);
- valueAxis.setUpperMargin(0.1);
-
- CategoryItemRenderer renderer = new StatisticalLineAndShapeRenderer(false, true);
-
- // n'affiche pas les nombre sur le graphique
- //StandardCategoryItemLabelGenerator itemLabelGenerator = new StandardCategoryItemLabelGenerator();
- //renderer.setBaseItemLabelGenerator(itemLabelGenerator);
- //renderer.setBaseItemLabelsVisible(true);
-
- CategoryPlot plot = new CategoryPlot(statisticalDataset, categoryAxis, valueAxis, renderer);
- plot.setOrientation(PlotOrientation.VERTICAL);
- JFreeChart chart = new JFreeChart(chartTitle,
- JFreeChart.DEFAULT_TITLE_FONT, plot, true);
-
- // remove series legend
- chart.removeLegend();
- // white background
- chart.setBackgroundPaint(Color.WHITE);
-
- try {
- result = File.createTempFile("coser-chart-community-indicator-", ".png");
- result.deleteOnExit();
- ChartUtilities.saveChartAsPNG(result, chart, 800, 400);
- } catch (IOException ex) {
- throw new CoserTechnicalException("Can't save chart", ex);
- }
}
-
return result;
}
- // --------------------------------------------------------------------- //
- // --- Get Population indicator result --------------------------------- //
- // --------------------------------------------------------------------- //
+ protected boolean matchPopulationIndicatorListAndSpeciesList(ExtractRequest request) {
+ Preconditions.checkNotNull(request.getPopulationIndicatorList());
- protected File getPopulationIndicatorDataFile(String species, String indicator) {
+ List<String> indicatorList = request.getPopulationIndicatorList();
+ List<String> speciesList = request.getSpeciesList();
- DataStorage dataStorage = new MemoryDataStorage();
+ boolean result = false;
- Iterator<String[]> iterator = loadPopulationIndicatorStorage(false);
-
- // add header
- dataStorage.add(iterator.next());
-
+ Iterator<String[]> iterator = loadPopulationIndicatorStorage(true);
while (iterator.hasNext()) {
String[] tuple = iterator.next();
- if (matchPopulationSpeciesAndIndicator(tuple, species, indicator)) {
- dataStorage.add(tuple);
+ if (matchIndicatorListAndSpeciesList(tuple, indicatorList, speciesList)) {
+ result = true;
+ break;
}
}
- File result = DataStorages.save("coser-chart-population-indicator",
- ".csv",
- dataStorage);
return result;
}
- protected File getPopulationIndicatorGraphFile(Locale locale, String zone, String species, String indicator) {
+ protected boolean matchCommunityIndicatorListAndSpeciesList(ExtractRequest request) {
+ Preconditions.checkNotNull(request.getCommunityIndicatorList());
+ List<String> indicatorList = request.getCommunityIndicatorList();
+ List<String> speciesList = request.getSpeciesList();
- int multiplicator = 1;
- int minYear = Integer.MAX_VALUE;
- int maxYear = Integer.MIN_VALUE;
- boolean indicatorFound = false;
- Map<Integer, Double[]> graphData = new HashMap<Integer, Double[]>();
- Iterator<String[]> iterator = loadPopulationIndicatorStorage(true);
+ boolean result = false;
+
+ Iterator<String[]> iterator = loadCommunityIndicatorStorage(true);
while (iterator.hasNext()) {
String[] tuple = iterator.next();
-
- if (matchPopulationSpeciesAndIndicator(tuple, species, indicator)) {
- indicatorFound = true;
-
- // XXX echatellier, maybe take care of list here ?
-
- Double estimation = Double.parseDouble(tuple[6]);
- Double ecart = Double.parseDouble(tuple[7]);
- int year = Integer.parseInt(tuple[5]);
-
- if (year < minYear) {
- minYear = year;
- }
- if (year > maxYear) {
- maxYear = year;
- }
- graphData.put(year, new Double[]{estimation, ecart});
-
- // si les données sont énormes, on affiche les données
- // / multiplicator et on le mentionne dans la légende
- if (estimation > 1e9) {
- multiplicator = 1000000;
- }
- if (estimation > 1e6 && multiplicator < 1000000) {
- multiplicator = 1000;
- }
+ if (matchIndicatorListAndSpeciesList(tuple, indicatorList, speciesList)) {
+ result = true;
+ break;
}
}
+ return result;
+ }
- File result = null;
+ protected boolean matchIndicatorList(String[] tuple, List<String> indicatorList) {
+ String indicatorCode = tuple[1];
+ boolean result = indicatorList.contains(indicatorCode);
+ return result;
+ }
- // avec l'extraction des données, on peut demander a générer un graphique
- // sur un indicateur qui n'est pas présent dans le projet courant,
- // dans ce cas, on retourne null
- if (indicatorFound) {
+ protected boolean matchIndicatorListAndSpeciesList(String[] tuple,
+ List<String> indicatorList,
+ List<String> speciesList) {
+ String indicatorCode = tuple[1];
+ String speciesCode = tuple[3];
+ boolean result = indicatorList.contains(indicatorCode) && speciesList.contains(speciesCode);
+ return result;
+ }
- String zoneDisplayName = getZonesMap().getZoneFullName(zone);
- String indicatorName = getIndicatorsMap().getIndicatorValue(indicator, locale);
- String unit = getIndicatorsMap().getIndicatorUnit(indicator);
+ // --------------------------------------------------------------------- //
+ // --- Get Map result -------------------------------------------------- //
+ // --------------------------------------------------------------------- //
- // get graph title
- String title = zoneDisplayName;
- title += " - " + indicatorName;
- title += " - " + Reports.getReportDisplayName(loadSpeciesFileStorage(true), species);
-
- // generate dataset with sorted data
- DefaultStatisticalCategoryDataset statisticalDataset = new DefaultStatisticalCategoryDataset();
- for (int indexYear = minYear; indexYear <= maxYear; ++indexYear) {
- Double[] entry = graphData.get(indexYear);
- if (entry != null) {
- Double estimation = entry[0] / multiplicator;
- Double ecart = entry[1] / multiplicator;
- statisticalDataset.add(estimation, ecart, "Serie1", (Comparable) indexYear);
- } else {
- statisticalDataset.add(null, null, "Serie1", indexYear);
- }
- }
-
- // configure chart
- //CategoryAxis categoryAxis = new CategoryAxis(t("coser.business.common.year"));
- String yearAxis = Reports.getYearChartTitle(locale);
- CategoryAxis categoryAxis = new CategoryAxis(yearAxis);
- categoryAxis.setCategoryMargin(0);
- categoryAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
- // label horizontaux
- String legendY = indicatorName;
- if (multiplicator != 1) {
- // affiche par exemple : cm * 1000
- legendY += " (" + unit + "*" + multiplicator + ")";
- } else if (StringUtils.isNotEmpty(unit)) {
- legendY += " (" + unit + ")";
- }
- ValueAxis valueAxis = new NumberAxis(legendY);
- valueAxis.setUpperMargin(0.1);
-
- CategoryItemRenderer renderer = new StatisticalLineAndShapeRenderer(false, true);
-
- // n'affiche pas les nombre sur le graphique
- //StandardCategoryItemLabelGenerator itemLabelGenerator = new StandardCategoryItemLabelGenerator();
- //renderer.setBaseItemLabelGenerator(itemLabelGenerator);
- //renderer.setBaseItemLabelsVisible(true);
-
- CategoryPlot plot = new CategoryPlot(statisticalDataset, categoryAxis, valueAxis, renderer);
- plot.setOrientation(PlotOrientation.VERTICAL);
- JFreeChart chart = new JFreeChart(title,
- JFreeChart.DEFAULT_TITLE_FONT, plot, true);
-
- // remove series legend
- chart.removeLegend();
- // white background
- chart.setBackgroundPaint(Color.WHITE);
-
- try {
- result = File.createTempFile("coser-chart-population-indicator-", ".png");
- result.deleteOnExit();
- ChartUtilities.saveChartAsPNG(result, chart, 800, 400);
- } catch (IOException ex) {
- throw new CoserTechnicalException("Can't save chart", ex);
- }
- }
-
- return result;
+ protected File getMapSpeciesFile(String species) {
+ String fileName = speciesCodeToMapFile.apply(species);
+ File file = fileName == null ? null : new File(mapsDirectory, fileName);
+ return file;
}
// --------------------------------------------------------------------- //
@@ -930,8 +524,8 @@
// --------------------------------------------------------------------- //
protected Set<String> getMapSpecies() {
- File[] files = project.getMapsDirectory().listFiles(mapSpeciesFilenameFilter);
Set<String> result = Sets.newHashSet();
+ File[] files = project.getMapsDirectory().listFiles(mapSpeciesFilenameFilter);
if (files != null) {
List<String> transform = Lists.transform(Lists.newArrayList(files), mapFileToSpeciesCode);
result.addAll(transform);
@@ -944,20 +538,31 @@
Iterator<String[]> iterator = loadPopulationIndicatorStorage(true);
while (iterator.hasNext()) {
String[] tuple = iterator.next();
- String specyCode = tuple[3];
- result.add(specyCode);
+ String speciesCode = tuple[3];
+ result.add(speciesCode);
}
return result;
}
+ protected Set<String> getCommunityIndicatorSpecies() {
+ Iterator<String[]> iterator = loadCommunityIndicatorStorage(true);
+ Set<String> result = Sets.newHashSet();
+ while (iterator.hasNext()) {
+ String[] tuple = iterator.next();
+ String speciesCode = tuple[2];
+ result.add(speciesCode);
+ }
+ return result;
+ }
+
protected Set<String> getCommunityIndicatorSpecies(String indicator) {
Iterator<String[]> iterator = loadCommunityIndicatorStorage(true);
Set<String> result = Sets.newHashSet();
while (iterator.hasNext()) {
String[] tuple = iterator.next();
- if (matchCommunityIndicator(tuple, indicator)) {
- String specyCode = tuple[2];
- result.add(specyCode);
+ if (matchIndicatorIndicator(tuple, indicator)) {
+ String speciesCode = tuple[2];
+ result.add(speciesCode);
}
}
return result;
@@ -978,12 +583,23 @@
return result;
}
+ protected Set<String> getPopulationIndicators() {
+ Iterator<String[]> iterator = loadPopulationIndicatorStorage(true);
+ Set<String> result = Sets.newHashSet();
+ while (iterator.hasNext()) {
+ String[] tuple = iterator.next();
+ String indicatorCode = tuple[1];
+ result.add(indicatorCode);
+ }
+ return result;
+ }
+
protected Set<String> getPopulationIndicators(String species) {
Iterator<String[]> iterator = loadPopulationIndicatorStorage(true);
Set<String> result = Sets.newHashSet();
while (iterator.hasNext()) {
String[] tuple = iterator.next();
- if (matchPopulationSpecies(tuple, species)) {
+ if (matchIndicatorSpecies(tuple, species)) {
String indicatorCode = tuple[1];
result.add(indicatorCode);
}
@@ -992,45 +608,19 @@
}
// --------------------------------------------------------------------- //
- // --- Get species definition maps ------------------------------------- //
+ // --- Get definition maps --------------------------------------------- //
// --------------------------------------------------------------------- //
- protected Map<String, String> getSpeciesMap() {
+ protected SpeciesMap getSpeciesMap() {
if (speciesMap == null) {
- speciesMap = Maps.newTreeMap();
- // load species file
- Iterator<String[]> iterator = loadSpeciesFileStorage(true);
- while (iterator.hasNext()) {
- String[] tuple = iterator.next();
- String speciesCode = tuple[3];
- String speciesLabel = tuple[4] + " " + tuple[5];
- speciesMap.put(speciesCode, speciesLabel);
- }
+ File file = project.getSpeciesDefinitionFile();
+
+ speciesMap = new SpeciesMap(file);
}
return speciesMap;
}
- protected Map<String, String> getSpeciesSubMap(Collection<String> speciesList) {
-
- Map<String, String> result = Maps.newTreeMap();
-
- if (speciesList != null) {
-
- Map<String, String> map = getSpeciesMap();
- for (String species : speciesList) {
- String speciesLabel = map.get(species);
- result.put(species, speciesLabel);
- }
- }
-
- return result;
- }
-
- // --------------------------------------------------------------------- //
- // --- Get indicator definition maps ----------------------------------- //
- // --------------------------------------------------------------------- //
-
protected IndicatorMap getIndicatorsMap() {
if (indicatorsMap == null) {
indicatorsMap = new IndicatorMap(config.getWebIndicatorsFile());
@@ -1038,10 +628,6 @@
return indicatorsMap;
}
- // --------------------------------------------------------------------- //
- // --- Get zone definition maps ---------------------------------------- //
- // --------------------------------------------------------------------- //
-
public ZoneMap getZonesMap() {
if (zonesMap == null) {
zonesMap = new ZoneMap(config.getWebZonesFile());
@@ -1069,21 +655,4 @@
return iterator;
}
-
- protected Iterator<String[]> loadSpeciesFileStorage(boolean skipFirstLine) {
- // "C_Perm","NumSys","NivSys","C_VALIDE","L_VALIDE","AA_VALIDE","C_TxP\u00E8re","Taxa"
- Iterator<String[]> iterator = getSpeciesDefinition().iterator(skipFirstLine);
- return iterator;
- }
-
- protected DataStorage getSpeciesDefinition() throws CoserTechnicalException {
- if (speciesDefinition == null) {
- File file = project.getSpeciesDefinitionFile();
- speciesDefinition = DataStorages.load(file);
- }
-
- return speciesDefinition;
- }
-
-
}
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/ExtractResultProducer.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/ExtractResultProducer.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/ExtractResultProducer.java 2014-03-11 09:28:43 UTC (rev 1141)
@@ -0,0 +1,685 @@
+package fr.ifremer.coser.result.repository.echobase;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Maps;
+import com.google.common.collect.Sets;
+import fr.ifremer.coser.CoserTechnicalException;
+import fr.ifremer.coser.bean.EchoBaseProject;
+import fr.ifremer.coser.bean.IndicatorMap;
+import fr.ifremer.coser.bean.SpeciesMap;
+import fr.ifremer.coser.bean.ZoneMap;
+import fr.ifremer.coser.result.FileResult;
+import fr.ifremer.coser.result.Reports;
+import fr.ifremer.coser.result.repository.ResultProducer;
+import fr.ifremer.coser.result.request.ExtractRequest;
+import fr.ifremer.coser.storage.DataStorage;
+import fr.ifremer.coser.storage.DataStorages;
+import fr.ifremer.coser.storage.MemoryDataStorage;
+import fr.ifremer.coser.util.DataType;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.MapUtils;
+import org.apache.commons.collections4.keyvalue.MultiKey;
+import org.apache.commons.collections4.map.MultiKeyMap;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.tuple.Pair;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jfree.chart.ChartUtilities;
+import org.jfree.chart.JFreeChart;
+import org.jfree.chart.axis.CategoryAxis;
+import org.jfree.chart.axis.CategoryLabelPositions;
+import org.jfree.chart.axis.NumberAxis;
+import org.jfree.chart.axis.ValueAxis;
+import org.jfree.chart.plot.CategoryPlot;
+import org.jfree.chart.plot.PlotOrientation;
+import org.jfree.chart.renderer.category.CategoryItemRenderer;
+import org.jfree.chart.renderer.category.StatisticalLineAndShapeRenderer;
+import org.jfree.data.statistics.DefaultStatisticalCategoryDataset;
+import org.nuiton.util.FileUtil;
+import org.nuiton.util.ZipUtil;
+
+import java.awt.Color;
+import java.io.File;
+import java.io.IOException;
+import java.io.StringWriter;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class ExtractResultProducer implements ResultProducer<ExtractRequest> {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(ExtractResultProducer.class);
+
+ protected final EchoBaseResultRepository repository;
+
+ protected final Reports reports;
+
+ protected final EchoBaseProject project;
+
+ public ExtractResultProducer(EchoBaseResultRepository repository) {
+ this.repository = repository;
+ this.project = repository.project;
+ this.reports = repository.reports;
+ }
+
+ @Override
+ public EchoBaseResultRepository getRepository() {
+ return repository;
+ }
+
+ @Override
+ public Map<String, String> getAvailableZones(ExtractRequest request) {
+
+ ZoneMap zonesMap = repository.getZonesMap();
+ List<String> allowedZones = zonesMap.getZonesForFacade(null);
+ Map<String, String> result = zonesMap.getSubZonesMap(project.getZoneName(), allowedZones);
+ return result;
+ }
+
+ @Override
+ public Map<String, String> getAvailableSpecies(ExtractRequest request) {
+ Preconditions.checkNotNull(request.getZoneList());
+
+ boolean match = repository.matchZoneList(request);
+
+ Map<String, String> result = null;
+ if (match) {
+ Set<String> speciesList = Sets.newHashSet();
+
+ // get all species for population indicators
+ speciesList.addAll(repository.getPopulationIndicatorSpecies());
+ // get all species for community indicators
+ speciesList.addAll(repository.getCommunityIndicatorSpecies());
+ result = repository.getSpeciesMap().getSpeciesSubMap(speciesList);
+ }
+ return result;
+ }
+
+ @Override
+ public Map<String, String> getAvailableIndicators(ExtractRequest request) {
+ Preconditions.checkNotNull(request.getZoneList());
+ Preconditions.checkNotNull(request.getExtractTypeList());
+
+ Map<String, String> result = null;
+
+ boolean match = repository.matchZoneList(request);
+ if (match) {
+
+ Set<String> indicatorList = null;
+
+ if (request.getExtractTypeList().contains(DataType.COMMUNITY)) {
+
+ // get all community indicators for given zone
+ indicatorList = repository.getCommunityIndicators();
+ } else if (request.getExtractTypeList().contains(DataType.POPULATION)) {
+
+ // get all population indicators for given zone
+ indicatorList = repository.getPopulationIndicators();
+ }
+
+ if (indicatorList != null) {
+ result = repository.getIndicatorsMap().getIndicatorsValues(indicatorList, request.getLocale());
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public FileResult produceResult(ExtractRequest r) {
+
+ Locale locale = r.getLocale();
+ List<String> zoneList = r.getZoneList();
+ List<DataType> extractTypeList = r.getExtractTypeList();
+ List<String> speciesList = r.getSpeciesList();
+ List<String> communityIndicatorList = r.getCommunityIndicatorList();
+ List<String> populationIndicatorList = r.getPopulationIndicatorList();
+
+ File resultZip = null;
+ File tempDir = null;
+ try {
+ tempDir = FileUtil.createTempDirectory("coser-extract-", "-tmp");
+
+ File subDir = new File(tempDir, "Indicateurs_Ifremer");
+ FileUtils.forceMkdir(subDir);
+
+ // les sources se retrouve dans le zip a cote du pdf
+ if (extractTypeList.contains(DataType.SOURCE)) {
+ if (log.isDebugEnabled()) {
+ log.debug("Extracting sources");
+ }
+ File srcDir = new File(subDir, "sources");
+ extractSource(srcDir);
+ }
+
+ // les cartes doivent se retrouver dans le pdf
+ MultiKeyMap pdfMaps = null;
+ if (extractTypeList.contains(DataType.MAP)) {
+ if (log.isDebugEnabled()) {
+ log.debug("Extracting maps");
+ }
+ String zone = project.getZoneName();
+ SpeciesMap speciesMap = repository.getSpeciesMap();
+ for (String species : speciesList) {
+ File mapFile = repository.getMapSpeciesFile(species);
+ pdfMaps.put(zone, speciesMap.getSpeciesName(species), mapFile);
+ }
+ }
+
+ // les graphiques sont également dans le pdf
+ MultiKeyMap pdfCharts = null;
+ if (CollectionUtils.isNotEmpty(communityIndicatorList) ||
+ CollectionUtils.isNotEmpty(populationIndicatorList)) {
+ if (log.isDebugEnabled()) {
+ log.debug("Extracting charts");
+ }
+ pdfCharts = extractCharts(speciesList,
+ communityIndicatorList,
+ populationIndicatorList,
+ locale);
+ }
+
+ // generate pdf if necessary
+ if (MapUtils.isNotEmpty(pdfMaps) || MapUtils.isNotEmpty(pdfCharts)) {
+ if (log.isDebugEnabled()) {
+ log.debug("Generated Extract PDF");
+ }
+ reports.generateExtractPDF(subDir,
+ zoneList,
+ pdfMaps,
+ pdfCharts,
+ repository.getZonesMap(),
+ locale);
+ }
+
+ // fichier de décharge en pdf
+ if (log.isDebugEnabled()) {
+ log.debug("Generated decharge PDF");
+ }
+ String filename = reports.getDechargeFilename(locale);
+ File dechargePDF = new File(subDir, filename);
+ reports.generateDechargePDF(dechargePDF, locale, null, null);
+
+ // make zip
+ if (log.isDebugEnabled()) {
+ log.debug("Make final archive");
+ }
+ resultZip = File.createTempFile("coser-extract-", ".zip");
+ resultZip.deleteOnExit();
+ ZipUtil.compress(resultZip, subDir);
+
+ // clean directory
+ FileUtils.deleteDirectory(tempDir);
+ } catch (IOException ex) {
+ throw new CoserTechnicalException("Can't create zip file", ex);
+ } finally {
+ // clean directory
+ FileUtils.deleteQuietly(tempDir);
+ }
+
+ FileResult result = new FileResult(repository.getId(), resultZip);
+ return result;
+ }
+
+ /**
+ * Generate raw data after selection in a sub directory (named of the zone) of the given directory.
+ *
+ * @param directory where to generate file
+ */
+ protected void extractSource(File directory) {
+
+ //TODO
+ }
+
+ /**
+ * Retourne les indicateurs calculés avec leurs traductions scientifique
+ * pour la zone et l'especes souhaitées.
+ *
+ * @param species especes (if {@code null} look for com indicators
+ * @param comIndicators comIndicator
+ * @param popIndicators popIndicators
+ * @param locale locale
+ * @return la liste des indicateurs (zone, speciesname, [graphfile, graphdata])
+ */
+ protected MultiKeyMap extractCharts(Collection<String> species,
+ Collection<String> comIndicators,
+ Collection<String> popIndicators,
+ Locale locale) {
+
+ MultiKeyMap chartFileAndDatas = new MultiKeyMap();
+
+ String zone = project.getZoneName();
+ String zoneDisplayName = repository.getZonesMap().getZoneFullName(zone);
+
+ if (CollectionUtils.isNotEmpty(comIndicators)) {
+ Map<String, Pair<File, String>> chartFileAndDataCom = getRsufiResultComCharts(comIndicators,
+ zoneDisplayName,
+ repository.getIndicatorsMap(),
+ locale,
+ 650,
+ 430);
+ // put in multimap as zone,speciesname, data
+ for (Map.Entry<String, Pair<File, String>> entry : chartFileAndDataCom.entrySet()) {
+ chartFileAndDatas.put(zone, entry.getKey(), entry.getValue());
+ }
+ }
+
+ if (CollectionUtils.isNotEmpty(popIndicators)) {
+ Map<String, Pair<File, String>> chartFileAndDataPop = getRsufiResultPopCharts(species,
+ popIndicators,
+ zoneDisplayName,
+ repository.getIndicatorsMap(),
+ locale,
+ 650,
+ 430);
+ // put in multimap as zone,speciesname, data
+ for (Map.Entry<String, Pair<File, String>> entry : chartFileAndDataPop.entrySet()) {
+ chartFileAndDatas.put(zone, entry.getKey(), entry.getValue());
+ }
+ }
+
+ return chartFileAndDatas;
+ }
+
+ /**
+ * Generate community graph for selected indicators.
+ * Used by web ui extraction.
+ *
+ * @param indicators indicators to extract
+ * @param zoneDisplayName zone full name
+ * @param indicatorMap indicator localized map
+ * @param locale locale
+ * @param width graph width
+ * @param height graph height
+ * @return maps of generated graph image (temp file) and data indexed by natural key (indicator - species)
+ */
+ public Map<String, Pair<File, String>> getRsufiResultComCharts(Collection<String> indicators,
+ String zoneDisplayName,
+ IndicatorMap indicatorMap,
+ Locale locale,
+ int width, int height) {
+
+ Map<String, Pair<File, String>> result = Maps.newHashMap();
+
+ int multiplicator = 1;
+ int minYear = Integer.MAX_VALUE;
+ int maxYear = Integer.MIN_VALUE;
+
+ Map<String, Map<Integer, Double[]>> indicatorGraphData = new HashMap<String, Map<Integer, Double[]>>();
+ Map<String, String> indicatorLists = new HashMap<String, String>();
+ Map<String, DataStorage> indicatorStorages = new HashMap<String, DataStorage>();
+
+ // Campagne Indicateur Liste Strate Annee Estimation EcartType CV
+ Iterator<String[]> estComIndIterator = repository.loadCommunityIndicatorStorage(true);
+ while (estComIndIterator.hasNext()) {
+ // Campagne Indicateur Liste Strate Annee Estimation EcartType CV
+ String[] tuple = estComIndIterator.next();
+ String indicatorCode = tuple[1];
+ String indicatorList = tuple[2];
+
+ if (indicators.contains(indicatorCode)) {
+
+ // si pas de list selectionnée, on prend la premiere
+ String localList = indicatorLists.get(indicatorCode);
+ if (StringUtils.isBlank(localList)) {
+ localList = indicatorList;
+ indicatorLists.put(indicatorCode, localList);
+ }
+
+ if (indicatorList.equals(localList)) {
+ Double estimation = Double.parseDouble(tuple[5]);
+ Double ecart = Double.parseDouble(tuple[6]);
+ int year = Integer.parseInt(tuple[4]);
+
+ if (year < minYear) {
+ minYear = year;
+ }
+ if (year > maxYear) {
+ maxYear = year;
+ }
+ Map<Integer, Double[]> graphData = indicatorGraphData.get(indicatorCode);
+ if (graphData == null) {
+ graphData = new HashMap<Integer, Double[]>();
+ indicatorGraphData.put(indicatorCode, graphData);
+ }
+ graphData.put(year, new Double[]{estimation, ecart});
+
+ // si les données sont énormes, on affiche les données
+ // / multiplicator et on le mentionne dans la légende
+ if (estimation > 1e9) {
+ multiplicator = 1000000;
+ }
+ if (estimation > 1e6 && multiplicator < 1000000) {
+ multiplicator = 1000;
+ }
+
+ // for data part
+ DataStorage subDataStorage = indicatorStorages.get(indicatorCode);
+ if (subDataStorage == null) {
+ subDataStorage = new MemoryDataStorage();
+ if ("fr".equals(locale.getLanguage())) {
+ subDataStorage.add(new String[]{"Campagne", "Indice", "Liste", "Strate", "Année", "Estimation", "EcartType", "CV"});
+ } else {
+ subDataStorage.add(new String[]{"Survey", "Index", "List", "Stratum", "Year", "Estimate", "StandardDeviation", "CV"});
+ }
+ indicatorStorages.put(indicatorCode, subDataStorage);
+ }
+ subDataStorage.add(tuple);
+ }
+ }
+ }
+
+ // avec l'extraction des données, on peut demander a générer un graphique
+ // sur un indicateur qui n'est pas présent dans le projet courant,
+ // dans ce cas, on retourne null
+ for (String indicator : indicatorGraphData.keySet()) {
+ // get graph title
+ String chartTitle = zoneDisplayName;
+ String indicatorName = indicatorMap.getIndicatorValue(indicator, locale);
+ String unit = indicatorMap.getIndicatorUnit(indicator);
+ chartTitle += " - " + indicatorName;
+
+ // ajout de la traduction de la liste d'indicateur
+ // les liste sont a1, T1, T2 ...
+ String localList = indicatorLists.get(indicator);
+ String listLetter = String.valueOf(localList.charAt(0));
+ Iterator<String[]> typeIterator = repository.getSpeciesMap().iterator(true);
+ while (typeIterator.hasNext()) {
+ // "Types";"Commentaire";"NumSys min";"NumSys max";"Code"
+ String[] tuple = typeIterator.next();
+ if (tuple[4].equals(listLetter)) {
+ /// gestion du groupe "Tous"
+ // cas special, c'est la seule valeur du fichier
+ // code type espece qui a besoin d'une traduction
+ if (tuple[4].equalsIgnoreCase("T")) {
+ if ("fr".equals(locale.getLanguage())) {
+ chartTitle += " - " + "Tous Liste " + localList.charAt(1);
+ } else if ("es".equals(locale.getLanguage())) {
+ chartTitle += " - " + "Todo Lista " + localList.charAt(1);
+ } else {
+ chartTitle += " - " + "All List " + localList.charAt(1);
+ }
+ } else {
+ // ajout de la traduction du nom de liste plus le numéro
+ if ("fr".equals(locale.getLanguage())) {
+ chartTitle += " - " + tuple[0] + " Liste " + localList.charAt(1);
+ } else if ("es".equals(locale.getLanguage())) {
+ chartTitle += " - " + tuple[0] + " Lista " + localList.charAt(1);
+ } else {
+ chartTitle += " - " + tuple[0] + " List " + localList.charAt(1);
+ }
+ }
+ break;
+ }
+ }
+
+ // generate dataset with sorted data
+ Map<Integer, Double[]> graphData = indicatorGraphData.get(indicator);
+ DefaultStatisticalCategoryDataset statisticalDataset = new DefaultStatisticalCategoryDataset();
+ for (int indexYear = minYear; indexYear <= maxYear; ++indexYear) {
+ Double[] entry = graphData.get(indexYear);
+ if (entry != null) {
+ Double estimation = entry[0] / multiplicator;
+ Double ecart = entry[1] / multiplicator;
+ statisticalDataset.add(estimation, ecart, "Serie1", (Comparable) indexYear);
+ } else {
+ statisticalDataset.add(null, null, "Serie1", indexYear);
+ }
+ }
+
+ // configure chart
+ //CategoryAxis categoryAxis = new CategoryAxis(t("coser.business.common.year"));
+ String yearAxis = reports.getYearChartTitle(locale);
+ CategoryAxis categoryAxis = new CategoryAxis(yearAxis);
+ categoryAxis.setCategoryMargin(0);
+ categoryAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
+ // label horizontaux
+ String legendY = indicatorName;
+ if (multiplicator != 1) {
+ // affiche par exemple : cm * 1000
+ legendY += " (" + unit + "*" + multiplicator + ")";
+ } else if (StringUtils.isNotEmpty(unit)) {
+ legendY += " (" + unit + ")";
+ }
+ ValueAxis valueAxis = new NumberAxis(legendY);
+ valueAxis.setUpperMargin(0.1);
+
+ CategoryItemRenderer renderer = new StatisticalLineAndShapeRenderer(false, true);
+
+ // n'affiche pas les nombre sur le graphique
+ //StandardCategoryItemLabelGenerator itemLabelGenerator = new StandardCategoryItemLabelGenerator();
+ //renderer.setBaseItemLabelGenerator(itemLabelGenerator);
+ //renderer.setBaseItemLabelsVisible(true);
+
+ CategoryPlot plot = new CategoryPlot(statisticalDataset, categoryAxis, valueAxis, renderer);
+ plot.setOrientation(PlotOrientation.VERTICAL);
+ JFreeChart chart = new JFreeChart(chartTitle,
+ JFreeChart.DEFAULT_TITLE_FONT, plot, true);
+
+ // remove series legend
+ chart.removeLegend();
+ // white background
+ chart.setBackgroundPaint(Color.WHITE);
+
+ try {
+ File chartFile = File.createTempFile("coser-community-chart-", ".png");
+ chartFile.deleteOnExit();
+ ChartUtilities.saveChartAsPNG(chartFile, chart, width, height);
+ //ByteArrayOutputStream out = new ByteArrayOutputStream();
+ //ChartUtilities.writeChartAsPNG(out, chart, width, height);
+
+ // data extraction
+ DataStorage subDataStorage = indicatorStorages.get(indicator);
+ StringWriter writer = new StringWriter();
+ DataStorages.save(subDataStorage, writer);
+
+ // add chart file dans chart data in result
+ result.put(indicator, Pair.of(chartFile, writer.toString()));
+ writer.close();
+ } catch (IOException ex) {
+ throw new CoserTechnicalException("Can't save chart", ex);
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Generate population graph for selected species and indicator.
+ *
+ * @param species species to extract
+ * @param indicators indicators to extract
+ * @param zoneDisplayName zone full name
+ * @param indicatorMap indicator localized map
+ * @param locale locale
+ * @param width graph width
+ * @param height graph height
+ * @return maps of generated graph image (temp file) and data indexed by natural key (indicator - species)
+ */
+ public Map<String, Pair<File, String>> getRsufiResultPopCharts(Collection<String> species,
+ Collection<String> indicators,
+ String zoneDisplayName,
+ IndicatorMap indicatorMap,
+ Locale locale,
+ int width,
+ int height) {
+
+ Map<String, Pair<File, String>> result = Maps.newHashMap();
+
+ int multiplicator = 1;
+ int minYear = Integer.MAX_VALUE;
+ int maxYear = Integer.MIN_VALUE;
+
+ MultiKeyMap indicatorGraphData = new MultiKeyMap();
+ MultiKeyMap indicatorStorages = new MultiKeyMap();
+
+ // Campagne Indicateur Liste Species Strate Annee Estimation EcartType CV
+ Iterator<String[]> estPopIndIterator = repository.loadPopulationIndicatorStorage(true);
+ while (estPopIndIterator.hasNext()) {
+ String[] tuple = estPopIndIterator.next();
+
+ String speciesCode = tuple[3];
+ String indicatorCode = tuple[1];
+ if (species.contains(speciesCode) && indicators.contains(indicatorCode)) {
+
+ // XXX echatellier, maybe take care of list here ?
+
+ Double estimation = Double.parseDouble(tuple[6]);
+ Double ecart = Double.parseDouble(tuple[7]);
+ int year = Integer.parseInt(tuple[5]);
+
+ if (year < minYear) {
+ minYear = year;
+ }
+ if (year > maxYear) {
+ maxYear = year;
+ }
+ Map<Integer, Double[]> graphData = (Map<Integer, Double[]>) indicatorGraphData.get(indicatorCode, speciesCode);
+ if (graphData == null) {
+ graphData = new HashMap<Integer, Double[]>();
+ indicatorGraphData.put(indicatorCode, speciesCode, graphData);
+ }
+ graphData.put(year, new Double[]{estimation, ecart});
+
+ // si les données sont énormes, on affiche les données
+ // / multiplicator et on le mentionne dans la légende
+ if (estimation > 1e9) {
+ multiplicator = 1000000;
+ }
+ if (estimation > 1e6 && multiplicator < 1000000) {
+ multiplicator = 1000;
+ }
+
+ // for data part
+ DataStorage subDataStorage = (DataStorage) indicatorStorages.get(indicatorCode, speciesCode);
+ if (subDataStorage == null) {
+ subDataStorage = new MemoryDataStorage();
+ if ("fr".equals(locale.getLanguage())) {
+ subDataStorage.add(new String[]{"Campagne", "Indice", "Liste", "Espèce", "Strate", "Annee", "Estimation", "EcartType", "CV"});
+ } else {
+ subDataStorage.add(new String[]{"Survey", "Index", "List", "Species", "Stratum", "Year", "Estimate", "StandardDeviation", "CV"});
+ }
+ indicatorStorages.put(indicatorCode, speciesCode, subDataStorage);
+ }
+ subDataStorage.add(tuple);
+ }
+ }
+
+ // avec l'extraction des données, on peut demander a générer un graphique
+ // sur un indicateur qui n'est pas présent dans le projet courant,
+ // dans ce cas, on retourne null
+ for (MultiKey indicatorSpecies : (Set<MultiKey>) indicatorGraphData.keySet()) {
+ String indicator = (String) indicatorSpecies.getKey(0);
+ String aSpecies = (String) indicatorSpecies.getKey(1);
+ // get graph title
+ String title = zoneDisplayName;
+ String indicatorName = indicatorMap.getIndicatorValue(indicator, locale);
+ String unit = indicatorMap.getIndicatorUnit(indicator);
+ title += " - " + indicatorName;
+ title += " - " + repository.getSpeciesMap().getReportDisplayName(aSpecies);
+
+ // generate dataset with sorted data
+ DefaultStatisticalCategoryDataset statisticalDataset = new DefaultStatisticalCategoryDataset();
+ Map<Integer, Double[]> graphData = (Map<Integer, Double[]>) indicatorGraphData.get(indicator, aSpecies);
+ for (int indexYear = minYear; indexYear <= maxYear; ++indexYear) {
+ Double[] entry = graphData.get(indexYear);
+ if (entry != null) {
+ Double estimation = entry[0] / multiplicator;
+ Double ecart = entry[1] / multiplicator;
+ statisticalDataset.add(estimation, ecart, "Serie1", (Comparable) indexYear);
+ } else {
+ statisticalDataset.add(null, null, "Serie1", indexYear);
+ }
+ }
+
+
+ // configure chart
+ //CategoryAxis categoryAxis = new CategoryAxis(t("coser.business.common.year"));
+ String yearAxis = reports.getYearChartTitle(locale);
+ CategoryAxis categoryAxis = new CategoryAxis(yearAxis);
+ categoryAxis.setCategoryMargin(0);
+ categoryAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
+ // label horizontaux
+ String legendY = indicatorName;
+ if (multiplicator != 1) {
+ // affiche par exemple : cm * 1000
+ legendY += " (" + unit + "*" + multiplicator + ")";
+ } else if (StringUtils.isNotEmpty(unit)) {
+ legendY += " (" + unit + ")";
+ }
+ ValueAxis valueAxis = new NumberAxis(legendY);
+ valueAxis.setUpperMargin(0.1);
+
+ CategoryItemRenderer renderer = new StatisticalLineAndShapeRenderer(false, true);
+
+ // n'affiche pas les nombre sur le graphique
+ //StandardCategoryItemLabelGenerator itemLabelGenerator = new StandardCategoryItemLabelGenerator();
+ //renderer.setBaseItemLabelGenerator(itemLabelGenerator);
+ //renderer.setBaseItemLabelsVisible(true);
+
+ CategoryPlot plot = new CategoryPlot(statisticalDataset, categoryAxis, valueAxis, renderer);
+ plot.setOrientation(PlotOrientation.VERTICAL);
+ JFreeChart chart = new JFreeChart(title,
+ JFreeChart.DEFAULT_TITLE_FONT, plot, true);
+
+ // remove series legend
+ chart.removeLegend();
+ // white background
+ chart.setBackgroundPaint(Color.WHITE);
+
+ try {
+ File chartFile = File.createTempFile("coser-population-chart-", ".png");
+ chartFile.deleteOnExit();
+ ChartUtilities.saveChartAsPNG(chartFile, chart, width, height);
+ //ByteArrayOutputStream out = new ByteArrayOutputStream();
+ //ChartUtilities.writeChartAsPNG(out, chart, width, height);
+
+ // data extraction
+ DataStorage subDataStorage = (DataStorage) indicatorStorages.get(indicator, aSpecies);
+ StringWriter writer = new StringWriter();
+ DataStorages.save(subDataStorage, writer);
+
+ // add chart file dans chart data in result
+ result.put(indicator + "-" + aSpecies, Pair.of(chartFile, writer.toString()));
+ writer.close();
+ } catch (IOException ex) {
+ throw new CoserTechnicalException("Can't save chart", ex);
+ }
+ }
+
+ return result;
+ }
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/ExtractResultProducer.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/MapResultProducer.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/MapResultProducer.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/MapResultProducer.java 2014-03-11 09:28:43 UTC (rev 1141)
@@ -0,0 +1,108 @@
+package fr.ifremer.coser.result.repository.echobase;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import fr.ifremer.coser.bean.EchoBaseProject;
+import fr.ifremer.coser.bean.ZoneMap;
+import fr.ifremer.coser.result.FileResult;
+import fr.ifremer.coser.result.repository.RequestUnavailableForProducerException;
+import fr.ifremer.coser.result.repository.ResultProducer;
+import fr.ifremer.coser.result.request.MapRequest;
+
+import java.io.File;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class MapResultProducer implements ResultProducer<MapRequest> {
+
+ protected final EchoBaseResultRepository repository;
+
+ protected final EchoBaseProject project;
+
+ public MapResultProducer(EchoBaseResultRepository repository) {
+ this.repository = repository;
+ this.project = repository.project;
+ }
+
+ @Override
+ public EchoBaseResultRepository getRepository() {
+ return repository;
+ }
+
+ @Override
+ public Map<String, String> getAvailableZones(MapRequest request) {
+ Preconditions.checkNotNull(request.getFacade());
+
+ boolean match = repository.matchFacade(request);
+
+ Map<String, String> result = null;
+ if (match) {
+ ZoneMap zonesMap = repository.getZonesMap();
+ List<String> allowedZones = zonesMap.getZonesForFacade(request.getFacade());
+ result = zonesMap.getSubZonesMap(project.getZoneName(), allowedZones);
+ }
+ return result;
+ }
+
+ @Override
+ public Map<String, String> getAvailableSpecies(MapRequest request) {
+ Preconditions.checkNotNull(request.getFacade());
+ Preconditions.checkNotNull(request.getZone());
+
+ Map<String, String> result = null;
+
+ boolean match = repository.matchFacade(request) && repository.matchZone(request);
+ if (match) {
+ // get all map species for given facade + zone
+ Set<String> speciesList = repository.getMapSpecies();
+ result = repository.getSpeciesMap().getSpeciesSubMap(speciesList);
+ }
+ return result;
+ }
+
+ @Override
+ public Map<String, String> getAvailableIndicators(MapRequest request) {
+ throw RequestUnavailableForProducerException.newException("getAvailableIndicators", this);
+ }
+
+ @Override
+ public FileResult produceResult(MapRequest request) {
+ Preconditions.checkNotNull(request.getFacade());
+ Preconditions.checkNotNull(request.getZone());
+ Preconditions.checkNotNull(request.getSpecies());
+
+ File resultZip = repository.getMapSpeciesFile(request.getSpecies());
+
+ FileResult result = new FileResult(repository.getId(), resultZip);
+ return result;
+ }
+
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/MapResultProducer.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/PopulationIndicatorResultProducer.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/PopulationIndicatorResultProducer.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/PopulationIndicatorResultProducer.java 2014-03-11 09:28:43 UTC (rev 1141)
@@ -0,0 +1,292 @@
+package fr.ifremer.coser.result.repository.echobase;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import fr.ifremer.coser.CoserTechnicalException;
+import fr.ifremer.coser.bean.EchoBaseProject;
+import fr.ifremer.coser.bean.ZoneMap;
+import fr.ifremer.coser.result.FileResult;
+import fr.ifremer.coser.result.Reports;
+import fr.ifremer.coser.result.repository.ResultProducer;
+import fr.ifremer.coser.result.request.PopulationIndicatorRequest;
+import fr.ifremer.coser.storage.DataStorage;
+import fr.ifremer.coser.storage.DataStorages;
+import fr.ifremer.coser.storage.MemoryDataStorage;
+import org.apache.commons.lang3.StringUtils;
+import org.jfree.chart.ChartUtilities;
+import org.jfree.chart.JFreeChart;
+import org.jfree.chart.axis.CategoryAxis;
+import org.jfree.chart.axis.CategoryLabelPositions;
+import org.jfree.chart.axis.NumberAxis;
+import org.jfree.chart.axis.ValueAxis;
+import org.jfree.chart.plot.CategoryPlot;
+import org.jfree.chart.plot.PlotOrientation;
+import org.jfree.chart.renderer.category.CategoryItemRenderer;
+import org.jfree.chart.renderer.category.StatisticalLineAndShapeRenderer;
+import org.jfree.data.statistics.DefaultStatisticalCategoryDataset;
+
+import java.awt.Color;
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class PopulationIndicatorResultProducer implements ResultProducer<PopulationIndicatorRequest> {
+
+ protected final EchoBaseResultRepository repository;
+
+ protected final Reports reports;
+
+ protected final EchoBaseProject project;
+
+ public PopulationIndicatorResultProducer(EchoBaseResultRepository repository) {
+ this.repository = repository;
+ this.project = repository.project;
+ this.reports = repository.reports;
+ }
+
+ @Override
+ public EchoBaseResultRepository getRepository() {
+ return repository;
+ }
+
+ @Override
+ public Map<String, String> getAvailableZones(PopulationIndicatorRequest request) {
+ boolean match = repository.matchFacade(request);
+
+ Map<String, String> result = null;
+ if (match) {
+ ZoneMap zonesMap = repository.getZonesMap();
+ List<String> allowedZones = zonesMap.getZonesForFacade(request.getFacade());
+ result = zonesMap.getSubZonesMap(project.getZoneName(), allowedZones);
+ }
+ return result;
+ }
+
+ @Override
+ public Map<String, String> getAvailableSpecies(PopulationIndicatorRequest request) {
+ Preconditions.checkNotNull(request.getFacade());
+ Preconditions.checkNotNull(request.getZone());
+
+ Map<String, String> result = null;
+ boolean match = repository.matchFacade(request) && repository.matchZone(request);
+
+ if (match) {
+ // get all population indicator species for given facade + zone
+ Set<String> speciesList = repository.getPopulationIndicatorSpecies();
+ result = repository.getSpeciesMap().getSpeciesSubMap(speciesList);
+ }
+
+ return result;
+ }
+
+ @Override
+ public Map<String, String> getAvailableIndicators(PopulationIndicatorRequest request) {
+ Preconditions.checkNotNull(request.getFacade());
+ Preconditions.checkNotNull(request.getZone());
+
+ Map<String, String> result = null;
+ boolean match = repository.matchFacade(request) && repository.matchZone(request);
+ if (match) {
+
+ // get all indicators for given facade + zone
+ Set<String> indicatorList = repository.getCommunityIndicators();
+ result = repository.getIndicatorsMap().getIndicatorsValues(indicatorList, request.getLocale());
+ }
+ return result;
+ }
+
+ @Override
+ public FileResult produceResult(PopulationIndicatorRequest r) {
+
+ File file = null;
+ switch (r.getResultType()) {
+ case DATA:
+ file = getPopulationIndicatorDataFile(r.getIndicator(),
+ r.getSpecies());
+ break;
+
+ case GRAPH:
+ file = getPopulationIndicatorGraphFile(r.getLocale(),
+ r.getZone(),
+ r.getIndicator(),
+ r.getSpecies());
+ break;
+ }
+
+
+ FileResult result = new FileResult(repository.getId(), file);
+ return result;
+ }
+
+ protected File getPopulationIndicatorDataFile(String species, String indicator) {
+
+ DataStorage dataStorage = new MemoryDataStorage();
+
+ Iterator<String[]> iterator = repository.loadPopulationIndicatorStorage(false);
+
+ // add header
+ dataStorage.add(iterator.next());
+
+ while (iterator.hasNext()) {
+ String[] tuple = iterator.next();
+ if (repository.matchIndicatorSpeciesAndIndicator(tuple, species, indicator)) {
+ dataStorage.add(tuple);
+ }
+ }
+ File result = DataStorages.save(dataStorage, "coser-chart-population-indicator",
+ ".csv"
+ );
+ return result;
+ }
+
+ protected File getPopulationIndicatorGraphFile(Locale locale,
+ String zone,
+ String species,
+ String indicator) {
+
+
+ int multiplicator = 1;
+ int minYear = Integer.MAX_VALUE;
+ int maxYear = Integer.MIN_VALUE;
+ boolean indicatorFound = false;
+ Map<Integer, Double[]> graphData = new HashMap<Integer, Double[]>();
+ Iterator<String[]> iterator = repository.loadPopulationIndicatorStorage(true);
+ while (iterator.hasNext()) {
+ String[] tuple = iterator.next();
+
+ if (repository.matchIndicatorSpeciesAndIndicator(tuple, species, indicator)) {
+ indicatorFound = true;
+
+ // XXX echatellier, maybe take care of list here ?
+
+ Double estimation = Double.parseDouble(tuple[6]);
+ Double ecart = Double.parseDouble(tuple[7]);
+ int year = Integer.parseInt(tuple[5]);
+
+ if (year < minYear) {
+ minYear = year;
+ }
+ if (year > maxYear) {
+ maxYear = year;
+ }
+ graphData.put(year, new Double[]{estimation, ecart});
+
+ // si les données sont énormes, on affiche les données
+ // / multiplicator et on le mentionne dans la légende
+ if (estimation > 1e9) {
+ multiplicator = 1000000;
+ }
+ if (estimation > 1e6 && multiplicator < 1000000) {
+ multiplicator = 1000;
+ }
+ }
+ }
+
+ File result = null;
+
+ // avec l'extraction des données, on peut demander a générer un graphique
+ // sur un indicateur qui n'est pas présent dans le projet courant,
+ // dans ce cas, on retourne null
+ if (indicatorFound) {
+
+ String zoneDisplayName = repository.getZonesMap().getZoneFullName(zone);
+ String indicatorName = repository.getIndicatorsMap().getIndicatorValue(indicator, locale);
+ String unit = repository.getIndicatorsMap().getIndicatorUnit(indicator);
+
+ // get graph title
+ String title = zoneDisplayName;
+ title += " - " + indicatorName;
+ title += " - " + repository.getSpeciesMap().getReportDisplayName(species);
+
+ // generate dataset with sorted data
+ DefaultStatisticalCategoryDataset statisticalDataset = new DefaultStatisticalCategoryDataset();
+ for (int indexYear = minYear; indexYear <= maxYear; ++indexYear) {
+ Double[] entry = graphData.get(indexYear);
+ if (entry != null) {
+ Double estimation = entry[0] / multiplicator;
+ Double ecart = entry[1] / multiplicator;
+ statisticalDataset.add(estimation, ecart, "Serie1", (Comparable) indexYear);
+ } else {
+ statisticalDataset.add(null, null, "Serie1", indexYear);
+ }
+ }
+
+ // configure chart
+ //CategoryAxis categoryAxis = new CategoryAxis(t("coser.business.common.year"));
+ String yearAxis = reports.getYearChartTitle(locale);
+ CategoryAxis categoryAxis = new CategoryAxis(yearAxis);
+ categoryAxis.setCategoryMargin(0);
+ categoryAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
+ // label horizontaux
+ String legendY = indicatorName;
+ if (multiplicator != 1) {
+ // affiche par exemple : cm * 1000
+ legendY += " (" + unit + "*" + multiplicator + ")";
+ } else if (StringUtils.isNotEmpty(unit)) {
+ legendY += " (" + unit + ")";
+ }
+ ValueAxis valueAxis = new NumberAxis(legendY);
+ valueAxis.setUpperMargin(0.1);
+
+ CategoryItemRenderer renderer = new StatisticalLineAndShapeRenderer(false, true);
+
+ // n'affiche pas les nombre sur le graphique
+ //StandardCategoryItemLabelGenerator itemLabelGenerator = new StandardCategoryItemLabelGenerator();
+ //renderer.setBaseItemLabelGenerator(itemLabelGenerator);
+ //renderer.setBaseItemLabelsVisible(true);
+
+ CategoryPlot plot = new CategoryPlot(statisticalDataset, categoryAxis, valueAxis, renderer);
+ plot.setOrientation(PlotOrientation.VERTICAL);
+ JFreeChart chart = new JFreeChart(title,
+ JFreeChart.DEFAULT_TITLE_FONT, plot, true);
+
+ // remove series legend
+ chart.removeLegend();
+ // white background
+ chart.setBackgroundPaint(Color.WHITE);
+
+ try {
+ result = File.createTempFile("coser-chart-population-indicator-", ".png");
+ result.deleteOnExit();
+ ChartUtilities.saveChartAsPNG(result, chart, 800, 400);
+ } catch (IOException ex) {
+ throw new CoserTechnicalException("Can't save chart", ex);
+ }
+ }
+
+ return result;
+ }
+
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/PopulationIndicatorResultProducer.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/RawDataResultProducer.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/RawDataResultProducer.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/RawDataResultProducer.java 2014-03-11 09:28:43 UTC (rev 1141)
@@ -0,0 +1,91 @@
+package fr.ifremer.coser.result.repository.echobase;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import fr.ifremer.coser.bean.EchoBaseProject;
+import fr.ifremer.coser.bean.ZoneMap;
+import fr.ifremer.coser.result.FileResult;
+import fr.ifremer.coser.result.repository.RequestUnavailableForProducerException;
+import fr.ifremer.coser.result.repository.ResultProducer;
+import fr.ifremer.coser.result.request.RawDataRequest;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class RawDataResultProducer implements ResultProducer<RawDataRequest> {
+
+ protected final EchoBaseResultRepository repository;
+
+ protected final EchoBaseProject project;
+
+ public RawDataResultProducer(EchoBaseResultRepository repository) {
+ this.repository = repository;
+ this.project = repository.project;
+
+ }
+
+ @Override
+ public EchoBaseResultRepository getRepository() {
+ return repository;
+ }
+
+ @Override
+ public Map<String, String> getAvailableZones(RawDataRequest request) {
+ Preconditions.checkNotNull(request.getFacade());
+
+ boolean match = repository.matchFacade(request);
+
+ Map<String, String> result = null;
+ if (match) {
+ ZoneMap zonesMap = repository.getZonesMap();
+ List<String> allowedZones = zonesMap.getZonesForFacade(request.getFacade());
+ result = zonesMap.getSubZonesMap(project.getZoneName(), allowedZones);
+ }
+ return result;
+ }
+
+ @Override
+ public Map<String, String> getAvailableSpecies(RawDataRequest request) {
+ throw RequestUnavailableForProducerException.newException("getAvailableSpecies", this);
+ }
+
+ @Override
+ public Map<String, String> getAvailableIndicators(RawDataRequest request) {
+ throw RequestUnavailableForProducerException.newException("getAvailableIndicators", this);
+ }
+
+ @Override
+ public FileResult produceResult(RawDataRequest r) {
+
+ //TODO
+ throw RequestUnavailableForProducerException.newException("produceResult", this);
+ }
+
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/echobase/RawDataResultProducer.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/CommunityIndicatorResultProducer.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/CommunityIndicatorResultProducer.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/CommunityIndicatorResultProducer.java 2014-03-11 09:28:43 UTC (rev 1141)
@@ -0,0 +1,405 @@
+package fr.ifremer.coser.result.repository.legacy;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import fr.ifremer.coser.CoserTechnicalException;
+import fr.ifremer.coser.bean.RSufiResultPath;
+import fr.ifremer.coser.bean.ZoneMap;
+import fr.ifremer.coser.result.FileResult;
+import fr.ifremer.coser.result.Reports;
+import fr.ifremer.coser.result.repository.ResultProducer;
+import fr.ifremer.coser.result.request.CommunityIndicatorRequest;
+import fr.ifremer.coser.services.ProjectService;
+import fr.ifremer.coser.storage.DataStorage;
+import fr.ifremer.coser.storage.DataStorages;
+import fr.ifremer.coser.storage.MemoryDataStorage;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jfree.chart.ChartUtilities;
+import org.jfree.chart.JFreeChart;
+import org.jfree.chart.axis.CategoryAxis;
+import org.jfree.chart.axis.CategoryLabelPositions;
+import org.jfree.chart.axis.NumberAxis;
+import org.jfree.chart.axis.ValueAxis;
+import org.jfree.chart.plot.CategoryPlot;
+import org.jfree.chart.plot.PlotOrientation;
+import org.jfree.chart.renderer.category.CategoryItemRenderer;
+import org.jfree.chart.renderer.category.StatisticalLineAndShapeRenderer;
+import org.jfree.data.statistics.DefaultStatisticalCategoryDataset;
+import org.nuiton.util.FileUtil;
+import org.nuiton.util.ZipUtil;
+
+import java.awt.Color;
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class CommunityIndicatorResultProducer implements ResultProducer<CommunityIndicatorRequest> {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(CommunityIndicatorResultProducer.class);
+
+ protected final LegacyResultRepository repository;
+
+ protected final Reports reports;
+
+ protected final RSufiResultPath path;
+
+ protected final File basedir;
+
+ protected final ProjectService projectService;
+
+ protected final String surveyName;
+
+ public CommunityIndicatorResultProducer(LegacyResultRepository repository) {
+ this.repository = repository;
+ this.path = repository.path;
+ this.reports = repository.reports;
+ this.projectService = repository.projectService;
+ this.basedir = repository.basedir;
+ this.surveyName = repository.surveyName;
+ }
+
+ @Override
+ public LegacyResultRepository getRepository() {
+ return repository;
+ }
+
+ @Override
+ public Map<String, String> getAvailableZones(CommunityIndicatorRequest request) {
+ Preconditions.checkNotNull(request.getFacade());
+
+ boolean match = repository.matchFacade(request);
+
+ Map<String, String> result = null;
+ if (match) {
+ ZoneMap zonesMap = repository.getZonesMap();
+ List<String> allowedZones = zonesMap.getZonesForFacade(request.getFacade());
+ result = zonesMap.getSubZonesMap(path.getRsufiResult().getZone(), allowedZones);
+ }
+ return result;
+ }
+
+ @Override
+ public Map<String, String> getAvailableSpecies(CommunityIndicatorRequest request) {
+ Preconditions.checkNotNull(request.getFacade());
+ Preconditions.checkNotNull(request.getZone());
+ Preconditions.checkNotNull(request.getIndicator());
+
+ Map<String, String> result = null;
+
+ boolean match = repository.indicatorsResult &&
+ repository.matchFacade(request) &&
+ repository.matchZone(request) &&
+ repository.matchIndicator(request);
+ if (match) {
+
+ // get all map species for given facade + zone
+ result = repository.getCommunityIndicatorSpecies(request.getLocale(),
+ request.getIndicator());
+ }
+ return result;
+ }
+
+ @Override
+ public Map<String, String> getAvailableIndicators(CommunityIndicatorRequest request) {
+ Preconditions.checkNotNull(request.getFacade());
+ Preconditions.checkNotNull(request.getZone());
+
+ Map<String, String> result = null;
+
+ boolean match = repository.indicatorsResult &&
+ repository.matchFacade(request) &&
+ repository.matchZone(request);
+ if (match) {
+
+ // get all indicators for given facade + zone
+ Set<String> indicatorList = repository.getCommunityIndicators();
+ result = repository.getIndicatorsMap().getIndicatorsValues(indicatorList, request.getLocale());
+ }
+
+ return result;
+ }
+
+ @Override
+ public FileResult produceResult(CommunityIndicatorRequest request) {
+
+ File file = null;
+ switch (request.getResultType()) {
+ case DATA:
+ file = getCommunityIndicatorDataFile(request.getLocale(),
+ request.getIndicator(),
+ request.getSpecies());
+ break;
+
+ case GRAPH:
+ file = getCommunityIndicatorGraphFile(request.getLocale(),
+ request.getZone(),
+ request.getIndicator(),
+ request.getSpecies());
+ break;
+ }
+ FileResult result = new FileResult(repository.getId(), file);
+ return result;
+ }
+
+
+ protected File getCommunityIndicatorDataFile(Locale locale,
+ String indicator,
+ String speciesList) {
+
+ try {
+
+ File tempDir = FileUtil.createTempDirectory("coser-chart-population-indicator", "-tmp");
+
+ File baseDir = new File(tempDir, surveyName);
+ FileUtils.forceMkdir(baseDir);
+
+ // ajout du fichier csv avec les indicateurs
+ DataStorage dataStorage = new MemoryDataStorage();
+
+ Iterator<String[]> iterator = repository.loadCommunityIndicatorStorage(false);
+
+ // add header
+ dataStorage.add(iterator.next());
+
+ while (iterator.hasNext()) {
+ String[] tuple = iterator.next();
+ if (repository.matchCommunityIndicatorAndSpeciesList(tuple, indicator, speciesList)) {
+ dataStorage.add(tuple);
+ }
+ }
+ File csvFile = DataStorages.save(dataStorage, "coser-chart-community-indicator",
+ ".csv"
+ );
+
+ File csvFileCopied = new File(baseDir, indicator + ".csv");
+ FileUtils.copyFile(csvFile, csvFileCopied);
+ FileUtils.forceDelete(csvFile);
+
+ // ajout du fichier d'information sur les espèces incluses dans
+ // les calculs des indicateurs de communautés
+ // load project (without data to get reftax data)
+ File metaFile = reports.generateMetaFilePDF(path,
+ repository.resultDirectory,
+ locale,
+ repository.getIndicatorsMap()
+ );
+ File metaFileCopied = new File(baseDir, "Information.pdf");
+ FileUtils.copyFile(metaFile, metaFileCopied);
+
+ // make zip
+ File result = File.createTempFile("coser-chart-community-indicator", ".zip");
+ result.deleteOnExit();
+ ZipUtil.compress(result, baseDir);
+
+ // clean directory
+ FileUtils.deleteDirectory(tempDir);
+ return result;
+ } catch (Exception e) {
+ throw new CoserTechnicalException("Can't create zip file", e);
+ }
+ }
+
+ protected File getCommunityIndicatorGraphFile(Locale locale,
+ String zone,
+ String indicator,
+ String speciesList) {
+
+ // indicator list to take care
+ // pour avoir une valeur non nulle si list est null
+ // on prend dans ce cas la premiere valeur trouvée
+ String localList = speciesList;
+
+ if (log.isDebugEnabled()) {
+ log.debug("Searching list for indicator : " + indicator);
+ }
+
+ int multiplicator = 1;
+ int minYear = Integer.MAX_VALUE;
+ int maxYear = Integer.MIN_VALUE;
+ boolean indicatorFound = false;
+ Map<Integer, Double[]> graphData = new HashMap<Integer, Double[]>();
+ Iterator<String[]> iterator = repository.loadCommunityIndicatorStorage(true);
+ while (iterator.hasNext()) {
+ // Campagne Indicateur Liste Strate Annee Estimation EcartType CV
+ String[] tuple = iterator.next();
+ String indicatorList = tuple[2];
+
+ if (repository.matchCommunityIndicator(tuple, indicator)) {
+ indicatorFound = true;
+
+ // si pas de list selectionnée, on prend la premiere
+ if (StringUtils.isBlank(localList)) {
+ localList = indicatorList;
+ }
+
+ if (indicatorList.equals(localList)) {
+ Double estimation = Double.parseDouble(tuple[5]);
+ Double ecart = Double.parseDouble(tuple[6]);
+ int year = Integer.parseInt(tuple[4]);
+
+ if (year < minYear) {
+ minYear = year;
+ }
+ if (year > maxYear) {
+ maxYear = year;
+ }
+ graphData.put(year, new Double[]{estimation, ecart});
+
+ // si les données sont énormes, on affiche les données
+ // / multiplicator et on le mentionne dans la légende
+ if (estimation > 1e9) {
+ multiplicator = 1000000;
+ }
+ if (estimation > 1e6 && multiplicator < 1000000) {
+ multiplicator = 1000;
+ }
+ }
+ }
+ }
+
+ File result = null;
+
+ // avec l'extraction des données, on peut demander a générer un graphique
+ // sur un indicateur qui n'est pas présent dans le projet courant,
+ // dans ce cas, on retourne null
+ if (indicatorFound) {
+
+ String zoneDisplayName = repository.getZonesMap().getZoneFullName(zone);
+ String indicatorName = repository.getIndicatorsMap().getIndicatorValue(indicator, locale);
+ String unit = repository.getIndicatorsMap().getIndicatorUnit(indicator);
+
+ // get graph title
+ String chartTitle = zoneDisplayName;
+ chartTitle += " - " + indicatorName;
+
+ String speciesListName = repository.getSpeciesListMap().getSpeciesListName(locale, localList);
+ chartTitle += " - " + speciesListName;
+// // ajout de la traduction de la liste d'indicateur
+// // les liste sont a1, T1, T2 ...
+// String listLetter = String.valueOf(localList.charAt(0));
+// Iterator<String[]> typeIterator = repository.getSpeciesListMap().iterator(true);
+// while (typeIterator.hasNext()) {
+// // "Types";"Commentaire";"NumSys min";"NumSys max";"Code"
+// String[] tuple = typeIterator.next();
+// if (tuple[4].equals(listLetter)) {
+// /// gestion du groupe "Tous"
+// // cas special, c'est la seule valeur du fichier
+// // code type espece qui a besoin d'une traduction
+// if (tuple[4].equalsIgnoreCase("T")) {
+// if ("fr".equals(locale.getLanguage())) {
+// chartTitle += " - " + "Tous Liste " + localList.charAt(1);
+// } else if ("es".equals(locale.getLanguage())) {
+// chartTitle += " - " + "Todo Lista " + localList.charAt(1);
+// } else {
+// chartTitle += " - " + "All List " + localList.charAt(1);
+// }
+// } else {
+// // ajout de la traduction du nom de liste plus le numéro
+// if ("fr".equals(locale.getLanguage())) {
+// chartTitle += " - " + tuple[0] + " Liste " + localList.charAt(1);
+// } else if ("es".equals(locale.getLanguage())) {
+// chartTitle += " - " + tuple[0] + " Lista " + localList.charAt(1);
+// } else {
+// chartTitle += " - " + tuple[0] + " List " + localList.charAt(1);
+// }
+// }
+// break;
+// }
+// }
+
+ // generate dataset with sorted data
+ DefaultStatisticalCategoryDataset statisticalDataset = new DefaultStatisticalCategoryDataset();
+ for (int indexYear = minYear; indexYear <= maxYear; ++indexYear) {
+ Double[] entry = graphData.get(indexYear);
+ if (entry != null) {
+ Double estimation = entry[0] / multiplicator;
+ Double ecart = entry[1] / multiplicator;
+ statisticalDataset.add(estimation, ecart, "Serie1", (Comparable) indexYear);
+ } else {
+ statisticalDataset.add(null, null, "Serie1", indexYear);
+ }
+ }
+
+ // configure chart
+ //CategoryAxis categoryAxis = new CategoryAxis(t("coser.business.common.year"));
+ String yearAxis = reports.getYearChartTitle(locale);
+
+ CategoryAxis categoryAxis = new CategoryAxis(yearAxis);
+ categoryAxis.setCategoryMargin(0);
+ categoryAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
+ // label horizontaux
+ String legendY = indicatorName;
+ if (multiplicator != 1) {
+ // affiche par exemple : cm * 1000
+ legendY += " (" + unit + "*" + multiplicator + ")";
+ } else if (StringUtils.isNotEmpty(unit)) {
+ legendY += " (" + unit + ")";
+ }
+ ValueAxis valueAxis = new NumberAxis(legendY);
+ valueAxis.setUpperMargin(0.1);
+
+ CategoryItemRenderer renderer = new StatisticalLineAndShapeRenderer(false, true);
+
+ // n'affiche pas les nombre sur le graphique
+ //StandardCategoryItemLabelGenerator itemLabelGenerator = new StandardCategoryItemLabelGenerator();
+ //renderer.setBaseItemLabelGenerator(itemLabelGenerator);
+ //renderer.setBaseItemLabelsVisible(true);
+
+ CategoryPlot plot = new CategoryPlot(statisticalDataset, categoryAxis, valueAxis, renderer);
+ plot.setOrientation(PlotOrientation.VERTICAL);
+ JFreeChart chart = new JFreeChart(chartTitle,
+ JFreeChart.DEFAULT_TITLE_FONT, plot, true);
+
+ // remove series legend
+ chart.removeLegend();
+ // white background
+ chart.setBackgroundPaint(Color.WHITE);
+
+ try {
+ result = File.createTempFile("coser-chart-community-indicator-", ".png");
+ result.deleteOnExit();
+ ChartUtilities.saveChartAsPNG(result, chart, 800, 400);
+ } catch (IOException ex) {
+ throw new CoserTechnicalException("Can't save chart", ex);
+ }
+ }
+
+ return result;
+ }
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/CommunityIndicatorResultProducer.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/ExtractResultProducer.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/ExtractResultProducer.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/ExtractResultProducer.java 2014-03-11 09:28:43 UTC (rev 1141)
@@ -0,0 +1,730 @@
+package fr.ifremer.coser.result.repository.legacy;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Maps;
+import fr.ifremer.coser.CoserBusinessException;
+import fr.ifremer.coser.CoserTechnicalException;
+import fr.ifremer.coser.bean.IndicatorMap;
+import fr.ifremer.coser.bean.Project;
+import fr.ifremer.coser.bean.RSufiResult;
+import fr.ifremer.coser.bean.RSufiResultPath;
+import fr.ifremer.coser.bean.Selection;
+import fr.ifremer.coser.bean.SpeciesMap;
+import fr.ifremer.coser.bean.ZoneMap;
+import fr.ifremer.coser.result.FileResult;
+import fr.ifremer.coser.result.Reports;
+import fr.ifremer.coser.result.repository.ResultProducer;
+import fr.ifremer.coser.result.request.ExtractRequest;
+import fr.ifremer.coser.services.ProjectService;
+import fr.ifremer.coser.storage.DataStorage;
+import fr.ifremer.coser.storage.DataStorages;
+import fr.ifremer.coser.storage.MemoryDataStorage;
+import fr.ifremer.coser.util.DataType;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.MapUtils;
+import org.apache.commons.collections4.keyvalue.MultiKey;
+import org.apache.commons.collections4.map.MultiKeyMap;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.tuple.Pair;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jfree.chart.ChartUtilities;
+import org.jfree.chart.JFreeChart;
+import org.jfree.chart.axis.CategoryAxis;
+import org.jfree.chart.axis.CategoryLabelPositions;
+import org.jfree.chart.axis.NumberAxis;
+import org.jfree.chart.axis.ValueAxis;
+import org.jfree.chart.plot.CategoryPlot;
+import org.jfree.chart.plot.PlotOrientation;
+import org.jfree.chart.renderer.category.CategoryItemRenderer;
+import org.jfree.chart.renderer.category.StatisticalLineAndShapeRenderer;
+import org.jfree.data.statistics.DefaultStatisticalCategoryDataset;
+import org.nuiton.util.FileUtil;
+import org.nuiton.util.ZipUtil;
+
+import java.awt.Color;
+import java.io.File;
+import java.io.IOException;
+import java.io.StringWriter;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class ExtractResultProducer implements ResultProducer<ExtractRequest> {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(ExtractResultProducer.class);
+
+ protected final LegacyResultRepository repository;
+
+ protected final Reports reports;
+
+ protected final RSufiResultPath path;
+
+ protected final File basedir;
+
+ protected final ProjectService projectService;
+
+ public ExtractResultProducer(LegacyResultRepository repository) {
+ this.repository = repository;
+ this.path = repository.path;
+ this.reports = repository.reports;
+ this.projectService = repository.projectService;
+ this.basedir = repository.basedir;
+ }
+
+ @Override
+ public LegacyResultRepository getRepository() {
+ return repository;
+ }
+
+ @Override
+ public Map<String, String> getAvailableZones(ExtractRequest request) {
+
+ ZoneMap zonesMap = repository.getZonesMap();
+ List<String> allowedZones = zonesMap.getZonesForFacade(null);
+ Map<String, String> result = zonesMap.getSubZonesMap(path.getRsufiResult().getZone(), allowedZones);
+ return result;
+ }
+
+ @Override
+ public Map<String, String> getAvailableSpecies(ExtractRequest request) {
+ Preconditions.checkNotNull(request.getZoneList());
+
+ Map<String, String> result = null;
+
+ boolean match = repository.matchZoneList(request);
+
+ if (match) {
+ result = Maps.newHashMap();
+
+ // get all species for population indicators
+ result.putAll(repository.getPopulationIndicatorSpecies());
+ // get all species for community indicators
+ result.putAll(repository.getCommunityIndicatorSpecies());
+ }
+ return result;
+ }
+
+ @Override
+ public Map<String, String> getAvailableIndicators(ExtractRequest request) {
+ Preconditions.checkNotNull(request.getZoneList());
+ Preconditions.checkNotNull(request.getExtractTypeList());
+
+ Map<String, String> result = null;
+
+ boolean match = repository.matchZoneList(request);
+ if (match) {
+
+ Set<String> indicatorList = null;
+
+ if (request.getExtractTypeList().contains(DataType.COMMUNITY)) {
+
+ // get all community indicators for given zone
+ indicatorList = repository.getCommunityIndicators();
+ } else if (request.getExtractTypeList().contains(DataType.POPULATION)) {
+
+ // get all population indicators for given zone
+ indicatorList = repository.getPopulationIndicators();
+ }
+
+ if (indicatorList != null) {
+ result = repository.getIndicatorsMap().getIndicatorsValues(indicatorList, request.getLocale());
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public FileResult produceResult(ExtractRequest r) {
+
+ Locale locale = r.getLocale();
+ List<String> zoneList = r.getZoneList();
+ List<DataType> extractTypeList = r.getExtractTypeList();
+ List<String> speciesList = r.getSpeciesList();
+ List<String> communityIndicatorList = r.getCommunityIndicatorList();
+ List<String> populationIndicatorList = r.getPopulationIndicatorList();
+
+ File resultZip = null;
+ File tempDir = null;
+ try {
+ tempDir = FileUtil.createTempDirectory("coser-extract-", "-tmp");
+
+ File subDir = new File(tempDir, "Indicateurs_Ifremer");
+ FileUtils.forceMkdir(subDir);
+
+ // les sources se retrouve dans le zip a cote du pdf
+ if (extractTypeList.contains(DataType.SOURCE)) {
+ if (log.isDebugEnabled()) {
+ log.debug("Extracting sources");
+ }
+ File srcDir = new File(subDir, "sources");
+ extractSource(srcDir);
+ }
+
+ // les cartes doivent se retrouver dans le pdf
+ MultiKeyMap pdfMaps = null;
+ if (extractTypeList.contains(DataType.MAP)) {
+ if (log.isDebugEnabled()) {
+ log.debug("Extracting maps");
+ }
+ SpeciesMap speciesMap = repository.getSpeciesMap();
+ String zone = path.getRsufiResult().getZone();
+ for (String species : speciesList) {
+ File mapFile = repository.getMapSpeciesFile(species);
+ pdfMaps.put(zone, speciesMap.getSpeciesName(species), mapFile);
+ }
+ }
+
+ // les graphiques sont également dans le pdf
+ MultiKeyMap pdfCharts = null;
+ if (CollectionUtils.isNotEmpty(communityIndicatorList) ||
+ CollectionUtils.isNotEmpty(populationIndicatorList)) {
+ if (log.isDebugEnabled()) {
+ log.debug("Extracting charts");
+ }
+ pdfCharts = extractCharts(speciesList,
+ communityIndicatorList,
+ populationIndicatorList,
+ locale);
+ }
+
+ // generate pdf if necessary
+ if (MapUtils.isNotEmpty(pdfMaps) || MapUtils.isNotEmpty(pdfCharts)) {
+ if (log.isDebugEnabled()) {
+ log.debug("Generated Extract PDF");
+ }
+ reports.generateExtractPDF(subDir,
+ zoneList,
+ pdfMaps,
+ pdfCharts,
+ repository.getZonesMap(),
+ locale);
+ }
+
+ // fichier de décharge en pdf
+ if (log.isDebugEnabled()) {
+ log.debug("Generated decharge PDF");
+ }
+ String filename = reports.getDechargeFilename(locale);
+ File dechargePDF = new File(subDir, filename);
+ reports.generateDechargePDF(dechargePDF, locale, null, null);
+
+ // make zip
+ if (log.isDebugEnabled()) {
+ log.debug("Make final archive");
+ }
+ resultZip = File.createTempFile("coser-extract-", ".zip");
+ resultZip.deleteOnExit();
+ ZipUtil.compress(resultZip, subDir);
+
+ // clean directory
+ FileUtils.deleteDirectory(tempDir);
+ } catch (IOException ex) {
+ throw new CoserTechnicalException("Can't create zip file", ex);
+ } finally {
+ // clean directory
+ FileUtils.deleteQuietly(tempDir);
+ }
+
+ FileResult result = new FileResult(repository.getId(), resultZip);
+ return result;
+ }
+
+ /**
+ * Generate raw data after selection in a sub directory (named of the zone) of the given directory.
+ *
+ * @param directory where to generate file
+ */
+ protected void extractSource(File directory) {
+
+ // load project (with data to get original file names)
+ Project project = path.getProject();
+
+ // load selection data (to do data export rsufi)
+ Selection selection = path.getSelection();
+
+ try {
+ // be sure that data are available for this project
+ // or it will fail
+
+ projectService.loadSelectionData(basedir.getParentFile(), project, selection);
+ } catch (CoserBusinessException e) {
+ throw new CoserTechnicalException("Could not load project selection", e);
+ }
+
+ // il ne faut pas les fichiers de selection, mais leurs
+ // export rsufi (sans les lignes, et les quotes)
+ File zoneDirectory = new File(directory, path.getRsufiResult().getZone());
+
+ try {
+ FileUtils.forceMkdir(zoneDirectory);
+ } catch (IOException e) {
+ throw new CoserTechnicalException("Could not create directory: " + zoneDirectory, e);
+ }
+
+ try {
+ projectService.extractRSUfiData(project, selection, zoneDirectory, true);
+ } catch (CoserBusinessException e) {
+ throw new CoserTechnicalException("Could not extract raw data", e);
+ }
+ }
+
+ /**
+ * Retourne les indicateurs calculés avec leurs traductions scientifique
+ * pour la zone et l'especes souhaitées.
+ *
+ * @param species especes (if {@code null} look for com indicators
+ * @param comIndicators comIndicator
+ * @param popIndicators popIndicators
+ * @param locale locale
+ * @return la liste des indicateurs (zone, speciesname, [graphfile, graphdata])
+ */
+ protected MultiKeyMap extractCharts(Collection<String> species,
+ Collection<String> comIndicators,
+ Collection<String> popIndicators,
+ Locale locale) {
+
+ MultiKeyMap chartFileAndDatas = new MultiKeyMap();
+
+ Project project = path.getProject();
+ RSufiResult rsufiResult = path.getRsufiResult();
+ String zone = rsufiResult.getZone();
+ String zoneDisplayName = repository.getZonesMap().getZoneFullName(zone);
+
+ if (CollectionUtils.isNotEmpty(comIndicators)) {
+ Map<String, Pair<File, String>> chartFileAndDataCom = getRsufiResultComCharts(comIndicators,
+ zoneDisplayName,
+ repository.getIndicatorsMap(),
+ locale,
+ 650,
+ 430);
+ // put in multimap as zone,speciesname, data
+ for (Map.Entry<String, Pair<File, String>> entry : chartFileAndDataCom.entrySet()) {
+ chartFileAndDatas.put(zone, entry.getKey(), entry.getValue());
+ }
+ }
+
+ if (CollectionUtils.isNotEmpty(popIndicators)) {
+ Map<String, Pair<File, String>> chartFileAndDataPop = getRsufiResultPopCharts(species,
+ popIndicators,
+ zoneDisplayName,
+ repository.getIndicatorsMap(),
+ locale,
+ 650,
+ 430);
+ // put in multimap as zone,speciesname, data
+ for (Map.Entry<String, Pair<File, String>> entry : chartFileAndDataPop.entrySet()) {
+ chartFileAndDatas.put(zone, entry.getKey(), entry.getValue());
+ }
+ }
+
+ return chartFileAndDatas;
+ }
+
+ /**
+ * Generate community graph for selected indicators.
+ * Used by web ui extraction.
+ *
+ * @param indicators indicators to extract
+ * @param zoneDisplayName zone full name
+ * @param indicatorMap indicator localized map
+ * @param locale locale
+ * @param width graph width
+ * @param height graph height
+ * @return maps of generated graph image (temp file) and data indexed by natural key (indicator - species)
+ */
+ public Map<String, Pair<File, String>> getRsufiResultComCharts(Collection<String> indicators,
+ String zoneDisplayName,
+ IndicatorMap indicatorMap,
+ Locale locale,
+ int width, int height) {
+
+ Map<String, Pair<File, String>> result = Maps.newHashMap();
+
+ int multiplicator = 1;
+ int minYear = Integer.MAX_VALUE;
+ int maxYear = Integer.MIN_VALUE;
+
+ Map<String, Map<Integer, Double[]>> indicatorGraphData = new HashMap<String, Map<Integer, Double[]>>();
+ Map<String, String> indicatorLists = new HashMap<String, String>();
+ Map<String, DataStorage> indicatorStorages = new HashMap<String, DataStorage>();
+
+ // Campagne Indicateur Liste Strate Annee Estimation EcartType CV
+ Iterator<String[]> estComIndIterator = repository.loadCommunityIndicatorStorage(true);
+ while (estComIndIterator.hasNext()) {
+ // Campagne Indicateur Liste Strate Annee Estimation EcartType CV
+ String[] tuple = estComIndIterator.next();
+ String indicatorCode = tuple[1];
+ String indicatorList = tuple[2];
+
+ if (indicators.contains(indicatorCode)) {
+
+ // si pas de list selectionnée, on prend la premiere
+ String localList = indicatorLists.get(indicatorCode);
+ if (StringUtils.isBlank(localList)) {
+ localList = indicatorList;
+ indicatorLists.put(indicatorCode, localList);
+ }
+
+ if (indicatorList.equals(localList)) {
+ Double estimation = Double.parseDouble(tuple[5]);
+ Double ecart = Double.parseDouble(tuple[6]);
+ int year = Integer.parseInt(tuple[4]);
+
+ if (year < minYear) {
+ minYear = year;
+ }
+ if (year > maxYear) {
+ maxYear = year;
+ }
+ Map<Integer, Double[]> graphData = indicatorGraphData.get(indicatorCode);
+ if (graphData == null) {
+ graphData = new HashMap<Integer, Double[]>();
+ indicatorGraphData.put(indicatorCode, graphData);
+ }
+ graphData.put(year, new Double[]{estimation, ecart});
+
+ // si les données sont énormes, on affiche les données
+ // / multiplicator et on le mentionne dans la légende
+ if (estimation > 1e9) {
+ multiplicator = 1000000;
+ }
+ if (estimation > 1e6 && multiplicator < 1000000) {
+ multiplicator = 1000;
+ }
+
+ // for data part
+ DataStorage subDataStorage = indicatorStorages.get(indicatorCode);
+ if (subDataStorage == null) {
+ subDataStorage = new MemoryDataStorage();
+ if ("fr".equals(locale.getLanguage())) {
+ subDataStorage.add(new String[]{"Campagne", "Indice", "Liste", "Strate", "Année", "Estimation", "EcartType", "CV"});
+ } else {
+ subDataStorage.add(new String[]{"Survey", "Index", "List", "Stratum", "Year", "Estimate", "StandardDeviation", "CV"});
+ }
+ indicatorStorages.put(indicatorCode, subDataStorage);
+ }
+ subDataStorage.add(tuple);
+ }
+ }
+ }
+
+ // avec l'extraction des données, on peut demander a générer un graphique
+ // sur un indicateur qui n'est pas présent dans le projet courant,
+ // dans ce cas, on retourne null
+ for (String indicator : indicatorGraphData.keySet()) {
+ // get graph title
+ String chartTitle = zoneDisplayName;
+ String indicatorName = indicatorMap.getIndicatorValue(indicator, locale);
+ String unit = indicatorMap.getIndicatorUnit(indicator);
+ chartTitle += " - " + indicatorName;
+
+ // ajout de la traduction de la liste d'indicateur
+ // les liste sont a1, T1, T2 ...
+ String localList = indicatorLists.get(indicator);
+ String speciesListName = repository.getSpeciesListMap().getSpeciesListName(locale, localList);
+ chartTitle += " - " + speciesListName;
+// String listLetter = String.valueOf(localList.charAt(0));
+// Iterator<String[]> typeIterator = repository.getSpeciesListMap().iterator(true);
+// while (typeIterator.hasNext()) {
+// // "Types";"Commentaire";"NumSys min";"NumSys max";"Code"
+// String[] tuple = typeIterator.next();
+// if (tuple[4].equals(listLetter)) {
+// /// gestion du groupe "Tous"
+// // cas special, c'est la seule valeur du fichier
+// // code type espece qui a besoin d'une traduction
+// if (tuple[4].equalsIgnoreCase("T")) {
+// if ("fr".equals(locale.getLanguage())) {
+// chartTitle += " - " + "Tous Liste " + localList.charAt(1);
+// } else if ("es".equals(locale.getLanguage())) {
+// chartTitle += " - " + "Todo Lista " + localList.charAt(1);
+// } else {
+// chartTitle += " - " + "All List " + localList.charAt(1);
+// }
+// } else {
+// // ajout de la traduction du nom de liste plus le numéro
+// if ("fr".equals(locale.getLanguage())) {
+// chartTitle += " - " + tuple[0] + " Liste " + localList.charAt(1);
+// } else if ("es".equals(locale.getLanguage())) {
+// chartTitle += " - " + tuple[0] + " Lista " + localList.charAt(1);
+// } else {
+// chartTitle += " - " + tuple[0] + " List " + localList.charAt(1);
+// }
+// }
+// break;
+// }
+// }
+
+ // generate dataset with sorted data
+ Map<Integer, Double[]> graphData = indicatorGraphData.get(indicator);
+ DefaultStatisticalCategoryDataset statisticalDataset = new DefaultStatisticalCategoryDataset();
+ for (int indexYear = minYear; indexYear <= maxYear; ++indexYear) {
+ Double[] entry = graphData.get(indexYear);
+ if (entry != null) {
+ Double estimation = entry[0] / multiplicator;
+ Double ecart = entry[1] / multiplicator;
+ statisticalDataset.add(estimation, ecart, "Serie1", (Comparable) indexYear);
+ } else {
+ statisticalDataset.add(null, null, "Serie1", indexYear);
+ }
+ }
+
+ // configure chart
+ //CategoryAxis categoryAxis = new CategoryAxis(t("coser.business.common.year"));
+ String yearAxis = reports.getYearChartTitle(locale);
+ CategoryAxis categoryAxis = new CategoryAxis(yearAxis);
+ categoryAxis.setCategoryMargin(0);
+ categoryAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
+ // label horizontaux
+ String legendY = indicatorName;
+ if (multiplicator != 1) {
+ // affiche par exemple : cm * 1000
+ legendY += " (" + unit + "*" + multiplicator + ")";
+ } else if (StringUtils.isNotEmpty(unit)) {
+ legendY += " (" + unit + ")";
+ }
+ ValueAxis valueAxis = new NumberAxis(legendY);
+ valueAxis.setUpperMargin(0.1);
+
+ CategoryItemRenderer renderer = new StatisticalLineAndShapeRenderer(false, true);
+
+ // n'affiche pas les nombre sur le graphique
+ //StandardCategoryItemLabelGenerator itemLabelGenerator = new StandardCategoryItemLabelGenerator();
+ //renderer.setBaseItemLabelGenerator(itemLabelGenerator);
+ //renderer.setBaseItemLabelsVisible(true);
+
+ CategoryPlot plot = new CategoryPlot(statisticalDataset, categoryAxis, valueAxis, renderer);
+ plot.setOrientation(PlotOrientation.VERTICAL);
+ JFreeChart chart = new JFreeChart(chartTitle,
+ JFreeChart.DEFAULT_TITLE_FONT, plot, true);
+
+ // remove series legend
+ chart.removeLegend();
+ // white background
+ chart.setBackgroundPaint(Color.WHITE);
+
+ try {
+ File chartFile = File.createTempFile("coser-community-chart-", ".png");
+ chartFile.deleteOnExit();
+ ChartUtilities.saveChartAsPNG(chartFile, chart, width, height);
+ //ByteArrayOutputStream out = new ByteArrayOutputStream();
+ //ChartUtilities.writeChartAsPNG(out, chart, width, height);
+
+ // data extraction
+ DataStorage subDataStorage = indicatorStorages.get(indicator);
+ StringWriter writer = new StringWriter();
+ DataStorages.save(subDataStorage, writer);
+
+ // add chart file dans chart data in result
+ result.put(indicator, Pair.of(chartFile, writer.toString()));
+ writer.close();
+ } catch (IOException ex) {
+ throw new CoserTechnicalException("Can't save chart", ex);
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Generate population graph for selected species and indicator.
+ *
+ * @param species species to extract
+ * @param indicators indicators to extract
+ * @param zoneDisplayName zone full name
+ * @param indicatorMap indicator localized map
+ * @param locale locale
+ * @param width graph width
+ * @param height graph height
+ * @return maps of generated graph image (temp file) and data indexed by natural key (indicator - species)
+ */
+ public Map<String, Pair<File, String>> getRsufiResultPopCharts(Collection<String> species,
+ Collection<String> indicators,
+ String zoneDisplayName,
+ IndicatorMap indicatorMap,
+ Locale locale,
+ int width,
+ int height) {
+
+ Map<String, Pair<File, String>> result = Maps.newHashMap();
+
+ int multiplicator = 1;
+ int minYear = Integer.MAX_VALUE;
+ int maxYear = Integer.MIN_VALUE;
+
+ MultiKeyMap indicatorGraphData = new MultiKeyMap();
+ MultiKeyMap indicatorStorages = new MultiKeyMap();
+
+ // Campagne Indicateur Liste Species Strate Annee Estimation EcartType CV
+ Iterator<String[]> estPopIndIterator = repository.loadPopulationIndicatorStorage(true);
+ while (estPopIndIterator.hasNext()) {
+ String[] tuple = estPopIndIterator.next();
+
+ String speciesCode = tuple[3];
+ String indicatorCode = tuple[1];
+ if (species.contains(speciesCode) && indicators.contains(indicatorCode)) {
+
+ // XXX echatellier, maybe take care of list here ?
+
+ Double estimation = Double.parseDouble(tuple[6]);
+ Double ecart = Double.parseDouble(tuple[7]);
+ int year = Integer.parseInt(tuple[5]);
+
+ if (year < minYear) {
+ minYear = year;
+ }
+ if (year > maxYear) {
+ maxYear = year;
+ }
+ Map<Integer, Double[]> graphData = (Map<Integer, Double[]>) indicatorGraphData.get(indicatorCode, speciesCode);
+ if (graphData == null) {
+ graphData = new HashMap<Integer, Double[]>();
+ indicatorGraphData.put(indicatorCode, speciesCode, graphData);
+ }
+ graphData.put(year, new Double[]{estimation, ecart});
+
+ // si les données sont énormes, on affiche les données
+ // / multiplicator et on le mentionne dans la légende
+ if (estimation > 1e9) {
+ multiplicator = 1000000;
+ }
+ if (estimation > 1e6 && multiplicator < 1000000) {
+ multiplicator = 1000;
+ }
+
+ // for data part
+ DataStorage subDataStorage = (DataStorage) indicatorStorages.get(indicatorCode, speciesCode);
+ if (subDataStorage == null) {
+ subDataStorage = new MemoryDataStorage();
+ if ("fr".equals(locale.getLanguage())) {
+ subDataStorage.add(new String[]{"Campagne", "Indice", "Liste", "Espèce", "Strate", "Annee", "Estimation", "EcartType", "CV"});
+ } else {
+ subDataStorage.add(new String[]{"Survey", "Index", "List", "Species", "Stratum", "Year", "Estimate", "StandardDeviation", "CV"});
+ }
+ indicatorStorages.put(indicatorCode, speciesCode, subDataStorage);
+ }
+ subDataStorage.add(tuple);
+ }
+ }
+
+ SpeciesMap speciesMap = repository.getSpeciesMap();
+
+ // avec l'extraction des données, on peut demander a générer un graphique
+ // sur un indicateur qui n'est pas présent dans le projet courant,
+ // dans ce cas, on retourne null
+ for (MultiKey indicatorSpecies : (Set<MultiKey>) indicatorGraphData.keySet()) {
+ String indicator = (String) indicatorSpecies.getKey(0);
+ String aSpecies = (String) indicatorSpecies.getKey(1);
+ // get graph title
+ String title = zoneDisplayName;
+ String indicatorName = indicatorMap.getIndicatorValue(indicator, locale);
+ String unit = indicatorMap.getIndicatorUnit(indicator);
+ title += " - " + indicatorName;
+ title += " - " + speciesMap.getReportDisplayName(aSpecies);
+
+ // generate dataset with sorted data
+ DefaultStatisticalCategoryDataset statisticalDataset = new DefaultStatisticalCategoryDataset();
+ Map<Integer, Double[]> graphData = (Map<Integer, Double[]>) indicatorGraphData.get(indicator, aSpecies);
+ for (int indexYear = minYear; indexYear <= maxYear; ++indexYear) {
+ Double[] entry = graphData.get(indexYear);
+ if (entry != null) {
+ Double estimation = entry[0] / multiplicator;
+ Double ecart = entry[1] / multiplicator;
+ statisticalDataset.add(estimation, ecart, "Serie1", (Comparable) indexYear);
+ } else {
+ statisticalDataset.add(null, null, "Serie1", indexYear);
+ }
+ }
+
+
+ // configure chart
+ //CategoryAxis categoryAxis = new CategoryAxis(t("coser.business.common.year"));
+ String yearAxis = reports.getYearChartTitle(locale);
+ CategoryAxis categoryAxis = new CategoryAxis(yearAxis);
+ categoryAxis.setCategoryMargin(0);
+ categoryAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
+ // label horizontaux
+ String legendY = indicatorName;
+ if (multiplicator != 1) {
+ // affiche par exemple : cm * 1000
+ legendY += " (" + unit + "*" + multiplicator + ")";
+ } else if (StringUtils.isNotEmpty(unit)) {
+ legendY += " (" + unit + ")";
+ }
+ ValueAxis valueAxis = new NumberAxis(legendY);
+ valueAxis.setUpperMargin(0.1);
+
+ CategoryItemRenderer renderer = new StatisticalLineAndShapeRenderer(false, true);
+
+ // n'affiche pas les nombre sur le graphique
+ //StandardCategoryItemLabelGenerator itemLabelGenerator = new StandardCategoryItemLabelGenerator();
+ //renderer.setBaseItemLabelGenerator(itemLabelGenerator);
+ //renderer.setBaseItemLabelsVisible(true);
+
+ CategoryPlot plot = new CategoryPlot(statisticalDataset, categoryAxis, valueAxis, renderer);
+ plot.setOrientation(PlotOrientation.VERTICAL);
+ JFreeChart chart = new JFreeChart(title,
+ JFreeChart.DEFAULT_TITLE_FONT, plot, true);
+
+ // remove series legend
+ chart.removeLegend();
+ // white background
+ chart.setBackgroundPaint(Color.WHITE);
+
+ try {
+ File chartFile = File.createTempFile("coser-population-chart-", ".png");
+ chartFile.deleteOnExit();
+ ChartUtilities.saveChartAsPNG(chartFile, chart, width, height);
+ //ByteArrayOutputStream out = new ByteArrayOutputStream();
+ //ChartUtilities.writeChartAsPNG(out, chart, width, height);
+
+ // data extraction
+ DataStorage subDataStorage = (DataStorage) indicatorStorages.get(indicator, aSpecies);
+ StringWriter writer = new StringWriter();
+ DataStorages.save(subDataStorage, writer);
+
+ // add chart file dans chart data in result
+ result.put(indicator + "-" + aSpecies, Pair.of(chartFile, writer.toString()));
+ writer.close();
+ } catch (IOException ex) {
+ throw new CoserTechnicalException("Can't save chart", ex);
+ }
+ }
+
+ return result;
+ }
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/ExtractResultProducer.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/LegacyResultRepository.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/LegacyResultRepository.java 2014-03-10 10:23:18 UTC (rev 1140)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/LegacyResultRepository.java 2014-03-11 09:28:43 UTC (rev 1141)
@@ -27,55 +27,36 @@
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import fr.ifremer.coser.CoserBusinessConfig;
-import fr.ifremer.coser.CoserBusinessException;
import fr.ifremer.coser.CoserConstants;
-import fr.ifremer.coser.CoserTechnicalException;
import fr.ifremer.coser.bean.EchoBaseProject;
import fr.ifremer.coser.bean.IndicatorMap;
-import fr.ifremer.coser.bean.Project;
-import fr.ifremer.coser.bean.RSufiResult;
import fr.ifremer.coser.bean.RSufiResultPath;
-import fr.ifremer.coser.bean.Selection;
+import fr.ifremer.coser.bean.SpeciesListMap;
+import fr.ifremer.coser.bean.SpeciesMap;
import fr.ifremer.coser.bean.ZoneMap;
import fr.ifremer.coser.result.CoserRequest;
import fr.ifremer.coser.result.CoserResult;
-import fr.ifremer.coser.result.FileResult;
import fr.ifremer.coser.result.Reports;
+import fr.ifremer.coser.result.repository.ResultProducer;
import fr.ifremer.coser.result.repository.ResultRepository;
import fr.ifremer.coser.result.request.CommunityIndicatorRequest;
-import fr.ifremer.coser.result.request.IndicatorRequest;
+import fr.ifremer.coser.result.request.CoserRequestFacadeAware;
+import fr.ifremer.coser.result.request.CoserRequestZoneAware;
+import fr.ifremer.coser.result.request.ExtractRequest;
import fr.ifremer.coser.result.request.MapRequest;
import fr.ifremer.coser.result.request.PopulationIndicatorRequest;
import fr.ifremer.coser.result.request.RawDataRequest;
import fr.ifremer.coser.services.ProjectService;
-import fr.ifremer.coser.services.WebService;
import fr.ifremer.coser.storage.DataStorage;
import fr.ifremer.coser.storage.DataStorages;
-import fr.ifremer.coser.storage.MemoryDataStorage;
+import fr.ifremer.coser.util.DataType;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jfree.chart.ChartUtilities;
-import org.jfree.chart.JFreeChart;
-import org.jfree.chart.axis.CategoryAxis;
-import org.jfree.chart.axis.CategoryLabelPositions;
-import org.jfree.chart.axis.NumberAxis;
-import org.jfree.chart.axis.ValueAxis;
-import org.jfree.chart.plot.CategoryPlot;
-import org.jfree.chart.plot.PlotOrientation;
-import org.jfree.chart.renderer.category.CategoryItemRenderer;
-import org.jfree.chart.renderer.category.StatisticalLineAndShapeRenderer;
-import org.jfree.data.statistics.DefaultStatisticalCategoryDataset;
-import org.nuiton.util.FileUtil;
-import org.nuiton.util.ZipUtil;
-import java.awt.Color;
import java.io.File;
import java.io.FilenameFilter;
-import java.io.IOException;
-import java.util.Collection;
-import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
@@ -148,9 +129,14 @@
/**
* Cache of species definition.
*/
- protected Map<String, String> speciesMap;
+ protected SpeciesMap speciesMap;
/**
+ * Cache of species list definition.
+ */
+ protected SpeciesListMap speciesListMap;
+
+ /**
* Cache of indicator definition.
*/
protected IndicatorMap indicatorsMap;
@@ -171,14 +157,19 @@
protected final boolean indicatorsResult;
/**
- * IS the results contains raw data ?
+ * Is the results contains raw data ?
*/
protected final boolean dataResult;
- protected final ProjectService projectService;
+ /**
+ * Report helper.
+ */
+ protected final Reports reports;
- protected final WebService webService;
+ protected final Map<Class<?>, ResultProducer<?>> resultProducers;
+ protected final ProjectService projectService;
+
public LegacyResultRepository(CoserBusinessConfig config,
File basedir,
RSufiResultPath path,
@@ -201,16 +192,22 @@
this.mapsResult = path.getRsufiResult().isMapsResult();
this.indicatorsResult = path.getRsufiResult().isIndicatorsResult();
this.dataResult = path.getRsufiResult().isDataAllowed();
+ this.reports = new Reports();
- if (log.isInfoEnabled()) {
- log.info("New result repository: " + getId());
- }
-
this.mapFileToSpeciesCode = EchoBaseProject.newMapFileToSpeciesCode(surveyName);
this.speciesCodeToMapFile = EchoBaseProject.newSpeciesCodeToMapFileName(surveyName);
this.mapSpeciesFilenameFilter = EchoBaseProject.newMapSpeciesFilenameFilter(surveyName);
this.projectService = new ProjectService(config);
- this.webService = new WebService(config);
+ this.resultProducers = Maps.newHashMap();
+ this.resultProducers.put(MapRequest.class, new MapResultProducer(this));
+ this.resultProducers.put(CommunityIndicatorRequest.class, new CommunityIndicatorResultProducer(this));
+ this.resultProducers.put(PopulationIndicatorRequest.class, new PopulationIndicatorResultProducer(this));
+ this.resultProducers.put(RawDataRequest.class, new RawDataResultProducer(this));
+ this.resultProducers.put(ExtractRequest.class, new ExtractResultProducer(this));
+
+ if (log.isInfoEnabled()) {
+ log.info("New result repository: " + getId());
+ }
}
// --------------------------------------------------------------------- //
@@ -229,130 +226,30 @@
@Override
public Map<String, String> getAvailableZones(CoserRequest request) {
- List<String> allowedZones = null;
+ ResultProducer resultProducer = getProducer(request.getClass());
+ Preconditions.checkNotNull(resultProducer);
- if (request instanceof MapRequest) {
- MapRequest r = (MapRequest) request;
-
- boolean match = mapsResult && matchFacade(r);
- if (match) {
- allowedZones = getZonesMap().getZonesForFacade(r.getFacade());
- }
- } else if (request instanceof RawDataRequest) {
- RawDataRequest r = (RawDataRequest) request;
-
- boolean match = dataResult && matchFacade(r);
- if (match) {
- allowedZones = getZonesMap().getZonesForFacade(r.getFacade());
- }
- } else if (request instanceof PopulationIndicatorRequest) {
- PopulationIndicatorRequest r = (PopulationIndicatorRequest) request;
-
- boolean match = indicatorsResult && matchFacade(r);
- if (match) {
- allowedZones = getZonesMap().getZonesForFacade(r.getFacade());
- }
- } else if (request instanceof CommunityIndicatorRequest) {
- CommunityIndicatorRequest r = (CommunityIndicatorRequest) request;
-
- boolean match = indicatorsResult && matchFacade(r);
- if (match) {
- allowedZones = getZonesMap().getZonesForFacade(r.getFacade());
- }
- }
-
- Map<String, String> result = Maps.newHashMap();
-
- if (allowedZones != null) {
-
- String zoneId = path.getRsufiResult().getZone();
- if (allowedZones.contains(zoneId)) {
- String zoneFullName = getZonesMap().getZoneFullNameWithNoFacade(zoneId);
- result.put(zoneId, zoneFullName);
- }
- }
-
+ Map result = resultProducer.getAvailableZones(request);
return result;
}
@Override
public Map<String, String> getAvailableSpecies(CoserRequest request) {
- Map<String, String> result = null;
+ ResultProducer resultProducer = getProducer(request.getClass());
+ Preconditions.checkNotNull(resultProducer);
- if (request instanceof MapRequest) {
- MapRequest r = (MapRequest) request;
-
- boolean match = mapsResult &&
- matchFacade(r) &&
- matchZone(r);
- if (match) {
- // get all map species for given facade + zone
- result = getPopulationIndicatorSpecies();
- }
- } else if (request instanceof PopulationIndicatorRequest) {
- PopulationIndicatorRequest r = (PopulationIndicatorRequest) request;
-
- boolean match = indicatorsResult &&
- matchFacade(r) &&
- matchZone(r);
-
- if (match) {
- // get all population indicator species for given facade + zone
- result = getPopulationIndicatorSpecies();
- }
- } else if (request instanceof CommunityIndicatorRequest) {
- CommunityIndicatorRequest r = (CommunityIndicatorRequest) request;
-
- Preconditions.checkNotNull(r.getIndicator());
-
- boolean match = indicatorsResult &&
- matchFacade(r) &&
- matchZone(r) &&
- matchIndicator(r);
-
- if (match) {
- // get all speciesList for given facade + zone + indicator
- result = getCommunityIndicatorSpecies(r.getLocale(), r.getIndicator());
- }
- }
-
+ Map<String, String> result = resultProducer.getAvailableSpecies(request);
return result;
}
@Override
- public Map<String, String> getAvailableIndicators(IndicatorRequest request) {
- Set<String> indicatorList = null;
+ public Map<String, String> getAvailableIndicators(CoserRequest request) {
- if (request instanceof PopulationIndicatorRequest) {
- PopulationIndicatorRequest r = (PopulationIndicatorRequest) request;
+ ResultProducer resultProducer = getProducer(request.getClass());
+ Preconditions.checkNotNull(resultProducer);
- Preconditions.checkNotNull(r.getSpecies());
-
- boolean match = indicatorsResult &&
- matchFacade(request) &&
- matchZone(request) &&
- matchSpecies(r);
-
- if (match) {
-
- // get all indicators for given facade + zone + species
- indicatorList = getPopulationIndicators(r.getSpecies());
- }
-
- } else if (request instanceof CommunityIndicatorRequest) {
-
- boolean match = indicatorsResult &&
- matchFacade(request) &&
- matchZone(request);
- if (match) {
-
- // get all indicators for given facade + zone
- indicatorList = getCommunityIndicators();
- }
- }
-
- Map<String, String> result = getIndicatorsMap().getIndicatorsValues(indicatorList, request.getLocale());
+ Map<String, String> result = resultProducer.getAvailableIndicators(request);
return result;
}
@@ -396,6 +293,15 @@
matchFacade(r) &&
matchZone(r) &&
matchSpeciesAndIndicator(r);
+ } else if (request instanceof ExtractRequest) {
+
+ // must match extract type + zone + (species + indicator)
+ ExtractRequest r = (ExtractRequest) request;
+
+ result = matchExtractTypeSet(r) &&
+ matchZoneList(r) &&
+ (matchPopulationIndicatorListAndSpeciesList(r) ||
+ matchCommunityIndicatorListAndSpeciesList(r));
}
return result;
}
@@ -405,84 +311,33 @@
Preconditions.checkArgument(request.isFilled());
Preconditions.checkArgument(acceptResult(request));
- CoserResult result = null;
+ ResultProducer resultProducer = getProducer(request.getClass());
+ Preconditions.checkNotNull(resultProducer);
- if (request instanceof MapRequest) {
- MapRequest r = (MapRequest) request;
-
- String species = r.getSpecies();
-
- File mapFile = getMapSpeciesFile(species);
- result = new FileResult(getId(), mapFile);
-
- } else if (request instanceof RawDataRequest) {
-
- // No such result for echobase at the moment
- RawDataRequest r = (RawDataRequest) request;
-
- File file = getRawDataFile(r.getLocale()
- );
- result = new FileResult(getId(), file);
-
- } else if (request instanceof CommunityIndicatorRequest) {
- CommunityIndicatorRequest r = (CommunityIndicatorRequest) request;
-
- File file = null;
- switch (r.getResultType()) {
- case DATA:
- file = getCommunityIndicatorDataFile(r.getLocale(),
- r.getZone(),
- r.getIndicator(),
- r.getSpecies());
- break;
-
- case GRAPH:
- file = getCommunityIndicatorGraphFile(r.getLocale(),
- r.getZone(),
- r.getIndicator(),
- r.getSpecies());
- break;
- }
- if (file != null) {
- result = new FileResult(getId(), file);
- }
-
- } else if (request instanceof PopulationIndicatorRequest) {
- PopulationIndicatorRequest r = (PopulationIndicatorRequest) request;
-
- File file = null;
- switch (r.getResultType()) {
- case DATA:
- file = getPopulationIndicatorDataFile(r.getSpecies(),
- r.getIndicator());
- break;
-
- case GRAPH:
- file = getPopulationIndicatorGraphFile(r.getLocale(),
- r.getZone(),
- r.getSpecies(),
- r.getIndicator());
- break;
- }
- if (file != null) {
- result = new FileResult(getId(), file);
- }
- }
+ CoserResult result = resultProducer.produceResult(request);
return result;
}
+ protected <R extends CoserRequest> ResultProducer<R> getProducer(Class<R> requestType) {
+ return (ResultProducer<R>) resultProducers.get(requestType);
+ }
+
// --------------------------------------------------------------------- //
- // --- MapRequest matchers --------------------------------------------- //
+ // --- Common matchers ------------------------------------------------- //
// --------------------------------------------------------------------- //
- protected boolean matchFacade(MapRequest request) {
+ protected boolean matchFacade(CoserRequestFacadeAware request) {
return true;
}
- protected boolean matchZone(MapRequest request) {
+ protected boolean matchZone(CoserRequestZoneAware request) {
return path.getRsufiResult().getZone().equals(request.getZone());
}
+ // --------------------------------------------------------------------- //
+ // --- MapRequest matchers --------------------------------------------- //
+ // --------------------------------------------------------------------- //
+
protected boolean matchSpecies(MapRequest request) {
String species = request.getSpecies();
File file = getMapSpeciesFile(species);
@@ -493,27 +348,11 @@
// --- RawDataRequest matchers ----------------------------------------- //
// --------------------------------------------------------------------- //
- protected boolean matchFacade(RawDataRequest request) {
- return true;
- }
-
protected boolean matchZone(RawDataRequest request) {
return path.getRsufiResult().getZone().equals(request.getZone());
}
// --------------------------------------------------------------------- //
- // --- IndicatorRequest matchers --------------------------------------- //
- // --------------------------------------------------------------------- //
-
- protected boolean matchFacade(IndicatorRequest request) {
- return true;
- }
-
- protected boolean matchZone(IndicatorRequest request) {
- return path.getRsufiResult().getZone().equals(request.getZone());
- }
-
- // --------------------------------------------------------------------- //
// --- PopulationIndicatorRequest matchers ----------------------------- //
// --------------------------------------------------------------------- //
@@ -623,455 +462,161 @@
}
// --------------------------------------------------------------------- //
- // --- Get Map result -------------------------------------------------- //
+ // --- ExtractRequest matchers ----------------------------------------- //
// --------------------------------------------------------------------- //
- protected File getMapSpeciesFile(String species) {
- String fileName = speciesCodeToMapFile.apply(species);
- File file = fileName == null ? null : new File(mapsDirectory, fileName);
- return file;
- }
-
- // --------------------------------------------------------------------- //
- // --- Get Raw Data result --------------------------------------------- //
- // --------------------------------------------------------------------- //
-
- protected File getRawDataFile(Locale locale) {
-
- try {
- // be sure that data are available for this project
- // or it will fail
- projectService.loadSelectionData(basedir.getParentFile(), path.getProject(), path.getSelection());
- } catch (CoserBusinessException e) {
- throw new CoserTechnicalException("Could not load project selection", e);
+ protected boolean matchExtractTypeSet(ExtractRequest request) {
+ boolean result = false;
+ if (mapsResult) {
+ result = request.getExtractTypeList().contains(DataType.SOURCE);
}
-
- File result;
-
- try {
- File tempDir = FileUtil.createTempDirectory("coser-source-", "-tmp");
-
- // il ne faut pas les fichiers de selection, mais leurs
- // export rsufi (sans les lignes, et les quotes)
- File archiveDir = projectService.extractRSUfiData(path.getProject(), path.getSelection(), tempDir, true);
-
- // add decharge file
- String filename;
- if (locale != null && "fr".equals(locale.getLanguage())) {
- filename = "DechargeDonnees.pdf";
- } else if (locale != null && "es".equals(locale.getLanguage())) {
- filename = "DatosDeExencionDeResponsabilidad.pdf";
- } else {
- filename = "DataDisclaimer.pdf";
- }
- File dechargePDF = new File(archiveDir, filename);
- webService.generateDechargePDF(dechargePDF, resultDirectory, path.getRsufiResult(), locale);
-
- // ajout du reftax dans le zip
- File reftaxFile = new File(basedir, CoserConstants.Category.REFTAX_SPECIES.getStorageFileName());
- FileUtils.copyFileToDirectory(reftaxFile, archiveDir);
-
- // make zip
- result = File.createTempFile("coser-source-", ".zip");
- result.deleteOnExit();
- ZipUtil.compress(result, archiveDir);
-
- // clean directory
- FileUtils.deleteDirectory(tempDir);
- } catch (Exception ex) {
- throw new CoserTechnicalException("Can't create zip file", ex);
+ if (indicatorsResult) {
+ result = request.getExtractTypeList().contains(DataType.POPULATION) ||
+ request.getExtractTypeList().contains(DataType.COMMUNITY);
}
-
+ if (dataResult) {
+ result = request.getExtractTypeList().contains(DataType.SOURCE);
+ }
return result;
}
- // --------------------------------------------------------------------- //
- // --- Get Community indicator result ---------------------------------- //
- // --------------------------------------------------------------------- //
-
- protected File getCommunityIndicatorDataFile(Locale locale,
- String zone,
- String indicator,
- String speciesList) {
-
- try {
-
- File tempDir = FileUtil.createTempDirectory("coser-chart-population-indicator", "-tmp");
-
- File baseDir = new File(tempDir, surveyName);
- FileUtils.forceMkdir(baseDir);
-
- RSufiResult rSufiResult = path.getRsufiResult();
-
- // ajout du fichier csv avec les indicateurs
- DataStorage dataStorage = new MemoryDataStorage();
-
- Iterator<String[]> iterator = loadCommunityIndicatorStorage(false);
-
- // add header
- dataStorage.add(iterator.next());
-
- while (iterator.hasNext()) {
- String[] tuple = iterator.next();
- if (matchCommunityIndicatorAndSpeciesList(tuple, indicator, speciesList)) {
- dataStorage.add(tuple);
- }
- }
- File csvFile = DataStorages.save("coser-chart-community-indicator",
- ".csv",
- dataStorage);
-
- File csvFileCopied = new File(baseDir, indicator + ".csv");
- FileUtils.copyFile(csvFile, csvFileCopied);
- FileUtils.forceDelete(csvFile);
-
- // ajout du fichier d'information sur les espèces incluses dans
- // les calculs des indicateurs de communautés
- // load project (without data to get reftax data)
- Project project = path.getProject();
- Selection selection = path.getSelection();
- File metaFile = webService.generateMetaFilePDF(project,
- selection,
- resultDirectory,
- rSufiResult,
- indicator,
- locale);
- File metaFileCopied = new File(baseDir, "Information.pdf");
- FileUtils.copyFile(metaFile, metaFileCopied);
-
- // make zip
- File result = File.createTempFile("coser-chart-community-indicator", ".zip");
- result.deleteOnExit();
- ZipUtil.compress(result, baseDir);
-
- // clean directory
- FileUtils.deleteDirectory(tempDir);
- return result;
- } catch (Exception e) {
- throw new CoserTechnicalException("Can't create zip file", e);
- }
+ protected boolean matchZoneList(ExtractRequest request) {
+ return request.getZoneList().contains(path.getRsufiResult().getZone());
}
- protected File getCommunityIndicatorGraphFile(Locale locale,
- String zone,
- String indicator,
- String speciesList) {
+ protected boolean matchCommunityIndicatorList(ExtractRequest request) {
+ Preconditions.checkNotNull(request.getCommunityIndicatorList());
- // indicator list to take care
- // pour avoir une valeur non nulle si list est null
- // on prend dans ce cas la premiere valeur trouvée
- String localList = speciesList;
+ List<String> indicatorList = request.getCommunityIndicatorList();
- if (log.isDebugEnabled()) {
- log.debug("Searching list for indicator : " + indicator);
- }
+ boolean result = false;
- int multiplicator = 1;
- int minYear = Integer.MAX_VALUE;
- int maxYear = Integer.MIN_VALUE;
- boolean indicatorFound = false;
- Map<Integer, Double[]> graphData = new HashMap<Integer, Double[]>();
Iterator<String[]> iterator = loadCommunityIndicatorStorage(true);
while (iterator.hasNext()) {
- // Campagne Indicateur Liste Strate Annee Estimation EcartType CV
String[] tuple = iterator.next();
- String indicatorList = tuple[2];
-
- if (matchCommunityIndicator(tuple, indicator)) {
- indicatorFound = true;
-
- // si pas de list selectionnée, on prend la premiere
- if (StringUtils.isBlank(localList)) {
- localList = indicatorList;
- }
-
- if (indicatorList.equals(localList)) {
- Double estimation = Double.parseDouble(tuple[5]);
- Double ecart = Double.parseDouble(tuple[6]);
- int year = Integer.parseInt(tuple[4]);
-
- if (year < minYear) {
- minYear = year;
- }
- if (year > maxYear) {
- maxYear = year;
- }
- graphData.put(year, new Double[]{estimation, ecart});
-
- // si les données sont énormes, on affiche les données
- // / multiplicator et on le mentionne dans la légende
- if (estimation > 1e9) {
- multiplicator = 1000000;
- }
- if (estimation > 1e6 && multiplicator < 1000000) {
- multiplicator = 1000;
- }
- }
+ if (matchIndicatorList(tuple, indicatorList)) {
+ result = true;
+ break;
}
}
+ return result;
+ }
- File result = null;
+ protected boolean matchPopulationIndicatorList(ExtractRequest request) {
+ Preconditions.checkNotNull(request.getPopulationIndicatorList());
- // avec l'extraction des données, on peut demander a générer un graphique
- // sur un indicateur qui n'est pas présent dans le projet courant,
- // dans ce cas, on retourne null
- if (indicatorFound) {
+ List<String> indicatorList = request.getPopulationIndicatorList();
- String zoneDisplayName = getZonesMap().getZoneFullName(zone);
- String indicatorName = getIndicatorsMap().getIndicatorValue(indicator, locale);
- String unit = getIndicatorsMap().getIndicatorUnit(indicator);
+ boolean result = false;
- // get graph title
- String chartTitle = zoneDisplayName;
- chartTitle += " - " + indicatorName;
-
- // ajout de la traduction de la liste d'indicateur
- // les liste sont a1, T1, T2 ...
- String listLetter = String.valueOf(localList.charAt(0));
- Iterator<String[]> typeIterator = loadSpeciesFileStorage(true);
- while (typeIterator.hasNext()) {
- // "Types";"Commentaire";"NumSys min";"NumSys max";"Code"
- String[] tuple = typeIterator.next();
- if (tuple[4].equals(listLetter)) {
- /// gestion du groupe "Tous"
- // cas special, c'est la seule valeur du fichier
- // code type espece qui a besoin d'une traduction
- if (tuple[4].equalsIgnoreCase("T")) {
- if ("fr".equals(locale.getLanguage())) {
- chartTitle += " - " + "Tous Liste " + localList.charAt(1);
- } else if ("es".equals(locale.getLanguage())) {
- chartTitle += " - " + "Todo Lista " + localList.charAt(1);
- } else {
- chartTitle += " - " + "All List " + localList.charAt(1);
- }
- } else {
- // ajout de la traduction du nom de liste plus le numéro
- if ("fr".equals(locale.getLanguage())) {
- chartTitle += " - " + tuple[0] + " Liste " + localList.charAt(1);
- } else if ("es".equals(locale.getLanguage())) {
- chartTitle += " - " + tuple[0] + " Lista " + localList.charAt(1);
- } else {
- chartTitle += " - " + tuple[0] + " List " + localList.charAt(1);
- }
- }
- break;
- }
+ Iterator<String[]> iterator = loadPopulationIndicatorStorage(true);
+ while (iterator.hasNext()) {
+ String[] tuple = iterator.next();
+ if (matchIndicatorList(tuple, indicatorList)) {
+ result = true;
+ break;
}
-
- // generate dataset with sorted data
- DefaultStatisticalCategoryDataset statisticalDataset = new DefaultStatisticalCategoryDataset();
- for (int indexYear = minYear; indexYear <= maxYear; ++indexYear) {
- Double[] entry = graphData.get(indexYear);
- if (entry != null) {
- Double estimation = entry[0] / multiplicator;
- Double ecart = entry[1] / multiplicator;
- statisticalDataset.add(estimation, ecart, "Serie1", (Comparable) indexYear);
- } else {
- statisticalDataset.add(null, null, "Serie1", indexYear);
- }
- }
-
- // configure chart
- //CategoryAxis categoryAxis = new CategoryAxis(t("coser.business.common.year"));
- String yearAxis = Reports.getYearChartTitle(locale);
-
- CategoryAxis categoryAxis = new CategoryAxis(yearAxis);
- categoryAxis.setCategoryMargin(0);
- categoryAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
- // label horizontaux
- String legendY = indicatorName;
- if (multiplicator != 1) {
- // affiche par exemple : cm * 1000
- legendY += " (" + unit + "*" + multiplicator + ")";
- } else if (StringUtils.isNotEmpty(unit)) {
- legendY += " (" + unit + ")";
- }
- ValueAxis valueAxis = new NumberAxis(legendY);
- valueAxis.setUpperMargin(0.1);
-
- CategoryItemRenderer renderer = new StatisticalLineAndShapeRenderer(false, true);
-
- // n'affiche pas les nombre sur le graphique
- //StandardCategoryItemLabelGenerator itemLabelGenerator = new StandardCategoryItemLabelGenerator();
- //renderer.setBaseItemLabelGenerator(itemLabelGenerator);
- //renderer.setBaseItemLabelsVisible(true);
-
- CategoryPlot plot = new CategoryPlot(statisticalDataset, categoryAxis, valueAxis, renderer);
- plot.setOrientation(PlotOrientation.VERTICAL);
- JFreeChart chart = new JFreeChart(chartTitle,
- JFreeChart.DEFAULT_TITLE_FONT, plot, true);
-
- // remove series legend
- chart.removeLegend();
- // white background
- chart.setBackgroundPaint(Color.WHITE);
-
- try {
- result = File.createTempFile("coser-chart-community-indicator-", ".png");
- result.deleteOnExit();
- ChartUtilities.saveChartAsPNG(result, chart, 800, 400);
- } catch (IOException ex) {
- throw new CoserTechnicalException("Can't save chart", ex);
- }
}
-
return result;
}
- // --------------------------------------------------------------------- //
- // --- Get Population indicator result --------------------------------- //
- // --------------------------------------------------------------------- //
+ protected boolean matchPopulationIndicatorListAndSpeciesList(ExtractRequest request) {
+ Preconditions.checkNotNull(request.getPopulationIndicatorList());
- protected File getPopulationIndicatorDataFile(String species, String indicator) {
+ List<String> indicatorList = request.getPopulationIndicatorList();
+ List<String> speciesList = request.getSpeciesList();
- DataStorage dataStorage = new MemoryDataStorage();
+ boolean result = false;
- Iterator<String[]> iterator = loadPopulationIndicatorStorage(false);
-
- // add header
- dataStorage.add(iterator.next());
-
+ Iterator<String[]> iterator = loadPopulationIndicatorStorage(true);
while (iterator.hasNext()) {
String[] tuple = iterator.next();
- if (matchPopulationSpeciesAndIndicator(tuple, species, indicator)) {
- dataStorage.add(tuple);
+ if (matchIndicatorListAndSpeciesList(tuple, indicatorList, speciesList)) {
+ result = true;
+ break;
}
}
- File result = DataStorages.save("coser-chart-population-indicator",
- ".csv",
- dataStorage);
return result;
}
- protected File getPopulationIndicatorGraphFile(Locale locale, String zone, String species, String indicator) {
+ protected boolean matchCommunityIndicatorListAndSpeciesList(ExtractRequest request) {
+ Preconditions.checkNotNull(request.getCommunityIndicatorList());
+ List<String> indicatorList = request.getCommunityIndicatorList();
+ List<String> speciesList = request.getSpeciesList();
- int multiplicator = 1;
- int minYear = Integer.MAX_VALUE;
- int maxYear = Integer.MIN_VALUE;
- boolean indicatorFound = false;
- Map<Integer, Double[]> graphData = new HashMap<Integer, Double[]>();
- Iterator<String[]> iterator = loadPopulationIndicatorStorage(true);
+ boolean result = false;
+
+ Iterator<String[]> iterator = loadCommunityIndicatorStorage(true);
while (iterator.hasNext()) {
String[] tuple = iterator.next();
-
- if (matchPopulationSpeciesAndIndicator(tuple, species, indicator)) {
- indicatorFound = true;
-
- // XXX echatellier, maybe take care of list here ?
-
- Double estimation = Double.parseDouble(tuple[6]);
- Double ecart = Double.parseDouble(tuple[7]);
- int year = Integer.parseInt(tuple[5]);
-
- if (year < minYear) {
- minYear = year;
- }
- if (year > maxYear) {
- maxYear = year;
- }
- graphData.put(year, new Double[]{estimation, ecart});
-
- // si les données sont énormes, on affiche les données
- // / multiplicator et on le mentionne dans la légende
- if (estimation > 1e9) {
- multiplicator = 1000000;
- }
- if (estimation > 1e6 && multiplicator < 1000000) {
- multiplicator = 1000;
- }
+ if (matchIndicatorListAndSpeciesList(tuple, indicatorList, speciesList)) {
+ result = true;
+ break;
}
}
+ return result;
+ }
- File result = null;
+ protected boolean matchIndicatorList(String[] tuple, List<String> indicatorList) {
+ String indicatorCode = tuple[1];
+ boolean result = indicatorList.contains(indicatorCode);
+ return result;
+ }
- // avec l'extraction des données, on peut demander a générer un graphique
- // sur un indicateur qui n'est pas présent dans le projet courant,
- // dans ce cas, on retourne null
- if (indicatorFound) {
+ protected boolean matchIndicatorListAndSpeciesList(String[] tuple,
+ List<String> indicatorList,
+ List<String> speciesList) {
+ String indicatorCode = tuple[1];
+ String speciesCode = tuple[3];
+ boolean result = indicatorList.contains(indicatorCode) &&
+ speciesList.contains(speciesCode);
+ return result;
+ }
- String zoneDisplayName = getZonesMap().getZoneFullName(zone);
- String indicatorName = getIndicatorsMap().getIndicatorValue(indicator, locale);
- String unit = getIndicatorsMap().getIndicatorUnit(indicator);
+ // --------------------------------------------------------------------- //
+ // --- Get Map result -------------------------------------------------- //
+ // --------------------------------------------------------------------- //
- // get graph title
- String title = zoneDisplayName;
- title += " - " + indicatorName;
- title += " - " + Reports.getReportDisplayName(loadSpeciesFileStorage(true), species);
+ protected File getMapSpeciesFile(String species) {
+ String fileName = speciesCodeToMapFile.apply(species);
+ File file = fileName == null ? null : new File(mapsDirectory, fileName);
+ return file;
+ }
- // generate dataset with sorted data
- DefaultStatisticalCategoryDataset statisticalDataset = new DefaultStatisticalCategoryDataset();
- for (int indexYear = minYear; indexYear <= maxYear; ++indexYear) {
- Double[] entry = graphData.get(indexYear);
- if (entry != null) {
- Double estimation = entry[0] / multiplicator;
- Double ecart = entry[1] / multiplicator;
- statisticalDataset.add(estimation, ecart, "Serie1", (Comparable) indexYear);
- } else {
- statisticalDataset.add(null, null, "Serie1", indexYear);
- }
- }
+ // --------------------------------------------------------------------- //
+ // --- Get species lists ----------------------------------------------- //
+ // --------------------------------------------------------------------- //
- // configure chart
- //CategoryAxis categoryAxis = new CategoryAxis(t("coser.business.common.year"));
- String yearAxis = Reports.getYearChartTitle(locale);
- CategoryAxis categoryAxis = new CategoryAxis(yearAxis);
- categoryAxis.setCategoryMargin(0);
- categoryAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
- // label horizontaux
- String legendY = indicatorName;
- if (multiplicator != 1) {
- // affiche par exemple : cm * 1000
- legendY += " (" + unit + "*" + multiplicator + ")";
- } else if (StringUtils.isNotEmpty(unit)) {
- legendY += " (" + unit + ")";
- }
- ValueAxis valueAxis = new NumberAxis(legendY);
- valueAxis.setUpperMargin(0.1);
+ protected Map<String, String> getPopulationIndicatorSpecies() {
+ Map<String, String> result = Maps.newHashMap();
- CategoryItemRenderer renderer = new StatisticalLineAndShapeRenderer(false, true);
+ SpeciesMap speciesNames = getSpeciesMap();
+ Iterator<String[]> iterator = loadPopulationIndicatorStorage(true);
+ while (iterator.hasNext()) {
+ String[] tuple = iterator.next();
+ String speciesCode = tuple[3];
- // n'affiche pas les nombre sur le graphique
- //StandardCategoryItemLabelGenerator itemLabelGenerator = new StandardCategoryItemLabelGenerator();
- //renderer.setBaseItemLabelGenerator(itemLabelGenerator);
- //renderer.setBaseItemLabelsVisible(true);
+ String speciesName = speciesNames.getSpeciesName(speciesCode);
- CategoryPlot plot = new CategoryPlot(statisticalDataset, categoryAxis, valueAxis, renderer);
- plot.setOrientation(PlotOrientation.VERTICAL);
- JFreeChart chart = new JFreeChart(title,
- JFreeChart.DEFAULT_TITLE_FONT, plot, true);
-
- // remove series legend
- chart.removeLegend();
- // white background
- chart.setBackgroundPaint(Color.WHITE);
-
- try {
- result = File.createTempFile("coser-chart-population-indicator-", ".png");
- result.deleteOnExit();
- ChartUtilities.saveChartAsPNG(result, chart, 800, 400);
- } catch (IOException ex) {
- throw new CoserTechnicalException("Can't save chart", ex);
+ if (StringUtils.isNotEmpty(speciesName)) {
+ result.put(speciesCode, speciesName);
}
+ result.put(speciesCode, speciesName);
}
-
return result;
}
- // --------------------------------------------------------------------- //
- // --- Get species lists ----------------------------------------------- //
- // --------------------------------------------------------------------- //
-
- protected Map<String, String> getPopulationIndicatorSpecies() {
+ protected Map<String, String> getCommunityIndicatorSpecies() {
Map<String, String> result = Maps.newHashMap();
- Map<String, String> speciesNames = getSpeciesMap();
- Iterator<String[]> iterator = loadPopulationIndicatorStorage(true);
+ SpeciesMap speciesNames = getSpeciesMap();
+ Iterator<String[]> iterator = loadCommunityIndicatorStorage(true);
while (iterator.hasNext()) {
String[] tuple = iterator.next();
String speciesCode = tuple[3];
- String speciesName = speciesNames.get(speciesCode);
+ String speciesName = speciesNames.getSpeciesName(speciesCode);
if (StringUtils.isNotEmpty(speciesName)) {
result.put(speciesCode, speciesName);
@@ -1093,40 +638,7 @@
if (matchCommunityIndicator(tuple, indicator)) {
String list = tuple[2];
- // recherche de la traduction de l'id de liste
- // les liste sont a1, T1, T2 ...
- String listLetter = String.valueOf(list.charAt(0));
- String translation = "## " + list + " not found ##";
- Iterator<String[]> typeIterator = loadSpeciesListFileStorage(true);
- while (typeIterator.hasNext()) {
- // "Types";"Commentaire";"NumSys min";"NumSys max";"Code"
- String[] tupleType = typeIterator.next();
- if (tupleType[4].equals(listLetter)) {
-
- // gestion du groupe "Tous"
- // cas special, c'est la seule valeur du fichier
- // code type espece qui a besoin d'une traduction
- if (tupleType[4].equalsIgnoreCase("T")) {
- if (locale != null && "fr".equals(locale.getLanguage())) {
- translation = "Tous Liste " + list.charAt(1);
- } else if (locale != null && "en".equals(locale.getLanguage())) {
- translation = "Todo Lista " + list.charAt(1);
- } else {
- translation = "All List " + list.charAt(1);
- }
- } else {
- // ajout de la traduction du nom de liste plus le numéro
- if (locale != null && "fr".equals(locale.getLanguage())) {
- translation = tupleType[0] + " Liste " + list.charAt(1);
- } else if (locale != null && "en".equals(locale.getLanguage())) {
- translation = tupleType[0] + " Lista " + list.charAt(1);
- } else {
- translation = tupleType[0] + " List " + list.charAt(1);
- }
- }
- break;
- }
- }
+ String translation = getSpeciesListMap().getSpeciesListName(locale, list);
result.put(list, translation);
}
}
@@ -1148,12 +660,23 @@
return result;
}
+ protected Set<String> getPopulationIndicators() {
+ Iterator<String[]> iterator = loadPopulationIndicatorStorage(true);
+ Set<String> result = Sets.newHashSet();
+ while (iterator.hasNext()) {
+ String[] tuple = iterator.next();
+ String indicatorCode = tuple[1];
+ result.add(indicatorCode);
+ }
+ return result;
+ }
+
protected Set<String> getPopulationIndicators(String species) {
Iterator<String[]> iterator = loadPopulationIndicatorStorage(true);
Set<String> result = Sets.newHashSet();
while (iterator.hasNext()) {
String[] tuple = iterator.next();
- if (species == null || matchPopulationSpecies(tuple, species)) {
+ if (matchPopulationSpecies(tuple, species)) {
String indicatorCode = tuple[1];
result.add(indicatorCode);
}
@@ -1162,45 +685,26 @@
}
// --------------------------------------------------------------------- //
- // --- Get species definition maps ------------------------------------- //
+ // --- Get definition maps --------------------------------------------- //
// --------------------------------------------------------------------- //
- protected Map<String, String> getSpeciesMap() {
- if (speciesMap == null) {
- speciesMap = Maps.newTreeMap();
-
- // load species file
- Iterator<String[]> iterator = loadSpeciesFileStorage(true);
- while (iterator.hasNext()) {
- String[] tuple = iterator.next();
- String speciesCode = tuple[3];
- String speciesLabel = tuple[4] + " " + tuple[5];
- speciesMap.put(speciesCode, speciesLabel);
- }
+ public SpeciesListMap getSpeciesListMap() {
+ if (speciesListMap == null) {
+ File file = new File(basedir, CoserConstants.Category.TYPE_ESPECES.getStorageFileName());
+ speciesListMap = new SpeciesListMap(file);
}
- return speciesMap;
+ return speciesListMap;
}
- protected Map<String, String> getSpeciesSubMap(Collection<String> speciesList) {
+ protected SpeciesMap getSpeciesMap() {
+ if (speciesMap == null) {
- Map<String, String> result = Maps.newTreeMap();
-
- if (speciesList != null) {
-
- Map<String, String> map = getSpeciesMap();
- for (String species : speciesList) {
- String speciesLabel = map.get(species);
- result.put(species, speciesLabel);
- }
+ File file = new File(basedir, CoserConstants.Category.REFTAX_SPECIES.getStorageFileName());
+ speciesMap = new SpeciesMap(file);
}
-
- return result;
+ return speciesMap;
}
- // --------------------------------------------------------------------- //
- // --- Get indicator definition maps ----------------------------------- //
- // --------------------------------------------------------------------- //
-
protected IndicatorMap getIndicatorsMap() {
if (indicatorsMap == null) {
indicatorsMap = new IndicatorMap(config.getWebIndicatorsFile());
@@ -1208,10 +712,6 @@
return indicatorsMap;
}
- // --------------------------------------------------------------------- //
- // --- Get zone definition maps ---------------------------------------- //
- // --------------------------------------------------------------------- //
-
public ZoneMap getZonesMap() {
if (zonesMap == null) {
zonesMap = new ZoneMap(config.getWebZonesFile());
@@ -1239,16 +739,4 @@
return iterator;
}
- protected Iterator<String[]> loadSpeciesFileStorage(boolean skipFirstLine) {
- // "C_Perm","NumSys","NivSys","C_VALIDE","L_VALIDE","AA_VALIDE","C_TxP\u00E8re","Taxa"
- Iterator<String[]> iterator = path.getProject().getRefTaxSpecies().iterator(skipFirstLine);
- return iterator;
- }
-
- protected Iterator<String[]> loadSpeciesListFileStorage(boolean skipFirstLine) {
- // "Types";"Commentaire";"NumSys min";"NumSys max";"Code"
- Iterator<String[]> iterator = path.getProject().getTypeEspeces().iterator(skipFirstLine);
- return iterator;
- }
-
}
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/MapResultProducer.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/MapResultProducer.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/MapResultProducer.java 2014-03-11 09:28:43 UTC (rev 1141)
@@ -0,0 +1,106 @@
+package fr.ifremer.coser.result.repository.legacy;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import fr.ifremer.coser.bean.RSufiResultPath;
+import fr.ifremer.coser.bean.ZoneMap;
+import fr.ifremer.coser.result.FileResult;
+import fr.ifremer.coser.result.repository.RequestUnavailableForProducerException;
+import fr.ifremer.coser.result.repository.ResultProducer;
+import fr.ifremer.coser.result.request.MapRequest;
+
+import java.io.File;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class MapResultProducer implements ResultProducer<MapRequest> {
+
+ protected final LegacyResultRepository repository;
+
+ protected final RSufiResultPath path;
+
+ public MapResultProducer(LegacyResultRepository repository) {
+ this.repository = repository;
+ this.path = repository.path;
+ }
+
+ @Override
+ public LegacyResultRepository getRepository() {
+ return repository;
+ }
+
+ @Override
+ public Map<String, String> getAvailableZones(MapRequest request) {
+ Preconditions.checkNotNull(request.getFacade());
+
+ boolean match = repository.matchFacade(request);
+
+ Map<String, String> result = null;
+ if (match) {
+ ZoneMap zonesMap = repository.getZonesMap();
+ List<String> allowedZones = zonesMap.getZonesForFacade(request.getFacade());
+ result = zonesMap.getSubZonesMap(path.getRsufiResult().getZone(), allowedZones);
+ }
+ return result;
+ }
+
+ @Override
+ public Map<String, String> getAvailableSpecies(MapRequest request) {
+ Preconditions.checkNotNull(request.getFacade());
+ Preconditions.checkNotNull(request.getZone());
+
+ Map<String, String> result = null;
+
+ boolean match = repository.mapsResult &&
+ repository.matchFacade(request) &&
+ repository.matchZone(request);
+ if (match) {
+
+ // get all map species for given facade + zone
+ result = repository.getPopulationIndicatorSpecies();
+ }
+ return result;
+ }
+
+ @Override
+ public Map<String, String> getAvailableIndicators(MapRequest request) {
+ throw RequestUnavailableForProducerException.newException("getAvailableIndicators", this);
+ }
+
+ @Override
+ public FileResult produceResult(MapRequest r) {
+
+ File resultZip = repository.getMapSpeciesFile(r.getSpecies());
+
+ FileResult result = new FileResult(repository.getId(), resultZip);
+ return result;
+ }
+
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/MapResultProducer.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/PopulationIndicatorResultProducer.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/PopulationIndicatorResultProducer.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/PopulationIndicatorResultProducer.java 2014-03-11 09:28:43 UTC (rev 1141)
@@ -0,0 +1,308 @@
+package fr.ifremer.coser.result.repository.legacy;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import fr.ifremer.coser.CoserTechnicalException;
+import fr.ifremer.coser.bean.RSufiResultPath;
+import fr.ifremer.coser.bean.ZoneMap;
+import fr.ifremer.coser.result.FileResult;
+import fr.ifremer.coser.result.Reports;
+import fr.ifremer.coser.result.repository.ResultProducer;
+import fr.ifremer.coser.result.request.PopulationIndicatorRequest;
+import fr.ifremer.coser.storage.DataStorage;
+import fr.ifremer.coser.storage.DataStorages;
+import fr.ifremer.coser.storage.MemoryDataStorage;
+import org.apache.commons.lang3.StringUtils;
+import org.jfree.chart.ChartUtilities;
+import org.jfree.chart.JFreeChart;
+import org.jfree.chart.axis.CategoryAxis;
+import org.jfree.chart.axis.CategoryLabelPositions;
+import org.jfree.chart.axis.NumberAxis;
+import org.jfree.chart.axis.ValueAxis;
+import org.jfree.chart.plot.CategoryPlot;
+import org.jfree.chart.plot.PlotOrientation;
+import org.jfree.chart.renderer.category.CategoryItemRenderer;
+import org.jfree.chart.renderer.category.StatisticalLineAndShapeRenderer;
+import org.jfree.data.statistics.DefaultStatisticalCategoryDataset;
+
+import java.awt.Color;
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class PopulationIndicatorResultProducer implements ResultProducer<PopulationIndicatorRequest> {
+
+ protected final LegacyResultRepository repository;
+
+ protected final Reports reports;
+
+ protected final RSufiResultPath path;
+
+ protected final File basedir;
+
+ protected final String surveyName;
+
+ public PopulationIndicatorResultProducer(LegacyResultRepository repository) {
+ this.repository = repository;
+ this.path = repository.path;
+ this.reports = repository.reports;
+ this.basedir = repository.basedir;
+ this.surveyName = repository.surveyName;
+ }
+
+ @Override
+ public LegacyResultRepository getRepository() {
+ return repository;
+ }
+
+ @Override
+ public Map<String, String> getAvailableZones(PopulationIndicatorRequest request) {
+ Preconditions.checkNotNull(request.getFacade());
+
+ boolean match = repository.matchFacade(request);
+
+ Map<String, String> result = null;
+ if (match) {
+ ZoneMap zonesMap = repository.getZonesMap();
+ List<String> allowedZones = zonesMap.getZonesForFacade(request.getFacade());
+ result = zonesMap.getSubZonesMap(path.getRsufiResult().getZone(), allowedZones);
+ }
+ return result;
+ }
+
+ @Override
+ public Map<String, String> getAvailableSpecies(PopulationIndicatorRequest request) {
+ Preconditions.checkNotNull(request.getFacade());
+ Preconditions.checkNotNull(request.getZone());
+
+ Map<String, String> result = null;
+
+ boolean match = repository.indicatorsResult &&
+ repository.matchFacade(request) &&
+ repository.matchZone(request);
+
+ if (match) {
+ // get all population indicator species for given facade + zone
+ result = repository.getPopulationIndicatorSpecies();
+ }
+ return result;
+ }
+
+ @Override
+ public Map<String, String> getAvailableIndicators(PopulationIndicatorRequest request) {
+ Preconditions.checkNotNull(request.getFacade());
+ Preconditions.checkNotNull(request.getZone());
+ Preconditions.checkNotNull(request.getSpecies());
+
+ Map<String, String> result = null;
+
+ boolean match = repository.indicatorsResult &&
+ repository.matchFacade(request) &&
+ repository.matchZone(request) &&
+ repository.matchSpecies(request);
+
+ if (match) {
+
+ // get all indicators for given facade + zone + species
+ Set<String> indicatorList = repository.getPopulationIndicators(request.getSpecies());
+ result = repository.getIndicatorsMap().getIndicatorsValues(indicatorList, request.getLocale());
+ }
+
+ return result;
+ }
+
+ @Override
+ public FileResult produceResult(PopulationIndicatorRequest request) {
+
+ File file = null;
+ switch (request.getResultType()) {
+ case DATA:
+ file = getPopulationIndicatorDataFile(request.getIndicator(),
+ request.getSpecies());
+ break;
+
+ case GRAPH:
+ file = getPopulationIndicatorGraphFile(request.getLocale(),
+ request.getZone(),
+ request.getIndicator(),
+ request.getSpecies());
+ break;
+ }
+
+
+ FileResult result = new FileResult(repository.getId(), file);
+ return result;
+ }
+
+ protected File getPopulationIndicatorDataFile(String species, String indicator) {
+
+ DataStorage dataStorage = new MemoryDataStorage();
+
+ Iterator<String[]> iterator = repository.loadPopulationIndicatorStorage(false);
+
+ // add header
+ dataStorage.add(iterator.next());
+
+ while (iterator.hasNext()) {
+ String[] tuple = iterator.next();
+ if (repository.matchPopulationSpeciesAndIndicator(tuple, species, indicator)) {
+ dataStorage.add(tuple);
+ }
+ }
+ File result = DataStorages.save(dataStorage, "coser-chart-population-indicator",
+ ".csv"
+ );
+ return result;
+ }
+
+ protected File getPopulationIndicatorGraphFile(Locale locale,
+ String zone,
+ String species,
+ String indicator) {
+
+
+ int multiplicator = 1;
+ int minYear = Integer.MAX_VALUE;
+ int maxYear = Integer.MIN_VALUE;
+ boolean indicatorFound = false;
+ Map<Integer, Double[]> graphData = new HashMap<Integer, Double[]>();
+ Iterator<String[]> iterator = repository.loadPopulationIndicatorStorage(true);
+ while (iterator.hasNext()) {
+ String[] tuple = iterator.next();
+
+ if (repository.matchPopulationSpeciesAndIndicator(tuple, species, indicator)) {
+ indicatorFound = true;
+
+ // XXX echatellier, maybe take care of list here ?
+
+ Double estimation = Double.parseDouble(tuple[6]);
+ Double ecart = Double.parseDouble(tuple[7]);
+ int year = Integer.parseInt(tuple[5]);
+
+ if (year < minYear) {
+ minYear = year;
+ }
+ if (year > maxYear) {
+ maxYear = year;
+ }
+ graphData.put(year, new Double[]{estimation, ecart});
+
+ // si les données sont énormes, on affiche les données
+ // / multiplicator et on le mentionne dans la légende
+ if (estimation > 1e9) {
+ multiplicator = 1000000;
+ }
+ if (estimation > 1e6 && multiplicator < 1000000) {
+ multiplicator = 1000;
+ }
+ }
+ }
+
+ File result = null;
+
+ // avec l'extraction des données, on peut demander a générer un graphique
+ // sur un indicateur qui n'est pas présent dans le projet courant,
+ // dans ce cas, on retourne null
+ if (indicatorFound) {
+
+ String zoneDisplayName = repository.getZonesMap().getZoneFullName(zone);
+ String indicatorName = repository.getIndicatorsMap().getIndicatorValue(indicator, locale);
+ String unit = repository.getIndicatorsMap().getIndicatorUnit(indicator);
+
+ // get graph title
+ String title = zoneDisplayName;
+ title += " - " + indicatorName;
+ title += " - " + repository.getSpeciesMap().getReportDisplayName(species);
+
+ // generate dataset with sorted data
+ DefaultStatisticalCategoryDataset statisticalDataset = new DefaultStatisticalCategoryDataset();
+ for (int indexYear = minYear; indexYear <= maxYear; ++indexYear) {
+ Double[] entry = graphData.get(indexYear);
+ if (entry != null) {
+ Double estimation = entry[0] / multiplicator;
+ Double ecart = entry[1] / multiplicator;
+ statisticalDataset.add(estimation, ecart, "Serie1", (Comparable) indexYear);
+ } else {
+ statisticalDataset.add(null, null, "Serie1", indexYear);
+ }
+ }
+
+ // configure chart
+ //CategoryAxis categoryAxis = new CategoryAxis(t("coser.business.common.year"));
+ String yearAxis = reports.getYearChartTitle(locale);
+ CategoryAxis categoryAxis = new CategoryAxis(yearAxis);
+ categoryAxis.setCategoryMargin(0);
+ categoryAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
+ // label horizontaux
+ String legendY = indicatorName;
+ if (multiplicator != 1) {
+ // affiche par exemple : cm * 1000
+ legendY += " (" + unit + "*" + multiplicator + ")";
+ } else if (StringUtils.isNotEmpty(unit)) {
+ legendY += " (" + unit + ")";
+ }
+ ValueAxis valueAxis = new NumberAxis(legendY);
+ valueAxis.setUpperMargin(0.1);
+
+ CategoryItemRenderer renderer = new StatisticalLineAndShapeRenderer(false, true);
+
+ // n'affiche pas les nombre sur le graphique
+ //StandardCategoryItemLabelGenerator itemLabelGenerator = new StandardCategoryItemLabelGenerator();
+ //renderer.setBaseItemLabelGenerator(itemLabelGenerator);
+ //renderer.setBaseItemLabelsVisible(true);
+
+ CategoryPlot plot = new CategoryPlot(statisticalDataset, categoryAxis, valueAxis, renderer);
+ plot.setOrientation(PlotOrientation.VERTICAL);
+ JFreeChart chart = new JFreeChart(title,
+ JFreeChart.DEFAULT_TITLE_FONT, plot, true);
+
+ // remove series legend
+ chart.removeLegend();
+ // white background
+ chart.setBackgroundPaint(Color.WHITE);
+
+ try {
+ result = File.createTempFile("coser-chart-population-indicator-", ".png");
+ result.deleteOnExit();
+ ChartUtilities.saveChartAsPNG(result, chart, 800, 400);
+ } catch (IOException ex) {
+ throw new CoserTechnicalException("Can't save chart", ex);
+ }
+ }
+
+ return result;
+ }
+
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/PopulationIndicatorResultProducer.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/RawDataResultProducer.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/RawDataResultProducer.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/RawDataResultProducer.java 2014-03-11 09:28:43 UTC (rev 1141)
@@ -0,0 +1,163 @@
+package fr.ifremer.coser.result.repository.legacy;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.coser.CoserBusinessConfig;
+import fr.ifremer.coser.CoserBusinessException;
+import fr.ifremer.coser.CoserConstants;
+import fr.ifremer.coser.CoserTechnicalException;
+import fr.ifremer.coser.bean.Project;
+import fr.ifremer.coser.bean.RSufiResultPath;
+import fr.ifremer.coser.bean.Selection;
+import fr.ifremer.coser.bean.ZoneMap;
+import fr.ifremer.coser.result.FileResult;
+import fr.ifremer.coser.result.Reports;
+import fr.ifremer.coser.result.repository.RequestUnavailableForProducerException;
+import fr.ifremer.coser.result.repository.ResultProducer;
+import fr.ifremer.coser.result.request.RawDataRequest;
+import fr.ifremer.coser.services.ProjectService;
+import org.apache.commons.io.FileUtils;
+import org.nuiton.util.FileUtil;
+import org.nuiton.util.ZipUtil;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Date;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+/**
+ * Created on 3/11/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class RawDataResultProducer implements ResultProducer<RawDataRequest> {
+
+ protected final LegacyResultRepository repository;
+
+ protected final Reports reports;
+
+ protected final RSufiResultPath path;
+
+ protected final File basedir;
+
+ protected final ProjectService projectService;
+
+ private CoserBusinessConfig config;
+
+ private String surveyName;
+
+ public RawDataResultProducer(LegacyResultRepository repository) {
+ this.repository = repository;
+ this.path = repository.path;
+ this.reports = repository.reports;
+ this.projectService = repository.projectService;
+ this.basedir = repository.basedir;
+ this.config = repository.config;
+ this.surveyName = repository.surveyName;
+ }
+
+ @Override
+ public LegacyResultRepository getRepository() {
+ return repository;
+ }
+
+ @Override
+ public Map<String, String> getAvailableZones(RawDataRequest request) {
+ boolean match = repository.matchFacade(request);
+
+ Map<String, String> result = null;
+ if (match) {
+ ZoneMap zonesMap = repository.getZonesMap();
+ List<String> allowedZones = zonesMap.getZonesForFacade(request.getFacade());
+ result = zonesMap.getSubZonesMap(path.getRsufiResult().getZone(), allowedZones);
+ }
+ return result;
+ }
+
+ @Override
+ public Map<String, String> getAvailableSpecies(RawDataRequest request) {
+ throw RequestUnavailableForProducerException.newException("getAvailableSpecies", this);
+ }
+
+ @Override
+ public Map<String, String> getAvailableIndicators(RawDataRequest request) {
+ throw RequestUnavailableForProducerException.newException("getAvailableIndicators", this);
+ }
+
+ @Override
+ public FileResult produceResult(RawDataRequest r) {
+
+ Locale locale = r.getLocale();
+
+ Project project = path.getProject();
+ Selection selection = path.getSelection();
+ try {
+ // be sure that data are available for this project
+ // or it will fail
+ projectService.loadSelectionData(basedir.getParentFile(), project, selection);
+ } catch (CoserBusinessException e) {
+ throw new CoserTechnicalException("Could not load project selection", e);
+ }
+
+ File resultZip;
+
+ try {
+ File tempDir = FileUtil.createTempDirectory("coser-source-", "-tmp");
+
+ // il ne faut pas les fichiers de selection, mais leurs
+ // export rsufi (sans les lignes, et les quotes)
+ File archiveDir = projectService.extractRSUfiData(project, selection, tempDir, true);
+
+ // add decharge file
+ String filename = reports.getDechargeFilename(locale);
+ File dechargePDF = new File(archiveDir, filename);
+
+ Date lastDataUpdateDate = config.getLastDataUpdateDate();
+
+ reports.generateDechargePDF(dechargePDF, locale, lastDataUpdateDate, surveyName);
+
+ // ajout du reftax dans le zip
+ File reftaxFile = new File(basedir, CoserConstants.Category.REFTAX_SPECIES.getStorageFileName());
+ FileUtils.copyFileToDirectory(reftaxFile, archiveDir);
+
+ // make zip
+ resultZip = File.createTempFile("coser-source-", ".zip");
+ resultZip.deleteOnExit();
+ ZipUtil.compress(resultZip, archiveDir);
+
+ // clean directory
+ FileUtils.deleteDirectory(tempDir);
+ } catch (IOException e) {
+ throw new CoserTechnicalException("Can't create zip file", e);
+ } catch (CoserBusinessException e) {
+ throw new CoserTechnicalException("Can't create zip file", e);
+ }
+
+ FileResult result = new FileResult(repository.getId(), resultZip);
+ return result;
+ }
+
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/repository/legacy/RawDataResultProducer.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/CoserRequestBuilder.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/CoserRequestBuilder.java 2014-03-10 10:23:18 UTC (rev 1140)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/CoserRequestBuilder.java 2014-03-11 09:28:43 UTC (rev 1141)
@@ -23,7 +23,10 @@
*/
import fr.ifremer.coser.result.CoserRequest;
+import fr.ifremer.coser.util.DataType;
+import org.apache.commons.collections4.CollectionUtils;
+import java.util.List;
import java.util.Locale;
/**
@@ -48,6 +51,16 @@
protected IndicatorRequest.ResultType resultType;
+ protected List<DataType> extractTypeList;
+
+ protected List<String> zoneList;
+
+ protected List<String> speciesList;
+
+ protected List<String> populationIndicatorList;
+
+ protected List<String> communityIndicatorList;
+
public CoserRequestBuilder(Locale locale) {
this.locale = locale;
}
@@ -77,6 +90,31 @@
return this;
}
+ public CoserRequestBuilder addExtractTypeList(List<DataType> extractTypeSet) {
+ this.extractTypeList = extractTypeSet;
+ return this;
+ }
+
+ public CoserRequestBuilder addZoneList(List<String> zoneList) {
+ this.zoneList = zoneList;
+ return this;
+ }
+
+ public CoserRequestBuilder addSpeciesList(List<String> speciesList) {
+ this.speciesList = speciesList;
+ return this;
+ }
+
+ public CoserRequestBuilder addPopulationIndicatorList(List<String> populationIndicatorList) {
+ this.populationIndicatorList = populationIndicatorList;
+ return this;
+ }
+
+ public CoserRequestBuilder addCommunityIndicatorList(List<String> communityIndicatorList) {
+ this.communityIndicatorList = communityIndicatorList;
+ return this;
+ }
+
public MapRequest toMapRequest() {
MapRequest request = new MapRequest();
flush(request);
@@ -101,6 +139,12 @@
return request;
}
+ public ExtractRequest toExtractRequest() {
+ ExtractRequest request = new ExtractRequest();
+ flush(request);
+ return request;
+ }
+
protected <R extends CoserRequest> void flush(R request) {
request.setLocale(locale);
if (request instanceof CoserRequestFacadeAware) {
@@ -127,6 +171,25 @@
((IndicatorRequest) request).setResultType(resultType);
}
}
+
+ if (request instanceof ExtractRequest) {
+ if (CollectionUtils.isNotEmpty(extractTypeList)) {
+ ((ExtractRequest) request).setExtractTypeList(extractTypeList);
+ }
+ if (CollectionUtils.isNotEmpty(zoneList)) {
+ ((ExtractRequest) request).setZoneList(zoneList);
+ }
+ if (CollectionUtils.isNotEmpty(populationIndicatorList)) {
+ ((ExtractRequest) request).setPopulationIndicatorList(populationIndicatorList);
+ }
+ if (CollectionUtils.isNotEmpty(communityIndicatorList)) {
+ ((ExtractRequest) request).setCommunityIndicatorList(communityIndicatorList);
+ }
+ if (CollectionUtils.isNotEmpty(speciesList)) {
+ ((ExtractRequest) request).setSpeciesList(speciesList);
+ }
+
+ }
}
}
Added: trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/ExtractRequest.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/ExtractRequest.java (rev 0)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/ExtractRequest.java 2014-03-11 09:28:43 UTC (rev 1141)
@@ -0,0 +1,122 @@
+package fr.ifremer.coser.result.request;
+
+/*
+ * #%L
+ * Coser :: Business
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import fr.ifremer.coser.result.CoserRequest;
+import fr.ifremer.coser.util.DataType;
+import org.apache.commons.collections4.CollectionUtils;
+
+import java.util.List;
+import java.util.Locale;
+
+/**
+ * Request to extract data.
+ * <p/>
+ * Created on 3/9/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class ExtractRequest implements CoserRequest {
+
+ private static final long serialVersionUID = 1L;
+
+ protected Locale locale;
+
+ protected List<String> zoneList;
+
+ protected List<String> populationIndicatorList;
+
+ protected List<String> communityIndicatorList;
+
+ protected List<String> speciesList;
+
+ protected List<DataType> extractTypeList;
+
+ @Override
+ public Locale getLocale() {
+ return locale;
+ }
+
+ @Override
+ public void setLocale(Locale locale) {
+ Preconditions.checkNotNull(locale);
+ this.locale = locale;
+ }
+
+ @Override
+ public boolean isFilled() {
+ return !(locale == null ||
+ CollectionUtils.isEmpty(extractTypeList) ||
+ CollectionUtils.isEmpty(zoneList) ||
+ CollectionUtils.isEmpty(populationIndicatorList) ||
+ CollectionUtils.isEmpty(communityIndicatorList) ||
+ CollectionUtils.isEmpty(speciesList));
+ }
+
+ public List<DataType> getExtractTypeList() {
+ return extractTypeList;
+ }
+
+ public void setExtractTypeList(List<DataType> extractTypeSet) {
+ Preconditions.checkArgument(CollectionUtils.isNotEmpty(extractTypeSet));
+ this.extractTypeList = extractTypeSet;
+ }
+
+ public List<String> getZoneList() {
+ return zoneList;
+ }
+
+ public void setZoneList(List<String> zoneList) {
+ Preconditions.checkArgument(CollectionUtils.isNotEmpty(zoneList));
+ this.zoneList = zoneList;
+ }
+
+ public List<String> getPopulationIndicatorList() {
+ return populationIndicatorList;
+ }
+
+ public void setPopulationIndicatorList(List<String> populationIndicatorList) {
+ Preconditions.checkArgument(CollectionUtils.isNotEmpty(populationIndicatorList));
+ this.populationIndicatorList = populationIndicatorList;
+ }
+
+ public List<String> getCommunityIndicatorList() {
+ return communityIndicatorList;
+ }
+
+ public void setCommunityIndicatorList(List<String> communityIndicatorList) {
+ Preconditions.checkArgument(CollectionUtils.isNotEmpty(communityIndicatorList));
+ this.communityIndicatorList = communityIndicatorList;
+ }
+
+ public List<String> getSpeciesList() {
+ return speciesList;
+ }
+
+ public void setSpeciesList(List<String> speciesList) {
+ Preconditions.checkArgument(CollectionUtils.isNotEmpty(speciesList));
+ this.speciesList = speciesList;
+ }
+}
Property changes on: trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/ExtractRequest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/IndicatorRequest.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/IndicatorRequest.java 2014-03-10 10:23:18 UTC (rev 1140)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/result/request/IndicatorRequest.java 2014-03-11 09:28:43 UTC (rev 1141)
@@ -109,6 +109,7 @@
}
public void setIndicator(String indicator) {
+ Preconditions.checkNotNull(indicator);
this.indicator = indicator;
}
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/storage/DataStorages.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/storage/DataStorages.java 2014-03-10 10:23:18 UTC (rev 1140)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/storage/DataStorages.java 2014-03-11 09:28:43 UTC (rev 1141)
@@ -113,12 +113,12 @@
* his name is generated then using the {@link File#createTempFile(String, String)} using the given {@code prefix}
* and {@code suffix}.
*
+ * @param dataStorage the storage to save
* @param prefix prefix of generated file name
* @param suffix suffix of generated file name
- * @param dataStorage the storage to save
* @return the file where the storage was saved
*/
- public static File save(String prefix, String suffix, DataStorage dataStorage) throws CoserTechnicalException {
+ public static File save(DataStorage dataStorage, String prefix, String suffix) throws CoserTechnicalException {
File file;
try {
@@ -131,6 +131,27 @@
try {
writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), CoserConstants.CSV_FILE_ENCODING));
+ save(dataStorage, writer);
+ writer.close();
+ writer.close();
+ } catch (IOException ex) {
+ throw new CoserTechnicalException("Can't save data", ex);
+ } finally {
+ IOUtils.closeQuietly(writer);
+ }
+ return file;
+ }
+
+ /**
+ * Save a datastorage to a writer.
+ *
+ * @param dataStorage the storage to save
+ * @param writer where to save storage
+ */
+ public static void save(DataStorage dataStorage, Writer writer) throws CoserTechnicalException {
+
+ try {
+
for (String[] contentDatas : dataStorage) {
// start at 1 to not output "line" column
for (int i = 1; i < contentDatas.length; i++) {
@@ -155,7 +176,5 @@
} finally {
IOUtils.closeQuietly(writer);
}
- return file;
}
-
}
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/util/DataType.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/util/DataType.java 2014-03-10 10:23:18 UTC (rev 1140)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/util/DataType.java 2014-03-11 09:28:43 UTC (rev 1141)
@@ -2,7 +2,7 @@
* #%L
* Coser :: Business
* %%
- * Copyright (C) 2012 Ifremer, Codelutin, Chatellier Eric
+ * Copyright (C) 2012 Ifremer, Codelutin, Chatellier Eric, Chemit Tony
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
@@ -22,16 +22,42 @@
package fr.ifremer.coser.util;
+import com.google.common.collect.Maps;
+
+import java.util.Locale;
+import java.util.Map;
+
+import static org.nuiton.i18n.I18n.l;
+import static org.nuiton.i18n.I18n.n;
+
/**
* Les types de données gérées par le site internet, sur lesquelle il est
* possible de filtrer dans le formulaire de recherche.
- *
+ *
* @author echatellier
* @since 1.4
*/
public enum DataType {
- MAP,
- POPULATION,
- COMMUNITY,
- SOURCE
+ MAP(n("coser.business.data.type.map")),
+ POPULATION(n("coser.business.data.type.population")),
+ COMMUNITY(n("coser.business.data.type.community")),
+ SOURCE(n("coser.business.data.type.source"));
+
+ private final String i18nKey;
+
+ DataType(String i18nKey) {
+ this.i18nKey = i18nKey;
+ }
+
+ public String getLabel(Locale locale) {
+ return l(locale, i18nKey);
+ }
+
+ public static Map<String, String> getExtractTypes(Locale locale) {
+ Map<String, String> result = Maps.newLinkedHashMap();
+ for (DataType dataType : DataType.values()) {
+ result.put(dataType.name(), dataType.getLabel(locale));
+ }
+ return result;
+ }
}
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 2014-03-10 10:23:18 UTC (rev 1140)
+++ trunk/coser-business/src/main/resources/i18n/coser-business_en_GB.properties 2014-03-11 09:28:43 UTC (rev 1141)
@@ -101,6 +101,10 @@
coser.business.control.step.lengthoutliers=Searching for aberrants lengths \: %s (%d%%)
coser.business.control.step.observation=Checking observation number \: %s (%d%%)
coser.business.control.step.xworks=Line checks \: %s (%d%%)
+coser.business.data.type.community=Community indices by area
+coser.business.data.type.map=Species distribution maps by area
+coser.business.data.type.population=Population indices by species by area
+coser.business.data.type.source=Raw data by sampling unit (generally by haul)
coser.business.dataDisclaimer.filename=DataDisclaimer.pdf
coser.business.extract.creationdate=Creation date \:
coser.business.extract.extractdata=Data
@@ -142,10 +146,13 @@
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.specesList.name=%s List %s
+coser.business.specesList.nameForAll=All List %s
coser.business.uploadresult.checkcollision=Checking zone collisions
coser.business.uploadresult.modifyResultOptions=Modify result options
coser.business.uploadresult.preparezip=Preparing zip archive…
coser.business.uploadresult.sendzip=Sending zip archive…
+coser.business.year=Year
coser.config.control.diffcatchlength.description=Percentage difference allowed between catch and length (in percent, for example 5% set 5.0)
coser.config.control.nobsmin.description=Minimal observation number
coser.config.control.standarddeviationtoaverage.description=Length outliers (how many strandard deviation to average)
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 2014-03-10 10:23:18 UTC (rev 1140)
+++ trunk/coser-business/src/main/resources/i18n/coser-business_fr_FR.properties 2014-03-11 09:28:43 UTC (rev 1141)
@@ -101,6 +101,10 @@
coser.business.control.step.lengthoutliers=Recherche des longueurs abérrantes \: %s (%d%%)
coser.business.control.step.observation=Vérification du nombre d'observation \: %s (%d%%)
coser.business.control.step.xworks=Validation par lignes \: %s (%d%%)
+coser.business.data.type.community=Des indices de communauté par zone
+coser.business.data.type.map=Des cartes de distribution par espèce et par zone
+coser.business.data.type.population=Des indices biologiques par espèce et par zone
+coser.business.data.type.source=Des données par opération d'échantillonnage (en général par trait de chalut)
coser.business.dataDisclaimer.filename=DechargeDonnees.pdf
coser.business.extract.creationdate=Date de création \:
coser.business.extract.extractdata=Données du graphique
@@ -142,10 +146,13 @@
coser.business.result.rsufiResultAlreadyExists=Le résultat %s existe déjà \!
coser.business.resultupload.duplicatedresult=Le résultat %s/%s/%s duplique un autre résultat pour la zone %s \!
coser.business.selection.notValidatedControl=Contrôle non validé \!
+coser.business.specesList.name=%s Liste %s
+coser.business.specesList.nameForAll=Tous Liste %s
coser.business.uploadresult.checkcollision=Vérification des collisions de zones
coser.business.uploadresult.modifyResultOptions=Modification des options des résultats
coser.business.uploadresult.preparezip=Préparation de l'archive zip…
coser.business.uploadresult.sendzip=Envoi de l'archive zip…
+coser.business.year=Année
coser.config.control.diffcatchlength.description=Pourcentage d'écart toléré entre les captures et les tailles (en pourcent, par exemple pour 5% mettre 5.0)
coser.config.control.nobsmin.description=Nombre minimal d'observation
coser.config.control.standarddeviationtoaverage.description=Tailles aberrantes (combien de fois l'écart type par rapport à la moyenne)
Modified: trunk/coser-business/src/test/java/fr/ifremer/coser/result/repository/echobase/EchoBaseResultRepositoryTest.java
===================================================================
--- trunk/coser-business/src/test/java/fr/ifremer/coser/result/repository/echobase/EchoBaseResultRepositoryTest.java 2014-03-10 10:23:18 UTC (rev 1140)
+++ trunk/coser-business/src/test/java/fr/ifremer/coser/result/repository/echobase/EchoBaseResultRepositoryTest.java 2014-03-11 09:28:43 UTC (rev 1141)
@@ -89,14 +89,12 @@
// pas de zones pour la facade
mapRequest.setFacade("mediteranee");
availableZones = repository1.getAvailableZones(mapRequest);
- Assert.assertNotNull(availableZones);
- Assert.assertTrue(availableZones.isEmpty());
+ Assert.assertNull(availableZones);
// facade inconnue
mapRequest.setFacade("mediteranee2");
availableZones = repository1.getAvailableZones(mapRequest);
- Assert.assertNotNull(availableZones);
- Assert.assertTrue(availableZones.isEmpty());
+ Assert.assertNull(availableZones);
// Population request
@@ -113,14 +111,12 @@
// pas de zones pour la facade
popRequest.setFacade("mediteranee");
availableZones = repository1.getAvailableZones(popRequest);
- Assert.assertNotNull(availableZones);
- Assert.assertTrue(availableZones.isEmpty());
+ Assert.assertNull(availableZones);
// facade inconnue
popRequest.setFacade("mediteranee2");
availableZones = repository1.getAvailableZones(popRequest);
- Assert.assertNotNull(availableZones);
- Assert.assertTrue(availableZones.isEmpty());
+ Assert.assertNull(availableZones);
// Community request
@@ -137,14 +133,12 @@
// pas de zones pour la facade
comRequest.setFacade("mediteranee");
availableZones = repository1.getAvailableZones(comRequest);
- Assert.assertNotNull(availableZones);
- Assert.assertTrue(availableZones.isEmpty());
+ Assert.assertNull(availableZones);
// facade inconnue
comRequest.setFacade("mediteranee2");
availableZones = repository1.getAvailableZones(comRequest);
- Assert.assertNotNull(availableZones);
- Assert.assertTrue(availableZones.isEmpty());
+ Assert.assertNull(availableZones);
}
}
Modified: trunk/coser-web/src/main/java/fr/ifremer/coser/web/ServiceHelper.java
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/ServiceHelper.java 2014-03-10 10:23:18 UTC (rev 1140)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/ServiceHelper.java 2014-03-11 09:28:43 UTC (rev 1141)
@@ -28,15 +28,12 @@
import fr.ifremer.coser.result.CoserResultEngine;
import fr.ifremer.coser.result.FileResult;
import fr.ifremer.coser.result.repository.ResultRepositoryProvider;
-import fr.ifremer.coser.result.repository.legacy.LegacyResultRepository;
import fr.ifremer.coser.result.request.CoserRequestSpeciesAware;
import fr.ifremer.coser.result.request.CoserRequestZoneAware;
import fr.ifremer.coser.result.request.IndicatorRequest;
import fr.ifremer.coser.services.WebService;
import fr.ifremer.coser.util.DataType;
import fr.ifremer.coser.web.actions.common.CoserAction;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.nuiton.config.ArgumentsParserException;
import org.nuiton.i18n.I18n;
import org.nuiton.i18n.init.DefaultI18nInitializer;
@@ -61,9 +58,6 @@
*/
public class ServiceHelper {
- /** Logger. */
- private static final Log log = LogFactory.getLog(ServiceHelper.class);
-
private static WebService webService;
private static CoserResultEngine resultService;
@@ -199,7 +193,7 @@
// --- Indicator methods ----------------------------------------------- //
// --------------------------------------------------------------------- //
- public Map<String, String> getAvailableIndicators(IndicatorRequest request) {
+ public Map<String, String> getAvailableIndicators(CoserRequest request) {
return resultService.getAvailableIndicators(request);
}
@@ -281,29 +275,6 @@
}
}
- public FileResult extractData(List<String> selectZones,
- List<DataType> selectTypes,
- List<String> selectSpecies,
- List<String> selectComIndicators,
- List<String> selectPopIndicators,
- Locale locale) {
- try {
- File file = webService.extractData(selectZones,
- selectTypes,
- selectSpecies,
- selectComIndicators,
- selectPopIndicators,
- locale);
- FileResult fileResult = new FileResult(LegacyResultRepository.ID, file);
- return fileResult;
- } catch (CoserBusinessException e) {
- if (log.isErrorEnabled()) {
- log.error("Can't extract data", e);
- }
- throw new CoserWebException("Can't extract data", e);
- }
- }
-
// --------------------------------------------------------------------- //
// --- Misc methods ---------------------------------------------------- //
// --------------------------------------------------------------------- //
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 2014-03-10 10:23:18 UTC (rev 1140)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/com/GraphDataAction.java 2014-03-11 09:28:43 UTC (rev 1141)
@@ -102,6 +102,7 @@
if (list == null) {
+ //TODO Improve this (add a getFirstAvailableSpecies method)
// on prend la première entrée dans le fichier
Map<String, String> lists = getService().getAvailableSpecies(request);
if (!lists.isEmpty()) {
Modified: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/com/GraphDownloadAction.java
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/com/GraphDownloadAction.java 2014-03-10 10:23:18 UTC (rev 1140)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/com/GraphDownloadAction.java 2014-03-11 09:28:43 UTC (rev 1141)
@@ -103,6 +103,7 @@
if (list == null) {
+ //TODO Improve this (add a getFirstAvailableSpecies method)
// on prend la première entrée dans le fichier
Map<String, String> lists = getService().getAvailableSpecies(request);
if (!lists.isEmpty()) {
Modified: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/common/CoserAction.java
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/common/CoserAction.java 2014-03-10 10:23:18 UTC (rev 1140)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/common/CoserAction.java 2014-03-11 09:28:43 UTC (rev 1141)
@@ -26,6 +26,8 @@
import fr.ifremer.coser.web.ServiceHelper;
import org.nuiton.web.struts2.BaseAction;
+import java.util.Locale;
+
/**
* Toutes les actions doivent étendre celle ci. Contient le code commun
* récurent, et notamment les actions utilisé par le layout et devant
@@ -87,10 +89,19 @@
* @since 1.5
*/
protected CoserRequestBuilder requestBuilder() {
- return new CoserRequestBuilder(getLocale());
+ return requestBuilder(getLocale());
}
/**
+ * @param locale locale to use (while using execute and wait action we keep the locale in session...)
+ * @return a new request builder.
+ * @since 1.5
+ */
+ protected CoserRequestBuilder requestBuilder(Locale locale) {
+ return new CoserRequestBuilder(locale);
+ }
+
+ /**
* @return service helper for this action
* @since 1.5
*/
Modified: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/search/ExtractAction.java
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/search/ExtractAction.java 2014-03-10 10:23:18 UTC (rev 1140)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/search/ExtractAction.java 2014-03-11 09:28:43 UTC (rev 1141)
@@ -21,7 +21,9 @@
package fr.ifremer.coser.web.actions.search;
+import com.google.common.collect.Lists;
import fr.ifremer.coser.result.FileResult;
+import fr.ifremer.coser.result.request.ExtractRequest;
import fr.ifremer.coser.util.DataType;
import fr.ifremer.coser.web.actions.common.CoserAction;
import org.apache.commons.collections4.CollectionUtils;
@@ -58,8 +60,12 @@
public static final String DOWNLOAD = "download";
+ public static final String LOCALE_ATTRIBUTE = "locale";
+
protected Map<String, String> zones;
+ protected Map<String, String> types;
+
protected List<String> selectZones;
protected List<DataType> selectTypes;
@@ -96,6 +102,10 @@
this.selectZones = selectZones;
}
+ public Map<String, String> getTypes() {
+ return types;
+ }
+
public List<DataType> getSelectTypes() {
return selectTypes;
}
@@ -144,6 +154,11 @@
this.submitAction = submitAction;
}
+ // used by validation
+ public boolean isAccepted() {
+ return accepted;
+ }
+
public void setAccepted(boolean accepted) {
this.accepted = accepted;
}
@@ -167,17 +182,31 @@
} else {
result = INPUT;
+ types = DataType.getExtractTypes(getLocale());
// renvoi la liste des id subzone-survey et leurs label associé
zones = getService().getZoneForFacade();
+
if (CollectionUtils.isNotEmpty(selectZones)) {
- species = getService().getSpecies(selectZones);
- if (selectTypes != null && selectTypes.contains(DataType.COMMUNITY)) {
- comIndicators = getService().getIndicators(selectZones, DataType.COMMUNITY);
+ ExtractRequest extractRequest = requestBuilder().
+ addZoneList(selectZones).
+ toExtractRequest();
+
+ species = getService().getAvailableSpecies(extractRequest);
+
+ if (selectTypes != null) {
+
+ if (selectTypes.contains(DataType.COMMUNITY)) {
+
+ extractRequest.setExtractTypeList(Lists.newArrayList(DataType.COMMUNITY));
+ comIndicators = getService().getAvailableIndicators(extractRequest);
+ }
+
+ if (selectTypes.contains(DataType.POPULATION)) {
+ extractRequest.setExtractTypeList(Lists.newArrayList(DataType.POPULATION));
+ popIndicators = getService().getAvailableIndicators(extractRequest);
+ }
}
- if (selectTypes != null && selectTypes.contains(DataType.POPULATION)) {
- popIndicators = getService().getIndicators(selectZones, DataType.POPULATION);
- }
}
}
@@ -186,22 +215,14 @@
@Action(value = "extract-quality",
results = {
- @Result(location = "/WEB-INF/content/search/extract-success.jsp"),
+ @Result(name = "input", location = "/WEB-INF/content/search/extract-success.jsp"),
@Result(name = DOWNLOAD, type = "redirect", params = {
"location", "${location}"})})
public String quality() {
- String result;
- if (!accepted) {
- addFieldError("accepted", getText("message.quality.notaccepted"));
- result = SUCCESS;
- } else {
-
- // petit hack pour mettre la locale dans la session car
- // après, on n'a plus accès au context dans le executeAndWait
- request.getSession().setAttribute("locale", getLocale());
- result = DOWNLOAD;
- }
- return result;
+ // petit hack pour mettre la locale dans la session car
+ // après, on n'a plus accès au context dans le executeAndWait
+ request.getSession().setAttribute(LOCALE_ATTRIBUTE, getLocale());
+ return DOWNLOAD;
}
/**
@@ -247,15 +268,18 @@
@Result(type = "stream", params = {"contentType", "application/zip", "contentDisposition", "attachment; filename=\"${filename}\""})})
public String download() {
- Locale locale = (Locale) request.getSession().getAttribute("locale");
+ Locale locale = (Locale) request.getSession().getAttribute(LOCALE_ATTRIBUTE);
- resultFile = getService().extractData(selectZones,
- selectTypes,
- selectSpecies,
- selectComIndicators,
- selectPopIndicators,
- locale);
+ ExtractRequest extractRequest = requestBuilder(locale).
+ addZoneList(selectZones).
+ addExtractTypeList(selectTypes).
+ addSpeciesList(selectSpecies).
+ addCommunityIndicatorList(selectComIndicators).
+ addPopulationIndicatorList(selectPopIndicators).
+ toExtractRequest();
+ resultFile = getService().getFileResult(extractRequest);
+
return SUCCESS;
}
@@ -268,6 +292,26 @@
return "Indicateurs_Ifremer.zip";
}
+ // @Action(value = "extract-quality",
+// results = {
+// @Result(location = "/WEB-INF/content/search/extract-success.jsp"),
+// @Result(name = DOWNLOAD, type = "redirect", params = {
+// "location", "${location}"})})
+// public String quality() {
+// String result;
+// if (!accepted) {
+// addFieldError("accepted", getText("message.quality.notaccepted"));
+// result = SUCCESS;
+// } else {
+//
+// // petit hack pour mettre la locale dans la session car
+// // après, on n'a plus accès au context dans le executeAndWait
+// request.getSession().setAttribute("locale", getLocale());
+// result = DOWNLOAD;
+// }
+// return result;
+// }
+//
// protected File zipFile;
//
// @Override
Added: trunk/coser-web/src/main/resources/fr/ifremer/coser/web/actions/search/ExtractAction-extract-quality-validation.xml
===================================================================
--- trunk/coser-web/src/main/resources/fr/ifremer/coser/web/actions/search/ExtractAction-extract-quality-validation.xml (rev 0)
+++ trunk/coser-web/src/main/resources/fr/ifremer/coser/web/actions/search/ExtractAction-extract-quality-validation.xml 2014-03-11 09:28:43 UTC (rev 1141)
@@ -0,0 +1,34 @@
+<!--
+ #%L
+ Coser :: Web
+ %%
+ Copyright (C) 2010 - 2014 Ifremer, Codelutin, Chemit Tony
+ %%
+ 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%
+ -->
+<!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator 1.0.3//EN"
+ "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
+<validators>
+
+ <field name="accepted">
+
+ <field-validator type="fieldexpression">
+ <param name="expression">accepted</param>
+ <message key="message.quality.notaccepted"/>
+ </field-validator>
+
+ </field>
+
+</validators>
\ No newline at end of file
Property changes on: trunk/coser-web/src/main/resources/fr/ifremer/coser/web/actions/search/ExtractAction-extract-quality-validation.xml
___________________________________________________________________
Added: svn:mime-type
+ text/xml
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/coser-web/src/main/webapp/WEB-INF/content/search/extract-input.jsp
===================================================================
--- trunk/coser-web/src/main/webapp/WEB-INF/content/search/extract-input.jsp 2014-03-10 10:23:18 UTC (rev 1140)
+++ trunk/coser-web/src/main/webapp/WEB-INF/content/search/extract-input.jsp 2014-03-11 09:28:43 UTC (rev 1141)
@@ -2,7 +2,7 @@
#%L
Coser :: Web
%%
- Copyright (C) 2012 Ifremer, Codelutin, Chatellier Eric
+ Copyright (C) 2012 Ifremer, Codelutin, Chatellier Eric, Chemit Tony
%%
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
@@ -57,6 +57,15 @@
<td><s:text name="message.common.datatypes" /> :</td>
<td>
<select name="selectTypes" multiple="multiple" style="width:100%" id="selectTypes">
+ <s:iterator value="types" var="type">
+ <option value="<s:property value="key" />"
+ <s:if test="selectTypes.contains(#type.key)">
+ selected="selected"
+ </s:if>>
+ <s:property value="value" /></option>
+ </s:iterator>
+ </select>
+ </td><%--
<option value="<s:property value="@fr.ifremer.coser.util.DataType@MAP" />"
<s:if test="selectTypes.contains(@fr.ifremer.coser.util.DataType@MAP)">
selected="selected"
@@ -77,7 +86,7 @@
selected="selected"
</s:if>>
<s:text name="message.index.datatypesource.short" /></option>
- </select></td>
+ </select></td>--%>
<td style="vertical-align:top">
<img src="<s:url value='/images/stock_select_table.png' />"
onClick="javascript:coserSelectAll($('#selectTypes'))"
1
0
10 Mar '14
Author: tchemit
Date: 2014-03-10 11:23:18 +0100 (Mon, 10 Mar 2014)
New Revision: 1140
Url: http://forge.codelutin.com/projects/coser/repository/revisions/1140
Log:
refs-80 #4664
Added:
trunk/coser-business/src/site/
trunk/coser-business/src/site/site_en.xml
trunk/coser-business/src/site/site_fr.xml
trunk/coser-ui/src/main/java/fr/ifremer/coser/CoserConfigProvider.java
trunk/coser-ui/src/main/resources/META-INF/
trunk/coser-ui/src/main/resources/META-INF/services/
trunk/coser-ui/src/main/resources/META-INF/services/org.nuiton.config.ApplicationConfigProvider
trunk/coser-ui/src/site/
trunk/coser-ui/src/site/site_en.xml
trunk/coser-ui/src/site/site_fr.xml
trunk/coser-web/src/main/java/fr/ifremer/coser/web/CoserWebConfigProvider.java
trunk/coser-web/src/main/resources/META-INF/
trunk/coser-web/src/main/resources/META-INF/services/
trunk/coser-web/src/main/resources/META-INF/services/org.nuiton.config.ApplicationConfigProvider
trunk/coser-web/src/main/validationRules.txt
trunk/coser-web/src/site/
trunk/coser-web/src/site/site_en.xml
trunk/coser-web/src/site/site_fr.xml
Removed:
trunk/coser-web/src/main/resources/fr/ifremer/coser/web/package.properties
trunk/coser-web/src/main/resources/fr/ifremer/coser/web/package_en.properties
trunk/coser-web/src/main/resources/fr/ifremer/coser/web/package_es.properties
trunk/coser-web/src/main/resources/fr/ifremer/coser/web/package_fr.properties
Modified:
trunk/coser-business/pom.xml
trunk/coser-business/src/main/java/fr/ifremer/coser/CoserBusinessConfig.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-ui/pom.xml
trunk/coser-ui/src/main/java/fr/ifremer/coser/Coser.java
trunk/coser-ui/src/main/java/fr/ifremer/coser/CoserConfig.java
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/pom.xml
trunk/coser-web/src/main/java/fr/ifremer/coser/web/CoserWebConfig.java
trunk/coser-web/src/main/java/fr/ifremer/coser/web/ServiceHelper.java
trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/common/CoserAction.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
trunk/coser-web/src/main/resources/struts.xml
trunk/pom.xml
trunk/src/site/en/rst/user/guide_listcontrols.rst
trunk/src/site/site_fr.xml
Modified: trunk/coser-business/pom.xml
===================================================================
--- trunk/coser-business/pom.xml 2014-03-09 06:34:41 UTC (rev 1139)
+++ trunk/coser-business/pom.xml 2014-03-10 10:23:18 UTC (rev 1140)
@@ -85,6 +85,10 @@
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
</dependency>
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ </dependency>
<dependency>
<groupId>net.sf.opencsv</groupId>
<artifactId>opencsv</artifactId>
@@ -137,4 +141,35 @@
</plugins>
</build>
+ <profiles>
+ <profile>
+ <id>reporting</id>
+ <activation>
+ <property>
+ <name>performRelease</name>
+ <value>true</value>
+ </property>
+ </activation>
+
+ <reporting>
+ <plugins>
+
+ <plugin>
+ <artifactId>maven-project-info-reports-plugin</artifactId>
+ <version>${projectInfoReportsPluginVersion}</version>
+ <reportSets>
+ <reportSet>
+ <reports>
+ <report>index</report>
+ </reports>
+ </reportSet>
+ </reportSets>
+ </plugin>
+
+ </plugins>
+ </reporting>
+
+ </profile>
+ </profiles>
+
</project>
Modified: trunk/coser-business/src/main/java/fr/ifremer/coser/CoserBusinessConfig.java
===================================================================
--- trunk/coser-business/src/main/java/fr/ifremer/coser/CoserBusinessConfig.java 2014-03-09 06:34:41 UTC (rev 1139)
+++ trunk/coser-business/src/main/java/fr/ifremer/coser/CoserBusinessConfig.java 2014-03-10 10:23:18 UTC (rev 1140)
@@ -25,9 +25,16 @@
import static org.nuiton.i18n.I18n.t;
import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Date;
import java.util.List;
import java.util.Locale;
+import java.util.Properties;
+import org.apache.commons.io.IOUtils;
import org.nuiton.config.ApplicationConfig;
import org.nuiton.config.ConfigOptionDef;
@@ -45,11 +52,6 @@
public CoserBusinessConfig() {
// init configuration with default options
loadDefaultOptions(CoserBusinessOption.values());
-// for (CoserBusinessOption o : CoserBusinessOption.values()) {
-// if (o.defaultValue != null) {
-// setDefaultOption(o.key, o.defaultValue);
-// }
-// }
}
/**
@@ -241,45 +243,87 @@
return emails;
}
+ /**
+ * Retourne la date de dernière mise à jour des données du site web.
+ *
+ * Retourne une date bidon, si pas de dernière mise à jour.
+ *
+ * @return last data update date
+ * @since 1.5
+ */
+ public Date getLastDataUpdateDate() {
+ Date dataUpdateDate = null;
+ File webProperties = getWebPropertiesFile();
+ if (webProperties.isFile()) {
+ // get update date
+ Properties props = new Properties();
+ InputStream stream = null;
+ try {
+ stream = new FileInputStream(webProperties);
+ props.load(stream);
+
+ if (props.containsKey("updateDate")) {
+ String date = props.getProperty("updateDate");
+ long time = Long.parseLong(date);
+ dataUpdateDate = new Date(time);
+ }
+ stream.close();
+ } catch (IOException ex) {
+ throw new CoserTechnicalException("Can't read properties file", ex);
+ }
+ finally {
+ IOUtils.closeQuietly(stream);
+ }
+ }
+
+ if (dataUpdateDate == null) {
+ dataUpdateDate = new Date(0);
+ }
+
+ return dataUpdateDate;
+ }
+
public static enum CoserBusinessOption implements ConfigOptionDef {
- DATABASE_DIRECTORY("coser.database.directory", t("coser.config.database.directory.description"), "${user.home}" + File.separator + "coser"),
- PROJECTS_DIRECTORY("coser.projects.directory", t("coser.config.projects.directory.description"), "${" + DATABASE_DIRECTORY.key + "}" + File.separator + "projects"),
- VALIDATOR_DIRECTORY("coser.validator.directory", t("coser.config.validator.directory.description"), "${" + DATABASE_DIRECTORY.key + "}" + File.separator + "validators"),
+ DATABASE_DIRECTORY("coser.database.directory", t("coser.config.database.directory.description"), File.class, "${user.home}" + File.separator + "coser"),
+ PROJECTS_DIRECTORY("coser.projects.directory", t("coser.config.projects.directory.description"), File.class, "${" + DATABASE_DIRECTORY.key + "}" + File.separator + "projects"),
+ VALIDATOR_DIRECTORY("coser.validator.directory", t("coser.config.validator.directory.description"), File.class, "${" + DATABASE_DIRECTORY.key + "}" + File.separator + "validators"),
- SMTP_HOST("coser.smtp.host", t("coser.config.smtp.host.description"), "smtp"),
- LOCALE("coser.locale", t("coser.config.locale.description"), Locale.FRANCE.toString()),
+ SMTP_HOST("coser.smtp.host", t("coser.config.smtp.host.description"),String.class , "smtp"),
+ LOCALE("coser.locale", t("coser.config.locale.description"), Locale.class, Locale.FRANCE.toString()),
- REFERENCE_SPECIES("coser.reference.species", t("coser.config.reference.species.description"), ""),
- REFERENCE_TYPE_ESPECES("coser.reference.typeSpecies", t("coser.config.reference.typeSpecies.description"), ""),
+ REFERENCE_SPECIES("coser.reference.species", t("coser.config.reference.species.description"), String.class, ""),
+ REFERENCE_TYPE_ESPECES("coser.reference.typeSpecies", t("coser.config.reference.typeSpecies.description"), String.class, ""),
- CONTROL_NOBSMIN("coser.control.nobsmin", t("coser.config.control.nobsmin.description"), "1.0"),
- CONTROL_DIFF_CATCH_LENGTH("coser.control.diffcatchlength", t("coser.config.control.diffcatchlength.description"), "5.0"),
- CONTROL_TYPE_FISH("coser.control.typeFish", t("coser.config.control.typeFish.description"), "Pisces + Agnatha"),
- CONTROL_STANDARD_DEVIATION_TO_AVERAGE("coser.control.standarddeviationtoaverage", t("coser.config.control.standarddeviationtoaverage.description"), "3"),
- SELECTION_FILTER_OCCURRENCE("coser.selection.occurrenceFilter", t("coser.config.selection.occurrenceFilter.description"), "5.0"),
- SELECTION_FILTER_DENSITY("coser.selection.densityFilter", t("coser.config.selection.densityFilter.description"), "5.0"),
+ CONTROL_NOBSMIN("coser.control.nobsmin", t("coser.config.control.nobsmin.description"), Float.class, "1.0"),
+ CONTROL_DIFF_CATCH_LENGTH("coser.control.diffcatchlength", t("coser.config.control.diffcatchlength.description"), Float.class, "5.0"),
+ CONTROL_TYPE_FISH("coser.control.typeFish", t("coser.config.control.typeFish.description"), String.class, "Pisces + Agnatha"),
+ CONTROL_STANDARD_DEVIATION_TO_AVERAGE("coser.control.standarddeviationtoaverage", t("coser.config.control.standarddeviationtoaverage.description"), Integer.class, "3"),
+ SELECTION_FILTER_OCCURRENCE("coser.selection.occurrenceFilter", t("coser.config.selection.occurrenceFilter.description"),Float.class , "5.0"),
+ SELECTION_FILTER_DENSITY("coser.selection.densityFilter", t("coser.config.selection.densityFilter.description"), Float.class, "5.0"),
/** Client side. */
- WEB_FRONT_END("coser.web.frontend", t("coser.config.web.frontend.description"), "http://www.ifremer.fr/SIH-indices-campagnes"),
- WEB_UPLOAD_URL("coser.web.uploadurl", t("coser.config.web.uploadurl.description"), "${" + WEB_FRONT_END.key + "}/upload-result.action"),
+ WEB_FRONT_END("coser.web.frontend", t("coser.config.web.frontend.description"), URL.class, "http://www.ifremer.fr/SIH-indices-campagnes"),
+ WEB_UPLOAD_URL("coser.web.uploadurl", t("coser.config.web.uploadurl.description"), URL.class, "${" + WEB_FRONT_END.key + "}/upload-result.action"),
/** Server side. */
- WEB_PROPERTIES_FILE("coser.web.properties.file", t("coser.config.web.properties.file.description"), "${" + DATABASE_DIRECTORY.key + "}" + File.separator + "web.properties"),
- WEB_INDICATORS_PROJECTS_DIRECTORY("coser.web.indicators.projects.directory", t("coser.config.web.indicators.projects.directory.description"), "${" + DATABASE_DIRECTORY.key + "}" + File.separator + "webindicatorsprojects"),
- WEB_MAPS_PROJECTS_DIRECTORY("coser.web.maps.projects.directory", t("coser.config.web.maps.projects.directory.description"), "${" + DATABASE_DIRECTORY.key + "}" + File.separator + "webmapsprojects"),
- WEB_ECHOBASE_PROJECTS_DIRECTORY("coser.web.echobase.projects.directory", t("coser.config.web.echobase.projects.directory.description"), "${" + DATABASE_DIRECTORY.key + "}" + File.separator + "webechobaseprojects"),
- WEB_INDICATORS("coser.web.indicators.file", t("coser.config.web.indicators.file.description"), "${" + DATABASE_DIRECTORY.key + "}" + File.separator + "webindicators.csv"),
- WEB_ZONES("coser.web.zones.file", t("coser.config.web.zones.file.description"), "${" + DATABASE_DIRECTORY.key + "}" + File.separator + "webzones.csv"),
- WEB_PUBLICATION_EMAIL("coser.web.newresult.emails", t("coser.config.web.newresult.emails.description"), null);
+ WEB_PROPERTIES_FILE("coser.web.properties.file", t("coser.config.web.properties.file.description"), File.class, "${" + DATABASE_DIRECTORY.key + "}" + File.separator + "web.properties"),
+ WEB_INDICATORS_PROJECTS_DIRECTORY("coser.web.indicators.projects.directory", t("coser.config.web.indicators.projects.directory.description"), File.class, "${" + DATABASE_DIRECTORY.key + "}" + File.separator + "webindicatorsprojects"),
+ WEB_MAPS_PROJECTS_DIRECTORY("coser.web.maps.projects.directory", t("coser.config.web.maps.projects.directory.description"), File.class, "${" + DATABASE_DIRECTORY.key + "}" + File.separator + "webmapsprojects"),
+ WEB_ECHOBASE_PROJECTS_DIRECTORY("coser.web.echobase.projects.directory", t("coser.config.web.echobase.projects.directory.description"), File.class, "${" + DATABASE_DIRECTORY.key + "}" + File.separator + "webechobaseprojects"),
+ WEB_INDICATORS("coser.web.indicators.file", t("coser.config.web.indicators.file.description"), File.class, "${" + DATABASE_DIRECTORY.key + "}" + File.separator + "webindicators.csv"),
+ WEB_ZONES("coser.web.zones.file", t("coser.config.web.zones.file.description"), File.class, "${" + DATABASE_DIRECTORY.key + "}" + File.separator + "webzones.csv"),
+ WEB_PUBLICATION_EMAIL("coser.web.newresult.emails", t("coser.config.web.newresult.emails.description"), String.class, null);
- protected String key;
- protected String description;
- protected String defaultValue;
+ private final String key;
+ private final String description;
+ private final String defaultValue;
+ private final Class<?> type;
- private CoserBusinessOption(String key, String description, String defaultValue) {
+ private CoserBusinessOption(String key, String description, Class<?> type, String defaultValue) {
this.key = key;
this.description = description;
+ this.type = type;
this.defaultValue = defaultValue;
}
@@ -322,8 +366,7 @@
@Override
public Class<?> getType() {
- //FIXME use it soon...
- return null;
+ return type;
}
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 2014-03-09 06:34:41 UTC (rev 1139)
+++ trunk/coser-business/src/main/resources/i18n/coser-business_en_GB.properties 2014-03-10 10:23:18 UTC (rev 1140)
@@ -101,6 +101,7 @@
coser.business.control.step.lengthoutliers=Searching for aberrants lengths \: %s (%d%%)
coser.business.control.step.observation=Checking observation number \: %s (%d%%)
coser.business.control.step.xworks=Line checks \: %s (%d%%)
+coser.business.dataDisclaimer.filename=DataDisclaimer.pdf
coser.business.extract.creationdate=Creation date \:
coser.business.extract.extractdata=Data
coser.business.extract.extracttitle=Extract
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 2014-03-09 06:34:41 UTC (rev 1139)
+++ trunk/coser-business/src/main/resources/i18n/coser-business_fr_FR.properties 2014-03-10 10:23:18 UTC (rev 1140)
@@ -101,6 +101,7 @@
coser.business.control.step.lengthoutliers=Recherche des longueurs abérrantes \: %s (%d%%)
coser.business.control.step.observation=Vérification du nombre d'observation \: %s (%d%%)
coser.business.control.step.xworks=Validation par lignes \: %s (%d%%)
+coser.business.dataDisclaimer.filename=DechargeDonnees.pdf
coser.business.extract.creationdate=Date de création \:
coser.business.extract.extractdata=Données du graphique
coser.business.extract.extracttitle=Extraction
Added: trunk/coser-business/src/site/site_en.xml
===================================================================
--- trunk/coser-business/src/site/site_en.xml (rev 0)
+++ trunk/coser-business/src/site/site_en.xml 2014-03-10 10:23:18 UTC (rev 1140)
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ #%L
+ Coser :: Business
+ %%
+ Copyright (C) 2010 - 2014 Ifremer, Codelutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Lesser Public License for more details.
+
+ You should have received a copy of the GNU General Lesser Public
+ License along with this program. If not, see
+ <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ #L%
+ -->
+
+
+<project name="${project.name}" xmlns="http://maven.apache.org/DECORATION/1.3.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/DECORATION/1.3.0 http://maven.apache.org/xsd/decoration-1.3.0.xsd">
+
+ <body>
+
+ <head>
+ <script type="text/javascript"
+ src="${mavenpomSiteCommonResourcesUrl}/js/mavenpom-site.js">
+ </script>
+
+ <link rel="stylesheet" type="text/css"
+ href="${mavenpomSiteCommonResourcesUrl}/css/mavenpom-site.css"/>
+ </head>
+
+ <breadcrumbs>
+ <item name="${project.name}" href="./index.html"/>
+ </breadcrumbs>
+
+ <menu name="Langue">
+ <item name="Version Française" href="./index.html"/>
+ <item name="English Version" href="../fr/index.html"/>
+ </menu>
+
+ <menu ref="parent"/>
+
+ <menu ref="reports"/>
+
+ <footer>
+
+ <div id='projectMetas'
+ projectversion='${project.version}'
+ platform='${project.platform}'
+ projectid='${project.projectId}'
+ scm='${project.scm.developerConnection}'
+ scmwebeditorenabled='${project.scmwebeditorEnabled}'
+ scmwebeditorurl='${project.scmwebeditorUrl}'
+ siteSourcesType='${project.siteSourcesType}'
+ piwikEnabled='${project.piwikEnabled}'
+ piwikId='${project.piwikId}'
+ locale='en'
+ scmwebeditor_skipDefaultFiles="true">
+ </div>
+ </footer>
+ </body>
+</project>
Property changes on: trunk/coser-business/src/site/site_en.xml
___________________________________________________________________
Added: svn:mime-type
+ text/xml
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/coser-business/src/site/site_fr.xml
===================================================================
--- trunk/coser-business/src/site/site_fr.xml (rev 0)
+++ trunk/coser-business/src/site/site_fr.xml 2014-03-10 10:23:18 UTC (rev 1140)
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ #%L
+ Coser :: Business
+ %%
+ Copyright (C) 2010 - 2014 Ifremer, Codelutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Lesser Public License for more details.
+
+ You should have received a copy of the GNU General Lesser Public
+ License along with this program. If not, see
+ <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ #L%
+ -->
+
+
+<project name="${project.name}" xmlns="http://maven.apache.org/DECORATION/1.3.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/DECORATION/1.3.0 http://maven.apache.org/xsd/decoration-1.3.0.xsd">
+
+ <body>
+
+ <head>
+ <script type="text/javascript"
+ src="${mavenpomSiteCommonResourcesUrl}/js/mavenpom-site.js">
+ </script>
+
+ <link rel="stylesheet" type="text/css"
+ href="${mavenpomSiteCommonResourcesUrl}/css/mavenpom-site.css"/>
+ </head>
+
+ <breadcrumbs>
+ <item name="${project.name}" href="./index.html"/>
+ </breadcrumbs>
+
+ <menu name="Langue">
+ <item name="Version Française" href="./index.html"/>
+ <item name="English Version" href="./en/index.html"/>
+ </menu>
+
+ <menu ref="parent"/>
+
+ <menu ref="reports"/>
+
+ <footer>
+
+ <div id='projectMetas'
+ projectversion='${project.version}'
+ platform='${project.platform}'
+ projectid='${project.projectId}'
+ scm='${project.scm.developerConnection}'
+ scmwebeditorenabled='${project.scmwebeditorEnabled}'
+ scmwebeditorurl='${project.scmwebeditorUrl}'
+ siteSourcesType='${project.siteSourcesType}'
+ piwikEnabled='${project.piwikEnabled}'
+ piwikId='${project.piwikId}'
+ locale='fr'
+ scmwebeditor_skipDefaultFiles="true">
+ </div>
+ </footer>
+ </body>
+</project>
Property changes on: trunk/coser-business/src/site/site_fr.xml
___________________________________________________________________
Added: svn:mime-type
+ text/xml
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/coser-ui/pom.xml
===================================================================
--- trunk/coser-ui/pom.xml 2014-03-09 06:34:41 UTC (rev 1139)
+++ trunk/coser-ui/pom.xml 2014-03-10 10:23:18 UTC (rev 1140)
@@ -25,7 +25,10 @@
<properties>
<maven.jar.main.class>fr.ifremer.coser.Coser</maven.jar.main.class>
<license.licenseName>gpl_v3</license.licenseName>
-
+
+ <!-- i18n configuration -->
+ <i18n.bundleOutputName>${coserI18nBundle}</i18n.bundleOutputName>
+
<redmine.releaseFiles>target/coser-${project.version}-bin.zip</redmine.releaseFiles>
</properties>
@@ -224,6 +227,7 @@
<executions>
<execution>
<id>copy-dependencies</id>
+ <phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
@@ -401,5 +405,50 @@
</plugins>
</reporting>
</profile>
+
+ <profile>
+ <id>reporting</id>
+ <activation>
+ <property>
+ <name>performRelease</name>
+ <value>true</value>
+ </property>
+ </activation>
+
+ <reporting>
+ <plugins>
+
+ <plugin>
+ <artifactId>maven-project-info-reports-plugin</artifactId>
+ <version>${projectInfoReportsPluginVersion}</version>
+ <reportSets>
+ <reportSet>
+ <reports>
+ <report>index</report>
+ </reports>
+ </reportSet>
+ </reportSets>
+ </plugin>
+
+ <plugin>
+ <groupId>org.nuiton</groupId>
+ <artifactId>nuiton-maven-report-plugin</artifactId>
+ <version>${nuitonReportPluginVersion}</version>
+ <reportSets>
+ <reportSet>
+ <reports>
+ <report>config-report</report>
+ </reports>
+ </reportSet>
+ </reportSets>
+ <configuration>
+ <i18nBundleName>${coserI18nBundle}</i18nBundleName>
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </reporting>
+
+ </profile>
</profiles>
</project>
Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/Coser.java
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/Coser.java 2014-03-09 06:34:41 UTC (rev 1139)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/Coser.java 2014-03-10 10:23:18 UTC (rev 1140)
@@ -97,8 +97,11 @@
// to work in java webstart
try {
- I18n.init(new DefaultI18nInitializer("coser-ui-i18n"), coserConfig.getLocale());
+ I18n.init(new DefaultI18nInitializer("coser-i18n"), coserConfig.getLocale());
} catch (RuntimeException ex) {
+ if (log.isErrorEnabled()) {
+ log.error("Could not load coser i18n bundle", ex);
+ }
// fallback for dev mode
I18n.init(new ClassPathI18nInitializer(), coserConfig.getLocale());
}
Modified: trunk/coser-ui/src/main/java/fr/ifremer/coser/CoserConfig.java
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/CoserConfig.java 2014-03-09 06:34:41 UTC (rev 1139)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/CoserConfig.java 2014-03-10 10:23:18 UTC (rev 1140)
@@ -2,7 +2,7 @@
* #%L
* Coser :: UI
* %%
- * Copyright (C) 2010 - 2011 Ifremer, Codelutin, Chatellier Eric
+ * Copyright (C) 2010 - 2011 Ifremer, Codelutin, Chatellier Eric, Chemit Tony
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
@@ -22,26 +22,24 @@
package fr.ifremer.coser;
-import static org.nuiton.i18n.I18n.t;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.config.ConfigOptionDef;
-import java.awt.Font;
-import java.util.Enumeration;
-
import javax.swing.UIManager;
import javax.swing.plaf.FontUIResource;
+import java.awt.Font;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.nuiton.config.ConfigOptionDef;
+import static org.nuiton.i18n.I18n.t;
/**
* Coser application configuration.
- *
+ *
* @author chatellier
* @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
+ * <p/>
+ * Last update : $Date$
+ * By : $Author$
*/
public class CoserConfig extends CoserBusinessConfig {
@@ -49,11 +47,7 @@
public CoserConfig() {
// init configuration with default options
- for (CoserOption o : CoserOption.values()) {
- if (o.defaultValue != null) {
- setDefaultOption(o.key, o.defaultValue);
- }
- }
+ loadDefaultOptions(CoserOption.values());
}
public String getLookAndFeel() {
@@ -106,14 +100,24 @@
WEBSITE_URL("coser.website", t("coser.config.website.description"), "https://doc.codelutin.com/coser/", String.class, false, false),
SWING_FONT_SIZE("coser.swingfontsize", t("coser.config.swingfontsize.description"), "12", Integer.class, false, false);
- protected String key;
- protected String description;
- protected String defaultValue;
- protected Class<?> type;
- protected boolean isTransient;
- protected boolean isFinal;
+ private final String key;
- private CoserOption(String key, String description, String defaultValue, Class<?> type, boolean isTransient, boolean isFinal) {
+ private final String description;
+
+ private final String defaultValue;
+
+ private final Class<?> type;
+
+ private final boolean isTransient;
+
+ private final boolean isFinal;
+
+ private CoserOption(String key,
+ String description,
+ String defaultValue,
+ Class<?> type,
+ boolean isTransient,
+ boolean isFinal) {
this.key = key;
this.description = description;
this.defaultValue = defaultValue;
@@ -154,17 +158,17 @@
@Override
public void setDefaultValue(String defaultValue) {
- this.defaultValue = defaultValue;
+ // not used
}
@Override
public void setTransient(boolean isTransient) {
- this.isTransient = isTransient;
+ // not used
}
@Override
public void setFinal(boolean isFinal) {
- this.isFinal = isFinal;
+ // not used
}
}
@@ -177,21 +181,19 @@
/**
* Update swing fonts properties.
- *
+ *
* @param newIncrease increase gap to apply to font
*/
protected void updateSwingFont(int newIncrease) {
// update all font properties
- Enumeration<Object> keys = UIManager.getDefaults().keys();
- while (keys.hasMoreElements()) {
- Object key = keys.nextElement();
+ for (Object key : UIManager.getDefaults().keySet()) {
// Application.useSystemFontSettings exists on windows
if (key.toString().endsWith("Font") || key.toString().endsWith(".font")) {
- Font font = (Font)UIManager.getFont(key);
+ Font font = UIManager.getFont(key);
if (log.isDebugEnabled()) {
log.debug("Update " + key + " to size " + newIncrease);
}
- font = font.deriveFont((float)newIncrease);
+ font = font.deriveFont((float) newIncrease);
UIManager.put(key, new FontUIResource(font));
}
}
Added: trunk/coser-ui/src/main/java/fr/ifremer/coser/CoserConfigProvider.java
===================================================================
--- trunk/coser-ui/src/main/java/fr/ifremer/coser/CoserConfigProvider.java (rev 0)
+++ trunk/coser-ui/src/main/java/fr/ifremer/coser/CoserConfigProvider.java 2014-03-10 10:23:18 UTC (rev 1140)
@@ -0,0 +1,64 @@
+package fr.ifremer.coser;
+
+/*
+ * #%L
+ * Coser :: UI
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin
+ * %%
+ * 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%
+ */
+
+import com.google.common.collect.Lists;
+import org.nuiton.config.ApplicationConfigProvider;
+import org.nuiton.config.ConfigActionDef;
+import org.nuiton.config.ConfigOptionDef;
+
+import java.util.List;
+import java.util.Locale;
+
+import static org.nuiton.i18n.I18n.l;
+
+/**
+ * To generate configuration report.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class CoserConfigProvider implements ApplicationConfigProvider {
+
+ @Override
+ public String getName() {
+ return "coserClient";
+ }
+
+ @Override
+ public String getDescription(Locale locale) {
+ return l(locale, "coser.config.coserClient.configuration.description");
+ }
+
+ @Override
+ public ConfigOptionDef[] getOptions() {
+ List<ConfigOptionDef> options = Lists.<ConfigOptionDef>newArrayList(CoserConfig.CoserOption.values());
+ options.addAll(Lists.newArrayList(CoserBusinessConfig.CoserBusinessOption.values()));
+ return options.toArray(new ConfigOptionDef[options.size()]);
+ }
+
+ @Override
+ public ConfigActionDef[] getActions() {
+ return new ConfigActionDef[0];
+ }
+}
Property changes on: trunk/coser-ui/src/main/java/fr/ifremer/coser/CoserConfigProvider.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/coser-ui/src/main/resources/META-INF/services/org.nuiton.config.ApplicationConfigProvider
===================================================================
--- trunk/coser-ui/src/main/resources/META-INF/services/org.nuiton.config.ApplicationConfigProvider (rev 0)
+++ trunk/coser-ui/src/main/resources/META-INF/services/org.nuiton.config.ApplicationConfigProvider 2014-03-10 10:23:18 UTC (rev 1140)
@@ -0,0 +1 @@
+fr.ifremer.coser.CoserConfigProvider
\ No newline at end of file
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 2014-03-09 06:34:41 UTC (rev 1139)
+++ trunk/coser-ui/src/main/resources/i18n/coser-ui_en_GB.properties 2014-03-10 10:23:18 UTC (rev 1140)
@@ -1,5 +1,6 @@
coser.config.application.version.description=Application's version
coser.config.config.file.description=Coser configuration file
+coser.config.coserClient.configuration.description=Coser client's configuration
coser.config.lookandfeel.description=Application's swing theme
coser.config.support.email.description=Support email address
coser.config.swingfontsize.description=Application fonts size
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 2014-03-09 06:34:41 UTC (rev 1139)
+++ trunk/coser-ui/src/main/resources/i18n/coser-ui_fr_FR.properties 2014-03-10 10:23:18 UTC (rev 1140)
@@ -1,5 +1,6 @@
coser.config.application.version.description=Version de l'application
coser.config.config.file.description=Fichier de configuration de Coser
+coser.config.coserClient.configuration.description=Configuration de Coser-Client
coser.config.lookandfeel.description=Themes graphique Swing de l'application
coser.config.support.email.description=Adresse de support pour l'envoi des erreurs
coser.config.swingfontsize.description=Taille de la police
Added: trunk/coser-ui/src/site/site_en.xml
===================================================================
--- trunk/coser-ui/src/site/site_en.xml (rev 0)
+++ trunk/coser-ui/src/site/site_en.xml 2014-03-10 10:23:18 UTC (rev 1140)
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ #%L
+ Coser :: UI
+ %%
+ Copyright (C) 2010 - 2014 Ifremer, Codelutin
+ %%
+ 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%
+ -->
+
+
+<project name="${project.name}" xmlns="http://maven.apache.org/DECORATION/1.3.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/DECORATION/1.3.0 http://maven.apache.org/xsd/decoration-1.3.0.xsd">
+
+ <body>
+
+ <head>
+ <script type="text/javascript"
+ src="${mavenpomSiteCommonResourcesUrl}/js/mavenpom-site.js">
+ </script>
+
+ <link rel="stylesheet" type="text/css"
+ href="${mavenpomSiteCommonResourcesUrl}/css/mavenpom-site.css"/>
+ </head>
+
+ <breadcrumbs>
+ <item name="${project.name}" href="./index.html"/>
+ </breadcrumbs>
+
+ <menu ref="parent"/>
+
+ <menu name="Documentation">
+ <item name="Home" href="index.html" />
+ <item name="Configuration" href="application-config-report.html" />
+ </menu>
+
+ <menu ref="reports"/>
+
+ <footer>
+
+ <div id='projectMetas'
+ projectversion='${project.version}'
+ platform='${project.platform}'
+ projectid='${project.projectId}'
+ scm='${project.scm.developerConnection}'
+ scmwebeditorenabled='${project.scmwebeditorEnabled}'
+ scmwebeditorurl='${project.scmwebeditorUrl}'
+ siteSourcesType='${project.siteSourcesType}'
+ piwikEnabled='${project.piwikEnabled}'
+ piwikId='${project.piwikId}'
+ locale='en'
+ scmwebeditor_skipDefaultFiles="true">
+ </div>
+ </footer>
+ </body>
+</project>
Property changes on: trunk/coser-ui/src/site/site_en.xml
___________________________________________________________________
Added: svn:mime-type
+ text/xml
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/coser-ui/src/site/site_fr.xml
===================================================================
--- trunk/coser-ui/src/site/site_fr.xml (rev 0)
+++ trunk/coser-ui/src/site/site_fr.xml 2014-03-10 10:23:18 UTC (rev 1140)
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ #%L
+ Coser :: UI
+ %%
+ Copyright (C) 2010 - 2014 Ifremer, Codelutin
+ %%
+ 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%
+ -->
+
+
+<project name="${project.name}" xmlns="http://maven.apache.org/DECORATION/1.3.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/DECORATION/1.3.0 http://maven.apache.org/xsd/decoration-1.3.0.xsd">
+
+ <body>
+
+ <head>
+ <script type="text/javascript"
+ src="${mavenpomSiteCommonResourcesUrl}/js/mavenpom-site.js">
+ </script>
+
+ <link rel="stylesheet" type="text/css"
+ href="${mavenpomSiteCommonResourcesUrl}/css/mavenpom-site.css"/>
+ </head>
+
+ <breadcrumbs>
+ <item name="${project.name}" href="./index.html"/>
+ </breadcrumbs>
+
+ <menu ref="parent"/>
+
+ <menu name="Documentation">
+ <item name="Accueil" href="index.html" />
+ <item name="Configuration" href="application-config-report.html" />
+ </menu>
+
+ <menu ref="reports"/>
+
+ <footer>
+
+ <div id='projectMetas'
+ projectversion='${project.version}'
+ platform='${project.platform}'
+ projectid='${project.projectId}'
+ scm='${project.scm.developerConnection}'
+ scmwebeditorenabled='${project.scmwebeditorEnabled}'
+ scmwebeditorurl='${project.scmwebeditorUrl}'
+ siteSourcesType='${project.siteSourcesType}'
+ piwikEnabled='${project.piwikEnabled}'
+ piwikId='${project.piwikId}'
+ locale='fr'
+ scmwebeditor_skipDefaultFiles="true">
+ </div>
+ </footer>
+ </body>
+</project>
Property changes on: trunk/coser-ui/src/site/site_fr.xml
___________________________________________________________________
Added: svn:mime-type
+ text/xml
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/coser-web/pom.xml
===================================================================
--- trunk/coser-web/pom.xml 2014-03-09 06:34:41 UTC (rev 1139)
+++ trunk/coser-web/pom.xml 2014-03-10 10:23:18 UTC (rev 1140)
@@ -25,8 +25,13 @@
<properties>
<license.licenseName>agpl_v3</license.licenseName>
<redmine.releaseFiles>target/coser-${project.version}.war</redmine.releaseFiles>
- <deployFiles>target/coser-${project.version}.war</deployFiles>
+ <!-- dev Mode (pass to false at release time) -->
+ <devMode>true</devMode>
+
+ <!-- i18n configuration -->
+ <i18n.bundleOutputName>${coserI18nBundle}</i18n.bundleOutputName>
+
<!-- Post Release configuration -->
<skipPostRelease>false</skipPostRelease>
</properties>
@@ -56,6 +61,10 @@
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.nuiton</groupId>
<artifactId>nuiton-utils</artifactId>
</dependency>
@@ -67,6 +76,10 @@
<groupId>org.nuiton.i18n</groupId>
<artifactId>nuiton-i18n</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.nuiton.web</groupId>
+ <artifactId>nuiton-struts2</artifactId>
+ </dependency>
<dependency>
<groupId>org.apache.struts.xwork</groupId>
<artifactId>xwork-core</artifactId>
@@ -113,14 +126,100 @@
<artifactId>i18n-maven-plugin</artifactId>
<executions>
<execution>
+ <id>parseJsp</id>
<goals>
+ <goal>parserStruts2</goal>
+ </goals>
+ <configuration>
+ <acceptKeyFormat>^message\..*$</acceptKeyFormat>
+ </configuration>
+ </execution>
+ <execution>
+ <id>parseOthersAndGen</id>
+ <goals>
+ <goal>parserValidation</goal>
<goal>parserJava</goal>
<goal>gen</goal>
</goals>
+ <configuration>
+ <userRulesFiles>
+ <file>${basedir}/src/main/validationRules.txt</file>
+ </userRulesFiles>
+ </configuration>
</execution>
+ <execution>
+ <id>bundle</id>
+ <goals>
+ <goal>bundle</goal>
+ </goals>
+ <configuration>
+ <showEmpty>true</showEmpty>
+ </configuration>
+ </execution>
</executions>
</plugin>
</plugins>
</build>
+ <profiles>
+ <profile>
+ <id>release-profile</id>
+ <activation>
+ <property>
+ <name>performRelease</name>
+ <value>true</value>
+ </property>
+ </activation>
+ <properties>
+ <devMode>false</devMode>
+ </properties>
+ </profile>
+
+ <profile>
+ <id>reporting</id>
+ <activation>
+ <property>
+ <name>performRelease</name>
+ <value>true</value>
+ </property>
+ </activation>
+
+ <reporting>
+ <plugins>
+
+ <plugin>
+ <artifactId>maven-project-info-reports-plugin</artifactId>
+ <version>${projectInfoReportsPluginVersion}</version>
+ <reportSets>
+ <reportSet>
+ <reports>
+ <report>index</report>
+ </reports>
+ </reportSet>
+ </reportSets>
+ </plugin>
+
+ <plugin>
+ <groupId>org.nuiton</groupId>
+ <artifactId>nuiton-maven-report-plugin</artifactId>
+ <version>${nuitonReportPluginVersion}</version>
+ <reportSets>
+ <reportSet>
+ <reports>
+ <report>config-report</report>
+ </reports>
+ </reportSet>
+ </reportSets>
+ <configuration>
+ <i18nBundleName>${coserI18nBundle}</i18nBundleName>
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </reporting>
+
+ </profile>
+
+ </profiles>
+
</project>
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 2014-03-09 06:34:41 UTC (rev 1139)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/CoserWebConfig.java 2014-03-10 10:23:18 UTC (rev 1140)
@@ -21,30 +21,26 @@
package fr.ifremer.coser.web;
-import static org.nuiton.i18n.I18n.t;
-
import fr.ifremer.coser.CoserBusinessConfig;
import org.nuiton.config.ConfigOptionDef;
+import org.nuiton.util.Version;
+import static org.nuiton.i18n.I18n.t;
+
/**
* Coser web configuration.
- *
+ *
* @author chatellier
* @version $Revision$
- *
- * Last update : $Date$
- * By : $Author$
+ * <p/>
+ * Last update : $Date$
+ * By : $Author$
*/
public class CoserWebConfig extends CoserBusinessConfig {
public CoserWebConfig() {
// init configuration with default options
loadDefaultOptions(CoserWebOption.values());
-// for (CoserWebOption o : CoserWebOption.values()) {
-// if (o.defaultValue != null) {
-// setDefaultOption(o.key, o.defaultValue);
-// }
-// }
}
public String getApplicationVersion() {
@@ -54,7 +50,7 @@
/**
* Get administrator email.
- *
+ *
* @return admin email
*/
public String getAdminEmail() {
@@ -64,7 +60,7 @@
/**
* Get admin login.
- *
+ *
* @return admin login
*/
public String getAdminLogin() {
@@ -74,7 +70,7 @@
/**
* Get admin password.
- *
+ *
* @return admin password
*/
public String getAdminPassword() {
@@ -84,7 +80,7 @@
/**
* Get analytics id.
- *
+ *
* @return analytics id
*/
public String getAnalyticsId() {
@@ -95,26 +91,31 @@
public enum CoserWebOption implements ConfigOptionDef {
/** Context name for multiple deployment. */
- CONTEXT_NAME(APP_NAME, null, "coser"),
+ CONTEXT_NAME(APP_NAME, null, String.class, "coser"),
// see : http://www.nuiton.org/issues/1862
- ENCODING_HACK(CONTEXT_NAME.getDefaultValue() + "." + CONFIG_ENCODING, null, "UTF-8"),
- CONFIG_FILE(CONTEXT_NAME.defaultValue + "." + CONFIG_FILE_NAME, t("coser.config.config.file.description"), "coserweb.properties"),
- APPLICATION_VERSION("coser.application.version", t("coser.config.application.version.description"), null),
- ADMIN_EMAIL("coser.admin.email", t("coser.config.config.file.description"), "harmonie(a)ifremer.fr"),
- ADMIN_LOGIN("coser.admin.login", t("coser.config.admin.login.description"), null),
- ADMIN_PASSWORD("coser.admin.password", t("coser.config.admin.password.description"), null),
- ANALYTICS_ID("coser.analytics.id", t("coser.config.analytics.id.description"), "UA-27739588-1");
+ ENCODING_HACK(CONTEXT_NAME.getDefaultValue() + "." + CONFIG_ENCODING, null, String.class, "UTF-8"),
+ CONFIG_FILE(CONTEXT_NAME.defaultValue + "." + CONFIG_FILE_NAME, t("coser.config.config.file.description"), String.class, "coserweb.properties"),
+ APPLICATION_VERSION("coser.application.version", t("coser.config.application.version.description"), Version.class, null),
+ ADMIN_EMAIL("coser.admin.email", t("coser.config.config.file.description"), String.class, "harmonie(a)ifremer.fr"),
+ ADMIN_LOGIN("coser.admin.login", t("coser.config.admin.login.description"), String.class, null),
+ ADMIN_PASSWORD("coser.admin.password", t("coser.config.admin.password.description"), String.class, null),
+ ANALYTICS_ID("coser.analytics.id", t("coser.config.analytics.id.description"), String.class, "UA-27739588-1");
- protected String key;
- protected String description;
- protected String defaultValue;
-
- private CoserWebOption(String key, String description, String defaultValue) {
+ private final String key;
+
+ private final String description;
+
+ private final String defaultValue;
+
+ private final Class<?> type;
+
+ private CoserWebOption(String key, String description, Class<?> type, String defaultValue) {
this.key = key;
this.description = description;
this.defaultValue = defaultValue;
+ this.type = type;
}
-
+
public String getDefaultValue() {
return defaultValue;
}
@@ -131,32 +132,30 @@
@Override
public void setDefaultValue(String defaultValue) {
-
+ // not used
}
@Override
public void setTransient(boolean isTransient) {
-
+ // not used
}
@Override
public void setFinal(boolean isFinal) {
-
+ // not used
}
public String getDescription() {
return description;
}
-
+
public String getKey() {
return key;
}
@Override
public Class<?> getType() {
- return null;
+ return type;
}
-
-
}
}
Added: trunk/coser-web/src/main/java/fr/ifremer/coser/web/CoserWebConfigProvider.java
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/CoserWebConfigProvider.java (rev 0)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/CoserWebConfigProvider.java 2014-03-10 10:23:18 UTC (rev 1140)
@@ -0,0 +1,64 @@
+package fr.ifremer.coser.web;
+
+/*
+ * #%L
+ * Coser :: Web
+ * %%
+ * Copyright (C) 2010 - 2014 Ifremer, Codelutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+import com.google.common.collect.Lists;
+import fr.ifremer.coser.CoserBusinessConfig;
+import org.nuiton.config.ApplicationConfigProvider;
+import org.nuiton.config.ConfigActionDef;
+import org.nuiton.config.ConfigOptionDef;
+
+import java.util.List;
+import java.util.Locale;
+
+import static org.nuiton.i18n.I18n.l;
+
+/**
+ * To generate configuration report.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.5
+ */
+public class CoserWebConfigProvider implements ApplicationConfigProvider {
+
+ @Override
+ public String getName() {
+ return "coserWeb";
+ }
+
+ @Override
+ public String getDescription(Locale locale) {
+ return l(locale, "coser.config.coserWeb.configuration.description");
+ }
+
+ @Override
+ public ConfigOptionDef[] getOptions() {
+ List<ConfigOptionDef> options = Lists.<ConfigOptionDef>newArrayList(CoserWebConfig.CoserWebOption.values());
+ options.addAll(Lists.newArrayList(CoserBusinessConfig.CoserBusinessOption.values()));
+ return options.toArray(new ConfigOptionDef[options.size()]);
+ }
+
+ @Override
+ public ConfigActionDef[] getActions() {
+ return new ConfigActionDef[0];
+ }
+}
Property changes on: trunk/coser-web/src/main/java/fr/ifremer/coser/web/CoserWebConfigProvider.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/coser-web/src/main/java/fr/ifremer/coser/web/ServiceHelper.java
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/ServiceHelper.java 2014-03-09 06:34:41 UTC (rev 1139)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/ServiceHelper.java 2014-03-10 10:23:18 UTC (rev 1140)
@@ -39,6 +39,7 @@
import org.apache.commons.logging.LogFactory;
import org.nuiton.config.ArgumentsParserException;
import org.nuiton.i18n.I18n;
+import org.nuiton.i18n.init.DefaultI18nInitializer;
import java.io.File;
import java.util.Date;
@@ -77,7 +78,7 @@
public static void init() {
// on a pas trop de locale là :(
- I18n.init(null, null);
+ I18n.init(new DefaultI18nInitializer("coser-i18n"), null);
config = new CoserWebConfig();
try {
@@ -308,11 +309,7 @@
// --------------------------------------------------------------------- //
public Date getLastDataUpdateDate() {
- try {
- return webService.getLastDataUpdateDate();
- } catch (CoserBusinessException e) {
- throw new CoserWebException("Can't get last update date", e);
- }
+ return getConfig().getLastDataUpdateDate();
}
public CoserWebConfig getConfig() {
Modified: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/common/CoserAction.java
===================================================================
--- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/common/CoserAction.java 2014-03-09 06:34:41 UTC (rev 1139)
+++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/common/CoserAction.java 2014-03-10 10:23:18 UTC (rev 1140)
@@ -21,10 +21,10 @@
package fr.ifremer.coser.web.actions.common;
-import com.opensymphony.xwork2.ActionSupport;
import fr.ifremer.coser.result.request.CoserRequestBuilder;
import fr.ifremer.coser.web.CoserWebConfig;
import fr.ifremer.coser.web.ServiceHelper;
+import org.nuiton.web.struts2.BaseAction;
/**
* Toutes les actions doivent étendre celle ci. Contient le code commun
@@ -37,7 +37,7 @@
* Last update : $Date$
* By : $Author$
*/
-public abstract class CoserAction extends ActionSupport {
+public abstract class CoserAction extends BaseAction {
/** serialVersionUID. */
private static final long serialVersionUID = 311574866032741326L;
Added: trunk/coser-web/src/main/resources/META-INF/services/org.nuiton.config.ApplicationConfigProvider
===================================================================
--- trunk/coser-web/src/main/resources/META-INF/services/org.nuiton.config.ApplicationConfigProvider (rev 0)
+++ trunk/coser-web/src/main/resources/META-INF/services/org.nuiton.config.ApplicationConfigProvider 2014-03-10 10:23:18 UTC (rev 1140)
@@ -0,0 +1 @@
+fr.ifremer.coser.web.CoserWebConfigProvider
\ No newline at end of file
Deleted: trunk/coser-web/src/main/resources/fr/ifremer/coser/web/package.properties
===================================================================
--- trunk/coser-web/src/main/resources/fr/ifremer/coser/web/package.properties 2014-03-09 06:34:41 UTC (rev 1139)
+++ trunk/coser-web/src/main/resources/fr/ifremer/coser/web/package.properties 2014-03-10 10:23:18 UTC (rev 1140)
@@ -1,210 +0,0 @@
-###
-# #%L
-# Coser :: Web
-# %%
-# Copyright (C) 2010 - 2012 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%
-###
-message.admin.title=Coser admin
-message.admin.indexaction=Administration actions
-message.admin.listprojects.deleteselected=Delete selected projects
-message.admin.listprojects.title=Projects management
-message.admin.listprojects.indicatorsprojects=Indicators projects by zones
-message.admin.listprojects.indicatorsprojects.comment=Removing an indicator project will also delete projet data source.
-message.admin.listprojects.mapsprojects=Maps projects by zones
-message.admin.login=Login
-message.admin.loginrequiered=Authentication required
-message.admin.password=Password
-message.com.downloadascsv=Download as CSV
-message.com.downloadaszip=Download as ZIP
-message.com.moredetailspdf=More information on calculated community indices
-message.com.paragraph1=Community indices are calculated for a list of species for each survey time series. The list of species included when calculating each index depends on the available data.
-message.com.paragraph2=The lists of species used for the calculations of community indices are given in the zip file "Information.pdf" (see the link "Download as ZIP" at the bottom of each graph).
-message.com.selectindicatorlist=Select a data list
-message.com.title=Community indices
-message.common.anchortop=Top
-message.common.community=community
-message.common.facade=Sea
-message.common.indicatorsof=Indicators of
-message.common.jsreadmore=Read more
-message.common.noresults=No results available
-message.common.population=population
-message.common.selectall=Select all
-message.common.selectnone=Unselect all
-message.common.selectfacade=Select an area
-message.common.selectindicator=Select an indicator
-message.common.selectpop=Select a population
-message.common.selectspecies=Select a species
-message.common.selectsurvey=Select a survey
-message.common.selectzone=Select an area
-message.common.species=Species
-message.common.validform=Valid
-message.common.zone=Zone
-message.common.zones=Zones
-message.common.datatypes=Data types
-message.documents.genparagraph1=Grands invert\u00E9br\u00E9s et poissons observ\u00E9s par les campagnes scientifiques. Atlas de distribution. Bilan 2008. 2009. {0}
-message.documents.genparagraph2=Grands invert\u00E9br\u00E9s et poissons observ\u00E9s par les campagnes scientifiques. Bilan 2007. 2009. {0}
-message.documents.genparagraph3=L''\u00E9tat des communaut\u00E9s exploit\u00E9es au large des c\u00F4tes de France. Application d''indicateurs \u00E0 l''\u00E9valuation de l''impact de la p\u00EAche. Bilan 2004 Edition 2009. {0}
-message.documents.genparagraph4=Poissons et invert\u00E9br\u00E9s au large des c\u00F4tes de France. Indicateurs issus des p\u00EAches scientifiques. Bilan 2004. 2007. {0}
-message.documents.gentitle1=Rapports g\u00E9n\u00E9raux
-message.documents.activityparagraph1=Battaglia A., V. M. Trenkel & M. J. Rochet, 2006. Estimating end effects in trawl catches. ICES J. Mar. Sci. 63: 956-959.
-message.documents.activityparagraph2=Lorance P., J. A. Bertrand, A. Brind''Amour, M. J. Rochet & V. Trenkel, 2009. Assessment of impacts from human activities on ecosystem components in the Bay of Biscay in the early 1990s. Aquatic living resources 22: 409-431.
-message.documents.activityparagraph3=Rochet M. J., M. Prigent, J. A. Bertrand, A. Carpentier, F. Coppin, J. P. Delpech, G. Fontenelle, E. Foucher, K. Mah\u00E9, E. Rostiaux & V. M. Trenkel, 2008. Ecosystem trends: evidence for agreement between fishers'' perceptions and scientific information. ICES J. Mar. Sci. 65: 1057-1068.
-message.documents.activityparagraph4=Rochet M. J. & J. Rice, 2005. Do explicit criteria help in selecting indicators for ecosystem-based fisheries management? ICES J. Mar. Sci. 62: 528-539.
-message.documents.activityparagraph5=Rochet M. J. & V. Trenkel, 2003. Which community indicators can measure the impact of fishing? A review and proposals. Can. J. Fish. Aquat. Sci. 60: 86-99.
-message.documents.activityparagraph6=Rochet M. J., V. M. Trenkel, R. Bellail, F. Coppin, O. Le Pape, J.-C. Mah\u00E9, A. Morin, J.-C. Poulard, I. Schlaich, A. Souplet, Y. V\u00E9rin & J. A. Bertrand, 2005. Combining indicator trends to assess ongoing changes in exploited fish communities: diagnostic of communities off the coasts of France. ICES Journal of Marine Science 62: 1647-1664.
-message.documents.activityparagraph7=Rochet M. J., V. M. Trenkel, A. Carpentier, F. Coppin, L. Gil de Sola Simarro, J. P. L\u00E9aut\u00E9, J. C. Mah\u00E9, P. Maiorano, A. Mannini, M. Murenu, G. Piet, C. Politou, B. Reale, M. T. Spedicato, G. Tserpes & J. A. Bertrand, 2010. Do changes in environmental pressures impact marine communities? An empirical assessment. J. Applied Ecology 47 (4): 741-750. Publisher''s official version : {0}, Open Access version : {1}
-message.documents.activityparagraph8=Trenkel V. & M. J. Rochet, 2003. Performance of indicators derived from abundance estimates for detecting the impact of fishing on a fish community. Can. J. Fish. Aquat. Sci. 60: 67-85.
-message.documents.activitytitle2=Publications des membres du GT relatives \u00E0 l''activit\u00E9 du groupe
-message.documents.indicatorparagraph1=Dreves L., C. Abernot-Le Gac, E. Antajan, P. Clabaut, P. Claquin, M.L. Cochard, P. Monbet, J. Morin, A. T\u00E9tard, C. Warenbourg & H. Thillaye du Boullay, 2010. Synth\u00E8se hydrobiologique du site \u00E9lectronucl\u00E9aire de Penly. Ifremer. DOP/LER/2010.05. 280 p.
-message.documents.indicatortitle3=Travaux ayant utilis\u00E9 les r\u00E9sultats du groupe de travail sur les indicateurs de populations et de peuplements
-message.documents.title=Documents
-message.index.datatypecom=Community indices by area
-message.index.datatypemap=Species distribution maps by area
-message.index.datatypepop=Population indices by species by area
-message.index.datatypesource=Raw data by sampling unit (generally by haul)
-message.index.datatypesource.short=Raw data by sampling unit
-message.index.datatypetitle=Viewing data online
-message.index.documentsmessage=Documents
-message.index.documentstitle=Documents
-message.index.extractdatatitle=Extract data
-message.index.extractdatalink=Search form
-message.index.paragraph1=This web site has been created to provide easy access to the raw data and index estimates derived from the scientific surveys carried out by Ifremer along the French coasts.
-message.index.paragraph2=All data made available have passed rigorous quality checks. However, as the reliability of results interpretations depends directly on the data used, users are cordially invited to study carefully the survey and quality check protocols.
-message.index.paragraph3=Each survey is carried out using a specific sampling design. Data analyses and interpretation of each time series must therefore take into account the sampling designs. The data are presented by survey series on the web site.
-message.index.paragraph4=The species codes used in the data tables are those of the taxinomic reference file of the Syst\u00E8me d''informations halieutiques de l''Ifremer ({0}).
-message.index.paragraph5=The link below allows you to extract the elements of the site (graphics and data) in the form of a .zip file (containing a pdf document and data)
-message.index.partnertitle=Group members
-message.index.partnerparagraph1=The results presented on this web site are the fruit of an internal Ifremer working group which has been active since 2001 with the objective of developing population and community indicators for the survey data collected since the end of the 1970s along the French coasts. The main group members are (by Ifremer location and in alphabetical order): Florence Sanchez (Anglet), Franck Coppin, Sandrine Vaz and Yves V\u00E9rin (Boulogne-sur-mer), Andr\u00E9 Battaglia and Jean-Pierre L\u00E9aut\u00E9 (L''Houmeau), Jean-Claude Mah\u00E9 and Mich\u00E8le Salaun (Lorient), Jacques Bertrand, Anik Brind''Amour, Yves D\u00E9saunay, Pascal Laffargue, Olivier Le Pape, J\u00E9r\u00E9my Lobry, Pascal Lorance, Jean-Charles Poulard, Marie-Jo\u00EBlle Rochet and Verena Trenkel (Nantes), Marie-Laure Cochard, Jocelyne Morin and Ivan Schlaich (Port-en-Bessin), Ang\u00E9lique Jadaud and Arnaud Souplet (S\u00E8te). The quality process is managed by Vincent Badts. The data-processing is supported by Olivier Berthel\u00E9.
-message.index.qualitymessage=Quality warning
-message.index.qualitytitle=Quality warning
-message.index.quotemessage=Ifremer {0,date,yyyy}. Population and community indices derived from scientific surveys carried out by Ifremer. {1} ({0,date,dd MMMM})
-message.index.quotetitle=How to cite this web site
-message.index.surveyparagraph=Survey protocol handbooks for each survey time series.
-message.index.surveytitle=Survey description
-message.index.thankstitle=Acknowledgements
-message.index.thanksparagraph1=All surveys presented on this web site were conducted by Ifremer and have received financial support from a variety of sources. After initially having been funded by Ifremer three of the surveys are now part of the European Data Collection Framework (DCF); this concerns IBTS, Evhoe and Medits. Two other surveys remain entirely funded by Ifremer: NourVil and CGFS (discussions to include this survey in the DCF are underway). For NourSein, the last three surveys were funded by GIP-Seine Aval. Finally, Crustaflam and NourSomme are entirely funded by EDF within a program of coastal monitoring of nuclear power plants and carried out by Ifremer. This web site has received the financial support of the French ministry for ecology, sustainable development, transport and housing (MEEDDM) (contract Ifremer-MEEDDM 2010). Pour calculating indices for the North Sea the data from all contributing nations was used; it is available in the Datras data base held by ICES (http://datras.ices.dk)
-message.index.title=Home
-message.layout.oceanicdata1=le Syst\u00E8me d''informations scientifiques pour la mer de l''Ifremer (SISMER)
-message.layout.oceanicdata2=the Fisheries Information System - Syst\u00E8me d''information halieutique de l''Ifremer (SIH)
-message.layout.oceanicdatatitle=Survey data management at Ifremer
-message.layout.title=Population and community indices derived from scientific surveys carried out by Ifremer.
-message.map.citation=Trenkel V.M., O. Berthel\u00E9, P. Lorance, J.A. Bertrand, A. Brind''Amour, M.L. Cochard, F. Coppin, J.P. Leaut\u00E9, J.C. Mah\u00E9, J. Morin, M.J. Rochet, M. Salaun, A. Souplet & Y. V\u00E9rin, 2009. Grands invert\u00E9br\u00E9s et poissons observ\u00E9s par les campagnes scientifiques. Atlas de distribution. Bilan 2008. Ifremer, Nantes. EMH : 09-003. {0}. 100 p.
-message.map.citationtitle=Citation
-message.map.downloadaspdf=Download as PDF
-message.map.linkarchimer=Access atlas : {0}
-message.map.paragraph1=The objectif of these maps is to provide a rough indication of the spatial distribution of certain fish and shelfish species as provided by scientific surveys.
-message.map.paragraph2=For each area a systematic grid was defined and the simple average density across years and hauls was calculated in numbers per km2. For mapping purposes, grid cells were coloured using a percentile scale: blue: species never observed, light yellow: average density between [0- 25\u00A0%[; dark yellow: [25-50\u00A0%[, orange\u00A0: [50-75\u00A0%[ and red\u00A0: [75-100\u00A0%]. Thus, cells with the highest average density are in red.
-message.map.title=Distribution maps
-message.map.warning=Warning
-message.map.warningcontent=The maps should not be interpreted as biological distribution maps but as the areas where the species are caught during the scientific surveys. As the different surveys use different samplin gear and are carried out at different times of the year, there can be differences in catchability among surveys and consequently among areas.
-message.pop.downloadascsv=Download as CSV
-message.pop.moredetailspdf=More details about computed population indices
-message.pop.paragraph1=The presented indices have been selected with respect to their capacity to inform on the impact of fishing and for integration into indicator dashboards for exploited ecosystems.
-message.pop.paragraph2=The data correspond to the value of each indicator. The information has been validated by an expert group within the framework of a holostic population and community indicator approach. The results are presented by geographic area or by species for all available data series. The user can select the geographic area, the season (for seasonal surveys), the species and the index. If data is available for a given selection, a figure is produced that shows the time series of the index, plus-minus one standard deviation. It is possible to extract the corresponding table with index values by year, standard deviations and coefficients of variation.
-message.pop.title=Population indices
-message.quality.acceptance=I acknowledge having read the documents and restrictions and I accept to cite the data source in all cases.
-message.quality.notaccepted=You must acknowledge having read the quality warning!
-message.quality.paragraph1=Despite careful data control carried out by Ifremer, inconcistencies inherent to the aggregation of the data might occur. For example\u00A0:
-message.quality.paragraph2=It is not recommended to simply combine data from different surveys in an analysis despite the fact that all data from all surveys are presented in the same format. For example, the catchability of the same species can vary with the survey gear used. As a consequence each survey provides a particular but coherent picture of the sampled ecosystem.
-message.quality.paragraph3=A common feature of survey time series is the change of taxonomic expertise over time. As a result new species can appear, disappear or similar species be confused thus biasing time trends of certain species.
-message.quality.paragraph4=For any given survey time series, any changes in the sampling procedure, gear, period and area covered might influence the catches. Therefore to avoid the risk of any bias in the analysis, the data must be carefully filtered before use.
-message.quality.paragraph5=It is strongly recommended to use the data with care. In the case of doubts about the validity of the data, please contact the administrator of the data base ({0}).
-message.quality.title=Quality warning
-message.search.extract.extract=Extract
-message.search.extract.speciesindicators=Indicators and species
-message.search.extract.title=Extract data
-message.search.extract.updatelists=Next
-message.search.extract.waittitle=Extracting data...
-message.search.extract.waitparagraph1=Data are being extracting. Please wait.
-message.search.extract.waitparagraph2=This operation take several minutes in the case of many graphics should be generated.
-message.search.extract.waitparagraph3=After downloading, close this page by returning to the home page of the site.
-message.search.extract.zonetype=Zone and data types
-message.source.download=Download
-message.source.paragraph1=The raw data are presented in four tables which contain the basic information by sampling unit (generally a haul) as well as the relevant information on the sampling design (strata). An additional table provides the latin names for the species codes used in the data files. Il s''agit des donn\u00E9es utilis\u00E9es pour r\u00E9aliser les calculs des indicateurs pr\u00E9sent\u00E9s. Ces donn\u00E9es ont fait l''objet de filtrages et de regroupements \u00E9ventuels par rapport aux donn\u00E9es de base de chaque s\u00E9rie, afin d''assurer la coh\u00E9rence des jeux de donn\u00E9es en vue du calcul des indicateurs. Ainsi, pour certaines s\u00E9ries, des groupes entiers (e.g. les amphihalins) ont pu \u00EAtre retir\u00E9s. Pour certaines s\u00E9ries, certaines ann\u00E9es ou certaines strates ont \u00E9t\u00E9 retir\u00E9es afin de pr\u00E9server l''homog\u00E9n\u00E9it\u00E9 de la s\u00E9rie. Dans des cas d''\u00E9volution du niveau de d\u00E9termination au cours de la s\u00E9rie, plusieurs taxons ont \u00E9t\u00E9 regroup\u00E9s \u00E0 un niveau sup\u00E9rieur.
-message.source.paragraph2=Les donn\u00E9es IBTS (donn\u00E9es fran\u00E7aises et donn\u00E9es des autres pays) issues de la base Datras du CIEM (http://datras.ices.dk) ont fait l''objet des m\u00EAmes contr\u00F4les de qualit\u00E9 que les autres s\u00E9ries de donn\u00E9es utilis\u00E9es, ainsi que de filtrages et de regroupements taxinomiques pour en pr\u00E9server la coh\u00E9rence vis-\u00E0-vis du pr\u00E9sent objectif de production d''indicateurs de tendances.
-message.source.paragraph3=The web site provides access to the raw data corresponding to the population and community indices presented. For any other data please contact the administrator of the Fisheries information system of Ifremer ({0}).
-message.source.paragraph4=The survey data consist of stations distributed in space following a stratified random design (which can be constant between years). The spatial resolution determines on which spatial scale population and community indices can be calculated.
-message.source.paragraph5=The list of proposed spatial areas includes the original sampling areas, plus post-stratified areas suitable for the European Marine Strategie Framework Directive. These areas have been validated by an internal Ifremer working group following sensitivity analyses.
-message.source.title=Raw data
-message.survey.atlantique.celtique.desc=The Evhoe suvey (Evaluation des ressources halieutiques de l''ouest europ\u00E9en) lasts one month in the fourth quarter every year since 1997. On average 75 half-hour hauls are carried out with a GOV trawl. Each haul covers about 0.067 km\u00B2. This survey provides a representative picture of the 150 000 km\u00B2 of the Celtic Sea.
-message.survey.atlantique.celtique.evhoe1=Manuel des protocoles EVHOE - Version 1.0 (2005)
-message.survey.atlantique.celtique.plus=For more information on the Evhoe surveys
-message.survey.atlantique.celtique=Celtic Sea
-message.survey.atlantique.gascogne.desc=The Evhoe survey (Evaluation des ressources halieutiques de l''ouest europ\u00E9en) lasts one month in the fourth quarter every year since 1992 (except 1993 and 1996). On average 70 half-hour hauls are carried out with a GOV trawl. Each haul covers about 0.067 km\u00B2. This survey provides a representative picture of the 72 500 km\u00B2 of the Bay of Biscay.
-message.survey.atlantique.gascogne.evhoe1=Manuel des protocoles EVHOE - Version 1.0 (2005)
-message.survey.atlantique.gascogne.plus=For more information on the Evhoe surveys
-message.survey.atlantique.gascogne=Bay of Biscay
-message.survey.atlantique.vilaine.desc=Survey in the nursery area of the Vilaine river bay (NourVil) lasted one week every year in autumn from 1980 \u00E0 2010, except 1991, 1994, 1995, 1998, 1999, 2006 and 2007. It used a 3m-beam trawl. On average 30 15-min hauls were carried out covering each about 0.0041 km\u00B2. This survey provides a representative picture of the 330 km\u00B2 of the Vilaine bay.
-message.survey.atlantique.vilaine.nourvil1=Manuel des protocoles Nourriceries Gascogne - V 1.0 (2002)
-message.survey.atlantique.vilaine.plus=For more information on the Nourvil survey
-message.survey.atlantique.vilaine=Vilaine river bay
-message.survey.atlantique=Northeast Atlantic
-message.survey.dataengincasier=Pots for the assessment of large crustaceans, in particular lobster, around Cap de Flamanville.
-message.survey.dataenginfond=Variants of a GOV (grande ouverture verticale) trawl for observing demersal species on the continental shelfs and upper slopes in the North Sea, Eastern English channel, Celtic Sea, Bay of Biscay, Gulf of Lions and East Corsica,
-message.survey.dataenginperche=A beam trawl for coastal zones and estuaries during surveys targeting juvenile flatfish: Somme and Vilaine river bays,
-message.survey.dataengintitle=Different sampling gears are used:
-message.survey.detailstitle=Characteristics of the surveys carried out by Ifremer
-message.survey.maintitle=Scientific surveys carried out by Ifremer
-message.survey.mancheoccidentale.flamanville.crustaflam1=Manuel des protocoles CRUSTAFLAM - Version 1.0 (2003)
-message.survey.mancheoccidentale.flamanville.desc=Two surveys of 15 jours each using pots around cap de Flamanville (CrustaFlam), in June and September, since 1986: 1200 sets per survey in an area covering 26 km\u00B2.
-message.survey.mancheoccidentale.flamanville.plus=For more information on the CrustFlam survey
-message.survey.mancheoccidentale.flamanville=Cap de Flamanville area
-message.survey.mancheoccidentale=Eastern English Channel
-message.survey.mancheorientale.baiedeseine=Seine river bay
-message.survey.mancheorientale.baiedeseine.desc=Yearly surveys carried on in the Seine estuary and the eastern bay of Seine (NourSeine), principally in autumn from 1995 to 2002. The main objective was to identify the coastal fish nurseries and to assess the fish and macro-benthos richness. About 45 hauls are done during each survey, using a standard beam trawl.
-message.survey.mancheorientale.baiedeseine.plus=For more information on the NourSeine survey
-message.survey.mancheorientale.baiedeseine.nourseine1=http://archimer.ifremer.fr/doc/00036/14714/
-message.survey.mancheorientale.baiedesomme.desc=The survey in the nursery area of the Somme rive bay (NourSomme) lasts one week in September-October each year since 1995, using a 2m-beam trawl in the estuary and a 3m-beam trawl in the more open areas. On average 50 hauls are carried out. Haul duration is 7 minutes covering 0.001 km\u00B2 in the estuary part and 15 minutes covering 0.004 km\u00B2 in the more open part. This survey provides a representative picture of the 720 km\u00B2 of the Somme baie.
-message.survey.mancheorientale.baiedesomme.noursomme1=Manuel des protocoles Nourriceries Somme - V 1.0 (2002)
-message.survey.mancheorientale.baiedesomme.plus=For more information on the NourSomme survey
-message.survey.mancheorientale.baiedesomme=Somme river bay
-message.survey.mancheorientale.mancheorientale.cgfs1=Manuel des protocoles CGFS - Version 1.0 (2002)
-message.survey.mancheorientale.mancheorientale.desc=French survey CGFS (Channel Ground Fish Survey) lasting one month and internationally coordonnated together with the IBTS survey. The survey takes place every year since 1988. On average 90 half hour hauls are carried out with a small GOV trawl. Each haul covers about 0.03 km\u00B2. This survey provides a representative picture of the 70 748 km\u00B2 of the Eastern English Channel.
-message.survey.mancheorientale.mancheorientale.plus=For more information on the CGFS survey
-message.survey.mancheorientale.mancheorientale=Eastern English Channel
-message.survey.mancheorientale=Eastern English Channel
-message.survey.mediterranee.estcorse.desc=French contribution to the internationally coordinated Medits (International bottom Trawl Surveys in the Mediterranean) survey, lasting one week in the second quarter every year since 1994 except 2002 using a GOV bottom trawl with short wings. On average 20 hauls are carried out; haul duration is half an hour above 200 m depth which corresponds to 0.05 km\u00B2 and one hour for bottom depths greater than 200 m (0.1\u00A0km\u00B2). Medits provides a representative picture of the 4 562 km\u00B2 of Eastern Corsican island plateau.
-message.survey.mediterranee.estcorse.medits1=Manuel des protocoles Medits, Version 1 (1994)
-message.survey.mediterranee.estcorse.medits2=Manuel des protocoles Medits, Version 2 (1995)
-message.survey.mediterranee.estcorse.medits3=Manuel des protocoles Medits, Version 3 (1999)
-message.survey.mediterranee.estcorse.medits4=Manuel des protocoles Medits, Version 4 (2001)
-message.survey.mediterranee.estcorse.medits5=Manuel des protocoles Medits, Version 5 (2007)
-message.survey.mediterranee.estcorse.medits6=Manuel des protocoles Medits, Version 6 (2012)
-message.survey.mediterranee.estcorse.plus=For more information on the Medits surveys
-message.survey.mediterranee.estcorse=East Corsica
-message.survey.mediterranee.golfelion.desc=French contribution to the internationally coordinated Medits (International bottom Trawl Surveys in the Mediterranean) survey, lasting one month in the second quarter every year since 1994 using a GOV bottom trawl with short wings. On average 69 hauls are carried out; haul duration is half an hour above 200 m depth which corresponds to 0.05 km\u00B2 and one hour for bottom depths greater than 200 m (0.1\u00A0km\u00B2). Medits provides a representative picture of the 13 860 km\u00B2 of the gulf of Lions.
-message.survey.mediterranee.golfelion.medits1=Manuel des protocoles Medits, Version 1 (1994)
-message.survey.mediterranee.golfelion.medits2=Manuel des protocoles Medits, Version 2 (1995)
-message.survey.mediterranee.golfelion.medits3=Manuel des protocoles Medits, Version 3 (1999)
-message.survey.mediterranee.golfelion.medits4=Manuel des protocoles Medits, Version 4 (2001)
-message.survey.mediterranee.golfelion.medits5=Manuel des protocoles Medits, Version 5 (2007)
-message.survey.mediterranee.golfelion.medits6=Manuel des protocoles Medits, Version 6 (2012)
-message.survey.mediterranee.golfelion.plus=For more information on the Medits surveys
-message.survey.mediterranee.golfelion=Gulf of Lions
-message.survey.mediterranee=Mediterranean Sea
-message.survey.merdunord.sudmerdunord.desc=Every years since 1980 France contributes one month of ship time to the IBTS (International Bottom Trawl Survey) in the first quarter using a GOV trawl. On average 58 hauls are carried out. The southern North Sea is sampled by four countries (France, Belgium, Danmark and Germany) who together carry out about 200 hauls per year. Each haul lasts half an hour corresponding to a swept area of about 0.067 km\u00B2. IBTS provides a representative picture of the 678\u00A0000\u00A0km\u00B2 of the area.
-message.survey.merdunord.sudmerdunord.ibts6=Manuel des protocoles IBTS - R\u00E9vision VI (1999)
-message.survey.merdunord.sudmerdunord.ibts7=Manuel des protocoles IBTS - R\u00E9vision VII (2004)
-message.survey.merdunord.sudmerdunord.plus=For more information on the IBTS survey
-message.survey.merdunord.sudmerdunord=Southern North Sea
-message.survey.merdunord=North Sea
-message.survey.paragraph1=The main objectif of the scientific fisheries surveys is to provide information on ressource changes, using a standard sampling protocol. They are always carried out in the same areas, at the same time of year and with the same gear, to allow comparisons among years. They provide information on both commercial and non-commercial species and their changes. Fish and shelfish species are counted, weighted and measured. For certain species other biological information is collected. Thus each survey provided a quantitive picture of the species assemblage in a given area during a certain time period. Additional information such as temperature, salinity, macrofauna, marin mammals, birds, macro waste etc. are collected during certain surveys, but this information is not presented here
-message.survey.paragraph2=For the last two decades Ifremer has organised scientific fisheries surveys in the North Sea, the English Channel, the Atlantic and in the Mediterrean Sea for sampling demersal and benthic ressources. The main objective is to produce abundance indices for the principal commercial species. The surveys collect also data for non-commercial species. Hence they contribute to the knowledge necessary for the development of an ecosystem approach to fisheries, in particular in the context of the common fisheries policy (CFP) and more generally the European marine strategy framework directive.
-message.survey.paragraph3=The surveys are carried out using standardised sampling designs. The gear and its rigging, station positions, sample treatment and biological sampling are carried out using fixed protocols.
-message.survey.paragraph4=Common protocols are used by all participants for surveys carried out under international coordination in the North Sea, Eastern English channel, Celtic Sea, Bay of Biscay and the Mediterranean Sea. The data collected by the different research vessels are therefore comparable.
-message.survey.paragraph5=Each survey area is subdivided in strata according to bottom depth, latitude or other criteria. The sampling protocol specifies the number of hauls or pots by stratum.
-message.survey.paragraph6=For each survey the station location is determined following the specified sampling design. The aim is not to obtain the largest catches as fishers might attempt to do, but to collect comparable data for detecting time trends.
\ No newline at end of file
Deleted: trunk/coser-web/src/main/resources/fr/ifremer/coser/web/package_en.properties
===================================================================
--- trunk/coser-web/src/main/resources/fr/ifremer/coser/web/package_en.properties 2014-03-09 06:34:41 UTC (rev 1139)
+++ trunk/coser-web/src/main/resources/fr/ifremer/coser/web/package_en.properties 2014-03-10 10:23:18 UTC (rev 1140)
@@ -1,210 +0,0 @@
-###
-# #%L
-# Coser :: Web
-# %%
-# Copyright (C) 2010 - 2012 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%
-###
-message.admin.title=Coser admin
-message.admin.indexaction=Administration actions
-message.admin.listprojects.deleteselected=Delete selected projects
-message.admin.listprojects.title=Projects management
-message.admin.listprojects.indicatorsprojects=Indicators projects by zones
-message.admin.listprojects.indicatorsprojects.comment=Removing an indicator project will also delete projet data source.
-message.admin.listprojects.mapsprojects=Maps projects by zones
-message.admin.login=Login
-message.admin.loginrequiered=Authentication required
-message.admin.password=Password
-message.com.downloadascsv=Download as CSV
-message.com.downloadaszip=Download as ZIP
-message.com.moredetailspdf=More information on calculated community indices
-message.com.paragraph1=Community indices are calculated for a list of species for each survey time series. The list of species included when calculating each index depends on the available data.
-message.com.paragraph2=The lists of species used for the calculations of community indices are given in the zip file "Information.pdf" (see the link "Download as ZIP" at the bottom of each graph).
-message.com.selectindicatorlist=Select a data list
-message.com.title=Community indices
-message.common.anchortop=Top
-message.common.community=community
-message.common.facade=Sea
-message.common.indicatorsof=Indicators of
-message.common.jsreadmore=Read more
-message.common.noresults=No results available
-message.common.population=population
-message.common.selectall=Select all
-message.common.selectnone=Unselect all
-message.common.selectfacade=Select an area
-message.common.selectindicator=Select an indicator
-message.common.selectpop=Select a population
-message.common.selectspecies=Select a species
-message.common.selectsurvey=Select a survey
-message.common.selectzone=Select an area
-message.common.species=Species
-message.common.validform=Valid
-message.common.zone=Zone
-message.common.zones=Zones
-message.common.datatypes=Data types
-message.documents.genparagraph1=Grands invert\u00E9br\u00E9s et poissons observ\u00E9s par les campagnes scientifiques. Atlas de distribution. Bilan 2008. 2009. {0}
-message.documents.genparagraph2=Grands invert\u00E9br\u00E9s et poissons observ\u00E9s par les campagnes scientifiques. Bilan 2007. 2009. {0}
-message.documents.genparagraph3=L''\u00E9tat des communaut\u00E9s exploit\u00E9es au large des c\u00F4tes de France. Application d''indicateurs \u00E0 l''\u00E9valuation de l''impact de la p\u00EAche. Bilan 2004 Edition 2009. {0}
-message.documents.genparagraph4=Poissons et invert\u00E9br\u00E9s au large des c\u00F4tes de France. Indicateurs issus des p\u00EAches scientifiques. Bilan 2004. 2007. {0}
-message.documents.gentitle1=Rapports g\u00E9n\u00E9raux
-message.documents.activityparagraph1=Battaglia A., V. M. Trenkel & M. J. Rochet, 2006. Estimating end effects in trawl catches. ICES J. Mar. Sci. 63: 956-959.
-message.documents.activityparagraph2=Lorance P., J. A. Bertrand, A. Brind''Amour, M. J. Rochet & V. Trenkel, 2009. Assessment of impacts from human activities on ecosystem components in the Bay of Biscay in the early 1990s. Aquatic living resources 22: 409-431.
-message.documents.activityparagraph3=Rochet M. J., M. Prigent, J. A. Bertrand, A. Carpentier, F. Coppin, J. P. Delpech, G. Fontenelle, E. Foucher, K. Mah\u00E9, E. Rostiaux & V. M. Trenkel, 2008. Ecosystem trends: evidence for agreement between fishers'' perceptions and scientific information. ICES J. Mar. Sci. 65: 1057-1068.
-message.documents.activityparagraph4=Rochet M. J. & J. Rice, 2005. Do explicit criteria help in selecting indicators for ecosystem-based fisheries management? ICES J. Mar. Sci. 62: 528-539.
-message.documents.activityparagraph5=Rochet M. J. & V. Trenkel, 2003. Which community indicators can measure the impact of fishing? A review and proposals. Can. J. Fish. Aquat. Sci. 60: 86-99.
-message.documents.activityparagraph6=Rochet M. J., V. M. Trenkel, R. Bellail, F. Coppin, O. Le Pape, J.-C. Mah\u00E9, A. Morin, J.-C. Poulard, I. Schlaich, A. Souplet, Y. V\u00E9rin & J. A. Bertrand, 2005. Combining indicator trends to assess ongoing changes in exploited fish communities: diagnostic of communities off the coasts of France. ICES Journal of Marine Science 62: 1647-1664.
-message.documents.activityparagraph7=Rochet M. J., V. M. Trenkel, A. Carpentier, F. Coppin, L. Gil de Sola Simarro, J. P. L\u00E9aut\u00E9, J. C. Mah\u00E9, P. Maiorano, A. Mannini, M. Murenu, G. Piet, C. Politou, B. Reale, M. T. Spedicato, G. Tserpes & J. A. Bertrand, 2010. Do changes in environmental pressures impact marine communities? An empirical assessment. J. Applied Ecology 47 (4): 741-750. Publisher''s official version : {0}, Open Access version : {1}
-message.documents.activityparagraph8=Trenkel V. & M. J. Rochet, 2003. Performance of indicators derived from abundance estimates for detecting the impact of fishing on a fish community. Can. J. Fish. Aquat. Sci. 60: 67-85.
-message.documents.activitytitle2=Publications des membres du GT relatives \u00E0 l''activit\u00E9 du groupe
-message.documents.indicatorparagraph1=Dreves L., C. Abernot-Le Gac, E. Antajan, P. Clabaut, P. Claquin, M.L. Cochard, P. Monbet, J. Morin, A. T\u00E9tard, C. Warenbourg & H. Thillaye du Boullay, 2010. Synth\u00E8se hydrobiologique du site \u00E9lectronucl\u00E9aire de Penly. Ifremer. DOP/LER/2010.05. 280 p.
-message.documents.indicatortitle3=Travaux ayant utilis\u00E9 les r\u00E9sultats du groupe de travail sur les indicateurs de populations et de peuplements
-message.documents.title=Documents
-message.index.datatypecom=Community indices by area
-message.index.datatypemap=Species distribution maps by area
-message.index.datatypepop=Population indices by species by area
-message.index.datatypesource=Raw data by sampling unit (generally by haul)
-message.index.datatypesource.short=Raw data by sampling unit
-message.index.datatypetitle=Viewing data online
-message.index.documentsmessage=Documents
-message.index.documentstitle=Documents
-message.index.extractdatatitle=Extract data
-message.index.extractdatalink=Search form
-message.index.paragraph1=This web site has been created to provide easy access to the raw data and index estimates derived from the scientific surveys carried out by Ifremer along the French coasts.
-message.index.paragraph2=All data made available have passed rigorous quality checks. However, as the reliability of results interpretations depends directly on the data used, users are cordially invited to study carefully the survey and quality check protocols.
-message.index.paragraph3=Each survey is carried out using a specific sampling design. Data analyses and interpretation of each time series must therefore take into account the sampling designs. The data are presented by survey series on the web site.
-message.index.paragraph4=The species codes used in the data tables are those of the taxinomic reference file of the Syst\u00E8me d''informations halieutiques de l''Ifremer ({0}).
-message.index.paragraph5=The link below allows you to extract the elements of the site (graphics and data) in the form of a .zip file (containing a pdf document and data)
-message.index.partnertitle=Group members
-message.index.partnerparagraph1=The results presented on this web site are the fruit of an internal Ifremer working group which has been active since 2001 with the objective of developing population and community indicators for the survey data collected since the end of the 1970s along the French coasts. The main group members are (by Ifremer location and in alphabetical order): Florence Sanchez (Anglet), Franck Coppin, Sandrine Vaz and Yves V\u00E9rin (Boulogne-sur-mer), Andr\u00E9 Battaglia and Jean-Pierre L\u00E9aut\u00E9 (L''Houmeau), Jean-Claude Mah\u00E9 and Mich\u00E8le Salaun (Lorient), Jacques Bertrand, Anik Brind''Amour, Yves D\u00E9saunay, Pascal Laffargue, Olivier Le Pape, J\u00E9r\u00E9my Lobry, Pascal Lorance, Jean-Charles Poulard, Marie-Jo\u00EBlle Rochet and Verena Trenkel (Nantes), Marie-Laure Cochard, Jocelyne Morin and Ivan Schlaich (Port-en-Bessin), Ang\u00E9lique Jadaud and Arnaud Souplet (S\u00E8te). The quality process is managed by Vincent Badts. The data-processing is supported by Olivier Berthel\u00E9.
-message.index.qualitymessage=Quality warning
-message.index.qualitytitle=Quality warning
-message.index.quotemessage=Ifremer {0,date,yyyy}. Population and community indices derived from scientific surveys carried out by Ifremer. {1} ({0,date,dd MMMM})
-message.index.quotetitle=How to cite this web site
-message.index.surveyparagraph=Survey protocol handbooks for each survey time series.
-message.index.surveytitle=Survey description
-message.index.thankstitle=Acknowledgements
-message.index.thanksparagraph1=All surveys presented on this web site were conducted by Ifremer and have received financial support from a variety of sources. After initially having been funded by Ifremer three of the surveys are now part of the European Data Collection Framework (DCF); this concerns IBTS, Evhoe and Medits. Two other surveys remain entirely funded by Ifremer: NourVil and CGFS (discussions to include this survey in the DCF are underway). For NourSein, the last three surveys were funded by GIP-Seine Aval. Finally, Crustaflam and NourSomme are entirely funded by EDF within a program of coastal monitoring of nuclear power plants and carried out by Ifremer. This web site has received the financial support of the French ministry for ecology, sustainable development, transport and housing (MEEDDM) (contract Ifremer-MEEDDM 2010). Pour calculating indices for the North Sea the data from all contributing nations was used; it is available in the Datras data base held by ICES (http://datras.ices.dk)
-message.index.title=Home
-message.layout.oceanicdata1=le Syst\u00E8me d''informations scientifiques pour la mer de l''Ifremer (SISMER)
-message.layout.oceanicdata2=the Fisheries Information System - Syst\u00E8me d''information halieutique de l''Ifremer (SIH)
-message.layout.oceanicdatatitle=Survey data management at Ifremer
-message.layout.title=Population and community indices derived from scientific surveys carried out by Ifremer.
-message.map.citation=Trenkel V.M., O. Berthel\u00E9, P. Lorance, J.A. Bertrand, A. Brind''Amour, M.L. Cochard, F. Coppin, J.P. Leaut\u00E9, J.C. Mah\u00E9, J. Morin, M.J. Rochet, M. Salaun, A. Souplet & Y. V\u00E9rin, 2009. Grands invert\u00E9br\u00E9s et poissons observ\u00E9s par les campagnes scientifiques. Atlas de distribution. Bilan 2008. Ifremer, Nantes. EMH : 09-003. {0}. 100 p.
-message.map.citationtitle=Citation
-message.map.downloadaspdf=Download as PDF
-message.map.linkarchimer=Access atlas : {0}
-message.map.paragraph1=The objectif of these maps is to provide a rough indication of the spatial distribution of certain fish and shelfish species as provided by scientific surveys.
-message.map.paragraph2=For each area a systematic grid was defined and the simple average density across years and hauls was calculated in numbers per km2. For mapping purposes, grid cells were coloured using a percentile scale: blue: species never observed, light yellow: average density between [0- 25\u00A0%[; dark yellow: [25-50\u00A0%[, orange\u00A0: [50-75\u00A0%[ and red\u00A0: [75-100\u00A0%]. Thus, cells with the highest average density are in red.
-message.map.title=Distribution maps
-message.map.warning=Warning
-message.map.warningcontent=The maps should not be interpreted as biological distribution maps but as the areas where the species are caught during the scientific surveys. As the different surveys use different samplin gear and are carried out at different times of the year, there can be differences in catchability among surveys and consequently among areas.
-message.pop.downloadascsv=Download as CSV
-message.pop.moredetailspdf=More details about computed population indices
-message.pop.paragraph1=The presented indices have been selected with respect to their capacity to inform on the impact of fishing and for integration into indicator dashboards for exploited ecosystems.
-message.pop.paragraph2=The data correspond to the value of each indicator. The information has been validated by an expert group within the framework of a holostic population and community indicator approach. The results are presented by geographic area or by species for all available data series. The user can select the geographic area, the season (for seasonal surveys), the species and the index. If data is available for a given selection, a figure is produced that shows the time series of the index, plus-minus one standard deviation. It is possible to extract the corresponding table with index values by year, standard deviations and coefficients of variation.
-message.pop.title=Population indices
-message.quality.acceptance=I acknowledge having read the documents and restrictions and I accept to cite the data source in all cases.
-message.quality.notaccepted=You must acknowledge having read the quality warning!
-message.quality.paragraph1=Despite careful data control carried out by Ifremer, inconcistencies inherent to the aggregation of the data might occur. For example\u00A0:
-message.quality.paragraph2=It is not recommended to simply combine data from different surveys in an analysis despite the fact that all data from all surveys are presented in the same format. For example, the catchability of the same species can vary with the survey gear used. As a consequence each survey provides a particular but coherent picture of the sampled ecosystem.
-message.quality.paragraph3=A common feature of survey time series is the change of taxonomic expertise over time. As a result new species can appear, disappear or similar species be confused thus biasing time trends of certain species.
-message.quality.paragraph4=For any given survey time series, any changes in the sampling procedure, gear, period and area covered might influence the catches. Therefore to avoid the risk of any bias in the analysis, the data must be carefully filtered before use.
-message.quality.paragraph5=It is strongly recommended to use the data with care. In the case of doubts about the validity of the data, please contact the administrator of the data base ({0}).
-message.quality.title=Quality warning
-message.search.extract.extract=Extract
-message.search.extract.speciesindicators=Indicators and species
-message.search.extract.title=Extract data
-message.search.extract.updatelists=Next
-message.search.extract.waittitle=Extracting data...
-message.search.extract.waitparagraph1=Data are being extracting. Please wait.
-message.search.extract.waitparagraph2=This operation take several minutes in the case of many graphics should be generated.
-message.search.extract.waitparagraph3=After downloading, close this page by returning to the home page of the site.
-message.search.extract.zonetype=Zone and data types
-message.source.download=Download
-message.source.paragraph1=The raw data are presented in four tables which contain the basic information by sampling unit (generally a haul) as well as the relevant information on the sampling design (strata). An additional table provides the latin names for the species codes used in the data files. Il s''agit des donn\u00E9es utilis\u00E9es pour r\u00E9aliser les calculs des indicateurs pr\u00E9sent\u00E9s. Ces donn\u00E9es ont fait l''objet de filtrages et de regroupements \u00E9ventuels par rapport aux donn\u00E9es de base de chaque s\u00E9rie, afin d''assurer la coh\u00E9rence des jeux de donn\u00E9es en vue du calcul des indicateurs. Ainsi, pour certaines s\u00E9ries, des groupes entiers (e.g. les amphihalins) ont pu \u00EAtre retir\u00E9s. Pour certaines s\u00E9ries, certaines ann\u00E9es ou certaines strates ont \u00E9t\u00E9 retir\u00E9es afin de pr\u00E9server l''homog\u00E9n\u00E9it\u00E9 de la s\u00E9rie. Dans des cas d''\u00E9volution du niveau de d\u00E9termination au cours de la s\u00E9rie, plusieurs taxons ont \u00E9t\u00E9 regroup\u00E9s \u00E0 un niveau sup\u00E9rieur.
-message.source.paragraph2=Les donn\u00E9es IBTS (donn\u00E9es fran\u00E7aises et donn\u00E9es des autres pays) issues de la base Datras du CIEM (http://datras.ices.dk) ont fait l''objet des m\u00EAmes contr\u00F4les de qualit\u00E9 que les autres s\u00E9ries de donn\u00E9es utilis\u00E9es, ainsi que de filtrages et de regroupements taxinomiques pour en pr\u00E9server la coh\u00E9rence vis-\u00E0-vis du pr\u00E9sent objectif de production d''indicateurs de tendances.
-message.source.paragraph3=The web site provides access to the raw data corresponding to the population and community indices presented. For any other data please contact the administrator of the Fisheries information system of Ifremer ({0}).
-message.source.paragraph4=The survey data consist of stations distributed in space following a stratified random design (which can be constant between years). The spatial resolution determines on which spatial scale population and community indices can be calculated.
-message.source.paragraph5=The list of proposed spatial areas includes the original sampling areas, plus post-stratified areas suitable for the European Marine Strategie Framework Directive. These areas have been validated by an internal Ifremer working group following sensitivity analyses.
-message.source.title=Raw data
-message.survey.atlantique.celtique.desc=The Evhoe suvey (Evaluation des ressources halieutiques de l''ouest europ\u00E9en) lasts one month in the fourth quarter every year since 1997. On average 75 half-hour hauls are carried out with a GOV trawl. Each haul covers about 0.067 km\u00B2. This survey provides a representative picture of the 150 000 km\u00B2 of the Celtic Sea.
-message.survey.atlantique.celtique.evhoe1=Manuel des protocoles EVHOE - Version 1.0 (2005)
-message.survey.atlantique.celtique.plus=For more information on the Evhoe surveys
-message.survey.atlantique.celtique=Celtic Sea
-message.survey.atlantique.gascogne.desc=The Evhoe survey (Evaluation des ressources halieutiques de l''ouest europ\u00E9en) lasts one month in the fourth quarter every year since 1992 (except 1993 and 1996). On average 70 half-hour hauls are carried out with a GOV trawl. Each haul covers about 0.067 km\u00B2. This survey provides a representative picture of the 72 500 km\u00B2 of the Bay of Biscay.
-message.survey.atlantique.gascogne.evhoe1=Manuel des protocoles EVHOE - Version 1.0 (2005)
-message.survey.atlantique.gascogne.plus=For more information on the Evhoe surveys
-message.survey.atlantique.gascogne=Bay of Biscay
-message.survey.atlantique.vilaine.desc=Survey in the nursery area of the Vilaine river bay (NourVil) lasted one week every year in autumn from 1980 \u00E0 2010, except 1991, 1994, 1995, 1998, 1999, 2006 and 2007. It used a 3m-beam trawl. On average 30 15-min hauls were carried out covering each about 0.0041 km\u00B2. This survey provides a representative picture of the 330 km\u00B2 of the Vilaine bay.
-message.survey.atlantique.vilaine.nourvil1=Manuel des protocoles Nourriceries Gascogne - V 1.0 (2002)
-message.survey.atlantique.vilaine.plus=For more information on the Nourvil survey
-message.survey.atlantique.vilaine=Vilaine river bay
-message.survey.atlantique=Northeast Atlantic
-message.survey.dataengincasier=Pots for the assessment of large crustaceans, in particular lobster, around Cap de Flamanville.
-message.survey.dataenginfond=Variants of a GOV (grande ouverture verticale) trawl for observing demersal species on the continental shelfs and upper slopes in the North Sea, Eastern English channel, Celtic Sea, Bay of Biscay, Gulf of Lions and East Corsica,
-message.survey.dataenginperche=A beam trawl for coastal zones and estuaries during surveys targeting juvenile flatfish: Somme and Vilaine river bays,
-message.survey.dataengintitle=Different sampling gears are used:
-message.survey.detailstitle=Characteristics of the surveys carried out by Ifremer
-message.survey.maintitle=Scientific surveys carried out by Ifremer
-message.survey.mancheoccidentale.flamanville.crustaflam1=Manuel des protocoles CRUSTAFLAM - Version 1.0 (2003)
-message.survey.mancheoccidentale.flamanville.desc=Two surveys of 15 jours each using pots around cap de Flamanville (CrustaFlam), in June and September, since 1986: 1200 sets per survey in an area covering 26 km\u00B2.
-message.survey.mancheoccidentale.flamanville.plus=For more information on the CrustFlam survey
-message.survey.mancheoccidentale.flamanville=Cap de Flamanville area
-message.survey.mancheoccidentale=Eastern English Channel
-message.survey.mancheorientale.baiedeseine=Seine river bay
-message.survey.mancheorientale.baiedeseine.desc=Yearly surveys carried on in the Seine estuary and the eastern bay of Seine (NourSeine), principally in autumn from 1995 to 2002. The main objective was to identify the coastal fish nurseries and to assess the fish and macro-benthos richness. About 45 hauls are done during each survey, using a standard beam trawl.
-message.survey.mancheorientale.baiedeseine.plus=For more information on the NourSeine survey
-message.survey.mancheorientale.baiedeseine.nourseine1=http://archimer.ifremer.fr/doc/00036/14714/
-message.survey.mancheorientale.baiedesomme.desc=The survey in the nursery area of the Somme rive bay (NourSomme) lasts one week in September-October each year since 1995, using a 2m-beam trawl in the estuary and a 3m-beam trawl in the more open areas. On average 50 hauls are carried out. Haul duration is 7 minutes covering 0.001 km\u00B2 in the estuary part and 15 minutes covering 0.004 km\u00B2 in the more open part. This survey provides a representative picture of the 720 km\u00B2 of the Somme baie.
-message.survey.mancheorientale.baiedesomme.noursomme1=Manuel des protocoles Nourriceries Somme - V 1.0 (2002)
-message.survey.mancheorientale.baiedesomme.plus=For more information on the NourSomme survey
-message.survey.mancheorientale.baiedesomme=Somme river bay
-message.survey.mancheorientale.mancheorientale.cgfs1=Manuel des protocoles CGFS - Version 1.0 (2002)
-message.survey.mancheorientale.mancheorientale.desc=French survey CGFS (Channel Ground Fish Survey) lasting one month and internationally coordonnated together with the IBTS survey. The survey takes place every year since 1988. On average 90 half hour hauls are carried out with a small GOV trawl. Each haul covers about 0.03 km\u00B2. This survey provides a representative picture of the 70 748 km\u00B2 of the Eastern English Channel.
-message.survey.mancheorientale.mancheorientale.plus=For more information on the CGFS survey
-message.survey.mancheorientale.mancheorientale=Eastern English Channel
-message.survey.mancheorientale=Eastern English Channel
-message.survey.mediterranee.estcorse.desc=French contribution to the internationally coordinated Medits (International bottom Trawl Surveys in the Mediterranean) survey, lasting one week in the second quarter every year since 1994 except 2002 using a GOV bottom trawl with short wings. On average 20 hauls are carried out; haul duration is half an hour above 200 m depth which corresponds to 0.05 km\u00B2 and one hour for bottom depths greater than 200 m (0.1\u00A0km\u00B2). Medits provides a representative picture of the 4 562 km\u00B2 of Eastern Corsican island plateau.
-message.survey.mediterranee.estcorse.medits1=Manuel des protocoles Medits, Version 1 (1994)
-message.survey.mediterranee.estcorse.medits2=Manuel des protocoles Medits, Version 2 (1995)
-message.survey.mediterranee.estcorse.medits3=Manuel des protocoles Medits, Version 3 (1999)
-message.survey.mediterranee.estcorse.medits4=Manuel des protocoles Medits, Version 4 (2001)
-message.survey.mediterranee.estcorse.medits5=Manuel des protocoles Medits, Version 5 (2007)
-message.survey.mediterranee.estcorse.medits6=Manuel des protocoles Medits, Version 6 (2012)
-message.survey.mediterranee.estcorse.plus=For more information on the Medits surveys
-message.survey.mediterranee.estcorse=East Corsica
-message.survey.mediterranee.golfelion.desc=French contribution to the internationally coordinated Medits (International bottom Trawl Surveys in the Mediterranean) survey, lasting one month in the second quarter every year since 1994 using a GOV bottom trawl with short wings. On average 69 hauls are carried out; haul duration is half an hour above 200 m depth which corresponds to 0.05 km\u00B2 and one hour for bottom depths greater than 200 m (0.1\u00A0km\u00B2). Medits provides a representative picture of the 13 860 km\u00B2 of the gulf of Lions.
-message.survey.mediterranee.golfelion.medits1=Manuel des protocoles Medits, Version 1 (1994)
-message.survey.mediterranee.golfelion.medits2=Manuel des protocoles Medits, Version 2 (1995)
-message.survey.mediterranee.golfelion.medits3=Manuel des protocoles Medits, Version 3 (1999)
-message.survey.mediterranee.golfelion.medits4=Manuel des protocoles Medits, Version 4 (2001)
-message.survey.mediterranee.golfelion.medits5=Manuel des protocoles Medits, Version 5 (2007)
-message.survey.mediterranee.golfelion.medits6=Manuel des protocoles Medits, Version 6 (2012)
-message.survey.mediterranee.golfelion.plus=For more information on the Medits surveys
-message.survey.mediterranee.golfelion=Gulf of Lions
-message.survey.mediterranee=Mediterranean Sea
-message.survey.merdunord.sudmerdunord.desc=Every years since 1980 France contributes one month of ship time to the IBTS (International Bottom Trawl Survey) in the first quarter using a GOV trawl. On average 58 hauls are carried out. The southern North Sea is sampled by four countries (France, Belgium, Danmark and Germany) who together carry out about 200 hauls per year. Each haul lasts half an hour corresponding to a swept area of about 0.067 km\u00B2. IBTS provides a representative picture of the 678\u00A0000\u00A0km\u00B2 of the area.
-message.survey.merdunord.sudmerdunord.ibts6=Manuel des protocoles IBTS - R\u00E9vision VI (1999)
-message.survey.merdunord.sudmerdunord.ibts7=Manuel des protocoles IBTS - R\u00E9vision VII (2004)
-message.survey.merdunord.sudmerdunord.plus=For more information on the IBTS survey
-message.survey.merdunord.sudmerdunord=Southern North Sea
-message.survey.merdunord=North Sea
-message.survey.paragraph1=The main objectif of the scientific fisheries surveys is to provide information on ressource changes, using a standard sampling protocol. They are always carried out in the same areas, at the same time of year and with the same gear, to allow comparisons among years. They provide information on both commercial and non-commercial species and their changes. Fish and shelfish species are counted, weighted and measured. For certain species other biological information is collected. Thus each survey provided a quantitive picture of the species assemblage in a given area during a certain time period. Additional information such as temperature, salinity, macrofauna, marin mammals, birds, macro waste etc. are collected during certain surveys, but this information is not presented here
-message.survey.paragraph2=For the last two decades Ifremer has organised scientific fisheries surveys in the North Sea, the English Channel, the Atlantic and in the Mediterrean Sea for sampling demersal and benthic ressources. The main objective is to produce abundance indices for the principal commercial species. The surveys collect also data for non-commercial species. Hence they contribute to the knowledge necessary for the development of an ecosystem approach to fisheries, in particular in the context of the common fisheries policy (CFP) and more generally the European marine strategy framework directive.
-message.survey.paragraph3=The surveys are carried out using standardised sampling designs. The gear and its rigging, station positions, sample treatment and biological sampling are carried out using fixed protocols.
-message.survey.paragraph4=Common protocols are used by all participants for surveys carried out under international coordination in the North Sea, Eastern English channel, Celtic Sea, Bay of Biscay and the Mediterranean Sea. The data collected by the different research vessels are therefore comparable.
-message.survey.paragraph5=Each survey area is subdivided in strata according to bottom depth, latitude or other criteria. The sampling protocol specifies the number of hauls or pots by stratum.
-message.survey.paragraph6=For each survey the station location is determined following the specified sampling design. The aim is not to obtain the largest catches as fishers might attempt to do, but to collect comparable data for detecting time trends.
\ No newline at end of file
Deleted: trunk/coser-web/src/main/resources/fr/ifremer/coser/web/package_es.properties
===================================================================
--- trunk/coser-web/src/main/resources/fr/ifremer/coser/web/package_es.properties 2014-03-09 06:34:41 UTC (rev 1139)
+++ trunk/coser-web/src/main/resources/fr/ifremer/coser/web/package_es.properties 2014-03-10 10:23:18 UTC (rev 1140)
@@ -1,211 +0,0 @@
-###
-# #%L
-# Coser :: Web
-# %%
-# Copyright (C) 2010 - 2012 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%
-###
-message.admin.title=Coser admin
-message.admin.indexaction=Actions d''administration
-message.admin.listprojects.deleteselected=Supprimer les projets s\u00E9lectionn\u00E9s
-message.admin.listprojects.title=Gestion des projets
-message.admin.listprojects.indicatorsprojects=Projects d'indicateur par zones
-message.admin.listprojects.indicatorsprojects.comment=La suppression d''un projets d''indicateur supprimera \u00E9galement la possibilit\u00E9 de t\u00E9l\u00E9charger les donn\u00E9es sources du projet concern\u00E9.
-message.admin.listprojects.mapsprojects=Projects de cartes par zones
-message.admin.login=Identifiant
-message.admin.loginrequiered=Autentification requise
-message.admin.password=Mot de passe
-message.com.downloadascsv=T\u00E9l\u00E9charger en CSV
-message.com.downloadaszip=T\u00E9l\u00E9charger en ZIP
-message.com.moredetailspdf=Plus d''informations sur les indices calcul\u00E9s des communaut\u00E9s
-message.com.paragraph1=Des indices de communaut\u00E9 sont calcul\u00E9s pour un ensemble de taxon dans chaque s\u00E9rie. La liste des taxons inclus pour le calcul de chaque indice varie selon les donn\u00E9es disponibles pour la r\u00E9alisation des calculs.
-message.com.paragraph2=La liste des esp\u00E8ces incluses dans le calcul de chaque indice de communaut\u00E9 est pr\u00E9sent\u00E9e dans le dossier t\u00E9l\u00E9chargable sous chaque graphe (fichier \"Information.pdf\").
-message.com.selectindicatorlist=S\u00E9lectionner une liste de donn\u00E9es
-message.com.title=Indices de communaut\u00E9s
-message.common.anchortop=Haut
-message.common.community=community
-message.common.facade=Facade
-message.common.indicatorsof=Indicateurs de
-message.common.jsreadmore=Voir la suite
-message.common.noresults=Aucun r\u00E9sultat disponible.
-message.common.population=population
-message.common.selectall=Tout s\u00E9lectionner
-message.common.selectnone=Tout d\u00E9-s\u00E9lectionner
-message.common.selectfacade=S\u00E9lectionnez une fa\u00E7ade
-message.common.selectindicator=S\u00E9lectionnez un indicateur
-message.common.selectpop=S\u00E9lectionnez une population
-message.common.selectspecies=S\u00E9lectionnez une esp\u00E8ce
-message.common.selectsurvey=S\u00E9lectionnez une campagne
-message.common.selectzone=S\u00E9lectionnez une zone
-message.common.species=Species
-message.common.validform=Valider
-message.common.zone=Zone
-message.common.zones=Zones
-message.common.datatypes=Type de donn\u00E9es
-message.documents.genparagraph1=Grands invert\u00E9br\u00E9s et poissons observ\u00E9s par les campagnes scientifiques. Atlas de distribution. Bilan 2008. 2009. {0}
-message.documents.genparagraph2=Grands invert\u00E9br\u00E9s et poissons observ\u00E9s par les campagnes scientifiques. Bilan 2007. 2009. {0}
-message.documents.genparagraph3=L''\u00E9tat des communaut\u00E9s exploit\u00E9es au large des c\u00F4tes de France. Application d''indicateurs \u00E0 l''\u00E9valuation de l''impact de la p\u00EAche. Bilan 2004 Edition 2009. {0}
-message.documents.genparagraph4=Poissons et invert\u00E9br\u00E9s au large des c\u00F4tes de France. Indicateurs issus des p\u00EAches scientifiques. Bilan 2004. 2007. {0}
-message.documents.gentitle1=Rapports g\u00E9n\u00E9raux
-message.documents.activityparagraph1=Battaglia A., V. M. Trenkel & M. J. Rochet, 2006. Estimating end effects in trawl catches. ICES J. Mar. Sci. 63: 956-959.
-message.documents.activityparagraph2=Lorance P., J. A. Bertrand, A. Brind''Amour, M. J. Rochet & V. Trenkel, 2009. Assessment of impacts from human activities on ecosystem components in the Bay of Biscay in the early 1990s. Aquatic living resources 22: 409-431.
-message.documents.activityparagraph3=Rochet M. J., M. Prigent, J. A. Bertrand, A. Carpentier, F. Coppin, J. P. Delpech, G. Fontenelle, E. Foucher, K. Mah\u00E9, E. Rostiaux & V. M. Trenkel, 2008. Ecosystem trends: evidence for agreement between fishers'' perceptions and scientific information. ICES J. Mar. Sci. 65: 1057-1068.
-message.documents.activityparagraph4=Rochet M. J. & J. Rice, 2005. Do explicit criteria help in selecting indicators for ecosystem-based fisheries management? ICES J. Mar. Sci. 62: 528-539.
-message.documents.activityparagraph5=Rochet M. J. & V. Trenkel, 2003. Which community indicators can measure the impact of fishing? A review and proposals. Can. J. Fish. Aquat. Sci. 60: 86-99.
-message.documents.activityparagraph6=Rochet M. J., V. M. Trenkel, R. Bellail, F. Coppin, O. Le Pape, J.-C. Mah\u00E9, A. Morin, J.-C. Poulard, I. Schlaich, A. Souplet, Y. V\u00E9rin & J. A. Bertrand, 2005. Combining indicator trends to assess ongoing changes in exploited fish communities: diagnostic of communities off the coasts of France. ICES Journal of Marine Science 62: 1647-1664.
-message.documents.activityparagraph7=Rochet M. J., V. M. Trenkel, A. Carpentier, F. Coppin, L. Gil de Sola Simarro, J. P. L\u00E9aut\u00E9, J. C. Mah\u00E9, P. Maiorano, A. Mannini, M. Murenu, G. Piet, C. Politou, B. Reale, M. T. Spedicato, G. Tserpes & J. A. Bertrand, 2010. Do changes in environmental pressures impact marine communities? An empirical assessment. J. Applied Ecology 47 (4): 741-750. Publisher''s official version : {0}, Open Access version : {1}
-message.documents.activityparagraph8=Trenkel V. & M. J. Rochet, 2003. Performance of indicators derived from abundance estimates for detecting the impact of fishing on a fish community. Can. J. Fish. Aquat. Sci. 60: 67-85.
-message.documents.activitytitle2=Publications des membres du GT relatives \u00E0 l''activit\u00E9 du groupe
-message.documents.indicatorparagraph1=Dreves L., C. Abernot-Le Gac, E. Antajan, P. Clabaut, P. Claquin, M.L. Cochard, P. Monbet, J. Morin, A. T\u00E9tard, C. Warenbourg & H. Thillaye du Boullay, 2010. Synth\u00E8se hydrobiologique du site \u00E9lectronucl\u00E9aire de Penly. Ifremer. DOP/LER/2010.05. 280 p.
-message.documents.indicatortitle3=Travaux ayant utilis\u00E9 les r\u00E9sultats du groupe de travail sur les indicateurs de populations et de peuplements
-message.documents.title=Documents
-message.index.datatypecom=Des indices de communaut\u00E9 par zone
-message.index.datatypemap=Des cartes de distribution par esp\u00E8ce et par zone
-message.index.datatypepop=Des indices biologiques par esp\u00E8ce et par zone
-message.index.datatypesource=Des donn\u00E9es par op\u00E9ration d''\u00E9chantillonnage (en g\u00E9n\u00E9ral par trait de chalut)
-message.index.datatypesource.short=Des donn\u00E9es par op\u00E9ration d''\u00E9chantillonnage
-message.index.datatypetitle=Consultation des donn\u00E9es en ligne
-message.index.documentsmessage=Documents
-message.index.documentstitle=Documents
-message.index.extractdatatitle=Extraction des donn\u00E9es
-message.index.extractdatalink=Formulaire de recherche
-message.index.paragraph1=Ce site a \u00E9t\u00E9 con\u00E7u pour fournir en libre acc\u00E8s des donn\u00E9es brutes et des donn\u00E9es \u00E9labor\u00E9es relatives aux campagnes scientifiques d''observation halieutique conduites par l''Ifremer le long des c\u00F4tes fran\u00E7aises.
-message.index.paragraph2=Toutes les donn\u00E9es mises \u00E0 disposition ont fait l''objet de qualification selon des protocoles sp\u00E9cifiques. La qualit\u00E9 des interpr\u00E9tations \u00E9tant directement li\u00E9e \u00E0 la nature des donn\u00E9es source, les utilisateurs de donn\u00E9es sont invit\u00E9s \u00E0 consid\u00E9rer avec attention les descriptions des protocoles mis en \u0153uvre ainsi que les niveaux de qualit\u00E9 contr\u00F4l\u00E9s.
-message.index.paragraph3=Chaque s\u00E9rie de campagnes est conduite selon une strat\u00E9gie d''\u00E9chantillonnage sp\u00E9cifique. Sauf cas particuliers, les analyses et interpr\u00E9tations doivent \u00EAtre conduites par s\u00E9rie, en prenant en compte les strat\u00E9gies d''\u00E9chantillonnage propres \u00E0 chacune de ces s\u00E9ries. Sur le site, les donn\u00E9es sont pr\u00E9sent\u00E9es par s\u00E9rie.
-message.index.paragraph4=Dans les tables de donn\u00E9es, toutes les esp\u00E8ces sont identifi\u00E9es selon le r\u00E9f\u00E9rentiel taxinomique du Syst\u00E8me d''informations halieutiques de l''Ifremer ({0}).
-message.index.paragraph5=Les liens ci-dessous vous permet d''extraire les \u00E9l\u00E9ments du site (graphique et donn\u00E9es) sous la forme d''un fichier .zip (contenant un document pdf et les donn\u00E9es)
-message.index.partnertitle=Membres du groupe
-message.index.partnerparagraph1=Les r\u00E9sultats pr\u00E9sent\u00E9s sur ce site sont le produit de l''activit\u00E9 d''un groupe de travail de l''Ifremer qui se r\u00E9unit chaque ann\u00E9e depuis 2001 pour d\u00E9velopper des indicateurs de populations et de peuplements \u00E0 partir des donn\u00E9es des s\u00E9ries de campagnes halieutiques standardis\u00E9es conduites depuis la fin des ann\u00E9es 1970 par l''Ifremer le long des c\u00F4tes de France m\u00E9tropolitaine. Les principaux membres du groupe sont (par ordre alphab\u00E9tique de site et de patronyme)\u00A0: Florence Sanchez (Anglet), Franck Coppin, Sandrine Vaz et Yves V\u00E9rin (Boulogne-sur-mer), Andr\u00E9 Battaglia et Jean-Pierre L\u00E9aut\u00E9 (L''Houmeau), Jean-Claude Mah\u00E9 et Mich\u00E8le Salaun (Lorient), Jacques Bertrand, Anik Brind''Amour, Yves D\u00E9saunay, Pascal Laffargue, Olivier Le Pape, J\u00E9r\u00E9my Lobry, Pascal Lorance, Jean-Charles Poulard, Marie-Jo\u00EBlle Rochet et Verena Trenkel (Nantes), Marie-Laure Cochard, Jocelyne Morin et Ivan Schlaich (Port-en-Bessin), Ang\u00E9lique Jadaud et Arnaud Souplet (S\u00E8te). La d\u00E9marche qualit\u00E9 est g\u00E9r\u00E9e par Vincent Badts. Le support informatique de gestion des donn\u00E9es est assur\u00E9 par Olivier Berthel\u00E9.
-message.index.qualitymessage=Avertissement qualit\u00E9
-message.index.qualitytitle=Avertissement qualit\u00E9
-message.index.quotemessage=Ifremer {0,date,yyyy}. Indices de populations et de communautés issus des campagnes de surveillance halieutique de l''Ifremer. {1} ({0,date,dd MMMM})
-message.index.quotetitle=Pour citer ce site
-message.index.surveyparagraph=Des manuels des protocoles d\u00E9crivent les modalit\u00E9s techniques de r\u00E9alisation de chaque s\u00E9rie de campagnes.
-message.index.surveytitle=Description des campagnes
-message.index.thankstitle=Remerciements
-message.index.thanksparagraph1=Bien que toutes les s\u00E9ries de campagnes dont des r\u00E9sultats sont pr\u00E9sent\u00E9s sur ce site aient \u00E9t\u00E9 conduites par l''Ifremer, elles ont fait l''objet de financements vari\u00E9s. Certaines, apr\u00E8s une phase \u00E9ventuelle de financement unique par l''Ifremer font l''objet de cofinancements, comme les s\u00E9ries IBTS, Evhoe et Medits retenues au titre du r\u00E8glement europ\u00E9en sur la collecte des donn\u00E9es halieutiques (DCF). D''autres sont prises en charge en totalit\u00E9 par l''Ifremer, comme les s\u00E9ries NourVil et CGFS (cette derni\u00E8re \u00E9tant en cours d''\u00E9valuation pour une reconnaissance au titre du r\u00E8glement europ\u00E9en sur la collecte des donn\u00E9es halieutiques - DCF). Pour la s\u00E9rie NourSein, les campagnes ont \u00E9t\u00E9 co-financ\u00E9es par le conseil r\u00E9gional de Haute Normandie, le GPMH, le programme Liteau, le programme Seine Aval et le GIP-Seine Aval, selon les ann\u00E9es. Enfin, les s\u00E9ries Crustaflam et NourSomme sont financ\u00E9es en totalit\u00E9 par EDF au titre de la surveillance de centrales nucl\u00E9aires littorales, dans le cadre de contrats entre Ifremer et EDF. Le pr\u00E9sent site a \u00E9t\u00E9 cr\u00E9\u00E9 gr\u00E2ce \u00E0 un soutien du MEEDDM (contrat Ifremer-MEEDDM 2010). Pour l''\u00E9tablissement des indices en mer du Nord, les donn\u00E9es sources utilis\u00E9es sont celles mises \u00E0 disposition par les diff\u00E9rents pays partenaires de la s\u00E9rie IBTS dans la base Datras du CIEM (http://datras.ices.dk)
-message.index.title=Bienvenida
-message.layout.oceanicdata1=le Syst\u00E8me d''informations scientifiques pour la mer de l''Ifremer (SISMER)
-message.layout.oceanicdata2=le Syst\u00E8me d''information halieutique de l''Ifremer (SIH)
-message.layout.oceanicdatatitle=Gestion des donn\u00E9es des campagnes oc\u00E9anographiques \u00E0 l''Ifremer
-message.layout.title=\u00CDndices de las poblaciones y comunidades de las campa\u00F1as de seguimiento, que participan de la pesquer\u00EDa pulgadas Ifremer
-message.map.citation=Trenkel V.M., O. Berthel\u00E9, P. Lorance, J.A. Bertrand, A. Brind''Amour, M.L. Cochard, F. Coppin, J.P. Leaut\u00E9, J.C. Mah\u00E9, J. Morin, M.J. Rochet, M. Salaun, A. Souplet & Y. V\u00E9rin, 2009. Grands invert\u00E9br\u00E9s et poissons observ\u00E9s par les campagnes scientifiques. Atlas de distribution. Bilan 2008. Ifremer, Nantes. EMH : 09-003. {0}. 100 p.
-message.map.citationtitle=Citation
-message.map.downloadaspdf=T\u00E9l\u00E9charger en PDF
-message.map.linkarchimer=Acc\u00E8s \u00E0 l''atlas : {0}
-message.map.paragraph1=L''objectif de cet atlas est de donner un aper\u00E7u de la distribution spatiale des esp\u00E8ces de poissons et de certains invert\u00E9br\u00E9s marins \u00E0 partir des observations des campagnes de p\u00EAche scientifiques.
-message.map.paragraph2=Pour chaque zone un quadrillage syst\u00E9matique a \u00E9t\u00E9 d\u00E9fini, puis la densit\u00E9 moyenne par km\u00B2 dans chaque cellule a \u00E9t\u00E9 calcul\u00E9e en utilisant les observations de toute la p\u00E9riode. Pour la repr\u00E9sentation cartographique, les cellules avec des densit\u00E9s moyenne correspondant aux quartiles de densit\u00E9 ont re\u00E7u la m\u00EAme couleur\u00A0: bleu\u00A0: esp\u00E8ce jamais observ\u00E9e, jaune clair\u00A0: densit\u00E9 moyenne entre [0 et 25\u00A0%[; jaune fonc\u00E9\u00A0: [25-50\u00A0%[, orange\u00A0: [50-75\u00A0%[ et rouge\u00A0: [75-100\u00A0%]. Donc, les zones o\u00F9 se trouvent les densit\u00E9s les plus \u00E9lev\u00E9es en moyenne sont repr\u00E9sent\u00E9es en rouge.
-message.map.title=Cartes de distribution
-message.map.warning=Avertissement
-message.map.warningcontent=Les cartes pr\u00E9sent\u00E9es ne doivent pas \u00EAtre interpr\u00E9t\u00E9es comme des cartes de distribution des esp\u00E8ces mais comme celle des zones o\u00F9 elles sont captur\u00E9es lors des campagnes scientifiques. Les campagnes \u00E9tant r\u00E9alis\u00E9es avec des chaluts diff\u00E9rents et \u00E0 diff\u00E9rentes saisons, les esp\u00E8ces peuvent avoir des capturabilit\u00E9s tr\u00E8s diff\u00E9rentes entre les s\u00E9ries de campagnes, donc d''une zone \u00E0 l''autre.
-message.pop.downloadascsv=T\u00E9l\u00E9charger en CSV
-message.pop.moredetailspdf=Plus d''informations sur les indices calcul\u00E9s des populations
-message.pop.paragraph1=Les indices pr\u00E9sent\u00E9s ont \u00E9t\u00E9 s\u00E9lectionn\u00E9s en r\u00E9f\u00E9rence \u00E0 leur aptitude \u00E0 renseigner sur l''impact de la p\u00EAche, en vue de leur int\u00E9gration dans des tableaux de bord d''indicateurs d''\u00E9volution d''\u00E9cosyst\u00E8mes exploit\u00E9s par la p\u00EAche.
-message.pop.paragraph2=Les donn\u00E9es disponibles sur le site sont les valeurs de chaque indice. Les informations ont \u00E9t\u00E9 valid\u00E9es par un groupe de travail dans une approche int\u00E9grative d''indicateurs de populations et de communaut\u00E9s. Les r\u00E9sultats sont donn\u00E9s par zone g\u00E9ographique et par esp\u00E8ce pour l''ensemble de la s\u00E9rie de donn\u00E9es disponible. L''utilisateur peut s\u00E9lectionner la zone g\u00E9ographique, la saison (dans le cas de s\u00E9ries saisonni\u00E8res), l''esp\u00E8ce et l''indice. Pour les s\u00E9lections pour lesquelles une information est disponible, le syst\u00E8me produit un graphe pr\u00E9sentant la distribution temporelle de l''indice, avec une repr\u00E9sentation de l''\u00E9cart-type. Il fournit la possibilit\u00E9 d''extraire la table des donn\u00E9es correspondantes, incluant la valeur de l''indice par ann\u00E9e, ainsi que son \u00E9cart-type et son coefficient de variation.
-message.pop.title=Indices biologiques
-message.quality.acceptance=Je reconnais avoir pris connaissance des documents et des restrictions associ\u00E9es et je m''engage \u00E0 citer la source des donn\u00E9es.
-message.quality.notaccepted=Vous devez valider les conditions Avertissement Qualit\u00E9 !
-message.quality.paragraph1=Bien que les donn\u00E9es aient \u00E9t\u00E9 pr\u00E9cautionneusement contr\u00F4l\u00E9es par l''Ifremer, des d\u00E9fauts inh\u00E9rents \u00E0 l''agr\u00E9gation des informations peuvent persister. Par exemple\u00A0:
-message.quality.paragraph2=En d\u00E9pit du fait que toutes les donn\u00E9es de toutes les s\u00E9ries de campagnes soient pr\u00E9sent\u00E9es selon le m\u00EAme format, sauf cas particuliers, des diff\u00E9rences dans les strat\u00E9gies d''observation emp\u00EAchent la combinaison de donn\u00E9es de diff\u00E9rentes campagnes dans une m\u00EAme analyse. Par exemple, la capturabilit\u00E9 d''une m\u00EAme esp\u00E8ce varie selon le type d''engin d''\u00E9chantillonnage utilis\u00E9. Il en r\u00E9sulte que chaque engin capture un sous-ensemble particulier des bioc\u00E9noses \u00E9chantillonn\u00E9es.
-message.quality.paragraph3=Une propri\u00E9t\u00E9 commune aux s\u00E9ries d''observations \u00E0 la mer est l''\u00E9volution dans le temps de la comp\u00E9tence des \u00E9quipes embarqu\u00E9es pour la d\u00E9termination des esp\u00E8ces. Il peut en r\u00E9sulter des apparitions, des disparitions ou des assignations sous un m\u00EAme nom de taxons proches dans les jeux de donn\u00E9es, non repr\u00E9sentatifs de l''\u00E9volution des populations concern\u00E9es dans l''\u00E9cosyst\u00E8me.
-message.quality.paragraph4=Pour les campagnes d''une m\u00EAme s\u00E9rie, des changements dans les proc\u00E9dures d''\u00E9chantillonnage, dans les caract\u00E9ristiques des engins, dans la p\u00E9riode de r\u00E9alisation de la campagne et la zone couverte peuvent influencer les captures. Pour pr\u00E9venir les risques de biais dans les analyses en raison de ces facteurs, les jeux de donn\u00E9es doivent \u00EAtre pr\u00E9alablement filtr\u00E9s ad\u00E9quatement.
-message.quality.paragraph5=Il est vivement recommand\u00E9 aux utilisateurs de donn\u00E9es de les traiter avec pr\u00E9caution. Si des utilisateurs s''interrogent sur la validit\u00E9 de donn\u00E9es, ils sont invit\u00E9s \u00E0 contacter l''administrateur de la base de donn\u00E9es ({0}).
-message.quality.title=Avertissement Qualit\u00E9
-message.search.extract.extract=Extraire
-message.search.extract.speciesindicators=Esp\u00E8ces et indicateurs
-message.search.extract.title=Extraction des donn\u00E9es
-message.search.extract.updatelists=Suite
-message.search.extract.waittitle=Extraction en cours...
-message.search.extract.waitparagraph1=Les donn\u00E9es sont en cours d'extraction. Merci de patienter.
-message.search.extract.waitparagraph2=Cette op\u00E9ration peut prendre plusieurs minute dans le cas ou de nombreux graphiques doivent \u00EAtre g\u00E9n\u00E9r\u00E9s.
-message.search.extract.waitparagraph3=Apr\u00E8s le t\u00E9l\u00E9chargement, fermer cette page en revenant sur la page d''accueil du site.
-message.search.extract.zonetype=Zone et type de donn\u00E9es
-message.search.extract.title=Extraction des donn\u00E9es
-message.source.download=T\u00E9l\u00E9charger
-message.source.paragraph1=Les donn\u00E9es de base sont pr\u00E9sent\u00E9es selon quatre tables fournissant des informations de base \u00E9lev\u00E9es \u00E0 l''op\u00E9ration d''\u00E9chantillonnage (en g\u00E9n\u00E9ral un trait de chalut) et organis\u00E9es selon des unit\u00E9s g\u00E9ographiques d\u00E9finies en relation avec le plan d''\u00E9chantillonnage. Une table suppl\u00E9mentaire pr\u00E9sente le r\u00E9f\u00E9rentiel taxinomique associ\u00E9 aux donn\u00E9es. Il s''agit des donn\u00E9es utilis\u00E9es pour r\u00E9aliser les calculs des indicateurs pr\u00E9sent\u00E9s. Ces donn\u00E9es ont fait l''objet de filtrages et de regroupements \u00E9ventuels par rapport aux donn\u00E9es de base de chaque s\u00E9rie, afin d''assurer la coh\u00E9rence des jeux de donn\u00E9es en vue du calcul des indicateurs. Ainsi, pour certaines s\u00E9ries, des groupes entiers (e.g. les amphihalins) ont pu \u00EAtre retir\u00E9s. Pour certaines s\u00E9ries, certaines ann\u00E9es ou certaines strates ont \u00E9t\u00E9 retir\u00E9es afin de pr\u00E9server l''homog\u00E9n\u00E9it\u00E9 de la s\u00E9rie. Dans des cas d''\u00E9volution du niveau de d\u00E9termination au cours de la s\u00E9rie, plusieurs taxons ont \u00E9t\u00E9 regroup\u00E9s \u00E0 un niveau sup\u00E9rieur.
-message.source.paragraph2=Les donn\u00E9es IBTS (donn\u00E9es fran\u00E7aises et donn\u00E9es des autres pays) issues de la base Datras du CIEM (http://datras.ices.dk) ont fait l''objet des m\u00EAmes contr\u00F4les de qualit\u00E9 que les autres s\u00E9ries de donn\u00E9es utilis\u00E9es, ainsi que de filtrages et de regroupements taxinomiques pour en pr\u00E9server la coh\u00E9rence vis-\u00E0-vis du pr\u00E9sent objectif de production d''indicateurs de tendances.
-message.source.paragraph3=Le site ne contient des donn\u00E9es de base que pour une partie des s\u00E9ries de campagnes pour lesquelles des indices de populations et de communaut\u00E9s sont pr\u00E9sent\u00E9s, selon les modalit\u00E9s d''acc\u00E8s \u00E0 ces donn\u00E9es. Pour un acc\u00E8s aux s\u00E9ries de donn\u00E9es source, il convient de contacter l''administrateur du Syst\u00E8me d''informations halieutiques de l''Ifremer ({0}) pour les donn\u00E9es fran\u00E7aises, et le site Datras du CIEM (http://datras.ices.dk) pour les donn\u00E9es IBTS des autres pays.
-message.source.paragraph4=Les donn\u00E9es de campagnes halieutiques sont constitu\u00E9es \u00E0 partir de stations d''\u00E9chantillonnage r\u00E9parties dans l''espace selon le principe de tirage stratifi\u00E9. La densit\u00E9 de l''\u00E9chantillonnage conditionne la partition g\u00E9ographique selon laquelle les indices de population et de communaut\u00E9 peuvent \u00EAtre \u00E9tablis.
-message.source.paragraph5=Les plans de zonage propos\u00E9s incluent le plan de r\u00E9f\u00E9rence correspondant au plan d''\u00E9chantillonnage, ainsi que des adaptations pour tenir compte des limites des sous-r\u00E9gions d\u00E9finies par la strat\u00E9gie marine europ\u00E9enne. Ils ont \u00E9t\u00E9 valid\u00E9s par un groupe de travail de l''Ifremer, apr\u00E8s exploration de la sensibilit\u00E9 de divers indices aux ajustements propos\u00E9s.
-message.source.title=Donn\u00E9es de base
-message.survey.atlantique.celtique.desc=Campagne Evhoe (Evaluation des ressources halieutiques de l''ouest europ\u00E9en) d''un mois au quatri\u00E8me trimestre, tous les ans depuis 1997. En moyenne 75 traits d''une demi-heure, au chalut de fond \u00E0 grande ouverture verticale, sont r\u00E9alis\u00E9s. Chaque trait couvre une surface d''environ 0,067 km\u00B2. Cette campagne est repr\u00E9sentative des 150 000 km\u00B2 de la mer Celtique.
-message.survey.atlantique.celtique.evhoe1=Manuel des protocoles EVHOE - Version 1.0 (2005)
-message.survey.atlantique.celtique.plus=Pour en savoir plus sur les campagnes Evhoe
-message.survey.atlantique.celtique=Mer Celtique
-message.survey.atlantique.gascogne.desc=Campagne Evhoe (Evaluation des ressources halieutiques de l''ouest europ\u00E9en) d''un mois au quatri\u00E8me trimestre, tous les ans depuis 1992 (sauf en 1993 et 1996). En moyenne, 70 traits de chalut d''une demi-heure au chalut de fond \u00E0 grande ouverture verticale, sont r\u00E9alis\u00E9s. Chaque trait couvre une surface de 0,067 km\u00B2. Cette campagne est repr\u00E9sentative des 72 500 km\u00B2 du golfe de Gascogne. La campagne Evhoe couvre donc le golfe de Gascogne et la mer Celtique avec le m\u00EAme protocole. De plus elle est coordonn\u00E9e internationalement, dans le cadre des campagnes IBTS, avec une campagne espagnole en mer Cantabrique, une campagne irlandaise et une campagne anglaise en mer Celtique.
-message.survey.atlantique.gascogne.evhoe1=Manuel des protocoles EVHOE - Version 1.0 (2005)
-message.survey.atlantique.gascogne.plus=Pour en savoir plus sur les campagnes Evhoe
-message.survey.atlantique.gascogne=Golfe de Gascogne
-message.survey.atlantique.vilaine.desc=Campagne sur la nourricerie de la baie de Vilaine (NourVil), d''une semaine \u00E0 l''automne, tous les ans de 1980 \u00E0 2010, sauf en 1991, 1994, 1995, 1998, 1999, 2006 et 2007, au chalut \u00E0 perche de 3 m\u00E8tres de large. En moyenne, 30 chalutages de 15 minutes sont r\u00E9alis\u00E9s. Chaque trait couvre une surface d''environ 0,0041 km\u00B2. Cette campagne est repr\u00E9sentative des 330 km\u00B2 de la baie.
-message.survey.atlantique.vilaine.nourvil1=Manuel des protocoles Nourriceries Gascogne - V 1.0 (2002)
-message.survey.atlantique.vilaine.plus=Pour en savoir plus sur les campagnes Nourvil
-message.survey.atlantique.vilaine=Baie de Vilaine
-message.survey.atlantique=Fa\u00E7ade Atlantique
-message.survey.dataengincasier=Un \u00E9chantillonnage au casier pour les campagnes d''\u00E9valuation des grands crustac\u00E9s, en particulier le homard, aux abords du cap de Flamanville.
-message.survey.dataenginfond=Un chalut de fond \u00E0 grande ouverture verticale pour l''observation des ressources d\u00E9mersales, sur les plateaux continentaux et le haut des pentes continentales (accores) en mer du Nord, Manche orientale, mer Celtique, golfe de Gascogne, golfe du Lion et Est de la Corse,
-message.survey.dataenginperche=Un chalut \u00E0 perche pour les zones tr\u00E8s c\u00F4ti\u00E8res et les estuaires lors des campagnes visant les juv\u00E9niles de poissons plats : baies de Somme et de Vilaine,
-message.survey.dataengintitle=Diff\u00E9rents engins d''\u00E9chantillonnage sont utilis\u00E9s :
-message.survey.detailstitle=Caract\u00E9ristiques des campagnes de surveillance halieutique de l''Ifremer
-message.survey.maintitle=Les campagnes de surveillance halieutique de l''Ifremer
-message.survey.mancheoccidentale.flamanville.crustaflam1=Manuel des protocoles CRUSTAFLAM - Version 1.0 (2003)
-message.survey.mancheoccidentale.flamanville.desc=Deux campagnes de 15 jours aux casiers \u00E0 crustac\u00E9s aux abords du cap de Flamanville (CrustaFlam), en juin et septembre, depuis 1986 : 1200 casiers relev\u00E9s par campagne sur une zone de 26 km\u00B2.
-message.survey.mancheoccidentale.flamanville.plus=Pour en savoir plus sur les campagnes CrustFlam
-message.survey.mancheoccidentale.flamanville=Abords du cap de Flamanville
-message.survey.mancheoccidentale=Fa\u00E7ade Manche occidentale
-message.survey.mancheorientale.baiedeseine=Baie de Seine
-message.survey.mancheorientale.baiedeseine.desc=Campagnes annuelles de prospection sur les nourriceries de l''estuaire de Seine et de la baie de Seine orientale (NourSeine) effectu\u00E9es essentiellement \u00E0 l''automne, de 1995 \u00E0 2002. L''objectif premier \u00E9tait d''identifier les nourriceries c\u00F4ti\u00E8res de ce site et d''en \u00E9valuer la richesse halieutique et macro-\u00E9pibenthique. Environ 45 traits effectu\u00E9s \u00E0 chaque campagne, \u00E0 l''aide d''un chalut \u00E0 perche standard.
-message.survey.mancheorientale.baiedeseine.plus=Pour en savoir plus sur les campagnes NourSeine
-message.survey.mancheorientale.baiedeseine.nourseine1=http://archimer.ifremer.fr/doc/00036/14714/
-message.survey.mancheorientale.baiedesomme.desc=Campagne de p\u00EAche sur la nourricerie de la baie de Somme (NourSomme) d''une semaine en septembre-octobre, tous les ans depuis 1995, aux chaluts \u00E0 perche de 2 m\u00E8tres de large dans la partie la plus estuarienne de la baie et 3 m\u00E8tres dans la partie externe, plus marine. En moyenne 50 chalutages sont r\u00E9alis\u00E9s chaque ann\u00E9e. Ils durent en moyenne 7 minutes sur une surface de 0,001 km\u00B2 chacun dans la partie interne de la baie et 15 minutes sur une surface d''environ 0,004 km\u00B2 dans la partie externe. Cette campagne est repr\u00E9sentative des 720 km\u00B2 de la baie.
-message.survey.mancheorientale.baiedesomme.noursomme1=Manuel des protocoles Nourriceries Somme - V 1.0 (2002)
-message.survey.mancheorientale.baiedesomme.plus=Pour en savoir plus sur les campagnes NourSomme
-message.survey.mancheorientale.baiedesomme=Baie de Somme
-message.survey.mancheorientale.mancheorientale.cgfs1=Manuel des protocoles CGFS - Version 1.0 (2002)
-message.survey.mancheorientale.mancheorientale.desc=Campagne fran\u00E7aise CGFS (Channel Ground Fish Survey) d''un mois en octobre, coordonn\u00E9e au plan international avec les campagnes IBTS. La campagne a lieu tous les ans depuis 1988. En moyenne 90 traits d''une demi-heure, au chalut de fond \u00E0 grande ouverture verticale, sont r\u00E9alis\u00E9s. Chaque trait couvre une surface d''environ 0,03 km\u00B2. Cette campagne est repr\u00E9sentative des 70 748 km\u00B2 de la Manche orientale.
-message.survey.mancheorientale.mancheorientale.plus=Pour en savoir plus sur les campagnes CGFS
-message.survey.mancheorientale.mancheorientale=Manche orientale
-message.survey.mancheorientale=Fa\u00E7ade Manche orientale
-message.survey.mediterranee.estcorse.desc=Contribution fran\u00E7aise \u00E0 la campagne internationale Medits (International bottom Trawl Surveys in the Mediterranean), d''une semaine au printemps, tous les ans depuis 1994, sauf en 2002, au chalut de fond \u00E0 grande ouverture verticale \u00E0 ailes courtes. En moyenne 20 chalutages sont r\u00E9alis\u00E9s, d''une demi-heure couvrant une surface d''environ 0,05 km\u00B2 chacun pour les profondeurs inf\u00E9rieures \u00E0 200 m\u00E8tres et d''une heure (surface d''environ 0,1\u00A0km\u00B2) pour les profondeurs sup\u00E9rieures \u00E0 200 m\u00E8tres. La campagne est repr\u00E9sentative des 4 562 km\u00B2 du plateau insulaire de l''est de la Corse.
-message.survey.mediterranee.estcorse.medits1=Manuel des protocoles Medits, Version 1 (1994)
-message.survey.mediterranee.estcorse.medits2=Manuel des protocoles Medits, Version 2 (1995)
-message.survey.mediterranee.estcorse.medits3=Manuel des protocoles Medits, Version 3 (1999)
-message.survey.mediterranee.estcorse.medits4=Manuel des protocoles Medits, Version 4 (2001)
-message.survey.mediterranee.estcorse.medits5=Manuel des protocoles Medits, Version 5 (2007)
-message.survey.mediterranee.estcorse.medits6=Manuel des protocoles Medits, Version 6 (2012)
-message.survey.mediterranee.estcorse.plus=Pour en savoir plus sur les campagnes Medits
-message.survey.mediterranee.estcorse=Est de la Corse
-message.survey.mediterranee.golfelion.desc=Contribution fran\u00E7aise aux campagnes internationales Medits (International bottom Trawl Surveys in the Mediterranean), d''un mois au deuxi\u00E8me trimestre tous les ans depuis 1994 au chalut de fond \u00E0 grande ouverture verticale \u00E0 ailes courtes. En moyenne 69 chalutages sont r\u00E9alis\u00E9s, d''une demi-heure couvrant une surface d''environ 0,05 km\u00B2 chacun pour les profondeurs inf\u00E9rieures \u00E0 200 m\u00E8tres et d''une heure (surface d''environ 0,1\u00A0km\u00B2) pour les profondeurs sup\u00E9rieures \u00E0 200 m\u00E8tres. Medits est repr\u00E9sentative des 13 860 km\u00B2 du golfe de Lion.
-message.survey.mediterranee.golfelion.medits1=Manuel des protocoles Medits, Version 1 (1994)
-message.survey.mediterranee.golfelion.medits2=Manuel des protocoles Medits, Version 2 (1995)
-message.survey.mediterranee.golfelion.medits3=Manuel des protocoles Medits, Version 3 (1999)
-message.survey.mediterranee.golfelion.medits4=Manuel des protocoles Medits, Version 4 (2001)
-message.survey.mediterranee.golfelion.medits5=Manuel des protocoles Medits, Version 5 (2007)
-message.survey.mediterranee.golfelion.medits6=Manuel des protocoles Medits, Version 6 (2012)
-message.survey.mediterranee.golfelion.plus=Pour en savoir plus sur les campagnes Medits
-message.survey.mediterranee.golfelion=Golfe du Lion
-message.survey.mediterranee=Fa\u00E7ade M\u00E9diterran\u00E9e
-message.survey.merdunord.sudmerdunord.desc=Contribution fran\u00E7aise d''un mois \u00E0 la campagne internationale IBTS (International Bottom Trawl Survey) au premier trimestre, tous les ans depuis 1980, au chalut de fond \u00E0 grande ouverture verticale. En moyenne, le navire fran\u00E7ais fait 58 chalutages par an. Le sud de la mer du Nord est couvert par 4 navires (fran\u00E7ais, belge, danois et allemand) qui r\u00E9alisent en tout environ 200 traits par an. Chaque trait dure une demi-heure et couvre une surface d''environ 0,067 km\u00B2. Cette campagne est repr\u00E9sentative des 678\u00A0000\u00A0km\u00B2 de la zone.
-message.survey.merdunord.sudmerdunord.ibts6=Manuel des protocoles IBTS - R\u00E9vision VI (1999)
-message.survey.merdunord.sudmerdunord.ibts7=Manuel des protocoles IBTS - R\u00E9vision VII (2004)
-message.survey.merdunord.sudmerdunord.plus=Pour en savoir plus sur les campagnes IBTS
-message.survey.merdunord.sudmerdunord=Sud mer du Nord
-message.survey.merdunord=Fa\u00E7ade Mer du Nord
-message.survey.paragraph1=Les campagnes de p\u00EAche scientifique standardis\u00E9es ont pour objectif d''observer les ressources halieutiques, en suivant toujours les m\u00EAmes m\u00E9thodes d''\u00E9chantillonnage. Elles sont toujours r\u00E9alis\u00E9es dans la m\u00EAme zone, \u00E0 la m\u00EAme saison, avec des engins de p\u00EAche standardis\u00E9s, afin que les donn\u00E9es soient comparables d''ann\u00E9e en ann\u00E9e. Elles servent \u00E0 d\u00E9crire les esp\u00E8ces, qu''elles soient commerciales ou non, d''une zone et \u00E0 observer les changements s''il y en a. Les poissons, les mollusques et les crustac\u00E9s sont d\u00E9nombr\u00E9s, mesur\u00E9s et pes\u00E9s. Certains d''entre eux font l''objet de pr\u00E9l\u00E8vements biologiques. Chaque campagne fournit ainsi une repr\u00E9sentation quantitative de l''ensemble des esp\u00E8ces de la zone \u00E0 une p\u00E9riode donn\u00E9e. Selon les s\u00E9ries, d''autres informations sont relev\u00E9es (temp\u00E9rature, salinit\u00E9, macrofaune, observation des mammif\u00E8res marins, oiseaux, macro d\u00E9chets etc., mais ne sont pas pr\u00E9sent\u00E9es dans ce site)
-message.survey.paragraph2=Depuis une vingtaine d''ann\u00E9es, l''Ifremer organise des campagnes de p\u00EAche scientifique en mer du Nord, en Manche, en Atlantique et en M\u00E9diterran\u00E9e concernant les ressources d\u00E9mersales et benthiques. L''objectif prioritaire est de produire des indices d''abondance des principales esp\u00E8ces commerciales. Elles recueillent \u00E9galement des donn\u00E9es sur les esp\u00E8ces captur\u00E9es non commerciales. Elles contribuent ainsi aux connaissances n\u00E9cessaires au d\u00E9veloppement de l''approche \u00E9cosyst\u00E9mique des p\u00EAches, notamment dans le cadre de la politique commune des p\u00EAches et plus largement de la strat\u00E9gie marine de l''Union europ\u00E9enne.
-message.survey.paragraph3=Les campagnes sont r\u00E9alis\u00E9es selon des plans d''\u00E9chantillonnage standardis\u00E9s. L''engin de p\u00EAche et son gr\u00E9ement, la position des stations, le tri des captures, les pr\u00E9l\u00E8vements biologiques suivent des protocoles fix\u00E9s.
-message.survey.paragraph4=Pour les campagnes coordonn\u00E9es entre navires de recherche des pays riverains en mer du Nord, Manche orientale, mer Celtique, golfe de Gascogne et M\u00E9diterran\u00E9e, les protocoles sont communs \u00E0 l''ensemble des pays partenaires. Les traits de chalut des diff\u00E9rents navires de recherche sont comparables.
-message.survey.paragraph5=Chaque zone \u00E9tudi\u00E9e est d\u00E9coup\u00E9e en strates en fonction de la profondeur, de la latitude ou d''autres crit\u00E8res. L''\u00E9chantillonnage pr\u00E9voit un nombre de traits de chalut ou de mouillages de casiers par strate.
-message.survey.paragraph6=Dans une campagne de chalutage scientifique, les positions des traits de chalut sont choisies selon un plan d''\u00E9chantillonnage statistique. L''objectif n''est pas d''obtenir les meilleures captures possibles comme le recherchent les p\u00EAcheurs, mais de r\u00E9colter des donn\u00E9es comparables d''une ann\u00E9e sur l''autre afin de relever des \u00E9volutions.
\ No newline at end of file
Deleted: trunk/coser-web/src/main/resources/fr/ifremer/coser/web/package_fr.properties
===================================================================
--- trunk/coser-web/src/main/resources/fr/ifremer/coser/web/package_fr.properties 2014-03-09 06:34:41 UTC (rev 1139)
+++ trunk/coser-web/src/main/resources/fr/ifremer/coser/web/package_fr.properties 2014-03-10 10:23:18 UTC (rev 1140)
@@ -1,210 +0,0 @@
-###
-# #%L
-# Coser :: Web
-# %%
-# Copyright (C) 2010 - 2012 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%
-###
-message.admin.title=Coser admin
-message.admin.indexaction=Actions d''administration
-message.admin.listprojects.deleteselected=Supprimer les projets s\u00E9lectionn\u00E9s
-message.admin.listprojects.title=Gestion des projets
-message.admin.listprojects.indicatorsprojects=Projects d'indicateur par zones
-message.admin.listprojects.indicatorsprojects.comment=La suppression d''un projets d''indicateur supprimera \u00E9galement la possibilit\u00E9 de t\u00E9l\u00E9charger les donn\u00E9es sources du projet concern\u00E9.
-message.admin.listprojects.mapsprojects=Projects de cartes par zones
-message.admin.login=Identifiant
-message.admin.loginrequiered=Autentification requise
-message.admin.password=Mot de passe
-message.com.downloadascsv=T\u00E9l\u00E9charger en CSV
-message.com.downloadaszip=T\u00E9l\u00E9charger en ZIP
-message.com.moredetailspdf=Plus d''informations sur les indices calcul\u00E9s des communaut\u00E9s
-message.com.paragraph1=Des indices de communaut\u00E9 sont calcul\u00E9s pour un ensemble de taxon dans chaque s\u00E9rie. La liste des taxons inclus pour le calcul de chaque indice varie selon les donn\u00E9es disponibles pour la r\u00E9alisation des calculs.
-message.com.paragraph2=La liste des esp\u00E8ces incluses dans le calcul de chaque indice de communaut\u00E9 est pr\u00E9sent\u00E9e dans le dossier t\u00E9l\u00E9chargable sous chaque graphe (fichier \"Information.pdf\").
-message.com.selectindicatorlist=S\u00E9lectionner une liste de donn\u00E9es
-message.com.title=Indices de communaut\u00E9s
-message.common.anchortop=Haut
-message.common.community=communaut\u00E9
-message.common.facade=Facade
-message.common.indicatorsof=Indicateurs de
-message.common.jsreadmore=Voir la suite
-message.common.noresults=Aucun r\u00E9sultat disponible.
-message.common.population=population
-message.common.selectall=Tout s\u00E9lectionner
-message.common.selectnone=Tout d\u00E9-s\u00E9lectionner
-message.common.selectfacade=S\u00E9lectionnez une fa\u00E7ade
-message.common.selectindicator=S\u00E9lectionnez un indicateur
-message.common.selectpop=S\u00E9lectionnez une population
-message.common.selectspecies=S\u00E9lectionnez une esp\u00E8ce
-message.common.selectsurvey=S\u00E9lectionnez une campagne
-message.common.selectzone=S\u00E9lectionnez une zone
-message.common.species=Esp\u00E8ces
-message.common.validform=Valider
-message.common.zone=Zone
-message.common.zones=Zones
-message.common.datatypes=Type de donn\u00E9es
-message.documents.genparagraph1=Grands invert\u00E9br\u00E9s et poissons observ\u00E9s par les campagnes scientifiques. Atlas de distribution. Bilan 2008. 2009. {0}
-message.documents.genparagraph2=Grands invert\u00E9br\u00E9s et poissons observ\u00E9s par les campagnes scientifiques. Bilan 2007. 2009. {0}
-message.documents.genparagraph3=L''\u00E9tat des communaut\u00E9s exploit\u00E9es au large des c\u00F4tes de France. Application d''indicateurs \u00E0 l''\u00E9valuation de l''impact de la p\u00EAche. Bilan 2004 Edition 2009. {0}
-message.documents.genparagraph4=Poissons et invert\u00E9br\u00E9s au large des c\u00F4tes de France. Indicateurs issus des p\u00EAches scientifiques. Bilan 2004. 2007. {0}
-message.documents.gentitle1=Rapports g\u00E9n\u00E9raux
-message.documents.activityparagraph1=Battaglia A., V. M. Trenkel & M. J. Rochet, 2006. Estimating end effects in trawl catches. ICES J. Mar. Sci. 63: 956-959.
-message.documents.activityparagraph2=Lorance P., J. A. Bertrand, A. Brind''Amour, M. J. Rochet & V. Trenkel, 2009. Assessment of impacts from human activities on ecosystem components in the Bay of Biscay in the early 1990s. Aquatic living resources 22: 409-431.
-message.documents.activityparagraph3=Rochet M. J., M. Prigent, J. A. Bertrand, A. Carpentier, F. Coppin, J. P. Delpech, G. Fontenelle, E. Foucher, K. Mah\u00E9, E. Rostiaux & V. M. Trenkel, 2008. Ecosystem trends: evidence for agreement between fishers'' perceptions and scientific information. ICES J. Mar. Sci. 65: 1057-1068.
-message.documents.activityparagraph4=Rochet M. J. & J. Rice, 2005. Do explicit criteria help in selecting indicators for ecosystem-based fisheries management? ICES J. Mar. Sci. 62: 528-539.
-message.documents.activityparagraph5=Rochet M. J. & V. Trenkel, 2003. Which community indicators can measure the impact of fishing? A review and proposals. Can. J. Fish. Aquat. Sci. 60: 86-99.
-message.documents.activityparagraph6=Rochet M. J., V. M. Trenkel, R. Bellail, F. Coppin, O. Le Pape, J.-C. Mah\u00E9, A. Morin, J.-C. Poulard, I. Schlaich, A. Souplet, Y. V\u00E9rin & J. A. Bertrand, 2005. Combining indicator trends to assess ongoing changes in exploited fish communities: diagnostic of communities off the coasts of France. ICES Journal of Marine Science 62: 1647-1664.
-message.documents.activityparagraph7=Rochet M. J., V. M. Trenkel, A. Carpentier, F. Coppin, L. Gil de Sola Simarro, J. P. L\u00E9aut\u00E9, J. C. Mah\u00E9, P. Maiorano, A. Mannini, M. Murenu, G. Piet, C. Politou, B. Reale, M. T. Spedicato, G. Tserpes & J. A. Bertrand, 2010. Do changes in environmental pressures impact marine communities? An empirical assessment. J. Applied Ecology 47 (4): 741-750. Publisher''s official version : {0}, Open Access version : {1}
-message.documents.activityparagraph8=Trenkel V. & M. J. Rochet, 2003. Performance of indicators derived from abundance estimates for detecting the impact of fishing on a fish community. Can. J. Fish. Aquat. Sci. 60: 67-85.
-message.documents.activitytitle2=Publications des membres du GT relatives \u00E0 l''activit\u00E9 du groupe
-message.documents.indicatorparagraph1=Dreves L., C. Abernot-Le Gac, E. Antajan, P. Clabaut, P. Claquin, M.L. Cochard, P. Monbet, J. Morin, A. T\u00E9tard, C. Warenbourg & H. Thillaye du Boullay, 2010. Synth\u00E8se hydrobiologique du site \u00E9lectronucl\u00E9aire de Penly. Ifremer. DOP/LER/2010.05. 280 p.
-message.documents.indicatortitle3=Travaux ayant utilis\u00E9 les r\u00E9sultats du groupe de travail sur les indicateurs de populations et de peuplements
-message.documents.title=Documents
-message.index.datatypecom=Des indices de communaut\u00E9 par zone
-message.index.datatypemap=Des cartes de distribution par esp\u00E8ce et par zone
-message.index.datatypepop=Des indices biologiques par esp\u00E8ce et par zone
-message.index.datatypesource=Des donn\u00E9es par op\u00E9ration d''\u00E9chantillonnage (en g\u00E9n\u00E9ral par trait de chalut)
-message.index.datatypesource.short=Des donn\u00E9es par op\u00E9ration d''\u00E9chantillonnage
-message.index.datatypetitle=Consultation des donn\u00E9es en ligne
-message.index.documentsmessage=Documents
-message.index.documentstitle=Documents
-message.index.extractdatatitle=Extraction des donn\u00E9es
-message.index.extractdatalink=Formulaire de recherche
-message.index.paragraph1=Ce site a \u00E9t\u00E9 con\u00E7u pour fournir en libre acc\u00E8s des donn\u00E9es brutes et des donn\u00E9es \u00E9labor\u00E9es relatives aux campagnes scientifiques d''observation halieutique conduites par l''Ifremer le long des c\u00F4tes fran\u00E7aises.
-message.index.paragraph2=Toutes les donn\u00E9es mises \u00E0 disposition ont fait l''objet de qualification selon des protocoles sp\u00E9cifiques. La qualit\u00E9 des interpr\u00E9tations \u00E9tant directement li\u00E9e \u00E0 la nature des donn\u00E9es source, les utilisateurs de donn\u00E9es sont invit\u00E9s \u00E0 consid\u00E9rer avec attention les descriptions des protocoles mis en \u0153uvre ainsi que les niveaux de qualit\u00E9 contr\u00F4l\u00E9s.
-message.index.paragraph3=Chaque s\u00E9rie de campagnes est conduite selon une strat\u00E9gie d''\u00E9chantillonnage sp\u00E9cifique. Sauf cas particuliers, les analyses et interpr\u00E9tations doivent \u00EAtre conduites par s\u00E9rie, en prenant en compte les strat\u00E9gies d''\u00E9chantillonnage propres \u00E0 chacune de ces s\u00E9ries. Sur le site, les donn\u00E9es sont pr\u00E9sent\u00E9es par s\u00E9rie.
-message.index.paragraph4=Dans les tables de donn\u00E9es, toutes les esp\u00E8ces sont identifi\u00E9es selon le r\u00E9f\u00E9rentiel taxinomique du Syst\u00E8me d''informations halieutiques de l''Ifremer ({0}).
-message.index.paragraph5=Les liens ci-dessous vous permet d''extraire les \u00E9l\u00E9ments du site (graphique et donn\u00E9es) sous la forme d''un fichier .zip (contenant un document pdf et les donn\u00E9es)
-message.index.partnertitle=Membres du groupe
-message.index.partnerparagraph1=Les r\u00E9sultats pr\u00E9sent\u00E9s sur ce site sont le produit de l''activit\u00E9 d''un groupe de travail de l''Ifremer qui se r\u00E9unit chaque ann\u00E9e depuis 2001 pour d\u00E9velopper des indicateurs de populations et de peuplements \u00E0 partir des donn\u00E9es des s\u00E9ries de campagnes halieutiques standardis\u00E9es conduites depuis la fin des ann\u00E9es 1970 par l''Ifremer le long des c\u00F4tes de France m\u00E9tropolitaine. Les principaux membres du groupe sont (par ordre alphab\u00E9tique de site et de patronyme)\u00A0: Florence Sanchez (Anglet), Franck Coppin, Sandrine Vaz et Yves V\u00E9rin (Boulogne-sur-mer), Andr\u00E9 Battaglia et Jean-Pierre L\u00E9aut\u00E9 (L''Houmeau), Jean-Claude Mah\u00E9 et Mich\u00E8le Salaun (Lorient), Jacques Bertrand, Anik Brind''Amour, Yves D\u00E9saunay, Pascal Laffargue, Olivier Le Pape, J\u00E9r\u00E9my Lobry, Pascal Lorance, Jean-Charles Poulard, Marie-Jo\u00EBlle Rochet et Verena Trenkel (Nantes), Marie-Laure Cochard, Jocelyne Morin et Ivan Schlaich (Port-en-Bessin), Ang\u00E9lique Jadaud et Arnaud Souplet (S\u00E8te). La d\u00E9marche qualit\u00E9 est g\u00E9r\u00E9e par Vincent Badts. Le support informatique de gestion des donn\u00E9es est assur\u00E9 par Olivier Berthel\u00E9.
-message.index.qualitymessage=Avertissement qualit\u00E9
-message.index.qualitytitle=Avertissement qualit\u00E9
-message.index.quotemessage=Ifremer {0,date,yyyy}. Indices de populations et de communautés issus des campagnes de surveillance halieutique de l''Ifremer. {1} ({0,date,dd MMMM})
-message.index.quotetitle=Pour citer ce site
-message.index.surveyparagraph=Des manuels des protocoles d\u00E9crivent les modalit\u00E9s techniques de r\u00E9alisation de chaque s\u00E9rie de campagnes.
-message.index.surveytitle=Description des campagnes
-message.index.thankstitle=Remerciements
-message.index.thanksparagraph1=Bien que toutes les s\u00E9ries de campagnes dont des r\u00E9sultats sont pr\u00E9sent\u00E9s sur ce site aient \u00E9t\u00E9 conduites par l''Ifremer, elles ont fait l''objet de financements vari\u00E9s. Certaines, apr\u00E8s une phase \u00E9ventuelle de financement unique par l''Ifremer font l''objet de cofinancements, comme les s\u00E9ries IBTS, Evhoe et Medits retenues au titre du r\u00E8glement europ\u00E9en sur la collecte des donn\u00E9es halieutiques (DCF). D''autres sont prises en charge en totalit\u00E9 par l''Ifremer, comme les s\u00E9ries NourVil et CGFS (cette derni\u00E8re \u00E9tant en cours d''\u00E9valuation pour une reconnaissance au titre du r\u00E8glement europ\u00E9en sur la collecte des donn\u00E9es halieutiques - DCF). Pour la s\u00E9rie NourSein, les campagnes ont \u00E9t\u00E9 co-financ\u00E9es par le conseil r\u00E9gional de Haute Normandie, le GPMH, le programme Liteau, le programme Seine Aval et le GIP-Seine Aval, selon les ann\u00E9es. Enfin, les s\u00E9ries Crustaflam et NourSomme sont financ\u00E9es en totalit\u00E9 par EDF au titre de la surveillance de centrales nucl\u00E9aires littorales, dans le cadre de contrats entre Ifremer et EDF. Le pr\u00E9sent site a \u00E9t\u00E9 cr\u00E9\u00E9 gr\u00E2ce \u00E0 un soutien du MEEDDM (contrat Ifremer-MEEDDM 2010). Pour l''\u00E9tablissement des indices en mer du Nord, les donn\u00E9es sources utilis\u00E9es sont celles mises \u00E0 disposition par les diff\u00E9rents pays partenaires de la s\u00E9rie IBTS dans la base Datras du CIEM (http://datras.ices.dk)
-message.index.title=Accueil
-message.layout.oceanicdata1=le Syst\u00E8me d''informations scientifiques pour la mer de l''Ifremer (SISMER)
-message.layout.oceanicdata2=le Syst\u00E8me d''information halieutique de l''Ifremer (SIH)
-message.layout.oceanicdatatitle=Gestion des donn\u00E9es des campagnes oc\u00E9anographiques \u00E0 l''Ifremer
-message.layout.title=Indices de populations et de communaut\u00E9s issus des campagnes de surveillance halieutique auxquelles participe l''Ifremer
-message.map.citation=Trenkel V.M., O. Berthel\u00E9, P. Lorance, J.A. Bertrand, A. Brind''Amour, M.L. Cochard, F. Coppin, J.P. Leaut\u00E9, J.C. Mah\u00E9, J. Morin, M.J. Rochet, M. Salaun, A. Souplet & Y. V\u00E9rin, 2009. Grands invert\u00E9br\u00E9s et poissons observ\u00E9s par les campagnes scientifiques. Atlas de distribution. Bilan 2008. Ifremer, Nantes. EMH : 09-003. {0}. 100 p.
-message.map.citationtitle=Citation
-message.map.downloadaspdf=T\u00E9l\u00E9charger en PDF
-message.map.linkarchimer=Acc\u00E8s \u00E0 l''atlas : {0}
-message.map.paragraph1=L''objectif de cet atlas est de donner un aper\u00E7u de la distribution spatiale des esp\u00E8ces de poissons et de certains invert\u00E9br\u00E9s marins \u00E0 partir des observations des campagnes de p\u00EAche scientifiques.
-message.map.paragraph2=Pour chaque zone un quadrillage syst\u00E9matique a \u00E9t\u00E9 d\u00E9fini, puis la densit\u00E9 moyenne par km\u00B2 dans chaque cellule a \u00E9t\u00E9 calcul\u00E9e en utilisant les observations de toute la p\u00E9riode. Pour la repr\u00E9sentation cartographique, les cellules avec des densit\u00E9s moyenne correspondant aux quartiles de densit\u00E9 ont re\u00E7u la m\u00EAme couleur\u00A0: bleu\u00A0: esp\u00E8ce jamais observ\u00E9e, jaune clair\u00A0: densit\u00E9 moyenne entre [0 et 25\u00A0%[; jaune fonc\u00E9\u00A0: [25-50\u00A0%[, orange\u00A0: [50-75\u00A0%[ et rouge\u00A0: [75-100\u00A0%]. Donc, les zones o\u00F9 se trouvent les densit\u00E9s les plus \u00E9lev\u00E9es en moyenne sont repr\u00E9sent\u00E9es en rouge.
-message.map.title=Cartes de distribution
-message.map.warning=Avertissement
-message.map.warningcontent=Les cartes pr\u00E9sent\u00E9es ne doivent pas \u00EAtre interpr\u00E9t\u00E9es comme des cartes de distribution des esp\u00E8ces mais comme celle des zones o\u00F9 elles sont captur\u00E9es lors des campagnes scientifiques. Les campagnes \u00E9tant r\u00E9alis\u00E9es avec des chaluts diff\u00E9rents et \u00E0 diff\u00E9rentes saisons, les esp\u00E8ces peuvent avoir des capturabilit\u00E9s tr\u00E8s diff\u00E9rentes entre les s\u00E9ries de campagnes, donc d''une zone \u00E0 l''autre.
-message.pop.downloadascsv=T\u00E9l\u00E9charger en CSV
-message.pop.moredetailspdf=Plus d''informations sur les indices calcul\u00E9s des populations
-message.pop.paragraph1=Les indices pr\u00E9sent\u00E9s ont \u00E9t\u00E9 s\u00E9lectionn\u00E9s en r\u00E9f\u00E9rence \u00E0 leur aptitude \u00E0 renseigner sur l''impact de la p\u00EAche, en vue de leur int\u00E9gration dans des tableaux de bord d''indicateurs d''\u00E9volution d''\u00E9cosyst\u00E8mes exploit\u00E9s par la p\u00EAche.
-message.pop.paragraph2=Les donn\u00E9es disponibles sur le site sont les valeurs de chaque indice. Les informations ont \u00E9t\u00E9 valid\u00E9es par un groupe de travail dans une approche int\u00E9grative d''indicateurs de populations et de communaut\u00E9s. Les r\u00E9sultats sont donn\u00E9s par zone g\u00E9ographique et par esp\u00E8ce pour l''ensemble de la s\u00E9rie de donn\u00E9es disponible. L''utilisateur peut s\u00E9lectionner la zone g\u00E9ographique, la saison (dans le cas de s\u00E9ries saisonni\u00E8res), l''esp\u00E8ce et l''indice. Pour les s\u00E9lections pour lesquelles une information est disponible, le syst\u00E8me produit un graphe pr\u00E9sentant la distribution temporelle de l''indice, avec une repr\u00E9sentation de l''\u00E9cart-type. Il fournit la possibilit\u00E9 d''extraire la table des donn\u00E9es correspondantes, incluant la valeur de l''indice par ann\u00E9e, ainsi que son \u00E9cart-type et son coefficient de variation.
-message.pop.title=Indices biologiques
-message.quality.acceptance=Je reconnais avoir pris connaissance des documents et des restrictions associ\u00E9es et je m''engage \u00E0 citer la source des donn\u00E9es.
-message.quality.notaccepted=Vous devez valider les conditions Avertissement Qualit\u00E9 !
-message.quality.paragraph1=Bien que les donn\u00E9es aient \u00E9t\u00E9 pr\u00E9cautionneusement contr\u00F4l\u00E9es par l''Ifremer, des d\u00E9fauts inh\u00E9rents \u00E0 l''agr\u00E9gation des informations peuvent persister. Par exemple\u00A0:
-message.quality.paragraph2=En d\u00E9pit du fait que toutes les donn\u00E9es de toutes les s\u00E9ries de campagnes soient pr\u00E9sent\u00E9es selon le m\u00EAme format, sauf cas particuliers, des diff\u00E9rences dans les strat\u00E9gies d''observation emp\u00EAchent la combinaison de donn\u00E9es de diff\u00E9rentes campagnes dans une m\u00EAme analyse. Par exemple, la capturabilit\u00E9 d''une m\u00EAme esp\u00E8ce varie selon le type d''engin d''\u00E9chantillonnage utilis\u00E9. Il en r\u00E9sulte que chaque engin capture un sous-ensemble particulier des bioc\u00E9noses \u00E9chantillonn\u00E9es.
-message.quality.paragraph3=Une propri\u00E9t\u00E9 commune aux s\u00E9ries d''observations \u00E0 la mer est l''\u00E9volution dans le temps de la comp\u00E9tence des \u00E9quipes embarqu\u00E9es pour la d\u00E9termination des esp\u00E8ces. Il peut en r\u00E9sulter des apparitions, des disparitions ou des assignations sous un m\u00EAme nom de taxons proches dans les jeux de donn\u00E9es, non repr\u00E9sentatifs de l''\u00E9volution des populations concern\u00E9es dans l''\u00E9cosyst\u00E8me.
-message.quality.paragraph4=Pour les campagnes d''une m\u00EAme s\u00E9rie, des changements dans les proc\u00E9dures d''\u00E9chantillonnage, dans les caract\u00E9ristiques des engins, dans la p\u00E9riode de r\u00E9alisation de la campagne et la zone couverte peuvent influencer les captures. Pour pr\u00E9venir les risques de biais dans les analyses en raison de ces facteurs, les jeux de donn\u00E9es doivent \u00EAtre pr\u00E9alablement filtr\u00E9s ad\u00E9quatement.
-message.quality.paragraph5=Il est vivement recommand\u00E9 aux utilisateurs de donn\u00E9es de les traiter avec pr\u00E9caution. Si des utilisateurs s''interrogent sur la validit\u00E9 de donn\u00E9es, ils sont invit\u00E9s \u00E0 contacter l''administrateur de la base de donn\u00E9es ({0}).
-message.quality.title=Avertissement Qualit\u00E9
-message.search.extract.extract=Extraire
-message.search.extract.speciesindicators=Esp\u00E8ces et indicateurs
-message.search.extract.title=Extraction des donn\u00E9es
-message.search.extract.updatelists=Suite
-message.search.extract.waittitle=Extraction en cours...
-message.search.extract.waitparagraph1=Les donn\u00E9es sont en cours d''extraction. Merci de patienter.
-message.search.extract.waitparagraph2=Cette op\u00E9ration peut prendre plusieurs minutes dans le cas o\u00F9 de nombreux graphiques doivent \u00EAtre g\u00E9n\u00E9r\u00E9s.
-message.search.extract.waitparagraph3=Apr\u00E8s le t\u00E9l\u00E9chargement, fermer cette page en revenant sur la page d''accueil du site.
-message.search.extract.zonetype=Zone et type de donn\u00E9es
-message.source.download=T\u00E9l\u00E9charger
-message.source.paragraph1=Les donn\u00E9es de base sont pr\u00E9sent\u00E9es selon quatre tables fournissant des informations de base \u00E9lev\u00E9es \u00E0 l''op\u00E9ration d''\u00E9chantillonnage (en g\u00E9n\u00E9ral un trait de chalut) et organis\u00E9es selon des unit\u00E9s g\u00E9ographiques d\u00E9finies en relation avec le plan d''\u00E9chantillonnage. Une table suppl\u00E9mentaire pr\u00E9sente le r\u00E9f\u00E9rentiel taxinomique associ\u00E9 aux donn\u00E9es. Il s''agit des donn\u00E9es utilis\u00E9es pour r\u00E9aliser les calculs des indicateurs pr\u00E9sent\u00E9s. Ces donn\u00E9es ont fait l''objet de filtrages et de regroupements \u00E9ventuels par rapport aux donn\u00E9es de base de chaque s\u00E9rie, afin d''assurer la coh\u00E9rence des jeux de donn\u00E9es en vue du calcul des indicateurs. Ainsi, pour certaines s\u00E9ries, des groupes entiers (e.g. les amphihalins) ont pu \u00EAtre retir\u00E9s. Pour certaines s\u00E9ries, certaines ann\u00E9es ou certaines strates ont \u00E9t\u00E9 retir\u00E9es afin de pr\u00E9server l''homog\u00E9n\u00E9it\u00E9 de la s\u00E9rie. Dans des cas d''\u00E9volution du niveau de d\u00E9termination au cours de la s\u00E9rie, plusieurs taxons ont \u00E9t\u00E9 regroup\u00E9s \u00E0 un niveau sup\u00E9rieur.
-message.source.paragraph2=Les donn\u00E9es IBTS (donn\u00E9es fran\u00E7aises et donn\u00E9es des autres pays) issues de la base Datras du CIEM (http://datras.ices.dk) ont fait l''objet des m\u00EAmes contr\u00F4les de qualit\u00E9 que les autres s\u00E9ries de donn\u00E9es utilis\u00E9es, ainsi que de filtrages et de regroupements taxinomiques pour en pr\u00E9server la coh\u00E9rence vis-\u00E0-vis du pr\u00E9sent objectif de production d''indicateurs de tendances.
-message.source.paragraph3=Le site ne contient des donn\u00E9es de base que pour une partie des s\u00E9ries de campagnes pour lesquelles des indices de populations et de communaut\u00E9s sont pr\u00E9sent\u00E9s, selon les modalit\u00E9s d''acc\u00E8s \u00E0 ces donn\u00E9es. Pour un acc\u00E8s aux s\u00E9ries de donn\u00E9es source, il convient de contacter l''administrateur du Syst\u00E8me d''informations halieutiques de l''Ifremer ({0}) pour les donn\u00E9es fran\u00E7aises, et le site Datras du CIEM (http://datras.ices.dk) pour les donn\u00E9es IBTS des autres pays.
-message.source.paragraph4=Les donn\u00E9es de campagnes halieutiques sont constitu\u00E9es \u00E0 partir de stations d''\u00E9chantillonnage r\u00E9parties dans l''espace selon le principe de tirage stratifi\u00E9. La densit\u00E9 de l''\u00E9chantillonnage conditionne la partition g\u00E9ographique selon laquelle les indices de population et de communaut\u00E9 peuvent \u00EAtre \u00E9tablis.
-message.source.paragraph5=Les plans de zonage propos\u00E9s incluent le plan de r\u00E9f\u00E9rence correspondant au plan d''\u00E9chantillonnage, ainsi que des adaptations pour tenir compte des limites des sous-r\u00E9gions d\u00E9finies par la strat\u00E9gie marine europ\u00E9enne. Ils ont \u00E9t\u00E9 valid\u00E9s par un groupe de travail de l''Ifremer, apr\u00E8s exploration de la sensibilit\u00E9 de divers indices aux ajustements propos\u00E9s.
-message.source.title=Donn\u00E9es de base
-message.survey.atlantique.celtique.desc=Campagne Evhoe (Evaluation des ressources halieutiques de l''ouest europ\u00E9en) d''un mois au quatri\u00E8me trimestre, tous les ans depuis 1997. En moyenne 75 traits d''une demi-heure, au chalut de fond \u00E0 grande ouverture verticale, sont r\u00E9alis\u00E9s. Chaque trait couvre une surface d''environ 0,067 km\u00B2. Cette campagne est repr\u00E9sentative des 150 000 km\u00B2 de la mer Celtique.
-message.survey.atlantique.celtique.evhoe1=Manuel des protocoles EVHOE - Version 1.0 (2005)
-message.survey.atlantique.celtique.plus=Pour en savoir plus sur les campagnes Evhoe
-message.survey.atlantique.celtique=Mer Celtique
-message.survey.atlantique.gascogne.desc=Campagne Evhoe (Evaluation des ressources halieutiques de l''ouest europ\u00E9en) d''un mois au quatri\u00E8me trimestre, tous les ans depuis 1992 (sauf en 1993 et 1996). En moyenne, 70 traits de chalut d''une demi-heure au chalut de fond \u00E0 grande ouverture verticale, sont r\u00E9alis\u00E9s. Chaque trait couvre une surface de 0,067 km\u00B2. Cette campagne est repr\u00E9sentative des 72 500 km\u00B2 du golfe de Gascogne. La campagne Evhoe couvre donc le golfe de Gascogne et la mer Celtique avec le m\u00EAme protocole. De plus elle est coordonn\u00E9e internationalement, dans le cadre des campagnes IBTS, avec une campagne espagnole en mer Cantabrique, une campagne irlandaise et une campagne anglaise en mer Celtique.
-message.survey.atlantique.gascogne.evhoe1=Manuel des protocoles EVHOE - Version 1.0 (2005)
-message.survey.atlantique.gascogne.plus=Pour en savoir plus sur les campagnes Evhoe
-message.survey.atlantique.gascogne=Golfe de Gascogne
-message.survey.atlantique.vilaine.desc=Campagne sur la nourricerie de la baie de Vilaine (NourVil), d''une semaine \u00E0 l''automne, tous les ans de 1980 \u00E0 2010, sauf en 1991, 1994, 1995, 1998, 1999, 2006 et 2007, au chalut \u00E0 perche de 3 m\u00E8tres de large. En moyenne, 30 chalutages de 15 minutes sont r\u00E9alis\u00E9s. Chaque trait couvre une surface d''environ 0,0041 km\u00B2. Cette campagne est repr\u00E9sentative des 330 km\u00B2 de la baie.
-message.survey.atlantique.vilaine.nourvil1=Manuel des protocoles Nourriceries Gascogne - V 1.0 (2002)
-message.survey.atlantique.vilaine.plus=Pour en savoir plus sur les campagnes Nourvil
-message.survey.atlantique.vilaine=Baie de Vilaine
-message.survey.atlantique=Fa\u00E7ade Atlantique
-message.survey.dataengincasier=Un \u00E9chantillonnage au casier pour les campagnes d''\u00E9valuation des grands crustac\u00E9s, en particulier le homard, aux abords du cap de Flamanville.
-message.survey.dataenginfond=Un chalut de fond \u00E0 grande ouverture verticale pour l''observation des ressources d\u00E9mersales, sur les plateaux continentaux et le haut des pentes continentales (accores) en mer du Nord, Manche orientale, mer Celtique, golfe de Gascogne, golfe du Lion et Est de la Corse,
-message.survey.dataenginperche=Un chalut \u00E0 perche pour les zones tr\u00E8s c\u00F4ti\u00E8res et les estuaires lors des campagnes visant les juv\u00E9niles de poissons plats : baies de Somme et de Vilaine,
-message.survey.dataengintitle=Diff\u00E9rents engins d''\u00E9chantillonnage sont utilis\u00E9s :
-message.survey.detailstitle=Caract\u00E9ristiques des campagnes de surveillance halieutique de l''Ifremer
-message.survey.maintitle=Les campagnes de surveillance halieutique de l''Ifremer
-message.survey.mancheoccidentale.flamanville.crustaflam1=Manuel des protocoles CRUSTAFLAM - Version 1.0 (2003)
-message.survey.mancheoccidentale.flamanville.desc=Deux campagnes de 15 jours aux casiers \u00E0 crustac\u00E9s aux abords du cap de Flamanville (CrustaFlam), en juin et septembre, depuis 1986 : 1200 casiers relev\u00E9s par campagne sur une zone de 26 km\u00B2.
-message.survey.mancheoccidentale.flamanville.plus=Pour en savoir plus sur les campagnes CrustFlam
-message.survey.mancheoccidentale.flamanville=Abords du cap de Flamanville
-message.survey.mancheoccidentale=Fa\u00E7ade Manche occidentale
-message.survey.mancheorientale.baiedeseine=Baie de Seine
-message.survey.mancheorientale.baiedeseine.desc=Campagnes annuelles de prospection sur les nourriceries de l''estuaire de Seine et de la baie de Seine orientale (NourSeine) effectu\u00E9es essentiellement \u00E0 l''automne, de 1995 \u00E0 2002. L''objectif premier \u00E9tait d''identifier les nourriceries c\u00F4ti\u00E8res de ce site et d''en \u00E9valuer la richesse halieutique et macro-\u00E9pibenthique. Environ 45 traits effectu\u00E9s \u00E0 chaque campagne, \u00E0 l''aide d''un chalut \u00E0 perche standard.
-message.survey.mancheorientale.baiedeseine.plus=Pour en savoir plus sur les campagnes NourSeine
-message.survey.mancheorientale.baiedeseine.nourseine1=http://archimer.ifremer.fr/doc/00036/14714/
-message.survey.mancheorientale.baiedesomme.desc=Campagne de p\u00EAche sur la nourricerie de la baie de Somme (NourSomme) d''une semaine en septembre-octobre, tous les ans depuis 1995, aux chaluts \u00E0 perche de 2 m\u00E8tres de large dans la partie la plus estuarienne de la baie et 3 m\u00E8tres dans la partie externe, plus marine. En moyenne 50 chalutages sont r\u00E9alis\u00E9s chaque ann\u00E9e. Ils durent en moyenne 7 minutes sur une surface de 0,001 km\u00B2 chacun dans la partie interne de la baie et 15 minutes sur une surface d''environ 0,004 km\u00B2 dans la partie externe. Cette campagne est repr\u00E9sentative des 720 km\u00B2 de la baie.
-message.survey.mancheorientale.baiedesomme.noursomme1=Manuel des protocoles Nourriceries Somme - V 1.0 (2002)
-message.survey.mancheorientale.baiedesomme.plus=Pour en savoir plus sur les campagnes NourSomme
-message.survey.mancheorientale.baiedesomme=Baie de Somme
-message.survey.mancheorientale.mancheorientale.cgfs1=Manuel des protocoles CGFS - Version 1.0 (2002)
-message.survey.mancheorientale.mancheorientale.desc=Campagne fran\u00E7aise CGFS (Channel Ground Fish Survey) d''un mois en octobre, coordonn\u00E9e au plan international avec les campagnes IBTS. La campagne a lieu tous les ans depuis 1988. En moyenne 90 traits d''une demi-heure, au chalut de fond \u00E0 grande ouverture verticale, sont r\u00E9alis\u00E9s. Chaque trait couvre une surface d''environ 0,03 km\u00B2. Cette campagne est repr\u00E9sentative des 70 748 km\u00B2 de la Manche orientale.
-message.survey.mancheorientale.mancheorientale.plus=Pour en savoir plus sur les campagnes CGFS
-message.survey.mancheorientale.mancheorientale=Manche orientale
-message.survey.mancheorientale=Fa\u00E7ade Manche orientale
-message.survey.mediterranee.estcorse.desc=Contribution fran\u00E7aise \u00E0 la campagne internationale Medits (International bottom Trawl Surveys in the Mediterranean), d''une semaine au printemps, tous les ans depuis 1994, sauf en 2002, au chalut de fond \u00E0 grande ouverture verticale \u00E0 ailes courtes. En moyenne 20 chalutages sont r\u00E9alis\u00E9s, d''une demi-heure couvrant une surface d''environ 0,05 km\u00B2 chacun pour les profondeurs inf\u00E9rieures \u00E0 200 m\u00E8tres et d''une heure (surface d''environ 0,1\u00A0km\u00B2) pour les profondeurs sup\u00E9rieures \u00E0 200 m\u00E8tres. La campagne est repr\u00E9sentative des 4 562 km\u00B2 du plateau insulaire de l''est de la Corse.
-message.survey.mediterranee.estcorse.medits1=Manuel des protocoles Medits, Version 1 (1994)
-message.survey.mediterranee.estcorse.medits2=Manuel des protocoles Medits, Version 2 (1995)
-message.survey.mediterranee.estcorse.medits3=Manuel des protocoles Medits, Version 3 (1999)
-message.survey.mediterranee.estcorse.medits4=Manuel des protocoles Medits, Version 4 (2001)
-message.survey.mediterranee.estcorse.medits5=Manuel des protocoles Medits, Version 5 (2007)
-message.survey.mediterranee.estcorse.medits6=Manuel des protocoles Medits, Version 6 (2012)
-message.survey.mediterranee.estcorse.plus=Pour en savoir plus sur les campagnes Medits
-message.survey.mediterranee.estcorse=Est de la Corse
-message.survey.mediterranee.golfelion.desc=Contribution fran\u00E7aise aux campagnes internationales Medits (International bottom Trawl Surveys in the Mediterranean), d''un mois au deuxi\u00E8me trimestre tous les ans depuis 1994 au chalut de fond \u00E0 grande ouverture verticale \u00E0 ailes courtes. En moyenne 69 chalutages sont r\u00E9alis\u00E9s, d''une demi-heure couvrant une surface d''environ 0,05 km\u00B2 chacun pour les profondeurs inf\u00E9rieures \u00E0 200 m\u00E8tres et d''une heure (surface d''environ 0,1\u00A0km\u00B2) pour les profondeurs sup\u00E9rieures \u00E0 200 m\u00E8tres. Medits est repr\u00E9sentative des 13 860 km\u00B2 du golfe de Lion.
-message.survey.mediterranee.golfelion.medits1=Manuel des protocoles Medits, Version 1 (1994)
-message.survey.mediterranee.golfelion.medits2=Manuel des protocoles Medits, Version 2 (1995)
-message.survey.mediterranee.golfelion.medits3=Manuel des protocoles Medits, Version 3 (1999)
-message.survey.mediterranee.golfelion.medits4=Manuel des protocoles Medits, Version 4 (2001)
-message.survey.mediterranee.golfelion.medits5=Manuel des protocoles Medits, Version 5 (2007)
-message.survey.mediterranee.golfelion.medits6=Manuel des protocoles Medits, Version 6 (2012)
-message.survey.mediterranee.golfelion.plus=Pour en savoir plus sur les campagnes Medits
-message.survey.mediterranee.golfelion=Golfe du Lion
-message.survey.mediterranee=Fa\u00E7ade M\u00E9diterran\u00E9e
-message.survey.merdunord.sudmerdunord.desc=Contribution fran\u00E7aise d''un mois \u00E0 la campagne internationale IBTS (International Bottom Trawl Survey) au premier trimestre, tous les ans depuis 1980, au chalut de fond \u00E0 grande ouverture verticale. En moyenne, le navire fran\u00E7ais fait 58 chalutages par an. Le sud de la mer du Nord est couvert par 4 navires (fran\u00E7ais, belge, danois et allemand) qui r\u00E9alisent en tout environ 200 traits par an. Chaque trait dure une demi-heure et couvre une surface d''environ 0,067 km\u00B2. Cette campagne est repr\u00E9sentative des 678\u00A0000\u00A0km\u00B2 de la zone.
-message.survey.merdunord.sudmerdunord.ibts6=Manuel des protocoles IBTS - R\u00E9vision VI (1999)
-message.survey.merdunord.sudmerdunord.ibts7=Manuel des protocoles IBTS - R\u00E9vision VII (2004)
-message.survey.merdunord.sudmerdunord.plus=Pour en savoir plus sur les campagnes IBTS
-message.survey.merdunord.sudmerdunord=Sud mer du Nord
-message.survey.merdunord=Fa\u00E7ade Mer du Nord
-message.survey.paragraph1=Les campagnes de p\u00EAche scientifique standardis\u00E9es ont pour objectif d''observer les ressources halieutiques, en suivant toujours les m\u00EAmes m\u00E9thodes d''\u00E9chantillonnage. Elles sont toujours r\u00E9alis\u00E9es dans la m\u00EAme zone, \u00E0 la m\u00EAme saison, avec des engins de p\u00EAche standardis\u00E9s, afin que les donn\u00E9es soient comparables d''ann\u00E9e en ann\u00E9e. Elles servent \u00E0 d\u00E9crire les esp\u00E8ces, qu''elles soient commerciales ou non, d''une zone et \u00E0 observer les changements s''il y en a. Les poissons, les mollusques et les crustac\u00E9s sont d\u00E9nombr\u00E9s, mesur\u00E9s et pes\u00E9s. Certains d''entre eux font l''objet de pr\u00E9l\u00E8vements biologiques. Chaque campagne fournit ainsi une repr\u00E9sentation quantitative de l''ensemble des esp\u00E8ces de la zone \u00E0 une p\u00E9riode donn\u00E9e. Selon les s\u00E9ries, d''autres informations sont relev\u00E9es (temp\u00E9rature, salinit\u00E9, macrofaune, observation des mammif\u00E8res marins, oiseaux, macro d\u00E9chets etc., mais ne sont pas pr\u00E9sent\u00E9es dans ce site)
-message.survey.paragraph2=Depuis une vingtaine d''ann\u00E9es, l''Ifremer organise des campagnes de p\u00EAche scientifique en mer du Nord, en Manche, en Atlantique et en M\u00E9diterran\u00E9e concernant les ressources d\u00E9mersales et benthiques. L''objectif prioritaire est de produire des indices d''abondance des principales esp\u00E8ces commerciales. Elles recueillent \u00E9galement des donn\u00E9es sur les esp\u00E8ces captur\u00E9es non commerciales. Elles contribuent ainsi aux connaissances n\u00E9cessaires au d\u00E9veloppement de l''approche \u00E9cosyst\u00E9mique des p\u00EAches, notamment dans le cadre de la politique commune des p\u00EAches et plus largement de la strat\u00E9gie marine de l''Union europ\u00E9enne.
-message.survey.paragraph3=Les campagnes sont r\u00E9alis\u00E9es selon des plans d''\u00E9chantillonnage standardis\u00E9s. L''engin de p\u00EAche et son gr\u00E9ement, la position des stations, le tri des captures, les pr\u00E9l\u00E8vements biologiques suivent des protocoles fix\u00E9s.
-message.survey.paragraph4=Pour les campagnes coordonn\u00E9es entre navires de recherche des pays riverains en mer du Nord, Manche orientale, mer Celtique, golfe de Gascogne et M\u00E9diterran\u00E9e, les protocoles sont communs \u00E0 l''ensemble des pays partenaires. Les traits de chalut des diff\u00E9rents navires de recherche sont comparables.
-message.survey.paragraph5=Chaque zone \u00E9tudi\u00E9e est d\u00E9coup\u00E9e en strates en fonction de la profondeur, de la latitude ou d''autres crit\u00E8res. L''\u00E9chantillonnage pr\u00E9voit un nombre de traits de chalut ou de mouillages de casiers par strate.
-message.survey.paragraph6=Dans une campagne de chalutage scientifique, les positions des traits de chalut sont choisies selon un plan d''\u00E9chantillonnage statistique. L''objectif n''est pas d''obtenir les meilleures captures possibles comme le recherchent les p\u00EAcheurs, mais de r\u00E9colter des donn\u00E9es comparables d''une ann\u00E9e sur l''autre afin de relever des \u00E9volutions.
\ No newline at end of file
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 2014-03-09 06:34:41 UTC (rev 1139)
+++ trunk/coser-web/src/main/resources/i18n/coser-web_en_GB.properties 2014-03-10 10:23:18 UTC (rev 1140)
@@ -1,5 +1,196 @@
-coser.config.admin.login.description=
-coser.config.admin.password.description=
-coser.config.analytics.id.description=
-coser.config.application.version.description=
-coser.config.config.file.description=
+coser.config.admin.login.description=Administrator login
+coser.config.admin.password.description=Administrator password
+coser.config.analytics.id.description=Googla Analytics Id
+coser.config.application.version.description=Application's version
+coser.config.config.file.description=Name of the configuration file
+coser.config.coserWeb.configuration.description=Indicator site configuration
+message.admin.indexaction=Administration actions
+message.admin.listprojects.deleteselected=Delete selected projects
+message.admin.listprojects.indicatorsprojects=Indicators projects by zones
+message.admin.listprojects.indicatorsprojects.comment=Removing an indicator project will also delete projet data source.
+message.admin.listprojects.mapsprojects=Maps projects by zones
+message.admin.listprojects.title=Projects management
+message.admin.login=Login
+message.admin.loginrequiered=Authentication required
+message.admin.password=Password
+message.admin.title=Coser admin
+message.com.downloadascsv=Download as CSV
+message.com.downloadaszip=Download as ZIP
+message.com.moredetailspdf=More information on calculated community indices
+message.com.paragraph1=Community indices are calculated for a list of species for each survey time series. The list of species included when calculating each index depends on the available data.
+message.com.paragraph2=The lists of species used for the calculations of community indices are given in the zip file "Information.pdf" (see the link "Download as ZIP" at the bottom of each graph).
+message.com.selectindicatorlist=Select a data list
+message.com.title=Community indices
+message.common.anchortop=Top
+message.common.community=community
+message.common.datatypes=Data types
+message.common.facade=Sea
+message.common.indicatorsof=Indicators of
+message.common.jsreadmore=Read more
+message.common.noresults=No results available
+message.common.population=population
+message.common.selectall=Select all
+message.common.selectfacade=Select an area
+message.common.selectindicator=Select an indicator
+message.common.selectnone=Unselect all
+message.common.selectpop=Select a population
+message.common.selectspecies=Select a species
+message.common.selectsurvey=Select a survey
+message.common.selectzone=Select an area
+message.common.species=Species
+message.common.validform=Valid
+message.common.zone=Zone
+message.common.zones=Zones
+message.documents.activityparagraph1=Battaglia A., V. M. Trenkel & M. J. Rochet, 2006. Estimating end effects in trawl catches. ICES J. Mar. Sci. 63\: 956-959.
+message.documents.activityparagraph2=Lorance P., J. A. Bertrand, A. Brind'Amour, M. J. Rochet & V. Trenkel, 2009. Assessment of impacts from human activities on ecosystem components in the Bay of Biscay in the early 1990s. Aquatic living resources 22\: 409-431.
+message.documents.activityparagraph3=Rochet M. J., M. Prigent, J. A. Bertrand, A. Carpentier, F. Coppin, J. P. Delpech, G. Fontenelle, E. Foucher, K. Mahé, E. Rostiaux & V. M. Trenkel, 2008. Ecosystem trends\: evidence for agreement between fishers' perceptions and scientific information. ICES J. Mar. Sci. 65\: 1057-1068.
+message.documents.activityparagraph4=Rochet M. J. & J. Rice, 2005. Do explicit criteria help in selecting indicators for ecosystem-based fisheries management? ICES J. Mar. Sci. 62\: 528-539.
+message.documents.activityparagraph5=Rochet M. J. & V. Trenkel, 2003. Which community indicators can measure the impact of fishing? A review and proposals. Can. J. Fish. Aquat. Sci. 60\: 86-99.
+message.documents.activityparagraph6=Rochet M. J., V. M. Trenkel, R. Bellail, F. Coppin, O. Le Pape, J.-C. Mahé, A. Morin, J.-C. Poulard, I. Schlaich, A. Souplet, Y. Vérin & J. A. Bertrand, 2005. Combining indicator trends to assess ongoing changes in exploited fish communities\: diagnostic of communities off the coasts of France. ICES Journal of Marine Science 62\: 1647-1664.
+message.documents.activityparagraph7=Rochet M. J., V. M. Trenkel, A. Carpentier, F. Coppin, L. Gil de Sola Simarro, J. P. Léauté, J. C. Mahé, P. Maiorano, A. Mannini, M. Murenu, G. Piet, C. Politou, B. Reale, M. T. Spedicato, G. Tserpes & J. A. Bertrand, 2010. Do changes in environmental pressures impact marine communities? An empirical assessment. J. Applied Ecology 47 (4)\: 741-750. Publisher's official version \: %1s, Open Access version \: %2s
+message.documents.activityparagraph8=Trenkel V. & M. J. Rochet, 2003. Performance of indicators derived from abundance estimates for detecting the impact of fishing on a fish community. Can. J. Fish. Aquat. Sci. 60\: 67-85.
+message.documents.activitytitle2=Publications des membres du GT relatives à l'activité du groupe
+message.documents.genparagraph1=Grands invertébrés et poissons observés par les campagnes scientifiques. Atlas de distribution. Bilan 2008. 2009. %1s
+message.documents.genparagraph2=Grands invertébrés et poissons observés par les campagnes scientifiques. Bilan 2007. 2009. %1s
+message.documents.genparagraph3=L'état des communautés exploitées au large des côtes de France. Application d'indicateurs à l'évaluation de l'impact de la pêche. Bilan 2004 Edition 2009. %1s
+message.documents.genparagraph4=Poissons et invertébrés au large des côtes de France. Indicateurs issus des pêches scientifiques. Bilan 2004. 2007. %1s
+message.documents.gentitle1=Rapports généraux
+message.documents.indicatorparagraph1=Dreves L., C. Abernot-Le Gac, E. Antajan, P. Clabaut, P. Claquin, M.L. Cochard, P. Monbet, J. Morin, A. Tétard, C. Warenbourg & H. Thillaye du Boullay, 2010. Synthèse hydrobiologique du site électronucléaire de Penly. Ifremer. DOP/LER/2010.05. 280 p.
+message.documents.indicatortitle3=Travaux ayant utilisé les résultats du groupe de travail sur les indicateurs de populations et de peuplements
+message.documents.title=Documents
+message.index.datatypecom=Community indices by area
+message.index.datatypemap=Species distribution maps by area
+message.index.datatypepop=Population indices by species by area
+message.index.datatypesource=Raw data by sampling unit (generally by haul)
+message.index.datatypesource.short=Raw data by sampling unit
+message.index.datatypetitle=Viewing data online
+message.index.documentsmessage=Documents
+message.index.documentstitle=Documents
+message.index.extractdatalink=Search form
+message.index.extractdatatitle=Extract data
+message.index.paragraph1=This web site has been created to provide easy access to the raw data and index estimates derived from the scientific surveys carried out by Ifremer along the French coasts.
+message.index.paragraph2=All data made available have passed rigorous quality checks. However, as the reliability of results interpretations depends directly on the data used, users are cordially invited to study carefully the survey and quality check protocols.
+message.index.paragraph3=Each survey is carried out using a specific sampling design. Data analyses and interpretation of each time series must therefore take into account the sampling designs. The data are presented by survey series on the web site.
+message.index.paragraph4=The species codes used in the data tables are those of the taxinomic reference file of the Système d'informations halieutiques de l'Ifremer (%1s).
+message.index.paragraph5=The link below allows you to extract the elements of the site (graphics and data) in the form of a .zip file (containing a pdf document and data)
+message.index.partnerparagraph1=The results presented on this web site are the fruit of an internal Ifremer working group which has been active since 2001 with the objective of developing population and community indicators for the survey data collected since the end of the 1970s along the French coasts. The main group members are (by Ifremer location and in alphabetical order)\: Florence Sanchez (Anglet), Franck Coppin, Sandrine Vaz and Yves Vérin (Boulogne-sur-mer), André Battaglia and Jean-Pierre Léauté (L'Houmeau), Jean-Claude Mahé and Michèle Salaun (Lorient), Jacques Bertrand, Anik Brind'Amour, Yves Désaunay, Pascal Laffargue, Olivier Le Pape, Jérémy Lobry, Pascal Lorance, Jean-Charles Poulard, Marie-Joëlle Rochet and Verena Trenkel (Nantes), Marie-Laure Cochard, Jocelyne Morin and Ivan Schlaich (Port-en-Bessin), Angélique Jadaud and Arnaud Souplet (Sète). The quality process is managed by Vincent Badts. The data-processing is supported by Olivier Berthelé.
+message.index.partnertitle=Group members
+message.index.qualitymessage=Quality warning
+message.index.qualitytitle=Quality warning
+message.index.quotemessage=Ifremer %1$tY. Population and community indices derived from scientific surveys carried out by Ifremer. %2$s (%1$td/%1$tm/%1$tY)
+message.index.quotetitle=How to cite this web site
+message.index.surveyparagraph=Survey protocol handbooks for each survey time series.
+message.index.surveytitle=Survey description
+message.index.thanksparagraph1=All surveys presented on this web site were conducted by Ifremer and have received financial support from a variety of sources. After initially having been funded by Ifremer three of the surveys are now part of the European Data Collection Framework (DCF); this concerns IBTS, Evhoe and Medits. Two other surveys remain entirely funded by Ifremer\: NourVil and CGFS (discussions to include this survey in the DCF are underway). For NourSein, the last three surveys were funded by GIP-Seine Aval. Finally, Crustaflam and NourSomme are entirely funded by EDF within a program of coastal monitoring of nuclear power plants and carried out by Ifremer. This web site has received the financial support of the French ministry for ecology, sustainable development, transport and housing (MEEDDM) (contract Ifremer-MEEDDM 2010). Pour calculating indices for the North Sea the data from all contributing nations was used; it is available in the Datras data base held by ICES (http\://datras.ices.dk).
+message.index.thankstitle=Acknowledgements
+message.index.title=Home
+message.layout.oceanicdata1=le Système d'informations scientifiques pour la mer de l'Ifremer (SISMER)
+message.layout.oceanicdata2=the Fisheries Information System - Système d'information halieutique de l'Ifremer (SIH)
+message.layout.oceanicdatatitle=Survey data management at Ifremer
+message.layout.title=Population and community indices derived from scientific surveys carried out by Ifremer.
+message.map.citation=Trenkel V.M., O. Berthelé, P. Lorance, J.A. Bertrand, A. Brind'Amour, M.L. Cochard, F. Coppin, J.P. Leauté, J.C. Mahé, J. Morin, M.J. Rochet, M. Salaun, A. Souplet & Y. Vérin, 2009. Grands invertébrés et poissons observés par les campagnes scientifiques. Atlas de distribution. Bilan 2008. Ifremer, Nantes. EMH \: 09-003. %1s. 100 p.
+message.map.citationtitle=Citation
+message.map.downloadaspdf=Download as PDF
+message.map.linkarchimer=Access atlas \: %1s
+message.map.paragraph1=The objectif of these maps is to provide a rough indication of the spatial distribution of certain fish and shelfish species as provided by scientific surveys.
+message.map.paragraph2=For each area a systematic grid was defined and the simple average density across years and hauls was calculated in numbers per km2. For mapping purposes, grid cells were coloured using a percentile scale\: blue\: species never observed, light yellow\: average density between [0- 25 %[; dark yellow\: [25-50 %[, orange \: [50-75 %[ and red \: [75-100 %]. Thus, cells with the highest average density are in red.
+message.map.title=Distribution maps
+message.map.warning=Warning
+message.map.warningcontent=The maps should not be interpreted as biological distribution maps but as the areas where the species are caught during the scientific surveys. As the different surveys use different samplin gear and are carried out at different times of the year, there can be differences in catchability among surveys and consequently among areas.
+message.pop.downloadascsv=Download as CSV
+message.pop.moredetailspdf=More details about computed population indices
+message.pop.paragraph1=The presented indices have been selected with respect to their capacity to inform on the impact of fishing and for integration into indicator dashboards for exploited ecosystems.
+message.pop.paragraph2=The data correspond to the value of each indicator. The information has been validated by an expert group within the framework of a holostic population and community indicator approach. The results are presented by geographic area or by species for all available data series. The user can select the geographic area, the season (for seasonal surveys), the species and the index. If data is available for a given selection, a figure is produced that shows the time series of the index, plus-minus one standard deviation. It is possible to extract the corresponding table with index values by year, standard deviations and coefficients of variation.
+message.pop.title=Population indices
+message.quality.acceptance=I acknowledge having read the documents and restrictions and I accept to cite the data source in all cases.
+message.quality.notaccepted=You must acknowledge having read the quality warning\!
+message.quality.paragraph1=Despite careful data control carried out by Ifremer, inconcistencies inherent to the aggregation of the data might occur. For example \:
+message.quality.paragraph2=It is not recommended to simply combine data from different surveys in an analysis despite the fact that all data from all surveys are presented in the same format. For example, the catchability of the same species can vary with the survey gear used. As a consequence each survey provides a particular but coherent picture of the sampled ecosystem.
+message.quality.paragraph3=A common feature of survey time series is the change of taxonomic expertise over time. As a result new species can appear, disappear or similar species be confused thus biasing time trends of certain species.
+message.quality.paragraph4=For any given survey time series, any changes in the sampling procedure, gear, period and area covered might influence the catches. Therefore to avoid the risk of any bias in the analysis, the data must be carefully filtered before use.
+message.quality.paragraph5=It is strongly recommended to use the data with care. In the case of doubts about the validity of the data, please contact the administrator of the data base (%1s).
+message.quality.title=Quality warning
+message.search.extract.extract=Extract
+message.search.extract.speciesindicators=Indicators and species
+message.search.extract.title=Extract data
+message.search.extract.updatelists=Next
+message.search.extract.waitparagraph1=Data are being extracting. Please wait.
+message.search.extract.waitparagraph2=This operation take several minutes in the case of many graphics should be generated.
+message.search.extract.waitparagraph3=After downloading, close this page by returning to the home page of the site.
+message.search.extract.waittitle=Extracting data...
+message.search.extract.zonetype=Zone and data types
+message.source.download=Download
+message.source.paragraph1=The raw data are presented in four tables which contain the basic information by sampling unit (generally a haul) as well as the relevant information on the sampling design (strata). An additional table provides the latin names for the species codes used in the data files. Il s'agit des données utilisées pour réaliser les calculs des indicateurs présentés. Ces données ont fait l'objet de filtrages et de regroupements éventuels par rapport aux données de base de chaque série, afin d'assurer la cohérence des jeux de données en vue du calcul des indicateurs. Ainsi, pour certaines séries, des groupes entiers (e.g. les amphihalins) ont pu être retirés. Pour certaines séries, certaines années ou certaines strates ont été retirées afin de préserver l'homogénéité de la série. Dans des cas d'évolution du niveau de détermination au cours de la série, plusieurs taxons ont été regroupés à un niveau supérieur.
+message.source.paragraph2=Les données IBTS (données françaises et données des autres pays) issues de la base Datras du CIEM (http\://datras.ices.dk) ont fait l'objet des mêmes contrôles de qualité que les autres séries de données utilisées, ainsi que de filtrages et de regroupements taxinomiques pour en préserver la cohérence vis-à-vis du présent objectif de production d'indicateurs de tendances.
+message.source.paragraph3=The web site provides access to the raw data corresponding to the population and community indices presented. For any other data please contact the administrator of the Fisheries information system of Ifremer (%1s).
+message.source.paragraph4=The survey data consist of stations distributed in space following a stratified random design (which can be constant between years). The spatial resolution determines on which spatial scale population and community indices can be calculated.
+message.source.paragraph5=The list of proposed spatial areas includes the original sampling areas, plus post-stratified areas suitable for the European Marine Strategie Framework Directive. These areas have been validated by an internal Ifremer working group following sensitivity analyses.
+message.source.title=Raw data
+message.survey.atlantique=Northeast Atlantic
+message.survey.atlantique.celtique=Celtic Sea
+message.survey.atlantique.celtique.desc=The Evhoe suvey (Evaluation des ressources halieutiques de l'ouest européen) lasts one month in the fourth quarter every year since 1997. On average 75 half-hour hauls are carried out with a GOV trawl. Each haul covers about 0.067 km². This survey provides a representative picture of the 150 000 km² of the Celtic Sea.
+message.survey.atlantique.celtique.evhoe1=Manuel des protocoles EVHOE - Version 1.0 (2005)
+message.survey.atlantique.celtique.plus=For more information on the Evhoe surveys
+message.survey.atlantique.gascogne=Bay of Biscay
+message.survey.atlantique.gascogne.desc=The Evhoe survey (Evaluation des ressources halieutiques de l'ouest européen) lasts one month in the fourth quarter every year since 1992 (except 1993 and 1996). On average 70 half-hour hauls are carried out with a GOV trawl. Each haul covers about 0.067 km². This survey provides a representative picture of the 72 500 km² of the Bay of Biscay.
+message.survey.atlantique.gascogne.evhoe1=Manuel des protocoles EVHOE - Version 1.0 (2005)
+message.survey.atlantique.gascogne.plus=For more information on the Evhoe surveys
+message.survey.atlantique.vilaine=Vilaine river bay
+message.survey.atlantique.vilaine.desc=Survey in the nursery area of the Vilaine river bay (NourVil) lasted one week every year in autumn from 1980 à 2010, except 1991, 1994, 1995, 1998, 1999, 2006 and 2007. It used a 3m-beam trawl. On average 30 15-min hauls were carried out covering each about 0.0041 km². This survey provides a representative picture of the 330 km² of the Vilaine bay.
+message.survey.atlantique.vilaine.nourvil1=Manuel des protocoles Nourriceries Gascogne - V 1.0 (2002)
+message.survey.atlantique.vilaine.plus=For more information on the Nourvil survey
+message.survey.dataengincasier=Pots for the assessment of large crustaceans, in particular lobster, around Cap de Flamanville.
+message.survey.dataenginfond=Variants of a GOV (grande ouverture verticale) trawl for observing demersal species on the continental shelfs and upper slopes in the North Sea, Eastern English channel, Celtic Sea, Bay of Biscay, Gulf of Lions and East Corsica,
+message.survey.dataenginperche=A beam trawl for coastal zones and estuaries during surveys targeting juvenile flatfish\: Somme and Vilaine river bays,
+message.survey.dataengintitle=Different sampling gears are used\:
+message.survey.detailstitle=Characteristics of the surveys carried out by Ifremer
+message.survey.maintitle=Scientific surveys carried out by Ifremer
+message.survey.mancheoccidentale=Eastern English Channel
+message.survey.mancheoccidentale.flamanville=Cap de Flamanville area
+message.survey.mancheoccidentale.flamanville.crustaflam1=Manuel des protocoles CRUSTAFLAM - Version 1.0 (2003)
+message.survey.mancheoccidentale.flamanville.desc=Two surveys of 15 jours each using pots around cap de Flamanville (CrustaFlam), in June and September, since 1986\: 1200 sets per survey in an area covering 26 km².
+message.survey.mancheoccidentale.flamanville.plus=For more information on the CrustFlam survey
+message.survey.mancheorientale=Eastern English Channel
+message.survey.mancheorientale.baiedeseine=Seine river bay
+message.survey.mancheorientale.baiedeseine.desc=Yearly surveys carried on in the Seine estuary and the eastern bay of Seine (NourSeine), principally in autumn from 1995 to 2002. The main objective was to identify the coastal fish nurseries and to assess the fish and macro-benthos richness. About 45 hauls are done during each survey, using a standard beam trawl.
+message.survey.mancheorientale.baiedeseine.nourseine1=http\://archimer.ifremer.fr/doc/00036/14714/
+message.survey.mancheorientale.baiedeseine.plus=For more information on the NourSeine survey
+message.survey.mancheorientale.baiedesomme=Somme river bay
+message.survey.mancheorientale.baiedesomme.desc=The survey in the nursery area of the Somme rive bay (NourSomme) lasts one week in September-October each year since 1995, using a 2m-beam trawl in the estuary and a 3m-beam trawl in the more open areas. On average 50 hauls are carried out. Haul duration is 7 minutes covering 0.001 km² in the estuary part and 15 minutes covering 0.004 km² in the more open part. This survey provides a representative picture of the 720 km² of the Somme baie.
+message.survey.mancheorientale.baiedesomme.noursomme1=Manuel des protocoles Nourriceries Somme - V 1.0 (2002)
+message.survey.mancheorientale.baiedesomme.plus=For more information on the NourSomme survey
+message.survey.mancheorientale.mancheorientale=Eastern English Channel
+message.survey.mancheorientale.mancheorientale.cgfs1=Manuel des protocoles CGFS - Version 1.0 (2002)
+message.survey.mancheorientale.mancheorientale.desc=French survey CGFS (Channel Ground Fish Survey) lasting one month and internationally coordonnated together with the IBTS survey. The survey takes place every year since 1988. On average 90 half hour hauls are carried out with a small GOV trawl. Each haul covers about 0.03 km². This survey provides a representative picture of the 70 748 km² of the Eastern English Channel.
+message.survey.mancheorientale.mancheorientale.plus=For more information on the CGFS survey
+message.survey.mediterranee=Mediterranean Sea
+message.survey.mediterranee.estcorse=East Corsica
+message.survey.mediterranee.estcorse.desc=French contribution to the internationally coordinated Medits (International bottom Trawl Surveys in the Mediterranean) survey, lasting one week in the second quarter every year since 1994 except 2002 using a GOV bottom trawl with short wings. On average 20 hauls are carried out; haul duration is half an hour above 200 m depth which corresponds to 0.05 km² and one hour for bottom depths greater than 200 m (0.1 km²). Medits provides a representative picture of the 4 562 km² of Eastern Corsican island plateau.
+message.survey.mediterranee.estcorse.medits1=Manuel des protocoles Medits, Version 1 (1994)
+message.survey.mediterranee.estcorse.medits2=Manuel des protocoles Medits, Version 2 (1995)
+message.survey.mediterranee.estcorse.medits3=Manuel des protocoles Medits, Version 3 (1999)
+message.survey.mediterranee.estcorse.medits4=Manuel des protocoles Medits, Version 4 (2001)
+message.survey.mediterranee.estcorse.medits5=Manuel des protocoles Medits, Version 5 (2007)
+message.survey.mediterranee.estcorse.medits6=Manuel des protocoles Medits, Version 6 (2012)
+message.survey.mediterranee.estcorse.plus=For more information on the Medits surveys
+message.survey.mediterranee.golfelion=Gulf of Lions
+message.survey.mediterranee.golfelion.desc=French contribution to the internationally coordinated Medits (International bottom Trawl Surveys in the Mediterranean) survey, lasting one month in the second quarter every year since 1994 using a GOV bottom trawl with short wings. On average 69 hauls are carried out; haul duration is half an hour above 200 m depth which corresponds to 0.05 km² and one hour for bottom depths greater than 200 m (0.1 km²). Medits provides a representative picture of the 13 860 km² of the gulf of Lions.
+message.survey.mediterranee.golfelion.medits1=Manuel des protocoles Medits, Version 1 (1994)
+message.survey.mediterranee.golfelion.medits2=Manuel des protocoles Medits, Version 2 (1995)
+message.survey.mediterranee.golfelion.medits3=Manuel des protocoles Medits, Version 3 (1999)
+message.survey.mediterranee.golfelion.medits4=Manuel des protocoles Medits, Version 4 (2001)
+message.survey.mediterranee.golfelion.medits5=Manuel des protocoles Medits, Version 5 (2007)
+message.survey.mediterranee.golfelion.medits6=Manuel des protocoles Medits, Version 6 (2012)
+message.survey.mediterranee.golfelion.plus=For more information on the Medits surveys
+message.survey.merdunord=North Sea
+message.survey.merdunord.sudmerdunord=Southern North Sea
+message.survey.merdunord.sudmerdunord.desc=Every years since 1980 France contributes one month of ship time to the IBTS (International Bottom Trawl Survey) in the first quarter using a GOV trawl. On average 58 hauls are carried out. The southern North Sea is sampled by four countries (France, Belgium, Danmark and Germany) who together carry out about 200 hauls per year. Each haul lasts half an hour corresponding to a swept area of about 0.067 km². IBTS provides a representative picture of the 678 000 km² of the area.
+message.survey.merdunord.sudmerdunord.ibts6=Manuel des protocoles IBTS - Révision VI (1999)
+message.survey.merdunord.sudmerdunord.ibts7=Manuel des protocoles IBTS - Révision VII (2004)
+message.survey.merdunord.sudmerdunord.plus=For more information on the IBTS survey
+message.survey.paragraph1=The main objectif of the scientific fisheries surveys is to provide information on ressource changes, using a standard sampling protocol. They are always carried out in the same areas, at the same time of year and with the same gear, to allow comparisons among years. They provide information on both commercial and non-commercial species and their changes. Fish and shelfish species are counted, weighted and measured. For certain species other biological information is collected. Thus each survey provided a quantitive picture of the species assemblage in a given area during a certain time period. Additional information such as temperature, salinity, macrofauna, marin mammals, birds, macro waste etc. are collected during certain surveys, but this information is not presented here
+message.survey.paragraph2=For the last two decades Ifremer has organised scientific fisheries surveys in the North Sea, the English Channel, the Atlantic and in the Mediterrean Sea for sampling demersal and benthic ressources. The main objective is to produce abundance indices for the principal commercial species. The surveys collect also data for non-commercial species. Hence they contribute to the knowledge necessary for the development of an ecosystem approach to fisheries, in particular in the context of the common fisheries policy (CFP) and more generally the European marine strategy framework directive.
+message.survey.paragraph3=The surveys are carried out using standardised sampling designs. The gear and its rigging, station positions, sample treatment and biological sampling are carried out using fixed protocols.
+message.survey.paragraph4=Common protocols are used by all participants for surveys carried out under international coordination in the North Sea, Eastern English channel, Celtic Sea, Bay of Biscay and the Mediterranean Sea. The data collected by the different research vessels are therefore comparable.
+message.survey.paragraph5=Each survey area is subdivided in strata according to bottom depth, latitude or other criteria. The sampling protocol specifies the number of hauls or pots by stratum.
+message.survey.paragraph6=For each survey the station location is determined following the specified sampling design. The aim is not to obtain the largest catches as fishers might attempt to do, but to collect comparable data for detecting time trends.
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 2014-03-09 06:34:41 UTC (rev 1139)
+++ trunk/coser-web/src/main/resources/i18n/coser-web_fr_FR.properties 2014-03-10 10:23:18 UTC (rev 1140)
@@ -1,5 +1,196 @@
-coser.config.admin.login.description=
-coser.config.admin.password.description=
-coser.config.analytics.id.description=
-coser.config.application.version.description=
-coser.config.config.file.description=
+coser.config.admin.login.description=Identifian de l'administrateur
+coser.config.admin.password.description=Mot de passe de l'administrateur
+coser.config.analytics.id.description=Identifiant du compte Google Analutics
+coser.config.application.version.description=Version de le l'application
+coser.config.config.file.description=Nom du fichier de configuration
+coser.config.coserWeb.configuration.description=Configuration du site des indicateurs
+message.admin.indexaction=Actions d'administration
+message.admin.listprojects.deleteselected=Supprimer les projets sélectionnés
+message.admin.listprojects.indicatorsprojects=Projects d'indicateur par zones
+message.admin.listprojects.indicatorsprojects.comment=La suppression d'un projets d'indicateur supprimera également la possibilité de télécharger les données sources du projet concerné.
+message.admin.listprojects.mapsprojects=Projects de cartes par zones
+message.admin.listprojects.title=Gestion des projets
+message.admin.login=Identifiant
+message.admin.loginrequiered=Autentification requise
+message.admin.password=Mot de passe
+message.admin.title=Coser admin
+message.com.downloadascsv=Télécharger en CSV
+message.com.downloadaszip=Télécharger en ZIP
+message.com.moredetailspdf=Plus d'informations sur les indices calculés des communautés
+message.com.paragraph1=Des indices de communauté sont calculés pour un ensemble de taxon dans chaque série. La liste des taxons inclus pour le calcul de chaque indice varie selon les données disponibles pour la réalisation des calculs.
+message.com.paragraph2=La liste des espèces incluses dans le calcul de chaque indice de communauté est présentée dans le dossier téléchargable sous chaque graphe (fichier "Information.pdf").
+message.com.selectindicatorlist=Sélectionner une liste de données
+message.com.title=Indices de communautés
+message.common.anchortop=Haut
+message.common.community=communauté
+message.common.datatypes=Type de données
+message.common.facade=Facade
+message.common.indicatorsof=Indicateurs de
+message.common.jsreadmore=Voir la suite
+message.common.noresults=Aucun résultat disponible.
+message.common.population=population
+message.common.selectall=Tout sélectionner
+message.common.selectfacade=Sélectionnez une façade
+message.common.selectindicator=Sélectionnez un indicateur
+message.common.selectnone=Tout dé-sélectionner
+message.common.selectpop=Sélectionnez une population
+message.common.selectspecies=Sélectionnez une espèce
+message.common.selectsurvey=Sélectionnez une campagne
+message.common.selectzone=Sélectionnez une zone
+message.common.species=Espèces
+message.common.validform=Valider
+message.common.zone=Zone
+message.common.zones=Zones
+message.documents.activityparagraph1=Battaglia A., V. M. Trenkel & M. J. Rochet, 2006. Estimating end effects in trawl catches. ICES J. Mar. Sci. 63\: 956-959.
+message.documents.activityparagraph2=Lorance P., J. A. Bertrand, A. Brind'Amour, M. J. Rochet & V. Trenkel, 2009. Assessment of impacts from human activities on ecosystem components in the Bay of Biscay in the early 1990s. Aquatic living resources 22\: 409-431.
+message.documents.activityparagraph3=Rochet M. J., M. Prigent, J. A. Bertrand, A. Carpentier, F. Coppin, J. P. Delpech, G. Fontenelle, E. Foucher, K. Mahé, E. Rostiaux & V. M. Trenkel, 2008. Ecosystem trends\: evidence for agreement between fishers' perceptions and scientific information. ICES J. Mar. Sci. 65\: 1057-1068.
+message.documents.activityparagraph4=Rochet M. J. & J. Rice, 2005. Do explicit criteria help in selecting indicators for ecosystem-based fisheries management? ICES J. Mar. Sci. 62\: 528-539.
+message.documents.activityparagraph5=Rochet M. J. & V. Trenkel, 2003. Which community indicators can measure the impact of fishing? A review and proposals. Can. J. Fish. Aquat. Sci. 60\: 86-99.
+message.documents.activityparagraph6=Rochet M. J., V. M. Trenkel, R. Bellail, F. Coppin, O. Le Pape, J.-C. Mahé, A. Morin, J.-C. Poulard, I. Schlaich, A. Souplet, Y. Vérin & J. A. Bertrand, 2005. Combining indicator trends to assess ongoing changes in exploited fish communities\: diagnostic of communities off the coasts of France. ICES Journal of Marine Science 62\: 1647-1664.
+message.documents.activityparagraph7=Rochet M. J., V. M. Trenkel, A. Carpentier, F. Coppin, L. Gil de Sola Simarro, J. P. Léauté, J. C. Mahé, P. Maiorano, A. Mannini, M. Murenu, G. Piet, C. Politou, B. Reale, M. T. Spedicato, G. Tserpes & J. A. Bertrand, 2010. Do changes in environmental pressures impact marine communities? An empirical assessment. J. Applied Ecology 47 (4)\: 741-750. Publisher's official version \: %1$s, Open Access version \: %2$s
+message.documents.activityparagraph8=Trenkel V. & M. J. Rochet, 2003. Performance of indicators derived from abundance estimates for detecting the impact of fishing on a fish community. Can. J. Fish. Aquat. Sci. 60\: 67-85.
+message.documents.activitytitle2=Publications des membres du GT relatives à l'activité du groupe
+message.documents.genparagraph1=Grands invertébrés et poissons observés par les campagnes scientifiques. Atlas de distribution. Bilan 2008. 2009. %1$s
+message.documents.genparagraph2=Grands invertébrés et poissons observés par les campagnes scientifiques. Bilan 2007. 2009. %1$s
+message.documents.genparagraph3=L'état des communautés exploitées au large des côtes de France. Application d'indicateurs à l'évaluation de l'impact de la pêche. Bilan 2004 Edition 2009. %1$s
+message.documents.genparagraph4=Poissons et invertébrés au large des côtes de France. Indicateurs issus des pêches scientifiques. Bilan 2004. 2007. %1$s
+message.documents.gentitle1=Rapports généraux
+message.documents.indicatorparagraph1=Dreves L., C. Abernot-Le Gac, E. Antajan, P. Clabaut, P. Claquin, M.L. Cochard, P. Monbet, J. Morin, A. Tétard, C. Warenbourg & H. Thillaye du Boullay, 2010. Synthèse hydrobiologique du site électronucléaire de Penly. Ifremer. DOP/LER/2010.05. 280 p.
+message.documents.indicatortitle3=Travaux ayant utilisé les résultats du groupe de travail sur les indicateurs de populations et de peuplements
+message.documents.title=Documents
+message.index.datatypecom=Des indices de communauté par zone
+message.index.datatypemap=Des cartes de distribution par espèce et par zone
+message.index.datatypepop=Des indices biologiques par espèce et par zone
+message.index.datatypesource=Des données par opération d'échantillonnage (en général par trait de chalut)
+message.index.datatypesource.short=Des données par opération d'échantillonnage
+message.index.datatypetitle=Consultation des données en ligne
+message.index.documentsmessage=Documents
+message.index.documentstitle=Documents
+message.index.extractdatalink=Formulaire de recherche
+message.index.extractdatatitle=Extraction des données
+message.index.paragraph1=Ce site a été conçu pour fournir en libre accès des données brutes et des données élaborées relatives aux campagnes scientifiques d'observation halieutique conduites par l'Ifremer le long des côtes françaises.
+message.index.paragraph2=Toutes les données mises à disposition ont fait l'objet de qualification selon des protocoles spécifiques. La qualité des interprétations étant directement liée à la nature des données source, les utilisateurs de données sont invités à considérer avec attention les descriptions des protocoles mis en œuvre ainsi que les niveaux de qualité contrôlés.
+message.index.paragraph3=Chaque série de campagnes est conduite selon une stratégie d'échantillonnage spécifique. Sauf cas particuliers, les analyses et interprétations doivent être conduites par série, en prenant en compte les stratégies d'échantillonnage propres à chacune de ces séries. Sur le site, les données sont présentées par série.
+message.index.paragraph4=Dans les tables de données, toutes les espèces sont identifiées selon le référentiel taxinomique du Système d'informations halieutiques de l'Ifremer (%1$s).
+message.index.paragraph5=Les liens ci-dessous vous permet d'extraire les éléments du site (graphique et données) sous la forme d'un fichier .zip (contenant un document pdf et les données)
+message.index.partnerparagraph1=Les résultats présentés sur ce site sont le produit de l'activité d'un groupe de travail de l'Ifremer qui se réunit chaque année depuis 2001 pour développer des indicateurs de populations et de peuplements à partir des données des séries de campagnes halieutiques standardisées conduites depuis la fin des années 1970 par l'Ifremer le long des côtes de France métropolitaine. Les principaux membres du groupe sont (par ordre alphabétique de site et de patronyme) \: Florence Sanchez (Anglet), Franck Coppin, Sandrine Vaz et Yves Vérin (Boulogne-sur-mer), André Battaglia et Jean-Pierre Léauté (L'Houmeau), Jean-Claude Mahé et Michèle Salaun (Lorient), Jacques Bertrand, Anik Brind'Amour, Yves Désaunay, Pascal Laffargue, Olivier Le Pape, Jérémy Lobry, Pascal Lorance, Jean-Charles Poulard, Marie-Joëlle Rochet et Verena Trenkel (Nantes), Marie-Laure Cochard, Jocelyne Morin et Ivan Schlaich (Port-en-Bessin), Angélique Jadaud et Arnaud Souplet (Sète). La démarche qualité est gérée par Vincent Badts. Le support informatique de gestion des données est assuré par Olivier Berthelé.
+message.index.partnertitle=Membres du groupe
+message.index.qualitymessage=Avertissement qualité
+message.index.qualitytitle=Avertissement qualité
+message.index.quotemessage=Ifremer %1$tY. Indices de populations et de communautés issus des campagnes de surveillance halieutique de l'Ifremer. %2$s (%1$td/%1$tm/%1$tY)
+message.index.quotetitle=Pour citer ce site
+message.index.surveyparagraph=Des manuels des protocoles décrivent les modalités techniques de réalisation de chaque série de campagnes.
+message.index.surveytitle=Description des campagnes
+message.index.thanksparagraph1=Bien que toutes les séries de campagnes dont des résultats sont présentés sur ce site aient été conduites par l'Ifremer, elles ont fait l'objet de financements variés. Certaines, après une phase éventuelle de financement unique par l'Ifremer font l'objet de cofinancements, comme les séries IBTS, Evhoe et Medits retenues au titre du règlement européen sur la collecte des données halieutiques (DCF). D'autres sont prises en charge en totalité par l'Ifremer, comme les séries NourVil et CGFS (cette dernière étant en cours d'évaluation pour une reconnaissance au titre du règlement européen sur la collecte des données halieutiques - DCF). Pour la série NourSein, les campagnes ont été co-financées par le conseil régional de Haute Normandie, le GPMH, le programme Liteau, le programme Seine Aval et le GIP-Seine Aval, selon les années. Enfin, les séries Crustaflam et NourSomme sont financées en totalité par EDF au titre de la surveillance de centrales nucléaires littorales, dans le cadre de contrats entre Ifremer et EDF. Le présent site a été créé grâce à un soutien du MEEDDM (contrat Ifremer-MEEDDM 2010). Pour l'établissement des indices en mer du Nord, les données sources utilisées sont celles mises à disposition par les différents pays partenaires de la série IBTS dans la base Datras du CIEM (http\://datras.ices.dk).
+message.index.thankstitle=Remerciements
+message.index.title=Accueil
+message.layout.oceanicdata1=le Système d'informations scientifiques pour la mer de l'Ifremer (SISMER)
+message.layout.oceanicdata2=le Système d'information halieutique de l'Ifremer (SIH)
+message.layout.oceanicdatatitle=Gestion des données des campagnes océanographiques à l'Ifremer
+message.layout.title=Indices de populations et de communautés issus des campagnes de surveillance halieutique auxquelles participe l'Ifremer
+message.map.citation=Trenkel V.M., O. Berthelé, P. Lorance, J.A. Bertrand, A. Brind'Amour, M.L. Cochard, F. Coppin, J.P. Leauté, J.C. Mahé, J. Morin, M.J. Rochet, M. Salaun, A. Souplet & Y. Vérin, 2009. Grands invertébrés et poissons observés par les campagnes scientifiques. Atlas de distribution. Bilan 2008. Ifremer, Nantes. EMH \: 09-003. %1$s. 100 p.
+message.map.citationtitle=Citation
+message.map.downloadaspdf=Télécharger en PDF
+message.map.linkarchimer=Accès à l'atlas \: %1$s
+message.map.paragraph1=L'objectif de cet atlas est de donner un aperçu de la distribution spatiale des espèces de poissons et de certains invertébrés marins à partir des observations des campagnes de pêche scientifiques.
+message.map.paragraph2=Pour chaque zone un quadrillage systématique a été défini, puis la densité moyenne par km² dans chaque cellule a été calculée en utilisant les observations de toute la période. Pour la représentation cartographique, les cellules avec des densités moyenne correspondant aux quartiles de densité ont reçu la même couleur \: bleu \: espèce jamais observée, jaune clair \: densité moyenne entre [0 et 25 %[; jaune foncé \: [25-50 %[, orange \: [50-75 %[ et rouge \: [75-100 %]. Donc, les zones où se trouvent les densités les plus élevées en moyenne sont représentées en rouge.
+message.map.title=Cartes de distribution
+message.map.warning=Avertissement
+message.map.warningcontent=Les cartes présentées ne doivent pas être interprétées comme des cartes de distribution des espèces mais comme celle des zones où elles sont capturées lors des campagnes scientifiques. Les campagnes étant réalisées avec des chaluts différents et à différentes saisons, les espèces peuvent avoir des capturabilités très différentes entre les séries de campagnes, donc d'une zone à l'autre.
+message.pop.downloadascsv=Télécharger en CSV
+message.pop.moredetailspdf=Plus d'informations sur les indices calculés des populations
+message.pop.paragraph1=Les indices présentés ont été sélectionnés en référence à leur aptitude à renseigner sur l'impact de la pêche, en vue de leur intégration dans des tableaux de bord d'indicateurs d'évolution d'écosystèmes exploités par la pêche.
+message.pop.paragraph2=Les données disponibles sur le site sont les valeurs de chaque indice. Les informations ont été validées par un groupe de travail dans une approche intégrative d'indicateurs de populations et de communautés. Les résultats sont donnés par zone géographique et par espèce pour l'ensemble de la série de données disponible. L'utilisateur peut sélectionner la zone géographique, la saison (dans le cas de séries saisonnières), l'espèce et l'indice. Pour les sélections pour lesquelles une information est disponible, le système produit un graphe présentant la distribution temporelle de l'indice, avec une représentation de l'écart-type. Il fournit la possibilité d'extraire la table des données correspondantes, incluant la valeur de l'indice par année, ainsi que son écart-type et son coefficient de variation.
+message.pop.title=Indices biologiques
+message.quality.acceptance=Je reconnais avoir pris connaissance des documents et des restrictions associées et je m'engage à citer la source des données.
+message.quality.notaccepted=Vous devez valider les conditions Avertissement Qualité \!
+message.quality.paragraph1=Bien que les données aient été précautionneusement contrôlées par l'Ifremer, des défauts inhérents à l'agrégation des informations peuvent persister. Par exemple \:
+message.quality.paragraph2=En dépit du fait que toutes les données de toutes les séries de campagnes soient présentées selon le même format, sauf cas particuliers, des différences dans les stratégies d'observation empêchent la combinaison de données de différentes campagnes dans une même analyse. Par exemple, la capturabilité d'une même espèce varie selon le type d'engin d'échantillonnage utilisé. Il en résulte que chaque engin capture un sous-ensemble particulier des biocénoses échantillonnées.
+message.quality.paragraph3=Une propriété commune aux séries d'observations à la mer est l'évolution dans le temps de la compétence des équipes embarquées pour la détermination des espèces. Il peut en résulter des apparitions, des disparitions ou des assignations sous un même nom de taxons proches dans les jeux de données, non représentatifs de l'évolution des populations concernées dans l'écosystème.
+message.quality.paragraph4=Pour les campagnes d'une même série, des changements dans les procédures d'échantillonnage, dans les caractéristiques des engins, dans la période de réalisation de la campagne et la zone couverte peuvent influencer les captures. Pour prévenir les risques de biais dans les analyses en raison de ces facteurs, les jeux de données doivent être préalablement filtrés adéquatement.
+message.quality.paragraph5=Il est vivement recommandé aux utilisateurs de données de les traiter avec précaution. Si des utilisateurs s'interrogent sur la validité de données, ils sont invités à contacter l'administrateur de la base de données (%1$s).
+message.quality.title=Avertissement Qualité
+message.search.extract.extract=Extraire
+message.search.extract.speciesindicators=Espèces et indicateurs
+message.search.extract.title=Extraction des données
+message.search.extract.updatelists=Suite
+message.search.extract.waitparagraph1=Les données sont en cours d'extraction. Merci de patienter.
+message.search.extract.waitparagraph2=Cette opération peut prendre plusieurs minutes dans le cas où de nombreux graphiques doivent être générés.
+message.search.extract.waitparagraph3=Après le téléchargement, fermer cette page en revenant sur la page d'accueil du site.
+message.search.extract.waittitle=Extraction en cours...
+message.search.extract.zonetype=Zone et type de données
+message.source.download=Télécharger
+message.source.paragraph1=Les données de base sont présentées selon quatre tables fournissant des informations de base élevées à l'opération d'échantillonnage (en général un trait de chalut) et organisées selon des unités géographiques définies en relation avec le plan d'échantillonnage. Une table supplémentaire présente le référentiel taxinomique associé aux données. Il s'agit des données utilisées pour réaliser les calculs des indicateurs présentés. Ces données ont fait l'objet de filtrages et de regroupements éventuels par rapport aux données de base de chaque série, afin d'assurer la cohérence des jeux de données en vue du calcul des indicateurs. Ainsi, pour certaines séries, des groupes entiers (e.g. les amphihalins) ont pu être retirés. Pour certaines séries, certaines années ou certaines strates ont été retirées afin de préserver l'homogénéité de la série. Dans des cas d'évolution du niveau de détermination au cours de la série, plusieurs taxons ont été regroupés à un niveau supérieur.
+message.source.paragraph2=Les données IBTS (données françaises et données des autres pays) issues de la base Datras du CIEM (http\://datras.ices.dk) ont fait l'objet des mêmes contrôles de qualité que les autres séries de données utilisées, ainsi que de filtrages et de regroupements taxinomiques pour en préserver la cohérence vis-à-vis du présent objectif de production d'indicateurs de tendances.
+message.source.paragraph3=Le site ne contient des données de base que pour une partie des séries de campagnes pour lesquelles des indices de populations et de communautés sont présentés, selon les modalités d'accès à ces données. Pour un accès aux séries de données source, il convient de contacter l'administrateur du Système d'informations halieutiques de l'Ifremer (%1$s) pour les données françaises, et le site Datras du CIEM (http\://datras.ices.dk) pour les données IBTS des autres pays.
+message.source.paragraph4=Les données de campagnes halieutiques sont constituées à partir de stations d'échantillonnage réparties dans l'espace selon le principe de tirage stratifié. La densité de l'échantillonnage conditionne la partition géographique selon laquelle les indices de population et de communauté peuvent être établis.
+message.source.paragraph5=Les plans de zonage proposés incluent le plan de référence correspondant au plan d'échantillonnage, ainsi que des adaptations pour tenir compte des limites des sous-régions définies par la stratégie marine européenne. Ils ont été validés par un groupe de travail de l'Ifremer, après exploration de la sensibilité de divers indices aux ajustements proposés.
+message.source.title=Données de base
+message.survey.atlantique=Façade Atlantique
+message.survey.atlantique.celtique=Mer Celtique
+message.survey.atlantique.celtique.desc=Campagne Evhoe (Evaluation des ressources halieutiques de l'ouest européen) d'un mois au quatrième trimestre, tous les ans depuis 1997. En moyenne 75 traits d'une demi-heure, au chalut de fond à grande ouverture verticale, sont réalisés. Chaque trait couvre une surface d'environ 0,067 km². Cette campagne est représentative des 150 000 km² de la mer Celtique.
+message.survey.atlantique.celtique.evhoe1=Manuel des protocoles EVHOE - Version 1.0 (2005)
+message.survey.atlantique.celtique.plus=Pour en savoir plus sur les campagnes Evhoe
+message.survey.atlantique.gascogne=Golfe de Gascogne
+message.survey.atlantique.gascogne.desc=Campagne Evhoe (Evaluation des ressources halieutiques de l'ouest européen) d'un mois au quatrième trimestre, tous les ans depuis 1992 (sauf en 1993 et 1996). En moyenne, 70 traits de chalut d'une demi-heure au chalut de fond à grande ouverture verticale, sont réalisés. Chaque trait couvre une surface de 0,067 km². Cette campagne est représentative des 72 500 km² du golfe de Gascogne. La campagne Evhoe couvre donc le golfe de Gascogne et la mer Celtique avec le même protocole. De plus elle est coordonnée internationalement, dans le cadre des campagnes IBTS, avec une campagne espagnole en mer Cantabrique, une campagne irlandaise et une campagne anglaise en mer Celtique.
+message.survey.atlantique.gascogne.evhoe1=Manuel des protocoles EVHOE - Version 1.0 (2005)
+message.survey.atlantique.gascogne.plus=Pour en savoir plus sur les campagnes Evhoe
+message.survey.atlantique.vilaine=Baie de Vilaine
+message.survey.atlantique.vilaine.desc=Campagne sur la nourricerie de la baie de Vilaine (NourVil), d'une semaine à l'automne, tous les ans de 1980 à 2010, sauf en 1991, 1994, 1995, 1998, 1999, 2006 et 2007, au chalut à perche de 3 mètres de large. En moyenne, 30 chalutages de 15 minutes sont réalisés. Chaque trait couvre une surface d'environ 0,0041 km². Cette campagne est représentative des 330 km² de la baie.
+message.survey.atlantique.vilaine.nourvil1=Manuel des protocoles Nourriceries Gascogne - V 1.0 (2002)
+message.survey.atlantique.vilaine.plus=Pour en savoir plus sur les campagnes Nourvil
+message.survey.dataengincasier=Un échantillonnage au casier pour les campagnes d'évaluation des grands crustacés, en particulier le homard, aux abords du cap de Flamanville.
+message.survey.dataenginfond=Un chalut de fond à grande ouverture verticale pour l'observation des ressources démersales, sur les plateaux continentaux et le haut des pentes continentales (accores) en mer du Nord, Manche orientale, mer Celtique, golfe de Gascogne, golfe du Lion et Est de la Corse,
+message.survey.dataenginperche=Un chalut à perche pour les zones très côtières et les estuaires lors des campagnes visant les juvéniles de poissons plats \: baies de Somme et de Vilaine,
+message.survey.dataengintitle=Différents engins d'échantillonnage sont utilisés \:
+message.survey.detailstitle=Caractéristiques des campagnes de surveillance halieutique de l'Ifremer
+message.survey.maintitle=Les campagnes de surveillance halieutique de l'Ifremer
+message.survey.mancheoccidentale=Façade Manche occidentale
+message.survey.mancheoccidentale.flamanville=Abords du cap de Flamanville
+message.survey.mancheoccidentale.flamanville.crustaflam1=Manuel des protocoles CRUSTAFLAM - Version 1.0 (2003)
+message.survey.mancheoccidentale.flamanville.desc=Deux campagnes de 15 jours aux casiers à crustacés aux abords du cap de Flamanville (CrustaFlam), en juin et septembre, depuis 1986 \: 1200 casiers relevés par campagne sur une zone de 26 km².
+message.survey.mancheoccidentale.flamanville.plus=Pour en savoir plus sur les campagnes CrustFlam
+message.survey.mancheorientale=Façade Manche orientale
+message.survey.mancheorientale.baiedeseine=Baie de Seine
+message.survey.mancheorientale.baiedeseine.desc=Campagnes annuelles de prospection sur les nourriceries de l'estuaire de Seine et de la baie de Seine orientale (NourSeine) effectuées essentiellement à l'automne, de 1995 à 2002. L'objectif premier était d'identifier les nourriceries côtières de ce site et d'en évaluer la richesse halieutique et macro-épibenthique. Environ 45 traits effectués à chaque campagne, à l'aide d'un chalut à perche standard.
+message.survey.mancheorientale.baiedeseine.nourseine1=http\://archimer.ifremer.fr/doc/00036/14714/
+message.survey.mancheorientale.baiedeseine.plus=Pour en savoir plus sur les campagnes NourSeine
+message.survey.mancheorientale.baiedesomme=Baie de Somme
+message.survey.mancheorientale.baiedesomme.desc=Campagne de pêche sur la nourricerie de la baie de Somme (NourSomme) d'une semaine en septembre-octobre, tous les ans depuis 1995, aux chaluts à perche de 2 mètres de large dans la partie la plus estuarienne de la baie et 3 mètres dans la partie externe, plus marine. En moyenne 50 chalutages sont réalisés chaque année. Ils durent en moyenne 7 minutes sur une surface de 0,001 km² chacun dans la partie interne de la baie et 15 minutes sur une surface d'environ 0,004 km² dans la partie externe. Cette campagne est représentative des 720 km² de la baie.
+message.survey.mancheorientale.baiedesomme.noursomme1=Manuel des protocoles Nourriceries Somme - V 1.0 (2002)
+message.survey.mancheorientale.baiedesomme.plus=Pour en savoir plus sur les campagnes NourSomme
+message.survey.mancheorientale.mancheorientale=Manche orientale
+message.survey.mancheorientale.mancheorientale.cgfs1=Manuel des protocoles CGFS - Version 1.0 (2002)
+message.survey.mancheorientale.mancheorientale.desc=Campagne française CGFS (Channel Ground Fish Survey) d'un mois en octobre, coordonnée au plan international avec les campagnes IBTS. La campagne a lieu tous les ans depuis 1988. En moyenne 90 traits d'une demi-heure, au chalut de fond à grande ouverture verticale, sont réalisés. Chaque trait couvre une surface d'environ 0,03 km². Cette campagne est représentative des 70 748 km² de la Manche orientale.
+message.survey.mancheorientale.mancheorientale.plus=Pour en savoir plus sur les campagnes CGFS
+message.survey.mediterranee=Façade Méditerranée
+message.survey.mediterranee.estcorse=Est de la Corse
+message.survey.mediterranee.estcorse.desc=Contribution française à la campagne internationale Medits (International bottom Trawl Surveys in the Mediterranean), d'une semaine au printemps, tous les ans depuis 1994, sauf en 2002, au chalut de fond à grande ouverture verticale à ailes courtes. En moyenne 20 chalutages sont réalisés, d'une demi-heure couvrant une surface d'environ 0,05 km² chacun pour les profondeurs inférieures à 200 mètres et d'une heure (surface d'environ 0,1 km²) pour les profondeurs supérieures à 200 mètres. La campagne est représentative des 4 562 km² du plateau insulaire de l'est de la Corse.
+message.survey.mediterranee.estcorse.medits1=Manuel des protocoles Medits, Version 1 (1994)
+message.survey.mediterranee.estcorse.medits2=Manuel des protocoles Medits, Version 2 (1995)
+message.survey.mediterranee.estcorse.medits3=Manuel des protocoles Medits, Version 3 (1999)
+message.survey.mediterranee.estcorse.medits4=Manuel des protocoles Medits, Version 4 (2001)
+message.survey.mediterranee.estcorse.medits5=Manuel des protocoles Medits, Version 5 (2007)
+message.survey.mediterranee.estcorse.medits6=Manuel des protocoles Medits, Version 6 (2012)
+message.survey.mediterranee.estcorse.plus=Pour en savoir plus sur les campagnes Medits
+message.survey.mediterranee.golfelion=Golfe du Lion
+message.survey.mediterranee.golfelion.desc=Contribution française aux campagnes internationales Medits (International bottom Trawl Surveys in the Mediterranean), d'un mois au deuxième trimestre tous les ans depuis 1994 au chalut de fond à grande ouverture verticale à ailes courtes. En moyenne 69 chalutages sont réalisés, d'une demi-heure couvrant une surface d'environ 0,05 km² chacun pour les profondeurs inférieures à 200 mètres et d'une heure (surface d'environ 0,1 km²) pour les profondeurs supérieures à 200 mètres. Medits est représentative des 13 860 km² du golfe de Lion.
+message.survey.mediterranee.golfelion.medits1=Manuel des protocoles Medits, Version 1 (1994)
+message.survey.mediterranee.golfelion.medits2=Manuel des protocoles Medits, Version 2 (1995)
+message.survey.mediterranee.golfelion.medits3=Manuel des protocoles Medits, Version 3 (1999)
+message.survey.mediterranee.golfelion.medits4=Manuel des protocoles Medits, Version 4 (2001)
+message.survey.mediterranee.golfelion.medits5=Manuel des protocoles Medits, Version 5 (2007)
+message.survey.mediterranee.golfelion.medits6=Manuel des protocoles Medits, Version 6 (2012)
+message.survey.mediterranee.golfelion.plus=Pour en savoir plus sur les campagnes Medits
+message.survey.merdunord=Façade Mer du Nord
+message.survey.merdunord.sudmerdunord=Sud mer du Nord
+message.survey.merdunord.sudmerdunord.desc=Contribution française d'un mois à la campagne internationale IBTS (International Bottom Trawl Survey) au premier trimestre, tous les ans depuis 1980, au chalut de fond à grande ouverture verticale. En moyenne, le navire français fait 58 chalutages par an. Le sud de la mer du Nord est couvert par 4 navires (français, belge, danois et allemand) qui réalisent en tout environ 200 traits par an. Chaque trait dure une demi-heure et couvre une surface d'environ 0,067 km². Cette campagne est représentative des 678 000 km² de la zone.
+message.survey.merdunord.sudmerdunord.ibts6=Manuel des protocoles IBTS - Révision VI (1999)
+message.survey.merdunord.sudmerdunord.ibts7=Manuel des protocoles IBTS - Révision VII (2004)
+message.survey.merdunord.sudmerdunord.plus=Pour en savoir plus sur les campagnes IBTS
+message.survey.paragraph1=Les campagnes de pêche scientifique standardisées ont pour objectif d'observer les ressources halieutiques, en suivant toujours les mêmes méthodes d'échantillonnage. Elles sont toujours réalisées dans la même zone, à la même saison, avec des engins de pêche standardisés, afin que les données soient comparables d'année en année. Elles servent à décrire les espèces, qu'elles soient commerciales ou non, d'une zone et à observer les changements s'il y en a. Les poissons, les mollusques et les crustacés sont dénombrés, mesurés et pesés. Certains d'entre eux font l'objet de prélèvements biologiques. Chaque campagne fournit ainsi une représentation quantitative de l'ensemble des espèces de la zone à une période donnée. Selon les séries, d'autres informations sont relevées (température, salinité, macrofaune, observation des mammifères marins, oiseaux, macro déchets etc., mais ne sont pas présentées dans ce site)
+message.survey.paragraph2=Depuis une vingtaine d'années, l'Ifremer organise des campagnes de pêche scientifique en mer du Nord, en Manche, en Atlantique et en Méditerranée concernant les ressources démersales et benthiques. L'objectif prioritaire est de produire des indices d'abondance des principales espèces commerciales. Elles recueillent également des données sur les espèces capturées non commerciales. Elles contribuent ainsi aux connaissances nécessaires au développement de l'approche écosystémique des pêches, notamment dans le cadre de la politique commune des pêches et plus largement de la stratégie marine de l'Union européenne.
+message.survey.paragraph3=Les campagnes sont réalisées selon des plans d'échantillonnage standardisés. L'engin de pêche et son gréement, la position des stations, le tri des captures, les prélèvements biologiques suivent des protocoles fixés.
+message.survey.paragraph4=Pour les campagnes coordonnées entre navires de recherche des pays riverains en mer du Nord, Manche orientale, mer Celtique, golfe de Gascogne et Méditerranée, les protocoles sont communs à l'ensemble des pays partenaires. Les traits de chalut des différents navires de recherche sont comparables.
+message.survey.paragraph5=Chaque zone étudiée est découpée en strates en fonction de la profondeur, de la latitude ou d'autres critères. L'échantillonnage prévoit un nombre de traits de chalut ou de mouillages de casiers par strate.
+message.survey.paragraph6=Dans une campagne de chalutage scientifique, les positions des traits de chalut sont choisies selon un plan d'échantillonnage statistique. L'objectif n'est pas d'obtenir les meilleures captures possibles comme le recherchent les pêcheurs, mais de récolter des données comparables d'une année sur l'autre afin de relever des évolutions.
Modified: trunk/coser-web/src/main/resources/struts.xml
===================================================================
--- trunk/coser-web/src/main/resources/struts.xml 2014-03-09 06:34:41 UTC (rev 1139)
+++ trunk/coser-web/src/main/resources/struts.xml 2014-03-10 10:23:18 UTC (rev 1140)
@@ -3,7 +3,7 @@
#%L
Coser :: Web
%%
- Copyright (C) 2010 - 2013 Ifremer, Codelutin, Chatellier Eric
+ Copyright (C) 2010 - 2013 Ifremer, Codelutin, Chatellier Eric, Chemit Tony
%%
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
@@ -24,10 +24,23 @@
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
- <constant name="struts.i18n.encoding" value="UTF-8"/>
+
<constant name="struts.multipart.maxSize" value="100097152"/>
<constant name="struts.enable.DynamicMethodInvocation" value="true"/>
+ <!-- dev mode tuning -->
+ <constant name="struts.devMode" value="${devMode}"/>
+ <constant name="struts.ognl.logMissingProperties" value="${devMode}"/>
+ <constant name="struts.el.throwExceptionOnFailure" value="${devMode}"/>
+ <constant name="struts.i18n.reload" value="${devMode}"/>
+ <constant name="struts.configuration.xml.reload" value="${devMode}"/>
+
+ <!-- I18n configuration -->
+ <bean class="org.nuiton.web.struts2.I18nTextProvider"
+ name="i18nTextProvider" type="com.opensymphony.xwork2.TextProvider"/>
+ <constant name="struts.xworkTextProvider" value="i18nTextProvider"/>
+ <constant name="struts.i18n.encoding" value="UTF-8"/>
+
<package name="admin" extends="convention-default">
<interceptors>
<interceptor name="loginInterceptor" class="fr.ifremer.coser.web.actions.admin.LoginInterceptor" />
Added: trunk/coser-web/src/main/validationRules.txt
===================================================================
--- trunk/coser-web/src/main/validationRules.txt (rev 0)
+++ trunk/coser-web/src/main/validationRules.txt 2014-03-10 10:23:18 UTC (rev 1140)
@@ -0,0 +1,3 @@
+# Règles pour la validation XWorks
+
+//validators/field/field-validator/message/@key
\ No newline at end of file
Property changes on: trunk/coser-web/src/main/validationRules.txt
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/coser-web/src/site/site_en.xml
===================================================================
--- trunk/coser-web/src/site/site_en.xml (rev 0)
+++ trunk/coser-web/src/site/site_en.xml 2014-03-10 10:23:18 UTC (rev 1140)
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ #%L
+ Coser :: Web
+ %%
+ Copyright (C) 2010 - 2014 Ifremer, Codelutin
+ %%
+ 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%
+ -->
+
+
+<project name="${project.name}" xmlns="http://maven.apache.org/DECORATION/1.3.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/DECORATION/1.3.0 http://maven.apache.org/xsd/decoration-1.3.0.xsd">
+
+ <body>
+
+ <head>
+ <script type="text/javascript"
+ src="${mavenpomSiteCommonResourcesUrl}/js/mavenpom-site.js">
+ </script>
+
+ <link rel="stylesheet" type="text/css"
+ href="${mavenpomSiteCommonResourcesUrl}/css/mavenpom-site.css"/>
+ </head>
+
+ <breadcrumbs>
+ <item name="${project.name}" href="./index.html"/>
+ </breadcrumbs>
+
+ <menu ref="parent"/>
+
+ <menu name="Documentation">
+ <item name="Home" href="index.html" />
+ <item name="Configuration" href="application-config-report.html" />
+ </menu>
+
+ <menu ref="reports"/>
+
+ <footer>
+
+ <div id='projectMetas'
+ projectversion='${project.version}'
+ platform='${project.platform}'
+ projectid='${project.projectId}'
+ scm='${project.scm.developerConnection}'
+ scmwebeditorenabled='${project.scmwebeditorEnabled}'
+ scmwebeditorurl='${project.scmwebeditorUrl}'
+ siteSourcesType='${project.siteSourcesType}'
+ piwikEnabled='${project.piwikEnabled}'
+ piwikId='${project.piwikId}'
+ locale='en'
+ scmwebeditor_skipDefaultFiles="true">
+ </div>
+ </footer>
+ </body>
+</project>
Property changes on: trunk/coser-web/src/site/site_en.xml
___________________________________________________________________
Added: svn:mime-type
+ text/xml
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/coser-web/src/site/site_fr.xml
===================================================================
--- trunk/coser-web/src/site/site_fr.xml (rev 0)
+++ trunk/coser-web/src/site/site_fr.xml 2014-03-10 10:23:18 UTC (rev 1140)
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ #%L
+ Coser :: Web
+ %%
+ Copyright (C) 2010 - 2014 Ifremer, Codelutin
+ %%
+ 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%
+ -->
+
+
+<project name="${project.name}" xmlns="http://maven.apache.org/DECORATION/1.3.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/DECORATION/1.3.0 http://maven.apache.org/xsd/decoration-1.3.0.xsd">
+
+ <body>
+
+ <head>
+ <script type="text/javascript"
+ src="${mavenpomSiteCommonResourcesUrl}/js/mavenpom-site.js">
+ </script>
+
+ <link rel="stylesheet" type="text/css"
+ href="${mavenpomSiteCommonResourcesUrl}/css/mavenpom-site.css"/>
+ </head>
+
+ <breadcrumbs>
+ <item name="${project.name}" href="./index.html"/>
+ </breadcrumbs>
+
+ <menu ref="parent"/>
+
+ <menu name="Documentation">
+ <item name="Accueil" href="index.html" />
+ <item name="Configuration" href="application-config-report.html" />
+ </menu>
+
+ <menu ref="reports"/>
+
+ <footer>
+
+ <div id='projectMetas'
+ projectversion='${project.version}'
+ platform='${project.platform}'
+ projectid='${project.projectId}'
+ scm='${project.scm.developerConnection}'
+ scmwebeditorenabled='${project.scmwebeditorEnabled}'
+ scmwebeditorurl='${project.scmwebeditorUrl}'
+ siteSourcesType='${project.siteSourcesType}'
+ piwikEnabled='${project.piwikEnabled}'
+ piwikId='${project.piwikId}'
+ locale='fr'
+ scmwebeditor_skipDefaultFiles="true">
+ </div>
+ </footer>
+ </body>
+</project>
Property changes on: trunk/coser-web/src/site/site_fr.xml
___________________________________________________________________
Added: svn:mime-type
+ text/xml
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2014-03-09 06:34:41 UTC (rev 1139)
+++ trunk/pom.xml 2014-03-10 10:23:18 UTC (rev 1140)
@@ -73,15 +73,23 @@
<properties>
<projectId>coser</projectId>
<platform>codelutin.com</platform>
-
+
+ <!-- license configuration -->
<license.licenseName>lgpl_v3</license.licenseName>
<license.organizationName>Ifremer, Codelutin</license.organizationName>
+ <!-- i18n configuration -->
+ <i18n.bundles>fr_FR,en_GB</i18n.bundles>
+ <i18n.silent>true</i18n.silent>
+ <coserI18nBundle>coser-i18n</coserI18nBundle>
+
<!-- Versions -->
<jaxxVersion>2.8.2-SNAPSHOT</jaxxVersion>
<nuitonI18nVersion>3.0</nuitonI18nVersion>
<nuitonMatrixVersion>2.4-SNAPSHOT</nuitonMatrixVersion>
<struts.version>2.3.16.1</struts.version>
+ <nuitonReportPluginVersion>3.0-rc-1</nuitonReportPluginVersion>
+
</properties>
<repositories>
@@ -137,6 +145,12 @@
</dependency>
<dependency>
+ <groupId>org.nuiton.web</groupId>
+ <artifactId>nuiton-struts2</artifactId>
+ <version>1.15-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
<groupId>org.nuiton.jaxx</groupId>
<artifactId>jaxx-runtime</artifactId>
<version>${jaxxVersion}</version>
Modified: trunk/src/site/en/rst/user/guide_listcontrols.rst
===================================================================
--- trunk/src/site/en/rst/user/guide_listcontrols.rst 2014-03-09 06:34:41 UTC (rev 1139)
+++ trunk/src/site/en/rst/user/guide_listcontrols.rst 2014-03-10 10:23:18 UTC (rev 1140)
@@ -202,7 +202,7 @@
Cross checking with the taxonomic reference file
----------------------------------------------
+------------------------------------------------
+-----------------------------------------------------------------------------+----------+
| Checks | Level |
Modified: trunk/src/site/site_fr.xml
===================================================================
--- trunk/src/site/site_fr.xml 2014-03-09 06:34:41 UTC (rev 1139)
+++ trunk/src/site/site_fr.xml 2014-03-10 10:23:18 UTC (rev 1140)
@@ -88,7 +88,7 @@
</item>
</menu>
- <!--<menu ref="modules"/>-->
+ <menu ref="modules"/>
<menu ref="reports"/>
1
0