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