Subversion Repositories eFlore/Applications.coel

Rev

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

Rev 1417 Rev 1513
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("^"+Publication.PREFIXE+"_", "");
-
 
51
					cleObjet = cle.replaceFirst("^"+Personne.PREFIXE+"_", "");
-
 
52
					cleObjet = cleObjet.replaceFirst("^"+PREFIXE+"_", "");
-
 
53
				}
-
 
54
				else {
-
 
55
					cleObjet = cle;
-
 
56
				}
16
	public CollectionAPublication() {
57
				this.set(cleObjet, a.get(cle));
17
		initialiser(new JSONObject());
58
			}
18
	}
59
		}
19
			
60
 
Line 47... Line 88...
47
			setIdPublication(publication.getId());
88
			setIdPublication(publication.getId());
48
		}
89
		}
49
	}
90
	}
Line 50... Line 91...
50
	
91
	
-
 
92
	private void initialiserChampsPourGrille() {
51
	private void initialiserChampsPourGrille() {
93
		if (removePrefix) {
52
		set("fmt_auteur", getPublication().getAuteur());
94
			set("fmt_auteur", getPublication().getAuteur());
53
		set("titre", getPublication().getTitre());
95
			set("titre", getPublication().getTitre());
54
		set("collection", getPublication().getCollection());
96
			set("collection", getPublication().getCollection());
55
		set("_editeur_", "");
97
			set("_editeur_", "");
56
		set("_annee_", "");
98
			set("_annee_", "");
57
		set("indication_nvt", getPublication().getIndicationNvt());
99
			set("indication_nvt", getPublication().getIndicationNvt());
58
		set("fascicule", getPublication().getFascicule());
100
			set("fascicule", getPublication().getFascicule());
-
 
101
			set("truk_pages", getPublication().getPages());
-
 
102
			set("_etat_", "");
-
 
103
		} else {
-
 
104
			set(Publication.PREFIXE+"_fmt_auteur", getPublication().getAuteur());
-
 
105
			set(Publication.PREFIXE+"_titre", getPublication().getTitre());
-
 
106
			set(Publication.PREFIXE+"_collection", getPublication().getCollection());
-
 
107
			set("_editeur_", "");
-
 
108
			set("_annee_", "");
-
 
109
			set(Publication.PREFIXE+"_indication_nvt", getPublication().getIndicationNvt());
-
 
110
			set(Publication.PREFIXE+"_fascicule", getPublication().getFascicule());
59
		set("truk_pages", getPublication().getPages());
111
			set(Publication.PREFIXE+"_truk_pages", getPublication().getPages());
-
 
112
			set("_etat_", "");
60
		set("_etat_", "");
113
		}
Line 61... Line 114...
61
	}
114
	}
62
	
115
	
63
	// ID
116
	// ID
Line 80... Line 133...
80
	//+---------------------------------------------------------------------------------------------------------------+
133
	//+---------------------------------------------------------------------------------------------------------------+
81
	// CHAMPS PROVENANT de la TABLE COEL_COLLECTION_A_PERSONNE
134
	// CHAMPS PROVENANT de la TABLE COEL_COLLECTION_A_PERSONNE
Line 82... Line 135...
82
	
135
	
83
	// ID COLLECTION
136
	// ID COLLECTION
-
 
137
	public String getIdCollection() {
84
	public String getIdCollection() {
138
		if (removePrefix) return renvoyerValeurCorrecte("id_collection");
85
		return renvoyerValeurCorrecte("id_collection");
139
		else return renvoyerValeurCorrecte(PREFIXE+"_id_collection");
86
	}
140
	}
-
 
141
	public void setIdCollection(String idCollection) {
87
	public void setIdCollection(String idCollection) {
142
		if (removePrefix) set("id_collection", idCollection);
88
		set("id_collection", idCollection);
143
		else set(PREFIXE+"_id_collection", idCollection);
Line 89... Line 144...
89
	}
144
	}
90
	
145
	
-
 
146
	// ID PUBLICATION
91
	// ID PUBLICATION
147
	public String getIdPublication() {
92
	public String getIdPublication() {
148
		if (removePrefix) return renvoyerValeurCorrecte("id_publication");
93
		return renvoyerValeurCorrecte("id_publication");
149
		else return renvoyerValeurCorrecte(PREFIXE+"_id_publication");
-
 
150
	}
94
	}
151
	public void setIdPublication(String ip) {
95
	public void setIdPublication(String ip) {
152
		if (removePrefix) set("id_publication", ip);
Line 96... Line 153...
96
		set("id_publication", ip);
153
		else set(PREFIXE+"_id_publication", ip);
97
	}
154
	}