Subversion Repositories eFlore/Applications.coel

Compare Revisions

No changes between revisions

Ignore whitespace Rev 1428 → Rev 1513

/trunk/src/org/tela_botanica/client/modeles/publication/PublicationAPersonne.java
5,9 → 5,11
import java.util.Set;
 
import org.tela_botanica.client.modeles.aDonnee;
import org.tela_botanica.client.modeles.collection.CollectionAPublication;
import org.tela_botanica.client.modeles.personne.Personne;
import org.tela_botanica.client.util.Debug;
 
import com.extjs.gxt.ui.client.data.ModelData;
import com.google.gwt.json.client.JSONObject;
 
public class PublicationAPersonne extends aDonnee {
15,6 → 17,7
private static final long serialVersionUID = 7769105365939978129L;
public static final String PREFIXE = "cpuap";
private boolean removePrefix = true;
public static final String ROLE_AUTEUR = "2360";
//FIXME: insérer en base de données une valeur cohérente pour l'identifiant ci-dessous
public static final String ROLE_SUJET = "30762";
27,6 → 30,11
new PublicationAPersonne(new JSONObject());
}
public PublicationAPersonne(boolean removePrefix) {
this.removePrefix = removePrefix;
new PublicationAPersonne(new JSONObject());
}
public PublicationAPersonne(JSONObject pubAPersListe) {
Personne personne = new Personne(pubAPersListe);
setPersonne(personne);
39,33 → 47,74
for (Iterator<String> it = im.iterator(); it.hasNext();) {
// Si elle est associée à une valeur, nous l'ajoutons
String cle = it.next();
// Suppression de l'abréviation du champ. Inutile dans le contexte d'un objet
String cleObjet = cle.replaceFirst("^"+PREFIXE+"_", "");
String cleObjet = "";
if (removePrefix) cleObjet = cle.replaceFirst("^"+getPrefixe()+"_", "");
else cleObjet=cle;
// Valeur vide par défaut
String valeur = "";
if (pubAPersListe.get(cle).isString() != null) {
valeur = pubAPersListe.get(cle).isString().stringValue();
this.set(cleObjet, valeur);
} else {
this.set(cleObjet, valeur);
}
}
this.set(cleObjet, valeur);
}
initialiserChampsPourGrille();
}
public PublicationAPersonne(ModelData model, boolean removePrefix)
{
this.removePrefix = removePrefix;
Map<String, Object> a = model.getProperties();
Set<String> cles = a.keySet();
Iterator<String> it = cles.iterator();
while (it.hasNext()) {
String cle = it.next();
if (a.get(cle) != null) {
String cleObjet = "";
if (removePrefix) {
cleObjet = cle.replaceFirst("^"+Personne.PREFIXE+"_", "");
cleObjet = cle.replaceFirst("^"+Publication.PREFIXE+"_", "");
cleObjet = cleObjet.replaceFirst("^"+PREFIXE+"_", "");
}
else {
cleObjet = cle;
}
this.set(cleObjet, a.get(cle));
}
}
 
setPersonne(new Personne(model, removePrefix));
setPublicationLiee(new Publication(model, removePrefix));
this.set("_role_", a.get("_role_"));
this.set("_etat_", a.get("_etat_"));
}
private void initialiserChampsPourGrille() {
set("fmt_auteur", publicationLiee.getAuteur());
set("titre", publicationLiee.getTitre());
set("collection", publicationLiee.getCollection());
set("_editeur_", "");
set("_annee_", "");
set("indication_nvt", publicationLiee.getIndicationNvt());
set("fascicule", publicationLiee.getFascicule());
set("truk_pages", publicationLiee.getPages());
set("_etat_", "");
set("_role_", this.get("id_role"));
if (removePrefix) {
set("fmt_auteur", publicationLiee.getAuteur());
set("titre", publicationLiee.getTitre());
set("collection", publicationLiee.getCollection());
set("_editeur_", "");
set("_annee_", "");
set("indication_nvt", publicationLiee.getIndicationNvt());
set("fascicule", publicationLiee.getFascicule());
set("truk_pages", publicationLiee.getPages());
set("_etat_", "");
set("_role_", this.get("id_role"));
} else {
set("cpu_fmt_auteur", publicationLiee.getAuteur());
set("cpu_titre", publicationLiee.getTitre());
set("cpu_collection", publicationLiee.getCollection());
set("_editeur_", "");
set("_annee_", "");
set("cpu_indication_nvt", publicationLiee.getIndicationNvt());
set("cpu_fascicule", publicationLiee.getFascicule());
set("cpu_truk_pages", publicationLiee.getPages());
set("_etat_", "");
set("_role_", this.get("id_role"));
}
}
81,21 → 130,34
public Personne getPersonne() {
return personneLiee;
}
public void setPersonne(Personne personne) {
setPersonne(personne, false);
}
public void setPersonne(Personne personne, boolean integrerProprietes) {
personneLiee = personne;
if (personne != null) {
setIdPersonne(personne.getId());
}
Map<String, Object> a = personne.getProperties();
 
Set<String> cles = a.keySet();
Iterator<String> it = cles.iterator();
while (it.hasNext()) {
String cle = it.next();
if (a.get(cle) != null) {
String cleObjet = cle.replaceFirst("^"+Personne.PREFIXE+"_", "");
this.set(cleObjet, a.get(cle));
if (integrerProprietes) {
Map<String, Object> a = personne.getProperties();
Set<String> cles = a.keySet();
Iterator<String> it = cles.iterator();
while (it.hasNext()) {
String cle = it.next();
if (a.get(cle) != null) {
String cleObjet = "";
if (removePrefix) {
cleObjet = cle.replaceFirst("^"+Personne.PREFIXE+"_", "");
}
else {
cleObjet = cle;
}
this.set(cleObjet, a.get(cle));
}
}
}
}
114,10 → 176,12
// ID PUBLICATION
public String getIdPublication() {
return renvoyerValeurCorrecte("id_publication");
if (removePrefix) return renvoyerValeurCorrecte("id_publication");
else return renvoyerValeurCorrecte("cpuap_id_publication");
}
public void setIdPublication(String id) {
set("id_publication", id);
if (removePrefix) set("id_publication", id);
else set("cpuap_id_publication", id);
}
// PUBLICATION LIEE
143,10 → 207,12
// ID PERSONNE
public String getIdPersonne() {
return renvoyerValeurCorrecte("id_personne");
if (removePrefix) return renvoyerValeurCorrecte("id_personne");
else return renvoyerValeurCorrecte("cpuap_id_personne");
}
public void setIdPersonne(String id) {
set("id_personne", id);
if (removePrefix) set("id_personne", id);
else set(PREFIXE+"_id_personne", id);
}
// ID RôLE
170,11 → 236,15
// ORDRE DES AUTEURS
public String getOrdreAuteurs() {
return renvoyerValeurCorrecte("ordre");
if (removePrefix) return renvoyerValeurCorrecte("ordre");
else return renvoyerValeurCorrecte(PREFIXE+"_ordre");
}
public void setOrdreAuteurs(String ordre) {
if (ordre.matches("[0-9]+")) {
this.set("ordre", ordre);
if (removePrefix) this.set("ordre", ordre);
else this.set(PREFIXE+"_ordre", ordre);
this.set("_ordre_", ordre);
}
}
}
Property changes:
Modified: svn:mergeinfo
Merged /trunk/src/org/tela_botanica/client/modeles/publication/PublicationAPersonne.java:r11-934
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/publication/PublicationAPersonne.java:r1417-1511