Subversion Repositories eFlore/Applications.coel

Rev

Rev 1383 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1383 Rev 1479
Line 1... Line 1...
1
package org.tela_botanica.client.modeles.collection;
1
package org.tela_botanica.client.modeles.collection;
Line -... Line 2...
-
 
2
 
-
 
3
import java.util.Iterator;
-
 
4
import java.util.Map;
-
 
5
import java.util.Set;
2
 
6
 
-
 
7
import org.tela_botanica.client.modeles.aDonnee;
3
import org.tela_botanica.client.modeles.aDonnee;
8
import org.tela_botanica.client.modeles.personne.Personne;
-
 
9
import org.tela_botanica.client.modeles.publication.Publication;
Line -... Line 10...
-
 
10
import org.tela_botanica.client.util.Debug;
4
import org.tela_botanica.client.modeles.publication.Publication;
11
 
Line 5... Line 12...
5
 
12
import com.extjs.gxt.ui.client.data.ModelData;
Line 6... Line 13...
6
import com.google.gwt.json.client.JSONObject;
13
import com.google.gwt.json.client.JSONObject;
Line 7... Line 14...
7
 
14
 
-
 
15
public class CollectionAPublication extends aDonnee {
8
public class CollectionAPublication extends aDonnee {
16
	
9
	
17
	private static final long serialVersionUID = 1L;
Line 10... Line 18...
10
	private static final long serialVersionUID = 1L;
18
	
11
	
19
	public static final String PREFIXE = "ccapu";
12
	public static final String PREFIXE = "ccapu";
20
	private boolean removePrefix = true;
-
 
21
	private Publication publicationLiee = null;
-
 
22
	public static String[] champsObligatoires = {"ccapu_id_collection", "ccapu_id_publication"};
-
 
23
	
-
 
24
	public CollectionAPublication() {
-
 
25
		initialiser(new JSONObject());
Line 13... Line 26...
13
	private Publication publicationLiee = null;
26
	}
14
	public static String[] champsObligatoires = {"ccapu_id_collection", "ccapu_id_publication"};
27
	
15
	
28
	public CollectionAPublication(boolean removePrefix) {
Line -... Line 29...
-
 
29
		this.removePrefix = removePrefix;
-
 
30
		initialiser(new JSONObject());
-
 
31
	}
-
 
32
			
-
 
33
	public CollectionAPublication(JSONObject collectionAPublicationListe) {
-
 
34
		initialiser(collectionAPublicationListe);
-
 
35
	}
-
 
36
	
-
 
37
	public CollectionAPublication(ModelData model, boolean removePrefix)
-
 
38
	{
-
 
39
		this.removePrefix = removePrefix;
-
 
40
		
-
 
41
		Map<String, Object> a = model.getProperties();
-
 
42
		
-
 
43
		Set<String> cles = a.keySet();
-
 
44
		Iterator<String> it = cles.iterator();
-
 
45
		while (it.hasNext()) {
-
 
46
			String cle = it.next();
-
 
47
			if (a.get(cle) != null) {
-
 
48
				String cleObjet = "";
-
 
49
				if (removePrefix) {
-
 
50
					cleObjet = cle.replaceFirst("^"+CollectionAPublication.PREFIXE+"_", "");
-
 
51
					cleObjet = cleObjet.replaceFirst("^"+PREFIXE+"_", "");
-
 
52
				}
-
 
53
				else {
-
 
54
					cleObjet = cle;
-
 
55
				}
16
	public CollectionAPublication() {
56
				this.set(cleObjet, a.get(cle));
17
		initialiser(new JSONObject());
57
			}
18
	}
58
		}
19
			
59
 
Line 47... Line 87...
47
			setIdPublication(publication.getId());
87
			setIdPublication(publication.getId());
48
		}
88
		}
49
	}
89
	}
Line 50... Line 90...
50
	
90
	
-
 
91
	private void initialiserChampsPourGrille() {
51
	private void initialiserChampsPourGrille() {
92
		if (removePrefix) {
52
		set("fmt_auteur", getPublication().getAuteur());
93
			set("fmt_auteur", getPublication().getAuteur());
53
		set("titre", getPublication().getTitre());
94
			set("titre", getPublication().getTitre());
54
		set("collection", getPublication().getCollection());
95
			set("collection", getPublication().getCollection());
55
		set("_editeur_", "");
96
			set("_editeur_", "");
56
		set("_annee_", "");
97
			set("_annee_", "");
57
		set("indication_nvt", getPublication().getIndicationNvt());
98
			set("indication_nvt", getPublication().getIndicationNvt());
58
		set("fascicule", getPublication().getFascicule());
99
			set("fascicule", getPublication().getFascicule());
-
 
100
			set("truk_pages", getPublication().getPages());
-
 
101
			set("_etat_", "");
-
 
102
		} else {
-
 
103
			set(Publication.PREFIXE+"_fmt_auteur", getPublication().getAuteur());
-
 
104
			set(Publication.PREFIXE+"_titre", getPublication().getTitre());
-
 
105
			set(Publication.PREFIXE+"_collection", getPublication().getCollection());
-
 
106
			set("_editeur_", "");
-
 
107
			set("_annee_", "");
-
 
108
			set(Publication.PREFIXE+"_indication_nvt", getPublication().getIndicationNvt());
-
 
109
			set(Publication.PREFIXE+"_fascicule", getPublication().getFascicule());
59
		set("truk_pages", getPublication().getPages());
110
			set(Publication.PREFIXE+"_truk_pages", getPublication().getPages());
-
 
111
			set("_etat_", "");
60
		set("_etat_", "");
112
		}
Line 61... Line 113...
61
	}
113
	}
62
	
114
	
63
	// ID
115
	// ID
Line 80... Line 132...
80
	//+---------------------------------------------------------------------------------------------------------------+
132
	//+---------------------------------------------------------------------------------------------------------------+
81
	// CHAMPS PROVENANT de la TABLE COEL_COLLECTION_A_PERSONNE
133
	// CHAMPS PROVENANT de la TABLE COEL_COLLECTION_A_PERSONNE
Line 82... Line 134...
82
	
134
	
83
	// ID COLLECTION
135
	// ID COLLECTION
-
 
136
	public String getIdCollection() {
84
	public String getIdCollection() {
137
		if (removePrefix) return renvoyerValeurCorrecte("id_collection");
85
		return renvoyerValeurCorrecte("id_collection");
138
		else return renvoyerValeurCorrecte(PREFIXE+"_id_collection");
86
	}
139
	}
-
 
140
	public void setIdCollection(String idCollection) {
87
	public void setIdCollection(String idCollection) {
141
		if (removePrefix) set("id_collection", idCollection);
88
		set("id_collection", idCollection);
142
		else set(PREFIXE+"_id_collection", idCollection);
Line 89... Line 143...
89
	}
143
	}
90
	
144
	
-
 
145
	// ID PUBLICATION
91
	// ID PUBLICATION
146
	public String getIdPublication() {
92
	public String getIdPublication() {
147
		if (removePrefix) return renvoyerValeurCorrecte("id_publication");
93
		return renvoyerValeurCorrecte("id_publication");
148
		else return renvoyerValeurCorrecte(PREFIXE+"_id_publication");
-
 
149
	}
94
	}
150
	public void setIdPublication(String ip) {
95
	public void setIdPublication(String ip) {
151
		if (removePrefix) set("id_publication", ip);
Line 96... Line 152...
96
		set("id_publication", ip);
152
		else set(PREFIXE+"_id_publication", ip);
97
	}
153
	}