Subversion Repositories eFlore/Applications.coel

Rev

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

Rev 171 Rev 177
Line 12... Line 12...
12
import com.google.gwt.json.client.JSONObject;
12
import com.google.gwt.json.client.JSONObject;
Line 13... Line 13...
13
 
13
 
Line 14... Line 14...
14
public class Structure extends aDonnee {
14
public class Structure extends aDonnee {
-
 
15
	
-
 
16
	public static final String PREFIXE = "cs";
15
	
17
	public static final String URL_SITE = "WEB";
16
	public static final String PREFIXE = "cs";
18
	public static final String URL_LOGO = "LOGO";
17
	private BaseModelData urls = null;
19
	private BaseModelData urls = null;
18
	/**
20
	/**
19
	 * Constructeur vide
21
	 * Constructeur vide
20
	 * 
22
	 * 
21
	 */
-
 
-
 
23
	 */
-
 
24
	public Structure() {
22
	public Structure() {
25
		// Constructions du tableau des urls interne
Line 23... Line 26...
23
		
26
		urls = new BaseModelData();
24
	}
27
	}
25
	
28
	
26
	/**
29
	/**
27
	 * Constructeur avec un objet JSON
30
	 * Constructeur avec un objet JSON
28
	 * 
31
	 * 
-
 
32
	 * @param image
-
 
33
	 */
-
 
34
	public Structure(JSONObject institution) {
29
	 * @param image
35
		// Constructions du tableau des urls interne
30
	 */
36
		urls = new BaseModelData();
Line 31... Line 37...
31
	public Structure(JSONObject institution) {
37
 
32
		// l'objet JSON est une table de hachage
38
		// l'objet JSON est une table de hachage
Line 137... Line 143...
137
		return (String) renvoyerValeurCorrecte("date_fondation");
143
		return (String) renvoyerValeurCorrecte("date_fondation");
138
	}
144
	}
139
	public Date getDateFondation() {
145
	public Date getDateFondation() {
140
		Date fondationDate = null;
146
		Date fondationDate = null;
141
		String fondationChaine = (String) renvoyerValeurCorrecte("date_fondation");
147
		String fondationChaine = (String) renvoyerValeurCorrecte("date_fondation");
142
		if (!fondationChaine.isEmpty()) {
148
		if (!fondationChaine.isEmpty() && !fondationChaine.equals("0000-00-00")) {
143
			fondationDate = DateTimeFormat.getFormat("yyyy-MM-dd HH:mm:ss").parseStrict(fondationChaine);
149
			fondationDate = DateTimeFormat.getFormat("yyyy-MM-dd").parseStrict(fondationChaine);
144
		}
150
		}
145
		return fondationDate;
151
		return fondationDate;
146
	}
152
	}
147
	public void setDateFondation(Date dateFondation) {
153
	public void setDateFondation(Date dateFondation) {
148
		if (dateFondation != null) {
154
		if (dateFondation != null) {
149
			this.set("date_fondation", DateTimeFormat.getFormat("yyyy-MM-dd HH:mm:ss").format(dateFondation));
155
			this.set("date_fondation", DateTimeFormat.getFormat("yyyy-MM-dd").format(dateFondation));
150
		}
156
		}
151
	}
157
	}
152
	public void setDateFondation(String dateFondation) {
158
	public void setDateFondation(String dateFondation) {
153
		if (dateFondation != null) {
159
		if (dateFondation != null) {
154
			this.set("date_fondation", dateFondation);
160
			this.set("date_fondation", dateFondation);
Line 224... Line 230...
224
		}
230
		}
225
		urlsDenormalise.replaceFirst(";;$", "");
231
		urlsDenormalise.replaceFirst(";;$", "");
226
		return urlsDenormalise;
232
		return urlsDenormalise;
227
	}
233
	}
228
	public void setUrl(String urlsDenormalise) {
234
	public void setUrl(String urlsDenormalise) {
229
		// Constructions du tableau des urls interne
-
 
230
		urls = new BaseModelData();
-
 
231
		if (urlsDenormalise != null && !urlsDenormalise.equals("")) {
235
		if (urlsDenormalise != null && !urlsDenormalise.equals("")) {
232
			//GWT.log(urlsDenormalise, null);
236
			//GWT.log(urlsDenormalise, null);
233
			String[] tableauUrls = urlsDenormalise.split(";;");
237
			String[] tableauUrls = urlsDenormalise.split(";;");
234
			for (int i = 0; i < tableauUrls.length; i++) {
238
			for (int i = 0; i < tableauUrls.length; i++) {
235
				String url = tableauUrls[i];
239
				String url = tableauUrls[i];
Line 241... Line 245...
241
				}
245
				}
242
			}
246
			}
243
		}
247
		}
244
	}
248
	}
245
	public void setUrl(String type, String url) {
249
	public void setUrl(String type, String url) {
-
 
250
		if (url != null) {
246
		urls.set(type, url);
251
			urls.set(type, url);
-
 
252
		}
247
	}
253
	}
Line 248... Line 254...
248
	
254
	
249
	public String getNbrePersonne() {
255
	public String getNbrePersonne() {
250
		return (String) renvoyerValeurCorrecte("nbre_personne");
256
		return (String) renvoyerValeurCorrecte("nbre_personne");
Line 261... Line 267...
261
		return (String) renvoyerValeurCorrecte("condition_usage");
267
		return (String) renvoyerValeurCorrecte("condition_usage");
262
	}
268
	}
Line 263... Line 269...
263
	
269
	
264
	public String toString() {
270
	public String toString() {
-
 
271
		String sortie = "";
-
 
272
		
265
		String sortie = "";
273
		// Champs du BaseModelData
266
		Set<String> proprietes = this.getProperties().keySet();
274
		Set<String> proprietes = this.getProperties().keySet();
267
		for (Iterator<String> it = proprietes.iterator(); it.hasNext();) {
275
		for (Iterator<String> it = proprietes.iterator(); it.hasNext();) {
268
			String cle = it.next();
276
			String cle = it.next();
269
			sortie += cle+" : "+this.get(cle)+"\n";
277
			sortie += cle+" : "+this.get(cle)+"\n";
-
 
278
		}
-
 
279
		
-
 
280
		// Champs spéciaux
-
 
281
		sortie += getUrl();
270
		}
282
		
271
		return sortie;
283
		return sortie;
Line 272... Line 284...
272
	}
284
	}
273
	
285