View Javadoc
1   /*
2    * #%L
3    * Coser :: Web
4    * %%
5    * Copyright (C) 2010 - 2012 Ifremer, Codelutin, Chatellier Eric, Chemit Tony
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.common;
23  
24  import fr.ifremer.coser.result.CoserRequest;
25  
26  import java.util.Map;
27  
28  /**
29   * Affiche la liste des sous zones (zone) et leurs liste des cartes
30   * et commentaires associƩs.
31   *
32   * @author chatellier
33   * @version $Revision$
34   *          <p/>
35   *          Last update : $Date$
36   *          By : $Author$
37   */
38  public abstract class CommonZone extends AbstractCoserJspAction {
39  
40      /** serialVersionUID. */
41      private static final long serialVersionUID = 3385467755357775199L;
42  
43      protected String facade;
44  
45      protected Map<String, String> zones;
46  
47      protected Map<String, String> zonesPictures;
48  
49      protected Map<String, String> zonesMetaInfo;
50  
51      /**
52       *
53       * @return the request to get zones
54       */
55      protected abstract CoserRequest createZonesRequest();
56  
57      public String getFacade() {
58          return facade;
59      }
60  
61      public void setFacade(String facade) {
62          this.facade = facade;
63      }
64  
65      public Map<String, String> getZones() {
66          return zones;
67      }
68  
69      public Map<String, String> getZonesPictures() {
70          return zonesPictures;
71      }
72  
73      public Map<String, String> getZonesMetaInfo() {
74          return zonesMetaInfo;
75      }
76  
77      public String getFacadeDisplayName() {
78          return getService().getFacadeDisplayName(facade);
79      }
80  
81      @Override
82      public String execute() {
83  
84          CoserRequest request = createZonesRequest();
85          zones = getService().toMap(request);
86          zonesPictures = getService().getZonePictures();
87          zonesMetaInfo = getService().getZoneMetaInfo(getLocale());
88  
89          return SUCCESS;
90      }
91  
92  //    public String getFacadeDisplayName() {
93  //        WebService webService = ServiceFactory.getWebService();
94  //        String displayName = null;
95  //        try {
96  //            displayName = webService.getFacades().get(facade);
97  //        } catch (CoserBusinessException ex) {
98  //            throw new CoserWebException("Can't get species display name", ex);
99  //        }
100 //        return displayName;
101 //    }
102 //
103 //    @Override
104 //    public String execute() {
105 //
106 //        WebService webService = ServiceFactory.getWebService();
107 //
108 //        Locale locale = getLocale();
109 //
110 //        try {
111 //            // renvoi la liste des id subzone-survey et leurs label associƩ
112 //            zones = webService.getZoneForFacade(facade, false, false);
113 //            zonesPictures = webService.getZonePictures();
114 //            zonesMetaInfo = webService.getZoneMetaInfo(locale);
115 //        } catch (CoserBusinessException ex) {
116 //            throw new CoserWebException("Can't get zone map", ex);
117 //        }
118 //
119 //        return SUCCESS;
120 //    }
121 }