r542 - trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/map
Author: chatellier Date: 2011-01-23 19:49:52 +0000 (Sun, 23 Jan 2011) New Revision: 542 Log: Move texts to first page for each part. Remove download map as pdf. Removed: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/map/MapPdfAction.java Deleted: trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/map/MapPdfAction.java =================================================================== --- trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/map/MapPdfAction.java 2011-01-23 19:49:45 UTC (rev 541) +++ trunk/coser-web/src/main/java/fr/ifremer/coser/web/actions/map/MapPdfAction.java 2011-01-23 19:49:52 UTC (rev 542) @@ -1,98 +0,0 @@ -/* - * #%L - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2010 - 2011 Ifremer, Codelutin, Chatellier Eric - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * #L% - */ - -package fr.ifremer.coser.web.actions.map; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.InputStream; - -import org.apache.struts2.convention.annotation.Action; -import org.apache.struts2.convention.annotation.Result; - -import com.opensymphony.xwork2.ActionSupport; - -import fr.ifremer.coser.CoserBusinessException; -import fr.ifremer.coser.services.WebService; -import fr.ifremer.coser.web.CoserWebException; -import fr.ifremer.coser.web.ServiceFactory; - -/** - * Génére la carte sous forme de pdf. - * - * @author chatellier - * @version $Revision$ - * - * Last update : $Date$ - * By : $Author$ - */ -public class MapPdfAction extends ActionSupport { - - /** serialVersionUID. */ - private static final long serialVersionUID = 1663244944108703571L; - - protected String survey; - - protected String species; - - public String getSurvey() { - return survey; - } - - public void setSurvey(String survey) { - this.survey = survey; - } - - public String getSpecies() { - return species; - } - - public void setSpecies(String species) { - this.species = species; - } - - @Action(results= {@Result(type="stream", params={"contentType", "application/pdf", "inputName", "inputStream", "contentDisposition", "attachment; filename=\"${filename}\""})}) - public String execute() { - return SUCCESS; - } - - public String getFilename() { - return survey + "-" + species + ".pdf"; - } - - public InputStream getInputStream() { - WebService webService = ServiceFactory.getWebService(); - - InputStream input = null; - try { - File mapImage = webService.getMapFileAsPDF(survey, species); - input = new FileInputStream(mapImage); - } catch (CoserBusinessException ex) { - throw new CoserWebException("Can't get map pdf", ex); - } catch (FileNotFoundException ex) { - throw new CoserWebException("Can't get map pdf", ex); - } - - return input; - } -}
participants (1)
-
chatellier@users.labs.libre-entreprise.org