Subversion Repositories eFlore/Applications.coel

Rev

Rev 741 | Rev 751 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 741 Rev 748
1
package org.tela_botanica.client.modeles;
1
package org.tela_botanica.client.modeles;
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 com.google.gwt.json.client.JSONObject;
6
import com.google.gwt.json.client.JSONObject;
7
 
7
 
8
public class PublicationAPersonne extends aDonnee {
8
public class PublicationAPersonne extends aDonnee {
9
 
9
 
10
	private static final long serialVersionUID = 7769105365939978129L;
10
	private static final long serialVersionUID = 7769105365939978129L;
-
 
11
	
-
 
12
	private static final String PREFIXE = "cpuap";
11
 
13
 
12
	public PublicationAPersonne(JSONObject pubAPersListe) {
14
	public PublicationAPersonne(JSONObject pubAPersListe) {
13
		// l'objet JSON est une table de hachage
15
		// l'objet JSON est une table de hachage
14
		Set<String> im = pubAPersListe.keySet();
16
		Set<String> im = pubAPersListe.keySet();
15
 
17
 
16
		// Parcourt pour chaque clé
18
		// Parcourt pour chaque clé
17
		for (Iterator<String> it = im.iterator(); it.hasNext();) {
19
		for (Iterator<String> it = im.iterator(); it.hasNext();) {
18
			// Si elle est associée à une valeur, nous l'ajoutons
20
			// Si elle est associée à une valeur, nous l'ajoutons
19
			String cle = it.next();
21
			String cle = it.next();
20
			// Suppression de l'abréviation du champ. Inutile dans le contexte d'un objet
22
			// Suppression de l'abréviation du champ. Inutile dans le contexte d'un objet
-
 
23
			String cleObjet = cle.replaceFirst("^"+PREFIXE+"_", "");
-
 
24
			// Valeur vide par défaut
-
 
25
			String valeur = "";
21
			if (pubAPersListe.get(cle).isString() != null) {
26
			if (pubAPersListe.get(cle).isString() != null) {
22
				String valeur = pubAPersListe.get(cle).isString().stringValue();
27
				valeur = pubAPersListe.get(cle).isString().stringValue();
23
				this.set(cle, valeur);
28
				this.set(cleObjet, valeur);
24
			} else {
29
			} else {
25
				// Sinon, nous ajoutons la clé avec une valeur vide
-
 
26
				String valeur = " ";
-
 
27
				this.set(cle, valeur);
30
				this.set(cleObjet, valeur);
28
			}
31
			}
29
		}
32
		}
30
	}
33
	}
-
 
34
	
-
 
35
	@Override
-
 
36
	protected String getPrefixe() {
-
 
37
		return PREFIXE;
-
 
38
	}
-
 
39
 
-
 
40
	public String getIdAuteur() {
-
 
41
		return renvoyerValeurCorrecte("cp_id_personne");
-
 
42
	}
31
	
43
	
32
	public String getNomCompletAuteur() {
44
	public String getNomCompletAuteur() {
33
		return renvoyerValeurCorrecte("cp_fmt_nom_complet");
45
		return renvoyerValeurCorrecte("cp_fmt_nom_complet");
34
	}
46
	}
35
	
47
	
36
	public String getNomAuteur() {
48
	public String getNomAuteur() {
37
		return renvoyerValeurCorrecte("cp_nom");
49
		return renvoyerValeurCorrecte("cp_nom");
38
	}
50
	}
39
	
51
	
40
	public String getPrenomAuteur() {
52
	public String getPrenomAuteur() {
41
		return renvoyerValeurCorrecte("cp_prenom");
53
		return renvoyerValeurCorrecte("cp_prenom");
42
	}
54
	}
43
	
-
 
44
	public String getIdAuteur() {
-
 
45
		return renvoyerValeurCorrecte("cp_id_personne");
-
 
46
	}
-
 
47
	
55
	
48
	public String getPublication() {
56
	public String getPublication() {
49
		return renvoyerValeurCorrecte("cpuap_id_publication");
57
		return renvoyerValeurCorrecte("id_publication");
50
	}
58
	}
51
}
59
}