Subversion Repositories eFlore/Applications.coel

Rev

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

Rev 221 Rev 230
Line 1... Line 1...
1
package org.tela_botanica.client.modeles;
1
package org.tela_botanica.client.modeles;
Line 2... Line 2...
2
 
2
 
-
 
3
import java.util.Iterator;
3
import java.util.Iterator;
4
import java.util.Map;
Line -... Line 5...
-
 
5
import java.util.Set;
4
import java.util.Set;
6
 
-
 
7
import com.google.gwt.http.client.URL;
Line 5... Line 8...
5
 
8
import com.google.gwt.json.client.JSONObject;
Line 6... Line 9...
6
import com.google.gwt.json.client.JSONObject;
9
import com.google.gwt.user.client.Window;
-
 
10
 
-
 
11
public class Publication extends aDonnee {
-
 
12
 
-
 
13
	/**
-
 
14
	 * Préfixe à retirer pour construire les noms des clés
-
 
15
	 * et à rajouter lors de la transformation en requête
7
 
16
	 */
8
public class Publication extends aDonnee {
17
	private static String prefixe = "cpu_";
9
 
18
	
10
	/**
19
	/**
Line 27... Line 36...
27
		// Parcourt pour chaque clé
36
		// Parcourt pour chaque clé
28
		for (Iterator<String> it = im.iterator(); it.hasNext();) {
37
		for (Iterator<String> it = im.iterator(); it.hasNext();) {
29
			// Si elle est associée à une valeur, nous l'ajoutons
38
			// Si elle est associée à une valeur, nous l'ajoutons
30
			String cle = it.next();
39
			String cle = it.next();
31
			// Suppression de l'abréviation du champ. Inutile dans le contexte d'un objet
40
			// Suppression de l'abréviation du champ. Inutile dans le contexte d'un objet
32
			String cleObjet = cle.replaceFirst("^cpu_", "");
41
			String cleObjet = cle.replaceFirst("^"+prefixe, "");
33
			if (institution.get(cle).isString() != null) {
42
			if (institution.get(cle).isString() != null) {
34
				String valeur = institution.get(cle).isString().stringValue();
43
				String valeur = institution.get(cle).isString().stringValue();
35
				this.set(cleObjet, valeur);
44
				this.set(cleObjet, valeur);
36
			} else {
45
			} else {
37
				// Sinon, nous ajoutons la clé avec une valeur vide
46
				// Sinon, nous ajoutons la clé avec une valeur vide
Line 42... Line 51...
42
	}
51
	}
Line 43... Line 52...
43
	
52
	
44
	public Publication(String nom_complet, String uri, String auteur, String collection, String titre, String editeur,
53
	public Publication(String nom_complet, String uri, String auteur, String collection, String titre, String editeur,
45
			String dateParution, String indicationNvt, String fascicule, String pages) {
54
			String dateParution, String indicationNvt, String fascicule, String pages) {
-
 
55
		this.set("fmt_nom_complet", nom_complet);
46
		this.set("fmt_nom_complet", nom_complet);
56
		this.set("ce_projet", "");
47
		this.set("uri", uri);
57
		this.set("uri", uri);
48
		this.set("fmt_auteur", auteur);
58
		this.set("fmt_auteur", auteur);
49
		this.set("collection", collection);
59
		this.set("collection", collection);
50
		this.set("titre", nom_complet);
60
		this.set("titre", nom_complet);
51
		this.set("fmt_nom_complet", titre);
61
		this.set("fmt_nom_complet", titre);
52
		this.set("ce_truk_editeur", editeur);
62
		this.set("ce_truk_editeur", editeur);
53
		this.set("date_parution", dateParution);
63
		this.set("date_parution", dateParution);
54
		this.set("indication_nvt", indicationNvt);
64
		this.set("indication_nvt", indicationNvt);
55
		this.set("fascicule", fascicule);
65
		this.set("fascicule", fascicule);
-
 
66
		this.set("truk_pages", pages);
56
		this.set("truk_pages", pages);
67
		this.set("ce_meta", "");
Line -... Line 68...
-
 
68
	}
-
 
69
	
-
 
70
	public Publication(String idPublication,String idProjet, String nom_complet, String uri, String auteur, String collection, String titre, String editeur,
-
 
71
			String dateParution, String indicationNvt, String fascicule, String pages) {
-
 
72
		this.set("id_publication", idPublication);
-
 
73
		this.set("ce_projet", idProjet);
-
 
74
		this.set("fmt_nom_complet", nom_complet);
-
 
75
		this.set("uri", uri);
-
 
76
		this.set("fmt_auteur", auteur);
-
 
77
		this.set("collection", collection);
-
 
78
		this.set("titre", nom_complet);
-
 
79
		this.set("fmt_nom_complet", titre);
-
 
80
		this.set("ce_truk_editeur", editeur);
-
 
81
		this.set("date_parution", dateParution);
-
 
82
		this.set("indication_nvt", indicationNvt);
-
 
83
		this.set("fascicule", fascicule);
-
 
84
		this.set("truk_pages", pages);
-
 
85
		this.set("ce_meta", "");
57
	}
86
	}
58
	
87
 
59
	public String getId() {
88
	public String getId() {
Line 60... Line 89...
60
		return (String) renvoyerValeurCorrecte("id_publication");
89
		return (String) renvoyerValeurCorrecte("id_publication");
61
	}
90
	}
62
	
91
	
Line 63... Line 92...
63
	public String getProjet() {
92
	public String getProjet() {
64
		return (String) renvoyerValeurCorrecte("projet");
93
		return (String) renvoyerValeurCorrecte("ce_projet");
65
	}
94
	}
Line 101... Line 130...
101
	}
130
	}
Line 102... Line 131...
102
	
131
	
103
	public String getPages() {
132
	public String getPages() {
104
		return (String) renvoyerValeurCorrecte("truk_pages");
133
		return (String) renvoyerValeurCorrecte("truk_pages");
-
 
134
	}
-
 
135
	
-
 
136
	public String getMeta() {
-
 
137
		return (String) renvoyerValeurCorrecte("ce_meta");
-
 
138
	}
-
 
139
	
-
 
140
	public String toReqString() {
-
 
141
		String reqString = "" ;
-
 
142
		
-
 
143
		Map<String,Object> clesValeurs = getProperties() ;
-
 
144
		for(Iterator<String> it = clesValeurs.keySet().iterator(); it.hasNext();) {
-
 
145
			String cle = it.next();
-
 
146
				reqString += "&"+prefixe+cle+"="+URL.encode((String)clesValeurs.get(cle));
-
 
147
		}
-
 
148
		Window.alert(reqString);
-
 
149
		return reqString;
105
	}
150
	}
106
}
151
}