Subversion Repositories eFlore/Applications.del

Rev

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

Rev 939 Rev 1471
Line 2... Line 2...
2
 
2
 
Line 3... Line 3...
3
import java.util.List;
3
import java.util.List;
4
 
4
 
-
 
5
import org.tela_botanica.del.client.config.Config;
5
import org.tela_botanica.del.client.config.Config;
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;
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.PHPCallback.ModeRequete;
Line 34... Line 35...
34
		// TODO Auto-generated method stub
35
		// TODO Auto-generated method stub
35
		return null;
36
		return null;
36
	}
37
	}
Line 37... Line 38...
37
 
38
 
38
	@Override
39
	@Override
39
	public void ajouterVote(String idImage, VoteProtocole voteProtocole, VoteProtocoleCallback callback) {
40
	public void ajouterVote(String idImage, VoteProtocole voteProtocole, AjoutVoteProtocoleCallback callback) {
40
		RequestBuilder rb = new RequestBuilder(RequestBuilder.PUT, baseUrl+"images/"+idImage+"/votes/");
41
		RequestBuilder rb = new RequestBuilder(RequestBuilder.PUT, baseUrl+"images/"+idImage+"/votes/");
41
		callback.setMode(ModeRequete.AJOUT);
42
		callback.setMode(ModeRequete.AJOUT);
42
		String chainePost = assemblerChaineRequeteAjoutModif(voteProtocole);
43
		String chainePost = assemblerChaineRequeteAjoutModif(voteProtocole);
43
		try {
44
		try {
Line 51... Line 52...
51
		String chaineRequete = "utilisateur="+voteProtocole.getContributeur()+"&"+
52
		String chaineRequete = "utilisateur="+voteProtocole.getContributeur()+"&"+
52
								"protocole="+voteProtocole.getIdProtocole()+"&"+
53
								"protocole="+voteProtocole.getIdProtocole()+"&"+
53
								"valeur="+voteProtocole.getVote();
54
								"valeur="+voteProtocole.getVote();
54
		return chaineRequete;
55
		return chaineRequete;
55
	}
56
	}
56
 
57
	
57
	@Override
58
	@Override
58
	public void modifierVote(String idImage, VoteProtocole voteProtocole, VoteProtocoleCallback callback) {
59
	public void modifierVote(String idImage, VoteProtocole voteProtocole, VoteProtocoleCallback callback) {
59
		RequestBuilder rb = new RequestBuilder(RequestBuilder.POST, baseUrl+"images/"+idImage+"/votes/");
60
		RequestBuilder rb = new RequestBuilder(RequestBuilder.POST, baseUrl+"images/"+idImage+"/votes/");
60
		callback.setMode(ModeRequete.MODIFICATION);
61
		callback.setMode(ModeRequete.MODIFICATION);
61
		String chainePost = assemblerChaineRequeteAjoutModif(voteProtocole);
62
		String chainePost = assemblerChaineRequeteAjoutModif(voteProtocole);
Line 63... Line 64...
63
			rb.sendRequest(chainePost, callback);
64
			rb.sendRequest(chainePost, callback);
64
		} catch (Exception e) {
65
		} catch (Exception e) {
65
			//TODO: quoi faire si la requete est mal formée coté client avant d'être envoyée ?
66
			//TODO: quoi faire si la requete est mal formée coté client avant d'être envoyée ?
66
		}
67
		}
67
	}
68
	}
-
 
69
 
-
 
70
	@Override
-
 
71
	public void supprimerVote(String idImage, VoteProtocole voteProtocole,
-
 
72
			VoteProtocoleCallback callback) {
-
 
73
		RequestBuilder rb = new RequestBuilder(RequestBuilder.DELETE, baseUrl+"images/"+idImage+"/votes/"+voteProtocole.getId());
-
 
74
		callback.setMode(ModeRequete.SUPPRESSION);
-
 
75
		try {
-
 
76
			rb.sendRequest(null, callback);
-
 
77
		} catch (Exception e) {
-
 
78
			//TODO: quoi faire si la requete est mal formée coté client avant d'être envoyée ?
-
 
79
		}
-
 
80
	}
68
}
81
}