Subversion Repositories eFlore/Applications.coel

Compare Revisions

Ignore whitespace Rev 237 → Rev 238

/trunk/src/org/tela_botanica/client/modeles/Personne.java
47,13 → 47,17
}
public String getNom() {
return (String) renvoyerValeurCorrecte("cp_nom");
return (String) renvoyerValeurCorrecte("nom");
}
public String getPrenom() {
return (String) renvoyerValeurCorrecte("cp_prenom");
return (String) renvoyerValeurCorrecte("prenom");
}
public String getNomComplet() {
return (String) renvoyerValeurCorrecte("fmt_nom_complet");
}
public Object obtenirValeurChamp(String nomChamp) {
return renvoyerValeurCorrecte(nomChamp);
}
/trunk/src/org/tela_botanica/client/modeles/PublicationListeAsyncDao.java
5,6 → 5,7
import org.tela_botanica.client.interfaces.Rafraichissable;
 
import com.extjs.gxt.ui.client.Registry;
import com.google.gwt.core.client.GWT;
import com.google.gwt.http.client.Request;
import com.google.gwt.http.client.RequestBuilder;
import com.google.gwt.http.client.RequestCallback;
11,6 → 12,7
import com.google.gwt.http.client.RequestException;
import com.google.gwt.http.client.Response;
import com.google.gwt.json.client.JSONArray;
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.json.client.JSONParser;
import com.google.gwt.json.client.JSONValue;
import com.google.gwt.user.client.Window;
44,8 → 46,8
final JSONValue responseValue = JSONParser.parse(response.getText());
// Si la requête est un succès, reception d'un tableau
if (responseValue.isArray() != null) {
final JSONArray reponse = responseValue.isArray();
if (responseValue.isObject() != null) {
final JSONObject reponse = responseValue.isObject();
// Transformation du tableau JSON réponse en ListeInstitution
publications = new PublicationListe(reponse);
// et on met à jour le demandeur des données
85,7 → 87,7
// Si la requête est un succès, reception d'un tableau
if (responseValue.isArray() != null) {
final JSONArray reponse = responseValue.isArray();
final JSONObject reponse = responseValue.isObject();
// Transformation du tableau JSON réponse en ListeInstitution
publications = new PublicationListe(reponse);
// et on met à jour le demandeur des données
124,8 → 126,8
final JSONValue responseValue = JSONParser.parse(response.getText());
// Si la requête est un succès, reception d'un tableau
if (responseValue.isArray() != null) {
final JSONArray reponse = responseValue.isArray();
if (responseValue.isObject() != null) {
final JSONObject reponse = responseValue.isObject();
// Transformation du tableau JSON réponse en ListeInstitution
publications = new PublicationListe(reponse);
// et on met à jour le demandeur des données
146,4 → 148,46
}
 
public void supprimerPublication(Modele modele, String utilisateurId,
String idPubs) {
String url = ((Configuration) Registry.get(RegistreId.CONFIG)).getServiceBaseUrl();
RequestBuilder rb = new RequestBuilder(RequestBuilder.POST, url+"CoelPublicationListe/"+utilisateurId+"/"+idPubs);
 
try {
rb.sendRequest("action=DELETE", new RequestCallback() {
 
public void onError(Request request, Throwable exception) {
GWT.log("Erreur dans la requête de suppression", exception);
 
}
 
public void onResponseReceived(Request request, Response response) {
Boolean defaut = true;
if (response.getText().length() != 0 && response.getText() != null) {
final JSONValue responseValue = JSONParser.parse(response.getText());
// Si la requête est un succès, reception d'un tableau
if (responseValue.isObject() != null) {
final JSONObject reponse = responseValue.isObject();
// Transformation du tableau JSON réponse en ListeInstitution
publications = new PublicationListe(reponse);
// et on met à jour le demandeur des données
rafraichissement.rafraichir(publications);
// Tout c'est bien déroulé, on courcircuite l'affichage par défaut
defaut = false;
}
}
if (defaut == true) {
publications = new PublicationListe(0);
rafraichissement.rafraichir(publications);
}
}
});
} catch (RequestException e) {
e.printStackTrace();
}
}
 
}
/trunk/src/org/tela_botanica/client/modeles/Publication.java
137,6 → 137,10
return (String) renvoyerValeurCorrecte("ce_meta");
}
public String getIdAuteur() {
return (String) renvoyerValeurCorrecte("id_personne");
}
public String toReqString() {
String reqString = "" ;
/trunk/src/org/tela_botanica/client/modeles/PublicationListe.java
1,9 → 1,11
package org.tela_botanica.client.modeles;
 
import java.util.Iterator;
import java.util.LinkedHashMap;
 
import com.google.gwt.json.client.JSONArray;
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.user.client.Window;
 
public class PublicationListe extends LinkedHashMap<String, Publication> {
 
20,14 → 22,11
* Constructeur pour une liste d'institutions
* @param dates
*/
public PublicationListe(JSONArray publications)
public PublicationListe(JSONObject publications)
{
super(publications.size()) ;
final int taillemax = publications.size();
for (int i = 0; i < taillemax; i++) {
JSONObject publicationCourante = publications.get(i).isObject() ;
for (Iterator<String> it = publications.keySet().iterator() ; it.hasNext();) {
JSONObject publicationCourante = publications.get(it.next()).isObject() ;
if (publicationCourante != null) {
Publication publication = new Publication(publicationCourante);
this.put(publication.getId(), publication);