60 |
jpm |
1 |
package org.tela_botanica.client;
|
|
|
2 |
|
237 |
aurelien |
3 |
import java.util.Iterator;
|
|
|
4 |
import java.util.List;
|
|
|
5 |
|
60 |
jpm |
6 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
453 |
jp_milcent |
7 |
import org.tela_botanica.client.modeles.Collection;
|
875 |
jpm |
8 |
import org.tela_botanica.client.modeles.CollectionAPersonne;
|
|
|
9 |
import org.tela_botanica.client.modeles.CollectionAPersonneAsyncDao;
|
883 |
jpm |
10 |
import org.tela_botanica.client.modeles.CollectionAPublication;
|
|
|
11 |
import org.tela_botanica.client.modeles.CollectionAPublicationAsyncDao;
|
468 |
jp_milcent |
12 |
import org.tela_botanica.client.modeles.CollectionAsyncDao;
|
388 |
gduche |
13 |
import org.tela_botanica.client.modeles.Personne;
|
268 |
jp_milcent |
14 |
import org.tela_botanica.client.modeles.PersonneAsyncDao;
|
892 |
aurelien |
15 |
import org.tela_botanica.client.modeles.Projet;
|
268 |
jp_milcent |
16 |
import org.tela_botanica.client.modeles.ProjetAsyncDao;
|
228 |
aurelien |
17 |
import org.tela_botanica.client.modeles.Publication;
|
741 |
aurelien |
18 |
import org.tela_botanica.client.modeles.PublicationAPersonneAsyncDao;
|
268 |
jp_milcent |
19 |
import org.tela_botanica.client.modeles.PublicationAsyncDao;
|
119 |
jpm |
20 |
import org.tela_botanica.client.modeles.Structure;
|
231 |
jp_milcent |
21 |
import org.tela_botanica.client.modeles.StructureAPersonne;
|
209 |
jp_milcent |
22 |
import org.tela_botanica.client.modeles.StructureAPersonneAsyncDao;
|
119 |
jpm |
23 |
import org.tela_botanica.client.modeles.StructureAsyncDao;
|
188 |
jp_milcent |
24 |
import org.tela_botanica.client.modeles.StructureConservation;
|
195 |
jp_milcent |
25 |
import org.tela_botanica.client.modeles.StructureValorisation;
|
64 |
jpm |
26 |
import org.tela_botanica.client.modeles.Utilisateur;
|
69 |
jpm |
27 |
import org.tela_botanica.client.modeles.UtilisateurAsyncDao;
|
91 |
jpm |
28 |
import org.tela_botanica.client.modeles.ValeurListeAsyncDao;
|
60 |
jpm |
29 |
|
|
|
30 |
import com.extjs.gxt.ui.client.Registry;
|
673 |
aurelien |
31 |
import com.google.gwt.core.client.GWT;
|
|
|
32 |
import com.google.gwt.user.client.Window;
|
60 |
jpm |
33 |
|
|
|
34 |
// TODO : le transformer en SINGLETON
|
277 |
jp_milcent |
35 |
public class Modele {
|
60 |
jpm |
36 |
|
|
|
37 |
public Modele() {
|
|
|
38 |
Registry.register(RegistreId.MODELE, this);
|
|
|
39 |
}
|
|
|
40 |
|
231 |
jp_milcent |
41 |
//+----------------------------------------------------------------------------------------------------------------+
|
|
|
42 |
// GESTION DES VALEURS ET LISTES
|
|
|
43 |
//+----------------------------------------------------------------------------------------------------------------+
|
|
|
44 |
|
277 |
jp_milcent |
45 |
public void obtenirListeValeurs(Rafraichissable vue, Integer id) {
|
|
|
46 |
ValeurListeAsyncDao lsDao = new ValeurListeAsyncDao(vue);
|
91 |
jpm |
47 |
lsDao.obtenirListe(id);
|
|
|
48 |
}
|
|
|
49 |
|
289 |
gduche |
50 |
|
297 |
gduche |
51 |
public void obtenirListeRegion(Rafraichissable vue, Integer id, String region) {
|
|
|
52 |
ValeurListeAsyncDao lsDao = new ValeurListeAsyncDao(vue);
|
302 |
gduche |
53 |
lsDao.selectionner("abv", id, null, region);
|
297 |
gduche |
54 |
}
|
|
|
55 |
|
302 |
gduche |
56 |
public void obtenirValeur(Rafraichissable vue, String type, Integer id, String identifiant) {
|
297 |
gduche |
57 |
ValeurListeAsyncDao lsDao = new ValeurListeAsyncDao(vue);
|
302 |
gduche |
58 |
lsDao.selectionner(type, id, null, identifiant);
|
289 |
gduche |
59 |
}
|
|
|
60 |
|
231 |
jp_milcent |
61 |
//+----------------------------------------------------------------------------------------------------------------+
|
|
|
62 |
// GESTION DES UTILISATEURS
|
|
|
63 |
//+----------------------------------------------------------------------------------------------------------------+
|
237 |
aurelien |
64 |
|
277 |
jp_milcent |
65 |
public void connecterUtilisateur(Rafraichissable vue, String login, String mdp) {
|
|
|
66 |
Utilisateur utilisateur = (Utilisateur) Registry.get(RegistreId.UTILISATEUR_COURANT);
|
65 |
jpm |
67 |
utilisateur.setLogin(login);
|
|
|
68 |
utilisateur.setMotDePasse(mdp);
|
277 |
jp_milcent |
69 |
UtilisateurAsyncDao uDao = new UtilisateurAsyncDao(vue);
|
65 |
jpm |
70 |
uDao.connecterUtilisateur();
|
64 |
jpm |
71 |
}
|
|
|
72 |
|
277 |
jp_milcent |
73 |
public void deconnecterUtilisateur(Rafraichissable vue) {
|
|
|
74 |
UtilisateurAsyncDao uDao = new UtilisateurAsyncDao(vue);
|
65 |
jpm |
75 |
uDao.deconnecterUtilisateur();
|
64 |
jpm |
76 |
}
|
453 |
jp_milcent |
77 |
|
|
|
78 |
//+----------------------------------------------------------------------------------------------------------------+
|
|
|
79 |
// GESTION DES PROJETS
|
|
|
80 |
//+----------------------------------------------------------------------------------------------------------------+
|
231 |
jp_milcent |
81 |
|
552 |
jp_milcent |
82 |
public void selectionnerProjets(Rafraichissable vueARafraichir) {
|
|
|
83 |
ProjetAsyncDao projetsDao = new ProjetAsyncDao(vueARafraichir);
|
453 |
jp_milcent |
84 |
projetsDao.selectionner();
|
|
|
85 |
}
|
|
|
86 |
|
231 |
jp_milcent |
87 |
//+----------------------------------------------------------------------------------------------------------------+
|
|
|
88 |
// GESTION DES STRUCTURES
|
|
|
89 |
//+----------------------------------------------------------------------------------------------------------------+
|
64 |
jpm |
90 |
|
468 |
jp_milcent |
91 |
public void selectionnerStructure(Rafraichissable vueARafraichir, String projetId, String structureId) {
|
209 |
jp_milcent |
92 |
// Gestion des données des tables coel_structure, coel_structure_conservation et coel_structure_valorisation
|
769 |
jpm |
93 |
StructureAsyncDao sDao = new StructureAsyncDao(vueARafraichir);
|
|
|
94 |
sDao.selectionner(projetId, structureId);
|
156 |
jp_milcent |
95 |
}
|
|
|
96 |
|
119 |
jpm |
97 |
/** Lance la creation d'une Structure
|
468 |
jp_milcent |
98 |
* @param vueARafraichir la vue demandant a être rafraichie
|
119 |
jpm |
99 |
* @param structure les données de la structure
|
|
|
100 |
*/
|
769 |
jpm |
101 |
public void ajouterStructure(Rafraichissable vueARafraichir, Structure structure, StructureConservation conservation, StructureValorisation valorisation) {
|
|
|
102 |
StructureAsyncDao structureDao = new StructureAsyncDao(vueARafraichir);
|
|
|
103 |
structureDao.ajouter(structure, conservation, valorisation);
|
119 |
jpm |
104 |
}
|
135 |
jpm |
105 |
|
769 |
jpm |
106 |
public void supprimerStructure(Rafraichissable vueARafraichir, String idStr) {
|
|
|
107 |
StructureAsyncDao structureDao = new StructureAsyncDao(vueARafraichir);
|
|
|
108 |
structureDao.supprimer(idStr);
|
135 |
jpm |
109 |
}
|
119 |
jpm |
110 |
|
769 |
jpm |
111 |
public void modifierStructure(Rafraichissable vueARafraichir, String structureId, Structure structure, StructureConservation conservation, StructureValorisation valorisation) {
|
|
|
112 |
StructureAsyncDao structureDao = new StructureAsyncDao(vueARafraichir);
|
|
|
113 |
structureDao.modifier(structureId, structure, conservation, valorisation);
|
156 |
jp_milcent |
114 |
}
|
231 |
jp_milcent |
115 |
|
265 |
jp_milcent |
116 |
//+----------------------------------------------------------------------------------------------------------------+
|
|
|
117 |
// GESTION de la relation STRUCTURE A PERSONNE
|
|
|
118 |
|
767 |
jpm |
119 |
public void selectionnerStructureAPersonne(Rafraichissable vueARafraichir, String structureId, String roleId) {
|
265 |
jp_milcent |
120 |
// Gestion des données de la table coel_structure_a_personne
|
|
|
121 |
if (structureId != null && roleId != null) {
|
761 |
jpm |
122 |
StructureAPersonneAsyncDao sapDao = new StructureAPersonneAsyncDao(vueARafraichir);
|
|
|
123 |
sapDao.selectionner(structureId, roleId);
|
265 |
jp_milcent |
124 |
}
|
|
|
125 |
}
|
|
|
126 |
|
767 |
jpm |
127 |
public void modifierStructureAPersonne(Rafraichissable vueARafraichir, StructureAPersonne personnel) {
|
761 |
jpm |
128 |
StructureAPersonneAsyncDao structureAPersonneDao = new StructureAPersonneAsyncDao(vueARafraichir);
|
767 |
jpm |
129 |
structureAPersonneDao.modifier(personnel);
|
231 |
jp_milcent |
130 |
}
|
156 |
jp_milcent |
131 |
|
767 |
jpm |
132 |
public void ajouterStructureAPersonne(Rafraichissable vueARafraichir, String structureId, StructureAPersonne personnel) {
|
761 |
jpm |
133 |
StructureAPersonneAsyncDao structureAPersonneDao = new StructureAPersonneAsyncDao(vueARafraichir);
|
767 |
jpm |
134 |
structureAPersonneDao.ajouter(structureId, personnel);
|
231 |
jp_milcent |
135 |
}
|
|
|
136 |
|
767 |
jpm |
137 |
public void supprimerStructureAPersonne(Rafraichissable vueARafraichir, String personnelId) {
|
761 |
jpm |
138 |
StructureAPersonneAsyncDao structureAPersonneDao = new StructureAPersonneAsyncDao(vueARafraichir);
|
767 |
jpm |
139 |
structureAPersonneDao.supprimer(personnelId);
|
231 |
jp_milcent |
140 |
}
|
453 |
jp_milcent |
141 |
|
231 |
jp_milcent |
142 |
//+----------------------------------------------------------------------------------------------------------------+
|
453 |
jp_milcent |
143 |
// GESTION DES COLLECTIONS
|
231 |
jp_milcent |
144 |
//+----------------------------------------------------------------------------------------------------------------+
|
|
|
145 |
|
453 |
jp_milcent |
146 |
public void selectionnerCollection(Rafraichissable vueARafraichir, String projetId, String collectionId) {
|
872 |
jpm |
147 |
CollectionAsyncDao cDao = new CollectionAsyncDao(vueARafraichir);
|
|
|
148 |
cDao.selectionner(projetId, collectionId);
|
143 |
gduche |
149 |
}
|
453 |
jp_milcent |
150 |
|
751 |
jpm |
151 |
public void ajouterCollection(Rafraichissable vueARafraichir, String utilisateurId, Collection collection) {
|
453 |
jp_milcent |
152 |
// TODO Auto-generated method stub
|
|
|
153 |
|
|
|
154 |
}
|
224 |
aurelien |
155 |
|
872 |
jpm |
156 |
public void modifierCollection(Rafraichissable vueARafraichir, Collection collection) {
|
|
|
157 |
CollectionAsyncDao cDao = new CollectionAsyncDao(vueARafraichir);
|
|
|
158 |
cDao.modifier(collection);
|
453 |
jp_milcent |
159 |
}
|
|
|
160 |
|
751 |
jpm |
161 |
public void supprimerCollection(Rafraichissable vueARafraichir, String utilisateurId, String identifiantsCollectionSepareParVirgule) {
|
453 |
jp_milcent |
162 |
// TODO Auto-generated method stub
|
|
|
163 |
|
|
|
164 |
}
|
|
|
165 |
|
231 |
jp_milcent |
166 |
//+----------------------------------------------------------------------------------------------------------------+
|
875 |
jpm |
167 |
// GESTION de la relation COLLECTION A PERSONNE
|
|
|
168 |
|
|
|
169 |
public void selectionnerCollectionAPersonne(Rafraichissable vueARafraichir, String collectionId, String roleId) {
|
883 |
jpm |
170 |
CollectionAPersonneAsyncDao sapDao = new CollectionAPersonneAsyncDao(vueARafraichir);
|
|
|
171 |
sapDao.selectionner(collectionId, roleId);
|
875 |
jpm |
172 |
}
|
|
|
173 |
|
|
|
174 |
public void modifierCollectionAPersonne(Rafraichissable vueARafraichir, CollectionAPersonne collectionAPersonne) {
|
|
|
175 |
CollectionAPersonneAsyncDao collectionAPersonneDao = new CollectionAPersonneAsyncDao(vueARafraichir);
|
|
|
176 |
collectionAPersonneDao.modifier(collectionAPersonne);
|
|
|
177 |
}
|
|
|
178 |
|
|
|
179 |
public void ajouterCollectionAPersonne(Rafraichissable vueARafraichir, String collectionId, CollectionAPersonne collectionAPersonne) {
|
|
|
180 |
CollectionAPersonneAsyncDao collectionAPersonneDao = new CollectionAPersonneAsyncDao(vueARafraichir);
|
|
|
181 |
collectionAPersonneDao.ajouter(collectionId, collectionAPersonne);
|
|
|
182 |
}
|
|
|
183 |
|
|
|
184 |
public void supprimerCollectionAPersonne(Rafraichissable vueARafraichir, String collectionAPersonneId) {
|
|
|
185 |
CollectionAPersonneAsyncDao collectionAPersonneDao = new CollectionAPersonneAsyncDao(vueARafraichir);
|
|
|
186 |
collectionAPersonneDao.supprimer(collectionAPersonneId);
|
|
|
187 |
}
|
|
|
188 |
|
|
|
189 |
//+----------------------------------------------------------------------------------------------------------------+
|
883 |
jpm |
190 |
// GESTION de la relation COLLECTION A PUBLICATION
|
|
|
191 |
|
|
|
192 |
public void selectionnerCollectionAPublication(Rafraichissable vueARafraichir, String collectionId) {
|
|
|
193 |
CollectionAPublicationAsyncDao capDao = new CollectionAPublicationAsyncDao(vueARafraichir);
|
|
|
194 |
capDao.selectionner(collectionId);
|
|
|
195 |
}
|
|
|
196 |
|
|
|
197 |
public void modifierCollectionAPublication(Rafraichissable vueARafraichir, CollectionAPublication collectionAPublication) {
|
|
|
198 |
CollectionAPublicationAsyncDao collectionAPublicationDao = new CollectionAPublicationAsyncDao(vueARafraichir);
|
|
|
199 |
collectionAPublicationDao.modifier(collectionAPublication);
|
|
|
200 |
}
|
|
|
201 |
|
|
|
202 |
public void ajouterCollectionAPublication(Rafraichissable vueARafraichir, String collectionId, CollectionAPublication collectionAPublication) {
|
|
|
203 |
CollectionAPublicationAsyncDao collectionAPublicationDao = new CollectionAPublicationAsyncDao(vueARafraichir);
|
|
|
204 |
collectionAPublicationDao.ajouter(collectionId, collectionAPublication);
|
|
|
205 |
}
|
|
|
206 |
|
|
|
207 |
public void supprimerCollectionAPublication(Rafraichissable vueARafraichir, String collectionAPublicationId) {
|
|
|
208 |
CollectionAPublicationAsyncDao collectionAPublicationDao = new CollectionAPublicationAsyncDao(vueARafraichir);
|
|
|
209 |
collectionAPublicationDao.supprimer(collectionAPublicationId);
|
|
|
210 |
}
|
|
|
211 |
|
|
|
212 |
//+----------------------------------------------------------------------------------------------------------------+
|
231 |
jp_milcent |
213 |
// GESTION DES PERSONNES
|
|
|
214 |
//+----------------------------------------------------------------------------------------------------------------+
|
|
|
215 |
|
598 |
gduche |
216 |
public void selectionnerPersonne(Rafraichissable vueARafraichir, String personneId, String projetId, String nomComplet, int start, int nbElements) {
|
468 |
jp_milcent |
217 |
PersonneAsyncDao pDao = new PersonneAsyncDao(vueARafraichir);
|
598 |
gduche |
218 |
pDao.selectionner(personneId, projetId, nomComplet, start, nbElements);
|
244 |
jp_milcent |
219 |
}
|
277 |
jp_milcent |
220 |
|
772 |
jpm |
221 |
public void supprimerPersonne(Rafraichissable vueARafraichir, String idPersonneSepareParVirgule) {
|
468 |
jp_milcent |
222 |
PersonneAsyncDao personneDao = new PersonneAsyncDao(vueARafraichir);
|
772 |
jpm |
223 |
personneDao.supprimer(idPersonneSepareParVirgule);
|
277 |
jp_milcent |
224 |
|
|
|
225 |
}
|
244 |
jp_milcent |
226 |
|
430 |
gduche |
227 |
public void ajouterPersonne(Rafraichissable vue, Personne personne) {
|
388 |
gduche |
228 |
PersonneAsyncDao personneDao = new PersonneAsyncDao(vue);
|
748 |
jpm |
229 |
personneDao.ajouter(personne);
|
388 |
gduche |
230 |
}
|
430 |
gduche |
231 |
|
468 |
jp_milcent |
232 |
public void modifierPersonne(Rafraichissable vueARafraichir, Personne personne) {
|
|
|
233 |
PersonneAsyncDao personneDao = new PersonneAsyncDao(vueARafraichir);
|
748 |
jpm |
234 |
personneDao.modifier(personne);
|
430 |
gduche |
235 |
}
|
453 |
jp_milcent |
236 |
|
231 |
jp_milcent |
237 |
//+----------------------------------------------------------------------------------------------------------------+
|
|
|
238 |
// GESTION DES PUBLICATIONS
|
|
|
239 |
//+----------------------------------------------------------------------------------------------------------------+
|
|
|
240 |
|
709 |
jp_milcent |
241 |
public void selectionnerPublication(Rafraichissable vueARafraichir, String publicationId, String projetId, String nomComplet) {
|
468 |
jp_milcent |
242 |
PublicationAsyncDao lsDao = new PublicationAsyncDao(vueARafraichir);
|
751 |
jpm |
243 |
lsDao.selectionner(publicationId, projetId, nomComplet);
|
231 |
jp_milcent |
244 |
}
|
|
|
245 |
|
764 |
jpm |
246 |
public void modifierPublication(Rafraichissable vueRafraichir, Publication publication) {
|
468 |
jp_milcent |
247 |
PublicationAsyncDao pDao = new PublicationAsyncDao(vueRafraichir);
|
764 |
jpm |
248 |
pDao.modifier(publication);
|
228 |
aurelien |
249 |
}
|
|
|
250 |
|
764 |
jpm |
251 |
public void ajouterPublication(Rafraichissable vueARafraichir, Publication publication) {
|
468 |
jp_milcent |
252 |
PublicationAsyncDao pDao = new PublicationAsyncDao(vueARafraichir);
|
764 |
jpm |
253 |
pDao.ajouter(publication);
|
228 |
aurelien |
254 |
}
|
231 |
jp_milcent |
255 |
|
764 |
jpm |
256 |
public void supprimerPublication(Rafraichissable vueARafraichir, List<Publication> publicationListe) {
|
|
|
257 |
String publicationsId = "";
|
237 |
aurelien |
258 |
for(Iterator<Publication> it = publicationListe.iterator(); it.hasNext();) {
|
|
|
259 |
Publication pub = it.next();
|
764 |
jpm |
260 |
publicationsId += pub.getId();
|
237 |
aurelien |
261 |
if(it.hasNext()) {
|
764 |
jpm |
262 |
publicationsId += ",";
|
237 |
aurelien |
263 |
}
|
|
|
264 |
}
|
468 |
jp_milcent |
265 |
PublicationAsyncDao pDao = new PublicationAsyncDao(vueARafraichir);
|
764 |
jpm |
266 |
pDao.supprimer(publicationsId);
|
237 |
aurelien |
267 |
}
|
244 |
jp_milcent |
268 |
|
822 |
jpm |
269 |
//+----------------------------------------------------------------------------------------------------------------+
|
|
|
270 |
// GESTION de la relation PUBLICATION A PERSONNE
|
|
|
271 |
|
|
|
272 |
public void selectionPublicationAPersonne(Rafraichissable vueARafraichir, String publicationId, String personnesId, String roleId) {
|
741 |
aurelien |
273 |
PublicationAPersonneAsyncDao paDao = new PublicationAPersonneAsyncDao(vueARafraichir);
|
822 |
jpm |
274 |
paDao.selectionner(publicationId, personnesId, roleId);
|
741 |
aurelien |
275 |
}
|
822 |
jpm |
276 |
|
|
|
277 |
public void ajouterAuteurPublication(Rafraichissable vueARafraichir, String publicationId, String personnesId, String roleId) {
|
741 |
aurelien |
278 |
PublicationAPersonneAsyncDao paDao = new PublicationAPersonneAsyncDao(vueARafraichir);
|
822 |
jpm |
279 |
paDao.ajouter(publicationId, personnesId, roleId);
|
741 |
aurelien |
280 |
}
|
|
|
281 |
|
822 |
jpm |
282 |
public void modifierAuteurPublication(Rafraichissable vueARafraichir, String publicationId, String personnesId, String roleId) {
|
750 |
aurelien |
283 |
PublicationAPersonneAsyncDao paDao = new PublicationAPersonneAsyncDao(vueARafraichir);
|
822 |
jpm |
284 |
paDao.modifier(publicationId, personnesId, roleId);
|
750 |
aurelien |
285 |
}
|
|
|
286 |
|
877 |
aurelien |
287 |
public void selectionnerProjet(Rafraichissable vueARafraichir,
|
|
|
288 |
String projetId) {
|
880 |
aurelien |
289 |
ProjetAsyncDao pADAO = new ProjetAsyncDao(vueARafraichir);
|
|
|
290 |
pADAO.selectionnerProjet(projetId);
|
877 |
aurelien |
291 |
}
|
|
|
292 |
|
892 |
aurelien |
293 |
public void ajouterProjet(Rafraichissable vueARafraichir,
|
|
|
294 |
Projet projetCollecte) {
|
|
|
295 |
ProjetAsyncDao pADAO = new ProjetAsyncDao(vueARafraichir);
|
|
|
296 |
pADAO.ajouter(projetCollecte);
|
|
|
297 |
|
|
|
298 |
}
|
|
|
299 |
|
|
|
300 |
public void modifierProjet(Rafraichissable vueARafraichir,
|
|
|
301 |
Projet projetCollecte) {
|
|
|
302 |
ProjetAsyncDao pADAO = new ProjetAsyncDao(vueARafraichir);
|
|
|
303 |
pADAO.modifier(projetCollecte);
|
|
|
304 |
}
|
|
|
305 |
|
60 |
jpm |
306 |
}
|