Subversion Repositories eFlore/Applications.del

Rev

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

Rev 1151 Rev 1162
Line 1... Line 1...
1
package org.tela_botanica.del.client.services.rest;
1
package org.tela_botanica.del.client.services.rest;
Line 2... Line 2...
2
 
2
 
3
import org.tela_botanica.del.client.cache.CacheClient;
3
import org.tela_botanica.del.client.cache.CacheClient;
4
import org.tela_botanica.del.client.config.Config;
4
import org.tela_botanica.del.client.config.Config;
5
import org.tela_botanica.del.client.services.rest.async.AjoutMotsClesImageCallBack;
5
import org.tela_botanica.del.client.services.rest.async.AjoutMotsClesImageCallback;
6
import org.tela_botanica.del.client.services.rest.async.ListeMotsClesImageCallBack;
6
import org.tela_botanica.del.client.services.rest.async.ListeMotsClesImageCallBack;
-
 
7
import org.tela_botanica.del.client.services.rest.async.PHPCallback.ModeRequete;
Line 7... Line 8...
7
import org.tela_botanica.del.client.services.rest.async.PHPCallback.ModeRequete;
8
import org.tela_botanica.del.client.services.rest.async.SuppressionMotCleImageCallback;
8
 
9
 
Line 9... Line 10...
9
import com.google.gwt.http.client.RequestBuilder;
10
import com.google.gwt.http.client.RequestBuilder;
Line 39... Line 40...
39
		return chaineRequete;
40
		return chaineRequete;
40
	}
41
	}
Line 41... Line 42...
41
 
42
 
42
	@Override
43
	@Override
43
	public void ajouterMotCleImage(String idImage, String motCle,
44
	public void ajouterMotCleImage(String idImage, String motCle,
44
			AjoutMotsClesImageCallBack callback) {
45
			AjoutMotsClesImageCallback callback) {
45
		String urlService = baseUrl+"mots-cles/";
46
		String urlService = baseUrl+"mots-cles/";
Line 46... Line 47...
46
		RequestBuilder rb = new RequestBuilder(RequestBuilder.PUT, urlService);
47
		RequestBuilder rb = new RequestBuilder(RequestBuilder.PUT, urlService);
47
		
48
		
Line 59... Line 60...
59
		return "image="+URL.encodeQueryString(idImage)+
60
		return "image="+URL.encodeQueryString(idImage)+
60
			   "&mot_cle="+URL.encodeQueryString(motCle)+
61
			   "&mot_cle="+URL.encodeQueryString(motCle)+
61
			   "&"+URL.encodeQueryString("auteur.id")+"="+URL.encodeQueryString(CacheClient.getInstance().getUtilisateur().getId());
62
			   "&"+URL.encodeQueryString("auteur.id")+"="+URL.encodeQueryString(CacheClient.getInstance().getUtilisateur().getId());
62
	}
63
	}
Line -... Line 64...
-
 
64
 
-
 
65
	@Override
-
 
66
	public void supprimerMotCleImage(String idMotCle, SuppressionMotCleImageCallback callback) {
-
 
67
		String urlService = baseUrl+"mots-cles/"+idMotCle;
-
 
68
		RequestBuilder rb = new RequestBuilder(RequestBuilder.DELETE, urlService);
-
 
69
		
-
 
70
		callback.setMode(ModeRequete.SUPPRESSION);
-
 
71
		try {
-
 
72
			rb.sendRequest(null, callback);
-
 
73
		} catch (Exception e) {
-
 
74
			//TODO: quoi faire si la requete est mal formée coté client avant d'être envoyée ?
-
 
75
		}
63
 
76
	}