/trunk/src/org/tela_botanica/client/modeles/aDonnee.java |
---|
Property changes: |
Modified: svn:mergeinfo |
Merged /trunk/src/org/tela_botanica/client/modeles/aDonnee.java:r11-68 |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/aDonnee.java:r1417-1511 |
/trunk/src/org/tela_botanica/client/modeles/personne/Personne.java |
---|
7,6 → 7,7 |
import org.tela_botanica.client.Mediateur; |
import org.tela_botanica.client.modeles.aDonnee; |
import org.tela_botanica.client.modeles.collection.CollectionAPublication; |
import org.tela_botanica.client.modeles.publication.PublicationAPersonneListe; |
import org.tela_botanica.client.util.Debug; |
import org.tela_botanica.client.util.UtilString; |
21,6 → 22,7 |
private static final long serialVersionUID = -6974716696155349332L; |
public static final String PREFIXE = "cp"; |
private boolean removePrefix = true; |
public static final String TELEPHONE_FIXE = "FIX"; |
public static final String TELEPHONE_GSM = "GSM"; |
public static final String TELEPHONE_FAX = "FAX"; |
33,8 → 35,18 |
public Personne() { |
} |
public Personne(ModelData model) |
{ |
public Personne(ModelData model) { |
creerPersonne(model, false); |
} |
public Personne(ModelData model, boolean removePrefix) { |
creerPersonne(model, removePrefix); |
} |
private void creerPersonne(ModelData model, boolean removePrefix) { |
this.removePrefix = removePrefix; |
Map<String, Object> a = model.getProperties(); |
Set<String> cles = a.keySet(); |
42,11 → 54,17 |
while (it.hasNext()) { |
String cle = it.next(); |
if (a.get(cle) != null) { |
String cleObjet = cle.replaceFirst("^"+getPrefixe()+"_", ""); |
String cleObjet = ""; |
if (removePrefix) { |
cleObjet = cleObjet.replaceFirst("^"+PREFIXE+"_", ""); |
} |
else { |
cleObjet = cle; |
} |
this.set(cleObjet, a.get(cle)); |
} |
} |
} |
} |
public Personne(JSONObject personne) { |
initialiserModele(personne); |
116,10 → 134,12 |
// ID PERSONNE |
public String getId() { |
return renvoyerValeurCorrecte("id_personne"); |
if (removePrefix) return renvoyerValeurCorrecte("id_personne"); |
else return renvoyerValeurCorrecte(PREFIXE+"_id_personne"); |
} |
public void setId(String personneId) { |
this.set("id_personne", personneId); |
if (removePrefix) this.set("id_personne", personneId); |
else this.set(PREFIXE+"_id_personne", personneId); |
} |
// ID PROJET |
158,18 → 178,22 |
// NOM |
public String getNom() { |
return renvoyerValeurCorrecte("nom"); |
if (removePrefix) return renvoyerValeurCorrecte("nom"); |
else return renvoyerValeurCorrecte(PREFIXE+"_nom"); |
} |
public void setNom(String nom) { |
set("nom", nom); |
if (removePrefix) set("nom", nom); |
else set(PREFIXE+"_nom", nom); |
} |
// PRÉNOM |
public String getPrenom() { |
return renvoyerValeurCorrecte("prenom"); |
if (removePrefix) return renvoyerValeurCorrecte("prenom"); |
else return renvoyerValeurCorrecte(PREFIXE+"_prenom"); |
} |
public void setPrenom(String prenom) { |
set("prenom", prenom); |
if (removePrefix) set("prenom", prenom); |
else set(PREFIXE+"_prenom", prenom); |
} |
// TÉLÉPHONE |
Property changes: |
Modified: svn:mergeinfo |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/personne/Personne.java:r1417-1511 |
Merged /trunk/src/org/tela_botanica/client/modeles/personne/Personne.java:r11-934 |
/trunk/src/org/tela_botanica/client/modeles/personne/PersonneListe.java |
---|
Property changes: |
Modified: svn:mergeinfo |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/personne/PersonneListe.java:r1417-1511 |
Merged /trunk/src/org/tela_botanica/client/modeles/personne/PersonneListe.java:r11-934 |
/trunk/src/org/tela_botanica/client/modeles/personne/PersonneAsyncDao.java |
---|
Property changes: |
Modified: svn:mergeinfo |
Merged /trunk/src/org/tela_botanica/client/modeles/personne/PersonneAsyncDao.java:r11-934 |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/personne/PersonneAsyncDao.java:r1417-1511 |
/trunk/src/org/tela_botanica/client/modeles/aDonneeListe.java |
---|
Property changes: |
Modified: svn:mergeinfo |
Merged /trunk/src/org/tela_botanica/client/modeles/aDonneeListe.java:r11-362 |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/aDonneeListe.java:r1417-1511 |
/trunk/src/org/tela_botanica/client/modeles/Utilisateur.java |
---|
Property changes: |
Modified: svn:mergeinfo |
Merged /trunk/src/org/tela_botanica/client/modeles/Utilisateur.java:r11-60 |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/Utilisateur.java:r1417-1511 |
/trunk/src/org/tela_botanica/client/modeles/collection/UniteBase.java |
---|
Property changes: |
Modified: svn:mergeinfo |
Merged /trunk/src/org/tela_botanica/client/modeles/collection/UniteBase.java:r11-948 |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/collection/UniteBase.java:r1417-1511 |
/trunk/src/org/tela_botanica/client/modeles/collection/CollectionACommentaire.java |
---|
1,8 → 1,15 |
package org.tela_botanica.client.modeles.collection; |
import java.util.Iterator; |
import java.util.Map; |
import java.util.Set; |
import org.tela_botanica.client.modeles.aDonnee; |
import org.tela_botanica.client.modeles.commentaire.Commentaire; |
import org.tela_botanica.client.modeles.personne.Personne; |
import org.tela_botanica.client.modeles.publication.Publication; |
import com.extjs.gxt.ui.client.data.ModelData; |
import com.google.gwt.json.client.JSONObject; |
public class CollectionACommentaire extends aDonnee { |
9,6 → 16,7 |
private static final long serialVersionUID = 8751553802444398035L; |
public static final String PREFIXE = "ccac"; |
private boolean removePrefix = true; |
private Commentaire commentaireLiee = null; |
public static String[] champsObligatoires = {"cc_id_collection", "ccac_id_commentaire"}; |
24,6 → 32,34 |
initialiser(collectionACommentaireListe, chargerCommentaire); |
} |
public CollectionACommentaire(ModelData model, boolean removePrefix) |
{ |
this.removePrefix = removePrefix; |
Map<String, Object> a = model.getProperties(); |
Set<String> cles = a.keySet(); |
Iterator<String> it = cles.iterator(); |
while (it.hasNext()) { |
String cle = it.next(); |
if (a.get(cle) != null) { |
String cleObjet = ""; |
if (removePrefix) { |
cleObjet = cle.replaceFirst("^"+CollectionACommentaire.PREFIXE+"_", ""); |
cleObjet = cleObjet.replaceFirst("^"+Commentaire.PREFIXE+"_", ""); |
} |
else { |
cleObjet = cle; |
} |
this.set(cleObjet, a.get(cle)); |
} |
} |
setCommentaire(new Commentaire(model)); |
this.set("_etat_", a.get("_etat_")); |
this.set("_type_", a.get("_type_")); |
} |
@Override |
protected String getPrefixe() { |
return PREFIXE; |
Property changes: |
Modified: svn:mergeinfo |
Merged /trunk/src/org/tela_botanica/client/modeles/collection/CollectionACommentaire.java:r11-984 |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/collection/CollectionACommentaire.java:r1417-1511 |
/trunk/src/org/tela_botanica/client/modeles/collection/CollectionACommentaireListe.java |
---|
Property changes: |
Modified: svn:mergeinfo |
Merged /trunk/src/org/tela_botanica/client/modeles/collection/CollectionACommentaireListe.java:r11-984 |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/collection/CollectionACommentaireListe.java:r1417-1511 |
/trunk/src/org/tela_botanica/client/modeles/collection/CollectionACommentaireAsyncDao.java |
---|
1,5 → 1,7 |
package org.tela_botanica.client.modeles.collection; |
import java.util.HashMap; |
import org.tela_botanica.client.Mediateur; |
import org.tela_botanica.client.RegistreId; |
import org.tela_botanica.client.http.JsonRestRequestBuilder; |
14,6 → 16,7 |
import com.google.gwt.core.client.GWT; |
import com.google.gwt.http.client.URL; |
import com.google.gwt.json.client.JSONArray; |
import com.google.gwt.json.client.JSONObject; |
import com.google.gwt.json.client.JSONValue; |
public class CollectionACommentaireAsyncDao { |
30,52 → 33,100 |
utilisateurId = ((Mediateur) Registry.get(RegistreId.MEDIATEUR)).getUtilisateurId(); |
} |
public void selectionner(final String collectionId, final Integer seqId) { |
public void selectionner(final boolean paginationProgressive, final String collectionId, final String recherche, final int start, final int nbElements, final Integer seqId) { |
String[] parametres = {collectionId}; |
final JsonRestRequestBuilder rb = UtilDAO.construireRequete(SERVICE_NOM, parametres); |
HashMap<String, String> restrictions = new HashMap<String, String>(); |
if (nbElements != -1) { |
restrictions.put("limit", String.valueOf(nbElements)); |
} |
rb.envoyerRequete(null, new JsonRestRequestCallback() { |
@Override |
public void surReponse(JSONValue responseValue) { |
Information info = new Information("liste_collection_a_commentaire"); |
if (responseValue != null) { |
// Si la requête est un succès, reception d'un tableau |
if (responseValue.isArray() != null) { |
final JSONArray reponse = responseValue.isArray(); |
// Transformation du tableau JSON réponse en ListCommentaier |
CollectionACommentaireListe commentaires = new CollectionACommentaireListe(reponse); |
info.setDonnee(0, commentaires); |
// et on met à jour le demandeur des données |
if (seqId != null) { |
Reponse reponseRequete = new Reponse(info, seqId); |
vueARafraichir.rafraichir(reponseRequete); |
/** GESTION DE LA REQUETE dans le cas d'une liste paginée progressive **/ |
if (paginationProgressive) { |
/** DEFINITION DU TUPLE DE DEPART **/ |
restrictions.put("start", String.valueOf(start)); |
/** CONSTRUCTION DE LA REQUETE **/ |
final JsonRestRequestBuilder rb = UtilDAO.construireRequete(SERVICE_NOM, parametres, restrictions); |
/** ENVOI DE LA REQUETE **/ |
rb.envoyerRequete(null, new JsonRestRequestCallback() |
{ |
/** RECEPTION DE LA REPONSE **/ |
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("<-- CollectionACommentaireAsyncDao > Liste paginée, retour au sequenceur"); |
Reponse reponseRequete = new Reponse(responseValue, seqId); |
vueARafraichir.rafraichir(reponseRequete); |
} |
else { |
if (Mediateur.DEBUG) System.out.println("<-- CollectionACommentaireAsyncDao > 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 **/ |
restrictions.put("start", String.valueOf(start*nbElements)); |
final JsonRestRequestBuilder rb = UtilDAO.construireRequete(SERVICE_NOM, parametres, restrictions); |
rb.envoyerRequete(null, new JsonRestRequestCallback() { |
@Override |
public void surReponse(JSONValue responseValue) { |
Information info = new Information("liste_collection_a_commentaire"); |
if (responseValue != null) { |
JSONObject responseObject = responseValue.isObject(); |
if (responseObject != null) { |
// Si la réponse est un tableau, alors c'est une liste de collections qui a été retournée |
if (responseObject.get("collectionsACommentaire").isArray() != null) { |
final JSONArray reponse = responseObject.get("collectionsACommentaire").isArray(); |
// Transformation du tableau JSON réponse en ListeInstitution |
CollectionACommentaireListe publications = new CollectionACommentaireListe(reponse); |
info.setDonnee(0, publications); |
// et on met à jour le demandeur des données |
if (seqId != null) { |
if (Mediateur.DEBUG) System.out.println("<-- CollectionACommentaireAsyncDao > Liste non paginée, retour au sequenceur"); |
Reponse reponseRequete = new Reponse(info, seqId); |
vueARafraichir.rafraichir(reponseRequete); |
} |
else { |
if (Mediateur.DEBUG) System.out.println("<-- CollectionACommentaireAsyncDao > Liste non paginée, retour au sequenceur"); |
vueARafraichir.rafraichir(info); |
} |
// Si la réponse est un objet, alors c'est une unique collection qui a été retournée |
} else if (responseObject.get("collectionsACommentaire").isObject() != null) { |
GWT.log(rb.getUrl()+"\n\tLa réponse n'est pas un tableau JSON et vaut : "+responseValue.toString(), null); |
} |
} |
else { |
vueARafraichir.rafraichir(info); |
} |
} else { |
GWT.log(rb.getUrl()+"\n\tLa réponse n'est pas un talbeau JSON et vaut : "+responseValue.toString(), null); |
} |
} else { |
if (collectionId == null) { |
// Dans le cas, où nous demandons toutes les relations Collection à Commentaires et qu'il n'y en a pas, nous retournons un message d'information |
info.setMessage("Aucune relations entre la collection et les commentaires"); |
if (seqId != null) { |
Reponse reponseRequete = new Reponse(info, seqId); |
vueARafraichir.rafraichir(reponseRequete); |
} |
else { |
// Dans le cas, où nous demandons toutes les institutions et qu'il n'y en a pas, nous retournons un objet vide |
if (collectionId == null) { |
info.setMessage("Aucune relations entre la collection et les commentaires"); |
vueARafraichir.rafraichir(info); |
} |
} |
} |
} |
}); |
} |
}); |
} |
} |
public void ajouter(String collectionId, CollectionACommentaire commentaires) { |
String postDonneesEncodees = construirePost(collectionId, commentaires); |
final JsonRestRequestBuilder rb = UtilDAO.construireRequetePost(SERVICE_NOM); |
Property changes: |
Modified: svn:mergeinfo |
Merged /trunk/src/org/tela_botanica/client/modeles/collection/CollectionACommentaireAsyncDao.java:r11-988 |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/collection/CollectionACommentaireAsyncDao.java:r1417-1511 |
/trunk/src/org/tela_botanica/client/modeles/collection/CollectionBotanique.java |
---|
Property changes: |
Modified: svn:mergeinfo |
Merged /trunk/src/org/tela_botanica/client/modeles/collection/CollectionBotanique.java:r11-934 |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/collection/CollectionBotanique.java:r1417-1511 |
/trunk/src/org/tela_botanica/client/modeles/collection/UniteRangement.java |
---|
Property changes: |
Modified: svn:mergeinfo |
Merged /trunk/src/org/tela_botanica/client/modeles/collection/UniteRangement.java:r11-948 |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/collection/UniteRangement.java:r1417-1511 |
/trunk/src/org/tela_botanica/client/modeles/collection/CollectionAPersonne.java |
---|
32,7 → 32,7 |
public CollectionAPersonne(ModelData model) |
{ |
Map<String, Object> a = model.getProperties(); |
Set<String> cles = a.keySet(); |
Iterator<String> it = cles.iterator(); |
while (it.hasNext()) { |
151,8 → 151,10 |
// ID RôLE |
public String getIdRole() { |
String role = renvoyerValeurCorrecte("id_role"); |
return role; |
/* |
if (role != null && !UtilString.isEmpty(role)) return role; |
else return renvoyerValeurCorrecte("_role_"); |
else return renvoyerValeurCorrecte("_role_");*/ |
} |
public void setIdRole(String ir) { |
set("id_role", ir); |
Property changes: |
Modified: svn:mergeinfo |
Merged /trunk/src/org/tela_botanica/client/modeles/collection/CollectionAPersonne.java:r11-934 |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/collection/CollectionAPersonne.java:r1417-1511 |
/trunk/src/org/tela_botanica/client/modeles/collection/CollectionAPublication.java |
---|
1,8 → 1,15 |
package org.tela_botanica.client.modeles.collection; |
import java.util.Iterator; |
import java.util.Map; |
import java.util.Set; |
import org.tela_botanica.client.modeles.aDonnee; |
import org.tela_botanica.client.modeles.personne.Personne; |
import org.tela_botanica.client.modeles.publication.Publication; |
import org.tela_botanica.client.util.Debug; |
import com.extjs.gxt.ui.client.data.ModelData; |
import com.google.gwt.json.client.JSONObject; |
public class CollectionAPublication extends aDonnee { |
10,6 → 17,7 |
private static final long serialVersionUID = 1L; |
public static final String PREFIXE = "ccapu"; |
private boolean removePrefix = true; |
private Publication publicationLiee = null; |
public static String[] champsObligatoires = {"ccapu_id_collection", "ccapu_id_publication"}; |
16,11 → 24,44 |
public CollectionAPublication() { |
initialiser(new JSONObject()); |
} |
public CollectionAPublication(boolean removePrefix) { |
this.removePrefix = removePrefix; |
initialiser(new JSONObject()); |
} |
public CollectionAPublication(JSONObject collectionAPublicationListe) { |
initialiser(collectionAPublicationListe); |
} |
public CollectionAPublication(ModelData model, boolean removePrefix) |
{ |
this.removePrefix = removePrefix; |
Map<String, Object> a = model.getProperties(); |
Set<String> cles = a.keySet(); |
Iterator<String> it = cles.iterator(); |
while (it.hasNext()) { |
String cle = it.next(); |
if (a.get(cle) != null) { |
String cleObjet = ""; |
if (removePrefix) { |
cleObjet = cle.replaceFirst("^"+Publication.PREFIXE+"_", ""); |
cleObjet = cle.replaceFirst("^"+Personne.PREFIXE+"_", ""); |
cleObjet = cleObjet.replaceFirst("^"+PREFIXE+"_", ""); |
} |
else { |
cleObjet = cle; |
} |
this.set(cleObjet, a.get(cle)); |
} |
} |
setPublication(new Publication(model, removePrefix)); |
this.set("_etat_", a.get("_etat_")); |
} |
@Override |
protected String getPrefixe() { |
return PREFIXE; |
49,15 → 90,27 |
} |
private void initialiserChampsPourGrille() { |
set("fmt_auteur", getPublication().getAuteur()); |
set("titre", getPublication().getTitre()); |
set("collection", getPublication().getCollection()); |
set("_editeur_", ""); |
set("_annee_", ""); |
set("indication_nvt", getPublication().getIndicationNvt()); |
set("fascicule", getPublication().getFascicule()); |
set("truk_pages", getPublication().getPages()); |
set("_etat_", ""); |
if (removePrefix) { |
set("fmt_auteur", getPublication().getAuteur()); |
set("titre", getPublication().getTitre()); |
set("collection", getPublication().getCollection()); |
set("_editeur_", ""); |
set("_annee_", ""); |
set("indication_nvt", getPublication().getIndicationNvt()); |
set("fascicule", getPublication().getFascicule()); |
set("truk_pages", getPublication().getPages()); |
set("_etat_", ""); |
} else { |
set(Publication.PREFIXE+"_fmt_auteur", getPublication().getAuteur()); |
set(Publication.PREFIXE+"_titre", getPublication().getTitre()); |
set(Publication.PREFIXE+"_collection", getPublication().getCollection()); |
set("_editeur_", ""); |
set("_annee_", ""); |
set(Publication.PREFIXE+"_indication_nvt", getPublication().getIndicationNvt()); |
set(Publication.PREFIXE+"_fascicule", getPublication().getFascicule()); |
set(Publication.PREFIXE+"_truk_pages", getPublication().getPages()); |
set("_etat_", ""); |
} |
} |
// ID |
82,18 → 135,22 |
// ID COLLECTION |
public String getIdCollection() { |
return renvoyerValeurCorrecte("id_collection"); |
if (removePrefix) return renvoyerValeurCorrecte("id_collection"); |
else return renvoyerValeurCorrecte(PREFIXE+"_id_collection"); |
} |
public void setIdCollection(String idCollection) { |
set("id_collection", idCollection); |
if (removePrefix) set("id_collection", idCollection); |
else set(PREFIXE+"_id_collection", idCollection); |
} |
// ID PUBLICATION |
public String getIdPublication() { |
return renvoyerValeurCorrecte("id_publication"); |
if (removePrefix) return renvoyerValeurCorrecte("id_publication"); |
else return renvoyerValeurCorrecte(PREFIXE+"_id_publication"); |
} |
public void setIdPublication(String ip) { |
set("id_publication", ip); |
if (removePrefix) set("id_publication", ip); |
else set(PREFIXE+"_id_publication", ip); |
} |
} |
Property changes: |
Modified: svn:mergeinfo |
Merged /trunk/src/org/tela_botanica/client/modeles/collection/CollectionAPublication.java:r11-934 |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/collection/CollectionAPublication.java:r1417-1511 |
/trunk/src/org/tela_botanica/client/modeles/collection/CollectionAPersonneListe.java |
---|
Property changes: |
Modified: svn:mergeinfo |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/collection/CollectionAPersonneListe.java:r1417-1511 |
Merged /trunk/src/org/tela_botanica/client/modeles/collection/CollectionAPersonneListe.java:r11-934 |
/trunk/src/org/tela_botanica/client/modeles/collection/CollectionAPublicationListe.java |
---|
Property changes: |
Modified: svn:mergeinfo |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/collection/CollectionAPublicationListe.java:r1417-1511 |
Merged /trunk/src/org/tela_botanica/client/modeles/collection/CollectionAPublicationListe.java:r11-934 |
/trunk/src/org/tela_botanica/client/modeles/collection/CollectionAPersonneAsyncDao.java |
---|
123,7 → 123,7 |
} |
} |
public void ajouter(String collectionId, CollectionAPersonne personnes) { |
public void ajouter(String collectionId, CollectionAPersonne personnes) { |
String postDonneesEncodees = construirePost(collectionId, personnes); |
final JsonRestRequestBuilder rb = UtilDAO.construireRequetePost(SERVICE_NOM); |
rb.envoyerRequete(postDonneesEncodees, new JsonRestRequestCallback() { |
Property changes: |
Modified: svn:mergeinfo |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/collection/CollectionAPersonneAsyncDao.java:r1417-1511 |
Merged /trunk/src/org/tela_botanica/client/modeles/collection/CollectionAPersonneAsyncDao.java:r11-934 |
/trunk/src/org/tela_botanica/client/modeles/collection/CollectionAPublicationAsyncDao.java |
---|
1,5 → 1,7 |
package org.tela_botanica.client.modeles.collection; |
import java.util.HashMap; |
import org.tela_botanica.client.Mediateur; |
import org.tela_botanica.client.RegistreId; |
import org.tela_botanica.client.http.JsonRestRequestBuilder; |
14,6 → 16,7 |
import com.google.gwt.core.client.GWT; |
import com.google.gwt.http.client.URL; |
import com.google.gwt.json.client.JSONArray; |
import com.google.gwt.json.client.JSONObject; |
import com.google.gwt.json.client.JSONValue; |
public class CollectionAPublicationAsyncDao { |
28,43 → 31,101 |
utilisateurId = ((Mediateur) Registry.get(RegistreId.MEDIATEUR)).getUtilisateurId(); |
} |
public void selectionner(final String collectionId, final Integer seqId) { |
public void selectionner(final boolean paginationProgressive, final String collectionId, final String recherche, final int start, final int nbElements, final Integer seqId) { |
String[] parametres = {collectionId}; |
final JsonRestRequestBuilder rb = UtilDAO.construireRequete(SERVICE_NOM, parametres); |
HashMap<String, String> restrictions = new HashMap<String, String>(); |
if (nbElements != -1) { |
restrictions.put("limit", String.valueOf(nbElements)); |
} |
restrictions.put("orderby", "cpu_fmt_auteur"); |
rb.envoyerRequete(null, new JsonRestRequestCallback() { |
@Override |
public void surReponse(JSONValue responseValue) { |
Information info = new Information("liste_collection_a_publication"); |
if (responseValue != null) { |
// Si la requête est un succès, reception d'un tableau |
if (responseValue.isArray() != null) { |
final JSONArray reponse = responseValue.isArray(); |
// Transformation du tableau JSON réponse en ListeInstitution |
CollectionAPublicationListe publications = new CollectionAPublicationListe(reponse); |
info.setDonnee(0, publications); |
// et on met à jour le demandeur des données |
if (seqId != null) { |
Reponse reponseRequete = new Reponse(info, seqId); |
vueARafraichir.rafraichir(reponseRequete); |
/** GESTION DE LA REQUETE dans le cas d'une liste paginée progressive **/ |
if (paginationProgressive) { |
/** DEFINITION DU TUPLE DE DEPART **/ |
restrictions.put("start", String.valueOf(start)); |
/** CONSTRUCTION DE LA REQUETE **/ |
final JsonRestRequestBuilder rb = UtilDAO.construireRequete(SERVICE_NOM, parametres, restrictions); |
/** ENVOI DE LA REQUETE **/ |
rb.envoyerRequete(null, new JsonRestRequestCallback() |
{ |
/** RECEPTION DE LA REPONSE **/ |
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("<-- CollectionAPublicationAsyncDao > Liste paginée, retour au sequenceur"); |
Reponse reponseRequete = new Reponse(responseValue, seqId); |
vueARafraichir.rafraichir(reponseRequete); |
} |
else { |
if (Mediateur.DEBUG) System.out.println("<-- CollectionAPublicationAsyncDao > 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 **/ |
restrictions.put("start", String.valueOf(start*nbElements)); |
final JsonRestRequestBuilder rb = UtilDAO.construireRequete(SERVICE_NOM, parametres, restrictions); |
rb.envoyerRequete(null, new JsonRestRequestCallback() { |
@Override |
public void surReponse(JSONValue responseValue) { |
Information info = new Information("liste_collection_a_publication"); |
if (responseValue != null) { |
JSONObject responseObject = responseValue.isObject(); |
if (responseObject != null) { |
// Si la réponse est un tableau, alors c'est une liste de collections qui a été retournée |
if (responseObject.get("collectionsAPublication").isArray() != null) { |
final JSONArray reponse = responseObject.get("collectionsAPublication").isArray(); |
// Transformation du tableau JSON réponse en ListeInstitution |
CollectionAPublicationListe publications = new CollectionAPublicationListe(reponse); |
info.setDonnee(0, publications); |
// et on met à jour le demandeur des données |
if (seqId != null) { |
if (Mediateur.DEBUG) System.out.println("<-- CollectionAPublicationAsyncDao > Liste non paginée, retour au sequenceur"); |
Reponse reponseRequete = new Reponse(info, seqId); |
vueARafraichir.rafraichir(reponseRequete); |
} |
else { |
if (Mediateur.DEBUG) System.out.println("<-- CollectionAPublicationAsyncDao > Liste non paginée, retour au sequenceur"); |
vueARafraichir.rafraichir(info); |
} |
// Si la réponse est un objet, alors c'est une unique collection qui a été retournée |
} else if (responseObject.get("collectionsAPublication").isObject() != null) { |
GWT.log(rb.getUrl()+"\n\tLa réponse n'est pas un tableau JSON et vaut : "+responseValue.toString(), null); |
} |
} |
else { |
} else { |
// Dans le cas, où nous demandons toutes les institutions et qu'il n'y en a pas, nous retournons un objet vide |
if (collectionId == null) { |
info.setMessage("Aucune relations entre la collection et les publications"); |
vueARafraichir.rafraichir(info); |
} |
} else { |
GWT.log(rb.getUrl()+"\n\tLa réponse n'est pas un talbeau JSON et vaut : "+responseValue.toString(), null); |
} |
} else { |
if (collectionId == null) { |
// Dans le cas, où nous demandons toutes les relations Collection à Publication et qu'il n'y en a pas, nous retournons un message d'information |
info.setMessage("Aucune relations entre la collection et les publications"); |
vueARafraichir.rafraichir(info); |
} |
} |
} |
}); |
} |
}); |
} |
} |
public void ajouter(String collectionId, CollectionAPublication publications) { |
String postDonneesEncodees = construirePost(collectionId, publications); |
Property changes: |
Modified: svn:mergeinfo |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/collection/CollectionAPublicationAsyncDao.java:r1417-1511 |
Merged /trunk/src/org/tela_botanica/client/modeles/collection/CollectionAPublicationAsyncDao.java:r11-934 |
/trunk/src/org/tela_botanica/client/modeles/collection/Collection.java |
---|
Property changes: |
Modified: svn:mergeinfo |
Merged /trunk/src/org/tela_botanica/client/modeles/collection/Collection.java:r11-934 |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/collection/Collection.java:r1417-1511 |
/trunk/src/org/tela_botanica/client/modeles/collection/CollectionListe.java |
---|
Property changes: |
Modified: svn:mergeinfo |
Merged /trunk/src/org/tela_botanica/client/modeles/collection/CollectionListe.java:r11-934 |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/collection/CollectionListe.java:r1417-1511 |
/trunk/src/org/tela_botanica/client/modeles/collection/CollectionAsyncDao.java |
---|
124,13 → 124,14 |
if (Mediateur.DEBUG) System.out.println("<-- CollectionAsyncDao > Liste non paginée, retour au sequenceur"); |
Reponse reponseRequete = new Reponse(info, seqId); |
vueARafraichir.rafraichir(reponseRequete); |
} else { |
} |
else { |
if (Mediateur.DEBUG) System.out.println("<-- CollectionAsyncDao > Liste non paginée, retour à "+vueARafraichir.getClass().toString()); |
vueARafraichir.rafraichir(info); |
} |
} |
} else { |
Debug.log(rb.getUrl()+"\n\tLa réponse n'est pas un objet ou un talbeau JSON et vaut : "+responseValue.toString()); |
GWT.log(rb.getUrl()+"\n\tLa réponse n'est pas un objet ou un talbeau JSON et vaut : "+responseValue.toString(), null); |
} |
} else { |
// Dans le cas, où nous demandons toutes les institutions et qu'il n'y en a pas, nous retournons un objet vide |
Property changes: |
Modified: svn:mergeinfo |
Merged /trunk/src/org/tela_botanica/client/modeles/collection/CollectionAsyncDao.java:r11-934 |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/collection/CollectionAsyncDao.java:r1417-1511 |
/trunk/src/org/tela_botanica/client/modeles/structure/StructureAPersonneAsyncDao.java |
---|
33,13 → 33,7 |
public void selectionner(final boolean paginationProgressive, final String structureId, final String roleId, final String recherche, final int start, final int nbElements, final Integer seqId) { |
Debug.log("selectionner structure a personne"); |
/*Debug.log("paginationProgressive="+paginationProgressive); |
Debug.log("structureId="+structureId); |
Debug.log("roleId="+roleId); |
Debug.log("recherche="+recherche); |
Debug.log("nbElements="+nbElements); |
Debug.log("seqId="+seqId);*/ |
String[] parametres = {structureId, roleId}; |
HashMap<String, String> restrictions = new HashMap<String, String>(); |
Property changes: |
Modified: svn:mergeinfo |
Merged /trunk/src/org/tela_botanica/client/modeles/structure/StructureAPersonneAsyncDao.java:r11-934 |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/structure/StructureAPersonneAsyncDao.java:r1417-1511 |
/trunk/src/org/tela_botanica/client/modeles/structure/Structure.java |
---|
214,6 → 214,7 |
return fondationDate; |
} |
/* |
public String getAnneeOuDateFondation() { |
String valeurDateFondation = get("date_fondation"); |
if (!UtilString.isEmpty(valeurDateFondation) && valeurDateFondation.endsWith("00-00")) { |
222,8 → 223,55 |
valeurDateFondation = ""; |
} |
return valeurDateFondation; |
}*/ |
public String getAnneeOuDateFondation() { |
String valeurDateFondation = get("date_fondation"); |
return getDateSouple(valeurDateFondation); |
} |
public String getDateSouple(String date) { |
String valeurDate = date; |
String jour = ""; |
String mois = ""; |
String annee = ""; |
// pas de date dans la BD |
if (UtilString.isEmpty(valeurDate) || valeurDate.equals("0000-00-00")) { |
valeurDate = ""; |
// YYYY |
} else if (valeurDate.endsWith("00-00")) { |
valeurDate = valeurDate.substring(0, 4); |
if (valeurDate.matches("\\d{4}")) { |
jour = ""; |
mois = ""; |
annee = valeurDate.substring(0,4); |
valeurDate = annee; |
} |
// YYYY-MM |
} else if (valeurDate.endsWith("-00")) { |
valeurDate = valeurDate.substring(0, 7); |
if (valeurDate.matches("\\d{4}-\\d{2}")) { |
jour = ""; |
mois = valeurDate.substring(5,7); |
annee = valeurDate.substring(0,4); |
valeurDate = mois+"/"+annee; |
} |
} |
// YYYY-MM-DD |
else if (valeurDate.matches("\\d{4}-\\d{2}-\\d{2}")) { |
Date objetDate = DateTimeFormat.getFormat("yyyy-MM-dd").parse(valeurDate); |
DateTimeFormat fmt = DateTimeFormat.getFormat("dd/MM/yyyy"); |
valeurDate = fmt.format(objetDate); |
} |
return valeurDate; |
} |
public void setDateFondation(Date dateFondation) { |
if (dateFondation != null) { |
this.set("date_fondation", DateTimeFormat.getFormat("yyyy-MM-dd").format(dateFondation)); |
Property changes: |
Modified: svn:mergeinfo |
Merged /trunk/src/org/tela_botanica/client/modeles/structure/Structure.java:r11-934 |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/structure/Structure.java:r1417-1511 |
/trunk/src/org/tela_botanica/client/modeles/structure/StructureListe.java |
---|
Property changes: |
Modified: svn:mergeinfo |
Merged /trunk/src/org/tela_botanica/client/modeles/structure/StructureListe.java:r11-934 |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/structure/StructureListe.java:r1417-1511 |
/trunk/src/org/tela_botanica/client/modeles/structure/StructureAsyncDao.java |
---|
Property changes: |
Modified: svn:mergeinfo |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/structure/StructureAsyncDao.java:r1417-1511 |
Merged /trunk/src/org/tela_botanica/client/modeles/structure/StructureAsyncDao.java:r11-934 |
/trunk/src/org/tela_botanica/client/modeles/structure/StructureAPersonne.java |
---|
Property changes: |
Modified: svn:mergeinfo |
Merged /trunk/src/org/tela_botanica/client/modeles/structure/StructureAPersonne.java:r11-934 |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/structure/StructureAPersonne.java:r1417-1511 |
/trunk/src/org/tela_botanica/client/modeles/structure/StructureConservation.java |
---|
Property changes: |
Modified: svn:mergeinfo |
Merged /trunk/src/org/tela_botanica/client/modeles/structure/StructureConservation.java:r11-934 |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/structure/StructureConservation.java:r1417-1511 |
/trunk/src/org/tela_botanica/client/modeles/structure/StructureValorisation.java |
---|
Property changes: |
Modified: svn:mergeinfo |
Merged /trunk/src/org/tela_botanica/client/modeles/structure/StructureValorisation.java:r11-934 |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/structure/StructureValorisation.java:r1417-1511 |
/trunk/src/org/tela_botanica/client/modeles/structure/StructureAPersonneListe.java |
---|
Property changes: |
Modified: svn:mergeinfo |
Merged /trunk/src/org/tela_botanica/client/modeles/structure/StructureAPersonneListe.java:r11-934 |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/structure/StructureAPersonneListe.java:r1417-1511 |
/trunk/src/org/tela_botanica/client/modeles/ValeurListeAsyncDao.java |
---|
Property changes: |
Modified: svn:mergeinfo |
Merged /trunk/src/org/tela_botanica/client/modeles/ValeurListeAsyncDao.java:r11-68 |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/ValeurListeAsyncDao.java:r1417-1511 |
/trunk/src/org/tela_botanica/client/modeles/projet/Projet.java |
---|
Property changes: |
Modified: svn:mergeinfo |
Merged /trunk/src/org/tela_botanica/client/modeles/projet/Projet.java:r11-934 |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/projet/Projet.java:r1417-1511 |
/trunk/src/org/tela_botanica/client/modeles/projet/ProjetListe.java |
---|
Property changes: |
Modified: svn:mergeinfo |
Merged /trunk/src/org/tela_botanica/client/modeles/projet/ProjetListe.java:r11-934 |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/projet/ProjetListe.java:r1417-1511 |
/trunk/src/org/tela_botanica/client/modeles/projet/ProjetAsyncDao.java |
---|
Property changes: |
Modified: svn:mergeinfo |
Merged /trunk/src/org/tela_botanica/client/modeles/projet/ProjetAsyncDao.java:r11-934 |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/projet/ProjetAsyncDao.java:r1417-1511 |
/trunk/src/org/tela_botanica/client/modeles/projet/ProjetVersion.java |
---|
Property changes: |
Modified: svn:mergeinfo |
Merged /trunk/src/org/tela_botanica/client/modeles/projet/ProjetVersion.java:r11-934 |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/projet/ProjetVersion.java:r1417-1511 |
/trunk/src/org/tela_botanica/client/modeles/InterneValeur.java |
---|
Property changes: |
Modified: svn:mergeinfo |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/InterneValeur.java:r1417-1511 |
Merged /trunk/src/org/tela_botanica/client/modeles/InterneValeur.java:r11-100 |
/trunk/src/org/tela_botanica/client/modeles/commentaire/Commentaire.java |
---|
1,5 → 1,9 |
package org.tela_botanica.client.modeles.commentaire; |
import java.util.Iterator; |
import java.util.Map; |
import java.util.Set; |
import org.tela_botanica.client.Mediateur; |
import org.tela_botanica.client.modeles.aDonnee; |
import org.tela_botanica.client.modeles.collection.Collection; |
6,12 → 10,13 |
import org.tela_botanica.client.modeles.collection.CollectionACommentaire; |
import org.tela_botanica.client.util.Debug; |
import com.extjs.gxt.ui.client.data.ModelData; |
import com.google.gwt.json.client.JSONObject; |
public class Commentaire extends aDonnee { |
private static final long serialVersionUID = 7216356814682582569L; |
private static final String PREFIXE = "ccm"; |
public static final String PREFIXE = "ccm"; |
private Collection collection = null; |
private CollectionACommentaire collectionACommentaire = null; |
public static String[] champsObligatoires = {"ccm_id_commentaire"}; |
27,6 → 32,21 |
initialiserCommentaire(commentaire, chargerCollectionACommentaire); |
} |
public Commentaire(ModelData model) |
{ |
Map<String, Object> a = model.getProperties(); |
Set<String> cles = a.keySet(); |
Iterator<String> it = cles.iterator(); |
while (it.hasNext()) { |
String cle = it.next(); |
if (a.get(cle) != null) { |
String cleObjet = cle.replaceFirst("^"+getPrefixe()+"_", ""); |
this.set(cleObjet, a.get(cle)); |
} |
} |
} |
public void initialiserCommentaire(JSONObject commentaire, boolean chargerCollectionACommentaire) { |
initialiserModele(commentaire); |
Property changes: |
Modified: svn:mergeinfo |
Merged /trunk/src/org/tela_botanica/client/modeles/commentaire/Commentaire.java:r11-984 |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/commentaire/Commentaire.java:r1417-1511 |
/trunk/src/org/tela_botanica/client/modeles/commentaire/CommentaireListe.java |
---|
Property changes: |
Modified: svn:mergeinfo |
Merged /trunk/src/org/tela_botanica/client/modeles/commentaire/CommentaireListe.java:r11-984 |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/commentaire/CommentaireListe.java:r1417-1511 |
/trunk/src/org/tela_botanica/client/modeles/commentaire/CommentaireAsyncDao.java |
---|
29,73 → 29,123 |
utilisateurId = ((Mediateur) Registry.get(RegistreId.MEDIATEUR)).getUtilisateurId(); |
} |
public void selectionner(final String commentaireId, String projetId, String titre, final int pageCourante, final int nbElements, final Integer seqId) { |
String[] parametres = {projetId, commentaireId, titre}; |
/** |
* |
* @param paginationProgressive : définit le mode de consultation de la base de données |
* - True : la consultation des données est progressive, ce qui signifie que la liste est chargée (paginée) au |
* fur et à mesure de la consultation des données par l'utilisateur. |
* - False : la consultation des données est classique : un seul appel à la base de données est effectué, le retour |
* est renvoyé à l'appelant |
* // FIXME : si la taille de la liste est supérieure à la limite du JREST (150), ce deuxieme mode ne fonctionne pas |
*/ |
public void selectionner(final boolean paginationProgressive, final String commentaireId, final String projetId, final String titre, final int start, final int nbElements, final Integer seqId) { |
// Ajout des paramètres et données à selectionner dans l'URL |
String nom = (titre == null) ? "%" : titre+"%"; |
String[] parametres = {projetId, commentaireId, nom}; |
HashMap<String, String> restrictions = new HashMap<String, String>(); |
restrictions.put("start", String.valueOf(pageCourante*nbElements)); |
if (nbElements != -1) { |
restrictions.put("limit", String.valueOf(nbElements)); |
} |
restrictions.put("orderby", "cc_nom ASC"); |
final JsonRestRequestBuilder rb = UtilDAO.construireRequete(SERVICE_NOM, parametres, restrictions); |
rb.envoyerRequete(null, new JsonRestRequestCallback() { |
@Override |
public void surReponse(JSONValue responseValue) { |
if (responseValue != null) { |
// Si la requête est un succès, réception d'un objet ou d'un tableau |
JSONArray responseArray = responseValue.isArray(); |
if (responseArray.get(1).isObject() != null) { |
final JSONObject reponse = responseArray.get(1).isObject(); |
// Transformation du tableau JSON réponse en ListeInstitution |
Commentaire commentaire = new Commentaire(reponse); |
// et on met à jour le demandeur des données |
if (seqId != null) { |
Reponse reponseRequete = new Reponse(commentaire, seqId); |
vueARafraichir.rafraichir(reponseRequete); |
} |
else { |
vueARafraichir.rafraichir(commentaire); |
} |
} else if (responseValue.isArray() != null) { |
final JSONArray reponse = responseValue.isArray(); |
CommentaireListe commentaires; |
if (reponse.get(1).isObject() != null) { |
commentaires = new CommentaireListe(reponse.get(1).isArray()); |
} else { |
commentaires = new CommentaireListe(reponse.get(1).isArray(), reponse.get(0).isNumber(), vueARafraichir); |
} |
commentaires.setTaillePage(nbElements); |
commentaires.setPageCourante(pageCourante); |
restrictions.put("orderby", "ccm_titre ASC"); |
if (seqId != null) { |
Reponse reponseRequete = new Reponse(commentaires, seqId); |
vueARafraichir.rafraichir(reponseRequete); |
/** GESTION DE LA REQUETE dans le cas d'une liste paginée progressive **/ |
if (paginationProgressive) { |
/** DEFINITION DU TUPLE DE DEPART **/ |
restrictions.put("start", String.valueOf(start)); |
/** CONSTRUCTION DE LA REQUETE **/ |
final JsonRestRequestBuilder rb = UtilDAO.construireRequete(SERVICE_NOM, parametres, restrictions); |
/** ENVOI DE LA REQUETE **/ |
rb.envoyerRequete(null, new JsonRestRequestCallback() |
{ |
/** RECEPTION DE LA REPONSE **/ |
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("<-- CommentairesASyncDao > Liste paginée, retour au sequenceur"); |
Reponse reponseRequete = new Reponse(responseValue, seqId); |
vueARafraichir.rafraichir(reponseRequete); |
} |
else { |
if (Mediateur.DEBUG) System.out.println("<-- CommentairesASyncDao > 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 **/ |
restrictions.put("start", String.valueOf(start*nbElements)); |
final JsonRestRequestBuilder rb = UtilDAO.construireRequete(SERVICE_NOM, parametres, restrictions); |
rb.envoyerRequete(null, new JsonRestRequestCallback() { |
@Override |
public void surReponse(JSONValue responseValue) { |
if (responseValue != null) { |
JSONObject responseObject = responseValue.isObject(); |
if (responseObject != null) { |
// Si la réponse est un tableau, alors c'est une liste de commentaires qui a été retournée |
if (responseObject.get("commentaires").isArray() != null) { |
final JSONArray reponse = responseObject.get("commentaires").isArray(); |
CommentaireListe commentaires = new CommentaireListe(reponse, responseObject.get("nbElements").isNumber(), vueARafraichir); |
commentaires.setTaillePage(nbElements); |
commentaires.setPageCourante(start); |
vueARafraichir.rafraichir(commentaires); |
// Si la réponse est un objet, alors c'est un unique commentaire qui a été retournée |
} else if (responseObject.get("commentaires").isObject() != null) { |
final JSONObject reponse = responseObject.get("commentaires").isObject(); |
Commentaire commentaire = new Commentaire(reponse); |
// et on met à jour le demandeur des données |
if (seqId != null) { |
if (Mediateur.DEBUG) System.out.println("<-- CommentairesASyncDao > Liste non paginée, retour au sequenceur"); |
Reponse reponseRequete = new Reponse(commentaire, seqId); |
vueARafraichir.rafraichir(reponseRequete); |
} |
else { |
if (Mediateur.DEBUG) System.out.println("<-- CommentairesASyncDao > Liste non paginée, retour à "+vueARafraichir.getClass().toString()); |
vueARafraichir.rafraichir(commentaire); |
} |
} |
} else { |
GWT.log(rb.getUrl()+"\n\tLa réponse n'est pas un objet ou un talbeau JSON et vaut : "+responseValue.toString(), null); |
} |
else { |
vueARafraichir.rafraichir(commentaires); |
} |
} else { |
GWT.log("La réponse n'est pas un objet ou un talbeau JSON et vaut : "+responseValue.toString(), null); |
} |
} else { |
// Dans le cas, où nous demandons toutes les publication et qu'il n'y en a pas, nous retournons un objet vide |
if (commentaireId == null) { |
CommentaireListe commentaires = new CommentaireListe(0); |
if (seqId != null) { |
Reponse reponseRequete = new Reponse(commentaires, seqId); |
vueARafraichir.rafraichir(reponseRequete); |
// Dans le cas, où nous demandons toutes les institutions et qu'il n'y en a pas, nous retournons un objet vide |
if (commentaireId == null) { |
CommentaireListe commentaires = new CommentaireListe(0); |
if (seqId != null) { |
Reponse reponseRequete = new Reponse(commentaires, seqId); |
vueARafraichir.rafraichir(reponseRequete); |
} |
else { |
vueARafraichir.rafraichir(commentaires); |
} |
} |
else { |
vueARafraichir.rafraichir(commentaires); |
} |
} |
} |
} |
}); |
}); |
} |
} |
public void ajouter(Commentaire commentaire) { |
Property changes: |
Modified: svn:mergeinfo |
Merged /trunk/src/org/tela_botanica/client/modeles/commentaire/CommentaireAsyncDao.java:r11-984 |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/commentaire/CommentaireAsyncDao.java:r1417-1511 |
/trunk/src/org/tela_botanica/client/modeles/InterneValeurListe.java |
---|
Property changes: |
Modified: svn:mergeinfo |
Merged /trunk/src/org/tela_botanica/client/modeles/InterneValeurListe.java:r11-100 |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/InterneValeurListe.java:r1417-1511 |
/trunk/src/org/tela_botanica/client/modeles/Information.java |
---|
Property changes: |
Modified: svn:mergeinfo |
Merged /trunk/src/org/tela_botanica/client/modeles/Information.java:r11-132 |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/Information.java:r1417-1511 |
/trunk/src/org/tela_botanica/client/modeles/publication/PublicationAPersonneListe.java |
---|
Property changes: |
Modified: svn:mergeinfo |
Merged /trunk/src/org/tela_botanica/client/modeles/publication/PublicationAPersonneListe.java:r11-934 |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/publication/PublicationAPersonneListe.java:r1417-1511 |
/trunk/src/org/tela_botanica/client/modeles/publication/PublicationAPersonneAsyncDao.java |
---|
8,6 → 8,7 |
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.collection.CollectionAPublicationListe; |
import org.tela_botanica.client.synchronisation.Reponse; |
import org.tela_botanica.client.util.Debug; |
import org.tela_botanica.client.util.UtilDAO; |
33,51 → 34,112 |
utilisateurId = ((Mediateur) Registry.get(RegistreId.MEDIATEUR)).getUtilisateurId(); |
} |
public void selectionner(String publicationId, String personnesId, String roleId, final Integer seqId) { |
public void selectionner(final boolean paginationProgressive, String publicationId, String personnesId, String roleId, final String recherche, final int start, final int nbElements, final Integer seqId) { |
String[] parametres = {publicationId, personnesId, roleId}; |
HashMap<String, String> restrictions = new HashMap<String, String>(); |
restrictions.put("orderby", "ordre"); |
final JsonRestRequestBuilder rb = UtilDAO.construireRequete(SERVICE_NOM, parametres); |
rb.envoyerRequete(null, new JsonRestRequestCallback() { |
@Override |
public void surReponse(JSONValue responseValue) { |
if (responseValue != null) { |
// Si la requête est un succès, réception d'un objet ou d'un tableau |
if (responseValue.isObject() != null) { |
final JSONObject reponse = responseValue.isObject(); |
// Transformation du tableau JSON réponse en ListeInstitution |
PublicationAPersonne publicationAPersonne = new PublicationAPersonne(reponse); |
// et on met à jour le demandeur des données |
if (seqId!=null) { |
Reponse reponseRequete = new Reponse(publicationAPersonne, seqId); |
vueARafraichir.rafraichir(reponseRequete); |
} else { |
vueARafraichir.rafraichir(publicationAPersonne); |
if (nbElements != -1) { |
restrictions.put("limit", String.valueOf(nbElements)); |
} |
restrictions.put("orderby", "cpuap_ordre"); |
/** GESTION DE LA REQUETE dans le cas d'une liste paginée progressive **/ |
if (paginationProgressive) { |
/** DEFINITION DU TUPLE DE DEPART **/ |
restrictions.put("start", String.valueOf(start)); |
/** CONSTRUCTION DE LA REQUETE **/ |
final JsonRestRequestBuilder rb = UtilDAO.construireRequete(SERVICE_NOM, parametres, restrictions); |
/** ENVOI DE LA REQUETE **/ |
rb.envoyerRequete(null, new JsonRestRequestCallback() |
{ |
/** RECEPTION DE LA REPONSE **/ |
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("<-- PublicationAPersonneAsyncDao > Liste paginée, retour au sequenceur"); |
Reponse reponseRequete = new Reponse(responseValue, seqId); |
vueARafraichir.rafraichir(reponseRequete); |
} |
else { |
if (Mediateur.DEBUG) System.out.println("<-- PublicationAPersonneAsyncDao > 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 **/ |
restrictions.put("start", String.valueOf(start*nbElements)); |
final JsonRestRequestBuilder rb = UtilDAO.construireRequete(SERVICE_NOM, parametres, restrictions); |
rb.envoyerRequete(null, new JsonRestRequestCallback() { |
@Override |
public void surReponse(JSONValue responseValue) { |
if (responseValue != null) { |
JSONObject responseObject = responseValue.isObject(); |
if (responseObject != null) { |
// Si la réponse est un tableau, alors c'est une liste de collections qui a été retournée |
if (responseObject.get("publicationsAPersonne").isArray() != null) { |
final JSONArray reponse = responseObject.get("publicationsAPersonne").isArray(); |
// Transformation du tableau JSON réponse en ListeInstitution |
PublicationAPersonneListe publicationsAPersonneListe = new PublicationAPersonneListe(reponse); |
// et on met à jour le demandeur des données |
if (seqId != null) { |
if (Mediateur.DEBUG) System.out.println("<-- PublicationAPersonneAsyncDao > Liste non paginée, retour au sequenceur"); |
Reponse reponseRequete = new Reponse(publicationsAPersonneListe, seqId); |
vueARafraichir.rafraichir(reponseRequete); |
} |
else { |
if (Mediateur.DEBUG) System.out.println("<-- PublicationAPersonneAsyncDao > Liste non paginée, retour au sequenceur"); |
vueARafraichir.rafraichir(publicationsAPersonneListe); |
} |
// Si la réponse est un objet, alors c'est une unique collection qui a été retournée |
} else if (responseObject.get("publicationsAPersonne").isObject() != null) { |
final JSONObject reponse = responseObject.get("publicationsAPersonne").isObject(); |
// Transformation du tableau JSON réponse en ListeInstitution |
PublicationAPersonne publicationAPersonne = new PublicationAPersonne(reponse); |
// et on met à jour le demandeur des données |
if (seqId!=null) { |
Reponse reponseRequete = new Reponse(publicationAPersonne, seqId); |
vueARafraichir.rafraichir(reponseRequete); |
} else { |
vueARafraichir.rafraichir(publicationAPersonne); |
} |
} else { |
GWT.log("La réponse n'est pas un objet ou un tableau JSON et vaut : "+responseValue.toString(), null); |
} |
} |
} else if (responseValue.isArray() != null) { |
final JSONArray reponse = responseValue.isArray(); |
PublicationAPersonneListe publicationsAPersonneListe = new PublicationAPersonneListe(reponse); |
} else { |
// Dans le cas, où nous demandons toutes les publication et qu'il n'y en a pas, nous retournons un objet vide |
PublicationAPersonneListe publicationAPersonneListe = new PublicationAPersonneListe(0); |
if (seqId!=null) { |
Reponse reponseRequete = new Reponse(publicationsAPersonneListe, seqId); |
Reponse reponseRequete = new Reponse(publicationAPersonneListe, seqId); |
vueARafraichir.rafraichir(reponseRequete); |
} else { |
vueARafraichir.rafraichir(publicationsAPersonneListe); |
vueARafraichir.rafraichir(publicationAPersonneListe); |
} |
} else { |
GWT.log("La réponse n'est pas un objet ou un tableau JSON et vaut : "+responseValue.toString(), null); |
} |
} else { |
// Dans le cas, où nous demandons toutes les publication et qu'il n'y en a pas, nous retournons un objet vide |
PublicationAPersonneListe publicationAPersonneListe = new PublicationAPersonneListe(0); |
if (seqId!=null) { |
Reponse reponseRequete = new Reponse(publicationAPersonneListe, seqId); |
vueARafraichir.rafraichir(reponseRequete); |
} else { |
vueARafraichir.rafraichir(publicationAPersonneListe); |
} |
} |
} |
}); |
}); |
} |
} |
public void ajouter(String publicationId, String personnesId, String ordreAuteurs, String roleId, final Integer seqId) { |
Property changes: |
Modified: svn:mergeinfo |
Merged /trunk/src/org/tela_botanica/client/modeles/publication/PublicationAPersonneAsyncDao.java:r11-934 |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/publication/PublicationAPersonneAsyncDao.java:r1417-1511 |
/trunk/src/org/tela_botanica/client/modeles/publication/Publication.java |
---|
1,9 → 1,17 |
package org.tela_botanica.client.modeles.publication; |
import java.util.ArrayList; |
import java.util.Iterator; |
import java.util.Map; |
import java.util.Set; |
import org.tela_botanica.client.modeles.aDonnee; |
import org.tela_botanica.client.modeles.collection.CollectionAPublication; |
import org.tela_botanica.client.modeles.structure.Structure; |
import org.tela_botanica.client.util.Debug; |
import org.tela_botanica.client.util.UtilString; |
import com.extjs.gxt.ui.client.data.ModelData; |
import com.google.gwt.json.client.JSONObject; |
public class Publication extends aDonnee { |
10,19 → 18,77 |
private static final long serialVersionUID = 4142843068041690126L; |
private static final String PREFIXE = "cpu"; |
public static final String PREFIXE = "cpu"; |
private boolean removePrefix = true; |
private Structure editeur = null; |
public static String[] champsObligatoires = {"cpu_id_publication"}; |
public ArrayList<String> cles = null; |
public Publication() { |
public Publication() { |
} |
public Publication(boolean removePrefix) { |
this.removePrefix = removePrefix; |
cles = new ArrayList<String>(); |
cles.add("id_publication"); |
} |
public Publication(JSONObject publication) { |
initialiserModele(publication); |
editeur = new Structure(publication); |
cles = new ArrayList<String>(); |
cles.add("id_publication"); |
} |
@Override |
public Publication(ModelData model, boolean removePrefix) |
{ |
this.removePrefix = removePrefix; |
cles = new ArrayList<String>(); |
cles.add("id_publication"); |
Map<String, Object> a = model.getProperties(); |
Set<String> cles = a.keySet(); |
Iterator<String> it = cles.iterator(); |
while (it.hasNext()) { |
String cle = it.next(); |
if (a.get(cle) != null) { |
String cleObjet = ""; |
if (removePrefix) { |
cleObjet = cle.replaceFirst("^"+getPrefixe()+"_", ""); |
} |
else { |
cleObjet=cle; |
String valeur = ""; |
if (a.get(cle) instanceof Integer) valeur = String.valueOf(a.get(cle)); |
else if (a.get(cle) instanceof String) valeur = (String)a.get(cle); |
traiterClesEtrangeres(cle, valeur); |
} |
this.set(cleObjet, a.get(cle)); |
} |
} |
} |
// Action |
//-------- |
// cette méthode sert dans le cas suivant : le contructeur reçoit un object ModelData |
// qui contient cpuap_id_publication mais pas cpu_id_publication ou id_publication. Sans |
// la méthode ci-dessous, on aurait des problèmes. Celle-ci affecte à id_publication la |
// valeur des clés étrangères rencontrées (cpuap_id_publication, cpuac_id_publication, etc.) |
private void traiterClesEtrangeres(String cle, String valeur) { |
// on recupere le nom de la clé de la propriété (sans son prefixe) |
String nomSansPrefixe = cle.replaceFirst("^[a-zA-Z]+_", ""); |
// on regarde si cette clé est une clé primaire de la table Publication |
if (cles.contains(nomSansPrefixe)) { |
// si c'est le cas et que la valeur est non nulle |
if (valeur != null && !UtilString.isEmpty(valeur)) { |
// on affecte la valeur de la clés étrangère à la clé primaire |
if (removePrefix) this.set(nomSansPrefixe, valeur); |
else this.set(PREFIXE+"_"+nomSansPrefixe, valeur); |
} |
} |
} |
protected String getPrefixe() { |
return PREFIXE; |
} |
36,52 → 102,66 |
} |
public String getId() { |
return renvoyerValeurCorrecte("id_publication"); |
if (removePrefix) return renvoyerValeurCorrecte("id_publication"); |
else return renvoyerValeurCorrecte(PREFIXE+"_id_publication"); |
} |
public void setId(String idPublication) { |
this.set("id_publication", idPublication); |
if (removePrefix) this.set("id_publication", idPublication); |
else this.set(PREFIXE+"_id_publication", idPublication); |
} |
public String getIdProjet() { |
return renvoyerValeurCorrecte("ce_projet"); |
if (removePrefix) return renvoyerValeurCorrecte("ce_projet"); |
else return renvoyerValeurCorrecte(PREFIXE+"_ce_projet"); |
} |
public void setIdProjet(String idProjet) { |
this.set("ce_projet", idProjet); |
if (removePrefix) this.set("ce_projet", idProjet); |
else this.set(PREFIXE+"_ce_projet", idProjet); |
} |
public String getNomComplet() { |
return renvoyerValeurCorrecte("fmt_nom_complet"); |
if (removePrefix) return renvoyerValeurCorrecte("fmt_nom_complet"); |
else return renvoyerValeurCorrecte(PREFIXE+"_fmt_nom_complet"); |
} |
public void setNomComplet(String nomComplet) { |
this.set("fmt_nom_complet", nomComplet); |
if (removePrefix) this.set("fmt_nom_complet", nomComplet); |
else this.set(PREFIXE+"_fmt_nom_complet", nomComplet); |
} |
public String getURI() { |
return renvoyerValeurCorrecte("uri"); |
if (removePrefix) return renvoyerValeurCorrecte("uri"); |
else return renvoyerValeurCorrecte(PREFIXE+"_uri"); |
} |
public void setUri(String uri) { |
this.set("uri", uri); |
if (removePrefix) this.set("uri", uri); |
else this.set(PREFIXE+"_uri", uri); |
} |
public String getAuteur() { |
return renvoyerValeurCorrecte("fmt_auteur"); |
if (removePrefix) return renvoyerValeurCorrecte("fmt_auteur"); |
else return renvoyerValeurCorrecte(PREFIXE+"_fmt_auteur"); |
} |
public void setAuteur(String auteurFormate) { |
this.set("fmt_auteur", auteurFormate); |
if (removePrefix) this.set("fmt_auteur", auteurFormate); |
else this.set(PREFIXE+"_fmt_auteur", auteurFormate); |
} |
public String getCollection() { |
return renvoyerValeurCorrecte("collection"); |
if (removePrefix) return renvoyerValeurCorrecte("collection"); |
else return renvoyerValeurCorrecte(PREFIXE+"_collection"); |
} |
public void setCollection(String collection) { |
this.set("collection", collection); |
if (removePrefix) this.set("collection", collection); |
else this.set(PREFIXE+"_collection", collection); |
} |
public String getTitre() { |
return renvoyerValeurCorrecte("titre"); |
if (removePrefix) return renvoyerValeurCorrecte("titre"); |
else return renvoyerValeurCorrecte(PREFIXE+"_titre"); |
} |
public void setTitre(String titre) { |
this.set("titre", UtilString.ucFirst(titre)); |
if (removePrefix) this.set("titre", UtilString.ucFirst(titre)); |
else this.set(PREFIXE+"_titre", UtilString.ucFirst(titre)); |
} |
public String getNomEditeur() { |
92,41 → 172,57 |
return editeurNom; |
} |
public String getEditeur() { |
return getChaineDenormaliseUnique("ce_truk_editeur"); |
if (removePrefix) return getChaineDenormaliseUnique("ce_truk_editeur"); |
else return getChaineDenormaliseUnique(PREFIXE+"_ce_truk_editeur"); |
} |
public void setEditeur(String editeur) { |
setChaineDenormaliseUnique("ce_truk_editeur", "AUTRE", editeur); |
if (removePrefix) setChaineDenormaliseUnique("ce_truk_editeur", "AUTRE", editeur); |
else setChaineDenormaliseUnique(PREFIXE+"_ce_truk_editeur", "AUTRE", editeur); |
} |
public String getAnneeParution() { |
return renvoyerValeurCorrecte("date_parution").substring(0, 4); |
String date; |
if (removePrefix) date = renvoyerValeurCorrecte("date_parution"); |
else date = renvoyerValeurCorrecte(PREFIXE+"_date_parution"); |
if (date != null && !UtilString.isEmpty(date)) |
return date.substring(0, 4); |
else |
return null; |
} |
public String getDateParution() { |
return renvoyerValeurCorrecte("date_parution"); |
if (removePrefix) return renvoyerValeurCorrecte("date_parution"); |
else return renvoyerValeurCorrecte(PREFIXE+"_date_parution"); |
} |
public void setDateParution(String date) { |
this.set("date_parution", date); |
if (removePrefix) this.set("date_parution", date); |
else this.set(PREFIXE+"_date_parution", date); |
} |
public String getIndicationNvt() { |
return renvoyerValeurCorrecte("indication_nvt"); |
if (removePrefix) return renvoyerValeurCorrecte("indication_nvt"); |
else return renvoyerValeurCorrecte(PREFIXE+"_indication_nvt"); |
} |
public void setIndicationNvt(String nvt) { |
this.set("indication_nvt", nvt); |
if (removePrefix) this.set("indication_nvt", nvt); |
else this.set(PREFIXE+"_indication_nvt", nvt); |
} |
public String getFascicule() { |
return renvoyerValeurCorrecte("fascicule"); |
if (removePrefix) return renvoyerValeurCorrecte("fascicule"); |
else return renvoyerValeurCorrecte(PREFIXE+"_fascicule"); |
} |
public void setFascicule(String fascicule) { |
this.set("fascicule", fascicule); |
if (removePrefix) this.set("fascicule", fascicule); |
else this.set(PREFIXE+"_fascicule", fascicule); |
} |
public String getPages() { |
return renvoyerValeurCorrecte("truk_pages"); |
if (removePrefix) return renvoyerValeurCorrecte("truk_pages"); |
else return renvoyerValeurCorrecte(PREFIXE+"_truk_pages"); |
} |
public void setPages(String pages) { |
this.set("truk_pages", pages); |
if (removePrefix) this.set("truk_pages", pages); |
else this.set(PREFIXE+"_truk_pages", pages); |
} |
} |
Property changes: |
Modified: svn:mergeinfo |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/publication/Publication.java:r1417-1511 |
Merged /trunk/src/org/tela_botanica/client/modeles/publication/Publication.java:r11-934 |
/trunk/src/org/tela_botanica/client/modeles/publication/PublicationListe.java |
---|
Property changes: |
Modified: svn:mergeinfo |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/publication/PublicationListe.java:r1417-1511 |
Merged /trunk/src/org/tela_botanica/client/modeles/publication/PublicationListe.java:r11-934 |
/trunk/src/org/tela_botanica/client/modeles/publication/PublicationAsyncDao.java |
---|
8,6 → 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; |
31,66 → 33,120 |
utilisateurId = ((Mediateur) Registry.get(RegistreId.MEDIATEUR)).getUtilisateurId(); |
} |
public void selectionner(final String publicationId, String projetId, String nomComplet, final int nbElements, final int pageCourante, final Integer seqId) { |
String[] parametres = {projetId, publicationId, nomComplet}; |
/** |
* @param paginationProgressive : définit le mode de consultation de la base de données |
* - True : la consultation des données est progressive, ce qui signifie que la liste est chargée (paginée) au |
* fur et à mesure de la consultation des données par l'utilisateur. |
* - False : la consultation des données est classique : un seul appel à la base de données est effectué, le retour |
* est renvoyé à l'appelant |
* // FIXME : si la taille de la liste est supérieure à la limite du JREST (150), ce deuxieme mode ne fonctionne pas efficacement (on ne voit pas les enregistrement suivants) |
*/ |
public void selectionner(final boolean paginationProgressive, final String publicationId, String projetId, String nomComplet, final int start, final int nbElements, final Integer seqId) { |
String nom = (nomComplet == null) ? "%" : nomComplet+"%"; |
String[] param = {publicationId, projetId, nom}; |
HashMap<String, String> restrictions = new HashMap<String, String>(); |
restrictions.put("orderby", "cpu_titre"); |
restrictions.put("start", String.valueOf(pageCourante*nbElements)); |
if (nbElements != -1) { |
restrictions.put("orderby", "cpu_fmt_nom_complet"); |
if (nbElements != -1) { |
restrictions.put("limit", String.valueOf(nbElements)); |
} |
final JsonRestRequestBuilder rb = UtilDAO.construireRequete(SERVICE_NOM, parametres, restrictions); |
rb.envoyerRequete(null, new JsonRestRequestCallback() { |
@Override |
public void surReponse(JSONValue responseValue) { |
if (responseValue != null) { |
// Si la requête est un succès, réception d'un objet ou d'un tableau |
JSONArray responseArray = responseValue.isArray(); |
if (responseArray.get(1).isObject() != null) { |
final JSONObject reponse = responseArray.get(1).isObject(); |
// Transformation du tableau JSON réponse en ListeInstitution |
Publication publication = new Publication(reponse); |
// et on met à jour le demandeur des données |
if (seqId!=null) { |
Reponse reponseRequete = new Reponse(publication, seqId); |
vueARafraichir.rafraichir(reponseRequete); |
} else { |
vueARafraichir.rafraichir(publication); |
} |
/** GESTION DE LA REQUETE dans le cas d'une liste paginée progressive **/ |
if (paginationProgressive) { |
/** DEFINITION DU TUPLE DE DEPART **/ |
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() |
{ |
/** RECEPTION DE LA REPONSE **/ |
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"); |
Reponse reponseRequete = new Reponse(responseValue, seqId); |
vueARafraichir.rafraichir(reponseRequete); |
} |
else { |
if (Mediateur.DEBUG) System.out.println("<-- 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 **/ |
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) { |
} else if (responseArray.get(1).isArray() != null) { |
final JSONArray reponse = responseValue.isArray(); |
PublicationListe publications; |
if (reponse.get(1).isObject() != null) { |
publications = new PublicationListe(reponse.get(1).isArray()); |
} else { |
publications = new PublicationListe(reponse.get(1).isArray(), reponse.get(0).isNumber(), vueARafraichir); |
} |
JSONObject responseObject = responseValue.isObject(); |
publications.setTaillePage(nbElements); |
publications.setPageCourante(pageCourante); |
if (seqId!=null) { |
Reponse reponseRequete = new Reponse(publications, seqId); |
vueARafraichir.rafraichir(reponseRequete); |
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; |
publications = new PublicationListe(reponse, responseObject.get("nbElements").isNumber(), vueARafraichir); |
publications.setTaillePage(nbElements); |
publications.setPageCourante(start); |
if (seqId != null) { |
if (Mediateur.DEBUG) System.out.println("<-- PublicationAsyncDao > Liste non paginée, retour au sequenceur"); |
Reponse retourRequete = new Reponse(publications, seqId); |
vueARafraichir.rafraichir(retourRequete); |
} else { |
if (Mediateur.DEBUG) System.out.println("<-- PublicationAsyncDao > Liste non paginée, retour à "+vueARafraichir.getClass().toString()); |
vueARafraichir.rafraichir(publications); |
} |
// Si la réponse est un objet, alors c'est un unique projet qui a été retourné |
} else if (responseObject.get("publications").isObject() != null) { |
JSONObject reponse = responseObject.get("publications").isObject(); |
// Transformation du tableau JSON réponse en ListeInstitution |
Publication publication = new Publication(reponse); |
// et on met à jour le demandeur des données |
if (seqId!=null) { |
Reponse reponseRequete = new Reponse(publication, seqId); |
vueARafraichir.rafraichir(reponseRequete); |
} else { |
vueARafraichir.rafraichir(publication); |
} |
} |
} else { |
GWT.log(rb.getUrl()+"\n\tLa réponse n'est pas un objet ou un tableau JSON et vaut : "+responseValue.toString(), null); |
} |
} else { |
if (publicationId == null) { |
PublicationListe publications = new PublicationListe(0); |
vueARafraichir.rafraichir(publications); |
} |
} else { |
GWT.log("La réponse n'est pas un objet ou un talbeau JSON et vaut : "+responseValue.toString(), null); |
} |
} else { |
// Dans le cas, où nous demandons toutes les publication et qu'il n'y en a pas, nous retournons un objet vide |
if (publicationId == null) { |
PublicationListe publications = new PublicationListe(0); |
vueARafraichir.rafraichir(publications); |
} |
} |
} |
}); |
}); |
} |
} |
public void ajouter(Publication publication, final Integer seqId) { |
Property changes: |
Modified: svn:mergeinfo |
Merged /trunk/src/org/tela_botanica/client/modeles/publication/PublicationAsyncDao.java:r11-934 |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/publication/PublicationAsyncDao.java:r1417-1511 |
/trunk/src/org/tela_botanica/client/modeles/publication/PublicationAPersonne.java |
---|
5,9 → 5,11 |
import java.util.Set; |
import org.tela_botanica.client.modeles.aDonnee; |
import org.tela_botanica.client.modeles.collection.CollectionAPublication; |
import org.tela_botanica.client.modeles.personne.Personne; |
import org.tela_botanica.client.util.Debug; |
import com.extjs.gxt.ui.client.data.ModelData; |
import com.google.gwt.json.client.JSONObject; |
public class PublicationAPersonne extends aDonnee { |
15,6 → 17,7 |
private static final long serialVersionUID = 7769105365939978129L; |
public static final String PREFIXE = "cpuap"; |
private boolean removePrefix = true; |
public static final String ROLE_AUTEUR = "2360"; |
//FIXME: insérer en base de données une valeur cohérente pour l'identifiant ci-dessous |
public static final String ROLE_SUJET = "30762"; |
27,6 → 30,11 |
new PublicationAPersonne(new JSONObject()); |
} |
public PublicationAPersonne(boolean removePrefix) { |
this.removePrefix = removePrefix; |
new PublicationAPersonne(new JSONObject()); |
} |
public PublicationAPersonne(JSONObject pubAPersListe) { |
Personne personne = new Personne(pubAPersListe); |
setPersonne(personne); |
39,33 → 47,74 |
for (Iterator<String> it = im.iterator(); it.hasNext();) { |
// Si elle est associée à une valeur, nous l'ajoutons |
String cle = it.next(); |
// Suppression de l'abréviation du champ. Inutile dans le contexte d'un objet |
String cleObjet = cle.replaceFirst("^"+PREFIXE+"_", ""); |
String cleObjet = ""; |
if (removePrefix) cleObjet = cle.replaceFirst("^"+getPrefixe()+"_", ""); |
else cleObjet=cle; |
// Valeur vide par défaut |
String valeur = ""; |
if (pubAPersListe.get(cle).isString() != null) { |
valeur = pubAPersListe.get(cle).isString().stringValue(); |
this.set(cleObjet, valeur); |
} else { |
this.set(cleObjet, valeur); |
} |
} |
this.set(cleObjet, valeur); |
} |
initialiserChampsPourGrille(); |
} |
public PublicationAPersonne(ModelData model, boolean removePrefix) |
{ |
this.removePrefix = removePrefix; |
Map<String, Object> a = model.getProperties(); |
Set<String> cles = a.keySet(); |
Iterator<String> it = cles.iterator(); |
while (it.hasNext()) { |
String cle = it.next(); |
if (a.get(cle) != null) { |
String cleObjet = ""; |
if (removePrefix) { |
cleObjet = cle.replaceFirst("^"+Personne.PREFIXE+"_", ""); |
cleObjet = cle.replaceFirst("^"+Publication.PREFIXE+"_", ""); |
cleObjet = cleObjet.replaceFirst("^"+PREFIXE+"_", ""); |
} |
else { |
cleObjet = cle; |
} |
this.set(cleObjet, a.get(cle)); |
} |
} |
setPersonne(new Personne(model, removePrefix)); |
setPublicationLiee(new Publication(model, removePrefix)); |
this.set("_role_", a.get("_role_")); |
this.set("_etat_", a.get("_etat_")); |
} |
private void initialiserChampsPourGrille() { |
set("fmt_auteur", publicationLiee.getAuteur()); |
set("titre", publicationLiee.getTitre()); |
set("collection", publicationLiee.getCollection()); |
set("_editeur_", ""); |
set("_annee_", ""); |
set("indication_nvt", publicationLiee.getIndicationNvt()); |
set("fascicule", publicationLiee.getFascicule()); |
set("truk_pages", publicationLiee.getPages()); |
set("_etat_", ""); |
set("_role_", this.get("id_role")); |
if (removePrefix) { |
set("fmt_auteur", publicationLiee.getAuteur()); |
set("titre", publicationLiee.getTitre()); |
set("collection", publicationLiee.getCollection()); |
set("_editeur_", ""); |
set("_annee_", ""); |
set("indication_nvt", publicationLiee.getIndicationNvt()); |
set("fascicule", publicationLiee.getFascicule()); |
set("truk_pages", publicationLiee.getPages()); |
set("_etat_", ""); |
set("_role_", this.get("id_role")); |
} else { |
set("cpu_fmt_auteur", publicationLiee.getAuteur()); |
set("cpu_titre", publicationLiee.getTitre()); |
set("cpu_collection", publicationLiee.getCollection()); |
set("_editeur_", ""); |
set("_annee_", ""); |
set("cpu_indication_nvt", publicationLiee.getIndicationNvt()); |
set("cpu_fascicule", publicationLiee.getFascicule()); |
set("cpu_truk_pages", publicationLiee.getPages()); |
set("_etat_", ""); |
set("_role_", this.get("id_role")); |
} |
} |
81,21 → 130,34 |
public Personne getPersonne() { |
return personneLiee; |
} |
public void setPersonne(Personne personne) { |
setPersonne(personne, false); |
} |
public void setPersonne(Personne personne, boolean integrerProprietes) { |
personneLiee = personne; |
if (personne != null) { |
setIdPersonne(personne.getId()); |
} |
Map<String, Object> a = personne.getProperties(); |
Set<String> cles = a.keySet(); |
Iterator<String> it = cles.iterator(); |
while (it.hasNext()) { |
String cle = it.next(); |
if (a.get(cle) != null) { |
String cleObjet = cle.replaceFirst("^"+Personne.PREFIXE+"_", ""); |
this.set(cleObjet, a.get(cle)); |
if (integrerProprietes) { |
Map<String, Object> a = personne.getProperties(); |
Set<String> cles = a.keySet(); |
Iterator<String> it = cles.iterator(); |
while (it.hasNext()) { |
String cle = it.next(); |
if (a.get(cle) != null) { |
String cleObjet = ""; |
if (removePrefix) { |
cleObjet = cle.replaceFirst("^"+Personne.PREFIXE+"_", ""); |
} |
else { |
cleObjet = cle; |
} |
this.set(cleObjet, a.get(cle)); |
} |
} |
} |
} |
114,10 → 176,12 |
// ID PUBLICATION |
public String getIdPublication() { |
return renvoyerValeurCorrecte("id_publication"); |
if (removePrefix) return renvoyerValeurCorrecte("id_publication"); |
else return renvoyerValeurCorrecte("cpuap_id_publication"); |
} |
public void setIdPublication(String id) { |
set("id_publication", id); |
if (removePrefix) set("id_publication", id); |
else set("cpuap_id_publication", id); |
} |
// PUBLICATION LIEE |
143,10 → 207,12 |
// ID PERSONNE |
public String getIdPersonne() { |
return renvoyerValeurCorrecte("id_personne"); |
if (removePrefix) return renvoyerValeurCorrecte("id_personne"); |
else return renvoyerValeurCorrecte("cpuap_id_personne"); |
} |
public void setIdPersonne(String id) { |
set("id_personne", id); |
if (removePrefix) set("id_personne", id); |
else set(PREFIXE+"_id_personne", id); |
} |
// ID RôLE |
170,11 → 236,15 |
// ORDRE DES AUTEURS |
public String getOrdreAuteurs() { |
return renvoyerValeurCorrecte("ordre"); |
if (removePrefix) return renvoyerValeurCorrecte("ordre"); |
else return renvoyerValeurCorrecte(PREFIXE+"_ordre"); |
} |
public void setOrdreAuteurs(String ordre) { |
if (ordre.matches("[0-9]+")) { |
this.set("ordre", ordre); |
if (removePrefix) this.set("ordre", ordre); |
else this.set(PREFIXE+"_ordre", ordre); |
this.set("_ordre_", ordre); |
} |
} |
} |
Property changes: |
Modified: svn:mergeinfo |
Merged /trunk/src/org/tela_botanica/client/modeles/publication/PublicationAPersonne.java:r11-934 |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/publication/PublicationAPersonne.java:r1417-1511 |
/trunk/src/org/tela_botanica/client/modeles/UtilisateurAsyncDao.java |
---|
Property changes: |
Modified: svn:mergeinfo |
Merged /trunk/src/org/tela_botanica/client/modeles/UtilisateurAsyncDao.java:r11-68 |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/UtilisateurAsyncDao.java:r1417-1511 |
/trunk/src/org/tela_botanica/client/modeles/Valeur.java |
---|
Property changes: |
Modified: svn:mergeinfo |
Merged /trunk/src/org/tela_botanica/client/modeles/Valeur.java:r11-68 |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/Valeur.java:r1417-1511 |
/trunk/src/org/tela_botanica/client/modeles/ValeurListe.java |
---|
Property changes: |
Modified: svn:mergeinfo |
Merged /trunk/src/org/tela_botanica/client/modeles/ValeurListe.java:r11-68 |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/ValeurListe.java:r1417-1511 |
/trunk/src/org/tela_botanica/client/modeles/Aide.java |
---|
Property changes: |
Modified: svn:mergeinfo |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/Aide.java:r1417-1511 |
Merged /trunk/src/org/tela_botanica/client/modeles/Aide.java:r11-65 |
/trunk/src/org/tela_botanica/client/modeles/Menu.java |
---|
Property changes: |
Modified: svn:mergeinfo |
Merged /trunk/src/org/tela_botanica/client/modeles/Menu.java:r11-59 |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/Menu.java:r1417-1511 |
/trunk/src/org/tela_botanica/client/modeles/MenuApplicationId.java |
---|
Property changes: |
Modified: svn:mergeinfo |
Merged /trunk/src/org/tela_botanica/client/modeles/MenuApplicationId.java:r11-325 |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/MenuApplicationId.java:r1417-1511 |
/trunk/src/org/tela_botanica/client/modeles/. |
---|
Property changes: |
Modified: svn:mergeinfo |
Merged /trunk/src/org/tela_botanica/client/modeles:r11-50 |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles:r1417-1511 |