Subversion Repositories eFlore/Applications.del

Rev

Rev 14 | Rev 40 | Go to most recent revision | Blame | Compare with Previous | 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.ObservationValidation;

public class MockDatasource {

        static MockDatasource instance;

        List<Observation> observations = new ArrayList<Observation>();

        List<ObservationValidation> observationValidationDatas = new ArrayList<ObservationValidation>();

        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) + "CRX2S.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);
        }

        public List<Observation> getObservations() {
                return observations;
        }

        public List<ObservationValidation> getValidationData(String idImage) {

                return observationValidationDatas;
        }

        public void saveValidationData(ObservationValidation validationData) throws ExceptionClient {

        }

        public static MockDatasource getInstance() {
                if (instance == null) {
                        instance = new MockDatasource();
                }
                return instance;
        }

}