Subversion Repositories eFlore/Applications.del

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
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;
14 benjamin 9
import org.tela_botanica.del.client.modeles.ObservationValidation;
9 benjamin 10
 
11
public class MockDatasource {
12
 
13
	static MockDatasource instance;
14
 
15
	List<Observation> observations = new ArrayList<Observation>();
16
 
14 benjamin 17
	List<ObservationValidation> observationValidationDatas = new ArrayList<ObservationValidation>();
9 benjamin 18
 
19
	private MockDatasource() {
20
 
21
		for (int i = 0; i < 20; i++) {
22
 
23
			Observation observation = new Observation();
24
 
25
			observation.setAuteur("auteur " + i);
26
			observation.setSpecies("espece " + i);
35 gduche 27
 
28
			int numobs = 44120 + i;
29
			observation.setUrl("http://www.tela-botanica.org/appli:cel-img:0000" + String.valueOf(numobs) + "CRX2S.jpg");
9 benjamin 30
			observation.setNumNomenclatural("num nomenclatural " + i);
31
			observation.setIdImage("id image " + i);
32
			observation.setDate(new Date().toString());
33
			observation.setFamille("famille " + i);
34
			observation.setLocalite("localite " + i);
35 gduche 35
			observation.setNomRetenu("nom retenu " + i);
9 benjamin 36
 
37
			observations.add(observation);
38
		}
39
 
14 benjamin 40
		ObservationValidation observationValidationData = new ObservationValidation();
9 benjamin 41
		observationValidationData.setContributor("contributeur test");
42
		observationValidationData.setId("1");
43
		observationValidationData.setIdImage("id image 1");
44
		observationValidationData.setVote(4);
45
		observationValidationDatas.add(observationValidationData);
46
 
14 benjamin 47
		ObservationValidation observationValidationData2 = new ObservationValidation();
9 benjamin 48
		observationValidationData2.setContributor("contributeur test 2");
49
		observationValidationData2.setId("2");
50
		observationValidationData2.setIdImage("id image 1");
51
		observationValidationData2.setVote(2);
52
		observationValidationDatas.add(observationValidationData2);
53
	}
54
 
55
	public List<Observation> getObservations() {
56
		return observations;
57
	}
58
 
14 benjamin 59
	public List<ObservationValidation> getValidationData(String idImage) {
9 benjamin 60
 
61
		return observationValidationDatas;
62
	}
63
 
35 gduche 64
	public void saveValidationData(ObservationValidation validationData) throws ExceptionClient {
9 benjamin 65
 
66
	}
67
 
68
	public static MockDatasource getInstance() {
69
		if (instance == null) {
70
			instance = new MockDatasource();
71
		}
72
		return instance;
73
	}
74
 
75
}