Subversion Repositories eFlore/Applications.del

Rev

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

Rev 1471 Rev 1496
Line 6... Line 6...
6
import org.tela_botanica.del.client.modeles.VoteProtocole;
6
import org.tela_botanica.del.client.modeles.VoteProtocole;
7
import org.tela_botanica.del.client.services.rest.async.AjoutVoteProtocoleCallback;
7
import org.tela_botanica.del.client.services.rest.async.AjoutVoteProtocoleCallback;
8
import org.tela_botanica.del.client.services.rest.async.PHPCallback.ModeRequete;
8
import org.tela_botanica.del.client.services.rest.async.PHPCallback.ModeRequete;
9
import org.tela_botanica.del.client.services.rest.async.VoteProtocoleCallback;
9
import org.tela_botanica.del.client.services.rest.async.VoteProtocoleCallback;
Line 10... Line 10...
10
 
10
 
Line 11... Line 11...
11
import com.google.gwt.http.client.RequestBuilder;
11
import org.tela_botanica.del.client.services.RequestBuilderWithCredentials;
Line 12... Line 12...
12
 
12
 
Line 36... Line 36...
36
		return null;
36
		return null;
37
	}
37
	}
Line 38... Line 38...
38
 
38
 
39
	@Override
39
	@Override
40
	public void ajouterVote(String idImage, VoteProtocole voteProtocole, AjoutVoteProtocoleCallback callback) {
40
	public void ajouterVote(String idImage, VoteProtocole voteProtocole, AjoutVoteProtocoleCallback callback) {
41
		RequestBuilder rb = new RequestBuilder(RequestBuilder.PUT, baseUrl+"images/"+idImage+"/votes/");
41
		RequestBuilderWithCredentials rb = new RequestBuilderWithCredentials(RequestBuilderWithCredentials.PUT, baseUrl+"images/"+idImage+"/votes/");
42
		callback.setMode(ModeRequete.AJOUT);
42
		callback.setMode(ModeRequete.AJOUT);
43
		String chainePost = assemblerChaineRequeteAjoutModif(voteProtocole);
43
		String chainePost = assemblerChaineRequeteAjoutModif(voteProtocole);
44
		try {
44
		try {
45
			rb.sendRequest(chainePost, callback);
45
			rb.sendRequest(chainePost, callback);
Line 55... Line 55...
55
		return chaineRequete;
55
		return chaineRequete;
56
	}
56
	}
Line 57... Line 57...
57
	
57
	
58
	@Override
58
	@Override
59
	public void modifierVote(String idImage, VoteProtocole voteProtocole, VoteProtocoleCallback callback) {
59
	public void modifierVote(String idImage, VoteProtocole voteProtocole, VoteProtocoleCallback callback) {
60
		RequestBuilder rb = new RequestBuilder(RequestBuilder.POST, baseUrl+"images/"+idImage+"/votes/");
60
		RequestBuilderWithCredentials rb = new RequestBuilderWithCredentials(RequestBuilderWithCredentials.POST, baseUrl+"images/"+idImage+"/votes/");
61
		callback.setMode(ModeRequete.MODIFICATION);
61
		callback.setMode(ModeRequete.MODIFICATION);
62
		String chainePost = assemblerChaineRequeteAjoutModif(voteProtocole);
62
		String chainePost = assemblerChaineRequeteAjoutModif(voteProtocole);
63
		try {
63
		try {
64
			rb.sendRequest(chainePost, callback);
64
			rb.sendRequest(chainePost, callback);
Line 68... Line 68...
68
	}
68
	}
Line 69... Line 69...
69
 
69
 
70
	@Override
70
	@Override
71
	public void supprimerVote(String idImage, VoteProtocole voteProtocole,
71
	public void supprimerVote(String idImage, VoteProtocole voteProtocole,
72
			VoteProtocoleCallback callback) {
72
			VoteProtocoleCallback callback) {
73
		RequestBuilder rb = new RequestBuilder(RequestBuilder.DELETE, baseUrl+"images/"+idImage+"/votes/"+voteProtocole.getId());
73
		RequestBuilderWithCredentials rb = new RequestBuilderWithCredentials(RequestBuilderWithCredentials.DELETE, baseUrl+"images/"+idImage+"/votes/"+voteProtocole.getId());
74
		callback.setMode(ModeRequete.SUPPRESSION);
74
		callback.setMode(ModeRequete.SUPPRESSION);
75
		try {
75
		try {
76
			rb.sendRequest(null, callback);
76
			rb.sendRequest(null, callback);
77
		} catch (Exception e) {
77
		} catch (Exception e) {