/branches/v1.8-narince/src/org/tela_botanica/client/modeles/collection/CollectionBotanique.java |
---|
New file |
0,0 → 1,393 |
package org.tela_botanica.client.modeles.collection; |
import java.util.Iterator; |
import java.util.Set; |
import org.tela_botanica.client.modeles.aDonnee; |
import com.google.gwt.json.client.JSONObject; |
public class CollectionBotanique extends aDonnee { |
private static final long serialVersionUID = -6659148189825855729L; |
public static final String PREFIXE = "ccb"; |
public static String[] champsObligatoires = {"ccb_id_collection"}; |
public CollectionBotanique() { |
} |
public CollectionBotanique(JSONObject botanique) { |
// l'objet JSON est une table de hachage |
Set<String> im = botanique.keySet(); |
// Parcourt pour chaque clé |
for (Iterator<String> it = im.iterator(); it.hasNext();) { |
// Si elle est associée à une valeur, nous l'ajoutons |
String cle = it.next(); |
if (cle.startsWith(PREFIXE+"_")) { |
// Suppression de l'abréviation du champ. Inutile dans le contexte d'un objet |
String cleObjet = cle.replaceFirst("^"+PREFIXE+"_", ""); |
// Sinon, nous ajoutons la clé avec une valeur vide |
String valeur = ""; |
if (botanique.get(cle).isString() != null) { |
valeur = botanique.get(cle).isString().stringValue(); |
} |
this.set(cleObjet, valeur); |
} |
} |
} |
@Override |
protected String getPrefixe() { |
return PREFIXE; |
} |
protected String[] getChampsObligatoires() { |
return champsObligatoires; |
} |
// ID |
public String getId() { |
return renvoyerValeurCorrecte("id_collection"); |
} |
public void setId(String idCollection) { |
this.set("id_collection", idCollection); |
} |
// NBRE ECHANTILLON |
public String getNbreEchantillon() { |
return renvoyerValeurCorrecte("nbre_echantillon"); |
} |
public void setNbreEchantillon(String type) { |
this.set("nbre_echantillon", type); |
} |
// TYPE |
public String getType() { |
return renvoyerValeurCorrecte("ce_truk_type"); |
} |
public void setType(String type) { |
this.set("ce_truk_type", type); |
} |
// UNITÉ RANGEMENT |
public String getUniteRangement() { |
return renvoyerValeurCorrecte("truk_unite_rangement"); |
} |
public void setUniteRangement(String uniteRangement) { |
this.set("truk_unite_rangement", uniteRangement); |
} |
// UNITÉ RANGEMENT ÉTAT |
public String getUniteRangementEtat() { |
return renvoyerValeurCorrecte("ce_unite_rangement_etat"); |
} |
public void setUniteRangementEtat(String uniteRangementEtat) { |
this.set("ce_unite_rangement_etat", uniteRangementEtat); |
} |
// UNITÉ BASE |
public String getUniteBase() { |
return renvoyerValeurCorrecte("truk_unite_base"); |
} |
public void setUniteBase(String uniteBase) { |
this.set("truk_unite_base", uniteBase); |
} |
// CONSERVATION PAPIER TYPE |
public String getConservationPapierType() { |
return renvoyerValeurCorrecte("truk_conservation_papier_type"); |
} |
public void setConservationPapierType(String typePapierConservation) { |
this.set("truk_conservation_papier_type", typePapierConservation); |
} |
// CONSERVATION MÉTHODE |
public String getConservationMethode() { |
return renvoyerValeurCorrecte("truk_conservation_methode"); |
} |
public void setConservationMethode(String methodeConservation) { |
this.set("truk_conservation_methode", methodeConservation); |
} |
// ÉTIQUETTE FIXATION POURCENT |
public String getEtiquetteFixationPourcent() { |
return renvoyerValeurCorrecte("etiquette_fixation_pourcent"); |
} |
public void setEtiquetteFixationPourcent(String etiquetteFixationPourcent) { |
this.set("etiquette_fixation_pourcent", etiquetteFixationPourcent); |
} |
// SPÉCIMEN FIXATION POURCENT |
public String getSpecimenFixationPourcent() { |
return renvoyerValeurCorrecte("specimen_fixation_pourcent"); |
} |
public void setSpecimenFixationPourcent(String specimenFixationPourcent) { |
this.set("specimen_fixation_pourcent", specimenFixationPourcent); |
} |
// SPÉCIMEN FIXATION MÉTHODE |
public String getSpecimenFixationMethode() { |
return renvoyerValeurCorrecte("truk_specimen_fixation_methode"); |
} |
public void setSpecimenFixationMethode(String specimenFixationMethode) { |
this.set("truk_specimen_fixation_methode", specimenFixationMethode); |
} |
// ÉTIQUETTE FIXATION SUPPORT |
public String getEtiquetteFixationSupport() { |
return renvoyerValeurCorrecte("truk_etiquette_fixation_support"); |
} |
public void setEtiquetteFixationSupport(String etiquetteFixationSupport) { |
this.set("truk_etiquette_fixation_support", etiquetteFixationSupport); |
} |
// ÉTIQUETTE FIXATION SPECIMEN |
public String getEtiquetteFixationSpecimen() { |
return renvoyerValeurCorrecte("truk_etiquette_fixation_specimen"); |
} |
public void setEtiquetteFixationSpecimen(String etiquetteFixationSpecimen) { |
this.set("truk_etiquette_fixation_specimen", etiquetteFixationSpecimen); |
} |
// ÉTIQUETTE ÉCRITURE |
public String getEtiquetteEcriture() { |
return renvoyerValeurCorrecte("truk_etiquette_ecriture"); |
} |
public void setEtiquetteEcriture(String etiquetteEcriture) { |
this.set("truk_etiquette_ecriture", etiquetteEcriture); |
} |
// TRAITEMENT |
public String getTraitement() { |
return renvoyerValeurCorrecte("ce_traitement"); |
} |
public void setTraitement(String traitement) { |
this.set("ce_traitement", traitement); |
} |
// TRAITEMENT POISON |
public String getTraitementPoison() { |
return renvoyerValeurCorrecte("truk_traitement_poison"); |
} |
public void setTraitementPoison(String traitementPoison) { |
this.set("truk_traitement_poison", traitementPoison); |
} |
// TRAITEMENT INSECTE |
public String getTraitementInsecte() { |
return renvoyerValeurCorrecte("truk_traitement_insecte"); |
} |
public void setTraitementInsecte(String traitementInsecte) { |
this.set("truk_traitement_insecte", traitementInsecte); |
} |
// ÉTAT GÉNÉRAL |
public String getEtatGeneral() { |
return renvoyerValeurCorrecte("ce_etat_general"); |
} |
public void setEtatGeneral(String etatGeneral) { |
this.set("ce_etat_general", etatGeneral); |
} |
// DÉGRADATION SPECIMEN |
public String getDegradationSpecimen() { |
return renvoyerValeurCorrecte("truk_degradation_specimen"); |
} |
public void setDegradationSpecimen(String degradationSpecimen) { |
this.set("truk_degradation_specimen", degradationSpecimen); |
} |
// DÉGRADATION PRÉSENTATION |
public String getDegradationPresentation() { |
return renvoyerValeurCorrecte("truk_degradation_presentation"); |
} |
public void setDegradationPresentation(String degradationPresentation) { |
this.set("truk_degradation_presentation", degradationPresentation); |
} |
// DÉTERMINATION |
public String getDetermination() { |
return renvoyerValeurCorrecte("ce_determination"); |
} |
public void setDetermination(String determination) { |
this.set("ce_determination", determination); |
} |
// NATURE |
public String getNature() { |
return renvoyerValeurCorrecte("truk_nature"); |
} |
public void setNature(String nature) { |
this.set("truk_nature", nature); |
} |
// SPÉCIALITÉ |
public String getSpecialite() { |
return renvoyerValeurCorrecte("specialite"); |
} |
public void setSpecialite(String specialite) { |
this.set("specialite", specialite); |
} |
// RÉCOLTE DATE DÉBUT |
public String getRecolteDateDebut() { |
return renvoyerValeurCorrecte("recolte_date_debut"); |
} |
public void setRecolteDateDebut(String dateDebut) { |
this.set("recolte_date_debut", dateDebut); |
} |
// RÉCOLTE DATE DÉBUT TYPE |
public String getRecolteDateDebutType() { |
return renvoyerValeurCorrecte("ce_recolte_date_debut_type"); |
} |
public void setRecolteDateDebutType(String dateDebutType) { |
this.set("ce_recolte_date_debut_type", dateDebutType); |
} |
// RÉCOLTE DATE FIN |
public String getRecolteDateFin() { |
return renvoyerValeurCorrecte("recolte_date_fin"); |
} |
public void setRecolteDateFin(String dateFin) { |
this.set("recolte_date_fin", dateFin); |
} |
// RÉCOLTE DATE DÉBUT TYPE |
public String getRecolteDateFinType() { |
return renvoyerValeurCorrecte("ce_recolte_date_fin_type"); |
} |
public void setRecolteDateFinType(String dateFinType) { |
this.set("ce_recolte_date_fin_type", dateFinType); |
} |
// CLASSEMENT ANNOTATION |
public String getClassementAnnotation() { |
return renvoyerValeurCorrecte("annotation_classement"); |
} |
public void setClassementAnnotation(String annotation) { |
this.set("annotation_classement", annotation); |
} |
// CLASSEMENT ÉTAT |
public String getClassementEtat() { |
return renvoyerValeurCorrecte("ce_classement_etat"); |
} |
public void setClassementEtat(String classementEtat) { |
this.set("ce_classement_etat", classementEtat); |
} |
// ÉTIQUETTE RENSEIGNEMENT |
public String getEtiquetteRenseignement() { |
return renvoyerValeurCorrecte("truk_etiquette_renseignement"); |
} |
public void setEtiquetteRenseignement(String etiquetteRenseignement) { |
this.set("truk_etiquette_renseignement", etiquetteRenseignement); |
} |
// PRÉCISION LOCALITÉ |
public String getPrecisionLocalite() { |
return renvoyerValeurCorrecte("ce_precision_localite"); |
} |
public void setPrecisionLocalite(String precisionLocalite) { |
this.set("ce_precision_localite", precisionLocalite); |
} |
// PRÉCISION DATE |
public String getPrecisionDate() { |
return renvoyerValeurCorrecte("ce_precision_date"); |
} |
public void setPrecisionDate(String precisionDate) { |
this.set("ce_precision_date", precisionDate); |
} |
// ANNOTATIONS DIVERSES |
public String getAnnotationsDiverses() { |
return renvoyerValeurCorrecte("annotation_diverse"); |
} |
public void setAnnotationsDiverses(String annotation) { |
this.set("annotation_diverse", annotation); |
} |
// COLLECTION INTÉGRÉ |
public String getCollectionIntegre() { |
return renvoyerValeurCorrecte("ce_collection_integre"); |
} |
public void setCollectionIntegre(String collectionIntegre) { |
this.set("ce_collection_integre", collectionIntegre); |
} |
// COLLECTION INTÉGRÉ INFO |
public String getCollectionIntegreInfo() { |
return renvoyerValeurCorrecte("ce_collection_integre_info"); |
} |
public void setCollectionIntegreInfo(String collectionIntegreInfo) { |
this.set("ce_collection_integre_info", collectionIntegreInfo); |
} |
// INVENTAIRE |
public String getInventaire() { |
return renvoyerValeurCorrecte("ce_inventaire"); |
} |
public void setInventaire(String inventaire) { |
this.set("ce_inventaire", inventaire); |
} |
// INVENTAIRE AUTEUR |
public String getInventaireAuteur() { |
return renvoyerValeurCorrecte("ce_inventaire_auteur"); |
} |
public void setInventaireAuteur(String inventaireAuteur) { |
this.set("ce_inventaire_auteur", inventaireAuteur); |
} |
// INVENTAIRE FORME |
public String getInventaireForme() { |
return renvoyerValeurCorrecte("ce_inventaire_forme"); |
} |
public void setInventaireForme(String inventaireForme) { |
this.set("ce_inventaire_forme", inventaireForme); |
} |
// INVENTAIRE INFO |
public String getInventaireInfo() { |
return renvoyerValeurCorrecte("inventaire_info"); |
} |
public void setInventaireInfo(String inventaireInfo) { |
this.set("inventaire_info", inventaireInfo); |
} |
// INVENTAIRE DIGITAL |
public String getInventaireDigital() { |
return renvoyerValeurCorrecte("ce_truk_inventaire_digital"); |
} |
public void setInventaireDigital(String inventaireDigital) { |
this.set("ce_truk_inventaire_digital", inventaireDigital); |
} |
// INVENTAIRE DIGITAL POURCENT |
public String getInventaireDigitalPourcent() { |
return renvoyerValeurCorrecte("inventaire_digital_pourcent"); |
} |
public void setInventaireDigitalPourcent(String inventaireDigitalPourcent) { |
this.set("inventaire_digital_pourcent", inventaireDigitalPourcent); |
} |
// INVENTAIRE ETAT |
public String getInventaireEtat() { |
return renvoyerValeurCorrecte("ce_inventaire_etat"); |
} |
public void setInventaireEtat(String inventaireEtat) { |
this.set("ce_inventaire_etat", inventaireEtat); |
} |
//DELETEME ::: INVENTAIRE DONNÉES TYPES |
/*public String getInventaireDonneesTypes() { |
return renvoyerValeurCorrecte("inventaire_donnee_type"); |
} |
public void setInventaireDonneesTypes(String inventaireDonneesTypes) { |
this.set("inventaire_donnee_type", inventaireDonneesTypes); |
}*/ |
} |
Property changes: |
Added: svn:mergeinfo |
Merged /branches/v1.0-syrah/src/org/tela_botanica/client/modeles/collection/CollectionBotanique.java:r1136-1368 |
Merged /trunk/src/org/tela_botanica/client/modeles/collection/CollectionBotanique.java:r11-934,1209-1382 |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/collection/CollectionBotanique.java:r1383-1511 |
/branches/v1.8-narince/src/org/tela_botanica/client/modeles/collection/CollectionAPersonne.java |
---|
New file |
0,0 → 1,163 |
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.util.Debug; |
import org.tela_botanica.client.util.UtilString; |
import com.extjs.gxt.ui.client.data.BaseModelData; |
import com.extjs.gxt.ui.client.data.ModelData; |
import com.google.gwt.json.client.JSONObject; |
public class CollectionAPersonne extends aDonnee { |
private static final long serialVersionUID = 1L; |
public static final String PREFIXE = "ccap"; |
private Personne personneLiee = null; |
public static String[] champsObligatoires = {"ccap_id_collection", "ccap_id_personne", "ccap_id_role"}; |
public CollectionAPersonne() { |
initialiser(new JSONObject()); |
} |
public CollectionAPersonne(JSONObject collectionAPersonneListe) { |
initialiser(collectionAPersonneListe); |
} |
public CollectionAPersonne(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 = ""; |
cleObjet = cle.replaceFirst("^"+CollectionAPersonne.PREFIXE+"_", ""); |
cleObjet = cleObjet.replaceFirst("^"+Personne.PREFIXE+"_", ""); |
this.set(cleObjet, a.get(cle)); |
} |
} |
setPersonne(new Personne(model)); |
this.set("_etat_", a.get("_etat_")); |
} |
@Override |
protected String getPrefixe() { |
return PREFIXE; |
} |
protected String[] getChampsObligatoires() { |
return champsObligatoires; |
} |
private void initialiser(JSONObject collectionAPersonneListe) { |
setPersonne(new Personne(collectionAPersonneListe)); |
initialiserModele(collectionAPersonneListe); |
initialiserChampsPourGrille(); |
} |
// PERSONNE |
public Personne getPersonne() { |
return personneLiee; |
} |
public void setPersonne(Personne personne) { |
personneLiee = personne; |
initialiserChampsPourGrille(); |
if (personne != null) { |
if (personne.getId() != null && !UtilString.isEmpty(personne.getId())) setIdPersonne(personne.getId()); |
} |
} |
public void setPersonnePourGrillePaginable(Personne personne) { |
personneLiee = personne; |
initialiserChampsPourGrillePaginable(); |
if (personne != null) { |
if (personne.getId() != null && !UtilString.isEmpty(personne.getId())) setIdPersonne(personne.getId()); |
} |
} |
private void initialiserChampsPourGrille() { |
set("_role_", getIdRole()); |
set("fmt_nom_complet", getPersonne().getNomComplet()); |
set("nom", getPersonne().getNom()); |
set("prenom", getPersonne().getPrenom()); |
set("naissance_date", getPersonne().getNaissanceDate()); |
set("naissance_lieu", getPersonne().getNaissanceLieu()); |
set("_deces_", getPersonne().getDeces()); |
set("deces_date", getPersonne().getDecesDate()); |
set("deces_lieu", getPersonne().getDecesLieu()); |
set("_etat_", ""); |
} |
public void initialiserChampsPourGrillePaginable() { |
set("ccap_id_role", getIdRole()); |
set("_role_", getIdRole()); |
set("cp_fmt_nom_complet", getPersonne().getNomComplet()); |
set("cp_nom", getPersonne().getNom()); |
set("cp_prenom", getPersonne().getPrenom()); |
set("cp_naissance_date", getPersonne().getNaissanceDate()); |
set("cp_naissance_lieu", getPersonne().getNaissanceLieu()); |
set("_deces_", getPersonne().getDeces()); |
set("cp_deces", getPersonne().getDeces()); |
set("cp_deces_date", getPersonne().getDecesDate()); |
set("cp_deces_lieu", getPersonne().getDecesLieu()); |
} |
// ID |
/** Génère un identifiant de CollectionAPersonne. |
* |
* C'est une concaténation des clés primaires de la table coel_collection_a_personne séparées par un tiret "-". |
* |
* @return identifiant unique d'une relation "collection à personne". |
*/ |
public String getId() { |
String idCollection = getIdCollection(); |
String idPersonne = getIdPersonne(); |
String idRole = getIdRole(); |
if (idCollection.equals("") && idPersonne.equals("") && idRole.equals("")) { |
return null; |
} else { |
return (idCollection+"-"+idPersonne+"-"+idRole); |
} |
} |
//+---------------------------------------------------------------------------------------------------------------+ |
// CHAMPS PROVENANT de la TABLE COEL_COLLECTION_A_PERSONNE |
// ID COLLECTION |
public String getIdCollection() { |
return renvoyerValeurCorrecte("id_collection"); |
} |
public void setIdCollection(String idCollection) { |
set("id_collection", idCollection); |
} |
// ID PERSONNE |
public String getIdPersonne() { |
return renvoyerValeurCorrecte("id_personne"); |
} |
public void setIdPersonne(String ip) { |
set("id_personne", ip); |
} |
// 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_");*/ |
} |
public void setIdRole(String ir) { |
set("id_role", ir); |
} |
} |
Property changes: |
Added: svn:mergeinfo |
Merged /branches/v1.0-syrah/src/org/tela_botanica/client/modeles/collection/CollectionAPersonne.java:r1136-1368 |
Merged /trunk/src/org/tela_botanica/client/modeles/collection/CollectionAPersonne.java:r11-934,1209-1382 |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/collection/CollectionAPersonne.java:r1383-1511 |
/branches/v1.8-narince/src/org/tela_botanica/client/modeles/collection/CollectionAPersonneListe.java |
---|
New file |
0,0 → 1,41 |
package org.tela_botanica.client.modeles.collection; |
import org.tela_botanica.client.modeles.aDonneeListe; |
import com.google.gwt.json.client.JSONArray; |
import com.google.gwt.json.client.JSONObject; |
/** |
* Table de hachage composée d'informations sur les Structures et les Personnes, renvoyé par un objet de type DAO |
* La clé est une concaténation des clés primaires de la table coel_structure_a_personne séparées par un tiret "-". |
* |
* @author david delon |
* |
*/ |
public class CollectionAPersonneListe extends aDonneeListe<CollectionAPersonne> { |
private static final long serialVersionUID = 1L; |
public CollectionAPersonneListe() { |
super(); |
} |
public CollectionAPersonneListe(int taille) { |
super(taille); |
} |
public CollectionAPersonneListe(JSONArray structures) { |
super(structures.size()) ; |
final int taillemax = structures.size(); |
for (int i = 0; i < taillemax; i++) { |
JSONObject collectionAPersonneCourante = structures.get(i).isObject() ; |
if (collectionAPersonneCourante != null) { |
CollectionAPersonne collectionAPersonne = new CollectionAPersonne(collectionAPersonneCourante); |
this.put(collectionAPersonne.getId(), collectionAPersonne); |
} |
} |
} |
} |
Property changes: |
Added: svn:mergeinfo |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/collection/CollectionAPersonneListe.java:r1383-1511 |
Merged /branches/v1.0-syrah/src/org/tela_botanica/client/modeles/collection/CollectionAPersonneListe.java:r1136-1368 |
Merged /trunk/src/org/tela_botanica/client/modeles/collection/CollectionAPersonneListe.java:r11-934,1209-1382 |
/branches/v1.8-narince/src/org/tela_botanica/client/modeles/collection/CollectionAPublicationAsyncDao.java |
---|
New file |
0,0 → 1,193 |
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; |
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.synchronisation.Reponse; |
import org.tela_botanica.client.util.Debug; |
import org.tela_botanica.client.util.UtilDAO; |
import com.extjs.gxt.ui.client.Registry; |
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 { |
private static final String SERVICE_NOM = "CoelCollectionAPublication"; |
private String utilisateurId = null; |
private Rafraichissable vueARafraichir = null; |
public CollectionAPublicationAsyncDao(Rafraichissable vueARafraichirCourrante) { |
if (Mediateur.DEBUG) System.out.println("|| CollectionAPublicationAsyncDao > vueARafraichir = "+vueARafraichirCourrante.getClass().toString()); |
vueARafraichir = vueARafraichirCourrante; |
utilisateurId = ((Mediateur) Registry.get(RegistreId.MEDIATEUR)).getUtilisateurId(); |
} |
public void selectionner(final boolean paginationProgressive, final String collectionId, final String recherche, final int start, final int nbElements, final Integer seqId) { |
String[] parametres = {collectionId}; |
HashMap<String, String> restrictions = new HashMap<String, String>(); |
if (nbElements != -1) { |
restrictions.put("limit", String.valueOf(nbElements)); |
} |
restrictions.put("orderby", "cpu_fmt_auteur"); |
/** 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 { |
// 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); |
} |
} |
} |
}); |
} |
} |
public void ajouter(String collectionId, CollectionAPublication publications) { |
String postDonneesEncodees = construirePost(collectionId, publications); |
final JsonRestRequestBuilder rb = UtilDAO.construireRequetePost(SERVICE_NOM); |
rb.envoyerRequete(postDonneesEncodees, new JsonRestRequestCallback() { |
@Override |
public void surReponse(JSONValue responseValue) { |
// Si la requête est un succès, reception d'une chaine |
if (responseValue.isString() != null) { |
Information info = new Information("ajout_collection_a_publication"); |
info.setMessage(responseValue.isString().stringValue()); |
vueARafraichir.rafraichir(info); |
} else { |
GWT.log(rb.getUrl()+"\n\tLa réponse n'est pas une chaine JSON.", null); |
} |
} |
}); |
} |
public void modifier(CollectionAPublication publications) { |
String[] parametres = {publications.getIdCollection(), publications.getIdPublication()}; |
final JsonRestRequestBuilder rb = UtilDAO.construireRequetePost(SERVICE_NOM, parametres); |
String postDonneesEncodees = construirePost(publications.getIdCollection(), publications); |
rb.envoyerRequete(postDonneesEncodees, new JsonRestRequestCallback() { |
@Override |
public void surReponse(JSONValue responseValue) { |
Information info = new Information("modif_collection_a_publication"); |
// Si la requête est un succès, reception d'une chaine |
if (responseValue.isString() != null) { |
info.setMessage(responseValue.isString().stringValue()); |
vueARafraichir.rafraichir(info); |
} else { |
GWT.log(rb.getUrl()+"\n\tLa réponse n'est pas une chaine JSON.", null); |
} |
} |
}); |
} |
public void supprimer(String idCollectionAPublication) { |
String[] parametres = {utilisateurId, idCollectionAPublication}; |
final JsonRestRequestBuilder rb = UtilDAO.construireRequetePost(SERVICE_NOM, parametres); |
rb.envoyerRequeteSuppression(new JsonRestRequestCallback() { |
@Override |
public void surReponse(JSONValue responseValue) { |
if (responseValue.isString() != null) { |
Information info = new Information("suppression_collection_a_publication"); |
info.setMessage(responseValue.isString().stringValue()); |
vueARafraichir.rafraichir(info); |
} else { |
GWT.log(rb.getUrl()+"\n\tLa réponse n'est pas une chaine JSON.", null); |
} |
} |
}); |
} |
private String construirePost(String collectionId, CollectionAPublication publication) { |
String postDonnees = "cmhl_ce_modifier_par=" + URL.encodeComponent(utilisateurId) + |
"&ccapu_id_collection=" + URL.encodeComponent(collectionId) + |
"&ccapu_id_publication=" + URL.encodeComponent(publication.getIdPublication()) + |
"&ccapu_source=" + URL.encodeComponent(publication.getSource()); |
return postDonnees; |
} |
} |
Property changes: |
Added: svn:mergeinfo |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/collection/CollectionAPublicationAsyncDao.java:r1383-1511 |
Merged /branches/v1.0-syrah/src/org/tela_botanica/client/modeles/collection/CollectionAPublicationAsyncDao.java:r1136-1368 |
Merged /trunk/src/org/tela_botanica/client/modeles/collection/CollectionAPublicationAsyncDao.java:r11-934,1209-1382 |
/branches/v1.8-narince/src/org/tela_botanica/client/modeles/collection/CollectionAStructure.java |
---|
New file |
0,0 → 1,35 |
package org.tela_botanica.client.modeles.collection; |
import org.tela_botanica.client.modeles.aDonnee; |
import com.google.gwt.json.client.JSONObject; |
public class CollectionAStructure extends aDonnee { |
private static final long serialVersionUID = -8891776931124681678L; |
public static final String PREFIXE = "cc"; |
public static String[] champsObligatoires = {"cc_id_collection","cc_nom"}; |
public CollectionAStructure(JSONObject collectionAStructure){ |
initialiserModele(collectionAStructure); |
} |
@Override |
protected String getPrefixe() { |
return PREFIXE; |
} |
@Override |
protected String[] getChampsObligatoires() { |
return champsObligatoires; |
} |
public String getNom() { |
return renvoyerValeurCorrecte("nom"); |
} |
public String getIdCollection() { |
return renvoyerValeurCorrecte("id_collection"); |
} |
} |
/branches/v1.8-narince/src/org/tela_botanica/client/modeles/collection/CollectionAsyncDao.java |
---|
New file |
0,0 → 1,232 |
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; |
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.synchronisation.Reponse; |
import org.tela_botanica.client.util.Debug; |
import org.tela_botanica.client.util.UtilDAO; |
import com.extjs.gxt.ui.client.Registry; |
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.JSONNumber; |
import com.google.gwt.json.client.JSONObject; |
import com.google.gwt.json.client.JSONValue; |
import com.google.gwt.user.client.Window; |
public class CollectionAsyncDao { |
public static final String SERVICE_NOM = "CoelCollection"; |
public static String tri = null; |
private String utilisateurId = null; |
private Rafraichissable vueARafraichir = null; |
public CollectionAsyncDao(Rafraichissable vueARafraichirCourrante) { |
//if (Mediateur.DEBUG) System.out.println("|| CollectionAsyncDao > vueARafraichir = "+vueARafraichirCourrante.getClass().toString()); |
vueARafraichir = vueARafraichirCourrante; |
utilisateurId = ((Mediateur) Registry.get(RegistreId.MEDIATEUR)).getUtilisateurId(); |
} |
/** |
* |
* @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 collectionId, final String nomCollection, final int start, final int nbElements, final Integer seqId) { |
// Ajout des paramètres et données à selectionner dans l'URL |
String nom = (nomCollection == null) ? "%" : nomCollection+"%"; |
String[] parametres = {collectionId, nom}; |
HashMap<String, String> restrictions = new HashMap<String, String>(); |
if (nbElements != -1) { |
restrictions.put("limit", String.valueOf(nbElements)); |
} |
if(tri != null) { |
restrictions.put("orderby", tri); |
} |
/** 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("<-- CollectionAsyncDao > Liste paginée, retour au sequenceur"); |
Reponse reponseRequete = new Reponse(responseValue, seqId); |
vueARafraichir.rafraichir(reponseRequete); |
} |
else { |
if (Mediateur.DEBUG) System.out.println("<-- CollectionAsyncDao > 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("collections").isArray() != null) { |
final JSONArray reponse = responseObject.get("collections").isArray(); |
CollectionListe collections = new CollectionListe(reponse, responseObject.get("nbElements").isNumber(), vueARafraichir); |
collections.setTaillePage(nbElements); |
collections.setPageCourante(start); |
vueARafraichir.rafraichir(collections); |
// Si la réponse est un objet, alors c'est une unique collection qui a été retournée |
} else if (responseObject.get("collections").isObject() != null) { |
final JSONObject reponse = responseObject.get("collections").isObject(); |
Collection collection = new Collection(reponse); |
CollectionBotanique collectionBotanique = new CollectionBotanique(reponse); |
collection.setBotanique(collectionBotanique); |
Information info = new Information("selection_collection"); |
info.setDonnee(0, collection); |
// et on met à jour le demandeur des données |
if (seqId != null) { |
if (Mediateur.DEBUG) System.out.println("<-- CollectionAsyncDao > Liste non paginée, retour au sequenceur"); |
Reponse reponseRequete = new Reponse(info, seqId); |
vueARafraichir.rafraichir(reponseRequete); |
} |
else { |
if (Mediateur.DEBUG) System.out.println("<-- CollectionAsyncDao > Liste non paginée, retour à "+vueARafraichir.getClass().toString()); |
vueARafraichir.rafraichir(info); |
} |
} |
} else { |
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 |
if (collectionId == null) { |
CollectionListe collections = new CollectionListe(0); |
vueARafraichir.rafraichir(collections); |
} |
} |
} |
}); |
} |
} |
public void ajouter(Collection collection) { |
String postDonneesEncodees = construirePost(null, collection); |
final JsonRestRequestBuilder rb = UtilDAO.construireRequetePost(SERVICE_NOM); |
rb.envoyerRequete(postDonneesEncodees, new JsonRestRequestCallback() { |
@Override |
public void surReponse(JSONValue responseValue) { |
if (responseValue.isString() != null) { |
Information info = new Information("ajout_collection"); |
String structureIdOuMessage = responseValue.isString().stringValue(); |
if (structureIdOuMessage.matches("^[0-9]+$")) { |
info.setDonnee(structureIdOuMessage); |
} else { |
info.setMessage(structureIdOuMessage); |
} |
vueARafraichir.rafraichir(info); |
} else { |
GWT.log(rb.getUrl()+"\n\tLa réponse n'est pas une chaine JSON.", null); |
} |
} |
}); |
} |
public void modifier(Collection collection) { |
String postDonneesEncodees = construirePost(collection.getId(), collection); |
String[] parametres = {collection.getId()}; |
final JsonRestRequestBuilder rb = UtilDAO.construireRequetePost(SERVICE_NOM, parametres); |
rb.envoyerRequete(postDonneesEncodees, new JsonRestRequestCallback() { |
@Override |
public void surReponse(JSONValue responseValue) { |
// Si la requête est un succès, reception d'une chaine |
if (responseValue.isString() != null) { |
Information info = new Information("modif_collection"); |
info.setMessage(responseValue.isString().stringValue()); |
vueARafraichir.rafraichir(info); |
} else { |
GWT.log(rb.getUrl()+"\n\tLa réponse n'est pas une chaine JSON.", null); |
} |
} |
}); |
} |
public void supprimer(String collectionsId) { |
String[] parametres = {utilisateurId, collectionsId}; |
final JsonRestRequestBuilder rb = UtilDAO.construireRequetePost(SERVICE_NOM, parametres); |
rb.envoyerRequeteSuppression(new JsonRestRequestCallback() { |
@Override |
public void surReponse(JSONValue responseValue) { |
if (responseValue.isString() != null) { |
Information info = new Information("suppression_collection"); |
info.setMessage(responseValue.isString().stringValue()); |
vueARafraichir.rafraichir(info); |
} else { |
GWT.log(rb.getUrl()+"\n\tLa réponse n'est pas une chaine JSON.", null); |
} |
} |
}); |
} |
private String construirePost(String collectionId, Collection collection) { |
String postDonnees = "cmhl_ce_modifier_par=" + URL.encodeComponent(utilisateurId); |
if (collection != null) { |
if (collectionId != null) { |
postDonnees += "&cc_id_collection=" + URL.encodeComponent(collectionId); |
} |
postDonnees += "&" + collection.obtenirChainePOST(); |
if (collection.getBotanique() != null) { |
if (collectionId != null) { |
postDonnees += "&ccb_id_collection=" + URL.encodeComponent(collectionId); |
} |
CollectionBotanique collectionBotanique = collection.getBotanique(); |
postDonnees += "&" + collectionBotanique.obtenirChainePOST(); |
} |
} |
return postDonnees; |
} |
} |
Property changes: |
Added: svn:mergeinfo |
Merged /trunk/src/org/tela_botanica/client/modeles/collection/CollectionAsyncDao.java:r11-934,1209-1382 |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/collection/CollectionAsyncDao.java:r1383-1511 |
Merged /branches/v1.0-syrah/src/org/tela_botanica/client/modeles/collection/CollectionAsyncDao.java:r1136-1368 |
/branches/v1.8-narince/src/org/tela_botanica/client/modeles/collection/CollectionAStructureListe.java |
---|
New file |
0,0 → 1,33 |
package org.tela_botanica.client.modeles.collection; |
import org.tela_botanica.client.modeles.aDonneeListe; |
import com.google.gwt.json.client.JSONArray; |
import com.google.gwt.json.client.JSONObject; |
import com.google.gwt.user.client.Window; |
public class CollectionAStructureListe extends aDonneeListe<CollectionAStructure> { |
private static final long serialVersionUID = -660181428725095350L; |
public CollectionAStructureListe() { |
super(); |
} |
public CollectionAStructureListe(int taille) { |
super(taille); |
} |
public CollectionAStructureListe(JSONArray collectionAStructureListe) { |
super(collectionAStructureListe.size()) ; |
final int taillemax = collectionAStructureListe.size(); |
for (int i = 0; i < taillemax; i++) { |
JSONObject collectionAStructureCourante = collectionAStructureListe.get(i).isObject() ; |
if (collectionAStructureCourante != null) { |
CollectionAStructure collectionAStructure = new CollectionAStructure(collectionAStructureCourante); |
this.put(collectionAStructure.getIdCollection(), collectionAStructure); |
} |
} |
} |
} |
/branches/v1.8-narince/src/org/tela_botanica/client/modeles/collection/UniteBase.java |
---|
New file |
0,0 → 1,112 |
package org.tela_botanica.client.modeles.collection; |
import org.tela_botanica.client.util.UtilString; |
import com.extjs.gxt.ui.client.data.BaseModelData; |
public class UniteBase extends BaseModelData { |
private static final long serialVersionUID = 394843761854792528L; |
public static final String COMPTE_EXACT = "E"; |
public static final String COMPTE_APPROXIMATIF = "A"; |
public UniteBase() { |
} |
public UniteBase(String id, String type, int nombre, String precision, String format, int nombreParts, String precisionPart, int nombreSp, String precisionSp) { |
setId(id); |
setType(type); |
setNombre(nombre); |
setPrecision(precision); |
setFormat(format); |
setTypeAutre(false); |
} |
public String getId() { |
return renvoyerValeurCorrecte((String) get("id")); |
} |
public void setId(String id) { |
set("id", id); |
} |
public String getType() { |
return renvoyerValeurCorrecte((String) get("type")); |
} |
public void setType(String type) { |
set("type", type); |
} |
public double getNombre() { |
if (get("nombre") == null) { |
return new Double(0); |
} |
return get("nombre"); |
} |
public void setNombre(double nombre) { |
set("nombre", nombre); |
} |
public String getPrecision() { |
return renvoyerValeurCorrecte((String) get("precision")); |
} |
public void setPrecision(String precision) { |
set("precision", precision); |
} |
public String getFormat() { |
return renvoyerValeurCorrecte((String) get("format")); |
} |
public void setFormat(String format) { |
set("format", format); |
} |
public double getNombrePart() { |
if (get("nombre_part") == null) { |
return new Double(0); |
} |
return get("nombre_part"); |
} |
public void setNombrePart(double nombre) { |
set("nombre_part", nombre); |
} |
public String getPrecisionPart() { |
return renvoyerValeurCorrecte((String) get("precision_part")); |
} |
public void setPrecisionPart(String precision) { |
set("precision_part", precision); |
} |
public double getNombreSp() { |
if (get("nombre_sp") == null) { |
return new Double(0); |
} |
return get("nombre_sp"); |
} |
public void setNombreSp(double nombre) { |
set("nombre_sp", nombre); |
} |
public String getPrecisionSp() { |
return renvoyerValeurCorrecte((String) get("precision_sp")); |
} |
public void setPrecisionSp(String precision) { |
set("precision_sp", precision); |
} |
public boolean getTypeAutre() { |
return get("type_autre"); |
} |
public void setTypeAutre(boolean bool) { |
set("type_autre", bool); |
} |
private String renvoyerValeurCorrecte(String valeur) { |
String valeurCorrecte = ""; |
if (!UtilString.isEmpty(valeur)) { |
valeurCorrecte = valeur; |
} |
return valeurCorrecte; |
} |
} |
Property changes: |
Added: svn:mergeinfo |
Merged /branches/v1.0-syrah/src/org/tela_botanica/client/modeles/collection/UniteBase.java:r1136-1368 |
Merged /trunk/src/org/tela_botanica/client/modeles/collection/UniteBase.java:r11-948,1209-1382 |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/collection/UniteBase.java:r1383-1511 |
/branches/v1.8-narince/src/org/tela_botanica/client/modeles/collection/CollectionACommentaire.java |
---|
New file |
0,0 → 1,146 |
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 { |
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"}; |
public CollectionACommentaire() { |
initialiser(new JSONObject(), false); |
} |
public CollectionACommentaire(JSONObject collectionACommentaireListe) { |
initialiser(collectionACommentaireListe, true); |
} |
public CollectionACommentaire(JSONObject collectionACommentaireListe, boolean chargerCommentaire) { |
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; |
} |
protected String[] getChampsObligatoires() { |
return champsObligatoires; |
} |
private void initialiser(JSONObject collectionACommentaireListe, boolean chargerCommentaire) { |
if (chargerCommentaire) { |
setCommentaire(new Commentaire(collectionACommentaireListe, false)); |
} else { |
setCommentaire(new Commentaire()); |
} |
initialiserModele(collectionACommentaireListe); |
initialiserChampsPourGrille(); |
} |
// COMMENTAIRE |
public Commentaire getCommentaire() { |
return commentaireLiee; |
} |
public void setCommentaire(Commentaire commentaire) { |
commentaireLiee = commentaire; |
initialiserChampsPourGrille(); |
if (commentaire != null) { |
setIdCommentaire(commentaire.getId()); |
} |
} |
private void initialiserChampsPourGrille() { |
set("_type_", getType()); |
set("_titre_", getCommentaire().getTitre()); |
set("_texte_", getCommentaire().getTexte()); |
set("_ponderation_", getCommentaire().getPonderation()); |
set("_public_", getCommentaire().getPublic()); |
set("_etat_", ""); |
} |
// ID |
/** Génère un identifiant de CollectionACommentaire. |
* |
* C'est une concaténation des clés primaires de la table coel_collection_a_commentaire séparées par un tiret "-". |
* |
* @return identifiant unique d'une relation "collection à commentaire". |
*/ |
public String getId() { |
String idCollection = getIdCollection(); |
String idCommentaire = getIdCommentaire(); |
if (idCollection.equals("") && idCommentaire.equals("")) { |
return null; |
} else { |
return (idCollection+"-"+idCommentaire); |
} |
} |
//+---------------------------------------------------------------------------------------------------------------+ |
// CHAMPS PROVENANT de la TABLE COEL_COLLECTION_A_COMMENTAIRE |
// ID COLLECTION |
public String getIdCollection() { |
return renvoyerValeurCorrecte("id_collection"); |
} |
public void setIdCollection(String idCollection) { |
set("id_collection", idCollection); |
} |
// ID COMENTAIRE |
public String getIdCommentaire() { |
return renvoyerValeurCorrecte("id_commentaire"); |
} |
public void setIdCommentaire(String ic) { |
set("id_commentaire", ic); |
} |
// TRUCK TYPE |
public String getType() { |
return renvoyerValeurCorrecte("truk_type"); |
} |
public void setType(String type) { |
set("truk_type", type); |
} |
} |
Property changes: |
Added: svn:mergeinfo |
Merged /branches/v1.0-syrah/src/org/tela_botanica/client/modeles/collection/CollectionACommentaire.java:r1136-1368 |
Merged /trunk/src/org/tela_botanica/client/modeles/collection/CollectionACommentaire.java:r11-984,1209-1382 |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/collection/CollectionACommentaire.java:r1383-1511 |
/branches/v1.8-narince/src/org/tela_botanica/client/modeles/collection/CollectionACommentaireListe.java |
---|
New file |
0,0 → 1,34 |
package org.tela_botanica.client.modeles.collection; |
import org.tela_botanica.client.modeles.aDonneeListe; |
import com.google.gwt.json.client.JSONArray; |
import com.google.gwt.json.client.JSONObject; |
public class CollectionACommentaireListe extends aDonneeListe<CollectionACommentaire> { |
private static final long serialVersionUID = 1L; |
public CollectionACommentaireListe() { |
super(); |
} |
public CollectionACommentaireListe(int taille) { |
super(taille); |
} |
public CollectionACommentaireListe(JSONArray collectionACommentaires) { |
super(collectionACommentaires.size()) ; |
final int taillemax = collectionACommentaires.size(); |
for (int i = 0; i < taillemax; i++) { |
JSONObject collectionACommentaireCourant = collectionACommentaires.get(i).isObject() ; |
if (collectionACommentaireCourant != null) { |
CollectionACommentaire collectionACommentaire = new CollectionACommentaire(collectionACommentaireCourant); |
this.put(collectionACommentaire.getId(), collectionACommentaire); |
} |
} |
} |
} |
Property changes: |
Added: svn:mergeinfo |
Merged /branches/v1.0-syrah/src/org/tela_botanica/client/modeles/collection/CollectionACommentaireListe.java:r1136-1368 |
Merged /trunk/src/org/tela_botanica/client/modeles/collection/CollectionACommentaireListe.java:r11-984,1209-1382 |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/collection/CollectionACommentaireListe.java:r1383-1511 |
/branches/v1.8-narince/src/org/tela_botanica/client/modeles/collection/UniteRangement.java |
---|
New file |
0,0 → 1,78 |
package org.tela_botanica.client.modeles.collection; |
import org.tela_botanica.client.util.UtilString; |
import com.extjs.gxt.ui.client.data.BaseModelData; |
public class UniteRangement extends BaseModelData { |
private static final long serialVersionUID = 394843761854792528L; |
public static final String COMPTE_EXACT = "E"; |
public static final String COMPTE_APPROXIMATIF = "A"; |
public UniteRangement() { |
} |
public UniteRangement(String id, String type, int nombre, String precision, String format) { |
setId(id); |
setType(type); |
setNombre(nombre); |
setPrecision(precision); |
setFormat(format); |
setTypeAutre(false); |
} |
public String getId() { |
return renvoyerValeurCorrecte((String) get("id")); |
} |
public void setId(String id) { |
set("id", id); |
} |
public String getType() { |
return renvoyerValeurCorrecte((String) get("type")); |
} |
public void setType(String type) { |
set("type", type); |
} |
public double getNombre() { |
if (get("nombre") == null) { |
return new Double(0); |
} |
return get("nombre"); |
} |
public void setNombre(double nombre) { |
set("nombre", nombre); |
} |
public String getPrecision() { |
return renvoyerValeurCorrecte((String) get("precision")); |
} |
public void setPrecision(String precision) { |
set("precision", precision); |
} |
public String getFormat() { |
return renvoyerValeurCorrecte((String) get("format")); |
} |
public void setFormat(String format) { |
set("format", format); |
} |
public boolean getTypeAutre() { |
return get("type_autre"); |
} |
public void setTypeAutre(boolean bool) { |
set("type_autre", bool); |
} |
private String renvoyerValeurCorrecte(String valeur) { |
String valeurCorrecte = ""; |
if (!UtilString.isEmpty(valeur)) { |
valeurCorrecte = valeur; |
} |
return valeurCorrecte; |
} |
} |
Property changes: |
Added: svn:mergeinfo |
Merged /branches/v1.0-syrah/src/org/tela_botanica/client/modeles/collection/UniteRangement.java:r1136-1368 |
Merged /trunk/src/org/tela_botanica/client/modeles/collection/UniteRangement.java:r11-948,1209-1382 |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/collection/UniteRangement.java:r1383-1511 |
/branches/v1.8-narince/src/org/tela_botanica/client/modeles/collection/CollectionAPublication.java |
---|
New file |
0,0 → 1,172 |
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 com.extjs.gxt.ui.client.data.ModelData; |
import com.google.gwt.json.client.JSONObject; |
public class CollectionAPublication extends aDonnee { |
private static final long serialVersionUID = 1L; |
public static final String PREFIXE = "ccapu"; |
private Publication publicationLiee = null; |
public static String[] champsObligatoires = {"ccapu_id_collection", "ccapu_id_publication"}; |
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; |
} |
protected String[] getChampsObligatoires() { |
return champsObligatoires; |
} |
private void initialiser(JSONObject collectionAPublicationListe) { |
setPublication(new Publication(collectionAPublicationListe)); |
initialiserChampsPourGrille(); |
initialiserModele(collectionAPublicationListe); |
} |
// PUBLICATION |
public Publication getPublication() { |
return publicationLiee; |
} |
public void setPublication(Publication publication) { |
publicationLiee = publication; |
initialiserChampsPourGrille(); |
if (publication != null) { |
setIdPublication(publication.getId()); |
} |
} |
private void initialiserChampsPourGrille() { |
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 |
/** Génère un identifiant de CollectionAPersonne. |
* |
* C'est une concaténation des clés primaires de la table coel_collection_a_personne séparées par un tiret "-". |
* |
* @return identifiant unique d'une relation "collection à personne". |
*/ |
public String getId() { |
String idCollection = getIdCollection(); |
String idPublication = getIdPublication(); |
if (idCollection.equals("") && idPublication.equals("")) { |
return null; |
} else { |
return (idCollection+"-"+idPublication); |
} |
} |
//+---------------------------------------------------------------------------------------------------------------+ |
// CHAMPS PROVENANT de la TABLE COEL_COLLECTION_A_PERSONNE |
// ID COLLECTION |
public String getIdCollection() { |
if (removePrefix) return renvoyerValeurCorrecte("id_collection"); |
else return renvoyerValeurCorrecte(PREFIXE+"_id_collection"); |
} |
public void setIdCollection(String idCollection) { |
if (removePrefix) set("id_collection", idCollection); |
else set(PREFIXE+"_id_collection", idCollection); |
} |
// ID PUBLICATION |
public String getIdPublication() { |
String idPublication; |
if (removePrefix) { |
idPublication = renvoyerValeurCorrecte("id_publication"); |
} else { |
idPublication = renvoyerValeurCorrecte(PREFIXE+"_id_publication"); |
} |
return idPublication; |
} |
public void setIdPublication(String ip) { |
if (removePrefix) { |
set("id_publication", ip); |
} else { |
set(PREFIXE+"_id_publication", ip); |
} |
} |
// SOURCE |
public String getSource() { |
if (removePrefix) return renvoyerValeurCorrecte("source"); |
else return renvoyerValeurCorrecte(PREFIXE+"_source"); |
} |
public void setSource(String source) { |
if (removePrefix) set("source", source); |
else set(PREFIXE+"_source", source); |
} |
} |
Property changes: |
Added: svn:mergeinfo |
Merged /branches/v1.0-syrah/src/org/tela_botanica/client/modeles/collection/CollectionAPublication.java:r1136-1368 |
Merged /trunk/src/org/tela_botanica/client/modeles/collection/CollectionAPublication.java:r11-934,1209-1382 |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/collection/CollectionAPublication.java:r1383-1511 |
/branches/v1.8-narince/src/org/tela_botanica/client/modeles/collection/CollectionAPublicationListe.java |
---|
New file |
0,0 → 1,41 |
package org.tela_botanica.client.modeles.collection; |
import org.tela_botanica.client.modeles.aDonneeListe; |
import com.google.gwt.json.client.JSONArray; |
import com.google.gwt.json.client.JSONObject; |
/** |
* Table de hachage composée d'informations sur les Structures et les Personnes, renvoyé par un objet de type DAO |
* La clé est une concaténation des clés primaires de la table coel_structure_a_personne séparées par un tiret "-". |
* |
* @author david delon |
* |
*/ |
public class CollectionAPublicationListe extends aDonneeListe<CollectionAPublication> { |
private static final long serialVersionUID = 1L; |
public CollectionAPublicationListe() { |
super(); |
} |
public CollectionAPublicationListe(int taille) { |
super(taille); |
} |
public CollectionAPublicationListe(JSONArray publications) { |
super(publications.size()) ; |
final int taillemax = publications.size(); |
for (int i = 0; i < taillemax; i++) { |
JSONObject collectionAPublicationCourante = publications.get(i).isObject() ; |
if (collectionAPublicationCourante != null) { |
CollectionAPublication collectionAPublication = new CollectionAPublication(collectionAPublicationCourante); |
this.put(collectionAPublication.getId(), collectionAPublication); |
} |
} |
} |
} |
Property changes: |
Added: svn:mergeinfo |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/collection/CollectionAPublicationListe.java:r1383-1511 |
Merged /branches/v1.0-syrah/src/org/tela_botanica/client/modeles/collection/CollectionAPublicationListe.java:r1136-1368 |
Merged /trunk/src/org/tela_botanica/client/modeles/collection/CollectionAPublicationListe.java:r11-934,1209-1382 |
/branches/v1.8-narince/src/org/tela_botanica/client/modeles/collection/CollectionAPersonneAsyncDao.java |
---|
New file |
0,0 → 1,189 |
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; |
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.synchronisation.Reponse; |
import org.tela_botanica.client.util.Debug; |
import org.tela_botanica.client.util.UtilDAO; |
import com.extjs.gxt.ui.client.Registry; |
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 CollectionAPersonneAsyncDao { |
private static final String SERVICE_NOM = "CoelCollectionAPersonne"; |
private String utilisateurId = null; |
private Rafraichissable vueARafraichir = null; |
public CollectionAPersonneAsyncDao(Rafraichissable vueARafraichirCourrante) { |
if (Mediateur.DEBUG) System.out.println("|| CollectionAPersonneAsyncDao > vueARafraichir = "+vueARafraichirCourrante.getClass().toString()); |
vueARafraichir = vueARafraichirCourrante; |
utilisateurId = ((Mediateur) Registry.get(RegistreId.MEDIATEUR)).getUtilisateurId(); |
} |
public void selectionner(final boolean paginationProgressive, final String collectionId, final String roleId, final String recherche, final int start, final int nbElements, final Integer seqId) { |
String[] parametres = {collectionId, roleId}; |
HashMap<String, String> restrictions = new HashMap<String, String>(); |
if (nbElements != -1) { |
restrictions.put("limit", String.valueOf(nbElements)); |
} |
restrictions.put("orderby", "cp_nom"); |
/** 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("<-- CollectionAPersonneAsyncDao > Liste paginée, retour au sequenceur"); |
Reponse reponseRequete = new Reponse(responseValue, seqId); |
vueARafraichir.rafraichir(reponseRequete); |
} |
else { |
if (Mediateur.DEBUG) System.out.println("<-- CollectionAPersonneAsyncDao > 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(); |
Information info = new Information("liste_collection_a_personne"); |
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("collectionsAPersonne").isArray() != null) { |
final JSONArray reponse = responseObject.get("collectionsAPersonne").isArray(); |
// Transformation du tableau JSON réponse en ListeInstitution |
CollectionAPersonneListe personnes = new CollectionAPersonneListe(reponse); |
info.setDonnee(0, personnes); |
// et on met à jour le demandeur des données |
if (seqId != null) { |
Reponse reponseRequete = new Reponse(info, seqId); |
vueARafraichir.rafraichir(reponseRequete); |
} |
else { |
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("collectionsAPersonne").isObject() != null) { |
GWT.log(rb.getUrl()+"\n\tLa réponse n'est pas un tableau 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 |
if (collectionId == null) { |
// Dans le cas, où nous demandons toutes les relations Collection à Personne et qu'il n'y en a pas, nous retournons un message d'information |
Information info = new Information("liste_collection_a_personne"); |
info.setMessage("Aucune relations entre la collection et les personnes"); |
vueARafraichir.rafraichir(info); |
} |
} |
} |
}); |
} |
} |
public void ajouter(String collectionId, CollectionAPersonne personnes) { |
String postDonneesEncodees = construirePost(collectionId, personnes); |
final JsonRestRequestBuilder rb = UtilDAO.construireRequetePost(SERVICE_NOM); |
rb.envoyerRequete(postDonneesEncodees, new JsonRestRequestCallback() { |
@Override |
public void surReponse(JSONValue responseValue) { |
// Si la requête est un succès, reception d'une chaine |
if (responseValue.isString() != null) { |
Information info = new Information("ajout_collection_a_personne"); |
info.setMessage(responseValue.isString().stringValue()); |
vueARafraichir.rafraichir(info); |
} else { |
GWT.log(rb.getUrl()+"\n\tLa réponse n'est pas une chaine JSON.", null); |
} |
} |
}); |
} |
public void modifier(CollectionAPersonne personnes) { |
String[] parametres = {personnes.getIdCollection(), personnes.getIdPersonne(), personnes.getIdRole()}; |
final JsonRestRequestBuilder rb = UtilDAO.construireRequetePost(SERVICE_NOM, parametres); |
String postDonneesEncodees = construirePost(personnes.getIdCollection(), personnes); |
rb.envoyerRequete(postDonneesEncodees, new JsonRestRequestCallback() { |
@Override |
public void surReponse(JSONValue responseValue) { |
Information info = new Information("modif_collection_a_personne"); |
// Si la requête est un succès, reception d'une chaine |
if (responseValue.isString() != null) { |
info.setMessage(responseValue.isString().stringValue()); |
vueARafraichir.rafraichir(info); |
} else { |
GWT.log(rb.getUrl()+"\n\tLa réponse n'est pas une chaine JSON.", null); |
} |
} |
}); |
} |
public void supprimer(String idCollectionAPersonne) { |
String[] parametres = {utilisateurId, idCollectionAPersonne}; |
final JsonRestRequestBuilder rb = UtilDAO.construireRequetePost(SERVICE_NOM, parametres); |
rb.envoyerRequeteSuppression(new JsonRestRequestCallback() { |
@Override |
public void surReponse(JSONValue responseValue) { |
if (responseValue.isString() != null) { |
Information info = new Information("suppression_collection_a_personne"); |
info.setMessage(responseValue.isString().stringValue()); |
vueARafraichir.rafraichir(info); |
} else { |
GWT.log(rb.getUrl()+"\n\tLa réponse n'est pas une chaine JSON.", null); |
} |
} |
}); |
} |
private String construirePost(String collectionId, CollectionAPersonne personne) { |
String postDonnees = "cmhl_ce_modifier_par=" + URL.encodeComponent(utilisateurId) + |
"&ccap_id_collection=" + URL.encodeComponent(collectionId) + |
"&ccap_id_personne=" + URL.encodeComponent(personne.getIdPersonne()) + |
"&ccap_id_role=" + URL.encodeComponent(personne.getIdRole()); |
return postDonnees; |
} |
} |
Property changes: |
Added: svn:mergeinfo |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/collection/CollectionAPersonneAsyncDao.java:r1383-1511 |
Merged /branches/v1.0-syrah/src/org/tela_botanica/client/modeles/collection/CollectionAPersonneAsyncDao.java:r1136-1368 |
Merged /trunk/src/org/tela_botanica/client/modeles/collection/CollectionAPersonneAsyncDao.java:r11-934,1209-1382 |
/branches/v1.8-narince/src/org/tela_botanica/client/modeles/collection/Collection.java |
---|
New file |
0,0 → 1,410 |
package org.tela_botanica.client.modeles.collection; |
import java.util.Iterator; |
import java.util.LinkedList; |
import java.util.List; |
import java.util.Map; |
import java.util.Set; |
import org.tela_botanica.client.modeles.aDonnee; |
import org.tela_botanica.client.util.Debug; |
import com.extjs.gxt.ui.client.data.ModelData; |
import com.google.gwt.json.client.JSONObject; |
public class Collection extends aDonnee { |
private static final long serialVersionUID = 3295310312337145716L; |
public static final String PREFIXE = "cc"; |
private CollectionBotanique botanique = null; |
private CollectionAPersonneListe personnesLiees = null; |
private CollectionAPublicationListe publicationsLiees = null; |
private CollectionACommentaireListe commentairesLiees = null; |
public static String[] champsObligatoires = {"cc_id_collection","cc_ce_type"}; |
public Collection() { |
} |
public Collection(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 Collection(JSONObject collection){ |
initialiserModele(collection); |
} |
@Override |
protected String getPrefixe(){ |
return PREFIXE; |
} |
protected String[] getChampsObligatoires() { |
return champsObligatoires; |
} |
// BOTANIQUE |
public CollectionBotanique getBotanique() { |
if (botanique == null) { |
botanique = new CollectionBotanique(); |
} |
return botanique; |
} |
public void setBotanique(CollectionBotanique botaniqueAStocker) { |
botanique = botaniqueAStocker; |
} |
// PERSONNES LIÉES |
public CollectionAPersonneListe getPersonnesLiees() { |
if (personnesLiees == null) { |
personnesLiees = new CollectionAPersonneListe(); |
} |
return personnesLiees; |
} |
public void setPersonnesLiees(CollectionAPersonneListe relationsCollectionAPersonne) { |
personnesLiees = relationsCollectionAPersonne; |
} |
// PUBLICATIONS LIÉES |
public CollectionAPublicationListe getPublicationsLiees() { |
if (publicationsLiees == null) { |
publicationsLiees = new CollectionAPublicationListe(); |
} |
return publicationsLiees; |
} |
public void setPublicationsLiees(CollectionAPublicationListe relationsCollectionAPublication) { |
publicationsLiees = relationsCollectionAPublication; |
} |
// COMMENTAIRES LIÉS |
public CollectionACommentaireListe getCommentairesLiees() { |
if (commentairesLiees == null) { |
commentairesLiees = new CollectionACommentaireListe(); |
} |
return commentairesLiees; |
} |
public void setCommentairesLiees(CollectionACommentaireListe relationsCollectionACommentaire) { |
commentairesLiees = relationsCollectionACommentaire; |
} |
// ID |
public String getId() { |
return renvoyerValeurCorrecte("id_collection"); |
} |
public void setId(String idCollection) { |
this.set("id_collection", idCollection); |
} |
// COLLECTION MERE ID |
public String getCollectionMereId() { |
return renvoyerValeurCorrecte("ce_mere"); |
} |
public void setCollectionMereId(String collectionMereId) { |
this.set("ce_mere", collectionMereId); |
} |
// COLLECTION MERE NOM |
public String getCollectionMereNom() { |
return renvoyerValeurCorrecte("_collection_mere_nom_"); |
} |
public void setCollectionMereNom(String collectionMereNom) { |
this.set("_collection_mere_nom_", collectionMereNom); |
} |
// CE STRUCTURE |
public String getIdStructure() { |
return renvoyerValeurCorrecte("ce_structure"); |
} |
public void setIdStructure(String idStructure) { |
this.set("ce_structure", idStructure); |
} |
// GUID |
public String getGuid() { |
return renvoyerValeurCorrecte("guid"); |
} |
public void setGuid(String guid) { |
this.set("guid", guid); |
} |
// CODE |
public String getCode() { |
return renvoyerValeurCorrecte("truk_code"); |
} |
public void setCode(String code) { |
this.set("truk_code", code); |
} |
// NOM |
public String getNom() { |
return renvoyerValeurCorrecte("nom"); |
} |
public void setNom(String nom) { |
this.set("nom", nom); |
} |
// NOM ALTERNATIF |
public String getNomAlternatif() { |
return renvoyerValeurCorrecte("truk_nom_alternatif"); |
} |
public void setNomAlternatif(String nomAlter) { |
this.set("truk_nom_alternatif", nomAlter); |
} |
// DESCRIPTION |
public String getDescription() { |
return renvoyerValeurCorrecte("description"); |
} |
public void setDescription(String description) { |
this.set("description", description); |
} |
// HISTORIQUE |
public String getHistorique() { |
return renvoyerValeurCorrecte("historique"); |
} |
public void setHistorique(String historique) { |
this.set("historique", historique); |
} |
// URL |
public String getUrls() { |
return renvoyerValeurCorrecte("truk_url"); |
} |
public void setUrls(String urls) { |
this.set("truk_url", urls); |
} |
// TYPE NCD |
public String getTypeNcd() { |
return renvoyerValeurCorrecte("ce_type"); |
} |
public void setTypeNcd(String typeNcd) { |
this.set("ce_type", typeNcd); |
} |
// TYPE DEPOT |
public String getTypeDepot() { |
return renvoyerValeurCorrecte("ce_type_depot"); |
} |
public void setTypeDepot(String typeDepot) { |
this.set("ce_type_depot", typeDepot); |
} |
// COTE |
public String getCote() { |
return renvoyerValeurCorrecte("cote"); |
} |
public void setCote(String cote) { |
this.set("cote", cote); |
} |
// DIMENSSION |
public String getDimenssion() { |
return renvoyerValeurCorrecte("dimenssion"); |
} |
public void setDimenssion(String dimenssion) { |
this.set("dimenssion", dimenssion); |
} |
// CONDITION ACCÉS |
public String getConditionAcces() { |
return renvoyerValeurCorrecte("condition_acces"); |
} |
public void setConditionAcces(String conditionAcces) { |
this.set("condition_acces", conditionAcces); |
} |
// CONDITION USAGE |
public String getConditionUsage() { |
return renvoyerValeurCorrecte("condition_usage"); |
} |
public void setConditionUsage(String conditionUsage) { |
this.set("condition_usage", conditionUsage); |
} |
// COUVERTURE VERNACULAIRE |
public String getCouvertureVernaculaire() { |
return renvoyerValeurCorrecte("truk_couverture_vernaculaire"); |
} |
public void setCouvertureVernaculaire(String couvertureVernaculaire) { |
this.set("truk_couverture_vernaculaire", couvertureVernaculaire); |
} |
// COUVERTURE TAXONOMIQUE |
public String getCouvertureTaxonomique() { |
return renvoyerValeurCorrecte("truk_couverture_taxonomique"); |
} |
public void setCouvertureTaxonomique(String couvertureTaxonomique) { |
this.set("truk_couverture_taxonomique", couvertureTaxonomique); |
} |
// COUVERTURE REGNE |
public String getCouvertureRegne() { |
return renvoyerValeurCorrecte("truk_couverture_regne"); |
} |
public void setCouvertureRegne(String couvertureRegne) { |
this.set("truk_couverture_regne", couvertureRegne); |
} |
// COUVERTURE TEMPORELLE |
public String getCouvertureTemporelle() { |
return renvoyerValeurCorrecte("truk_couverture_temporelle"); |
} |
public void setCouvertureTemporelle(String couvertureTemporelle) { |
this.set("truk_couverture_temporelle", couvertureTemporelle); |
} |
// COUVERTURE VIE |
public String getCouvertureVie() { |
return renvoyerValeurCorrecte("truk_couverture_vie"); |
} |
public void setCouvertureVie(String couvertureVie) { |
this.set("truk_couverture_Vie", couvertureVie); |
} |
// CONSERVATION STATUT |
public String getConservationStatut() { |
return renvoyerValeurCorrecte("truk_conservation_statut"); |
} |
public void setConservationStatut(String conservationStatut) { |
this.set("truk_conservation_statut", conservationStatut); |
} |
// PRESERVATION |
public String getPreservation() { |
return renvoyerValeurCorrecte("truk_preservation"); |
} |
public void setPreservation(String preservation) { |
this.set("truk_preservation", preservation); |
} |
// DEVELOPPEMENT |
public String getDeveloppement() { |
return renvoyerValeurCorrecte("ce_developpement"); |
} |
public void setDeveloppement(String developpement) { |
this.set("ce_developpement", developpement); |
} |
// PERIODE CONSTITUTION |
public String getPeriodeConstitution() { |
return renvoyerValeurCorrecte("truk_periode_constitution"); |
} |
public void setPeriodeConstitution(String periodeConstitution) { |
if (periodeConstitution.equals(new String(""))) |
this.set("truk_periode_constitution", null); |
else |
this.set("truk_periode_constitution", periodeConstitution); |
} |
// COUVERTURE LIEU |
public String getCouvertureLieu() { |
return renvoyerValeurCorrecte("truk_couverture_lieu"); |
} |
public void setCouvertureLieu(String couvertureLieu) { |
this.set("truk_couverture_lieu", couvertureLieu); |
} |
// COORDONNÉE |
public String getCoordonnee() { |
return renvoyerValeurCorrecte("truk_coordonnee"); |
} |
public void setCoordonnee(String coordonnee) { |
this.set("truk_coordonnee", coordonnee); |
} |
// SPECIMEN TYPE |
public String getSpecimenType() { |
return renvoyerValeurCorrecte("ce_specimen_type"); |
} |
public void setSpecimenType(String specimenType) { |
this.set("ce_specimen_type", specimenType); |
} |
// SPECIMEN TYPE NOMBRE |
public String getSpecimenTypeNbre() { |
return renvoyerValeurCorrecte("specimen_type_nbre"); |
} |
public void setSpecimenTypeNbre(String specimenTypeNbre) { |
this.set("specimen_type_nbre", specimenTypeNbre); |
} |
// SPECIMEN TYPE NOMBRE PRECISION |
public String getSpecimenTypeNbrePrecision() { |
return renvoyerValeurCorrecte("ce_specimen_type_nbre_precision"); |
} |
public void setSpecimenTypeNbrePrecision(String specimenTypeNbrePrecision) { |
this.set("ce_specimen_type_nbre_precision", specimenTypeNbrePrecision); |
} |
// SPECIMEN TYPE CLASSEMENT |
public String getSpecimenTypeClassement() { |
return renvoyerValeurCorrecte("ce_specimen_type_classement"); |
} |
public void setSpecimenTypeClassement(String specimenTypeClassement) { |
this.set("ce_specimen_type_classement", specimenTypeClassement); |
} |
// EXPEDITION NOM |
public String getExpeditionNom() { |
return renvoyerValeurCorrecte("expedition_nom"); |
} |
public void setExpeditionNom(String expeditionNom) { |
this.set("expedition_nom", expeditionNom); |
} |
// DIGITAL MEDIUM |
public String getDigitalMedium() { |
return renvoyerValeurCorrecte("truk_digital_medium"); |
} |
public void setDigitalMedium(String digitalMedium) { |
this.set("truk_digital_medium", digitalMedium); |
} |
// DIGITAL FORMAT |
public String getDigitalFormat() { |
return renvoyerValeurCorrecte("truk_digital_format"); |
} |
public void setDigitalFormat(String digitalFormat) { |
this.set("truk_digital_format", digitalFormat); |
} |
// PUBLIC |
public boolean etrePublic() { |
String publicMark = getPublic(); |
boolean estPublic = true; |
if (publicMark.equals("0")) { |
estPublic = false; |
} |
return estPublic; |
} |
public String getPublic() { |
return renvoyerValeurCorrecte("mark_public"); |
} |
public void setBoolPublic(String publicBool) { |
this.set("mark_public", publicBool); |
} |
// +--------------------------------------------------------------------------------------------------------------+ |
// STRUCTURE NOM |
public String getStructureNom() { |
return renvoyerValeurCorrecte("_structure_nom_"); |
} |
// STRUCTURE VILLE |
public String getStructureVille() { |
return renvoyerValeurCorrecte("_structure_ville_"); |
} |
} |
Property changes: |
Added: svn:mergeinfo |
Merged /trunk/src/org/tela_botanica/client/modeles/collection/Collection.java:r11-934,1209-1382 |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/collection/Collection.java:r1383-1511 |
Merged /branches/v1.0-syrah/src/org/tela_botanica/client/modeles/collection/Collection.java:r1136-1368 |
/branches/v1.8-narince/src/org/tela_botanica/client/modeles/collection/CollectionListe.java |
---|
New file |
0,0 → 1,130 |
package org.tela_botanica.client.modeles.collection; |
import org.tela_botanica.client.Mediateur; |
import org.tela_botanica.client.RegistreId; |
import org.tela_botanica.client.interfaces.ListePaginable; |
import org.tela_botanica.client.interfaces.Rafraichissable; |
import org.tela_botanica.client.modeles.aDonneeListe; |
import com.extjs.gxt.ui.client.Registry; |
import com.google.gwt.i18n.client.Dictionary; |
import com.google.gwt.json.client.JSONArray; |
import com.google.gwt.json.client.JSONNumber; |
import com.google.gwt.json.client.JSONObject; |
/** |
* Classe contenant les informations sur les Collections renvoyées par un objet de type DAO. |
* |
* @author Jean-Pascal MILCENT |
* |
*/ |
public class CollectionListe extends aDonneeListe<Collection> implements ListePaginable { |
private static final long serialVersionUID = 8024454926649039456L; |
private int currentPage = 0; |
private int nbElementsPage = Integer.valueOf(((Dictionary) Dictionary.getDictionary("configuration")).get("nbElementsPage")); |
private int nbElementsTotal; |
private Rafraichissable vueARafraichir; |
public CollectionListe() { |
super(); |
} |
public CollectionListe(int taille) { |
super(taille); |
} |
public CollectionListe(JSONArray ListeDeCollections) { |
super(ListeDeCollections.size()); |
initialiserCollectionListe(ListeDeCollections); |
} |
public CollectionListe(JSONArray ListeDeCollections, JSONNumber nbElements, Rafraichissable vueARafraichir) { |
super(ListeDeCollections.size()); |
this.nbElementsTotal = Integer.valueOf(nbElements.toString()); |
this.vueARafraichir = vueARafraichir; |
initialiserCollectionListe(ListeDeCollections); |
} |
private void initialiserCollectionListe(JSONArray ListeDeCollections) { |
final int taillemax = ListeDeCollections.size(); |
for (int i = 0; i < taillemax; i++) { |
JSONObject collectionCourante = ListeDeCollections.get(i).isObject() ; |
if (collectionCourante != null) { |
Collection collection = new Collection(collectionCourante); |
CollectionBotanique botanique = new CollectionBotanique(collectionCourante); |
collection.setBotanique(botanique); |
this.put(collection.getId(), collection); |
} |
} |
} |
public void changerNumeroPage(int pageCourante) { |
currentPage = pageCourante; |
selectionnerCollection(); |
} |
public void changerTaillePage(int nouvelleTaillePage) { |
nbElementsPage = nouvelleTaillePage; |
selectionnerCollection(); |
} |
public void recharger() { |
selectionnerCollection(); |
} |
public void setPageCourante(int pageCourante) { |
this.currentPage = pageCourante; |
} |
public void setTaillePage(int taillePage) { |
this.nbElementsPage = taillePage; |
} |
public int[] getPageTable() { |
int[] page = new int[4]; |
// Nombre de pages au total |
page[0] = calculerNbPages(); |
// Page En Cours |
page[1] = currentPage; |
// nbElementsParPage |
page[2] = nbElementsPage; |
// et le dernier le nombre total d'éléments |
page[3] = nbElementsTotal; |
return page; |
} |
/** |
* Calcule le nombre de pages nécessaires pour afficher un nombre d'élements |
* donnés en fonction de la taille de page en cours |
* |
* @return le nombre de pages |
*/ |
public int calculerNbPages() { |
// À cause de la bétise de java pour les conversion implicite, on fait quelques conversions manuellement |
// pour eviter qu'il arrondisse mal la division nombre de pages = (nombre d'element / taille de la page) |
// arrondie à l'entier supérieur. |
double nPage = (1.0 * nbElementsTotal) / (1.0 * nbElementsPage); |
double nPageRound = Math.ceil(nPage); |
Double nPageInt = new Double(nPageRound); |
// Convertion en entier |
return nPageInt.intValue(); |
} |
public void selectionnerCollection() { |
Mediateur mediateur =(Mediateur) Registry.get(RegistreId.MEDIATEUR); |
mediateur.selectionnerCollection(vueARafraichir, null, null, currentPage, nbElementsPage, null); |
} |
public void filtrerParNom(String nom) { |
Mediateur mediateur =(Mediateur) Registry.get(RegistreId.MEDIATEUR); |
mediateur.selectionnerCollection(vueARafraichir, null, "%" + nom + "%", 0, nbElementsPage, null); |
} |
public void filtrerParNomEtPage(String nom, int pageCourante) { |
currentPage = pageCourante; |
Mediateur mediateur = (Mediateur) Registry.get(RegistreId.MEDIATEUR); |
mediateur.selectionnerCollection(vueARafraichir, null, "%" + nom + "%", currentPage, nbElementsPage, null); |
} |
} |
Property changes: |
Added: svn:mergeinfo |
Merged /trunk/src/org/tela_botanica/client/modeles/collection/CollectionListe.java:r11-934,1209-1382 |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/collection/CollectionListe.java:r1383-1511 |
Merged /branches/v1.0-syrah/src/org/tela_botanica/client/modeles/collection/CollectionListe.java:r1136-1368 |
/branches/v1.8-narince/src/org/tela_botanica/client/modeles/collection/CollectionAStructureAsyncDao.java |
---|
New file |
0,0 → 1,78 |
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; |
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.synchronisation.Reponse; |
import org.tela_botanica.client.util.UtilDAO; |
import com.extjs.gxt.ui.client.Registry; |
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 CollectionAStructureAsyncDao { |
private static final String SERVICE_NOM = "CoelCollection"; |
public static final String PAR_STRUCTURE = "ParIdStructure"; |
private Rafraichissable vueARafraichir = null; |
public CollectionAStructureAsyncDao(Rafraichissable vueARafraichirCourrante) { |
if (Mediateur.DEBUG) System.out.println("|| CollectionAStructureAsyncDao > vueARafraichir = "+vueARafraichirCourrante.getClass().toString()); |
vueARafraichir = vueARafraichirCourrante; |
} |
public void selectionner(final String structureId, final int start, final int nbElements, final Integer seqId) { |
String[] parametres = {structureId}; |
HashMap<String, String> restrictions = new HashMap<String, String>(); |
if (nbElements != -1) { |
restrictions.put("limit", String.valueOf(nbElements)); |
} |
/** DEFINITION DU TUPLE DE DEPART **/ |
restrictions.put("start", String.valueOf(start*nbElements)); |
final JsonRestRequestBuilder rb = UtilDAO.construireRequete(SERVICE_NOM+'/'+PAR_STRUCTURE, parametres, restrictions); |
rb.envoyerRequete(null, new JsonRestRequestCallback() { |
@Override |
public void surReponse(JSONValue responseValue) { |
Information info = new Information("liste_collection_a_structure"); |
if (responseValue != null) { |
final JSONArray reponse = responseValue.isArray(); |
// Si la réponse est un tableau, alors c'est une liste de collections qui a été retournée |
if (responseValue.isArray() != null) { |
// Transformation du tableau JSON réponse en CollectionAStructureListe |
CollectionAStructureListe collections = new CollectionAStructureListe(reponse); |
info.setDonnee(0, collections); |
// et on met à jour le demandeur des données |
if (seqId != null) { |
if (Mediateur.DEBUG) System.out.println("<-- CollectionAStructureAsyncDao > Liste non paginée, retour au sequenceur"); |
Reponse reponseRequete = new Reponse(info, seqId); |
vueARafraichir.rafraichir(reponseRequete); |
} |
else { |
if (Mediateur.DEBUG) System.out.println("<-- CollectionAStructureAsyncDao > 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 (responseValue.isArray() != null) { |
GWT.log(rb.getUrl()+"\n\tLa réponse n'est pas un tableau JSON et vaut : "+responseValue.toString(), null); |
} |
} |
} |
}); |
} |
} |
/branches/v1.8-narince/src/org/tela_botanica/client/modeles/collection/CollectionACommentaireAsyncDao.java |
---|
New file |
0,0 → 1,192 |
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; |
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.synchronisation.Reponse; |
import org.tela_botanica.client.util.UtilDAO; |
import com.extjs.gxt.ui.client.Registry; |
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 { |
private static final String SERVICE_NOM = "CoelCollectionACommentaire"; |
public static final String SUPPRESSION_PAR_COLLECTION = "SuppressionParCollection"; |
public static final String SUPPRESSION_PAR_COMMENTAIRE = "SuppressionParCommentaire"; |
private String utilisateurId = null; |
private Rafraichissable vueARafraichir = null; |
public CollectionACommentaireAsyncDao(Rafraichissable vueARafraichirCourrante) { |
if (Mediateur.DEBUG) System.out.println("|| CollectionACommentaireAsyncDao > vueARafraichir = "+vueARafraichirCourrante.getClass().toString()); |
vueARafraichir = vueARafraichirCourrante; |
utilisateurId = ((Mediateur) Registry.get(RegistreId.MEDIATEUR)).getUtilisateurId(); |
} |
public void selectionner(final boolean paginationProgressive, final String collectionId, final String recherche, final int start, final int nbElements, final Integer seqId) { |
String[] parametres = {collectionId}; |
HashMap<String, String> restrictions = new HashMap<String, String>(); |
if (nbElements != -1) { |
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 **/ |
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 { |
// 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); |
rb.envoyerRequete(postDonneesEncodees, new JsonRestRequestCallback() { |
@Override |
public void surReponse(JSONValue responseValue) { |
// Si la requête est un succès, reception d'une chaine |
if (responseValue.isString() != null) { |
Information info = new Information("ajout_collection_a_commentaire"); |
info.setMessage(responseValue.isString().stringValue()); |
vueARafraichir.rafraichir(info); |
} else { |
GWT.log(rb.getUrl()+"\n\tLa réponse n'est pas une chaine JSON.", null); |
} |
} |
}); |
} |
public void modifier(CollectionACommentaire commentaires) { |
String[] parametres = {commentaires.getIdCollection(), commentaires.getIdCommentaire()}; |
final JsonRestRequestBuilder rb = UtilDAO.construireRequetePost(SERVICE_NOM, parametres); |
String postDonneesEncodees = construirePost(commentaires.getIdCollection(), commentaires); |
rb.envoyerRequete(postDonneesEncodees, new JsonRestRequestCallback() { |
@Override |
public void surReponse(JSONValue responseValue) { |
Information info = new Information("modif_collection_a_commentaire"); |
// Si la requête est un succès, reception d'une chaine |
if (responseValue.isString() != null) { |
info.setMessage(responseValue.isString().stringValue()); |
vueARafraichir.rafraichir(info); |
} else { |
GWT.log(rb.getUrl()+"\n\tLa réponse n'est pas une chaine JSON.", null); |
} |
} |
}); |
} |
public void supprimer(String idCollectionACommentaire, String mode) { |
String[] parametres = {utilisateurId, idCollectionACommentaire, mode}; |
final JsonRestRequestBuilder rb = UtilDAO.construireRequetePost(SERVICE_NOM, parametres); |
rb.envoyerRequeteSuppression(new JsonRestRequestCallback() { |
@Override |
public void surReponse(JSONValue responseValue) { |
if (responseValue.isString() != null) { |
Information info = new Information("suppression_collection_a_commentaire"); |
info.setMessage(responseValue.isString().stringValue()); |
vueARafraichir.rafraichir(info); |
} else { |
GWT.log(rb.getUrl()+"\n\tLa réponse n'est pas une chaine JSON.", null); |
} |
} |
}); |
} |
private String construirePost(String collectionId, CollectionACommentaire commentaire) { |
String postDonnees = "cmhl_ce_modifier_par=" + URL.encodeComponent(utilisateurId) + |
"&ccac_id_collection=" + URL.encodeComponent(collectionId) + |
"&ccac_id_commentaire=" + URL.encodeComponent(commentaire.getIdCommentaire()) + |
"&ccac_truk_type=" + URL.encodeComponent(commentaire.getType()); |
return postDonnees; |
} |
} |
Property changes: |
Added: svn:mergeinfo |
Merged /branches/v1.0-syrah/src/org/tela_botanica/client/modeles/collection/CollectionACommentaireAsyncDao.java:r1136-1368 |
Merged /trunk/src/org/tela_botanica/client/modeles/collection/CollectionACommentaireAsyncDao.java:r11-988,1209-1382 |
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/collection/CollectionACommentaireAsyncDao.java:r1383-1511 |