8,11 → 8,8 |
import org.tela_botanica.client.http.JsonRestRequestCallback; |
import org.tela_botanica.client.interfaces.Rafraichissable; |
import org.tela_botanica.client.modeles.Information; |
import org.tela_botanica.client.modeles.projet.Projet; |
import org.tela_botanica.client.modeles.projet.ProjetListe; |
import org.tela_botanica.client.modeles.structure.StructureListe; |
import org.tela_botanica.client.synchronisation.Reponse; |
import org.tela_botanica.client.util.Debug; |
import org.tela_botanica.client.util.Log; |
import org.tela_botanica.client.util.UtilDAO; |
|
import com.extjs.gxt.ui.client.Registry; |
28,7 → 25,7 |
private Rafraichissable vueARafraichir = null; |
|
public PublicationAsyncDao(Rafraichissable vueARafraichirCourrante) { |
if (Mediateur.DEBUG) System.out.println("|| PublicationAsyncDao > vueARafraichir = "+vueARafraichirCourrante.getClass().toString()); |
Log.trace("|| PublicationAsyncDao > vueARafraichir = "+vueARafraichirCourrante.getClass().toString()); |
vueARafraichir = vueARafraichirCourrante ; |
utilisateurId = ((Mediateur) Registry.get(RegistreId.MEDIATEUR)).getUtilisateurId(); |
} |
55,56 → 52,39 |
restrictions.put("limit", String.valueOf(nbElements)); |
} |
|
/** GESTION DE LA REQUETE dans le cas d'une liste paginée progressive **/ |
if (paginationProgressive) { |
|
/** DEFINITION DU TUPLE DE DEPART **/ |
// GESTION DE LA REQUETE dans le cas d'une liste paginée progressive |
restrictions.put("start", String.valueOf(start)); |
|
/** CONSTRUCTION DE LA REQUETE **/ |
final JsonRestRequestBuilder rb = UtilDAO.construireRequete(SERVICE_NOM, param, restrictions); |
|
/** ENVOI DE LA REQUETE **/ |
rb.envoyerRequete(null, new JsonRestRequestCallback() |
{ |
rb.envoyerRequete(null, new JsonRestRequestCallback() { |
/** RECEPTION DE LA REPONSE **/ |
public void surReponse(JSONValue responseValue) |
{ |
public void surReponse(JSONValue responseValue) { |
/** Dans le cas d'une liste paginée, vueARafraichir est un objet Proxy. |
* On retourne l'objet JSON au proxy afin que ce soit lui qui le traite **/ |
if (seqId != null) { |
if (Mediateur.DEBUG) System.out.println("<-- PublicationAsyncDao > Liste paginée, retour au sequenceur"); |
if (seqId != null) { |
Log.trace("<-- PublicationAsyncDao > Liste paginée, retour au sequenceur"); |
Reponse reponseRequete = new Reponse(responseValue, seqId); |
vueARafraichir.rafraichir(reponseRequete); |
} |
else { |
if (Mediateur.DEBUG) System.out.println("<-- PublicationAsyncDao > Liste paginée, retour à "+vueARafraichir.getClass().toString()); |
} else { |
Log.trace("<-- PublicationAsyncDao > Liste paginée, retour à "+vueARafraichir.getClass().toString()); |
vueARafraichir.rafraichir(responseValue); |
} |
} |
}); |
} |
/** GESTION DE LA REQUETE dans le cas d'une liste NON paginée progressive **/ |
else { |
|
/** DEFINITION DU TUPLE DE DEPART **/ |
} else { |
// GESTION DE LA REQUETE dans le cas d'une liste NON paginée progressive |
restrictions.put("start", String.valueOf(start*nbElements)); |
|
final JsonRestRequestBuilder rb = UtilDAO.construireRequete(SERVICE_NOM, param, restrictions); |
|
rb.envoyerRequete(null, new JsonRestRequestCallback() { |
|
public void surReponse(JSONValue responseValue) { |
|
if (responseValue != null) { |
|
if (responseValue != null) { |
JSONObject responseObject = responseValue.isObject(); |
|
if (responseObject != null) { |
|
// Si la réponse est un tableau, alors c'est une liste de projets qui a été retournée |
if (responseObject.get("publications").isArray() != null) { |
|
JSONArray reponse = responseObject.get("publications").isArray(); |
|
PublicationListe publications; |
136,7 → 116,7 |
} |
} |
} else { |
GWT.log(rb.getUrl()+"\n\tLa réponse n'est pas un objet ou un tableau JSON et vaut : "+responseValue.toString(), null); |
Log.warn(rb.getUrl()+"\n\tLa réponse n'est pas un objet ou un tableau JSON et vaut : "+responseValue.toString()); |
} |
} else { |
if (publicationId == null) { |