Subversion Repositories eFlore/Applications.coel

Rev

Rev 147 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 147 Rev 748
Line 4... Line 4...
4
import java.util.Set;
4
import java.util.Set;
Line 5... Line 5...
5
 
5
 
Line 6... Line 6...
6
import com.google.gwt.json.client.JSONObject;
6
import com.google.gwt.json.client.JSONObject;
-
 
7
 
-
 
8
public class Projet extends aDonnee {
7
 
9
	
8
public class Projet extends aDonnee {
10
	private static final long serialVersionUID = 6733053168274995082L;
9
	/**
11
 
10
	 * Constructeur vide
12
	private static final String PREFIXE = "cpr";
11
	 */
13
 
12
	public Projet() {
14
	public Projet() {
Line 13... Line -...
13
		this.set("mark_contact", false);
-
 
14
	}
-
 
15
	
-
 
16
	/**
-
 
17
	 * Constructeur avec un objet JSON
-
 
18
	 * 
15
		this.set("mark_contact", false);
19
	 * @param image
16
	}
20
	 */
17
	
Line 21... Line 18...
21
	public Projet(JSONObject liste) {
18
	public Projet(JSONObject liste) {
22
		// l'objet JSON est une table de hachage
19
		// l'objet JSON est une table de hachage
23
		Set<String> im = liste.keySet();
20
		Set<String> im = liste.keySet();
24
 
21
 
25
		// Parcourt pour chaque clé
22
		// Parcourt pour chaque clé
26
		for (Iterator<String> it = im.iterator(); it.hasNext();) {
23
		for (Iterator<String> it = im.iterator(); it.hasNext();) {
27
			// Si elle est associée à une valeur, nous l'ajoutons
24
			// Si elle est associée à une valeur, nous l'ajoutons
28
			String cle = it.next();
25
			String cle = it.next();
29
			// Suppression de l'abréviation du champ. Inutile dans le contexte d'un objet
26
			// Suppression de l'abréviation du champ. Inutile dans le contexte d'un objet
30
			String cleObjet = cle.replaceFirst("^cpr_", "");
27
			String cleObjet = cle.replaceFirst("^"+PREFIXE+"_", "");
31
			if (liste.get(cle).isString() != null) {
28
			if (liste.get(cle).isString() != null) {
Line 37... Line 34...
37
				this.set(cleObjet, valeur);
34
				this.set(cleObjet, valeur);
38
			}
35
			}
39
		}
36
		}
40
	}
37
	}
Line 41... Line -...
41
	
-
 
42
	/**
-
 
43
	 * Constructeur avec la fonction à passer en paramètre
-
 
44
	 * 
38
	
45
	 * @param image
-
 
46
	 *
39
	@Override
47
	/*public Projets(String fonction) {
-
 
48
		this.set("ce_truk_fonction", fonction);
40
	protected String getPrefixe() {
49
		this.set("mark_contact", false);
41
		return PREFIXE;
Line 50... Line 42...
50
	}*/
42
	}
51
	
43
	
52
	public String getId() {
44
	public String getId() {
Line 53... Line 45...
53
		return (String) renvoyerValeurCorrecte("id_projet");
45
		return (String) renvoyerValeurCorrecte("id_projet");
54
	}
46
	}
55
	
47
	
56
	public String getNom() {
-
 
57
		return (String) renvoyerValeurCorrecte("nom");
-
 
58
	}
-
 
59
	
-
 
60
	/*public String getFonction() {
-
 
61
		String fonction = (String) renvoyerValeurCorrecte("ce_truk_fonction");
-
 
62
		if (fonction.equals(Valeur.FONCTION_DIRECTEUR)) {
-
 
63
			return "Directeur";
-
 
64
		} else if (fonction.equals(Valeur.FONCTION_CONSERVATEUR)) {
-
 
65
			return "Conservateur";
-
 
66
		} else {
-
 
67
			return "";
-
 
Line 68... Line 48...
68
		}
48
	public String getNom() {