Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 7 Rev 642
Line 1... Line 1...
1
package org.tela_botanica.client;
1
package org.tela_botanica.client;
Line -... Line 2...
-
 
2
 
-
 
3
import org.tela_botanica.client.modeles.Observation;
2
 
4
 
Line 3... Line 5...
3
public class Util {
5
public class Util {
4
 
6
 
Line 5... Line 7...
5
	public Util() {
7
	public Util() {
6
	}
8
	}
7
 
9
 
8
	public static String toCelString(String str) {
10
	public static String toCelString(String str) {
-
 
11
		return str.substring(1, str.length() - 1);
-
 
12
		//
-
 
13
	}
-
 
14
	
-
 
15
	public static String formaterLieu(Observation obs, String modeleLieu) {
-
 
16
		
-
 
17
		String lieuModele = modeleLieu;
-
 
18
		
-
 
19
		String commune = obs.getLocalite(); 
-
 
20
		String lieuDit = obs.getLieudit();
-
 
21
		String station = obs.getStation();
-
 
22
		
-
 
23
		String lieuCommuneFormate = "";
-
 
24
		String lieuDitFormate = "";
-
 
25
		String stationFormatee = "";
-
 
26
		
-
 
27
		if(commune != null && !commune.contains("000null") && !commune.trim().equals("")) {
-
 
28
			String	idLoc =obs.getIdentifiantLocalite().replaceAll(" ","/");
-
 
29
			if(idLoc != null && !idLoc.contains("000null") && !idLoc.trim().equals("")) {
-
 
30
 
-
 
31
				idLoc = idLoc.replaceAll("%","");
-
 
32
				idLoc = idLoc.replaceAll("\"","");
-
 
33
				idLoc = idLoc.replace('\\',' ');
-
 
34
				idLoc = idLoc.trim();
-
 
35
				lieuCommuneFormate += idLoc+" - ";
-
 
36
			}
-
 
37
			lieuCommuneFormate += commune;
-
 
38
			lieuModele = lieuModele.replaceAll("IDLOCCOMMUNE", lieuCommuneFormate);
-
 
39
		} else {
-
 
40
			
-
 
41
			lieuModele = lieuModele.replaceAll("IDLOCCOMMUNE,", lieuCommuneFormate);
-
 
42
		}
-
 
43
		
-
 
44
		if(lieuDit != null && !lieuDit.contains("000null") && !lieuDit.trim().equals("")) {
-
 
45
			lieuDitFormate += lieuDit;
-
 
46
			lieuModele = lieuModele.replaceAll("LIEUDIT", lieuDitFormate);
-
 
47
		} else {
-
 
48
			lieuModele = lieuModele.replaceAll("LIEUDIT,", lieuDitFormate);
-
 
49
		}
-
 
50
		
-
 
51
		if(station != null && !station.contains("000null") && !station.trim().equals("")) {
-
 
52
			stationFormatee += station;
-
 
53
			lieuModele = lieuModele.replaceAll("STATION", stationFormatee);
-
 
54
		} else {
-
 
55
			lieuModele = lieuModele.replaceAll("STATION", stationFormatee);
-
 
56
		}
-
 
57
		
-
 
58
		lieuModele = lieuModele.trim();
-
 
59
		lieuModele = lieuModele.replaceAll(",$","");
-
 
60
		lieuModele = lieuModele.replaceAll(",^$",", ");
-
 
61
		
-
 
62
		return lieuModele;
-
 
63
	}
-
 
64
	
9
		return str.substring(1, str.length() - 1);
65
	public static String supprimerNumDepartementChaineLocalite(String chaineLocaliteComplete) {