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