Subversion Repositories eFlore/Applications.coel

Rev

Rev 1733 | Rev 1764 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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