Subversion Repositories eFlore/Applications.del

Compare Revisions

Regard whitespace Rev 925 → Rev 926

/trunk/src/org/tela_botanica/del/client/utils/UtilitairesServiceResultat.java
43,8 → 43,7
public static Observation parserObservationJSON(JSONObject observationJson) {
Observation observation = new Observation();
observation.setAuteur(getValeurOuVide(observationJson, "auteur.prenom")+
" "+getValeurOuVide(observationJson,"auteur.nom"));
observation.setAuteur(getValeurOuVide(observationJson, "auteur.prenom") + " " + getValeurOuVide(observationJson, "auteur.nom"));
observation.setNomAuteur(getValeurOuVide(observationJson,"auteur.nom"));
observation.setPrenomAuteur(getValeurOuVide(observationJson,"auteur.nom"));
observation.setIdAuteur(getValeurOuVide(observationJson,"auteur.id"));
61,7 → 60,8
observation.setLieuDit(getValeurOuVide(observationJson, "lieudit"));
observation.setNumNomenclatural(getValeurOuVide(observationJson, "determination.nn"));
//TODO: renvoyer les mots clés des observations
//observation.setMotsClefs(parserMotsCles(UtilitairesServiceResultat.getValeurOuVide(observationJson, "mots_cles_texte")));
// observation.setMotsClefs(parserMotsCles(UtilitairesServiceResultat.getValeurOuVide(observationJson,
// "mots_cles_texte")));
JSONValue propositions = observationJson.get("commentaires");
if(propositions != null && propositions.isObject() != null) {
73,10 → 73,27
return observation;
}
public static List<Commentaire> parserCommentaires(JSONObject commentaires, Observation observation) {
List<InterventionForum> interventionForums = parserInterventions(commentaires, observation);
List<Commentaire> commentairesListe = new ArrayList<Commentaire>();
for (InterventionForum interventionForum : interventionForums) {
if (interventionForum instanceof Commentaire) {
commentairesListe.add((Commentaire) interventionForum);
}
}
return commentairesListe;
 
}
 
public static List<InterventionForum> parserInterventions(JSONObject interventions, Observation observation) {
HashMap<String, InterventionForum> interventionsNonTypees = new HashMap<String, InterventionForum>();
List<InterventionForum> retour = new ArrayList<InterventionForum>();
//parcourir les interventions et en faire un tableau
if(interventions==null){
return retour;
}
Iterator<String> itInterventions = interventions.keySet().iterator();
while (itInterventions.hasNext()) {
JSONObject jsonIntervention = interventions.get(itInterventions.next()).isObject();
124,7 → 141,6
intervention.setDate(date);
interventionsNonTypees.put(intervention.getId(), intervention);
} else {
Commentaire intervention = new Commentaire(contributeur, date, texte);
intervention.setId(id);
147,7 → 163,7
}
}
List<InterventionForum> retour = new ArrayList<InterventionForum>();
retour.addAll(interventionsNonTypees.values());
return retour;
}
205,13 → 221,8
vd.setVote(Integer.parseInt(getValeurOuVide(vote, "vote")));
vd.setContributeur(getValeurOuVide(vote, "auteur.id"));
if(vote.get("auteur.nom") != null &&
vote.get("auteur.nom") != null &&
vote.get("auteur.courriel") != null) {
Contributeur auteur = new Contributeur(getValeurOuVide(vote, "auteur.id"),
getValeurOuVide(vote, "auteur.nom"),
getValeurOuVide(vote, "auteur.prenom"),
getValeurOuVide(vote, "auteur.courriel"));
if (vote.get("auteur.nom") != null && vote.get("auteur.nom") != null && vote.get("auteur.courriel") != null) {
Contributeur auteur = new Contributeur(getValeurOuVide(vote, "auteur.id"), getValeurOuVide(vote, "auteur.nom"), getValeurOuVide(vote, "auteur.prenom"), getValeurOuVide(vote, "auteur.courriel"));
vd.setAuteur(auteur);
}