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.result.FileResult;
25 import fr.ifremer.coser.result.request.GetPopulationIndicatorResultGraphRequest;
26 import fr.ifremer.coser.web.actions.common.AbstractCoserJspAction;
27 import org.apache.struts2.convention.annotation.Action;
28 import org.apache.struts2.convention.annotation.Result;
29
30 import java.io.InputStream;
31
32
33
34
35
36
37
38
39
40
41
42
43 public class GraphDataAction extends AbstractCoserJspAction {
44
45
46 private static final long serialVersionUID = 3385467755357775199L;
47
48 protected String facade;
49
50 protected String zone;
51
52 protected String species;
53
54 protected String indicator;
55
56 protected String chartUrl;
57
58 protected FileResult result;
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 String getSpecies() {
73 return species;
74 }
75
76 public void setSpecies(String species) {
77 this.species = species;
78 }
79
80 public String getIndicator() {
81 return indicator;
82 }
83
84 public void setIndicator(String indicator) {
85 this.indicator = indicator;
86 }
87
88 public String getSource() {
89 return result.getSource();
90 }
91
92 @Action(results = {@Result(type = "stream", params = {"contentType", "image/png"})})
93 public String execute() {
94 GetPopulationIndicatorResultGraphRequest request =
95 requestBuilder(GetPopulationIndicatorResultGraphRequest.class).
96 addFacade(facade).
97 addZone(zone).
98 addSpecies(species).
99 addIndicator(indicator).
100 toRequest();
101 result = getService().toFileResult(request);
102 return SUCCESS;
103 }
104
105 public InputStream getInputStream() {
106 InputStream input = result.getInputStream();
107 return input;
108 }
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127 }