| Line 2... |
Line 2... |
| 2 |
|
2 |
|
| 3 |
import java.util.Iterator;
|
3 |
import java.util.Iterator;
|
| Line 4... |
Line 4... |
| 4 |
import java.util.List;
|
4 |
import java.util.List;
|
| 5 |
|
- |
|
| 6 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
5 |
|
| 7 |
import org.tela_botanica.client.modeles.PersonneListe;
|
- |
|
| 8 |
import org.tela_botanica.client.modeles.PersonneAsyncDao;
|
6 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
| 9 |
import org.tela_botanica.client.modeles.ProjetListe;
|
7 |
import org.tela_botanica.client.modeles.PersonneAsyncDao;
|
| 10 |
import org.tela_botanica.client.modeles.ProjetAsyncDao;
|
- |
|
| 11 |
import org.tela_botanica.client.modeles.Publication;
|
8 |
import org.tela_botanica.client.modeles.ProjetAsyncDao;
|
| 12 |
import org.tela_botanica.client.modeles.PublicationListe;
|
9 |
import org.tela_botanica.client.modeles.Publication;
|
| 13 |
import org.tela_botanica.client.modeles.PublicationAsyncDao;
|
10 |
import org.tela_botanica.client.modeles.PublicationAsyncDao;
|
| 14 |
import org.tela_botanica.client.modeles.Structure;
|
11 |
import org.tela_botanica.client.modeles.Structure;
|
| 15 |
import org.tela_botanica.client.modeles.StructureAPersonne;
|
- |
|
| 16 |
import org.tela_botanica.client.modeles.StructureAPersonneAsyncDao;
|
12 |
import org.tela_botanica.client.modeles.StructureAPersonne;
|
| 17 |
import org.tela_botanica.client.modeles.StructureAPersonneListe;
|
13 |
import org.tela_botanica.client.modeles.StructureAPersonneAsyncDao;
|
| 18 |
import org.tela_botanica.client.modeles.StructureAsyncDao;
|
- |
|
| 19 |
import org.tela_botanica.client.modeles.StructureConservation;
|
14 |
import org.tela_botanica.client.modeles.StructureAsyncDao;
|
| 20 |
import org.tela_botanica.client.modeles.StructureListe;
|
15 |
import org.tela_botanica.client.modeles.StructureConservation;
|
| 21 |
import org.tela_botanica.client.modeles.StructureValorisation;
|
16 |
import org.tela_botanica.client.modeles.StructureValorisation;
|
| 22 |
import org.tela_botanica.client.modeles.Utilisateur;
|
- |
|
| 23 |
import org.tela_botanica.client.modeles.UtilisateurAsyncDao;
|
17 |
import org.tela_botanica.client.modeles.Utilisateur;
|
| Line 24... |
Line 18... |
| 24 |
import org.tela_botanica.client.modeles.ValeurListe;
|
18 |
import org.tela_botanica.client.modeles.UtilisateurAsyncDao;
|
| 25 |
import org.tela_botanica.client.modeles.ValeurListeAsyncDao;
|
- |
|
| 26 |
|
- |
|
| Line 27... |
Line 19... |
| 27 |
import com.extjs.gxt.ui.client.Registry;
|
19 |
import org.tela_botanica.client.modeles.ValeurListeAsyncDao;
|
| 28 |
import com.google.gwt.core.client.GWT;
|
20 |
|
| Line 29... |
Line 21... |
| 29 |
import com.google.gwt.user.client.Window;
|
21 |
import com.extjs.gxt.ui.client.Registry;
|
| 30 |
|
22 |
|
| 31 |
// TODO : le transformer en SINGLETON
|
23 |
// TODO : le transformer en SINGLETON
|
| Line 32... |
Line -... |
| 32 |
public class Modele implements Rafraichissable {
|
- |
|
| 33 |
|
- |
|
| 34 |
public Modele() {
|
- |
|
| 35 |
Registry.register(RegistreId.MODELE, this);
|
- |
|
| 36 |
}
|
- |
|
| 37 |
|
- |
|
| 38 |
public void rafraichir(Object nouvelleDonnees) {
|
- |
|
| 39 |
if (nouvelleDonnees instanceof StructureListe) {
|
- |
|
| 40 |
((Mediateur) Registry.get(RegistreId.MEDIATEUR)).afficherListeStructures((StructureListe) nouvelleDonnees);
|
- |
|
| 41 |
} else if (nouvelleDonnees instanceof Utilisateur) {
|
- |
|
| 42 |
((Mediateur) Registry.get(RegistreId.MEDIATEUR)).mettreAJourEtatIdentification((Utilisateur) nouvelleDonnees);
|
- |
|
| 43 |
} else if (nouvelleDonnees instanceof ValeurListe) {
|
- |
|
| 44 |
((Mediateur) Registry.get(RegistreId.MEDIATEUR)).afficherListeValeurs((ValeurListe) nouvelleDonnees);
|
- |
|
| 45 |
} else if (nouvelleDonnees instanceof PublicationListe) {
|
- |
|
| 46 |
((Mediateur) Registry.get(RegistreId.MEDIATEUR)).afficherListePublication((PublicationListe) nouvelleDonnees);
|
- |
|
| 47 |
} else if (nouvelleDonnees instanceof PersonneListe) {
|
- |
|
| 48 |
((Mediateur) Registry.get(RegistreId.MEDIATEUR)).afficherListePersonnes((PersonneListe) nouvelleDonnees);
|
24 |
public class Modele {
|
| 49 |
} else if (nouvelleDonnees instanceof ProjetListe) {
|
25 |
|
| 50 |
((Mediateur) Registry.get(RegistreId.MEDIATEUR)).afficherListeProjets((ProjetListe) nouvelleDonnees);
|
26 |
public Modele() {
|
| Line 51... |
Line 27... |
| 51 |
}
|
27 |
Registry.register(RegistreId.MODELE, this);
|
| 52 |
}
|
28 |
}
|
| 53 |
|
29 |
|
| 54 |
//+----------------------------------------------------------------------------------------------------------------+
|
30 |
//+----------------------------------------------------------------------------------------------------------------+
|
| Line 55... |
Line 31... |
| 55 |
// GESTION DES VALEURS ET LISTES
|
31 |
// GESTION DES VALEURS ET LISTES
|
| 56 |
//+----------------------------------------------------------------------------------------------------------------+
|
32 |
//+----------------------------------------------------------------------------------------------------------------+
|
| 57 |
|
33 |
|
| Line 58... |
Line -... |
| 58 |
public void obtenirListeValeurs(Integer id) {
|
- |
|
| 59 |
ValeurListeAsyncDao lsDao = new ValeurListeAsyncDao(this);
|
- |
|
| 60 |
lsDao.obtenirListe(id);
|
- |
|
| 61 |
}
|
- |
|
| 62 |
|
- |
|
| 63 |
//+----------------------------------------------------------------------------------------------------------------+
|
- |
|
| 64 |
// GESTION DES UTILISATEURS
|
- |
|
| 65 |
//+----------------------------------------------------------------------------------------------------------------+
|
34 |
public void obtenirListeValeurs(Rafraichissable vue, Integer id) {
|
| 66 |
|
35 |
ValeurListeAsyncDao lsDao = new ValeurListeAsyncDao(vue);
|
| 67 |
// pour obtenir la liste de personne et la fournir à des éléments spécifiques
|
36 |
lsDao.obtenirListe(id);
|
| 68 |
public void obtenirListePersonnes(Rafraichissable r) {
|
37 |
}
|
| 69 |
// Lance le service JREST associé au personne via la class PersonneListeAsyncDAO
|
38 |
|
| 70 |
PersonneAsyncDao plDao = new PersonneAsyncDao(r);
|
39 |
//+----------------------------------------------------------------------------------------------------------------+
|
| 71 |
plDao.obtenirListePersonnes();
|
40 |
// GESTION DES UTILISATEURS
|
| Line 72... |
Line 41... |
| 72 |
}
|
41 |
//+----------------------------------------------------------------------------------------------------------------+
|
| 73 |
|
42 |
|
| 74 |
public void connecterUtilisateur(String login, String mdp) {
|
43 |
public void connecterUtilisateur(Rafraichissable vue, String login, String mdp) {
|
| 75 |
Utilisateur utilisateur = (Utilisateur) Registry.get(RegistreId.UTILISATEUR);
|
44 |
Utilisateur utilisateur = (Utilisateur) Registry.get(RegistreId.UTILISATEUR_COURANT);
|
| Line 76... |
Line 45... |
| 76 |
utilisateur.setLogin(login);
|
45 |
utilisateur.setLogin(login);
|
| 77 |
utilisateur.setMotDePasse(mdp);
|
46 |
utilisateur.setMotDePasse(mdp);
|
| 78 |
UtilisateurAsyncDao uDao = new UtilisateurAsyncDao(this);
|
47 |
UtilisateurAsyncDao uDao = new UtilisateurAsyncDao(vue);
|
| Line 79... |
Line 48... |
| 79 |
uDao.connecterUtilisateur();
|
48 |
uDao.connecterUtilisateur();
|
| 80 |
}
|
49 |
}
|
| 81 |
|
50 |
|
| 82 |
public void deconnecterUtilisateur() {
|
51 |
public void deconnecterUtilisateur(Rafraichissable vue) {
|
| Line 83... |
Line 52... |
| 83 |
UtilisateurAsyncDao uDao = new UtilisateurAsyncDao(this);
|
52 |
UtilisateurAsyncDao uDao = new UtilisateurAsyncDao(vue);
|
| 84 |
uDao.deconnecterUtilisateur();
|
53 |
uDao.deconnecterUtilisateur();
|
| 85 |
}
|
54 |
}
|
| 86 |
|
55 |
|
| 87 |
//+----------------------------------------------------------------------------------------------------------------+
|
- |
|
| 88 |
// GESTION DES STRUCTURES
|
- |
|
| 89 |
//+----------------------------------------------------------------------------------------------------------------+
|
- |
|
| 90 |
|
- |
|
| 91 |
public void obtenirListeStructures(Rafraichissable r, String utilisateurId, String projetId) {
|
56 |
//+----------------------------------------------------------------------------------------------------------------+
|
| Line 92... |
Line 57... |
| 92 |
StructureAsyncDao sDao = new StructureAsyncDao();
|
57 |
// GESTION DES STRUCTURES
|
| 93 |
sDao.selectionner(r, utilisateurId, projetId,"");
|
58 |
//+----------------------------------------------------------------------------------------------------------------+
|
| 94 |
}
|
59 |
|
| 95 |
|
60 |
public void obtenirListeStructures(Rafraichissable vue, String projetId) {
|
| 96 |
public void selectionnerStructure(Rafraichissable vue, String utilisateurId, String projetId, String structureId) {
|
61 |
StructureAsyncDao sDao = new StructureAsyncDao();
|
| 97 |
// Gestion des données des tables coel_structure, coel_structure_conservation et coel_structure_valorisation
|
62 |
sDao.selectionner(vue, projetId, "");
|
| 98 |
StructureAsyncDao sDao = new StructureAsyncDao();
|
63 |
}
|
| 99 |
sDao.selectionner(vue, utilisateurId, projetId, structureId);
|
64 |
|
| Line 100... |
Line 65... |
| 100 |
}
|
65 |
public void selectionnerStructure(Rafraichissable vue, String projetId, String structureId) {
|
| 101 |
|
66 |
// Gestion des données des tables coel_structure, coel_structure_conservation et coel_structure_valorisation
|
| 102 |
public void selectionnerStructures(String utilisateurId, String projetId) {
|
67 |
StructureAsyncDao sDao = new StructureAsyncDao();
|
| Line 123... |
Line 88... |
| 123 |
}
|
88 |
}
|
| Line 124... |
Line 89... |
| 124 |
|
89 |
|
| 125 |
//+----------------------------------------------------------------------------------------------------------------+
|
90 |
//+----------------------------------------------------------------------------------------------------------------+
|
| Line 126... |
Line 91... |
| 126 |
// GESTION de la relation STRUCTURE A PERSONNE
|
91 |
// GESTION de la relation STRUCTURE A PERSONNE
|
| 127 |
|
92 |
|
| 128 |
public void selectionnerStructureAPersonne(Rafraichissable r, String idUtilisateur, String projetId, String structureId, String roleId) {
|
93 |
public void selectionnerStructureAPersonne(Rafraichissable vue, String idUtilisateur, String projetId, String structureId, String roleId) {
|
| 129 |
// Gestion des données de la table coel_structure_a_personne
|
94 |
// Gestion des données de la table coel_structure_a_personne
|
| 130 |
if (structureId != null && roleId != null) {
|
95 |
if (structureId != null && roleId != null) {
|
| 131 |
StructureAPersonneAsyncDao sapDao = new StructureAPersonneAsyncDao();
|
96 |
StructureAPersonneAsyncDao sapDao = new StructureAPersonneAsyncDao();
|
| 132 |
sapDao.selectionner(r, idUtilisateur, structureId, roleId);
|
97 |
sapDao.selectionner(vue, idUtilisateur, structureId, roleId);
|
| Line 133... |
Line 98... |
| 133 |
}
|
98 |
}
|
| 134 |
}
|
99 |
}
|
| Line 150... |
Line 115... |
| 150 |
|
115 |
|
| 151 |
//+----------------------------------------------------------------------------------------------------------------+
|
116 |
//+----------------------------------------------------------------------------------------------------------------+
|
| 152 |
// GESTION DES PROJETS
|
117 |
// GESTION DES PROJETS
|
| Line 153... |
Line 118... |
| 153 |
//+----------------------------------------------------------------------------------------------------------------+
|
118 |
//+----------------------------------------------------------------------------------------------------------------+
|
| 154 |
|
119 |
|
| 155 |
public void obtenirListeProjets () {
|
120 |
public void selectionnerProjets(Rafraichissable vue) {
|
| 156 |
ProjetAsyncDao projetsDao = new ProjetAsyncDao(this);
|
- |
|
| 157 |
projetsDao.selectionner();
|
- |
|
| 158 |
|
- |
|
| 159 |
}
|
- |
|
| 160 |
|
- |
|
| 161 |
public void supprimerPersonne(Rafraichissable vue, String utilisateurId,
|
- |
|
| 162 |
String idStr) {
|
- |
|
| 163 |
PersonneAsyncDao personneDao = new PersonneAsyncDao(vue);
|
- |
|
| 164 |
personneDao.supprimer(vue, utilisateurId, idStr);
|
121 |
ProjetAsyncDao projetsDao = new ProjetAsyncDao(vue);
|
| Line 165... |
Line 122... |
| 165 |
|
122 |
projetsDao.selectionner();
|
| 166 |
}
|
123 |
}
|
| 167 |
|
124 |
|
| Line 168... |
Line -... |
| 168 |
//+----------------------------------------------------------------------------------------------------------------+
|
- |
|
| 169 |
// GESTION DES PERSONNES
|
- |
|
| 170 |
//+----------------------------------------------------------------------------------------------------------------+
|
- |
|
| 171 |
|
- |
|
| 172 |
public void obtenirListePersonnes() {
|
- |
|
| 173 |
// Lance le service JREST associé au personne via la class PersonneListeAsyncDAO
|
- |
|
| 174 |
PersonneAsyncDao plDao = new PersonneAsyncDao(this);
|
125 |
//+----------------------------------------------------------------------------------------------------------------+
|
| 175 |
plDao.obtenirListePersonnes();
|
126 |
// GESTION DES PERSONNES
|
| 176 |
}
|
127 |
//+----------------------------------------------------------------------------------------------------------------+
|
| 177 |
|
128 |
|
| - |
|
129 |
public void selectionnerPersonne(Rafraichissable vue, String personneId, String projetId, String nomComplet) {
|
| - |
|
130 |
PersonneAsyncDao pDao = new PersonneAsyncDao(vue);
|
| - |
|
131 |
pDao.selectionner(personneId, projetId, nomComplet);
|
| - |
|
132 |
}
|
| - |
|
133 |
|
| - |
|
134 |
public void supprimerPersonne(Rafraichissable vue, String utilisateurId,
|
| - |
|
135 |
String idStr) {
|
| Line 178... |
Line 136... |
| 178 |
public void selectionnerPersonne(Rafraichissable vue, String personneId, String projetId, String nomComplet) {
|
136 |
PersonneAsyncDao personneDao = new PersonneAsyncDao(vue);
|
| 179 |
PersonneAsyncDao pDao = new PersonneAsyncDao(vue);
|
137 |
personneDao.supprimer(vue, utilisateurId, idStr);
|
| 180 |
pDao.selectionner(personneId, projetId, nomComplet);
|
138 |
|
| Line 181... |
Line 139... |
| 181 |
}
|
139 |
}
|
| 182 |
|
140 |
|
| 183 |
//+----------------------------------------------------------------------------------------------------------------+
|
141 |
//+----------------------------------------------------------------------------------------------------------------+
|
| 184 |
// GESTION DES PUBLICATIONS
|
142 |
// GESTION DES PUBLICATIONS
|
| Line 185... |
Line 143... |
| 185 |
//+----------------------------------------------------------------------------------------------------------------+
|
143 |
//+----------------------------------------------------------------------------------------------------------------+
|
| 186 |
|
144 |
|
| 187 |
public void obtenirListePublications() {
|
145 |
public void selectionnerPublications(Rafraichissable vue) {
|
| 188 |
PublicationAsyncDao lsDao = new PublicationAsyncDao(this);
|
146 |
PublicationAsyncDao lsDao = new PublicationAsyncDao(vue);
|
| Line 189... |
Line 147... |
| 189 |
lsDao.obtenirListePublication();
|
147 |
lsDao.obtenirListePublication();
|
| 190 |
}
|
148 |
}
|
| 191 |
|
149 |
|
| 192 |
public void modifierPublication(String utilisateurId, Publication publi) {
|
150 |
public void modifierPublication(Rafraichissable vue, String utilisateurId, Publication publi) {
|
| Line 193... |
Line 151... |
| 193 |
PublicationAsyncDao pDao = new PublicationAsyncDao(this);
|
151 |
PublicationAsyncDao pDao = new PublicationAsyncDao(vue);
|
| 194 |
pDao.modifierPublication(this, utilisateurId, publi);
|
- |
|
| 195 |
}
|
152 |
pDao.modifierPublication(utilisateurId, publi);
|
| 196 |
|
153 |
}
|
| 197 |
public void ajouterPublication(String utilisateurId, Publication publi) {
|
154 |
|
| 198 |
PublicationAsyncDao pDao = new PublicationAsyncDao(this);
|
155 |
public void ajouterPublication(Rafraichissable vue, String utilisateurId, Publication publi) {
|
| 199 |
pDao.ajouterPublication(this, utilisateurId, publi);
|
156 |
PublicationAsyncDao pDao = new PublicationAsyncDao(vue);
|
| 200 |
}
|
157 |
pDao.ajouterPublication(utilisateurId, publi);
|
| 201 |
|
158 |
}
|
| 202 |
public void supprimerPublication(String utilisateurId,
|
159 |
|
| 203 |
List<Publication> publicationListe) {
|
160 |
public void supprimerPublication(Rafraichissable vue, String utilisateurId, List<Publication> publicationListe) {
|
| 204 |
String idPubs = "";
|
161 |
String idPubs = "";
|
| 205 |
for(Iterator<Publication> it = publicationListe.iterator(); it.hasNext();) {
|
162 |
for(Iterator<Publication> it = publicationListe.iterator(); it.hasNext();) {
|
| Line 206... |
Line 163... |
| 206 |
Publication pub = it.next();
|
163 |
Publication pub = it.next();
|
| 207 |
idPubs += pub.getId();
|
164 |
idPubs += pub.getId();
|