View Javadoc
1   /*
2    * #%L
3    * Coser :: Web
4    * %%
5    * Copyright (C) 2010 - 2011 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.pop;
23  
24  import fr.ifremer.coser.result.CoserRequest;
25  import fr.ifremer.coser.result.request.GetIndicatorsForPopulationIndicatorResultRequest;
26  import fr.ifremer.coser.result.request.GetSpeciesForPopulationIndicatorResultRequest;
27  import fr.ifremer.coser.result.request.GetZonesForPopulationIndicatorResultRequest;
28  import fr.ifremer.coser.web.actions.common.CommonIndicator;
29  
30  /**
31   * Action index, recupere la liste des resultats.
32   *
33   * @author chatellier
34   * @version $Revision$
35   *          <p/>
36   *          Last update : $Date$
37   *          By : $Author$
38   */
39  public class IndicatorAction extends CommonIndicator {
40  
41      /** serialVersionUID. */
42      private static final long serialVersionUID = 1663244944108703571L;
43  
44      protected String species;
45  
46      public String getSpecies() {
47          return species;
48      }
49  
50      public void setSpecies(String species) {
51          this.species = species;
52      }
53  
54      @Override
55      protected CoserRequest createZonesRequest() {
56          GetZonesForPopulationIndicatorResultRequest request =
57                  requestBuilder(GetZonesForPopulationIndicatorResultRequest.class).
58                          addFacade(facade).
59                          toRequest();
60          return request;
61      }
62  
63      @Override
64      protected GetIndicatorsForPopulationIndicatorResultRequest createIndicatorsRequest() {
65          GetIndicatorsForPopulationIndicatorResultRequest request =
66                  requestBuilder(GetIndicatorsForPopulationIndicatorResultRequest.class).
67                          addFacade(facade).
68                          addZone(zone).
69                          addSpecies(species).
70                          toRequest();
71          return request;
72      }
73  
74      public String getSpeciesDisplayName() {
75          GetSpeciesForPopulationIndicatorResultRequest request =
76                  requestBuilder(GetSpeciesForPopulationIndicatorResultRequest.class).
77                          addFacade(facade).
78                          addZone(zone).
79                          toRequest();
80          return getService().getSpeciesDisplayName(request, species);
81      }
82  }