Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 683 Rev 965
Line 7... Line 7...
7
import org.tela_botanica.client.interfaces.Rafraichissable;
7
import org.tela_botanica.client.interfaces.Rafraichissable;
8
import org.tela_botanica.client.modeles.EntiteGeographiqueObservation;
8
import org.tela_botanica.client.modeles.EntiteGeographiqueObservation;
9
import org.tela_botanica.client.modeles.ListeEntiteGeographiqueObservation;
9
import org.tela_botanica.client.modeles.ListeEntiteGeographiqueObservation;
10
import org.tela_botanica.client.modeles.Observation;
10
import org.tela_botanica.client.modeles.Observation;
11
import org.tela_botanica.client.observation.ObservationMediateur;
11
import org.tela_botanica.client.observation.ObservationMediateur;
-
 
12
import org.tela_botanica.client.util.Util;
Line 12... Line 13...
12
 
13
 
13
import com.google.gwt.core.client.GWT;
14
import com.google.gwt.core.client.GWT;
14
import com.google.gwt.user.client.Window;
15
import com.google.gwt.user.client.Window;
15
import com.gwtext.client.data.Node;
16
import com.gwtext.client.data.Node;
Line 193... Line 194...
193
				else 
194
				else 
194
				{
195
				{
195
					observationMediateur.obtenirNombreObservation() ;
196
					observationMediateur.obtenirNombreObservation() ;
196
				}
197
				}
197
				return ;
198
				return ;
198
			case 4: nomFiltre += "station,lieudit,location,id_location";
199
			case 4: nomFiltre += "station,lieudit,commune,departement";
199
			nomPere = ((String[])node.getParentNode().getUserObject())[0] ;
200
			nomPere = ((String[])node.getParentNode().getUserObject())[0] ;
200
			nomGrandPere = ((String[])node.getParentNode().getParentNode().getUserObject())[0] ;
201
			nomGrandPere = ((String[])node.getParentNode().getParentNode().getUserObject())[0] ;
201
			nomArriereGrandPere = ((String[])node.getParentNode().getParentNode().getParentNode().getUserObject())[0] ;
202
			nomArriereGrandPere = ((String[])node.getParentNode().getParentNode().getParentNode().getUserObject())[0] ;
202
			entitesGeographiquesEncours += node.getText()+","+nomPere+","+nomGrandPere+","+nomArriereGrandPere ;
203
			entitesGeographiquesEncours += node.getText()+","+nomPere+","+nomGrandPere+","+nomArriereGrandPere ;
203
			break;
204
			break;
204
			case 3: nomFiltre += "lieudit,location,id_location";
205
			case 3: nomFiltre += "lieudit,commune,departement";
205
				nomPere = ((String[])node.getParentNode().getUserObject())[0] ;
206
				nomPere = ((String[])node.getParentNode().getUserObject())[0] ;
206
				nomGrandPere = ((String[])node.getParentNode().getParentNode().getUserObject())[0] ;
207
				nomGrandPere = ((String[])node.getParentNode().getParentNode().getUserObject())[0] ;
207
				entitesGeographiquesEncours += node.getText()+","+nomPere+","+nomGrandPere ;
208
				entitesGeographiquesEncours += node.getText()+","+nomPere+","+nomGrandPere ;
208
				break;
209
				break;
209
			case 2: nomFiltre += "location,id_location"; 
210
			case 2: nomFiltre += "commune,departement"; 
210
				nomPere = ((String[])node.getParentNode().getUserObject())[0] ;
211
				nomPere = ((String[])node.getParentNode().getUserObject())[0] ;
211
				entitesGeographiquesEncours += node.getText()+","+nomPere ;
212
				entitesGeographiquesEncours += node.getText()+","+nomPere ;
212
				break;
213
				break;
213
			case 1: nomFiltre += "id_location"; 
214
			case 1: nomFiltre += "departement"; 
214
				entitesGeographiquesEncours += node.getText() ;
215
				entitesGeographiquesEncours += node.getText() ;
215
				break;
216
				break;
216
			default: 
217
			default: 
217
				break;
218
				break;
218
		}
219
		}
Line 496... Line 497...
496
	 * @param ent l'entité géographique qui doit être décomposée en arborescence
497
	 * @param ent l'entité géographique qui doit être décomposée en arborescence
497
	 * @return
498
	 * @return
498
	 */
499
	 */
499
	private void creerHierarchieNoeud(Tree arbre, TreeNode root, EntiteGeographiqueObservation ent) {
500
	private void creerHierarchieNoeud(Tree arbre, TreeNode root, EntiteGeographiqueObservation ent) {
Line 500... Line 501...
500
		
501
		
501
		String idLocation=null;
502
		String id_zone_geo=null;
502
		String location=null;
503
		String zone_geo=null;
503
		String lieuDit=null;
504
		String lieuDit=null;
Line -... Line 505...
-
 
505
		String station=null;
-
 
506
		
Line 504... Line -...
504
		String station=null;
-
 
505
		
507
		// TODO creer une fonction plus efficace lors du passage au multi reférentiel
506
		
508
		id_zone_geo = Util.convertirChaineZoneGeoVersDepartement(ent.getIdZoneGeo());
507
		idLocation=ent.getIdLocalite();
509
		
508
		idLocation = idLocation.replaceAll("\"", "");
510
		id_zone_geo = id_zone_geo.replaceAll("\"", "");
509
		idLocation = idLocation.replace('\\',' ');
511
		id_zone_geo = id_zone_geo.replace('\\',' ');
510
		idLocation = idLocation.trim();
512
		id_zone_geo = id_zone_geo.trim();
Line 511... Line 513...
511
		location=ent.getCommune();
513
		zone_geo = ent.getZoneGeo();
512
		lieuDit=ent.getLieuDit();
514
		lieuDit = ent.getLieuDit();
513
		station=ent.getStation();
515
		station = ent.getStation();
Line 514... Line 516...
514
		
516
		
515
		if(idLocation.contains("000null") || idLocation.equals(null) || (idLocation.trim()).equals("")) {
517
		if(id_zone_geo.contains("000null") || id_zone_geo.equals(null) || (id_zone_geo.trim()).equals("")) {
516
			idLocation="Inconnue" ;
518
			id_zone_geo="Inconnue" ;
Line 517... Line 519...
517
		}
519
		}
518
		
520
		
519
		if(location.contains("000null") || location.equals(null) || (location.trim().equals(""))) {
521
		if(zone_geo.contains("000null") || zone_geo.equals(null) || (zone_geo.trim().equals(""))) {
Line 520... Line 522...
520
			location="Inconnue" ;
522
			zone_geo="Inconnue" ;
521
		}
523
		}
522
		
524
		
Line 523... Line 525...
523
		if(lieuDit.contains("000null") || lieuDit.equals(null) || (lieuDit.trim().equals(""))) {
525
		if(lieuDit.contains("000null") || lieuDit.equals(null) || (lieuDit.trim().equals(""))) {
524
			lieuDit="Inconnue" ;
526
			lieuDit="Inconnue" ;
525
		}
527
		}
526
		
528
		
527
		if(station.contains("000null") || station.equals(null) || (station.trim().equals(""))) {
529
		if(station.contains("000null") || station.equals(null) || (station.trim().equals(""))) {
528
			station="Inconnue" ;
530
			station="Inconnue" ;
Line 529... Line 531...
529
		}
531
		}
530
		
532
		
531
		Node noeudMemeId = arbre.getNodeById(""+idLocation);		
533
		Node noeudMemeId = arbre.getNodeById(""+id_zone_geo);		
532
		if(noeudMemeId == null) {
534
		if(noeudMemeId == null) {
533
			// on crée le noeud de l'identifiant location
535
			// on crée le noeud de l'identifiant zone_geo
534
			noeudMemeId = creerNoeud(""+idLocation,idLocation);
536
			noeudMemeId = creerNoeud(""+id_zone_geo,id_zone_geo);
535
			root.appendChild(noeudMemeId) ;
537
			root.appendChild(noeudMemeId) ;
536
		}
538
		}
Line 537... Line 539...
537
		
539
		
538
		// on teste si la localité existe
540
		// on teste si la localité existe
539
		Node noeudMemeLoc = arbre.getNodeById(""+(idLocation+location));
541
		Node noeudMemeLoc = arbre.getNodeById(""+(id_zone_geo+zone_geo));
540
		if(noeudMemeLoc == null)
542
		if(noeudMemeLoc == null)
541
		{
543
		{
542
			//  on crée le noeud de la location
544
			//  on crée le noeud de la zone_geo
543
			noeudMemeLoc = creerNoeud(""+idLocation+location, location);							
545
			noeudMemeLoc = creerNoeud(""+id_zone_geo+zone_geo, zone_geo);							
544
			noeudMemeId.appendChild(noeudMemeLoc) ;
546
			noeudMemeId.appendChild(noeudMemeLoc) ;
Line 545... Line 547...
545
		}
547
		}
546
		
548
		
547
		// on teste si le lieu dit existe
549
		// on teste si le lieu dit existe
548
		Node noeudMemeLieu = arbre.getNodeById(""+(idLocation+location+lieuDit));
550
		Node noeudMemeLieu = arbre.getNodeById(""+(id_zone_geo+zone_geo+lieuDit));
549
		if(noeudMemeLieu == null)
551
		if(noeudMemeLieu == null)
550
		{
552
		{
551
			// on crée le noeud du lieu dit
553
			// on crée le noeud du lieu dit
Line 552... Line 554...
552
			noeudMemeLieu = creerNoeud(idLocation+location+lieuDit, lieuDit);	
554
			noeudMemeLieu = creerNoeud(id_zone_geo+zone_geo+lieuDit, lieuDit);	
553
			noeudMemeLoc.appendChild(noeudMemeLieu) ;
555
			noeudMemeLoc.appendChild(noeudMemeLieu) ;
Line 605... Line 607...
605
	
607
	
Line 606... Line 608...
606
	private int calculerProfondeurPourNomFiltre(String nom) {
608
	private int calculerProfondeurPourNomFiltre(String nom) {
Line 607... Line 609...
607
		
609
		
608
		int profondeur = 0;
610
		int profondeur = 0;
609
		
611
		
Line 610... Line 612...
610
		if(nom.equals("id_location")) {
612
		if(nom.equals("departement")) {
611
			profondeur = 1;
613
			profondeur = 1;
612
		}
614
		}
Line 613... Line 615...
613
		
615
		
614
		if(nom.equals("location")) {
616
		if(nom.equals("commune")) {