Author: tchemit Date: 2014-03-02 00:20:47 +0100 (Sun, 02 Mar 2014) New Revision: 968 Url: http://codelutin.com/projects/echobase/repository/revisions/968 Log: refs #2931: Export de cartes au format image vers le site des indicateurs Added: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/exportMap/ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/exportMap/ExportMapConfiguration.java trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/exportMap/ExportMapService.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportMap/ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportMap/Configure.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportMap/Download.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportMap/Export.java trunk/echobase-ui/src/main/resources/config/struts-exportMap.xml trunk/echobase-ui/src/main/resources/fr/ifremer/echobase/ui/actions/exportMap/ trunk/echobase-ui/src/main/resources/fr/ifremer/echobase/ui/actions/exportMap/Configure-validation.xml trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportMap/ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportMap/configure.jsp trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportMap/progress.jsp trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportMap/result.jsp Modified: trunk/echobase-domain/src/main/data/echobase-referentiel.echobase trunk/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/migration/workingDb/MigrationCallBackForVersion2_6.java trunk/echobase-domain/src/main/resources/migration/postgis-view-2.6.sql trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/spatial/RefreshSpatialViews.java trunk/echobase-ui/src/main/resources/i18n/echobase-ui_en_GB.properties trunk/echobase-ui/src/main/resources/i18n/echobase-ui_fr_FR.properties trunk/echobase-ui/src/main/resources/struts.xml trunk/echobase-ui/src/main/webapp/WEB-INF/includes/header.jsp Property changes on: trunk/echobase-domain/src/main/data/echobase-referentiel.echobase ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/migration/workingDb/MigrationCallBackForVersion2_6.java =================================================================== --- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/migration/workingDb/MigrationCallBackForVersion2_6.java 2014-02-28 18:55:22 UTC (rev 967) +++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/migration/workingDb/MigrationCallBackForVersion2_6.java 2014-03-01 23:20:47 UTC (rev 968) @@ -4,7 +4,7 @@ * #%L * EchoBase :: Domain * $Id$ - * $HeadURL:$ + * $HeadURL$ * %% * Copyright (C) 2011 - 2014 Ifremer, Codelutin * %% Property changes on: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/migration/workingDb/MigrationCallBackForVersion2_6.java ___________________________________________________________________ Modified: svn:keywords - Author Date Id Revision + Author Date Id Revision HeadURL Modified: trunk/echobase-domain/src/main/resources/migration/postgis-view-2.6.sql =================================================================== --- trunk/echobase-domain/src/main/resources/migration/postgis-view-2.6.sql 2014-02-28 18:55:22 UTC (rev 967) +++ trunk/echobase-domain/src/main/resources/migration/postgis-view-2.6.sql 2014-03-01 23:20:47 UTC (rev 968) @@ -1,8 +1,8 @@ --- -- #%L -- EchoBase :: Domain --- $Id:$ --- $HeadURL:$ +-- $Id$ +-- $HeadURL$ -- %% -- Copyright (C) 2011 - 2014 Ifremer, Codelutin -- %% Property changes on: trunk/echobase-domain/src/main/resources/migration/postgis-view-2.6.sql ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/exportMap/ExportMapConfiguration.java =================================================================== --- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/exportMap/ExportMapConfiguration.java (rev 0) +++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/exportMap/ExportMapConfiguration.java 2014-03-01 23:20:47 UTC (rev 968) @@ -0,0 +1,119 @@ +package fr.ifremer.echobase.services.service.exportMap; + +/* + * #%L + * EchoBase :: Services + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 - 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.echobase.persistence.JdbcConfiguration; +import fr.ifremer.echobase.services.AbstractEchobaseActionConfiguration; +import fr.ifremer.echobase.services.ProgressModel; +import org.apache.commons.io.FileUtils; + +import java.io.File; +import java.io.IOException; + +/** + * Created on 3/1/14. + * + * @author Tony Chemit <chemit@codelutin.com> + * @since XXX + */ +public class ExportMapConfiguration extends AbstractEchobaseActionConfiguration { + + private static final long serialVersionUID = 1L; + + /** + * File of of export file. + */ + private String fileName; + + /** + * Working directory. + */ + private File workingDirectory; + + /** + * Final export file. + */ + private File exportFile; + + /** + * Id of voyage to export. + */ + private String voyageId; + + private JdbcConfiguration dbConfiguration; + + public ExportMapConfiguration() { + } + + public ExportMapConfiguration(ProgressModel progressModel) { + super(progressModel); + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public File getWorkingDirectory() { + return workingDirectory; + } + + public void setWorkingDirectory(File workingDirectory) { + this.workingDirectory = workingDirectory; + } + + public File getExportFile() { + return exportFile; + } + + public void setExportFile(File exportFile) { + this.exportFile = exportFile; + } + + public String getVoyageId() { + return voyageId; + } + + public void setVoyageId(String voyageId) { + this.voyageId = voyageId; + } + + public JdbcConfiguration getDbConfiguration() { + return dbConfiguration; + } + + public void setDbConfiguration(JdbcConfiguration dbConfiguration) { + this.dbConfiguration = dbConfiguration; + } + + @Override + public void destroy() throws IOException { + if (workingDirectory != null) { + FileUtils.deleteDirectory(workingDirectory); + } + } +} Property changes on: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/exportMap/ExportMapConfiguration.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/exportMap/ExportMapService.java =================================================================== --- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/exportMap/ExportMapService.java (rev 0) +++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/exportMap/ExportMapService.java 2014-03-01 23:20:47 UTC (rev 968) @@ -0,0 +1,87 @@ +package fr.ifremer.echobase.services.service.exportMap; + +/* + * #%L + * EchoBase :: Services + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 - 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.echobase.io.EchoBaseIOUtil; +import fr.ifremer.echobase.persistence.JdbcConfiguration; +import fr.ifremer.echobase.services.EchoBaseServiceSupport; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.nuiton.util.FileUtil; +import org.nuiton.util.TimeLog; + +import java.io.File; +import java.io.IOException; + +/** + * Created on 3/1/14. + * + * @author Tony Chemit <chemit@codelutin.com> + * @since 2.6 + */ +public class ExportMapService extends EchoBaseServiceSupport { + + /** Logger. */ + private static final Log log = LogFactory.getLog(ExportMapService.class); + + public static final TimeLog timeLog = new TimeLog(ExportMapService.class); + + public void doExport(ExportMapConfiguration model) throws IOException { + + String fileName = model.getFileName(); + + File tempDirectory = model.getWorkingDirectory(); + + File zipFile = new File(tempDirectory, fileName + ".zip"); + + if (log.isInfoEnabled()) { + log.info("Will export map to " + zipFile); + } + model.setExportFile(zipFile); + + File dir = new File(tempDirectory, "echobase"); + + FileUtil.createDirectoryIfNecessary(dir); + if (log.isInfoEnabled()) { + log.info("Will store maps in " + dir); + } + + JdbcConfiguration dbConfiguration = model.getDbConfiguration(); + if (log.isInfoEnabled()) { + log.info("Will connect to db: " + dbConfiguration.getUrl()); + } + + // compute nb steps + int nbSteps = 0; + + if (log.isInfoEnabled()) { + log.info("NB steps: " + nbSteps); + } + model.setNbSteps(nbSteps); + + // TODO Export + + EchoBaseIOUtil.compressZipFile(zipFile, dir); + } +} Property changes on: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/service/exportMap/ExportMapService.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportMap/Configure.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportMap/Configure.java (rev 0) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportMap/Configure.java 2014-03-01 23:20:47 UTC (rev 968) @@ -0,0 +1,100 @@ +package fr.ifremer.echobase.ui.actions.exportMap; + +/* + * #%L + * EchoBase :: UI + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 - 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.echobase.entities.data.Voyage; +import fr.ifremer.echobase.persistence.JdbcConfiguration; +import fr.ifremer.echobase.services.service.exportMap.ExportMapConfiguration; +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 java.io.File; +import java.io.IOException; +import java.util.Map; + +/** + * Created on 3/1/14. + * + * @author Tony Chemit <chemit@codelutin.com> + * @since 2.6 + */ +public class Configure extends AbstractConfigureAction<ExportMapConfiguration> { + + private static final long serialVersionUID = 1L; + + /** Logger. */ + private static final Log log = LogFactory.getLog(Configure.class); + + /** Universe of voyages to export in db. */ + protected Map<String, String> voyages; + + public Configure() { + super(ExportMapConfiguration.class); + } + + public Map<String, String> getVoyages() { + return voyages; + } + + public void setFileName(String fileName) { + getModel().setFileName(fileName); + } + + @Override + protected ExportMapConfiguration createModel() { + ExportMapConfiguration result = new ExportMapConfiguration(); + result.setFileName("echobase"); + + EchoBaseSession userSession = getEchoBaseSession(); + JdbcConfiguration workingDbConfiguration = userSession.getWorkingDbConfiguration(); + result.setDbConfiguration(workingDbConfiguration); + return result; + } + + @Override + protected void prepareInputAction(ExportMapConfiguration model) { + + voyages = userDbPersistenceService.loadSortAndDecorate(Voyage.class); + } + + @Override + protected void prepareExecuteAction(ExportMapConfiguration model) throws IOException { + + File tempDirectory = FileUtils.getTempDirectory(); + File dataDirectory = new File(tempDirectory, + "echobase-exportMap-" + + System.currentTimeMillis()); + FileUtil.createDirectoryIfNecessary(dataDirectory); + model.setWorkingDirectory(dataDirectory); + if (log.isInfoEnabled()) { + log.info("Temporary directory to use : " + dataDirectory); + } + + voyages = userDbPersistenceService.loadSortAndDecorate(Voyage.class); + } +} Property changes on: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportMap/Configure.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportMap/Download.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportMap/Download.java (rev 0) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportMap/Download.java 2014-03-01 23:20:47 UTC (rev 968) @@ -0,0 +1,96 @@ +package fr.ifremer.echobase.ui.actions.exportMap; + +/* + * #%L + * EchoBase :: UI + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 - 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.echobase.services.service.exportMap.ExportMapConfiguration; +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 { + + ExportMapConfiguration model = + getEchoBaseSession().getActionConfiguration(ExportMapConfiguration.class); + + if (model == null) { + addFlashError(t("echobase.error.no.exportMap.configurationFound")); + return ERROR; + } + + File exportFile = model.getExportFile(); + if (exportFile == null) { + addFlashError(t("echobase.error.no.exportMap.exportFileFound")); + return ERROR; + } + + fileName = exportFile.getName(); + contentType = "application/zip"; + contentLength = exportFile.length(); + inputStream = new BufferedInputStream(new FileInputStream(exportFile)); + + return SUCCESS; + } +} Property changes on: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportMap/Download.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportMap/Export.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportMap/Export.java (rev 0) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportMap/Export.java 2014-03-01 23:20:47 UTC (rev 968) @@ -0,0 +1,85 @@ +package fr.ifremer.echobase.ui.actions.exportMap; + +/* + * #%L + * EchoBase :: UI + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 - 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.echobase.services.service.exportMap.ExportMapConfiguration; +import fr.ifremer.echobase.services.service.exportMap.ExportMapService; +import fr.ifremer.echobase.ui.actions.AbstractWaitAndExecAction; +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<ExportMapConfiguration, ExportMapService> { + + private static final long serialVersionUID = 1L; + + /** Logger. */ + private static final Log log = LogFactory.getLog(Export.class); + + public Export() { + super(ExportMapConfiguration.class, ExportMapService.class); + } + + @Override + protected void startAction(ExportMapService service, + ExportMapConfiguration model) throws Exception { + if (log.isInfoEnabled()) { + log.info("Start export map to file " + model.getFileName()); + } + service.doExport(model); + } + + @Override + protected String getSuccesMessage() { + return t("echobase.info.exportMap.succeded"); + } + + @Override + protected String getErrorMessage() { + return t("echobase.info.exportMap.failed"); + } + + @Override + public String getActionResumeTitle() { + return t("echobase.legend.exportMap.resume"); + } + + @Override + protected String getResultMessage(ExportMapConfiguration model) { + String result = t("echobase.message.exportMap.result", + model.getFileName(), + model.getActionTime()); + + if (log.isInfoEnabled()) { + log.info("Result: " + result); + } + return result; + } + +} \ No newline at end of file Property changes on: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportMap/Export.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/spatial/RefreshSpatialViews.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/spatial/RefreshSpatialViews.java 2014-02-28 18:55:22 UTC (rev 967) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/spatial/RefreshSpatialViews.java 2014-03-01 23:20:47 UTC (rev 968) @@ -1,5 +1,28 @@ package fr.ifremer.echobase.ui.actions.spatial; +/* + * #%L + * EchoBase :: UI + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 - 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.echobase.services.service.spatial.SpatialService; import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport; Property changes on: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/spatial/RefreshSpatialViews.java ___________________________________________________________________ Modified: svn:keywords - Author Date Id Revision + Author Date Id Revision HeadURL Added: trunk/echobase-ui/src/main/resources/config/struts-exportMap.xml =================================================================== --- trunk/echobase-ui/src/main/resources/config/struts-exportMap.xml (rev 0) +++ trunk/echobase-ui/src/main/resources/config/struts-exportMap.xml 2014-03-01 23:20:47 UTC (rev 968) @@ -0,0 +1,82 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!-- + #%L + EchoBase :: UI + + $Id$ + $HeadURL$ + %% + 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="exportMap" extends="logguedAndWithDb" namespace="/exportMap"> + + <!-- Configure export (input) --> + <action name="configureInput" method="input" + class="fr.ifremer.echobase.ui.actions.exportMap.Configure"> + <result name="input">/WEB-INF/jsp/exportMap/configure.jsp</result> + </action> + + <!-- Configure export --> + <action name="configure" method="execute" + class="fr.ifremer.echobase.ui.actions.exportMap.Configure"> + <interceptor-ref name="prepareParamsStackLogguedWithDb"/> + <result name="input">/WEB-INF/jsp/exportMap/configure.jsp</result> + <result type="redirectAction"> + <param name="namespace">/exportMap</param> + <param name="actionName">export</param> + </result> + </action> + + <!-- Build export --> + <action name="export" method="execute" + class="fr.ifremer.echobase.ui.actions.exportMap.Export"> + <interceptor-ref name="basicStackLogguedWithdb"/> + <interceptor-ref name="execAndWait"/> + <result name="wait">/WEB-INF/jsp/exportMap/progress.jsp</result> + <result type="redirectAction"> + <param name="namespace">/exportMap</param> + <param name="actionName">result</param> + </result> + </action> + + <!-- Result Build export --> + <action name="result" method="result" + class="fr.ifremer.echobase.ui.actions.exportMap.Export"> + <result>/WEB-INF/jsp/exportMap/result.jsp</result> + </action> + + <!-- Download export --> + <action name="download" method="execute" + class="fr.ifremer.echobase.ui.actions.exportMap.Download"> + <interceptor-ref name="prepareParamsStackLogguedWithDb"/> + <result type="stream"> + <param name="contentType">${contentType}</param> + <param name="contentLength">${contentLength}</param> + <param name="contentDisposition">filename="${fileName}"</param> + </result> + </action> + + </package> + +</struts> + Property changes on: trunk/echobase-ui/src/main/resources/config/struts-exportMap.xml ___________________________________________________________________ Added: svn:mime-type + text/xml Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: trunk/echobase-ui/src/main/resources/fr/ifremer/echobase/ui/actions/exportMap/Configure-validation.xml =================================================================== --- trunk/echobase-ui/src/main/resources/fr/ifremer/echobase/ui/actions/exportMap/Configure-validation.xml (rev 0) +++ trunk/echobase-ui/src/main/resources/fr/ifremer/echobase/ui/actions/exportMap/Configure-validation.xml 2014-03-01 23:20:47 UTC (rev 968) @@ -0,0 +1,40 @@ +<!-- + #%L + EchoBase :: UI + + $Id$ + $HeadURL$ + %% + 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 validators PUBLIC "-//Apache Struts//XWork Validator 1.0.3//EN" + "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd"> +<validators> + + <field name="model.voyageId"> + <field-validator type="requiredstring"> + <message key="echobase.error.exportMap.voyage.required"/> + </field-validator> + </field> + + <field name="model.fileName"> + <field-validator type="requiredstring"> + <message key="echobase.error.exportMap.filename.required"/> + </field-validator> + </field> + +</validators> \ No newline at end of file Property changes on: trunk/echobase-ui/src/main/resources/fr/ifremer/echobase/ui/actions/exportMap/Configure-validation.xml ___________________________________________________________________ Added: svn:mime-type + text/xml Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: trunk/echobase-ui/src/main/resources/i18n/echobase-ui_en_GB.properties =================================================================== --- trunk/echobase-ui/src/main/resources/i18n/echobase-ui_en_GB.properties 2014-02-28 18:55:22 UTC (rev 967) +++ trunk/echobase-ui/src/main/resources/i18n/echobase-ui_en_GB.properties 2014-03-01 23:20:47 UTC (rev 968) @@ -17,6 +17,7 @@ echobase.action.display=Display spatial data echobase.action.downloadEmbeddedApplicationFile=Download the portable database echobase.action.downloadExportDbFile=Download database export file +echobase.action.downloadExportMapFile=Download voyage maps export file echobase.action.export=Export echobase.action.exportSqlData=Data export echobase.action.exportTable=Export @@ -36,6 +37,7 @@ echobase.action.saveSqlQuery=Update query echobase.action.show.embedded.documentation=How to use a portable database echobase.action.show.exportDb.documentation=How to export a database +echobase.action.show.exportMap.documentation=How to export voyage maps (Coser) echobase.action.show.import.documentation=How to import data echobase.action.show.importDb.documentation=How to import a database echobase.action.show.showSpatialData.documentation=How to display spatial data @@ -173,14 +175,16 @@ echobase.confirm.delete.workingDbConfiguration=Delete working database configuration echobase.error.bad.password=Invalid password echobase.error.email.already.used=The user name already exists -echobase.error.export.description.requiredstring=La description de l'export est obligatoire -echobase.error.export.name.requiredstring=Le nom de l'export est obligatoire +echobase.error.export.description.requiredstring=Export description required +echobase.error.export.name.requiredstring=Export name required echobase.error.export.sqlQuery.forbidden.alter.word=La requète contient le mot 'ALTER', ce qui est interdit echobase.error.export.sqlQuery.forbidden.delete.word=La requète contient le mot 'DELETE', ce qui est interdit echobase.error.export.sqlQuery.forbidden.drop.word=La requète contient le mot 'DROP', ce qui est interdit echobase.error.export.sqlQuery.forbidden.insert.word=La requète contient le mot 'INSERT', ce qui est interdit echobase.error.export.sqlQuery.forbidden.update.word=La requète contient le mot 'UPDATE', ce qui est interdit echobase.error.export.sqlQuery.requiredstring=La requète de l'export est obligatoire +echobase.error.exportMap.filename.required=Export filename required +echobase.error.exportMap.voyage.required=No voyage selected echobase.error.import.acousticDensityUnit.required=acousticDensityUnit non renseigné echobase.error.import.acquisitionSoftwareVersionER60.required=acquisitionSoftwareVersionER60 non renseigné echobase.error.import.acquisitionSoftwareVersionME70.required=acquisitionSoftwareVersionME70 non renseigné @@ -233,16 +237,15 @@ echobase.error.no.embeddedApplication.exportFileFound=New portable database not found echobase.error.no.exportDb.configurationFound=Database export configuration not found echobase.error.no.exportDb.exportFileFound=Database export archive not found +echobase.error.no.exportMap.configurationFound=Voyage maps export configuration not found +echobase.error.no.exportMap.exportFileFound=Voyage maps archive not found echobase.error.query.invalid.name=\=Query names must only contains alphanumeric characters echobase.error.query.name.already.exists=Query name already exists echobase.error.required.email=E-mail address required echobase.error.required.password=Password is required -echobase.error.showData.cellType.required=CellType required -echobase.error.showData.dataMetadata.required=DataMetadata required -echobase.error.showData.dataMetadataIdForLayer.required=Il faut sélectionner la méta-donnée à utiliser sur la couche -echobase.error.showData.echoTypeOrSpecies.required=Echotype or (and) Species is required -echobase.error.showData.noLayer.selected=Aucune couche de présentation sélectionnée -echobase.error.showData.voyage.required=Voyage required +echobase.error.showData.dataMetadataIdForLayer.required= +echobase.error.showData.noLayer.selected= +echobase.error.showData.voyage.required= echobase.error.warlocation.notFound=Database .war file not found at location %s echobase.error.workingDbConfiguration.couldNotConnect=Could not connect to database (%s) echobase.error.workingDbConfiguration.createOnlyOnPostgresql=Database creation is only possible for *Postgresql* type @@ -260,9 +263,12 @@ echobase.info.documentation=EchoBase online documentation echobase.info.downloadFiles=Download EchoBase or some import files echobase.info.echoR=EchoR project -echobase.info.exportDb.archive=Basebame of the archive, extension <strong>.echobase</strong> will be added to it. +echobase.info.exportDb.archive=Basename of the archive, extension <strong>.echobase</strong> will be added to it. echobase.info.exportDb.failed=Database export failed echobase.info.exportDb.succeded=Database export successful +echobase.info.exportMap.archive=Basename of the archive, extension <strong>.zip</strong> will be added to it. +echobase.info.exportMap.failed=Voyage maps export failed +echobase.info.exportMap.succeded=Voyage maps export successful echobase.info.import.failed=Import failed echobase.info.importData.failed=Data import failed echobase.info.importData.succeded=Data import sucessful @@ -311,6 +317,7 @@ echobase.label.exportAsSeen=Export as displayed on the screen echobase.label.exportDbFileName=Name of export file echobase.label.exportFileName=Name of export file +echobase.label.exportMapFileName=Name of export file echobase.label.importFile=File to export echobase.label.login=Connection echobase.label.numberOfCreatedEntities=No. of fields created @@ -334,6 +341,8 @@ echobase.legend.embeddedApplication.configuration=Portable database configuration echobase.legend.exportDb.configuration.files=Export configuration echobase.legend.exportDb.resume=Resume of database export +echobase.legend.exportMap.configuration.files=Export configuration +echobase.legend.exportMap.resume=Resume of voyage maps export echobase.legend.importData.configuration.selectImportType=Type of import selection echobase.legend.importData.configure=Import configuration echobase.legend.importData.createMission=Mission caracteristics @@ -355,6 +364,7 @@ echobase.menu.editData=Modify data echobase.menu.export=Export data echobase.menu.exportDb=Database export +echobase.menu.exportMap=Voyage maps export echobase.menu.importData=Import data echobase.menu.importDb=Database import echobase.menu.logs=Change log @@ -366,6 +376,7 @@ echobase.message.createEmbedded.result=Portable application was successful in %s. echobase.message.download.link=If download did not start by itself, you can start it manually from this link\: echobase.message.exportDb.result=Export of database (mode %s) was successful (file %s) in %s. +echobase.message.exportMap.result=Export of voyage maps was successful (file %s) in %s. echobase.message.importData.result=Data import successful in %s \:\n%s echobase.message.no.row.selected=No data selected echobase.message.no.spatial.database.support=The working db you are using is not compatible with postgis 2. @@ -394,6 +405,9 @@ echobase.title.exportDb=Export a complete database echobase.title.exportDbProgress=Export database in progress echobase.title.exportDbResult=Database export results +echobase.title.exportMap=Export voyage maps +echobase.title.exportMapProgress=Voyage maps export in progress +echobase.title.exportMapResult=Voyage maps export results echobase.title.exportTable=Export a table echobase.title.importData.selectImportType=Select type of import echobase.title.importDb=Database import Modified: trunk/echobase-ui/src/main/resources/i18n/echobase-ui_fr_FR.properties =================================================================== --- trunk/echobase-ui/src/main/resources/i18n/echobase-ui_fr_FR.properties 2014-02-28 18:55:22 UTC (rev 967) +++ trunk/echobase-ui/src/main/resources/i18n/echobase-ui_fr_FR.properties 2014-03-01 23:20:47 UTC (rev 968) @@ -17,6 +17,7 @@ echobase.action.display=Afficher les données echobase.action.downloadEmbeddedApplicationFile=Télécharger l'application embarquée echobase.action.downloadExportDbFile=Télécharger le fichier d'export de la base complète +echobase.action.downloadExportMapFile=Télécharger le fichier d'export des cartes d'une campagne echobase.action.export=Exporter echobase.action.exportSqlData=Exporter les données echobase.action.exportTable=Exporter @@ -36,6 +37,7 @@ echobase.action.saveSqlQuery=Mettre à jour echobase.action.show.embedded.documentation=Comment utiliser une application embarquée echobase.action.show.exportDb.documentation=Comment exporter une base +echobase.action.show.exportMap.documentation=Comment exporter les cartes d'une campagne (Coser) echobase.action.show.import.documentation=Comment importer des données echobase.action.show.importDb.documentation=Comment importer une base echobase.action.show.showSpatialData.documentation=Comment visualiser des données spatiales @@ -181,6 +183,8 @@ echobase.error.export.sqlQuery.forbidden.insert.word=La requète contient le mot 'INSERT', ce qui est interdit echobase.error.export.sqlQuery.forbidden.update.word=La requète contient le mot 'UPDATE', ce qui est interdit echobase.error.export.sqlQuery.requiredstring=La requète de l'export est obligatoire +echobase.error.exportMap.filename.required=Le nom d'un fichier d'export est obligatoire +echobase.error.exportMap.voyage.required=La sélection d'une campagne est obligatoire echobase.error.import.acousticDensityUnit.required=acousticDensityUnit non renseigné echobase.error.import.acquisitionSoftwareVersionER60.required=acquisitionSoftwareVersionER60 non renseigné echobase.error.import.acquisitionSoftwareVersionME70.required=acquisitionSoftwareVersionME70 non renseigné @@ -233,6 +237,8 @@ echobase.error.no.embeddedApplication.exportFileFound=Application embarquée générée non trouvée echobase.error.no.exportDb.configurationFound=Configuration de l'export de la base non trouvée echobase.error.no.exportDb.exportFileFound=Archive d'export de la base introuvable +echobase.error.no.exportMap.configurationFound=Configuration de l'export des cartes d'une campagne +echobase.error.no.exportMap.exportFileFound=Archive d'export des cartes d'une campagne introuvable echobase.error.query.invalid.name=Le nom de la requête doit être constitué uniquement de caractères alphanumériques echobase.error.query.name.already.exists=Nom de requête déjà utilisé echobase.error.required.email=Courriel obligatoire @@ -263,6 +269,9 @@ echobase.info.exportDb.archive=Il s'agit du nom de l'archive, l'extension <strong>.echobase</strong> sera automatiquement rajoutée. echobase.info.exportDb.failed=L'export de la base de données a échoué echobase.info.exportDb.succeded=L'export de la base de données a réussi +echobase.info.exportMap.archive=Il s'agit du nom de l'archive, l'extension <strong>.zip</strong> sera automatiquement rajoutée. +echobase.info.exportMap.failed=L'export des cartes d'une campagne a échoué +echobase.info.exportMap.succeded=L'export des cartes d'une campagne a réussi echobase.info.import.failed=L'import a échoué echobase.info.importData.failed=L'import des données a échoué echobase.info.importData.succeded=L'import des données a réussi @@ -311,6 +320,7 @@ echobase.label.exportAsSeen=Exporter "comme à l'écran" echobase.label.exportDbFileName=Nom du fichier d'export echobase.label.exportFileName=Nom du fichier d'export +echobase.label.exportMapFileName=Nom du fichier d'export echobase.label.importFile=Fichier à importer echobase.label.login=Connexion echobase.label.numberOfCreatedEntities=Nombre de champs créés @@ -334,6 +344,8 @@ echobase.legend.embeddedApplication.configuration=Configuration de l'application embarquée echobase.legend.exportDb.configuration.files=Configuration de l'export echobase.legend.exportDb.resume=Résumé de l'export de base +echobase.legend.exportMap.configuration.files=Configuration de l'export +echobase.legend.exportMap.resume=Résumé de l'export des cartes d'une campagne echobase.legend.importData.configuration.selectImportType=Sélection du type d'import echobase.legend.importData.configure=Configurer l'import echobase.legend.importData.createMission=Caractéristiques de la mission @@ -355,6 +367,7 @@ echobase.menu.editData=Modifier les données echobase.menu.export=Exporter des données echobase.menu.exportDb=Exporter une base +echobase.menu.exportMap=Exporter les cartes d'une campagne echobase.menu.importData=Importer des données echobase.menu.importDb=Importer une base echobase.menu.logs=Journal des modifications @@ -366,6 +379,7 @@ echobase.message.createEmbedded.result=La création de l'application embarqué a réussi en %s echobase.message.download.link=Si le téléchargement n'a pas démarré automatiquement, suivez ce lien \: echobase.message.exportDb.result=L'export de la base (mode %s) a réussi (fichier %s) en %s +echobase.message.exportMap.result=L'export des cartes a réussi (fichier %s) en %s echobase.message.importData.result=Import de données réussi en %s \:\n%s echobase.message.no.row.selected=Aucune donnée sélectionnée echobase.message.no.spatial.database.support=La base de travail que vous utilisez ne possède pas de support spatiale. @@ -394,6 +408,9 @@ echobase.title.exportDb=Export complet de la base echobase.title.exportDbProgress=Export de la base de données en cours echobase.title.exportDbResult=Résultats de l'export de la base de données +echobase.title.exportMap=Export des cartes d'une campagne +echobase.title.exportMapProgress=Export des cartes d'une campagne en cours +echobase.title.exportMapResult=Résultats de l'export des cartes d'une campagne echobase.title.exportTable=Exporter une table echobase.title.importData.selectImportType=Sélection du type d'import echobase.title.importDb=Import d'une base Modified: trunk/echobase-ui/src/main/resources/struts.xml =================================================================== --- trunk/echobase-ui/src/main/resources/struts.xml 2014-02-28 18:55:22 UTC (rev 967) +++ trunk/echobase-ui/src/main/resources/struts.xml 2014-03-01 23:20:47 UTC (rev 968) @@ -292,6 +292,7 @@ <include file="config/struts-importDb.xml"/> <include file="config/struts-exportDb.xml"/> + <include file="config/struts-exportMap.xml"/> <include file="config/struts-removeData.xml"/> <include file="config/struts-spatial.xml"/> Modified: trunk/echobase-ui/src/main/webapp/WEB-INF/includes/header.jsp =================================================================== --- trunk/echobase-ui/src/main/webapp/WEB-INF/includes/header.jsp 2014-02-28 18:55:22 UTC (rev 967) +++ trunk/echobase-ui/src/main/webapp/WEB-INF/includes/header.jsp 2014-03-01 23:20:47 UTC (rev 968) @@ -149,6 +149,13 @@ </span> </s:a> </li> + <li> + <s:a action="configureInput" namespace="/exportMap" cssClass="spatial"> + <span> + <s:text name="echobase.menu.exportMap"/> + </span> + </s:a> + </li> </s:if> <li> <s:a action="userList" namespace="/user" cssClass="user"> Added: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportMap/configure.jsp =================================================================== --- trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportMap/configure.jsp (rev 0) +++ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportMap/configure.jsp 2014-03-01 23:20:47 UTC (rev 968) @@ -0,0 +1,65 @@ +<%-- + #%L + EchoBase :: UI + + $Id$ + $HeadURL$ + %% + 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" %> + +<title><s:text name="echobase.title.exportMap"/></title> + +<script type="text/javascript"> + + jQuery(document).ready(function () { + + }); +</script> + +<s:form namespace="/exportMap" method="POST"> + <fieldset> + <legend> + <s:text name="echobase.legend.exportDb.configuration.files"/> + </legend> + + <div class="cleanBoth help"> + <s:a href="%{getDocumentation('exportMap.html', null)}" target="doc"> + <s:text name="echobase.action.show.exportMap.documentation"/> + </s:a> + </div> + <br/> + + <s:select key="model.voyageId" requiredLabel="true" + label='%{getText("echobase.common.voyage")}' + list="voyages" headerKey="" headerValue=""/> + + <div class="cleanBoth"></div> + <br/> + <s:textfield key="model.fileName" requiredLabel="true" size="100" + label="%{getText('echobase.label.exportMapFileName')} (*)"/> + + <div class="cleanBoth"> + <br/> + (*) <s:text name="echobase.info.exportMap.archive"/> + </div> + </fieldset> + <br/> + <s:submit action="configure" value='%{getText("echobase.action.export")}'/> +</s:form> Property changes on: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportMap/configure.jsp ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportMap/progress.jsp =================================================================== --- trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportMap/progress.jsp (rev 0) +++ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportMap/progress.jsp 2014-03-01 23:20:47 UTC (rev 968) @@ -0,0 +1,39 @@ +<%-- + #%L + EchoBase :: UI + + $Id$ + $HeadURL$ + %% + 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="/exportMap"/>'/> + +<title><s:text name="echobase.title.exportMapProgress"/></title> + +<%-- TODO letellier 20111104 : Add warn icon --%> +<p><s:text name="echobase.message.warnExportInProgress"/></p> + +<br/> + +<div> + <sj:progressbar value="%{model.progress}"/> +</div> \ No newline at end of file Property changes on: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportMap/progress.jsp ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Added: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportMap/result.jsp =================================================================== --- trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportMap/result.jsp (rev 0) +++ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportMap/result.jsp 2014-03-01 23:20:47 UTC (rev 968) @@ -0,0 +1,54 @@ +<%-- + #%L + EchoBase :: UI + + $Id$ + $HeadURL$ + %% + 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="/exportMap" action="download"/> + +<script type="text/javascript"> + + jQuery(document).ready(function () { + + // start to download by it-self the result of import + window.open("${downloadUrl}"); + }); + +</script> +<title><s:text name="echobase.title.exportMapResult"/></title> + +<%@ include file="/WEB-INF/includes/actionResult.jsp" %> + +<div> + L'export des cartes de la campagne a réussi en <s:property value="model.actionTime"/>. +</div> + +<br/> + +<div> + Si le téléchargement n'a pas démarré automatiquement, suivez ce lien : + <a href="${downloadUrl}" target="download"> + <s:text name="echobase.action.downloadExportMapFile"/> + </a> +</div> + Property changes on: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportMap/result.jsp ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native