Subversion Repositories eFlore/Applications.coel

Rev

Rev 1136 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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