9 |
benjamin |
1 |
package org.tela_botanica.del.client.utils;
|
|
|
2 |
|
|
|
3 |
import java.util.ArrayList;
|
|
|
4 |
import java.util.Date;
|
|
|
5 |
import java.util.List;
|
|
|
6 |
|
14 |
benjamin |
7 |
import org.tela_botanica.del.client.exceptions.ExceptionClient;
|
9 |
benjamin |
8 |
import org.tela_botanica.del.client.modeles.Observation;
|
40 |
aurelien |
9 |
import org.tela_botanica.del.client.modeles.ObservationDetermination;
|
14 |
benjamin |
10 |
import org.tela_botanica.del.client.modeles.ObservationValidation;
|
9 |
benjamin |
11 |
|
|
|
12 |
public class MockDatasource {
|
|
|
13 |
|
|
|
14 |
static MockDatasource instance;
|
|
|
15 |
|
|
|
16 |
List<Observation> observations = new ArrayList<Observation>();
|
|
|
17 |
|
14 |
benjamin |
18 |
List<ObservationValidation> observationValidationDatas = new ArrayList<ObservationValidation>();
|
40 |
aurelien |
19 |
|
|
|
20 |
List<ObservationDetermination> observationDeterminationDatas = new ArrayList<ObservationDetermination>();
|
9 |
benjamin |
21 |
|
|
|
22 |
private MockDatasource() {
|
|
|
23 |
|
|
|
24 |
for (int i = 0; i < 20; i++) {
|
|
|
25 |
|
|
|
26 |
Observation observation = new Observation();
|
|
|
27 |
|
|
|
28 |
observation.setAuteur("auteur " + i);
|
|
|
29 |
observation.setSpecies("espece " + i);
|
40 |
aurelien |
30 |
observation
|
|
|
31 |
.setUrl("http://www.tela-botanica.org/appli:cel-img:000044120CRX2S.jpg");
|
9 |
benjamin |
32 |
observation.setNumNomenclatural("num nomenclatural " + i);
|
|
|
33 |
observation.setIdImage("id image " + i);
|
|
|
34 |
observation.setDate(new Date().toString());
|
|
|
35 |
observation.setFamille("famille " + i);
|
|
|
36 |
observation.setLocalite("localite " + i);
|
35 |
gduche |
37 |
observation.setNomRetenu("nom retenu " + i);
|
9 |
benjamin |
38 |
|
|
|
39 |
observations.add(observation);
|
|
|
40 |
}
|
|
|
41 |
|
14 |
benjamin |
42 |
ObservationValidation observationValidationData = new ObservationValidation();
|
9 |
benjamin |
43 |
observationValidationData.setContributor("contributeur test");
|
|
|
44 |
observationValidationData.setId("1");
|
|
|
45 |
observationValidationData.setIdImage("id image 1");
|
|
|
46 |
observationValidationData.setVote(4);
|
|
|
47 |
observationValidationDatas.add(observationValidationData);
|
|
|
48 |
|
14 |
benjamin |
49 |
ObservationValidation observationValidationData2 = new ObservationValidation();
|
9 |
benjamin |
50 |
observationValidationData2.setContributor("contributeur test 2");
|
|
|
51 |
observationValidationData2.setId("2");
|
|
|
52 |
observationValidationData2.setIdImage("id image 1");
|
|
|
53 |
observationValidationData2.setVote(2);
|
|
|
54 |
observationValidationDatas.add(observationValidationData2);
|
40 |
aurelien |
55 |
|
|
|
56 |
ObservationDetermination observationDeterminationData1 = new ObservationDetermination();
|
|
|
57 |
observationDeterminationData1.setContributeur("Léo Ferré");
|
|
|
58 |
observationDeterminationData1.setCommentaire("Avec le temps...");
|
|
|
59 |
observationDeterminationData1.setId("1");
|
|
|
60 |
observationDeterminationData1.setIdImage("id image 1");
|
|
|
61 |
observationDeterminationData1.setPourcentageConfiance(90);
|
|
|
62 |
observationDeterminationData1.setDateCommentaire("12/01/2011");
|
|
|
63 |
observationDeterminationDatas.add(observationDeterminationData1);
|
|
|
64 |
|
|
|
65 |
ObservationDetermination observationDeterminationData2 = new ObservationDetermination();
|
|
|
66 |
observationDeterminationData2.setContributeur("Pierre Desproges");
|
|
|
67 |
observationDeterminationData2.setCommentaire("Public chéri mon amour !");
|
|
|
68 |
observationDeterminationData2.setId("2");
|
|
|
69 |
observationDeterminationData2.setIdImage("id image 1");
|
|
|
70 |
observationDeterminationData2.setPourcentageConfiance(30);
|
|
|
71 |
observationDeterminationData2.setDateCommentaire("05/09/2011");
|
|
|
72 |
observationDeterminationDatas.add(observationDeterminationData2);
|
|
|
73 |
|
|
|
74 |
ObservationDetermination observationDeterminationData3 = new ObservationDetermination();
|
|
|
75 |
observationDeterminationData3.setContributeur("Louis Aragon");
|
|
|
76 |
observationDeterminationData3.setCommentaire("Tout est affaire de décor");
|
|
|
77 |
observationDeterminationData3.setId("2");
|
|
|
78 |
observationDeterminationData3.setIdImage("id image 1");
|
|
|
79 |
observationDeterminationData3.setPourcentageConfiance(50);
|
|
|
80 |
observationDeterminationData3.setDateCommentaire("14/08/2011");
|
|
|
81 |
observationDeterminationDatas.add(observationDeterminationData3);
|
9 |
benjamin |
82 |
}
|
|
|
83 |
|
|
|
84 |
public List<Observation> getObservations() {
|
40 |
aurelien |
85 |
|
9 |
benjamin |
86 |
return observations;
|
|
|
87 |
}
|
|
|
88 |
|
14 |
benjamin |
89 |
public List<ObservationValidation> getValidationData(String idImage) {
|
9 |
benjamin |
90 |
|
|
|
91 |
return observationValidationDatas;
|
|
|
92 |
}
|
40 |
aurelien |
93 |
|
|
|
94 |
public List<ObservationDetermination> getDeterminationData(String idImage) {
|
9 |
benjamin |
95 |
|
40 |
aurelien |
96 |
return observationDeterminationDatas;
|
|
|
97 |
}
|
9 |
benjamin |
98 |
|
40 |
aurelien |
99 |
public void saveValidationData(ObservationValidation validationData)
|
|
|
100 |
throws ExceptionClient {
|
|
|
101 |
|
9 |
benjamin |
102 |
}
|
|
|
103 |
|
|
|
104 |
public static MockDatasource getInstance() {
|
|
|
105 |
if (instance == null) {
|
|
|
106 |
instance = new MockDatasource();
|
|
|
107 |
}
|
|
|
108 |
return instance;
|
|
|
109 |
}
|
|
|
110 |
|
|
|
111 |
}
|