Subversion Repositories eFlore/Applications.coel

Rev

Rev 64 | Go to most recent revision | Blame | Last modification | View Log | RSS feed

package org.tela_botanica.client.modeles;

import java.util.LinkedHashMap;

import com.google.gwt.json.client.JSONArray;
import com.google.gwt.json.client.JSONObject;

/**
 * Table de hachage composée d'informations sur les Structures, renvoyé par un objet de type DAO
 * La clé est le nom de l'entite + le nom de l'entite parente
 * 
 * @author david delon
 * 
 */
public class StructureListe extends LinkedHashMap<String, Structure> {
        
        /**
         * Identifiant pour sérialisé l'objet...
         */
        private static final long serialVersionUID = -7165785809164480836L;
        
        /**
         * Constructeur sans paramètres 
         */
        public StructureListe() {
                super();
        }
        
        /**
         * Constructeur avec paramètre
         * @param taille la taille de la table de hachage
         */
        public StructureListe(int taille)
        {
                super(taille);
        }
        /**
         * Constructeur pour une liste d'institutions
         * @param dates
         */
        public StructureListe(JSONArray institutions) 
        {
                super(institutions.size()) ;
                final int taillemax = institutions.size();
                
                for (int i = 0; i < taillemax; i++) {
                        JSONObject institutionCourante = institutions.get(i).isObject() ;
                        
                        if (institutionCourante != null)        {
                                Structure institution = new Structure(institutionCourante);
                                this.put(institution.getId(), institution);
                        }
                }
        }
                
}