9 |
benjamin |
1 |
package org.tela_botanica.del.client.utils;
|
|
|
2 |
|
|
|
3 |
import java.util.ArrayList;
|
|
|
4 |
import java.util.Date;
|
55 |
gduche |
5 |
import java.util.HashMap;
|
|
|
6 |
import java.util.Iterator;
|
270 |
gduche |
7 |
import java.util.LinkedHashMap;
|
9 |
benjamin |
8 |
import java.util.List;
|
|
|
9 |
|
14 |
benjamin |
10 |
import org.tela_botanica.del.client.exceptions.ExceptionClient;
|
141 |
aurelien |
11 |
import org.tela_botanica.del.client.modeles.Commentaire;
|
154 |
benjamin |
12 |
import org.tela_botanica.del.client.modeles.Image;
|
9 |
benjamin |
13 |
import org.tela_botanica.del.client.modeles.Observation;
|
141 |
aurelien |
14 |
import org.tela_botanica.del.client.modeles.PropositionDetermination;
|
103 |
benjamin |
15 |
import org.tela_botanica.del.client.modeles.Protocole;
|
154 |
benjamin |
16 |
import org.tela_botanica.del.client.modeles.VoteDetermination;
|
115 |
benjamin |
17 |
import org.tela_botanica.del.client.modeles.VoteProtocole;
|
282 |
benjamin |
18 |
import org.tela_botanica.del.client.services.rest.ImageService;
|
|
|
19 |
import org.tela_botanica.del.client.services.rest.ObservationService;
|
|
|
20 |
import org.tela_botanica.del.client.services.rest.PropositionDeterminationService;
|
|
|
21 |
import org.tela_botanica.del.client.services.rest.ProtocoleService;
|
|
|
22 |
import org.tela_botanica.del.client.services.rest.VoteProtocoleService;
|
9 |
benjamin |
23 |
|
282 |
benjamin |
24 |
public class MockDatasource implements ObservationService, ImageService, ProtocoleService, VoteProtocoleService, PropositionDeterminationService {
|
56 |
benjamin |
25 |
|
9 |
benjamin |
26 |
static MockDatasource instance;
|
|
|
27 |
|
|
|
28 |
List<Observation> observations = new ArrayList<Observation>();
|
|
|
29 |
|
154 |
benjamin |
30 |
List<PropositionDetermination> observationValidationDatas = new ArrayList<PropositionDetermination>();
|
48 |
benjamin |
31 |
|
282 |
benjamin |
32 |
List<String> propositionsTaxonDatas = new ArrayList<String>();
|
115 |
benjamin |
33 |
|
107 |
benjamin |
34 |
List<Protocole> protocoles = new ArrayList<Protocole>();
|
159 |
benjamin |
35 |
|
154 |
benjamin |
36 |
List<Image> images = new ArrayList<Image>();
|
135 |
gduche |
37 |
|
9 |
benjamin |
38 |
private MockDatasource() {
|
|
|
39 |
|
270 |
gduche |
40 |
HashMap<String, String> auteurObs = new LinkedHashMap<String, String>();
|
|
|
41 |
auteurObs.put("01Juliette 1MOUREAU", "Tragopogon porrifolius subsp. australis (Jord.) Nyman");
|
|
|
42 |
auteurObs.put("02Robert 2LERAS", "Iris lutescens subsp. lutescens");
|
|
|
43 |
auteurObs.put("03Geneviève 3BOTTI", "Euphorbia dendroides L.");
|
|
|
44 |
auteurObs.put("04Robert 4LERAS", "Lonicera japonica Thunb. ex Murray");
|
|
|
45 |
auteurObs.put("05Juliette 5MOUREAU", "Lavatera arborea L.");
|
|
|
46 |
auteurObs.put("06Robert 6LERAS", "Lavatera arborea L.");
|
|
|
47 |
auteurObs.put("07Juliette 7MOUREAU", "Serapias vomeracea (Burm.f.) Briq. ");
|
|
|
48 |
auteurObs.put("08Benjamin 8LIENS", "Lonicera etrusca Santi");
|
|
|
49 |
auteurObs.put("09Aurélient 9PERONNET", "Ophrys scolopax Cav. ");
|
|
|
50 |
auteurObs.put("10Grégoire 10DUCHÉ", "Staehelina dubia L. ");
|
|
|
51 |
auteurObs.put("11Juliette 11MOUREAU", "Tragopogon porrifolius subsp. australis (Jord.) Nyman");
|
|
|
52 |
auteurObs.put("12Robert 12LERAS", "Iris lutescens subsp. lutescens");
|
|
|
53 |
auteurObs.put("13Geneviève 13BOTTI", "Euphorbia dendroides L.");
|
|
|
54 |
auteurObs.put("14Robert 14LERAS", "Lonicera japonica Thunb. ex Murray");
|
|
|
55 |
auteurObs.put("15Juliette 15MOUREAU", "Lavatera arborea L.");
|
|
|
56 |
auteurObs.put("16Robert 16LERAS", "Lavatera arborea L.");
|
|
|
57 |
auteurObs.put("17Juliette 17MOUREAU", "Serapias vomeracea (Burm.f.) Briq. ");
|
|
|
58 |
auteurObs.put("18Benjamin 18LIENS", "Lonicera etrusca Santi");
|
|
|
59 |
auteurObs.put("19Aurélient 19PERONNET", "Ophrys scolopax Cav. ");
|
|
|
60 |
auteurObs.put("20Grégoire 20DUCHÉ", "Staehelina dubia L. ");
|
55 |
gduche |
61 |
|
270 |
gduche |
62 |
auteurObs.put("21Juliette 1MOUREAU", "Tragopogon porrifolius subsp. australis (Jord.) Nyman");
|
|
|
63 |
auteurObs.put("22R2obert 2LERAS", "Iris lutescens subsp. lutescens");
|
|
|
64 |
auteurObs.put("23Ge3neviève 3BOTTI", "Euphorbia dendroides L.");
|
|
|
65 |
auteurObs.put("24Rob4ert 4LERAS", "Lonicera japonica Thunb. ex Murray");
|
|
|
66 |
auteurObs.put("25Jul5iette 5MOUREAU", "Lavatera arborea L.");
|
|
|
67 |
auteurObs.put("26Rob6ert 6LERAS", "Lavatera arborea L.");
|
|
|
68 |
auteurObs.put("27J6ul7iette 7MOUREAU", "Serapias vomeracea (Burm.f.) Briq. ");
|
|
|
69 |
auteurObs.put("28Ben8jamin 8LIENS", "Lonicera etrusca Santi");
|
|
|
70 |
auteurObs.put("29Auré9lient 9PERONNET", "Ophrys scolopax Cav. ");
|
|
|
71 |
auteurObs.put("30Gég10oire 10DUCHÉ", "Staehelina dubia L. ");
|
|
|
72 |
auteurObs.put("31Julie11tte 11MOUREAU", "Tragopogon porrifolius subsp. australis (Jord.) Nyman");
|
|
|
73 |
auteurObs.put("32Rober12t 12LERAS", "Iris lutescens subsp. lutescens");
|
|
|
74 |
auteurObs.put("33Genev13iève 13BOTTI", "Euphorbia dendroides L.");
|
|
|
75 |
auteurObs.put("34Robe14rt 14LERAS", "Lonicera japonica Thunb. ex Murray");
|
|
|
76 |
auteurObs.put("35Julie15tte 15MOUREAU", "Lavatera arborea L.");
|
|
|
77 |
auteurObs.put("36Robe16rt 16LERAS", "Lavatera arborea L.");
|
|
|
78 |
auteurObs.put("37Julie17tte 17MOUREAU", "Serapias vomeracea (Burm.f.) Briq. ");
|
|
|
79 |
auteurObs.put("38Benja1m11in 18LIENS", "Lonicera etrusca Santi");
|
|
|
80 |
auteurObs.put("39Auré1111lient 19PERONNET", "Ophrys scolopax Cav. ");
|
|
|
81 |
auteurObs.put("40Gr545égoire 20DUCHÉ", "Staehelina dubia L. ");
|
282 |
benjamin |
82 |
|
61 |
benjamin |
83 |
ArrayList<String> motsClefs = new ArrayList<String>();
|
|
|
84 |
motsClefs.add("plantnet");
|
|
|
85 |
motsClefs.add("fleur");
|
|
|
86 |
motsClefs.add("fruit");
|
|
|
87 |
|
55 |
gduche |
88 |
Iterator<String> auteurs = auteurObs.keySet().iterator();
|
|
|
89 |
|
103 |
benjamin |
90 |
Protocole protocol1 = new Protocole();
|
|
|
91 |
protocol1.setNom(Protocole.ESTHETISME);
|
100 |
benjamin |
92 |
protocol1.setId(1);
|
|
|
93 |
|
103 |
benjamin |
94 |
Protocole protocol2 = new Protocole();
|
|
|
95 |
protocol2.setNom(Protocole.IDENTIFICATION_AUTOMATIQUE);
|
100 |
benjamin |
96 |
protocol2.setId(2);
|
115 |
benjamin |
97 |
|
107 |
benjamin |
98 |
protocoles.add(protocol1);
|
|
|
99 |
protocoles.add(protocol2);
|
100 |
benjamin |
100 |
|
154 |
benjamin |
101 |
VoteDetermination voteDetermination = new VoteDetermination();
|
167 |
aurelien |
102 |
voteDetermination.setVote(1);
|
154 |
benjamin |
103 |
voteDetermination.setDate(new Date());
|
|
|
104 |
voteDetermination.setContributeur("benjamin");
|
9 |
benjamin |
105 |
|
154 |
benjamin |
106 |
PropositionDetermination observationValidationData = new PropositionDetermination();
|
|
|
107 |
observationValidationData.setEspece("Iris lutescens subsp. lutescens");
|
|
|
108 |
observationValidationData.setContributeur("contributeur test");
|
|
|
109 |
observationValidationData.setId("1");
|
48 |
benjamin |
110 |
|
227 |
aurelien |
111 |
observationValidationData.ajouterVoteDetermination(voteDetermination);
|
154 |
benjamin |
112 |
observationValidationData.setDate(new Date());
|
|
|
113 |
observationValidationDatas.add(observationValidationData);
|
48 |
benjamin |
114 |
|
154 |
benjamin |
115 |
PropositionDetermination observationValidationData2 = new PropositionDetermination();
|
|
|
116 |
observationValidationData2.setContributeur("contributeur test 2");
|
|
|
117 |
observationValidationData2.setEspece("Lavatera arborea L.");
|
|
|
118 |
observationValidationData2.setId("2");
|
227 |
aurelien |
119 |
observationValidationData2.ajouterVoteDetermination(voteDetermination);
|
154 |
benjamin |
120 |
observationValidationData2.setDate(new Date());
|
|
|
121 |
observationValidationDatas.add(observationValidationData2);
|
48 |
benjamin |
122 |
|
154 |
benjamin |
123 |
PropositionDetermination observationValidationData3 = new PropositionDetermination();
|
|
|
124 |
observationValidationData3.setEspece("Acer monsp. L.");
|
|
|
125 |
observationValidationData3.setContributeur("Léo Ferré");
|
159 |
benjamin |
126 |
Commentaire commentaire = new Commentaire("Greg", new Date(), "Avec le temps...");
|
|
|
127 |
Commentaire commentaireBis = new Commentaire("Benj", new Date(), "Pas d'accord avec Greg!");
|
|
|
128 |
commentaire.getListeCommentaires().add(commentaireBis);
|
306 |
aurelien |
129 |
observationValidationData3.ajouterCommentaire(commentaire);
|
247 |
aurelien |
130 |
observationValidationData3.setId("3");
|
227 |
aurelien |
131 |
observationValidationData2.ajouterVoteDetermination(voteDetermination);
|
154 |
benjamin |
132 |
observationValidationData3.setDate(new Date());
|
|
|
133 |
observationValidationDatas.add(observationValidationData3);
|
115 |
benjamin |
134 |
|
154 |
benjamin |
135 |
PropositionDetermination observationValidationData4 = new PropositionDetermination();
|
|
|
136 |
observationValidationData4.setEspece("Acer aceras aus.");
|
|
|
137 |
observationValidationData4.setContributeur("Pierre Desproges");
|
159 |
benjamin |
138 |
Commentaire commentaire2 = new Commentaire("Greg", new Date(), "Public chéri mon amour...");
|
306 |
aurelien |
139 |
observationValidationData4.ajouterCommentaire(commentaire2);
|
247 |
aurelien |
140 |
observationValidationData4.setId("4");
|
227 |
aurelien |
141 |
observationValidationData4.ajouterVoteDetermination(voteDetermination);
|
154 |
benjamin |
142 |
observationValidationData4.setDate(new Date());
|
|
|
143 |
observationValidationDatas.add(observationValidationData4);
|
|
|
144 |
|
|
|
145 |
PropositionDetermination observationValidationData5 = new PropositionDetermination();
|
|
|
146 |
observationValidationData5.setEspece("Acer monsp subsp. monsp.");
|
|
|
147 |
observationValidationData5.setContributeur("Louis Aragon");
|
159 |
benjamin |
148 |
Commentaire commentaire3 = new Commentaire("Greg", new Date(), "Tout est affaire de décor...");
|
306 |
aurelien |
149 |
observationValidationData5.ajouterCommentaire(commentaire3);
|
247 |
aurelien |
150 |
observationValidationData5.setId("5");
|
227 |
aurelien |
151 |
observationValidationData5.ajouterVoteDetermination(voteDetermination);
|
154 |
benjamin |
152 |
observationValidationData5.setDate(new Date());
|
|
|
153 |
observationValidationDatas.add(observationValidationData5);
|
|
|
154 |
|
199 |
gduche |
155 |
int numobs = 44120;
|
224 |
aurelien |
156 |
for (int i = 0; i < 40; i++) {
|
48 |
benjamin |
157 |
|
103 |
benjamin |
158 |
Observation observation = new Observation();
|
|
|
159 |
String auteur = auteurs.next();
|
|
|
160 |
observation.setAuteur(auteur);
|
|
|
161 |
observation.setSpecies(auteurObs.get(auteur));
|
|
|
162 |
|
199 |
gduche |
163 |
numobs += i;
|
103 |
benjamin |
164 |
observation.setNumNomenclatural("num nomenclatural " + i);
|
282 |
benjamin |
165 |
observation.setDate("28/09/2011");
|
103 |
benjamin |
166 |
observation.setFamille("famille " + i);
|
|
|
167 |
observation.setLocalite("localite " + i);
|
135 |
gduche |
168 |
observation.setNomRetenu(auteurObs.get(auteur));
|
103 |
benjamin |
169 |
observation.setMotsClefs(motsClefs);
|
154 |
benjamin |
170 |
observation.setImageCelValidationDatas(observationValidationDatas);
|
103 |
benjamin |
171 |
|
154 |
benjamin |
172 |
Image image = new Image();
|
|
|
173 |
image.setIdImage("id image " + i);
|
199 |
gduche |
174 |
image.setUrlFormat("http://www.tela-botanica.org/appli:cel-img:0000" + String.valueOf(numobs) + "%s%.jpg");
|
154 |
benjamin |
175 |
image.setUrl("http://www.tela-botanica.org/appli:cel-img:0000" + String.valueOf(numobs) + "CRS.jpg");
|
199 |
gduche |
176 |
image.setMiniature("http://www.tela-botanica.org/appli:cel-img:0000" + String.valueOf(numobs) + "XS.jpg");
|
154 |
benjamin |
177 |
observation.getImages().add(image);
|
|
|
178 |
image.setObservation(observation);
|
|
|
179 |
images.add(image);
|
|
|
180 |
|
199 |
gduche |
181 |
// nombre d'images aléatoires
|
|
|
182 |
int nbImagesAssociees = (int) Math.round(Math.random() * 10);
|
|
|
183 |
for (int j = 0; j < nbImagesAssociees; j++) {
|
|
|
184 |
numobs++;
|
|
|
185 |
image = new Image();
|
|
|
186 |
image.setIdImage("id image " + i);
|
|
|
187 |
image.setUrlFormat("http://www.tela-botanica.org/appli:cel-img:0000" + String.valueOf(numobs) + "%s%.jpg");
|
|
|
188 |
image.setUrl("http://www.tela-botanica.org/appli:cel-img:0000" + String.valueOf(numobs) + "CRS.jpg");
|
|
|
189 |
image.setMiniature("http://www.tela-botanica.org/appli:cel-img:0000" + String.valueOf(numobs) + "XS.jpg");
|
|
|
190 |
observation.getImages().add(image);
|
|
|
191 |
image.setObservation(observation);
|
|
|
192 |
images.add(image);
|
|
|
193 |
}
|
|
|
194 |
|
154 |
benjamin |
195 |
VoteProtocole voteProtocole = new VoteProtocole();
|
234 |
gduche |
196 |
voteProtocole.setProtocole(protocol1);
|
159 |
benjamin |
197 |
voteProtocole.setVote(3);
|
154 |
benjamin |
198 |
voteProtocole.setContributeur("aurelien");
|
|
|
199 |
voteProtocole.setDate(new Date());
|
|
|
200 |
|
|
|
201 |
image.getVoteProtocoles().add(voteProtocole);
|
|
|
202 |
|
159 |
benjamin |
203 |
VoteProtocole voteProtocole2 = new VoteProtocole();
|
234 |
gduche |
204 |
voteProtocole2.setProtocole(protocol2);
|
159 |
benjamin |
205 |
voteProtocole2.setVote(2);
|
|
|
206 |
voteProtocole2.setContributeur("jpm");
|
|
|
207 |
voteProtocole2.setDate(new Date());
|
|
|
208 |
|
|
|
209 |
image.getVoteProtocoles().add(voteProtocole2);
|
|
|
210 |
|
103 |
benjamin |
211 |
observations.add(observation);
|
|
|
212 |
}
|
199 |
gduche |
213 |
|
180 |
benjamin |
214 |
ajouterVotesAleatoires();
|
177 |
benjamin |
215 |
|
9 |
benjamin |
216 |
}
|
199 |
gduche |
217 |
|
282 |
benjamin |
218 |
private void ajouterVotesAleatoires() {
|
167 |
aurelien |
219 |
for (PropositionDetermination validation : observationValidationDatas) {
|
199 |
gduche |
220 |
int nbVotesAjoutes = (int) Math.round(Math.random() * 20);
|
|
|
221 |
|
167 |
aurelien |
222 |
for (int i = 0; i < nbVotesAjoutes; i++) {
|
|
|
223 |
VoteDetermination vd = new VoteDetermination();
|
199 |
gduche |
224 |
vd.setVote((int) Math.round(Math.random()));
|
167 |
aurelien |
225 |
vd.setDate(new Date());
|
|
|
226 |
vd.setContributeur("test");
|
199 |
gduche |
227 |
|
167 |
aurelien |
228 |
validation.ajouterVoteDetermination(vd);
|
|
|
229 |
}
|
|
|
230 |
}
|
|
|
231 |
}
|
199 |
gduche |
232 |
|
282 |
benjamin |
233 |
/*
|
|
|
234 |
* (non-Javadoc)
|
|
|
235 |
*
|
|
|
236 |
* @see
|
|
|
237 |
* org.tela_botanica.del.client.utils.ObservationService#getObservations
|
|
|
238 |
* (java.util.HashMap)
|
|
|
239 |
*/
|
|
|
240 |
@Override
|
182 |
benjamin |
241 |
public List<Observation> getObservations(HashMap<String, String> champsRecherche) {
|
199 |
gduche |
242 |
if (champsRecherche == null) {
|
|
|
243 |
return getObservations();
|
|
|
244 |
} else {
|
|
|
245 |
int nbResultats = (int) Math.round(Math.random() * 20);
|
|
|
246 |
List<Observation> resultatRecherche = new ArrayList<Observation>();
|
|
|
247 |
for (int i = 0; i < nbResultats; i++) {
|
|
|
248 |
int numeroResultat = (int) Math.round(Math.random() * (observations.size() - 1));
|
|
|
249 |
resultatRecherche.add(observations.get(numeroResultat));
|
|
|
250 |
}
|
|
|
251 |
return resultatRecherche;
|
|
|
252 |
}
|
182 |
benjamin |
253 |
}
|
9 |
benjamin |
254 |
|
282 |
benjamin |
255 |
/*
|
|
|
256 |
* (non-Javadoc)
|
|
|
257 |
*
|
|
|
258 |
* @see
|
|
|
259 |
* org.tela_botanica.del.client.utils.ObservationService#getObservations()
|
|
|
260 |
*/
|
|
|
261 |
@Override
|
9 |
benjamin |
262 |
public List<Observation> getObservations() {
|
|
|
263 |
return observations;
|
|
|
264 |
}
|
159 |
benjamin |
265 |
|
282 |
benjamin |
266 |
/*
|
|
|
267 |
* (non-Javadoc)
|
|
|
268 |
*
|
|
|
269 |
* @see org.tela_botanica.del.client.utils.ObservationService#getImages()
|
|
|
270 |
*/
|
|
|
271 |
@Override
|
290 |
benjamin |
272 |
public List<Image> getImages(int debut, int fin) {
|
|
|
273 |
List<Image> sousListe = new ArrayList<Image>();
|
|
|
274 |
for (int i = debut; i < fin; i++) {
|
|
|
275 |
if (images.get(i) != null ) {
|
|
|
276 |
sousListe.add(images.get(i));
|
|
|
277 |
} else {
|
|
|
278 |
break;
|
|
|
279 |
}
|
|
|
280 |
}
|
154 |
benjamin |
281 |
return images;
|
|
|
282 |
}
|
9 |
benjamin |
283 |
|
282 |
benjamin |
284 |
/*
|
|
|
285 |
* (non-Javadoc)
|
|
|
286 |
*
|
|
|
287 |
* @see
|
|
|
288 |
* org.tela_botanica.del.client.utils.ObservationService#getVote(java.lang
|
|
|
289 |
* .String)
|
|
|
290 |
*/
|
|
|
291 |
@Override
|
177 |
benjamin |
292 |
public List<VoteProtocole> getVote(String idImage) {
|
|
|
293 |
for (Image image : images) {
|
|
|
294 |
if (image.getIdImage().equals(idImage)) {
|
|
|
295 |
return image.getVoteProtocoles();
|
154 |
benjamin |
296 |
}
|
177 |
benjamin |
297 |
|
154 |
benjamin |
298 |
}
|
|
|
299 |
return null;
|
9 |
benjamin |
300 |
}
|
48 |
benjamin |
301 |
|
282 |
benjamin |
302 |
/*
|
|
|
303 |
* (non-Javadoc)
|
|
|
304 |
*
|
|
|
305 |
* @see org.tela_botanica.del.client.utils.ObservationService#
|
|
|
306 |
* getVoteByImageAndProtocol(java.lang.String, java.lang.String)
|
|
|
307 |
*/
|
|
|
308 |
@Override
|
177 |
benjamin |
309 |
public List<VoteProtocole> getVoteByImageAndProtocol(String idImage, String protocolName) {
|
154 |
benjamin |
310 |
|
177 |
benjamin |
311 |
List<VoteProtocole> voteProtocolesLocal = new ArrayList<VoteProtocole>();
|
|
|
312 |
|
|
|
313 |
for (Image image : images) {
|
|
|
314 |
if (image.getIdImage().equals(idImage)) {
|
|
|
315 |
for (VoteProtocole voteProtocole : image.getVoteProtocoles()) {
|
234 |
gduche |
316 |
if (voteProtocole.getProtocole().getNom().equals(protocolName)) {
|
177 |
benjamin |
317 |
voteProtocolesLocal.add(voteProtocole);
|
154 |
benjamin |
318 |
}
|
|
|
319 |
}
|
|
|
320 |
}
|
177 |
benjamin |
321 |
|
103 |
benjamin |
322 |
}
|
177 |
benjamin |
323 |
return voteProtocolesLocal;
|
103 |
benjamin |
324 |
}
|
|
|
325 |
|
282 |
benjamin |
326 |
/*
|
|
|
327 |
* (non-Javadoc)
|
|
|
328 |
*
|
|
|
329 |
* @see
|
|
|
330 |
* org.tela_botanica.del.client.utils.ObservationService#getImagesEfloreParTaxon
|
|
|
331 |
* (java.lang.String)
|
|
|
332 |
*/
|
|
|
333 |
@Override
|
154 |
benjamin |
334 |
public List<Image> getImagesEfloreParTaxon(String nomTaxon) {
|
282 |
benjamin |
335 |
|
|
|
336 |
List<Image> imagesEflore = new ArrayList<Image>();
|
|
|
337 |
int nbResultats = (int) Math.round(Math.random() * 20);
|
|
|
338 |
for (int i = 0; i < nbResultats; i++) {
|
|
|
339 |
int numeroResultat = (int) Math.round(Math.random() * (images.size() - 1));
|
|
|
340 |
imagesEflore.add(images.get(numeroResultat));
|
|
|
341 |
}
|
|
|
342 |
return imagesEflore;
|
9 |
benjamin |
343 |
}
|
115 |
benjamin |
344 |
|
282 |
benjamin |
345 |
/*
|
|
|
346 |
* (non-Javadoc)
|
|
|
347 |
*
|
|
|
348 |
* @see
|
|
|
349 |
* org.tela_botanica.del.client.utils.ObservationService#getProtocole(java
|
|
|
350 |
* .lang.String)
|
|
|
351 |
*/
|
|
|
352 |
@Override
|
107 |
benjamin |
353 |
public Protocole getProtocole(String nomProtocole) {
|
|
|
354 |
for (Protocole protocole : protocoles) {
|
|
|
355 |
if (protocole.getNom().equals(nomProtocole)) {
|
|
|
356 |
return protocole;
|
|
|
357 |
}
|
|
|
358 |
}
|
|
|
359 |
return null;
|
|
|
360 |
}
|
159 |
benjamin |
361 |
|
282 |
benjamin |
362 |
/*
|
|
|
363 |
* (non-Javadoc)
|
|
|
364 |
*
|
|
|
365 |
* @see
|
|
|
366 |
* org.tela_botanica.del.client.utils.ObservationService#getProtocoles()
|
|
|
367 |
*/
|
|
|
368 |
@Override
|
177 |
benjamin |
369 |
public List<Protocole> getProtocoles() {
|
|
|
370 |
return protocoles;
|
|
|
371 |
}
|
|
|
372 |
|
282 |
benjamin |
373 |
/*
|
|
|
374 |
* (non-Javadoc)
|
|
|
375 |
*
|
|
|
376 |
* @see org.tela_botanica.del.client.utils.ObservationService#saveVote(org.
|
|
|
377 |
* tela_botanica.del.client.modeles.VoteProtocole)
|
|
|
378 |
*/
|
|
|
379 |
@Override
|
294 |
benjamin |
380 |
public void saveVote(String idImage, VoteProtocole voteProtocole) {
|
159 |
benjamin |
381 |
// TODO implement method
|
154 |
benjamin |
382 |
}
|
135 |
gduche |
383 |
|
282 |
benjamin |
384 |
/*
|
|
|
385 |
* (non-Javadoc)
|
|
|
386 |
*
|
|
|
387 |
* @see
|
|
|
388 |
* org.tela_botanica.del.client.utils.ObservationService#saveValidationData
|
|
|
389 |
* (org.tela_botanica.del.client.modeles.PropositionDetermination)
|
|
|
390 |
*/
|
|
|
391 |
@Override
|
294 |
benjamin |
392 |
public void saveValidationData(String idObservation, PropositionDetermination validationData) throws ExceptionClient {
|
154 |
benjamin |
393 |
observationValidationDatas.add(validationData);
|
48 |
benjamin |
394 |
}
|
|
|
395 |
|
9 |
benjamin |
396 |
public static MockDatasource getInstance() {
|
|
|
397 |
if (instance == null) {
|
|
|
398 |
instance = new MockDatasource();
|
|
|
399 |
}
|
|
|
400 |
return instance;
|
|
|
401 |
}
|
154 |
benjamin |
402 |
|
312 |
gduche |
403 |
@Override
|
|
|
404 |
public List<Image> getImagesParTaxon(String taxon, int debut, int fin) {
|
|
|
405 |
return MockDatasource.getInstance().getImages(debut, fin);
|
|
|
406 |
}
|
|
|
407 |
|
9 |
benjamin |
408 |
}
|