1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 package fr.ifremer.coser.web.actions.pop;
23
24 import fr.ifremer.coser.result.request.GetSpeciesForPopulationIndicatorResultRequest;
25 import fr.ifremer.coser.result.request.GetZonesForPopulationIndicatorResultRequest;
26 import fr.ifremer.coser.web.actions.common.AbstractCoserJspAction;
27 import org.apache.commons.logging.Log;
28 import org.apache.commons.logging.LogFactory;
29
30 import java.util.Map;
31
32
33
34
35
36
37
38
39
40
41 public class SpeciesAction extends AbstractCoserJspAction {
42
43
44 private static final long serialVersionUID = 1663244944108703571L;
45
46 private static final Log log = LogFactory.getLog(SpeciesAction.class);
47
48 protected String facade;
49
50 protected String zone;
51
52 protected Map<String, String> species;
53
54 protected String zonePicture;
55
56 public String getFacade() {
57 return facade;
58 }
59
60 public void setFacade(String facade) {
61 this.facade = facade;
62 }
63
64 public String getZone() {
65 return zone;
66 }
67
68 public void setZone(String zone) {
69 this.zone = zone;
70 }
71
72 public Map<String, String> getSpecies() {
73 return species;
74 }
75
76 public String getZonePicture() {
77 return zonePicture;
78 }
79
80 public String getFacadeDisplayName() {
81 return getService().getFacadeDisplayName(facade);
82 }
83
84 public String getZoneDisplayName() {
85 GetZonesForPopulationIndicatorResultRequest request =
86 requestBuilder(GetZonesForPopulationIndicatorResultRequest.class).
87 addFacade(facade).
88 toRequest();
89 return getService().getZoneDisplayName(request, zone);
90 }
91
92 @Override
93 public String execute() {
94
95 if (log.isInfoEnabled()) {
96 log.info("Looking for species for zone " + zone);
97 }
98
99 GetSpeciesForPopulationIndicatorResultRequest request =
100 requestBuilder(GetSpeciesForPopulationIndicatorResultRequest.class).
101 addFacade(facade).
102 addZone(zone).
103 toRequest();
104 species = getService().toMap(request);
105
106 if (log.isDebugEnabled()) {
107 log.debug("Species are : " + species);
108 }
109
110 zonePicture = getService().getZonePictures().get(zone);
111
112 return SUCCESS;
113 }
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160 }