Subversion Repositories eFlore/Applications.coel

Rev

Rev 1415 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
935 jpm 1
package org.tela_botanica.client.modeles.projet;
838 aurelien 2
 
3
import java.util.Iterator;
4
import java.util.Set;
5
 
935 jpm 6
import org.tela_botanica.client.modeles.aDonnee;
7
 
838 aurelien 8
import com.google.gwt.json.client.JSONObject;
9
 
10
public class ProjetVersion extends aDonnee {
11
 
12
	/**
13
	 *
14
	 */
15
	private static final long serialVersionUID = 1L;
16
 
17
	private static final String PREFIXE = "cprv";
1173 jpm 18
	public static String[] champsObligatoires = {"cpr_id_projet"};
19
 
838 aurelien 20
	public ProjetVersion() {
21
		//this.set("mark_contact", false);
22
		super();
23
	}
24
 
25
	public ProjetVersion(JSONObject liste) {
26
		// l'objet JSON est une table de hachage
27
		Set<String> im = liste.keySet();
28
 
29
		// Parcourt pour chaque clé
30
		for (Iterator<String> it = im.iterator(); it.hasNext();) {
31
			// Si elle est associée à une valeur, nous l'ajoutons
32
			String cle = it.next();
33
			// Suppression de l'abréviation du champ. Inutile dans le contexte d'un objet
34
			String cleObjet = cle.replaceFirst("^"+PREFIXE+"_", "");
35
			if (liste.get(cle).isString() != null) {
36
				String valeur = liste.get(cle).isString().stringValue();
37
				this.set(cleObjet, valeur);
38
			} else {
39
				// Sinon, nous ajoutons la clé avec une valeur vide
40
				String valeur = " ";
41
				this.set(cleObjet, valeur);
42
			}
43
		}
44
	}
45
 
46
	@Override
47
	protected String getPrefixe() {
48
		return PREFIXE;
49
	}
50
 
1173 jpm 51
	protected String[] getChampsObligatoires()	{
52
		return champsObligatoires;
53
	}
54
 
838 aurelien 55
	public String getIdVersion() {
56
		return renvoyerValeurCorrecte("id_version");
57
	}
58
 
59
	public String getIdProjet() {
60
		return renvoyerValeurCorrecte("id_projet");
61
	}
62
 
63
	public String getNom() {
64
		return renvoyerValeurCorrecte("nom");
65
	}
66
 
67
	public String getCode() {
68
		return renvoyerValeurCorrecte("code");
69
	}
70
 
71
	public String getDateDebut() {
72
		return renvoyerValeurCorrecte("date_debut");
73
	}
74
 
75
	public String getDateFin() {
76
		return renvoyerValeurCorrecte("date_fin");
77
	}
78
 
79
	public String getMeta() {
80
		return renvoyerValeurCorrecte("ce_meta ");
81
	}
82
 
83
 
84
}