Subversion Repositories eFlore/Applications.coel

Rev

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

Rev 1764 Rev 1784
1
package org.tela_botanica.client.modeles.structure;
1
package org.tela_botanica.client.modeles.structure;
2
 
2
 
3
import java.util.HashMap;
3
import java.util.HashMap;
4
 
4
 
5
import org.tela_botanica.client.Mediateur;
5
import org.tela_botanica.client.Mediateur;
6
import org.tela_botanica.client.RegistreId;
6
import org.tela_botanica.client.RegistreId;
7
import org.tela_botanica.client.http.JsonRestRequestBuilder;
7
import org.tela_botanica.client.http.JsonRestRequestBuilder;
8
import org.tela_botanica.client.http.JsonRestRequestCallback;
8
import org.tela_botanica.client.http.JsonRestRequestCallback;
9
import org.tela_botanica.client.interfaces.Rafraichissable;
9
import org.tela_botanica.client.interfaces.Rafraichissable;
10
import org.tela_botanica.client.modeles.Information;
10
import org.tela_botanica.client.modeles.Information;
11
import org.tela_botanica.client.modeles.personne.PersonneListe;
11
import org.tela_botanica.client.modeles.personne.PersonneListe;
12
import org.tela_botanica.client.synchronisation.Reponse;
12
import org.tela_botanica.client.synchronisation.Reponse;
13
import org.tela_botanica.client.util.UtilDAO;
13
import org.tela_botanica.client.util.UtilDAO;
14
 
14
 
15
import com.extjs.gxt.ui.client.Registry;
15
import com.extjs.gxt.ui.client.Registry;
16
import com.google.gwt.core.client.GWT;
16
import com.google.gwt.core.client.GWT;
17
import com.google.gwt.http.client.URL;
17
import com.google.gwt.http.client.URL;
18
import com.google.gwt.json.client.JSONArray;
18
import com.google.gwt.json.client.JSONArray;
19
import com.google.gwt.json.client.JSONObject;
19
import com.google.gwt.json.client.JSONObject;
20
import com.google.gwt.json.client.JSONValue;
20
import com.google.gwt.json.client.JSONValue;
21
import com.google.gwt.user.client.Window;
21
import com.google.gwt.user.client.Window;
22
 
22
 
23
public class StructureAsyncDao {
23
public class StructureAsyncDao {
24
	private static final String SERVICE_NOM = "CoelStructure";
24
	private static final String SERVICE_NOM = "CoelStructure";
25
	public static String tri = null;
25
	public static String tri = null;
26
	
26
	
27
	private String utilisateurId = null;
27
	private String utilisateurId = null;
28
	private Rafraichissable vueARafraichir = null;
28
	private Rafraichissable vueARafraichir = null;
29
	
29
	
30
	public StructureAsyncDao(Rafraichissable vue) {
30
	public StructureAsyncDao(Rafraichissable vue) {
31
		if (Mediateur.DEBUG) System.out.println("|| StructureAsyncDao > vueARafraichir = "+vue.getClass().toString());
31
		if (Mediateur.DEBUG) System.out.println("|| StructureAsyncDao > vueARafraichir = "+vue.getClass().toString());
32
		vueARafraichir = vue;
32
		vueARafraichir = vue;
33
		utilisateurId = ((Mediateur) Registry.get(RegistreId.MEDIATEUR)).getUtilisateurId();
33
		utilisateurId = ((Mediateur) Registry.get(RegistreId.MEDIATEUR)).getUtilisateurId();
34
	}
34
	}
35
 
35
 
36
	/**
36
	/**
37
	 * 
37
	 * 
38
	 * @param paginationProgressive : définit le mode de consultation de la base de données
38
	 * @param paginationProgressive : définit le mode de consultation de la base de données
39
	 * 			- True :	la consultation des données est progressive, ce qui signifie que la liste est chargée (paginée) au
39
	 * 			- True :	la consultation des données est progressive, ce qui signifie que la liste est chargée (paginée) au
40
	 * 						fur et à mesure de la consultation des données par l'utilisateur.
40
	 * 						fur et à mesure de la consultation des données par l'utilisateur.
41
	 * 			- False :	la consultation des données est classique : un seul appel à la base de données est effectué, le retour
41
	 * 			- False :	la consultation des données est classique : un seul appel à la base de données est effectué, le retour
42
	 * 						est renvoyé à l'appelant
42
	 * 						est renvoyé à l'appelant
43
	 * 			// FIXME : si la taille de la liste est supérieure à la limite du JREST (150), ce deuxieme mode ne fonctionne pas
43
	 * 			// FIXME : si la taille de la liste est supérieure à la limite du JREST (150), ce deuxieme mode ne fonctionne pas
44
	 */
44
	 */
45
	public void selectionner(final boolean paginationProgressive, final String structureId, final String nomStructure, final String formatRetour, final int start, final int nbElements, final Integer seqId, final boolean searchCity) {
45
	public void selectionner(final boolean paginationProgressive, final String structureId, final String nomStructure, final String formatRetour, final int start, final int nbElements, final Integer seqId, final boolean searchCity) {
46
		String[] parametres = {structureId, nomStructure};
46
		String[] parametres = {structureId, nomStructure};
47
 
47
 
48
		HashMap<String, String> restrictions = new HashMap<String, String>();
48
		HashMap<String, String> restrictions = new HashMap<String, String>();
49
 
49
 
50
		if (nbElements != -1)	{
50
		if (nbElements != -1)	{
51
			restrictions.put("limit", String.valueOf(nbElements));
51
			restrictions.put("limit", String.valueOf(nbElements));
52
		}
52
		}
53
		restrictions.put("searchCity", String.valueOf(searchCity));
53
		restrictions.put("searchCity", String.valueOf(searchCity));
54
 
54
 
55
		if(tri != null) {
55
		if(tri != null) {
56
			restrictions.put("orderby", tri);
56
			restrictions.put("orderby", tri);
57
		}
57
		}
58
		
58
		
59
		if ((formatRetour != null) && (formatRetour != "")) {
59
		if ((formatRetour != null) && (formatRetour != "")) {
60
			restrictions.put("formatRetour", formatRetour);
60
			restrictions.put("formatRetour", formatRetour);
61
		}
61
		}
62
		
62
		
63
		/** GESTION DE LA REQUETE dans le cas d'une liste paginée progressive **/
63
		/** GESTION DE LA REQUETE dans le cas d'une liste paginée progressive **/
64
		if (paginationProgressive) {
64
		if (paginationProgressive) {
65
			
65
			
66
			/** DEFINITION DU TUPLE DE DEPART **/
66
			/** DEFINITION DU TUPLE DE DEPART **/
67
			restrictions.put("start", String.valueOf(start));
67
			restrictions.put("start", String.valueOf(start));
68
			
68
			
69
			/** CONSTRUCTION DE LA REQUETE **/
69
			/** CONSTRUCTION DE LA REQUETE **/
70
    		final JsonRestRequestBuilder rb = UtilDAO.construireRequete(SERVICE_NOM, parametres, restrictions);
70
    		final JsonRestRequestBuilder rb = UtilDAO.construireRequete(SERVICE_NOM, parametres, restrictions);
71
 
71
 
72
    		/** ENVOI DE LA REQUETE **/
72
    		/** ENVOI DE LA REQUETE **/
73
    		rb.envoyerRequete(null, new JsonRestRequestCallback()
73
    		rb.envoyerRequete(null, new JsonRestRequestCallback()
74
    		{
74
    		{
75
    			/** RECEPTION DE LA REPONSE **/
75
    			/** RECEPTION DE LA REPONSE **/
76
    			public void surReponse(JSONValue responseValue)
76
    			public void surReponse(JSONValue responseValue)
77
    			{
77
    			{
78
					if (seqId != null)	{
78
					if (seqId != null)	{
79
						Reponse reponseRequete = new Reponse(responseValue, seqId);
79
						Reponse reponseRequete = new Reponse(responseValue, seqId);
80
						vueARafraichir.rafraichir(reponseRequete);
80
						vueARafraichir.rafraichir(reponseRequete);
81
					}
81
					}
82
					
82
					
83
    				/** Dans le cas d'une liste paginée, vueARafraichir est un objet Proxy.
83
    				/** Dans le cas d'une liste paginée, vueARafraichir est un objet Proxy.
84
    				 * On retourne l'objet JSON au proxy afin que ce soit lui qui le traite **/
84
    				 * On retourne l'objet JSON au proxy afin que ce soit lui qui le traite **/
85
					else vueARafraichir.rafraichir(responseValue);
85
					else vueARafraichir.rafraichir(responseValue);
86
    			}
86
    			}
87
    		});
87
    		});
88
		}
88
		}
89
		/** GESTION DE LA REQUETE dans le cas d'une liste NON paginée progressive **/
89
		/** GESTION DE LA REQUETE dans le cas d'une liste NON paginée progressive **/
90
		else {
90
		else {
91
			
91
			
92
			/** DEFINITION DU TUPLE DE DEPART **/
92
			/** DEFINITION DU TUPLE DE DEPART **/
93
			restrictions.put("start", String.valueOf(start*nbElements));
93
			restrictions.put("start", String.valueOf(start*nbElements));
94
			
94
			
95
			final JsonRestRequestBuilder rb = UtilDAO.construireRequete(SERVICE_NOM, parametres, restrictions);
95
			final JsonRestRequestBuilder rb = UtilDAO.construireRequete(SERVICE_NOM, parametres, restrictions);
96
			
96
			
97
			rb.envoyerRequete(null, new JsonRestRequestCallback() {
97
			rb.envoyerRequete(null, new JsonRestRequestCallback() {
98
 
98
 
99
				public void surReponse(JSONValue responseValue) {
99
				public void surReponse(JSONValue responseValue) {
100
					
100
					
101
					if (responseValue != null) {
101
					if (responseValue != null) {
102
						
102
						
103
						Information info = new Information("selection_structure");
103
						Information info = new Information("selection_structure");
104
						
104
						
105
						JSONObject responseObject = responseValue.isObject();
105
						JSONObject responseObject = responseValue.isObject();
106
						
106
						
107
						if (responseObject != null) {
107
						if (responseObject != null) {
108
							
108
							
109
							// Si la réponse est un tableau, alors c'est une liste de structure qui a été retournée
109
							// Si la réponse est un tableau, alors c'est une liste de structure qui a été retournée
110
							if (responseObject.get("structures").isArray() != null) {
110
							if (responseObject.get("structures").isArray() != null) {
111
								
111
								
112
								JSONObject reponse = responseObject;
112
								JSONObject reponse = responseObject;
113
								StructureListe structures;
113
								StructureListe structures;
114
								structures = new StructureListe(reponse.get("structures").isArray(), reponse.get("nbElements").isNumber(), vueARafraichir);
114
								structures = new StructureListe(reponse.get("structures").isArray(), reponse.get("nbElements").isNumber(), vueARafraichir);
115
								structures.setTaillePage(nbElements);
115
								structures.setTaillePage(nbElements);
116
								structures.setPageCourante(start);
116
								structures.setPageCourante(start);
117
								
117
								
118
								info.setDonnee(0, structures);
118
								info.setDonnee(0, structures);
119
								
119
								
120
								if (seqId != null)	{
120
								if (seqId != null)	{
121
									Reponse reponseRequete = new Reponse(info, seqId);
121
									Reponse reponseRequete = new Reponse(info, seqId);
122
									vueARafraichir.rafraichir(reponseRequete);
122
									vueARafraichir.rafraichir(reponseRequete);
123
								}
123
								}
124
								else vueARafraichir.rafraichir(structures);
124
								else vueARafraichir.rafraichir(structures);
125
								
125
								
126
							// Si la réponse est un objet, alors c'est une unique structure qui a été retournée
126
							// Si la réponse est un objet, alors c'est une unique structure qui a été retournée
127
							} else if (responseObject.get("structures").isObject() != null) {
127
							} else if (responseObject.get("structures").isObject() != null) {
128
								
128
								
129
								JSONObject reponse = responseObject.get("structures").isObject();
129
								JSONObject reponse = responseObject.get("structures").isObject();
130
								Structure structure = new Structure(reponse);
130
								Structure structure = new Structure(reponse);
131
								StructureConservation structureConservation = new StructureConservation(reponse);
131
								StructureConservation structureConservation = new StructureConservation(reponse);
132
								StructureValorisation structureValorisation = new StructureValorisation(reponse);
132
								StructureValorisation structureValorisation = new StructureValorisation(reponse);
133
								
133
								
134
								info.setDonnee(0, structure);
134
								info.setDonnee(0, structure);
135
								info.setDonnee(1, structureConservation);
135
								info.setDonnee(1, structureConservation);
136
								info.setDonnee(2, structureValorisation);
136
								info.setDonnee(2, structureValorisation);
137
								
137
								
138
								if (seqId != null)	{
138
								if (seqId != null)	{
139
									Reponse reponseRequete = new Reponse(info, seqId);
139
									Reponse reponseRequete = new Reponse(info, seqId);
140
									vueARafraichir.rafraichir(reponseRequete);
140
									vueARafraichir.rafraichir(reponseRequete);
141
								}
141
								}
142
								else vueARafraichir.rafraichir(info);
142
								else vueARafraichir.rafraichir(info);
143
							}  
143
							}  
144
						} else {
144
						} else {
145
							GWT.log(rb.getUrl()+"\n\tLa réponse n'est pas un objet ou un talbeau JSON et vaut : "+responseValue.toString(), null);
145
							GWT.log(rb.getUrl()+"\n\tLa réponse n'est pas un objet ou un talbeau JSON et vaut : "+responseValue.toString(), null);
146
						}
146
						}
147
					} else {
147
					} else {
148
						if (structureId == null) {
148
						if (structureId == null) {
149
							// Dans le cas, où nous demandons toutes les institutions et qu'il n'y en a pas, nous retournons un objet vide
149
							// Dans le cas, où nous demandons toutes les institutions et qu'il n'y en a pas, nous retournons un objet vide
150
							StructureListe structures = new StructureListe(0);
150
							StructureListe structures = new StructureListe(0);
151
							vueARafraichir.rafraichir(structures);								
151
							vueARafraichir.rafraichir(structures);								
152
						}
152
						}
153
					}
153
					}
154
				}
154
				}
155
			});
155
			});
156
		}
156
		}
157
	}
157
	}
158
	
158
	
159
 
159
 
160
	public void ajouter(final Structure str, StructureConservation conservation, StructureValorisation valorisation) {
160
	public void ajouter(final Structure str, StructureConservation conservation, StructureValorisation valorisation) {
161
		String postDonneesEncodees = construirePost(null, str, conservation, valorisation);
161
		String postDonneesEncodees = construirePost(null, str, conservation, valorisation);
162
 
162
 
163
		final JsonRestRequestBuilder rb = UtilDAO.construireRequetePost(SERVICE_NOM);	
163
		final JsonRestRequestBuilder rb = UtilDAO.construireRequetePost(SERVICE_NOM);	
164
		rb.envoyerRequete(postDonneesEncodees, new JsonRestRequestCallback() {
164
		rb.envoyerRequete(postDonneesEncodees, new JsonRestRequestCallback() {
165
			@Override
165
			@Override
166
			public void surReponse(JSONValue responseValue) {
166
			public void surReponse(JSONValue responseValue) {
167
				// Si la requête a impliquées des valeurs autogénérées, l'objet modifié est retourné
167
				// Si la requête a impliquées des valeurs autogénérées, l'objet modifié est retourné
168
				JSONObject obj;
168
				JSONObject obj;
169
				if ((obj = responseValue.isObject()) != null) {
169
				if ((obj = responseValue.isObject()) != null) {
170
					if (obj.get("structures").isObject() != null) {
170
					if (obj.get("structures").isObject() != null) {
171
						Information info = new Information("ajout_structure");
171
						Information info = new Information("ajout_structure");
172
						Structure structure = new Structure(obj.get("structures").isObject());
172
						Structure structure = new Structure(obj.get("structures").isObject());
173
						info.setDonnee(structure);
173
						info.setDonnee(structure);
174
						vueARafraichir.rafraichir(info);
174
						vueARafraichir.rafraichir(info);
175
					}
175
					}
176
				}
176
				}
177
				else if (responseValue.isString() != null) {
177
				else if (responseValue.isString() != null) {
178
					Information info = new Information("ajout_structure");
178
					Information info = new Information("ajout_structure");
179
					String structureIdOuMessage = responseValue.isString().stringValue();
179
					String structureIdOuMessage = responseValue.isString().stringValue();
180
					if (structureIdOuMessage.matches("^[0-9]+$")) {
180
					if (structureIdOuMessage.matches("^[0-9]+$")) {
181
						info.setDonnee(structureIdOuMessage);
181
						info.setDonnee(structureIdOuMessage);
182
					} else {
182
					} else {
183
						info.setMessage(structureIdOuMessage);
183
						info.setMessage(structureIdOuMessage);
184
					}
184
					}
185
					vueARafraichir.rafraichir(info);
185
					vueARafraichir.rafraichir(info);
186
				} else {
186
				} else {
187
					GWT.log(rb.getUrl()+"\n\tLa réponse n'est pas une chaine JSON.", null);
187
					GWT.log(rb.getUrl()+"\n\tLa réponse n'est pas une chaine JSON.", null);
188
				}
188
				}
189
			}
189
			}
190
		});
190
		});
191
	}
191
	}
192
 
192
 
193
	public void modifier(String structureId, Structure str, StructureConservation conservation, StructureValorisation valorisation) {
193
	public void modifier(String structureId, Structure str, StructureConservation conservation, StructureValorisation valorisation) {
194
		String postDonneesEncodees = construirePost(structureId, str, conservation, valorisation);
194
		String postDonneesEncodees = construirePost(structureId, str, conservation, valorisation);
195
		String[] parametres = {structureId};
195
		String[] parametres = {structureId};
196
		final JsonRestRequestBuilder rb = UtilDAO.construireRequetePost(SERVICE_NOM, parametres);
196
		final JsonRestRequestBuilder rb = UtilDAO.construireRequetePost(SERVICE_NOM, parametres);
197
		rb.envoyerRequete(postDonneesEncodees, new JsonRestRequestCallback() {
197
		rb.envoyerRequete(postDonneesEncodees, new JsonRestRequestCallback() {
198
			@Override
198
			@Override
199
			public void surReponse(JSONValue responseValue) {
199
			public void surReponse(JSONValue responseValue) {
200
				// Si la requête a impliquées des valeurs autogénérées, l'objet modifié est retourné
200
				// Si la requête a impliquées des valeurs autogénérées, l'objet modifié est retourné
201
				JSONObject obj;
201
				JSONObject obj;
202
				if ((obj = responseValue.isObject()) != null) {
202
				if ((obj = responseValue.isObject()) != null) {
203
					if (obj.get("structures").isObject() != null) {
203
					if (obj.get("structures").isObject() != null) {
204
						Structure structure = new Structure(obj.get("structures").isObject());
204
						Structure structure = new Structure(obj.get("structures").isObject());
205
						Information info = new Information("modif_structure");
205
						Information info = new Information("modif_structure");
206
						info.setDonnee(structure);
206
						info.setDonnee(structure);
207
						vueARafraichir.rafraichir(info);
207
						vueARafraichir.rafraichir(info);
208
					}
208
					}
209
				}
209
				}
210
				// Si la requête est un succès, reception d'une chaine
210
				// Si la requête est un succès, reception d'une chaine
211
				else if (responseValue.isString() != null) {
211
				else if (responseValue.isString() != null) {
212
					Information info = new Information("modif_structure");
212
					Information info = new Information("modif_structure");
213
					info.setMessage(responseValue.isString().stringValue());
213
					info.setMessage(responseValue.isString().stringValue());
214
					vueARafraichir.rafraichir(info);
214
					vueARafraichir.rafraichir(info);
215
				} else {
215
				} else {
216
					GWT.log(rb.getUrl()+"\n\tLa réponse n'est pas une chaine JSON.", null);
216
					GWT.log(rb.getUrl()+"\n\tLa réponse n'est pas une chaine JSON.", null);
217
				}
217
				}
218
			}
218
			}
219
		});
219
		});
220
	}
220
	}
221
	
221
	
222
	public void supprimer(String structuresId) {
222
	public void supprimer(String structuresId) {
223
		String[] parametres = {utilisateurId, structuresId};
223
		String[] parametres = {utilisateurId, structuresId};
224
		final JsonRestRequestBuilder rb = UtilDAO.construireRequetePost(SERVICE_NOM, parametres);
224
		final JsonRestRequestBuilder rb = UtilDAO.construireRequetePost(SERVICE_NOM, parametres);
225
		rb.envoyerRequeteSuppression(new JsonRestRequestCallback() {
225
		rb.envoyerRequeteSuppression(new JsonRestRequestCallback() {
226
			@Override
226
			@Override
227
			public void surReponse(JSONValue responseValue) {
227
			public void surReponse(JSONValue responseValue) {
228
				if (responseValue.isString() != null) {
228
				if (responseValue.isString() != null) {
229
					Information info = new Information("suppression_structure");
229
					Information info = new Information("suppression_structure");
230
					info.setMessage(responseValue.isString().stringValue());
230
					info.setMessage(responseValue.isString().stringValue());
231
					vueARafraichir.rafraichir(info);
231
					vueARafraichir.rafraichir(info);
232
				} else {
232
				} else {
233
					GWT.log(rb.getUrl()+"\n\tLa réponse n'est pas une chaine JSON.", null);
233
					GWT.log(rb.getUrl()+"\n\tLa réponse n'est pas une chaine JSON.", null);
234
				}
234
				}
235
			}
235
			}
236
		});
236
		});
237
	}
237
	}
238
	
238
	
239
	private String construirePost(String structureId, Structure str, StructureConservation conservation, StructureValorisation valorisation) {
239
	private String construirePost(String structureId, Structure str, StructureConservation conservation, StructureValorisation valorisation) {
240
		String postDonnees = "cmhl_ce_modifier_par=" + URL.encodeComponent(utilisateurId); 
240
		String postDonnees = "cmhl_ce_modifier_par=" + URL.encodeComponent(utilisateurId); 
241
			
241
			
242
		if (str != null) {
242
		if (str != null) {
243
			if (structureId != null) {
243
			if (structureId != null) {
244
				postDonnees += "&cs_id_structure=" + URL.encodeComponent(structureId);
244
				postDonnees += "&cs_id_structure=" + URL.encodeComponent(structureId);
245
			}
245
			}
246
			
246
			
247
			postDonnees += "&cs_ce_mere=" + URL.encodeComponent(str.getIdMere()) +
247
			postDonnees += "&cs_ce_mere=" + URL.encodeComponent(str.getIdMere()) +
248
				"&cs_guid=" + URL.encodeComponent(str.getGuid()) +
248
				"&cs_guid=" + URL.encodeComponent(str.getGuid()) +
249
				"&cs_truk_identifiant_alternatif=" + URL.encodeComponent(str.getIdAlternatif()) +
249
				"&cs_truk_identifiant_alternatif=" + URL.encodeComponent(str.getIdAlternatif()) +
250
				"&cs_nom=" + URL.encodeComponent(str.getNom()) +
250
				"&cs_nom=" + URL.encodeComponent(str.getNom()) +
251
				"&cs_truk_nom_alternatif=" + URL.encodeComponent(str.getNomAlternatif()) +
251
				"&cs_truk_nom_alternatif=" + URL.encodeComponent(str.getNomAlternatif()) +
252
				"&cs_description=" + URL.encodeComponent(str.getDescription()) +
252
				"&cs_description=" + URL.encodeComponent(str.getDescription()) +
253
				"&cs_ce_type=" + URL.encodeComponent(str.getType()) +
253
				"&cs_ce_type=" + URL.encodeComponent(str.getType()) +
254
				"&cs_ce_truk_type_prive=" + URL.encodeComponent(str.getTypePrive()) +
254
				"&cs_ce_truk_type_prive=" + URL.encodeComponent(str.getTypePrive()) +
255
				"&cs_ce_truk_type_public=" + URL.encodeComponent(str.getTypePublic()) +
255
				"&cs_ce_truk_type_public=" + URL.encodeComponent(str.getTypePublic()) +
256
				"&cs_adresse_01=" + URL.encodeComponent(str.getAdresse()) +
256
				"&cs_adresse_01=" + URL.encodeComponent(str.getAdresse()) +
257
				"&cs_adresse_02=" + URL.encodeComponent(str.getAdresseComplement()) +
-
 
258
				"&cs_date_fondation=" + URL.encodeComponent(str.getDateFondationFormatMysql()) +
257
				"&cs_date_fondation=" + URL.encodeComponent(str.getDateFondationFormatMysql()) +
259
				"&cs_code_postal=" + URL.encodeComponent(str.getCodePostal()) +
258
				"&cs_code_postal=" + URL.encodeComponent(str.getCodePostal()) +
260
				"&cs_ville=" + URL.encodeComponent(str.getVille()) +
259
				"&cs_ville=" + URL.encodeComponent(str.getVille()) +
261
				"&cs_ce_truk_region=" + URL.encodeComponent(str.get("ce_truk_region").toString()) +
-
 
262
				"&cs_ce_truk_pays=" + URL.encodeComponent(str.getPays()) +
260
				"&cs_ce_truk_pays=" + URL.encodeComponent(str.getPays()) +
263
				"&cs_latitude=" + URL.encodeComponent(str.getLatitude()) +
261
				"&cs_latitude=" + URL.encodeComponent(str.getLatitude()) +
264
				"&cs_longitude=" + URL.encodeComponent(str.getLongitude()) +
262
				"&cs_longitude=" + URL.encodeComponent(str.getLongitude()) +
265
				"&cs_truk_telephone=" + URL.encodeComponent(str.getTelephone()) +
263
				"&cs_truk_telephone=" + URL.encodeComponent(str.getTelephone()) +
266
				"&cs_truk_url=" + URL.encodeComponent(str.getUrl()) +
264
				"&cs_truk_url=" + URL.encodeComponent(str.getUrl()) +
267
				"&cs_nbre_personne=" + (str.getNbrePersonne() != null ? str.getNbrePersonne() : "") +
265
				"&cs_nbre_personne=" + (str.getNbrePersonne() != null ? str.getNbrePersonne() : "") +
268
				"&cs_condition_acces=" + URL.encodeComponent(str.getConditionAcces())+
266
				"&cs_condition_acces=" + URL.encodeComponent(str.getConditionAcces())+
269
				"&cs_condition_usage=" + URL.encodeComponent(str.getConditionUsage())+
267
				"&cs_condition_usage=" + URL.encodeComponent(str.getConditionUsage())+
270
				"&cs_courriel=" + URL.encodeComponent(str.getCourriel());
268
				"&cs_courriel=" + URL.encodeComponent(str.getCourriel());
271
		}
269
		}
272
		if (conservation != null) {
270
		if (conservation != null) {
273
			if (structureId != null) {
271
			if (structureId != null) {
274
				postDonnees += "&csc_id_structure=" + URL.encodeComponent(structureId);
272
				postDonnees += "&csc_id_structure=" + URL.encodeComponent(structureId);
275
			}
273
			}
276
			postDonnees += "&csc_mark_formation=" + (conservation.getFormation() != null ? conservation.getFormation() : "") +
274
			postDonnees += "&csc_mark_formation=" + (conservation.getFormation() != null ? conservation.getFormation() : "") +
277
				"&csc_formation=" + URL.encodeComponent(conservation.getFormationInfo()) +
275
				"&csc_formation=" + URL.encodeComponent(conservation.getFormationInfo()) +
278
				"&csc_mark_formation_interet=" + (conservation.getFormationInteret() != null ? conservation.getFormationInteret() : "") +
276
				"&csc_mark_formation_interet=" + (conservation.getFormationInteret() != null ? conservation.getFormationInteret() : "") +
279
				"&csc_truk_stockage_local=" + URL.encodeComponent(conservation.getStockageLocal()) +
277
				"&csc_truk_stockage_local=" + URL.encodeComponent(conservation.getStockageLocal()) +
280
				"&csc_truk_stockage_meuble=" + URL.encodeComponent(conservation.getStockageMeuble()) +
278
				"&csc_truk_stockage_meuble=" + URL.encodeComponent(conservation.getStockageMeuble()) +
281
				"&csc_truk_stockage_parametre=" + URL.encodeComponent(conservation.getStockageParametre()) +
279
				"&csc_truk_stockage_parametre=" + URL.encodeComponent(conservation.getStockageParametre()) +
282
				"&csc_mark_collection_commune=" + (conservation.getCollectionCommune() != null ? conservation.getCollectionCommune() : "") +
280
				"&csc_mark_collection_commune=" + (conservation.getCollectionCommune() != null ? conservation.getCollectionCommune() : "") +
283
				"&csc_truk_collection_autre=" + URL.encodeComponent(conservation.getCollectionAutre()) +
281
				"&csc_truk_collection_autre=" + URL.encodeComponent(conservation.getCollectionAutre()) +
284
				"&csc_mark_acces_controle=" + (conservation.getAccesControle() != null ? conservation.getAccesControle() : "") +
282
				"&csc_mark_acces_controle=" + (conservation.getAccesControle() != null ? conservation.getAccesControle() : "") +
285
				"&csc_mark_restauration=" + (conservation.getRestauration() != null ? conservation.getRestauration() : "") +
283
				"&csc_mark_restauration=" + (conservation.getRestauration() != null ? conservation.getRestauration() : "") +
286
				"&csc_truk_restauration_operation=" + URL.encodeComponent(conservation.getRestaurationOperation()) +
284
				"&csc_truk_restauration_operation=" + URL.encodeComponent(conservation.getRestaurationOperation()) +
287
				"&csc_ce_materiel_conservation=" + URL.encodeComponent(conservation.getMaterielConservation()) +
285
				"&csc_ce_materiel_conservation=" + URL.encodeComponent(conservation.getMaterielConservation()) +
288
				"&csc_truk_materiel_autre=" + URL.encodeComponent(conservation.getMaterielAutre()) +
286
				"&csc_truk_materiel_autre=" + URL.encodeComponent(conservation.getMaterielAutre()) +
289
				"&csc_mark_traitement=" + (conservation.getTraitement() != null ? conservation.getTraitement() : "") +
287
				"&csc_mark_traitement=" + (conservation.getTraitement() != null ? conservation.getTraitement() : "") +
290
				"&csc_truk_traitement=" + URL.encodeComponent(conservation.getTraitements()) +
288
				"&csc_truk_traitement=" + URL.encodeComponent(conservation.getTraitements()) +
291
				"&csc_mark_acquisition_collection=" + (conservation.getAcquisitionCollection() != null ? conservation.getAcquisitionCollection() : "") +
289
				"&csc_mark_acquisition_collection=" + (conservation.getAcquisitionCollection() != null ? conservation.getAcquisitionCollection() : "") +
292
				"&csc_mark_acquisition_echantillon=" + (conservation.getAcquisitionEchantillon() != null ? conservation.getAcquisitionEchantillon() : "") +
290
				"&csc_mark_acquisition_echantillon=" + (conservation.getAcquisitionEchantillon() != null ? conservation.getAcquisitionEchantillon() : "") +
293
				"&csc_mark_acquisition_traitement=" + URL.encodeComponent(conservation.getAcquisitionTraitement()) +
291
				"&csc_mark_acquisition_traitement=" + URL.encodeComponent(conservation.getAcquisitionTraitement()) +
294
				"&csc_truk_acquisition_traitement_poison=" + URL.encodeComponent(conservation.getAcquisitionTraitementPoison()) +
292
				"&csc_truk_acquisition_traitement_poison=" + URL.encodeComponent(conservation.getAcquisitionTraitementPoison()) +
295
				"&csc_truk_acquisition_traitement_insecte=" + URL.encodeComponent(conservation.getAcquisitionTraitementInsecte());
293
				"&csc_truk_acquisition_traitement_insecte=" + URL.encodeComponent(conservation.getAcquisitionTraitementInsecte());
296
		}
294
		}
297
		if (valorisation != null) {
295
		if (valorisation != null) {
298
			if (structureId != null) {
296
			if (structureId != null) {
299
				postDonnees += "&csv_id_structure=" + URL.encodeComponent(structureId);
297
				postDonnees += "&csv_id_structure=" + URL.encodeComponent(structureId);
300
			}
298
			}
301
			postDonnees += "&csv_mark_action=" + (valorisation.getAction() != null ? valorisation.getAction() : "") +
299
			postDonnees += "&csv_mark_action=" + (valorisation.getAction() != null ? valorisation.getAction() : "") +
302
			    "&csv_truk_action=" + URL.encodeComponent(valorisation.getActionInfo()) +
300
			    "&csv_truk_action=" + URL.encodeComponent(valorisation.getActionInfo()) +
303
			    "&csv_publication=" + URL.encodeComponent(valorisation.getPublication()) +
301
			    "&csv_publication=" + URL.encodeComponent(valorisation.getPublication()) +
304
			    "&csv_collection_autre=" + URL.encodeComponent(valorisation.getCollectionAutre()) +
302
			    "&csv_collection_autre=" + URL.encodeComponent(valorisation.getCollectionAutre()) +
305
			    "&csv_mark_action_future=" + (valorisation.getActionFuture() != null ? valorisation.getActionFuture() : "") +
303
			    "&csv_mark_action_future=" + (valorisation.getActionFuture() != null ? valorisation.getActionFuture() : "") +
306
			    "&csv_action_future=" + URL.encodeComponent(valorisation.getActionFutureInfo()) +
304
			    "&csv_action_future=" + URL.encodeComponent(valorisation.getActionFutureInfo()) +
307
			    "&csv_mark_recherche=" + (valorisation.getRecherche() != null ? valorisation.getRecherche() : "") +
305
			    "&csv_mark_recherche=" + (valorisation.getRecherche() != null ? valorisation.getRecherche() : "") +
308
			    "&csv_truk_recherche_provenance=" + URL.encodeComponent(valorisation.getRechercheProvenance()) +
306
			    "&csv_truk_recherche_provenance=" + URL.encodeComponent(valorisation.getRechercheProvenance()) +
309
			    "&csv_truk_recherche_type=" + URL.encodeComponent(valorisation.getRechercheType()) +
307
			    "&csv_truk_recherche_type=" + URL.encodeComponent(valorisation.getRechercheType()) +
310
			    "&csv_mark_acces_ss_motif=" + (valorisation.getAccesSansMotif() != null ? valorisation.getAccesSansMotif() : "") +
308
			    "&csv_mark_acces_ss_motif=" + (valorisation.getAccesSansMotif() != null ? valorisation.getAccesSansMotif() : "") +
311
			    "&csv_acces_ss_motif=" + URL.encodeComponent(valorisation.getAccesSansMotifInfo()) +
309
			    "&csv_acces_ss_motif=" + URL.encodeComponent(valorisation.getAccesSansMotifInfo()) +
312
			    "&csv_mark_visite_avec_motif=" + (valorisation.getVisiteAvecMotif() != null ? valorisation.getVisiteAvecMotif() : "") +
310
			    "&csv_mark_visite_avec_motif=" + (valorisation.getVisiteAvecMotif() != null ? valorisation.getVisiteAvecMotif() : "") +
313
			    "&csv_visite_avec_motif=" + URL.encodeComponent(valorisation.getVisiteAvecMotifInfo());
311
			    "&csv_visite_avec_motif=" + URL.encodeComponent(valorisation.getVisiteAvecMotifInfo());
314
		}
312
		}
315
		return postDonnees;
313
		return postDonnees;
316
	}
314
	}
317
}
315
}