Rev 48 | Blame | Last modification | View Log | RSS feed
package org.tela_botanica.del.client.utils;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.tela_botanica.del.client.exceptions.ExceptionClient;
import org.tela_botanica.del.client.modeles.Observation;
import org.tela_botanica.del.client.modeles.ObservationDetermination;
import org.tela_botanica.del.client.modeles.ObservationValidation;
public class MockDatasource {
static MockDatasource instance;
List<Observation> observations = new ArrayList<Observation>();
List<ObservationValidation> observationValidationDatas = new ArrayList<ObservationValidation>();
List<ObservationDetermination> observationDeterminationDatas = new ArrayList<ObservationDetermination>();
ArrayList<String> propositionsTaxonDatas = new ArrayList<String>();
private MockDatasource() {
for (int i = 0; i < 20; i++) {
Observation observation = new Observation();
observation.setAuteur("auteur " + i);
observation.setSpecies("espece " + i);
int numobs = 44120 + i;
observation.setUrl("http://www.tela-botanica.org/appli:cel-img:0000" + String.valueOf(numobs) + "CRS.jpg");
observation.setNumNomenclatural("num nomenclatural " + i);
observation.setIdImage("id image " + i);
observation.setDate(new Date().toString());
observation.setFamille("famille " + i);
observation.setLocalite("localite " + i);
observation.setNomRetenu("nom retenu " + i);
observations.add(observation);
}
ObservationValidation observationValidationData = new ObservationValidation();
observationValidationData.setContributor("contributeur test");
observationValidationData.setId("1");
observationValidationData.setIdImage("id image 1");
observationValidationData.setVote(4);
observationValidationDatas.add(observationValidationData);
ObservationValidation observationValidationData2 = new ObservationValidation();
observationValidationData2.setContributor("contributeur test 2");
observationValidationData2.setId("2");
observationValidationData2.setIdImage("id image 1");
observationValidationData2.setVote(2);
observationValidationDatas.add(observationValidationData2);
ObservationDetermination observationDeterminationData1 = new ObservationDetermination();
observationDeterminationData1.setEspece("Acer monsp. L.");
observationDeterminationData1.setContributeur("Léo Ferré");
observationDeterminationData1.setCommentaire("Avec le temps...");
observationDeterminationData1.setId("1");
observationDeterminationData1.setIdImage("id image 1");
observationDeterminationData1.setPourcentageConfiance(90);
observationDeterminationData1.setDateCommentaire("12/01/2011");
observationDeterminationDatas.add(observationDeterminationData1);
ObservationDetermination observationDeterminationData2 = new ObservationDetermination();
observationDeterminationData2.setEspece("Acer aceras aus.");
observationDeterminationData2.setContributeur("Pierre Desproges");
observationDeterminationData2.setCommentaire("Public chéri mon amour !");
observationDeterminationData2.setId("2");
observationDeterminationData2.setIdImage("id image 1");
observationDeterminationData2.setPourcentageConfiance(30);
observationDeterminationData2.setDateCommentaire("05/09/2011");
observationDeterminationDatas.add(observationDeterminationData2);
ObservationDetermination observationDeterminationData3 = new ObservationDetermination();
observationDeterminationData3.setEspece("Acer monsp subsp. monsp.");
observationDeterminationData3.setContributeur("Louis Aragon");
observationDeterminationData3.setCommentaire("Tout est affaire de décor");
observationDeterminationData3.setId("2");
observationDeterminationData3.setIdImage("id image 1");
observationDeterminationData3.setPourcentageConfiance(50);
observationDeterminationData3.setDateCommentaire("14/08/2011");
observationDeterminationDatas.add(observationDeterminationData3);
propositionsTaxonDatas.add("Acer monsp. L.");
propositionsTaxonDatas.add("Acer aceras aus.");
propositionsTaxonDatas.add("Acer monsp subsp. monsp.");
propositionsTaxonDatas.add("Acer australis L.");
}
public List<Observation> getObservations() {
return observations;
}
public List<ObservationValidation> getValidationData(String idImage) {
return observationValidationDatas;
}
public List<ObservationDetermination> getDeterminationData(String idImage) {
return observationDeterminationDatas;
}
public ArrayList<String> getPropositionsTaxonsData(String idImage) {
return propositionsTaxonDatas;
}
public Observation getObservationCourante() {
return observations.get(0);
}
public List<Observation> getObservationsEfloreParTaxon(String nomTaxon) {
return observations;
}
public void saveValidationData(ObservationValidation validationData) throws ExceptionClient {
}
public static MockDatasource getInstance() {
if (instance == null) {
instance = new MockDatasource();
}
return instance;
}
}