Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 2438 Rev 2602
Line 1... Line 1...
1
package org.tela_botanica.client.modeles.dao;
1
package org.tela_botanica.client.modeles.dao;
Line 2... Line 2...
2
 
2
 
3
import java.util.ArrayList;
3
import java.util.ArrayList;
4
import java.util.HashMap;
4
import java.util.HashMap;
-
 
5
import java.util.Iterator;
Line 5... Line 6...
5
import java.util.Iterator;
6
import java.util.Map;
6
 
7
 
7
import org.tela_botanica.client.cel2;
8
import org.tela_botanica.client.cel2;
8
import org.tela_botanica.client.interfaces.Rafraichissable;
9
import org.tela_botanica.client.interfaces.Rafraichissable;
Line 253... Line 254...
253
	}
254
	}
Line 254... Line 255...
254
	
255
	
255
	protected static String obtenirNomPageChampEtendu(String cle) {
256
	protected static String obtenirNomPageChampEtendu(String cle) {
256
		return prefixePageChampEtendu+Util.convertirEnChaMot(cle);
257
		return prefixePageChampEtendu+Util.convertirEnChaMot(cle);
-
 
258
	}
-
 
259
	
-
 
260
	public static String getUrlRequeteValeursChampEtendu(String cle) {
-
 
261
		return Configuration.getServiceBaseUrl() + 
-
 
262
		"/NomsChampsEtendus/valeur"+
-
 
263
		"?cle="+URL.encode(cle)+"&recherche=";
-
 
264
	}
-
 
265
	
-
 
266
	public static String getUrlRequeteNomsChampsEtendus() {
-
 
267
		return Configuration.getServiceBaseUrl()+ 
-
 
268
			   "/NomsChampsEtendus/cle?recherche=";
-
 
269
	}
-
 
270
	
-
 
271
	public static Map<String, String> parserRetourListeValeursChampsEtendus(Response response) {
-
 
272
		
-
 
273
		Map<String, String> valeurs = new HashMap<String, String>();
-
 
274
		final JSONValue responseValue = JSONParser.parse(response.getText());
-
 
275
		
-
 
276
		JSONArray reponse = null;
-
 
277
		if ((reponse = responseValue.isArray()) != null) {
-
 
278
			for(int i = 0; i < reponse.size(); i++) {								
-
 
279
				valeurs.put(reponse.get(i).isString().stringValue(), reponse.get(i).isString().stringValue());
-
 
280
			}
-
 
281
		}
-
 
282
		
-
 
283
		return valeurs;
-
 
284
	}
-
 
285
	
-
 
286
	public static Map<String, String> parserRetourListeNomsChampsEtendus(Response response) {				
-
 
287
		final JSONValue responseValue = JSONParser.parse(response.getText());
-
 
288
		
-
 
289
		JSONObject reponse = null;
-
 
290
		
-
 
291
		cacheClesLabels = new HashMap<String, String>();
-
 
292
		if ((reponse = responseValue.isObject()) != null) {
-
 
293
			Iterator<String> it = reponse.keySet().iterator();
-
 
294
			
-
 
295
			while(it.hasNext()) {
-
 
296
				String cle = it.next();								
-
 
297
				String valeur = reponse.get(cle).isString().stringValue();
-
 
298
				cacheClesLabels.put(cle, valeur);
-
 
299
			}
-
 
300
		}
-
 
301
		
-
 
302
		return cacheClesLabels;
257
	}
303
	}