Subversion Repositories eFlore/Applications.del

Rev

Rev 1053 | Rev 1104 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1053 Rev 1062
Line 24... Line 24...
24
import com.google.gwt.i18n.client.DateTimeFormat;
24
import com.google.gwt.i18n.client.DateTimeFormat;
25
import com.google.gwt.json.client.JSONArray;
25
import com.google.gwt.json.client.JSONArray;
26
import com.google.gwt.json.client.JSONObject;
26
import com.google.gwt.json.client.JSONObject;
27
import com.google.gwt.json.client.JSONParser;
27
import com.google.gwt.json.client.JSONParser;
28
import com.google.gwt.json.client.JSONValue;
28
import com.google.gwt.json.client.JSONValue;
29
import com.google.gwt.user.client.Window;
-
 
Line 30... Line 29...
30
 
29
 
31
/**
30
/**
32
 * Centralisation des methodes de parsing du code JSON retourné par les
31
 * Centralisation des methodes de parsing du code JSON retourné par les
33
 * webservices
32
 * webservices
Line 92... Line 91...
92
 
91
 
93
		if (propositions != null && propositions.isObject() != null) {
92
		if (propositions != null && propositions.isObject() != null) {
94
			List<InterventionForum> interventions = parserInterventions(propositions.isObject());
93
			List<InterventionForum> interventions = parserInterventions(propositions.isObject());
95
			for (InterventionForum interventionForum : interventions) {
94
			for (InterventionForum interventionForum : interventions) {
96
				interventionForum.setObservation(observation);			
95
				interventionForum.setObservation(observation);
-
 
96
				// Si une proposition avec le même nom retenu que l'observation
97
				// Si une proposition avec le même nom retenu que l'observation est déjà présente,
97
				// est déjà présente,
-
 
98
				// alors il n'est pas nécessaire de créer la proposition
98
				// alors il n'est pas nécessaire de créer la proposition "factice"
99
				// "factice"
99
				if(interventionForum instanceof PropositionDetermination) {
100
				if (interventionForum instanceof PropositionDetermination) {
100
					PropositionDetermination proposition = (PropositionDetermination)interventionForum;
101
					PropositionDetermination proposition = (PropositionDetermination) interventionForum;
101
					if(!nomRetenu.equals("") && proposition.getEspece().equals(nomRetenu)) {
102
					if (!nomRetenu.equals("") && proposition.getEspece().equals(nomRetenu)) {
102
						creerPropositionAPartirObs = false;
103
						creerPropositionAPartirObs = false;
Line 105... Line 106...
105
			}
106
			}
106
			observation.setInterventionsForum(interventions);
107
			observation.setInterventionsForum(interventions);
107
		}
108
		}
Line 108... Line 109...
108
		
109
 
109
		if(creerPropositionAPartirObs) {
110
		if (creerPropositionAPartirObs) {
-
 
111
			// Si elle est nécessaire, la proposition factice est ajoutée au
110
			// Si elle est nécessaire, la proposition factice est ajoutée au début
112
			// début
111
			observation.getInterventionsForum().add(0, creerPropositionDeterminationAPartirObservation(observation));
113
			observation.getInterventionsForum().add(0, creerPropositionDeterminationAPartirObservation(observation));
112
		}
114
		}
113
		return observation;
115
		return observation;
Line 237... Line 239...
237
			String idParent = intervention.getIdParent();
239
			String idParent = intervention.getIdParent();
238
			if (idParent != null && !idParent.equals("") && !idParent.equals("0") && interventionsNonTypees.containsKey(idParent)) {
240
			if (idParent != null && !idParent.equals("") && !idParent.equals("0") && interventionsNonTypees.containsKey(idParent)) {
239
				InterventionForum parent = interventionsNonTypees.get(idParent);
241
				InterventionForum parent = interventionsNonTypees.get(idParent);
240
				intervention.setParent(parent);
242
				intervention.setParent(parent);
241
				parent.ajouterCommentaire((Commentaire)intervention);
243
				parent.ajouterCommentaire((Commentaire) intervention);
242
			}
-
 
243
			else{
244
			} else {
244
				retour.add(intervention);
245
				retour.add(intervention);
245
			}
246
			}
246
		}
247
		}
Line 247... Line 248...
247
 
248
 
Line 468... Line 469...
468
		// TODO ajouter vérifications plus précises
469
		// TODO ajouter vérifications plus précises
469
		if (retourJson.isObject().get("entete") != null) {
470
		if (retourJson.isObject().get("entete") != null) {
470
			double total = retourJson.isObject().get("entete").isObject().get("total").isNumber().doubleValue();
471
			double total = retourJson.isObject().get("entete").isObject().get("total").isNumber().doubleValue();
471
			nbTotalImagesPourLaRecherche = (int) total;
472
			nbTotalImagesPourLaRecherche = (int) total;
472
			JSONObject tableauImg = retourJson.isObject().get("resultats").isObject();
473
			JSONObject tableauImg = retourJson.isObject().get("resultats").isObject();
-
 
474
			if (tableauImg != null) {
473
			java.util.Iterator<String> it = tableauImg.keySet().iterator();
475
				java.util.Iterator<String> it = tableauImg.keySet().iterator();
474
			while (it.hasNext()) {
476
				while (it.hasNext()) {
475
				JSONObject imageJson = tableauImg.get(it.next()).isObject();
477
					JSONObject imageJson = tableauImg.get(it.next()).isObject();
476
				Image image = parserRetourImage(imageJson);
478
					Image image = parserRetourImage(imageJson);
477
				images.add(image);
479
					images.add(image);
478
			}
480
				}
-
 
481
			}
Line 479... Line 482...
479
 
482
 
480
		} else {
483
		} else {
481
			JSONArray tableauImg = retourJson.isObject().get("images").isArray();
484
			JSONArray tableauImg = retourJson.isObject().get("images").isArray();
482
			nbTotalImagesPourLaRecherche = (int) tableauImg.size();
485
			nbTotalImagesPourLaRecherche = (int) tableauImg.size();