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