Subversion Repositories eFlore/Applications.coel

Rev

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

Rev 154 Rev 182
Line 1... Line 1...
1
package org.tela_botanica.client.util;
1
package org.tela_botanica.client.util;
Line -... Line 2...
-
 
2
 
-
 
3
import java.util.HashMap;
2
 
4
import java.util.Iterator;
Line 3... Line 5...
3
import java.util.LinkedHashMap;
5
import java.util.LinkedHashMap;
4
 
6
 
5
import org.tela_botanica.client.RegistreId;
7
import org.tela_botanica.client.RegistreId;
Line 46... Line 48...
46
	 * @param arrParametres
48
	 * @param arrParametres
47
	 * @return
49
	 * @return
48
	 */
50
	 */
49
	public static RequestBuilder construireRequete(String nomService, String[] arrParametres)	{
51
	public static RequestBuilder construireRequete(String nomService, String[] arrParametres)	{
Line -... Line 52...
-
 
52
		
-
 
53
		HashMap<String, String> hmRestrictions = null;
-
 
54
		return construireRequete(nomService, arrParametres, hmRestrictions);
-
 
55
		
-
 
56
	}
-
 
57
	
-
 
58
	public static RequestBuilder construireRequete(String nomService, HashMap<String, String> hmRestrictions)	{
-
 
59
		
-
 
60
		String[] arrParametres = null;
-
 
61
		return construireRequete( nomService, arrParametres, hmRestrictions);
-
 
62
		
-
 
63
	}
-
 
64
	
-
 
65
	public static RequestBuilder construireRequete(String nomService, String[] arrParametres, HashMap<String, String> hmRestrictions)	{
-
 
66
		
-
 
67
		
-
 
68
		String restrictions = "";
-
 
69
		
-
 
70
		//Les restrictions sont ajoutées en paramètres GET
-
 
71
		if ((hmRestrictions!=null)&&(hmRestrictions.size() > 0))	{
-
 
72
			
-
 
73
			Iterator<String> itRestrictions = hmRestrictions.keySet().iterator();
-
 
74
			while (itRestrictions.hasNext())	{
-
 
75
				String cle = itRestrictions.next();
-
 
76
				restrictions += cle + "=" + hmRestrictions.get(cle);
-
 
77
				
-
 
78
				if (itRestrictions.hasNext())	{
-
 
79
					restrictions = restrictions + "&";
-
 
80
				}
-
 
81
			}
-
 
82
			
-
 
83
			restrictions = "?" + restrictions;
-
 
84
		}
50
		
85
		
51
		String strParametres = "/";
86
		String strParametres = "/";
Line 52... Line 87...
52
		if (arrParametres != null) {
87
		if (arrParametres != null) {
53
			
88
			
54
			for (int i=0; i < arrParametres.length; i++)	{
89
			for (int i=0; i < arrParametres.length; i++)	{
55
				strParametres += arrParametres[i] + strParametres;
90
				strParametres += arrParametres[i] + strParametres;
Line 56... Line 91...
56
			}
91
			}
57
		}
92
		}
58
		
93
		
Line 59... Line 94...
59
		RequestBuilder rb = new RequestBuilder(RequestBuilder.GET, baseUrl + nomService + strParametres);
94
		RequestBuilder rb = new RequestBuilder(RequestBuilder.GET, baseUrl + nomService + strParametres + restrictions);
60
		return rb;
95
		return rb;