1 /* 2 * #%L 3 * Coser :: Web 4 * %% 5 * Copyright (C) 2010 - 2011 Ifremer, Codelutin, Chatellier Eric 6 * %% 7 * This program is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU Affero General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU Affero General Public License 18 * along with this program. If not, see <http://www.gnu.org/licenses/>. 19 * #L% 20 */ 21 22 package fr.ifremer.coser.web.actions.source; 23 24 import fr.ifremer.coser.result.request.GetZonesForExtractRawDataRequest; 25 import fr.ifremer.coser.web.actions.common.AbstractCoserJspAction; 26 27 import java.util.Map; 28 29 /** 30 * Affiche les liens de téléchargement du zip pour le projet choisit. 31 * 32 * @author chatellier 33 * @version $Revision$ 34 * <p/> 35 * Last update : $Date$ 36 * By : $Author$ 37 */ 38 public class SourceAction extends AbstractCoserJspAction { 39 40 /** serialVersionUID. */ 41 private static final long serialVersionUID = 3385467755357775199L; 42 43 protected String facade; 44 45 protected String zone; 46 47 protected String zonePicture; 48 49 public String getFacade() { 50 return facade; 51 } 52 53 public void setFacade(String facade) { 54 this.facade = facade; 55 } 56 57 public String getZone() { 58 return zone; 59 } 60 61 public void setZone(String zone) { 62 this.zone = zone; 63 } 64 65 public String getZonePicture() { 66 return zonePicture; 67 } 68 69 public String getFacadeDisplayName() { 70 return getService().getFacadeDisplayName(facade); 71 } 72 73 public String getZoneDisplayName() { 74 GetZonesForExtractRawDataRequest zonesRequest = 75 requestBuilder(GetZonesForExtractRawDataRequest.class). 76 addFacade(facade). 77 addZone(zone). 78 toRequest(); 79 return getService().getZoneDisplayName(zonesRequest, zone); 80 } 81 82 @Override 83 public String execute() { 84 Map<String, String> zonePictures = getService().getZonePictures(); 85 zonePicture = zonePictures.get(zone); 86 return SUCCESS; 87 } 88 89 // public String getFacadeDisplayName() { 90 // WebService webService = ServiceFactory.getWebService(); 91 // String displayName = null; 92 // try { 93 //// displayName = webService.getFacades().get(facade); 94 // displayName = webService.getZoneMap().getFacades().get(facade); 95 // } catch (CoserBusinessException ex) { 96 // throw new CoserWebException("Can't get facade display name", ex); 97 // } 98 // return displayName; 99 // } 100 // 101 // public String getZoneDisplayName() { 102 // WebService webService = ServiceFactory.getWebService(); 103 // String displayName = null; 104 // try { 105 // displayName = webService.getZoneForFacade(facade, false, false).get(zone); 106 // } catch (CoserBusinessException ex) { 107 // throw new CoserWebException("Can't get zone display name", ex); 108 // } 109 // return displayName; 110 // } 111 // 112 // @Override 113 // public String execute() { 114 // 115 // WebService webService = ServiceFactory.getWebService(); 116 // 117 // try { 118 //// zonePicture = webService.getZonePictures().get(zone); 119 // zonePicture = webService.getZoneMap().getZonePictures().get(zone); 120 // } catch (CoserBusinessException ex) { 121 // throw new CoserWebException("Can't get zone picture", ex); 122 // } 123 // 124 // return SUCCESS; 125 // } 126 }