Subversion Repositories eFlore/Applications.coel

Rev

Rev 1513 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1513 Rev 1733
1
package org.tela_botanica.client.modeles.structure;
1
package org.tela_botanica.client.modeles.structure;
2
 
2
 
3
import java.util.Iterator;
3
import java.util.Iterator;
4
import java.util.Set;
4
import java.util.Set;
5
 
5
 
6
import org.tela_botanica.client.modeles.aDonnee;
6
import org.tela_botanica.client.modeles.aDonnee;
7
 
7
 
8
import com.google.gwt.json.client.JSONObject;
8
import com.google.gwt.json.client.JSONObject;
9
 
9
 
10
public class StructureValorisation extends aDonnee {
10
public class StructureValorisation extends aDonnee {
11
	
11
	
12
	private static final long serialVersionUID = 8906713360999774621L;
12
    private static final long serialVersionUID = 8906713360999774621L;
13
 
13
 
14
	public static final String PREFIXE = "csv";
14
    public static final String PREFIXE = "csv";
15
	public static String[] champsObligatoires = {"csv_id_structure"};
15
    public static String[] champsObligatoires = {"csv_id_structure"};
16
 
16
 
17
	public StructureValorisation() {
17
    public StructureValorisation() {
18
	}
18
    }
19
	
19
	
20
	public StructureValorisation(JSONObject valorisation) {
20
    public StructureValorisation(JSONObject valorisation) {
21
		// L'objet JSON est une table de hachage
21
	// L'objet JSON est une table de hachage
22
		Set<String> im = valorisation.keySet();
22
	Set<String> im = valorisation.keySet();
23
 
23
 
24
		// Parcourt pour chaque clé
24
	// Parcourt pour chaque clé
25
		for (Iterator<String> it = im.iterator(); it.hasNext();) {
25
	for (Iterator<String> it = im.iterator(); it.hasNext();) {
26
			// Si elle est associée à une valeur, nous l'ajoutons
26
	    // Si elle est associée à une valeur, nous l'ajoutons
27
			String cle = it.next();
27
	    String cle = it.next();
28
			if (cle.startsWith(PREFIXE+"_")) {
28
	    if (cle.startsWith(PREFIXE+"_")) {
29
				// Suppression de l'abréviation du champ. Inutile dans le contexte d'un objet
29
		// Suppression de l'abréviation du champ. Inutile dans le contexte d'un objet
30
				String cleObjet = cle.replaceFirst("^"+PREFIXE+"_", "");
30
		String cleObjet = cle.replaceFirst("^"+PREFIXE+"_", "");
31
				// Sinon, nous ajoutons la clé avec une valeur vide
-
 
32
				String valeur = "";
-
 
33
				if (valorisation.get(cle).isString() != null) {
-
 
34
					valeur = valorisation.get(cle).isString().stringValue();
31
		// Sinon, nous ajoutons la clé avec une valeur vide
-
 
32
		String valeur = "";
-
 
33
		if (valorisation.get(cle).isString() != null) {
35
				}
34
		    valeur = valorisation.get(cle).isString().stringValue();
-
 
35
		}
36
				this.set(cleObjet, valeur);
36
		this.set(cleObjet, valeur);
37
			}
37
	    }
38
		}
38
	}
39
	}
39
    }
40
	
40
	
41
	@Override
41
    @Override
42
	protected String getPrefixe() {
42
    protected String getPrefixe() {
43
		return PREFIXE;
43
	return PREFIXE;
44
	}
44
    }
45
	
45
	
46
	protected String[] getChampsObligatoires()	{
46
    protected String[] getChampsObligatoires() {
47
		return champsObligatoires;
47
	return champsObligatoires;
-
 
48
    }
48
	}
49
	
-
 
50
    // ACTION
-
 
51
    public Integer getAction() {
49
	
52
	if (renvoyerValeurCorrecte("mark_action").equals("")) {
50
	// ACTION
53
	    return null;
51
	public String getAction() {
54
	}
52
		return renvoyerValeurCorrecte("mark_action");
55
	return Integer.parseInt(renvoyerValeurCorrecte("mark_action"));
53
	}
56
    }
54
	public void setAction(String a) {
57
    public void setAction(String a) {
55
		this.set("mark_action", a);
58
	this.set("mark_action", a != null ? Integer.parseInt(a) : null);
56
	}
59
    }
57
	
60
	
58
	// ACTION INFO
61
    // ACTION INFO
59
	public String getActionInfo() {
62
    public String getActionInfo() {
60
		return renvoyerValeurCorrecte("truk_action");
63
	return renvoyerValeurCorrecte("truk_action");
61
	}
64
    }
62
	public void setActionInfo(String a) {
65
    public void setActionInfo(String a) {
63
		this.set("truk_action", a);
66
	this.set("truk_action", a);
64
	}
67
    }
65
	public void setActionInfo(String type, Object valeur) {
68
    public void setActionInfo(String type, Object valeur) {
66
		remplacerTypeDansChaineDenormalise("truk_action", type, valeur);
69
	remplacerTypeDansChaineDenormalise("truk_action", type, valeur);
67
	}
70
    }
68
	
71
	
69
	// PUBLICATION
72
    // PUBLICATION
70
	public String getPublication() {
73
    public String getPublication() {
71
		return renvoyerValeurCorrecte("publication");
74
	return renvoyerValeurCorrecte("publication");
72
	}
75
    }
73
	public void setPublication(String p) {
76
    public void setPublication(String p) {
74
		this.set("publication", p);
77
	this.set("publication", p);
75
	}
78
    }
76
	
79
	
77
	// COLLECTION AUTRE
80
    // COLLECTION AUTRE
78
	public String getCollectionAutre() {
81
    public String getCollectionAutre() {
79
		return renvoyerValeurCorrecte("collection_autre");
82
	return renvoyerValeurCorrecte("collection_autre");
80
	}
83
    }
81
	public void setCollectionAutre(String ca) {
84
    public void setCollectionAutre(String ca) {
82
		this.set("collection_autre", ca);
85
	this.set("collection_autre", ca);
83
	}
86
    }
84
	public void setCollectionAutre(String type, Object valeur) {
87
    public void setCollectionAutre(String type, Object valeur) {
85
		remplacerTypeDansChaineDenormalise("collection_autre", type, valeur);
88
	remplacerTypeDansChaineDenormalise("collection_autre", type, valeur);
-
 
89
    }
86
	}
90
	
-
 
91
    // ACTION FUTURE
-
 
92
    public Integer getActionFuture() {
87
	
93
	if (renvoyerValeurCorrecte("mark_action_future").equals("")) {
88
	// ACTION FUTURE
94
	    return null;
89
	public String getActionFuture() {
95
	}
90
		return renvoyerValeurCorrecte("mark_action_future");
96
	return Integer.parseInt(renvoyerValeurCorrecte("mark_action_future"));
91
	}
97
    }
92
	public void setActionFuture(String af) {
98
    public void setActionFuture(String af) {
93
		this.set("mark_action_future", af);
99
	this.set("mark_action_future", af != null ? Integer.parseInt(af) : null);
94
	}
100
    }
95
	
101
	
96
	// ACTION FUTURE INFO
102
    // ACTION FUTURE INFO
97
	public String getActionFutureInfo() {
103
    public String getActionFutureInfo() {
98
		return renvoyerValeurCorrecte("action_future");
104
	return renvoyerValeurCorrecte("action_future");
99
	}
105
    }
100
	public void setActionFutureInfo(String af) {
106
    public void setActionFutureInfo(String af) {
101
		this.set("action_future", af);
-
 
102
	}
-
 
103
 
-
 
104
	
-
 
105
	// RECHERCHE
-
 
106
	public String getRecherche() {
-
 
107
		return renvoyerValeurCorrecte("mark_recherche");
-
 
108
	}
-
 
109
	public void setRecherche(String r) {
-
 
110
		this.set("mark_recherche", r);
-
 
111
	}
-
 
112
	
-
 
113
	// RECHERCHE PROVENANCE
-
 
114
	public String getRechercheProvenance() {
-
 
115
		return renvoyerValeurCorrecte("truk_recherche_provenance");
-
 
116
	}
-
 
117
	public void setRechercheProvenance(String rp) {
107
	this.set("action_future", af);
118
		this.set("truk_recherche_provenance", rp);
-
 
119
	}
-
 
120
	public void setRechercheProvenance(String type, Object valeur) {
-
 
121
		remplacerTypeDansChaineDenormalise("truk_recherche_provenance", type, valeur);
-
 
122
	}
-
 
123
	
-
 
124
	// RECHERCHE TYPE
-
 
125
	public String getRechercheType() {
-
 
126
		return renvoyerValeurCorrecte("truk_recherche_type");
-
 
127
	}
-
 
128
	public void setRechercheType(String rt) {
-
 
129
		this.set("truk_recherche_type", rt);
-
 
130
	}
-
 
131
	public void setRechercheType(String type, Object valeur) {
108
    }
-
 
109
 
-
 
110
	
-
 
111
    // RECHERCHE
132
		remplacerTypeDansChaineDenormalise("truk_recherche_type", type, valeur);
112
    public Integer getRecherche() {
133
	}
113
	if (renvoyerValeurCorrecte("mark_recherche").equals("")) {
134
	
114
	    return null;
135
	// ACCES SANS MOTIF
115
	}
136
	public String getAccesSansMotif() {
116
	return Integer.parseInt(renvoyerValeurCorrecte("mark_recherche"));
137
		return renvoyerValeurCorrecte("mark_acces_ss_motif");
117
 
138
	}
118
    }
139
	public void setAccesSansMotif(String asm) {
119
    public void setRecherche(String r) {
140
		this.set("mark_acces_ss_motif", asm);
120
	this.set("mark_recherche", r != null ? Integer.parseInt(r) : null);
141
	}
121
    }
-
 
122
	
-
 
123
    // RECHERCHE PROVENANCE
-
 
124
    public String getRechercheProvenance() {
142
	
125
	return renvoyerValeurCorrecte("truk_recherche_provenance");
143
	// ACCES SANS MOTIF INFO
126
    }
144
	public String getAccesSansMotifInfo() {
127
    public void setRechercheProvenance(String rp) {
145
		return renvoyerValeurCorrecte("acces_ss_motif");
128
	this.set("truk_recherche_provenance", rp);
146
	}
129
    }
147
	public void setAccesSansMotifInfo(String asm) {
130
    public void setRechercheProvenance(String type, Object valeur) {
148
		this.set("acces_ss_motif", asm);
131
	remplacerTypeDansChaineDenormalise("truk_recherche_provenance", type, valeur);
149
	}
132
    }
-
 
133
	
-
 
134
    // RECHERCHE TYPE
-
 
135
    public String getRechercheType() {
150
	
136
	return renvoyerValeurCorrecte("truk_recherche_type");
151
	// VISITE AVEC MOTIF
137
    }
152
	public String getVisiteAvecMotif() {
138
    public void setRechercheType(String rt) {
153
		return renvoyerValeurCorrecte("mark_visite_avec_motif");
139
	this.set("truk_recherche_type", rt);
154
	}
140
    }
-
 
141
    public void setRechercheType(String type, Object valeur) {
155
	public void setVisiteAvecMotif(String vam) {
142
	remplacerTypeDansChaineDenormalise("truk_recherche_type", type, valeur);
-
 
143
    }
-
 
144
	
-
 
145
    // ACCES SANS MOTIF
-
 
146
    public Integer getAccesSansMotif() {
-
 
147
	if (renvoyerValeurCorrecte("mark_acces_ss_motif").equals("")) {
-
 
148
	    return null;
-
 
149
	}
-
 
150
	return Integer.parseInt(renvoyerValeurCorrecte("mark_acces_ss_motif"));
-
 
151
 
-
 
152
    }
-
 
153
    public void setAccesSansMotif(String asm) {
156
		this.set("mark_visite_avec_motif", vam);
154
	this.set("mark_acces_ss_motif", asm != null ? Integer.parseInt(asm) : null);
157
	}
155
    }
-
 
156
	
-
 
157
    // ACCES SANS MOTIF INFO
-
 
158
    public String getAccesSansMotifInfo() {
-
 
159
	return renvoyerValeurCorrecte("acces_ss_motif");
-
 
160
    }
-
 
161
    public void setAccesSansMotifInfo(String asm) {
158
	
162
	this.set("acces_ss_motif", asm);
-
 
163
    }
-
 
164
	
-
 
165
    // VISITE AVEC MOTIF
-
 
166
    public Integer getVisiteAvecMotif() {
-
 
167
	if (renvoyerValeurCorrecte("mark_visite_avec_motif").equals("")) {
-
 
168
	    return null;
-
 
169
	}
-
 
170
	return Integer.parseInt(renvoyerValeurCorrecte("mark_visite_avec_motif"));
-
 
171
 
-
 
172
    }
-
 
173
    public void setVisiteAvecMotif(String vam) {
-
 
174
	this.set("mark_visite_avec_motif", vam != null ? Integer.parseInt(vam) : null);
-
 
175
    }
-
 
176
	
159
	// VISITE AVEC MOTIF INFO
177
    // VISITE AVEC MOTIF INFO
160
	public String getVisiteAvecMotifInfo() {
178
    public String getVisiteAvecMotifInfo() {
161
		return renvoyerValeurCorrecte("visite_avec_motif");
179
	return renvoyerValeurCorrecte("visite_avec_motif");
162
	}
180
    }
163
	public void setVisiteAvecMotifInfo(String vam) {
181
    public void setVisiteAvecMotifInfo(String vam) {
164
		this.set("visite_avec_motif", vam);
182
	this.set("visite_avec_motif", vam);
165
	}
183
    }
166
	
184
	
167
}
185
}