Subversion Repositories eFlore/Applications.coel

Rev

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

Rev 156 Rev 166
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.Date;
3
import java.util.Date;
4
import java.util.HashMap;
-
 
5
import java.util.Iterator;
4
import java.util.Iterator;
6
import java.util.Map;
Line -... Line 7...
-
 
7
import java.util.Set;
-
 
8
 
5
import java.util.Set;
9
import com.extjs.gxt.ui.client.data.BaseModelData;
6
 
10
import com.google.gwt.core.client.GWT;
Line 7... Line 11...
7
import com.google.gwt.i18n.client.DateTimeFormat;
11
import com.google.gwt.i18n.client.DateTimeFormat;
Line 8... Line 12...
8
import com.google.gwt.json.client.JSONObject;
12
import com.google.gwt.json.client.JSONObject;
9
 
-
 
-
 
13
 
10
public class Structure extends aDonnee {
14
public class Structure extends aDonnee {
11
	
15
	
12
	public static final String PREFIXE = "cs";
16
	public static final String PREFIXE = "cs";
13
	
17
	private BaseModelData urls = null;
14
	/**
18
	/**
Line 32... Line 36...
32
		for (Iterator<String> it = im.iterator(); it.hasNext();) {
36
		for (Iterator<String> it = im.iterator(); it.hasNext();) {
33
			// Si elle est associée à une valeur, nous l'ajoutons
37
			// Si elle est associée à une valeur, nous l'ajoutons
34
			String cle = it.next();
38
			String cle = it.next();
35
			// Suppression de l'abréviation du champ. Inutile dans le contexte d'un objet
39
			// Suppression de l'abréviation du champ. Inutile dans le contexte d'un objet
36
			String cleObjet = cle.replaceFirst("^"+Structure.PREFIXE+"_", "");
40
			String cleObjet = cle.replaceFirst("^"+Structure.PREFIXE+"_", "");
-
 
41
			// Sinon, nous ajoutons la clé avec une valeur vide
-
 
42
			String valeur = " ";
37
			if (institution.get(cle).isString() != null) {
43
			if (institution.get(cle).isString() != null) {
38
				String valeur = institution.get(cle).isString().stringValue();
44
				valeur = institution.get(cle).isString().stringValue();
-
 
45
			}
-
 
46
			if (cleObjet.equals("truk_url")) {
39
				this.set(cleObjet, valeur);
47
				this.setUrl(valeur);
40
			} else {
48
			} else {
41
				// Sinon, nous ajoutons la clé avec une valeur vide
-
 
42
				String valeur = " ";
-
 
43
				this.set(cleObjet, valeur);
49
				this.set(cleObjet, valeur);
44
			}
50
			}
45
		}
51
		}
46
	}
52
	}
Line 126... Line 132...
126
	public String getAdresseComplement() {
132
	public String getAdresseComplement() {
127
		return (String) renvoyerValeurCorrecte("adresse_02");
133
		return (String) renvoyerValeurCorrecte("adresse_02");
128
	}
134
	}
Line 129... Line 135...
129
 
135
 
-
 
136
	public Date getDateFondation() {
-
 
137
		Date fondationDate = null;
-
 
138
		String fondationChaine = (String) renvoyerValeurCorrecte("date_fondation");
130
	public Date getDateFondation() {
139
		if (!fondationChaine.equals(" ")) {
-
 
140
			fondationDate = DateTimeFormat.getFormat("yyyy-MM-dd HH:mm:ss").parseStrict(fondationChaine);
-
 
141
		}
131
		return DateTimeFormat.getFormat("yyyy-MM-dd HH:mm:ss").parse((String) renvoyerValeurCorrecte("date_fondation"));
142
		return fondationDate;
132
	}
143
	}
133
	public void setDateFondation(Date dateFondation) {
144
	public void setDateFondation(Date dateFondation) {
134
		if (dateFondation != null) {
145
		if (dateFondation != null) {
135
			DateTimeFormat.getFormat("yyyy-MM-dd HH:mm:ss").format(dateFondation);
-
 
136
			this.set("date_fondation", dateFondation.toString());
146
			this.set("date_fondation", DateTimeFormat.getFormat("yyyy-MM-dd HH:mm:ss").format(dateFondation));
137
		}
147
		}
138
	}
148
	}
139
	public void setDateFondation(String dateFondation) {
149
	public void setDateFondation(String dateFondation) {
140
		if (dateFondation != null) {
150
		if (dateFondation != null) {
Line 197... Line 207...
197
	}
207
	}
198
	public void setCourriel(String courriel) {
208
	public void setCourriel(String courriel) {
199
		this.set("courriel", courriel);
209
		this.set("courriel", courriel);
200
	}
210
	}
Line -... Line 211...
-
 
211
	
-
 
212
	public String getUrl(String type) {
-
 
213
		return urls.get(type);
201
	
214
	}
-
 
215
	public String getUrl() {
202
	public String getUrl() {
216
		String urlsDenormalise = "";
-
 
217
		Set<String> proprietes = urls.getProperties().keySet();
-
 
218
		for (Iterator<String> it = proprietes.iterator(); it.hasNext();) {
-
 
219
			String cle = it.next();
-
 
220
			urlsDenormalise += cle+"##"+urls.get(cle)+";;";
-
 
221
		}
-
 
222
		urlsDenormalise.replaceFirst(";;$", "");
203
		return (String) renvoyerValeurCorrecte("truk_url");
223
		return urlsDenormalise;
204
	}
224
	}
-
 
225
	public void setUrl(String urlsDenormalise) {
-
 
226
		// Constructions du tableau des urls interne
-
 
227
		urls = new BaseModelData();
-
 
228
		if (urlsDenormalise != null && !urlsDenormalise.equals("")) {
-
 
229
			//GWT.log(urlsDenormalise, null);
-
 
230
			String[] tableauUrls = urlsDenormalise.split(";;");
-
 
231
			for (int i = 0; i < tableauUrls.length; i++) {
-
 
232
				String url = tableauUrls[i];
-
 
233
				//GWT.log("\t"+url, null);
-
 
234
				String[] tableauUrl = url.split("##");
-
 
235
				if (tableauUrl.length == 2) {
-
 
236
					//GWT.log("\t\t"+tableauUrl[0]+"-"+tableauUrl[1], null);
-
 
237
					urls.set(tableauUrl[0], tableauUrl[1]);
-
 
238
				}
-
 
239
			}
-
 
240
		}
-
 
241
	}
205
	public void setUrl(String url) {
242
	public void setUrl(String type, String url) {
206
		this.set("truk_url", url);
243
		urls.set(type, url);
Line 207... Line 244...
207
	}
244
	}
208
	
245
	
209
	public String getNbrePersonne() {
246
	public String getNbrePersonne() {
Line 219... Line 256...
219
 
256
 
220
	public String getConditionUsage() {
257
	public String getConditionUsage() {
221
		return (String) renvoyerValeurCorrecte("condition_usage");
258
		return (String) renvoyerValeurCorrecte("condition_usage");
Line -... Line 259...
-
 
259
	}
-
 
260
	
-
 
261
	public String toString() {
-
 
262
		String sortie = "";
-
 
263
		Set<String> proprietes = this.getProperties().keySet();
-
 
264
		for (Iterator<String> it = proprietes.iterator(); it.hasNext();) {
-
 
265
			String cle = it.next();
-
 
266
			sortie += cle+" : "+this.get(cle)+"\n";
-
 
267
		}
-
 
268
		return sortie;
222
	}
269
	}
223
	
270