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>();
|
48 |
benjamin |
19 |
|
40 |
aurelien |
20 |
List<ObservationDetermination> observationDeterminationDatas = new ArrayList<ObservationDetermination>();
|
9 |
benjamin |
21 |
|
48 |
benjamin |
22 |
ArrayList<String> propositionsTaxonDatas = new ArrayList<String>();
|
|
|
23 |
|
9 |
benjamin |
24 |
private MockDatasource() {
|
|
|
25 |
|
|
|
26 |
for (int i = 0; i < 20; i++) {
|
|
|
27 |
|
|
|
28 |
Observation observation = new Observation();
|
|
|
29 |
|
|
|
30 |
observation.setAuteur("auteur " + i);
|
|
|
31 |
observation.setSpecies("espece " + i);
|
45 |
gduche |
32 |
int numobs = 44120 + i;
|
51 |
gduche |
33 |
observation.setUrl("http://www.tela-botanica.org/appli:cel-img:0000" + String.valueOf(numobs) + "CRS.jpg");
|
9 |
benjamin |
34 |
observation.setNumNomenclatural("num nomenclatural " + i);
|
|
|
35 |
observation.setIdImage("id image " + i);
|
|
|
36 |
observation.setDate(new Date().toString());
|
|
|
37 |
observation.setFamille("famille " + i);
|
|
|
38 |
observation.setLocalite("localite " + i);
|
35 |
gduche |
39 |
observation.setNomRetenu("nom retenu " + i);
|
9 |
benjamin |
40 |
|
|
|
41 |
observations.add(observation);
|
|
|
42 |
}
|
|
|
43 |
|
14 |
benjamin |
44 |
ObservationValidation observationValidationData = new ObservationValidation();
|
9 |
benjamin |
45 |
observationValidationData.setContributor("contributeur test");
|
|
|
46 |
observationValidationData.setId("1");
|
|
|
47 |
observationValidationData.setIdImage("id image 1");
|
|
|
48 |
observationValidationData.setVote(4);
|
|
|
49 |
observationValidationDatas.add(observationValidationData);
|
|
|
50 |
|
14 |
benjamin |
51 |
ObservationValidation observationValidationData2 = new ObservationValidation();
|
9 |
benjamin |
52 |
observationValidationData2.setContributor("contributeur test 2");
|
|
|
53 |
observationValidationData2.setId("2");
|
|
|
54 |
observationValidationData2.setIdImage("id image 1");
|
|
|
55 |
observationValidationData2.setVote(2);
|
|
|
56 |
observationValidationDatas.add(observationValidationData2);
|
48 |
benjamin |
57 |
|
40 |
aurelien |
58 |
ObservationDetermination observationDeterminationData1 = new ObservationDetermination();
|
47 |
aurelien |
59 |
observationDeterminationData1.setEspece("Acer monsp. L.");
|
40 |
aurelien |
60 |
observationDeterminationData1.setContributeur("Léo Ferré");
|
|
|
61 |
observationDeterminationData1.setCommentaire("Avec le temps...");
|
|
|
62 |
observationDeterminationData1.setId("1");
|
|
|
63 |
observationDeterminationData1.setIdImage("id image 1");
|
|
|
64 |
observationDeterminationData1.setPourcentageConfiance(90);
|
|
|
65 |
observationDeterminationData1.setDateCommentaire("12/01/2011");
|
|
|
66 |
observationDeterminationDatas.add(observationDeterminationData1);
|
48 |
benjamin |
67 |
|
40 |
aurelien |
68 |
ObservationDetermination observationDeterminationData2 = new ObservationDetermination();
|
47 |
aurelien |
69 |
observationDeterminationData2.setEspece("Acer aceras aus.");
|
40 |
aurelien |
70 |
observationDeterminationData2.setContributeur("Pierre Desproges");
|
|
|
71 |
observationDeterminationData2.setCommentaire("Public chéri mon amour !");
|
|
|
72 |
observationDeterminationData2.setId("2");
|
|
|
73 |
observationDeterminationData2.setIdImage("id image 1");
|
|
|
74 |
observationDeterminationData2.setPourcentageConfiance(30);
|
|
|
75 |
observationDeterminationData2.setDateCommentaire("05/09/2011");
|
|
|
76 |
observationDeterminationDatas.add(observationDeterminationData2);
|
48 |
benjamin |
77 |
|
40 |
aurelien |
78 |
ObservationDetermination observationDeterminationData3 = new ObservationDetermination();
|
47 |
aurelien |
79 |
observationDeterminationData3.setEspece("Acer monsp subsp. monsp.");
|
40 |
aurelien |
80 |
observationDeterminationData3.setContributeur("Louis Aragon");
|
|
|
81 |
observationDeterminationData3.setCommentaire("Tout est affaire de décor");
|
|
|
82 |
observationDeterminationData3.setId("2");
|
|
|
83 |
observationDeterminationData3.setIdImage("id image 1");
|
|
|
84 |
observationDeterminationData3.setPourcentageConfiance(50);
|
|
|
85 |
observationDeterminationData3.setDateCommentaire("14/08/2011");
|
|
|
86 |
observationDeterminationDatas.add(observationDeterminationData3);
|
48 |
benjamin |
87 |
|
47 |
aurelien |
88 |
propositionsTaxonDatas.add("Acer monsp. L.");
|
|
|
89 |
propositionsTaxonDatas.add("Acer aceras aus.");
|
|
|
90 |
propositionsTaxonDatas.add("Acer monsp subsp. monsp.");
|
|
|
91 |
propositionsTaxonDatas.add("Acer australis L.");
|
9 |
benjamin |
92 |
}
|
|
|
93 |
|
|
|
94 |
public List<Observation> getObservations() {
|
40 |
aurelien |
95 |
|
9 |
benjamin |
96 |
return observations;
|
|
|
97 |
}
|
|
|
98 |
|
14 |
benjamin |
99 |
public List<ObservationValidation> getValidationData(String idImage) {
|
9 |
benjamin |
100 |
|
|
|
101 |
return observationValidationDatas;
|
|
|
102 |
}
|
48 |
benjamin |
103 |
|
40 |
aurelien |
104 |
public List<ObservationDetermination> getDeterminationData(String idImage) {
|
9 |
benjamin |
105 |
|
40 |
aurelien |
106 |
return observationDeterminationDatas;
|
|
|
107 |
}
|
48 |
benjamin |
108 |
|
47 |
aurelien |
109 |
public ArrayList<String> getPropositionsTaxonsData(String idImage) {
|
9 |
benjamin |
110 |
|
47 |
aurelien |
111 |
return propositionsTaxonDatas;
|
|
|
112 |
}
|
|
|
113 |
|
48 |
benjamin |
114 |
public Observation getObservationCourante() {
|
|
|
115 |
return observations.get(0);
|
|
|
116 |
}
|
40 |
aurelien |
117 |
|
48 |
benjamin |
118 |
public List<Observation> getObservationsEfloreParTaxon(String nomTaxon) {
|
|
|
119 |
return observations;
|
9 |
benjamin |
120 |
}
|
|
|
121 |
|
48 |
benjamin |
122 |
public void saveValidationData(ObservationValidation validationData) throws ExceptionClient {
|
|
|
123 |
|
|
|
124 |
}
|
|
|
125 |
|
9 |
benjamin |
126 |
public static MockDatasource getInstance() {
|
|
|
127 |
if (instance == null) {
|
|
|
128 |
instance = new MockDatasource();
|
|
|
129 |
}
|
|
|
130 |
return instance;
|
|
|
131 |
}
|
|
|
132 |
|
|
|
133 |
}
|