Subversion Repositories eFlore/Applications.del

Rev

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

Rev 501 Rev 530
Line 1... Line 1...
1
package org.tela_botanica.del.client.services.rest;
1
package org.tela_botanica.del.client.services.rest;
Line -... Line 2...
-
 
2
 
2
 
3
import org.tela_botanica.del.client.config.Config;
3
import org.tela_botanica.del.client.modeles.InformationsRecherche;
4
import org.tela_botanica.del.client.modeles.InformationsRecherche;
Line 4... Line 5...
4
import org.tela_botanica.del.client.services.rest.async.ImagesParTaxonCallback;
5
import org.tela_botanica.del.client.services.rest.async.ImagesParTaxonCallback;
Line 5... Line 6...
5
 
6
 
Line 6... Line 7...
6
import com.google.gwt.http.client.RequestBuilder;
7
import com.google.gwt.http.client.RequestBuilder;
-
 
8
 
-
 
9
public class ImageServiceConcret implements ImageService {
-
 
10
 
-
 
11
	private String baseUrl;
-
 
12
	
-
 
13
	public ImageServiceConcret() {
-
 
14
		Config config = new Config();
-
 
15
		this.baseUrl = config.getServiceBaseUrl();
-
 
16
	}
7
 
17
	
8
public class ImageServiceConcret implements ImageService {
18
	public ImageServiceConcret(Config config) {
9
 
19
		this.baseUrl = config.getServiceBaseUrl();
Line 10... Line 20...
10
	private String serverUrl = "/del/jrest/";
20
	}
11
 
21
	
12
	@Override
22
	@Override
13
	public void getImagesEfloreParTaxon(String taxon, ImagesParTaxonCallback callback) {
23
	public void getImagesEfloreParTaxon(String taxon, ImagesParTaxonCallback callback) {
14
 
24
 
15
		// RequestBuilder rb = new RequestBuilder(RequestBuilder.GET,
25
		// RequestBuilder rb = new RequestBuilder(RequestBuilder.GET,
16
		// serverUrl+"ImagesEflore");
26
		// serverUrl+"ImagesEflore");
17
		// adresse ajoutee temporairement le temps de faire fonctionner le
27
		// adresse ajoutee temporairement le temps de faire fonctionner le
18
		// service d'images eflore
28
		// service d'images eflore
19
		RequestBuilder rb = new RequestBuilder(RequestBuilder.GET, serverUrl + "Images?nom_taxon=" + taxon);
29
		RequestBuilder rb = new RequestBuilder(RequestBuilder.GET, baseUrl + "Images?nom_taxon=" + taxon);
20
		try {
30
		try {
Line 21... Line 31...
21
			rb.sendRequest(null, callback);
31
			rb.sendRequest(null, callback);
22
		} catch (Exception e) {
32
		} catch (Exception e) {
23
			// TODO: handle exception
33
			// TODO: handle exception
24
		}
34
		}
25
	}
35
	}
26
 
36
 
27
	@Override
37
	@Override
28
	public void getImagesParTaxon(InformationsRecherche infos, int debut, int fin, ImagesParTaxonCallback callback) {
38
	public void getImagesParTaxon(InformationsRecherche infos, int debut, int fin, ImagesParTaxonCallback callback) {
29
		RequestBuilder rb = new RequestBuilder(RequestBuilder.GET, serverUrl + "Images" + assemblerChaineRequete(infos, debut, fin));
39
		RequestBuilder rb = new RequestBuilder(RequestBuilder.GET, baseUrl + "Images" + assemblerChaineRequete(infos, debut, fin));
Line 30... Line 40...
30
		try {
40
		try {
31
			rb.sendRequest(null, callback);
41
			rb.sendRequest(null, callback);
32
		} catch (Exception e) {
42
		} catch (Exception e) {
33
			// TODO: handle exception
43
			// TODO: handle exception
34
		}
44
		}
35
	}
45
	}
36
 
46
 
37
	public void getImagesParObservation(String observationId, ImagesParTaxonCallback callback) {
47
	public void getImagesParObservation(String observationId, ImagesParTaxonCallback callback) {