This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository echobase. See https://gitlab.nuiton.org/codelutin/echobase.git commit f63aac7278450e7a5f393ccda00496c7029d287d Author: Julien Ruchaud <julien.ruchaud@debux.org> Date: Wed Oct 26 12:19:28 2016 +0200 Create UI for atlantos export --- .../ifremer/echobase/entities/data/VoyageImpl.java | 6 +- .../atlantos/ExportAtlantosConfiguration.java | 2 +- .../service/atlantos/ExportAtlantosService.java | 15 +++- .../service/atlantos/xml/XmlAccousticExport.java | 18 ++-- .../import-data/echobase-atlantos.h2.db.gz | Bin 1238097 -> 1236305 bytes .../ui/actions/exportAtlantos/Configure.java | 95 +++++++++++++++++++++ .../ui/actions/exportAtlantos/Download.java | 95 +++++++++++++++++++++ .../echobase/ui/actions/exportAtlantos/Export.java | 87 +++++++++++++++++++ .../actions/importData/AbstractLaunchImport.java | 9 +- .../resources/config/struts-exportAtlantos.xml | 77 +++++++++++++++++ .../resources/i18n/echobase-ui_en_GB.properties | 6 ++ .../resources/i18n/echobase-ui_fr_FR.properties | 6 ++ echobase-ui/src/main/resources/struts.xml | 1 + echobase-ui/src/main/webapp/WEB-INF/decorators.xml | 1 + .../src/main/webapp/WEB-INF/includes/header.jsp | 9 +- .../WEB-INF/jsp/exportAtlantos/configure.jsp | 64 ++++++++++++++ .../webapp/WEB-INF/jsp/exportAtlantos/progress.jsp | 34 ++++++++ .../webapp/WEB-INF/jsp/exportAtlantos/result.jsp | 47 ++++++++++ 18 files changed, 559 insertions(+), 13 deletions(-) diff --git a/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/VoyageImpl.java b/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/VoyageImpl.java index 4174a49..4626ec3 100644 --- a/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/VoyageImpl.java +++ b/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/VoyageImpl.java @@ -137,8 +137,10 @@ public class VoyageImpl extends VoyageAbstract { for (Transit t : transit) { Transect transect = t.getTransect(vessel); - Collection<Operation> operations = transect.getOperation(); - result.addAll(operations); + if (transect != null) { + Collection<Operation> operations = transect.getOperation(); + result.addAll(operations); + } } } return result; diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/atlantos/ExportAtlantosConfiguration.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/atlantos/ExportAtlantosConfiguration.java index 2d05408..7444cc4 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/atlantos/ExportAtlantosConfiguration.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/atlantos/ExportAtlantosConfiguration.java @@ -94,7 +94,7 @@ public class ExportAtlantosConfiguration extends AbstractEchobaseActionConfigura public void setVesselId(String vesselId) { this.vesselId = vesselId; } - + @Override public void destroy() throws IOException { if (workingDirectory != null) { diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/atlantos/ExportAtlantosService.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/atlantos/ExportAtlantosService.java index 1ba76f0..672ecad 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/atlantos/ExportAtlantosService.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/atlantos/ExportAtlantosService.java @@ -24,6 +24,7 @@ package fr.ifremer.echobase.services.service.atlantos; import com.google.common.base.Preconditions; import fr.ifremer.echobase.entities.data.Voyage; import fr.ifremer.echobase.entities.references.Vessel; +import fr.ifremer.echobase.io.EchoBaseIOUtil; import fr.ifremer.echobase.services.EchoBaseServiceSupport; import fr.ifremer.echobase.services.service.UserDbPersistenceService; import fr.ifremer.echobase.services.service.atlantos.xml.XmlAccousticExport; @@ -66,7 +67,7 @@ public class ExportAtlantosService extends EchoBaseServiceSupport { Preconditions.checkNotNull(model); Preconditions.checkNotNull(model.getVoyageId()); - int nbSteps = 2; + int nbSteps = 3; model.setNbSteps(nbSteps); Voyage voyage = persistenceService.getVoyage(model.getVoyageId()); @@ -111,6 +112,7 @@ public class ExportAtlantosService extends EchoBaseServiceSupport { inAccousticVoca.close(); inAccousticCruise.close(); + outputAccousticHead.toFile().deleteOnExit(); outputAccousticVoca.toFile().delete(); outputAccousticCruise.toFile().delete(); @@ -136,9 +138,20 @@ public class ExportAtlantosService extends EchoBaseServiceSupport { outBiotic.close(); inBioticCruise.close(); + outputBioticVoca.toFile().deleteOnExit(); outputBioticCruise.toFile().delete(); model.incrementsProgress(); + + // Create Zip file + Path zipPath = Paths.get(basePath, "Atlantos_" + year + name + vesselCode + ".zip"); + File zipFile = zipPath.toFile(); + + EchoBaseIOUtil.compressZipFile(zipFile, tempDirectory, false); + zipFile.deleteOnExit(); + + model.setExportFile(zipFile); + model.incrementsProgress(); } } diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/atlantos/xml/XmlAccousticExport.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/atlantos/xml/XmlAccousticExport.java index 775f797..8b982b1 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/atlantos/xml/XmlAccousticExport.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/atlantos/xml/XmlAccousticExport.java @@ -124,7 +124,7 @@ public class XmlAccousticExport implements EchoBaseService { Collection<Result> results = cell.getResult(); for (Result result : results) { - if ("NASC".equals(result.getResultLabel())) { + if ("NASC".equals(result.getDataMetadata().getName())) { // EXPORT SAMPLE exportSample(voyage, cell, result, xmlCruise); @@ -311,13 +311,17 @@ public class XmlAccousticExport implements EchoBaseService { prefix = "End"; } + Data time = dataValues.get("Time" + prefix); + Data latitude = dataValues.get("Latitude" + prefix); + Data longitude = dataValues.get("Longitude" + prefix); + xml.create("Distance", position * 1852); xml.create("Time", - StringUtils.substring(dataValues.get("Time" + prefix).getDataValue(), 0, -8)); + time != null ? StringUtils.substring(time.getDataValue(), 0, -8) : ""); xml.create("Latitude", - dataValues.get("Latitude" + prefix).getDataValue()); + latitude != null ? latitude.getDataValue() : 0); xml.create("Longitude", - dataValues.get("Longitude" + prefix).getDataValue()); + longitude != null ? longitude.getDataValue() : 0); xml.create("Origin", "IDREF", vocabulary.getVocabularyCode("AC_LogOrigin_" + prefix)); } @@ -353,7 +357,9 @@ public class XmlAccousticExport implements EchoBaseService { } Float upperDepth = 10f; - Float lowerDepth = Float.parseFloat(dataValues.get(depthRefSurfaceMeta).getDataValue()); + Data depthRefSurfaceData = dataValues.get(depthRefSurfaceMeta); + + Float lowerDepth = depthRefSurfaceData != null ? Float.parseFloat(depthRefSurfaceData.getDataValue()) : 0f; if (lowerDepth >= 50) { if (result.getCategory().getEchotypeLabel().equals("D4")) { lowerDepth = 30f; @@ -379,7 +385,7 @@ public class XmlAccousticExport implements EchoBaseService { xml.create("Instrument", "IDREF", cell.getDataProcessing().getDataAcquisition().getAcousticInstrument().getTopiaId()); xml.create("Calibration", - "IDREF", calibrationFound.getTopiaId()); + "IDREF", calibrationFound != null ? calibrationFound.getTopiaId() : ""); xml.create("DataAcquisition", "IDREF", cell.getDataProcessing().getDataAcquisition().getTopiaId()); xml.create("DataProcessing", diff --git a/echobase-services/src/test/resources/import-data/echobase-atlantos.h2.db.gz b/echobase-services/src/test/resources/import-data/echobase-atlantos.h2.db.gz index 5009f1a..ccdc6f2 100644 Binary files a/echobase-services/src/test/resources/import-data/echobase-atlantos.h2.db.gz and b/echobase-services/src/test/resources/import-data/echobase-atlantos.h2.db.gz differ diff --git a/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportAtlantos/Configure.java b/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportAtlantos/Configure.java new file mode 100644 index 0000000..f5670cc --- /dev/null +++ b/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportAtlantos/Configure.java @@ -0,0 +1,95 @@ +package fr.ifremer.echobase.ui.actions.exportAtlantos; + +/* + * #%L + * EchoBase :: UI + * %% + * Copyright (C) 2011 - 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% + */ + +import fr.ifremer.echobase.ui.actions.exportCoser.*; +import fr.ifremer.echobase.EchoBaseTechnicalException; +import fr.ifremer.echobase.entities.data.Voyage; +import fr.ifremer.echobase.entities.references.Mission; +import fr.ifremer.echobase.persistence.JdbcConfiguration; +import fr.ifremer.echobase.services.service.CoserApiService; +import fr.ifremer.echobase.services.service.atlantos.ExportAtlantosConfiguration; +import fr.ifremer.echobase.services.service.atlantos.ExportAtlantosService; +import fr.ifremer.echobase.services.service.exportCoser.ExportCoserConfiguration; +import fr.ifremer.echobase.services.service.importdata.configurations.VoyageAcousticsImportConfiguration; +import fr.ifremer.echobase.ui.EchoBaseSession; +import fr.ifremer.echobase.ui.actions.AbstractConfigureAction; +import org.apache.commons.io.FileUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.nuiton.util.FileUtil; + +import javax.inject.Inject; +import java.io.File; +import java.io.IOException; +import java.util.Collections; +import java.util.Map; + +/** + * Created on 3/1/14. + * + * @author Tony Chemit - chemit@codelutin.com + * @since 2.6 + */ +public class Configure extends AbstractConfigureAction<ExportAtlantosConfiguration> { + + private static final long serialVersionUID = 1L; + + protected Map<String, String> voyages; + + /** Logger. */ + private static final Log log = LogFactory.getLog(Configure.class); + + @Inject + private transient ExportAtlantosService atlantosService; + + public Configure() { + super(ExportAtlantosConfiguration.class); + } + + @Override + protected ExportAtlantosConfiguration createModel() { + return new ExportAtlantosConfiguration(); + } + + @Override + protected void prepareInputAction(ExportAtlantosConfiguration model) { + voyages = userDbPersistenceService.loadSortAndDecorate(Voyage.class); + } + + @Override + protected void prepareExecuteAction(ExportAtlantosConfiguration model) throws IOException { + File tempDirectory = FileUtils.getTempDirectory(); + File dataDirectory = new File(tempDirectory, + "echobase-atlantos-" + System.currentTimeMillis()); + FileUtil.createDirectoryIfNecessary(dataDirectory); + model.setWorkingDirectory(dataDirectory); + if (log.isInfoEnabled()) { + log.info("Temporary directory to use : " + dataDirectory); + } + } + + public Map<String, String> getVoyages() { + return voyages; + } + +} diff --git a/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportAtlantos/Download.java b/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportAtlantos/Download.java new file mode 100644 index 0000000..3d92706 --- /dev/null +++ b/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportAtlantos/Download.java @@ -0,0 +1,95 @@ +package fr.ifremer.echobase.ui.actions.exportAtlantos; + +/* + * #%L + * EchoBase :: UI + * %% + * Copyright (C) 2011 - 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% + */ + +import fr.ifremer.echobase.services.service.atlantos.ExportAtlantosConfiguration; +import fr.ifremer.echobase.services.service.exportCoser.ExportCoserConfiguration; +import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport; + +import java.io.BufferedInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; + +/** + * Created on 3/1/14. + * + * @author Tony Chemit - chemit@codelutin.com + * @since 2.6 + */ +public class Download extends EchoBaseActionSupport { + + private static final long serialVersionUID = 1L; + + /** Input stream of the file to download. */ + protected transient InputStream inputStream; + + /** File name of the download. */ + protected String fileName; + + /** Length of the file to download. */ + protected long contentLength; + + /** Content type of the file to download. */ + protected String contentType; + + public InputStream getInputStream() { + return inputStream; + } + + public String getFileName() { + return fileName; + } + + public long getContentLength() { + return contentLength; + } + + public String getContentType() { + return contentType; + } + + @Override + public String execute() throws Exception { + + ExportAtlantosConfiguration model = + getEchoBaseSession().getActionConfiguration(ExportAtlantosConfiguration.class); + + if (model == null) { + addFlashError(t("echobase.error.no.exportAtlantos.configurationFound")); + return ERROR; + } + + File exportFile = model.getExportFile(); + if (exportFile == null) { + addFlashError(t("echobase.error.no.exportAtlantos.exportFileFound")); + return ERROR; + } + + fileName = exportFile.getName(); + contentType = "application/zip"; + contentLength = exportFile.length(); + inputStream = new BufferedInputStream(new FileInputStream(exportFile)); + + return SUCCESS; + } +} diff --git a/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportAtlantos/Export.java b/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportAtlantos/Export.java new file mode 100644 index 0000000..9a5f1f7 --- /dev/null +++ b/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportAtlantos/Export.java @@ -0,0 +1,87 @@ +package fr.ifremer.echobase.ui.actions.exportAtlantos; + +/* + * #%L + * EchoBase :: UI + * %% + * Copyright (C) 2011 - 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% + */ + +import fr.ifremer.echobase.services.service.atlantos.ExportAtlantosConfiguration; +import fr.ifremer.echobase.services.service.atlantos.ExportAtlantosService; +import fr.ifremer.echobase.ui.actions.exportCoser.*; +import fr.ifremer.echobase.services.service.exportCoser.ExportCoserConfiguration; +import fr.ifremer.echobase.services.service.exportCoser.ExportCoserService; +import fr.ifremer.echobase.services.service.exportCoser.GenerateCoserMapException; +import fr.ifremer.echobase.ui.actions.AbstractWaitAndExecAction; +import java.io.IOException; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * Created on 3/1/14. + * + * @author Tony Chemit - chemit@codelutin.com + * @since 2.6 + */ +public class Export extends AbstractWaitAndExecAction<ExportAtlantosConfiguration, ExportAtlantosService> { + + private static final long serialVersionUID = 1L; + + /** Logger. */ + private static final Log log = LogFactory.getLog(Export.class); + + public Export() { + super(ExportAtlantosConfiguration.class, ExportAtlantosService.class); + } + + @Override + protected void startAction(ExportAtlantosService service, + ExportAtlantosConfiguration model) throws Exception { + if (log.isInfoEnabled()) { + log.info("Start Atlantos export for voyage" + model.getVoyageId()); + } + service.doXmlExport(model); + } + + @Override + protected String getSuccesMessage() { + return t("echobase.info.exportAtlantos.succeded"); + } + + @Override + protected String getErrorMessage() { + return t("echobase.info.exportAtlantos.failed"); + } + + @Override + public String getActionResumeTitle() { + return t("echobase.legend.exportAtlantos.resume"); + } + + @Override + protected String getResultMessage(ExportAtlantosConfiguration model) { + String result = t("echobase.message.exportAtantos.result", + model.getExportFile().getName(), + model.getActionTime()); + + if (log.isInfoEnabled()) { + log.info("Result: " + result); + } + return result; + } +} diff --git a/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/AbstractLaunchImport.java b/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/AbstractLaunchImport.java index 48d4abd..878004b 100644 --- a/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/AbstractLaunchImport.java +++ b/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/AbstractLaunchImport.java @@ -84,8 +84,13 @@ public abstract class AbstractLaunchImport<M extends ImportDataConfigurationSupp log.info("Start imports for " + getModel()); } - ImportDataResult<M> importResult = doImport(service, model, getEchoBaseSession().getUser()); - model.setResultMessage(importResult.getImportSummary()); + try { + ImportDataResult<M> importResult = doImport(service, model, getEchoBaseSession().getUser()); + model.setResultMessage(importResult.getImportSummary()); + } catch (Exception error) { + log.error("Error during import", error); + throw new ImportException("Error during import", error); + } } diff --git a/echobase-ui/src/main/resources/config/struts-exportAtlantos.xml b/echobase-ui/src/main/resources/config/struts-exportAtlantos.xml new file mode 100644 index 0000000..98ea8f5 --- /dev/null +++ b/echobase-ui/src/main/resources/config/struts-exportAtlantos.xml @@ -0,0 +1,77 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + #%L + EchoBase :: UI + %% + Copyright (C) 2011 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% + --> +<!DOCTYPE struts PUBLIC + "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN" + "http://struts.apache.org/dtds/struts-2.3.dtd"> + +<struts> + + <package name="exportAtlantos" extends="logguedAndWithDb" namespace="/exportAtlantos"> + + <!-- Configure export (input) --> + <action name="configureInput" method="input" + class="fr.ifremer.echobase.ui.actions.exportAtlantos.Configure"> + <result name="input">/WEB-INF/jsp/exportAtlantos/configure.jsp</result> + </action> + + <!-- Configure export --> + <action name="configure" method="execute" + class="fr.ifremer.echobase.ui.actions.exportAtlantos.Configure"> + <interceptor-ref name="prepareParamsStackLogguedWithDb"/> + <result name="input">/WEB-INF/jsp/exportAtlantos/configure.jsp</result> + <result type="redirectAction"> + <param name="namespace">/exportAtlantos</param> + <param name="actionName">export</param> + </result> + </action> + + <!-- Build export --> + <action name="export" method="execute" + class="fr.ifremer.echobase.ui.actions.exportAtlantos.Export"> + <interceptor-ref name="basicStackLogguedWithdb"/> + <interceptor-ref name="execAndWait"/> + <result name="wait">/WEB-INF/jsp/exportAtlantos/progress.jsp</result> + <result type="redirectAction"> + <param name="namespace">/exportAtlantos</param> + <param name="actionName">result</param> + </result> + </action> + + <!-- Result Build export --> + <action name="result" method="result" + class="fr.ifremer.echobase.ui.actions.exportAtlantos.Export"> + <result>/WEB-INF/jsp/exportAtlantos/result.jsp</result> + </action> + + <!-- Download export --> + <action name="download" method="execute" + class="fr.ifremer.echobase.ui.actions.exportAtlantos.Download"> + <interceptor-ref name="prepareParamsStackLogguedWithDb"/> + <result type="stream"> + <param name="contentType">${contentType}</param> + <param name="contentLength">${contentLength}</param> + <param name="contentDisposition">attachment; filename="${fileName}"</param> + </result> + </action> + + </package> + +</struts> + diff --git a/echobase-ui/src/main/resources/i18n/echobase-ui_en_GB.properties b/echobase-ui/src/main/resources/i18n/echobase-ui_en_GB.properties index d96c533..f7acdf4 100644 --- a/echobase-ui/src/main/resources/i18n/echobase-ui_en_GB.properties +++ b/echobase-ui/src/main/resources/i18n/echobase-ui_en_GB.properties @@ -19,6 +19,7 @@ echobase.action.delete.selectedImport=Delete selected imports echobase.action.deleteConfiguration=Delete echobase.action.deleteEntity=Delete echobase.action.downloadEmbeddedApplicationFile=Download the portable database +echobase.action.downloadExportAtlantosFile= echobase.action.downloadExportCoserFile=Download Coser export file echobase.action.downloadExportDbFile=Download database export file echobase.action.export=Export @@ -370,6 +371,7 @@ echobase.legend.createEmbedded.resume=Results of portable application creation echobase.legend.dbeditor.edit=Editing '%s' echobase.legend.dbeditor.show=Displaying '%s' echobase.legend.embeddedApplication.configuration=Portable database configuration +echobase.legend.exportAtlantos.configure= echobase.legend.exportCoser.configuration.files=Export configuration echobase.legend.exportCoser.resume=Resume of Coser export echobase.legend.exportDb.configuration.files=Export configuration @@ -398,6 +400,7 @@ echobase.menu.createEmbeddedApplication=Create a portable database echobase.menu.dashboard=Dashboard echobase.menu.editData=Modify data echobase.menu.export=Export data +echobase.menu.exportAtlantos= echobase.menu.exportCoser=Coser export echobase.menu.exportDb=Database export echobase.menu.importData=Import data @@ -447,6 +450,9 @@ echobase.title.embeddedApplicationProgress=Creating the portable database echobase.title.embeddedApplicationResult=Results of the portable database creation echobase.title.entityModificationLogs=Change log echobase.title.export=SQL export +echobase.title.exportAtlantos= +echobase.title.exportAtlantosProgress= +echobase.title.exportAtlantosResult= echobase.title.exportCoser=Coser maps echobase.title.exportCoserProgress=Coser export in progress echobase.title.exportCoserResult=Coser export results diff --git a/echobase-ui/src/main/resources/i18n/echobase-ui_fr_FR.properties b/echobase-ui/src/main/resources/i18n/echobase-ui_fr_FR.properties index a175cd7..ccafed1 100644 --- a/echobase-ui/src/main/resources/i18n/echobase-ui_fr_FR.properties +++ b/echobase-ui/src/main/resources/i18n/echobase-ui_fr_FR.properties @@ -19,6 +19,7 @@ echobase.action.delete.selectedImport=Supprimer les imports sélectionnés echobase.action.deleteConfiguration=Supprimer echobase.action.deleteEntity=Supprimer echobase.action.downloadEmbeddedApplicationFile=Télécharger l'application embarquée +echobase.action.downloadExportAtlantosFile= echobase.action.downloadExportCoserFile=Télécharger le fichier d'export Coser echobase.action.downloadExportDbFile=Télécharger le fichier d'export de la base complète echobase.action.export=Exporter @@ -373,6 +374,7 @@ echobase.legend.createEmbedded.resume=Résumé de la création d'une application echobase.legend.dbeditor.edit=Edition de '%s' echobase.legend.dbeditor.show=Visualisation de '%s' echobase.legend.embeddedApplication.configuration=Configuration de l'application embarquée +echobase.legend.exportAtlantos.configure= echobase.legend.exportCoser.configuration.files=Configuration de l'export echobase.legend.exportCoser.resume=Résumé de l'export Coser echobase.legend.exportDb.configuration.files=Configuration de l'export @@ -401,6 +403,7 @@ echobase.menu.createEmbeddedApplication=Créer une application embarquée echobase.menu.dashboard=Tableau de bord echobase.menu.editData=Modifier les données echobase.menu.export=Exporter des données +echobase.menu.exportAtlantos= echobase.menu.exportCoser=Exporter vers Coser echobase.menu.exportDb=Exporter une base echobase.menu.importData=Importer des données @@ -450,6 +453,9 @@ echobase.title.embeddedApplicationProgress=Création de l'application embarquée echobase.title.embeddedApplicationResult=Résultat de la création de l'application embarquée echobase.title.entityModificationLogs=Journal des modifications echobase.title.export=Export SQL +echobase.title.exportAtlantos= +echobase.title.exportAtlantosProgress= +echobase.title.exportAtlantosResult= echobase.title.exportCoser=Export Coser echobase.title.exportCoserProgress=Export Coser en cours echobase.title.exportCoserResult=Résultats de l'export Coser diff --git a/echobase-ui/src/main/resources/struts.xml b/echobase-ui/src/main/resources/struts.xml index 0331f5b..a591b00 100644 --- a/echobase-ui/src/main/resources/struts.xml +++ b/echobase-ui/src/main/resources/struts.xml @@ -246,6 +246,7 @@ <include file="config/struts-exportCoser.xml"/> <include file="config/struts-removeData.xml"/> <include file="config/struts-spatial.xml"/> + <include file="config/struts-exportAtlantos.xml"/> </struts> diff --git a/echobase-ui/src/main/webapp/WEB-INF/decorators.xml b/echobase-ui/src/main/webapp/WEB-INF/decorators.xml index 1ee53f7..2188bbc 100644 --- a/echobase-ui/src/main/webapp/WEB-INF/decorators.xml +++ b/echobase-ui/src/main/webapp/WEB-INF/decorators.xml @@ -37,6 +37,7 @@ <pattern>/spatial/showMap*</pattern> <pattern>/workingDb/confirmDelete*</pattern> <pattern>/workingDb/get*</pattern> + <pattern>/atlantos/*</pattern> </excludes> <decorator name="layout-default" page="layout-default.jsp"> diff --git a/echobase-ui/src/main/webapp/WEB-INF/includes/header.jsp b/echobase-ui/src/main/webapp/WEB-INF/includes/header.jsp index 107c40c..877b10f 100644 --- a/echobase-ui/src/main/webapp/WEB-INF/includes/header.jsp +++ b/echobase-ui/src/main/webapp/WEB-INF/includes/header.jsp @@ -147,7 +147,14 @@ </s:a> </li> <li> - <s:a action="configureInput" namespace="/exportCoser" cssClass="spatial"> + <s:a action="configureInput" namespace="/exportAtlantos" cssClass="expBase"> + <span> + <s:text name="echobase.menu.exportAtlantos"/> + </span> + </s:a> + </li> + <li> + <s:a action="configureInput" namespace="/exportCoser" cssClass="expBase"> <span> <s:text name="echobase.menu.exportCoser"/> </span> diff --git a/echobase-ui/src/main/webapp/WEB-INF/jsp/exportAtlantos/configure.jsp b/echobase-ui/src/main/webapp/WEB-INF/jsp/exportAtlantos/configure.jsp new file mode 100644 index 0000000..ae71fc7 --- /dev/null +++ b/echobase-ui/src/main/webapp/WEB-INF/jsp/exportAtlantos/configure.jsp @@ -0,0 +1,64 @@ +<%-- + #%L + EchoBase :: UI + %% + Copyright (C) 2011 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% + --%> +<%@page contentType="text/html" pageEncoding="UTF-8" %> +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> +<title> + <s:text name="echobase.title.exportAtlantos"/> +</title> + +<script type="text/javascript" + src="<s:url value='/js/gridHelper.js' />"></script> + +<script type="text/javascript"> + + jQuery(document).ready(function () { + + $.autoSelectVoyageAndVessel( + $('[name="model.voyageId"]'), + $('[name="model.vesselId"]'), + '<s:url action="getVesselsForVoyage" namespace="/importData"/>', + '<s:property value="model.voyageId"/>', + '<s:property value="model.vesselId"/>' + ); + }); +</script> + +<s:form namespace="/exportAtlantos" method="POST" enctype="multipart/form-data"> + + <fieldset> + <legend> + <s:text name="echobase.legend.exportAtlantos.configure"/> + </legend> + + <s:select key="model.voyageId" requiredLabel="true" + label='%{getText("echobase.common.voyage")}' + list="voyages" headerKey="" headerValue=""/> + + <sj:select key="model.vesselId" requiredLabel="true" + label='%{getText("echobase.common.vessel")}'/> + + </fieldset> + <br/> + <s:submit action="configure" value='%{getText("echobase.action.export")}'/> + +</s:form> + diff --git a/echobase-ui/src/main/webapp/WEB-INF/jsp/exportAtlantos/progress.jsp b/echobase-ui/src/main/webapp/WEB-INF/jsp/exportAtlantos/progress.jsp new file mode 100644 index 0000000..92134e9 --- /dev/null +++ b/echobase-ui/src/main/webapp/WEB-INF/jsp/exportAtlantos/progress.jsp @@ -0,0 +1,34 @@ +<%-- + #%L + EchoBase :: UI + %% + Copyright (C) 2011 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% + --%> +<%@page contentType="text/html" pageEncoding="UTF-8" %> +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> + +<meta http-equiv="refresh" content='10;url=<s:url action="export" namespace="/exportAtlantos"/>'/> + +<title><s:text name="echobase.title.exportAtlantosProgress"/></title> + +<%-- TODO letellier 20111104 : Add warn icon --%> +<p><s:text name="echobase.message.warnExportInProgress"/></p> + +<br/> + +<div> + <sj:progressbar value="%{model.progress}"/> +</div> diff --git a/echobase-ui/src/main/webapp/WEB-INF/jsp/exportAtlantos/result.jsp b/echobase-ui/src/main/webapp/WEB-INF/jsp/exportAtlantos/result.jsp new file mode 100644 index 0000000..0854178 --- /dev/null +++ b/echobase-ui/src/main/webapp/WEB-INF/jsp/exportAtlantos/result.jsp @@ -0,0 +1,47 @@ +<%-- + #%L + EchoBase :: UI + %% + Copyright (C) 2011 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% + --%> +<%@page contentType="text/html" pageEncoding="UTF-8" %> +<%@ taglib prefix="s" uri="/struts-tags" %> + +<s:url id="downloadUrl" namespace="/exportAtlantos" action="download"/> + +<s:if test="error == null"> +<script type="text/javascript"> + + jQuery(document).ready(function () { + + // start to download by it-self the result of import + window.location="${downloadUrl}"; + }); +</script> +</s:if> +<title><s:text name="echobase.title.exportAtlantosResult"/></title> + +<%@ include file="/WEB-INF/includes/actionResult.jsp" %> + +<s:if test="error == null"> +<br/> +<div> + Si le téléchargement n'a pas démarré automatiquement, suivez ce lien : + <a href="${downloadUrl}" target="download" id="download"> + <s:text name="echobase.action.downloadExportAtlantosFile"/> + </a> +</div> +</s:if> + -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.