Line 9... |
Line 9... |
9 |
|
9 |
|
10 |
import org.tela_botanica.del.client.exceptions.ExceptionClient;
|
10 |
import org.tela_botanica.del.client.exceptions.ExceptionClient;
|
11 |
import org.tela_botanica.del.client.modeles.Commentaire;
|
11 |
import org.tela_botanica.del.client.modeles.Commentaire;
|
12 |
import org.tela_botanica.del.client.modeles.Image;
|
12 |
import org.tela_botanica.del.client.modeles.Image;
|
- |
|
13 |
import org.tela_botanica.del.client.modeles.InformationsRecherche;
|
13 |
import org.tela_botanica.del.client.modeles.InformationsRecherche;
|
14 |
import org.tela_botanica.del.client.modeles.InterventionForum;
|
14 |
import org.tela_botanica.del.client.modeles.Observation;
|
- |
|
15 |
import org.tela_botanica.del.client.modeles.ObservationServiceResultat;
|
15 |
import org.tela_botanica.del.client.modeles.Observation;
|
16 |
import org.tela_botanica.del.client.modeles.PropositionDetermination;
|
16 |
import org.tela_botanica.del.client.modeles.PropositionDetermination;
|
17 |
import org.tela_botanica.del.client.modeles.Protocole;
|
17 |
import org.tela_botanica.del.client.modeles.Protocole;
|
18 |
import org.tela_botanica.del.client.modeles.VoteDetermination;
|
18 |
import org.tela_botanica.del.client.modeles.VoteDetermination;
|
19 |
import org.tela_botanica.del.client.modeles.VoteProtocole;
|
19 |
import org.tela_botanica.del.client.modeles.VoteProtocole;
|
Line 29... |
Line 29... |
29 |
|
29 |
|
Line 30... |
Line 30... |
30 |
static MockDatasource instance;
|
30 |
static MockDatasource instance;
|
Line 31... |
Line 31... |
31 |
|
31 |
|
Line 32... |
Line 32... |
32 |
List<Observation> observations = new ArrayList<Observation>();
|
32 |
List<Observation> observations = new ArrayList<Observation>();
|
Line 33... |
Line 33... |
33 |
|
33 |
|
Line 107... |
Line 107... |
107 |
voteDetermination.setDate(new Date());
|
107 |
voteDetermination.setDate(new Date());
|
108 |
voteDetermination.setContributeur("benjamin");
|
108 |
voteDetermination.setContributeur("benjamin");
|
Line 109... |
Line 109... |
109 |
|
109 |
|
110 |
PropositionDetermination observationValidationData = new PropositionDetermination();
|
110 |
PropositionDetermination observationValidationData = new PropositionDetermination();
|
111 |
observationValidationData.setEspece("Iris lutescens subsp. lutescens");
|
111 |
observationValidationData.setEspece("Iris lutescens subsp. lutescens");
|
112 |
observationValidationData.setContributeur("contributeur test");
|
112 |
observationValidationData.setAuteur("contributeur test");
|
Line 113... |
Line 113... |
113 |
observationValidationData.setId("1");
|
113 |
observationValidationData.setId("1");
|
114 |
|
114 |
|
115 |
observationValidationData.ajouterVoteDetermination(voteDetermination);
|
115 |
observationValidationData.ajouterVoteDetermination(voteDetermination);
|
Line 116... |
Line 116... |
116 |
observationValidationData.setDate(new Date());
|
116 |
observationValidationData.setDate(new Date());
|
117 |
observationValidationDatas.add(observationValidationData);
|
117 |
observationValidationDatas.add(observationValidationData);
|
118 |
|
118 |
|
119 |
PropositionDetermination observationValidationData2 = new PropositionDetermination();
|
119 |
PropositionDetermination observationValidationData2 = new PropositionDetermination();
|
120 |
observationValidationData2.setContributeur("contributeur test 2");
|
120 |
observationValidationData2.setAuteur("contributeur test 2");
|
121 |
observationValidationData2.setEspece("Lavatera arborea L.");
|
121 |
observationValidationData2.setEspece("Lavatera arborea L.");
|
122 |
observationValidationData2.setId("2");
|
122 |
observationValidationData2.setId("2");
|
Line 123... |
Line 123... |
123 |
observationValidationData2.ajouterVoteDetermination(voteDetermination);
|
123 |
observationValidationData2.ajouterVoteDetermination(voteDetermination);
|
124 |
observationValidationData2.setDate(new Date());
|
124 |
observationValidationData2.setDate(new Date());
|
125 |
observationValidationDatas.add(observationValidationData2);
|
125 |
observationValidationDatas.add(observationValidationData2);
|
126 |
|
126 |
|
127 |
PropositionDetermination observationValidationData3 = new PropositionDetermination();
|
127 |
PropositionDetermination observationValidationData3 = new PropositionDetermination();
|
128 |
observationValidationData3.setEspece("Acer monsp. L.");
|
128 |
observationValidationData3.setEspece("Acer monsp. L.");
|
129 |
observationValidationData3.setContributeur("Léo Ferré");
|
129 |
observationValidationData3.setAuteur("Léo Ferré");
|
130 |
Commentaire commentaire = new Commentaire("Greg", new Date(), "Avec le temps...");
|
130 |
Commentaire commentaire = new Commentaire("Greg", new Date(), "Avec le temps...");
|
Line 136... |
Line 136... |
136 |
observationValidationData3.setDate(new Date());
|
136 |
observationValidationData3.setDate(new Date());
|
137 |
observationValidationDatas.add(observationValidationData3);
|
137 |
observationValidationDatas.add(observationValidationData3);
|
Line 138... |
Line 138... |
138 |
|
138 |
|
139 |
PropositionDetermination observationValidationData4 = new PropositionDetermination();
|
139 |
PropositionDetermination observationValidationData4 = new PropositionDetermination();
|
140 |
observationValidationData4.setEspece("Acer aceras aus.");
|
140 |
observationValidationData4.setEspece("Acer aceras aus.");
|
141 |
observationValidationData4.setContributeur("Pierre Desproges");
|
141 |
observationValidationData4.setAuteur("Pierre Desproges");
|
142 |
Commentaire commentaire2 = new Commentaire("Greg", new Date(), "Public chéri mon amour...");
|
142 |
Commentaire commentaire2 = new Commentaire("Greg", new Date(), "Public chéri mon amour...");
|
143 |
observationValidationData4.ajouterCommentaire(commentaire2);
|
143 |
observationValidationData4.ajouterCommentaire(commentaire2);
|
144 |
observationValidationData4.setId("4");
|
144 |
observationValidationData4.setId("4");
|
145 |
observationValidationData4.ajouterVoteDetermination(voteDetermination);
|
145 |
observationValidationData4.ajouterVoteDetermination(voteDetermination);
|
146 |
observationValidationData4.setDate(new Date());
|
146 |
observationValidationData4.setDate(new Date());
|
Line 147... |
Line 147... |
147 |
observationValidationDatas.add(observationValidationData4);
|
147 |
observationValidationDatas.add(observationValidationData4);
|
148 |
|
148 |
|
149 |
PropositionDetermination observationValidationData5 = new PropositionDetermination();
|
149 |
PropositionDetermination observationValidationData5 = new PropositionDetermination();
|
150 |
observationValidationData5.setEspece("Acer monsp subsp. monsp.");
|
150 |
observationValidationData5.setEspece("Acer monsp subsp. monsp.");
|
151 |
observationValidationData5.setContributeur("Louis Aragon");
|
151 |
observationValidationData5.setAuteur("Louis Aragon");
|
152 |
Commentaire commentaire3 = new Commentaire("Greg", new Date(), "Tout est affaire de décor...");
|
152 |
Commentaire commentaire3 = new Commentaire("Greg", new Date(), "Tout est affaire de décor...");
|
153 |
observationValidationData5.ajouterCommentaire(commentaire3);
|
153 |
observationValidationData5.ajouterCommentaire(commentaire3);
|
154 |
observationValidationData5.setId("5");
|
154 |
observationValidationData5.setId("5");
|
Line 169... |
Line 169... |
169 |
observation.setDateReleve("28/09/2011");
|
169 |
observation.setDateReleve("28/09/2011");
|
170 |
observation.setFamille("famille " + i);
|
170 |
observation.setFamille("famille " + i);
|
171 |
observation.setLocalite("localite " + i);
|
171 |
observation.setLocalite("localite " + i);
|
172 |
observation.setNomRetenu(auteurObs.get(auteur));
|
172 |
observation.setNomRetenu(auteurObs.get(auteur));
|
173 |
observation.setMotsClefs(motsClefs);
|
173 |
observation.setMotsClefs(motsClefs);
|
174 |
observation.setImageCelValidationDatas(observationValidationDatas);
|
174 |
observation.setInterventionsForum(observationValidationDatas);
|
Line 175... |
Line 175... |
175 |
|
175 |
|
176 |
Image image = new Image();
|
176 |
Image image = new Image();
|
177 |
image.setIdImage("id image " + i);
|
177 |
image.setIdImage("id image " + i);
|
178 |
image.setUrlFormat("http://www.tela-botanica.org/appli:cel-img:0000" + String.valueOf(numobs) + "%s%.jpg");
|
178 |
image.setUrlFormat("http://www.tela-botanica.org/appli:cel-img:0000" + String.valueOf(numobs) + "%s%.jpg");
|
Line 200... |
Line 200... |
200 |
voteProtocole.setProtocole(protocol1);
|
200 |
voteProtocole.setProtocole(protocol1);
|
201 |
voteProtocole.setVote(3);
|
201 |
voteProtocole.setVote(3);
|
202 |
voteProtocole.setContributeur("aurelien");
|
202 |
voteProtocole.setContributeur("aurelien");
|
203 |
voteProtocole.setDate(new Date());
|
203 |
voteProtocole.setDate(new Date());
|
Line 204... |
Line 204... |
204 |
|
204 |
|
Line 205... |
Line 205... |
205 |
//image.getVoteProtocoles().add(voteProtocole);
|
205 |
// image.getVoteProtocoles().add(voteProtocole);
|
206 |
|
206 |
|
207 |
VoteProtocole voteProtocole2 = new VoteProtocole();
|
207 |
VoteProtocole voteProtocole2 = new VoteProtocole();
|
208 |
voteProtocole2.setProtocole(protocol2);
|
208 |
voteProtocole2.setProtocole(protocol2);
|
209 |
voteProtocole2.setVote(2);
|
209 |
voteProtocole2.setVote(2);
|
Line 210... |
Line 210... |
210 |
voteProtocole2.setContributeur("jpm");
|
210 |
voteProtocole2.setContributeur("jpm");
|
Line 211... |
Line 211... |
211 |
voteProtocole2.setDate(new Date());
|
211 |
voteProtocole2.setDate(new Date());
|
212 |
|
212 |
|
Line 213... |
Line 213... |
213 |
//image.getVoteProtocoles().add(voteProtocole2);
|
213 |
// image.getVoteProtocoles().add(voteProtocole2);
|
Line 214... |
Line 214... |
214 |
|
214 |
|
Line 215... |
Line 215... |
215 |
observations.add(observation);
|
215 |
observations.add(observation);
|
216 |
}
|
216 |
}
|
217 |
|
- |
|
Line 218... |
Line -... |
218 |
ajouterVotesAleatoires();
|
- |
|
219 |
|
217 |
|
220 |
}
|
218 |
ajouterVotesAleatoires();
|
221 |
|
- |
|
222 |
private void ajouterVotesAleatoires() {
|
- |
|
Line -... |
Line 219... |
- |
|
219 |
|
223 |
for (PropositionDetermination validation : observationValidationDatas) {
|
220 |
}
|
- |
|
221 |
|
- |
|
222 |
private void ajouterVotesAleatoires() {
|
- |
|
223 |
for (InterventionForum validation : observationValidationDatas) {
|
- |
|
224 |
|
- |
|
225 |
if (validation instanceof PropositionDetermination) {
|
- |
|
226 |
int nbVotesAjoutes = (int) Math.round(Math.random() * 20);
|
224 |
int nbVotesAjoutes = (int) Math.round(Math.random() * 20);
|
227 |
|
225 |
|
228 |
for (int i = 0; i < nbVotesAjoutes; i++) {
|
226 |
for (int i = 0; i < nbVotesAjoutes; i++) {
|
229 |
VoteDetermination vd = new VoteDetermination();
|
Line 227... |
Line 230... |
227 |
VoteDetermination vd = new VoteDetermination();
|
230 |
vd.setVote((int) Math.round(Math.random()));
|
Line 273... |
Line 276... |
273 |
@Override
|
276 |
@Override
|
274 |
public List<VoteProtocole> getVote(String idImage) {
|
277 |
public List<VoteProtocole> getVote(String idImage) {
|
275 |
for (Image image : images) {
|
278 |
for (Image image : images) {
|
276 |
if (image.getIdImage().equals(idImage)) {
|
279 |
if (image.getIdImage().equals(idImage)) {
|
277 |
return null;
|
280 |
return null;
|
278 |
//return image.getVoteProtocoles();
|
281 |
// return image.getVoteProtocoles();
|
279 |
}
|
282 |
}
|
Line 280... |
Line 283... |
280 |
|
283 |
|
281 |
}
|
284 |
}
|
282 |
return new ArrayList<VoteProtocole>(0);
|
285 |
return new ArrayList<VoteProtocole>(0);
|
Line 302... |
Line 305... |
302 |
// }
|
305 |
// }
|
303 |
// }
|
306 |
// }
|
304 |
//
|
307 |
//
|
305 |
// }
|
308 |
// }
|
Line 306... |
Line -... |
306 |
|
- |
|
307 |
|
309 |
|
308 |
int rand = (int) (Math.random() * 5);
|
310 |
int rand = (int) (Math.random() * 5);
|
309 |
for (int i = 0; i < rand; i++) {
|
311 |
for (int i = 0; i < rand; i++) {
|
310 |
VoteProtocole voteProtocole = new VoteProtocole();
|
312 |
VoteProtocole voteProtocole = new VoteProtocole();
|
311 |
voteProtocole.setProtocole(protocoles.get(0));
|
313 |
voteProtocole.setProtocole(protocoles.get(0));
|
Line 320... |
Line 322... |
320 |
voteProtocole2.setDate(new Date());
|
322 |
voteProtocole2.setDate(new Date());
|
Line 321... |
Line 323... |
321 |
|
323 |
|
322 |
voteProtocolesLocal.add(voteProtocole);
|
324 |
voteProtocolesLocal.add(voteProtocole);
|
323 |
voteProtocolesLocal.add(voteProtocole2);
|
325 |
voteProtocolesLocal.add(voteProtocole2);
|
324 |
}
|
326 |
}
|
325 |
return voteProtocolesLocal;
|
327 |
return voteProtocolesLocal;
|
Line 326... |
Line 328... |
326 |
}
|
328 |
}
|
327 |
|
329 |
|
328 |
/*
|
330 |
/*
|
Line 401... |
Line 403... |
401 |
}
|
403 |
}
|
Line 402... |
Line 404... |
402 |
|
404 |
|
403 |
@Override
|
405 |
@Override
|
404 |
public void getImagesParObservation(String observationId, ImagesParTaxonCallback callback) {
|
406 |
public void getImagesParObservation(String observationId, ImagesParTaxonCallback callback) {
|
405 |
// TODO Auto-generated method stub
|
407 |
// TODO Auto-generated method stub
|
406 |
|
408 |
|
Line 407... |
Line 409... |
407 |
}
|
409 |
}
|