Nantes Université

Skip to content
Extraits de code Groupes Projets
Valider a8aaeed5 rédigé par Julien DURILLON's avatar Julien DURILLON
Parcourir les fichiers

Merge branch 'master' of git@github.com:sunye/AlmaGTD

parents fda5e228 df9dfcc7
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Affichage de
avec 1141 ajouts et 366 suppressions
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>fr.alma</groupId>
<artifactId>AlmaGTD</artifactId>
<version>1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>fr.alma</groupId>
......@@ -35,10 +28,55 @@
</build>
<dependencies>
<dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-annotations</artifactId>
<version>3.4.0.GA</version>
<artifactId>hibernate</artifactId>
<version>3.1.3</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>jta</groupId>
<artifactId>jta</artifactId>
<version>1.0.1b</version>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib-full</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>ehcache</groupId>
<artifactId>ehcache</artifactId>
<version>0.9</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.2.132</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-hibernate2</artifactId>
<version>2.0.8</version>
</dependency>
<dependency>
<groupId>jtds</groupId>
<artifactId>jtds</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>odmg</groupId>
<artifactId>odmg</artifactId>
<version>3.0</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-collections</artifactId>
<version>1.0.4</version>
</dependency>
</dependencies>
......
......@@ -3,6 +3,11 @@ package fr.univnantes.alma.gtd.controler.connexion;
import fr.univnantes.alma.gtd.model.gestionnaireutilisateur.GestionnaireUtilisateurs;
import fr.univnantes.alma.gtd.model.gestionnaireutilisateur.Utilisateur;
/**
*
* Class de controle de connexion utilisateur
*
*/
public class ControlerConnexion implements IControlerConnexion {
private GestionnaireUtilisateurs gu;
......@@ -10,7 +15,12 @@ public class ControlerConnexion implements IControlerConnexion {
@Override
/**
* Tentative de connexion de l'utilisateur
* @param log login utilisateur
* @param pwd mot de passe utilisateur
* @return true si connexion reussie
*/
public Boolean connect(String log, String pwd) {
gu = GestionnaireUtilisateurs.getGestionnaireUtilisateur();
Utilisateur util = gu.find(log);
......@@ -24,14 +34,21 @@ public class ControlerConnexion implements IControlerConnexion {
}
}
@Override
/**
* Deconnexion utilisateur
* @return true
*/
public Boolean disconnect() {
utilisateurConnecte = null;
return true;
}
@Override
/**
* Verifier si un utilisateur est connecte
* @return true si utilisateur connecte
*/
public Boolean verifyConnection() {
return (utilisateurConnecte != null);
}
......
......@@ -2,8 +2,24 @@ package fr.univnantes.alma.gtd.controler.connexion;
public interface IControlerConnexion {
/**
* se connecter
* @param log
* @param pwd
* @return
*/
public Boolean connect(String log, String pwd);
/**
* verifie la connexion de l'utilisateur
* @return Boolean
*/
public Boolean verifyConnection();
/**
* se deconnecter
* @return Boolean
*/
public Boolean disconnect();
......
package fr.univnantes.alma.gtd.controler.ressources;
import java.util.ArrayList;
import java.util.Vector;
import fr.univnantes.alma.gtd.controler.connexion.ControlerConnexion;
......@@ -12,6 +11,7 @@ import fr.univnantes.alma.gtd.model.gestionnaireressources.GestionnaireRessource
import fr.univnantes.alma.gtd.model.gestionnaireressources.Idee;
import fr.univnantes.alma.gtd.model.gestionnaireressources.Projet;
import fr.univnantes.alma.gtd.model.gestionnaireressources.Tache;
import fr.univnantes.alma.gtd.model.gestionnaireressources.TacheExtendInfo;
......@@ -25,38 +25,38 @@ public class ControlerRessources implements IControlerRessources {
super();
}
@Override
public Boolean addBasket(String nom, String element) {
Idee idee = new Idee(nom, element);
return (gestRes.add(idee) >= 0);
}
@Override
public Boolean addContactToProject(Projet p, String text) {
Projet projetSauv = gestRes.getProjet(p.getId());
projetSauv.addContact(new Contact(text));
return true;
}
@Override
public Boolean addContexte(String nom) {
Contexte contexte = new Contexte(nom);
return (gestRes.add(contexte) >= 0);
}
@Override
public Boolean addNoteToProject(Projet p, String note) {
Projet projetSauv = gestRes.getProjet(p.getId());
projetSauv.addNote(note);
return true;
}
@Override
public void addProjet(Projet p) {
gestRes.add(p);
}
@Override
public Boolean addProjet(String nomProjet, String contexte,
Projet projetParent) {
Vector<Contexte> temp = this.getListeContexte();
......@@ -82,11 +82,10 @@ public class ControlerRessources implements IControlerRessources {
return true;
}
@Override
public Boolean addTache(String nom, Integer priorite, Integer effort,
EtatTache etat, Date reveil, Date echeance, Projet projet) {
public Boolean addTache(TacheExtendInfo info, EtatTache etat, Date reveil, Date echeance, Projet projet) {
Tache tache = new Tache(nom,priorite,effort,reveil,echeance,new ArrayList<String>(),new ArrayList<String>());
Tache tache = new Tache(info,reveil,echeance);
if (etat.getId() != null) {
tache.setEtatTache(etat);
projet.addTache(tache);
......@@ -95,7 +94,7 @@ public class ControlerRessources implements IControlerRessources {
return false;
}
@Override
public Tache agir(Vector<Tache> listeTaches) {
Tache temp = null;
int prior = 0;
......@@ -107,91 +106,91 @@ public class ControlerRessources implements IControlerRessources {
return temp;
}
@Override
public Boolean addProject(String name) {
Projet projet = new Projet(name);
gestRes.add(projet);
return true;
}
@Override
public Integer deleteBasket(Idee e) {
gestRes.remove(e);
return null;
}
@Override
public Boolean deleteContactFromProject(Projet p, Contact c) {
Projet projetSauv = gestRes.getProjet(p.getId());
projetSauv.remove(c);
return true;
}
@Override
public Integer deleteContexte(Contexte c) {
gestRes.remove(c);
return null;
}
@Override
public Boolean deleteNoteFromProject(Projet p, String note) {
Projet projetSauv = gestRes.getProjet(p.getId());
projetSauv.removeNote(note);
return true;
}
@Override
public void deleteProject(Projet p) {
gestRes.remove(p);
}
@Override
public Boolean deleteTache(Tache t) {
gestRes.remove(t);
return true;
}
@Override
public Vector<Idee> getElements() {
Vector<Idee> res = new Vector<Idee>();
res.addAll(gestRes.getIdees());
return res;
}
@Override
public Vector<Contact> getContacts() {
Vector<Contact> res = new Vector<Contact>();
res.addAll(gestRes.getContacts());
return res;
}
@Override
public void deleteContact(Contact c) {
gestRes.remove(c);
}
@Override
public Vector<Contexte> getListeContexte() {
Vector<Contexte> res = new Vector<Contexte>();
res.addAll(gestRes.getContextes());
return res;
}
@Override
public Vector<Projet> getListeProjet() {
Vector<Projet> res = new Vector<Projet>();
res.addAll(gestRes.getProjets());
return res;
}
@Override
public Vector<Tache> getListeTache(Contexte c) {
Vector<Tache> res = new Vector<Tache>();
res.addAll(gestRes.getTaches());
return res;
}
@Override
public Vector<Projet> getProjectSubProject(Projet p) {
Projet projetSauv = gestRes.getProjet(p.getId());
Vector<Projet> res = new Vector<Projet>();
......@@ -199,7 +198,7 @@ public class ControlerRessources implements IControlerRessources {
return res;
}
@Override
public Vector<Tache> getProjectTasks(Projet p) {
Projet projetSauv = gestRes.getProjet(p.getId());
Vector<Tache> res = new Vector<Tache>();
......@@ -207,31 +206,31 @@ public class ControlerRessources implements IControlerRessources {
return res;
}
@Override
public Object[] getProjetContacts(Projet p) {
Projet projetSauv = gestRes.getProjet(p.getId());
return projetSauv.getContacts().toArray();
}
@Override
public Object[] getProjetNotes(Projet p) {
Projet projetSauv = gestRes.getProjet(p.getId());
return projetSauv.getNotes().toArray();
}
@Override
public Tache getProjetUrgentTask(Projet p) {
Projet projetSauv = gestRes.getProjet(p.getId());
return projetSauv.getUrgentTask();
}
@Override
public Projet getTaskProjet(Tache t) {
Tache tacheSauv = gestRes.getTache(t.getId());
return tacheSauv.getParent();
}
@Override
public Boolean setProjectContext(Projet p, String contexte) {
Vector<Contexte> temp = this.getListeContexte();
Contexte tempc = null;
......@@ -253,7 +252,7 @@ public class ControlerRessources implements IControlerRessources {
return true;
}
@Override
public Boolean setProjetName(Projet p, String nom) {
Projet projetSauv = gestRes.getProjet(p.getId());
gestRes.remove(projetSauv);
......@@ -261,7 +260,7 @@ public class ControlerRessources implements IControlerRessources {
gestRes.add(projetSauv);
return null;
}
@Override
public Integer updateBasket(Idee e, String contenu) {
String titre = e.getNom();
gestRes.remove(e);
......
......@@ -9,38 +9,223 @@ import fr.univnantes.alma.gtd.model.gestionnaireressources.EtatTache;
import fr.univnantes.alma.gtd.model.gestionnaireressources.Idee;
import fr.univnantes.alma.gtd.model.gestionnaireressources.Projet;
import fr.univnantes.alma.gtd.model.gestionnaireressources.Tache;
import fr.univnantes.alma.gtd.model.gestionnaireressources.TacheExtendInfo;
public interface IControlerRessources {
/**
*
* @param c
* @return
*/
public Integer deleteContexte(Contexte c);
/**
*
* @param listeTaches
* @return
*/
public Tache agir(Vector<Tache> listeTaches);
/**
*
* @param c
* @return
*/
public Vector<Tache> getListeTache(Contexte c);
/**
*
* @return
*/
public Vector<Projet> getListeProjet();
/**
*
* @return
*/
public Vector<Contexte> getListeContexte();
/**
*
* @param p
*/
public void deleteProject(Projet p);
/**
*
* @param t
* @return
*/
public Boolean deleteTache(Tache t);
/**
*
* @param p
*/
public void addProjet(Projet p);
/**
*
* @param nom
* @return
*/
public Boolean addContexte(String nom);
public Boolean addTache(String nom, Integer priorite,
Integer effort, EtatTache etat, Date reveil,
Date echeance, Projet projet);
/**
*
* @param info
* @param etat
* @param reveil
* @param echeance
* @param projet
* @return
*/
public Boolean addTache(TacheExtendInfo info, EtatTache etat, Date reveil, Date echeance, Projet projet);
/**
*
* @param name
* @return
*/
public Boolean addProject(String name);
/**
*
* @param p
* @param note
* @return
*/
public Boolean addNoteToProject(Projet p, String note);
/**
*
* @param e
* @param contenu
* @return
*/
public Integer updateBasket(Idee e, String contenu);
/**
*
* @param nom
* @param element
* @return
*/
public Boolean addBasket(String nom, String element);
/**
*
* @param e
* @return
*/
public Integer deleteBasket(Idee e);
/**
*
* @return
*/
public Vector<Idee> getElements();
/**
*
* @param p
* @return
*/
public Object[] getProjetNotes(Projet p);
/**
*
* @param p
* @param note
* @return
*/
public Boolean deleteNoteFromProject(Projet p, String note);
/**
*
* @param p
* @param text
* @return
*/
public Boolean addContactToProject(Projet p, String text);
/**
*
* @param p
* @return
*/
public Object[] getProjetContacts(Projet p);
/**
*
* @param p
* @param c
* @return
*/
public Boolean deleteContactFromProject(Projet p, Contact c);
/**
*
* @param p
* @return
*/
public Tache getProjetUrgentTask(Projet p);
/**
*
* @param nomProjet
* @param contexte
* @param projetParent
* @return
*/
public Boolean addProjet(String nomProjet, String contexte, Projet projetParent);
/**
*
* @param p
* @param contexte
* @return
*/
public Boolean setProjectContext(Projet p, String contexte);
/**
*
* @param p
* @param nom
* @return
*/
public Boolean setProjetName(Projet p,String nom);
/**
*
* @param t
* @return
*/
public Projet getTaskProjet(Tache t);
/**
*
* @param p
* @return
*/
public Vector<Tache> getProjectTasks(Projet p);
/**
*
* @param p
* @return
*/
public Vector<Projet> getProjectSubProject(Projet p);
/**
*
* @return
*/
public Vector<Contact> getContacts();
/**
*
* @param c
*/
public void deleteContact(Contact c);
}
......@@ -3,11 +3,21 @@ package fr.univnantes.alma.gtd.controler.utilisateurs;
import fr.univnantes.alma.gtd.model.gestionnaireutilisateur.GestionnaireUtilisateurs;
import fr.univnantes.alma.gtd.model.gestionnaireutilisateur.Utilisateur;
/**
*
* Classe de controle utilisateur
*
*/
public class ControlerUtilisateurs implements IControlerUtilisateurs{
private GestionnaireUtilisateurs gu;
@Override
/**
* cree un nouvel utilisateur
* @param login
* @param pwd
* @return Utilisateur
*/
public Utilisateur nouveauUtilisateur(String login, String pwd) {
Utilisateur util = new Utilisateur(login,pwd);
gu = GestionnaireUtilisateurs.getGestionnaireUtilisateur();
......
......@@ -3,5 +3,12 @@ package fr.univnantes.alma.gtd.controler.utilisateurs;
import fr.univnantes.alma.gtd.model.gestionnaireutilisateur.Utilisateur;
public interface IControlerUtilisateurs {
/**
*
* @param login
* @param pwd
* @return
*/
public Utilisateur nouveauUtilisateur(String login, String pwd);
}
......@@ -36,8 +36,8 @@ public class Tache extends GTDEntity{
private List<String> notes = new ArrayList<String>();
private EtatTache etatTache;
// Start of user code for attributes in Tache
private Projet parent;
private IPersistance persistance = GTDEntity.PERSISTANCE;
......@@ -47,9 +47,9 @@ public class Tache extends GTDEntity{
public Tache() {
super();
}
/**
* sans preciser le projet parent
* constructeur sans preciser le projet parent
* @param nom
* @param priorite
* @param effort
......@@ -58,39 +58,47 @@ public class Tache extends GTDEntity{
* @param liens
* @param note
*/
public Tache(final String nom, final Integer priorite, final Integer effort, final Date reveil, final Date echeance, final List<String> liens, final List<String> notes) {
public Tache(final TacheExtendInfo info, final Date reveil, final Date echeance) {
super();
this.nom = nom;
this.priorite = priorite;
this.effort = effort;
this.nom = info.getNom();
this.priorite = info.getPriorite();
this.effort = info.getEffort();
this.reveil = reveil;
this.echeance = echeance;
this.liens = liens;
this.notes = notes;
this.liens = info.getLiens();
this.notes = info.getNotes();
this.etatTache = EtatTache.AFAIRE;
}
public Tache( final String nom
, final Integer priorite
, final Integer effort
, final Date reveil
, final Date echeance
, final List<String> liens
, final List<String> note
, final Projet parent
) {
this ( nom
, priorite
, effort
, reveil
, echeance
, liens
, note
);
/**
* constructeur en précisant le projet parent
* @param nom
* @param priorite
* @param effort
* @param reveil
* @param echeance
* @param liens
* @param note
* @param parent
*/
public Tache( final TacheExtendInfo info
, final Date reveil
, final Date echeance
, final Projet parent
) {
this.nom = info.getNom();
this.priorite = info.getPriorite();
this.effort = info.getEffort();
this.reveil = reveil;
this.echeance = echeance;
this.liens = info.getLiens();
this.notes = info.getNotes();
this.parent = parent;
this.etatTache = EtatTache.AFAIRE;
}
public Projet getParent() {
return parent;
}
......@@ -98,42 +106,42 @@ public class Tache extends GTDEntity{
public void setParent(Projet parent) {
this.parent = parent;
}
public List<String> getNotes() {
return this.notes;
}
public List<String> getLiens() {
return this.liens;
}
public void addLien(String lien) {
this.liens.add(lien);
persistance.update(this);
}
public void addNote(String note) {
this.liens.add(note);
persistance.update(this);
}
public void removeNote(String note){
this.notes.remove(notes);
persistance.update(this);
}
public void removeLien(String lien){
this.notes.remove(lien);
persistance.update(this);
}
// End of user code
public String getNom() {
// Start of user code for getter of nom
return this.nom;
// End of user code
}
public void setNom(String nom) {
// Start of user code for setter of nom
this.nom = nom;
......@@ -144,7 +152,7 @@ public class Tache extends GTDEntity{
return this.priorite;
// End of user code
}
public void setPriorite(Integer priorite) {
// Start of user code for setter of priorite
this.priorite = priorite;
......@@ -155,7 +163,7 @@ public class Tache extends GTDEntity{
return this.effort;
// End of user code
}
public void setEffort(Integer effort) {
// Start of user code for setter of effort
this.effort = effort;
......@@ -166,7 +174,7 @@ public class Tache extends GTDEntity{
return this.reveil;
// End of user code
}
public void setReveil(Date reveil) {
// Start of user code for setter of reveil
this.reveil = reveil;
......@@ -177,16 +185,16 @@ public class Tache extends GTDEntity{
return this.echeance;
// End of user code
}
public void setEcheance(Date echeance) {
// Start of user code for setter of echeance
this.echeance = echeance;
// End of user code
}
public EtatTache getEtatTache() {
return this.etatTache;
}
return this.etatTache;
}
public void setEtatTache(EtatTache etatTache) {
this.etatTache = etatTache;
}
......@@ -199,7 +207,7 @@ public class Tache extends GTDEntity{
public void deleguee() {
// Start of user code for deleguee method body
this.etatTache.deleguee();
// End of user code
}
public void enAttente() {
......@@ -215,9 +223,9 @@ public class Tache extends GTDEntity{
public String toString(){
return this.getNom();
}
public List<EtatTache> prochainsEtats() {
return this.etatTache.etatsProchains();
}
}
package fr.univnantes.alma.gtd.model.gestionnaireressources;
import java.util.List;
/**
* classe possedant des informations permettant de construire une Tache
* fait pour diminuer le nombre de paramètre à 5 au lieu de 7,8 dans :
* - 2 constructeurs Tache
* - method addTache
*/
public class TacheExtendInfo {
private Integer priorite;
private Integer effort;
private List<String> liens;
private List<String> notes;
private String nom;
public TacheExtendInfo(){
super();
}
/**
* Constructor
* @param nom
* @param priorite
* @param effort
* @param liens
* @param notes
*/
public TacheExtendInfo(final String nom, final Integer priorite, final Integer effort, final List<String> liens, final List<String> notes) {
this.nom = nom;
this.priorite = priorite;
this.effort = effort;
this.liens = liens;
this.notes = notes;
}
/*
* Getters & Setters
*/
/**
* @return nom
*/
public String getNom() {
return nom;
}
/**
* @param nom
*/
public void setNom(String nom) {
this.nom = nom;
}
/**
*
* @return priorite
*/
public Integer getPriorite() {
return priorite;
}
/**
*
* @param priorite
*/
public void setPriorite(Integer priorite) {
this.priorite = priorite;
}
/**
*
* @return effort
*/
public Integer getEffort() {
return effort;
}
/**
*
* @param effort
*/
public void setEffort(Integer effort) {
this.effort = effort;
}
/**
*
* @return liens
*/
public List<String> getLiens() {
return liens;
}
/**
*
* @param liens
*/
public void setLiens(List<String> liens) {
this.liens = liens;
}
/**
*
* @return notes
*/
public List<String> getNotes() {
return notes;
}
/**
*
* @param notes
*/
public void setNotes(List<String> notes) {
this.notes = notes;
}
}
......@@ -29,280 +29,246 @@ public class PersistanceLocale implements IPersistance {
private ProjetDAO projetDao = new ProjetDAOImpl();
private TacheDAO tacheDao = new TacheDAOImpl();
@Override
public Contact findContact(Integer id) {
System.out.println("1");
return contactDao.find(id);
}
@Override
public Contexte findContexte(Integer id) {
System.out.println("2");
return contexteDao.find(id);
}
@Override
public Projet findProjet(Integer id) {
System.out.println("3");
return projetDao.find(id);
}
@Override
public Tache findTache(Integer id) {
System.out.println("4");
return tacheDao.find(id);
}
@Override
public Utilisateur findUtilisateur(Integer id) {
System.out.println("5");
return utilisateurDao.find(id);
}
@Override
public Idee findIdee(Integer id) {
System.out.println("6");
return ideeDao.find(id);
}
@Override
public Boolean update(GestionnaireUtilisateurs entity) {
System.out.println("7");
return gestionnaireUtilisateursDao.update(entity);
}
@Override
public Boolean delete(Utilisateur entity) {
System.out.println("8");
this.delete((GestionnaireRessources)entity.getIGestionnaireRessources());
return utilisateurDao.delete(entity);
}
@Override
public Boolean deleteAllUtilisateurs() {
System.out.println("9");
return utilisateurDao.deleteAll();
}
@Override
public List<Utilisateur> findAllUtilisateurs() {
System.out.println("10");
return utilisateurDao.findAll();
}
@Override
public Boolean update(Utilisateur entity) {
System.out.println("11");
return utilisateurDao.update(entity);
}
@Override
public Integer create(GestionnaireRessources entity) {
System.out.println("12");
return gestionnaireRessourcesDao.create(entity);
}
@Override
//TODO A revoir avec les delete en cascade
public Boolean delete(GestionnaireRessources entity) {
System.out.println("13");
for (Contact c : entity.getContacts())
this.delete(c);
for (Projet p : entity.getProjets())
this.delete(p);
for (Contexte c : entity.getContextes())
this.delete(c);
for (Idee i : entity.getIdees())
this.delete(i);
for (Contact c : entity.getContacts()){
this.delete(c);}
for (Projet p : entity.getProjets()){
this.delete(p);}
for (Contexte c : entity.getContextes()){
this.delete(c);}
for (Idee i : entity.getIdees()){
this.delete(i);}
return gestionnaireRessourcesDao.delete(entity);
}
@Override
public Boolean deleteAllGestionnaireRessources() {
System.out.println("14");
return gestionnaireRessourcesDao.deleteAll();
}
@Override
public List<GestionnaireRessources> findAllGestionnaireRessources() {
System.out.println("15");
return gestionnaireRessourcesDao.findAll();
}
@Override
public GestionnaireRessources findGestionnaireRessources(Integer id) {
System.out.println("16");
return gestionnaireRessourcesDao.find(id);
}
@Override
public Boolean update(GestionnaireRessources entity) {
System.out.println("17");
return gestionnaireRessourcesDao.update(entity);
}
@Override
public Boolean delete(Idee entity) {
System.out.println("18");
return ideeDao.delete(entity);
}
@Override
public Boolean delete(Contact entity) {
System.out.println("19");
return contactDao.delete(entity);
}
@Override
public Boolean delete(Contexte entity) {
System.out.println("20");
return contexteDao.delete(entity);
}
@Override
public Boolean delete(Projet entity) {
System.out.println("21");
return projetDao.delete(entity);
}
@Override
public Boolean delete(Tache entity) {
System.out.println("22");
return tacheDao.delete(entity);
}
@Override
public Boolean deleteAllContacts() {
System.out.println("23");
return contactDao.deleteAll();
}
@Override
public Boolean deleteAllContextes() {
System.out.println("24");
return contexteDao.deleteAll();
}
@Override
public Boolean deleteAllIdees() {
System.out.println("26");
return ideeDao.deleteAll();
}
@Override
public Boolean deleteAllProjets() {
System.out.println("27");
return projetDao.deleteAll();
}
@Override
public Boolean deleteAllTache() {
System.out.println("28");
return tacheDao.deleteAll();
}
@Override
public List<Contact> findAllContacts() {
System.out.println("29");
return contactDao.findAll();
}
@Override
public List<Contexte> findAllContextes() {
System.out.println("30");
return contexteDao.findAll();
}
@Override
public List<Idee> findAllIdees() {
System.out.println("31");
return ideeDao.findAll();
}
@Override
public List<Projet> findAllProjets() {
System.out.println("32");
return projetDao.findAll();
}
@Override
public List<Tache> findAllTaches() {
System.out.println("33");
return tacheDao.findAll();
}
@Override
public Boolean update(Idee entity) {
System.out.println("34");
return ideeDao.update(entity);
}
@Override
public Boolean update(Contact entity) {
System.out.println("35");
return contactDao.update(entity);
}
@Override
public Boolean update(Contexte entity) {
System.out.println("36");
return contexteDao.update(entity);
}
@Override
public Boolean update(Projet entity) {
System.out.println("37");
return projetDao.update(entity);
}
@Override
public void create(Projet projet) {
projetDao.create(projet);
}
@Override
public void valide() {
HibernateUtil.valide();
}
@Override
public Integer create(GestionnaireUtilisateurs entity) {
return gestionnaireUtilisateursDao.create(entity);
}
@Override
public GestionnaireUtilisateurs findGestionnaireUtilisateurs(Integer id) {
return gestionnaireUtilisateursDao.find(id);
}
@Override
public void create(EtatTache entity) {
etatTacheDao.create(entity);
}
@Override
public AFaire findAFaire(Integer id) {
return etatTacheDao.findAFaire(id);
}
@Override
public Boolean update(Tache entity) {
tacheDao.update(entity);
return true;
}
@Override
public Deleguee findDeleguee(Integer id) {
return etatTacheDao.findDeleguee(id);
}
@Override
public EnAttente findEnAttente(Integer id) {
return etatTacheDao.findEnAttente(id);
}
@Override
public Finie findFinie(Integer id) {
return etatTacheDao.findFinie(id);
}
......
......@@ -11,30 +11,27 @@ import fr.univnantes.alma.gtd.model.gestionnaireutilisateur.Utilisateur;
public class UtilisateurDAOImpl extends AbstractDAO implements UtilisateurDAO{
@Override
public Boolean deleteAll() {
Session s = HibernateUtil.getSession();
Transaction tx = s.beginTransaction();
Query q = s.createQuery("delete from Utilisateur");
q.executeUpdate();
tx.commit();
Session session = HibernateUtil.getSession();
Transaction transaction = session.beginTransaction();
Query query = session.createQuery("delete from Utilisateur");
query.executeUpdate();
transaction.commit();
return true;
}
@Override
public Utilisateur find(Integer id) {
Session s = HibernateUtil.getSession();
Utilisateur entity = (Utilisateur) s.get(Utilisateur.class.getCanonicalName(), id);
return entity;
Session session = HibernateUtil.getSession();
return (Utilisateur) session.get(Utilisateur.class.getCanonicalName(), id);
}
@SuppressWarnings("unchecked")
@Override
public List<Utilisateur> findAll() {
Session s = HibernateUtil.getSession();
Criteria criteria = s.createCriteria(Utilisateur.class.getCanonicalName());
List<Utilisateur> results = (List<Utilisateur>) criteria.list();
return results;
Session session = HibernateUtil.getSession();
Criteria criteria = session.createCriteria(Utilisateur.class.getCanonicalName());
return (List<Utilisateur>) criteria.list();
}
}
......@@ -5,6 +5,7 @@ import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.Vector;
import javax.swing.BoxLayout;
......@@ -23,6 +24,7 @@ import fr.univnantes.alma.gtd.controler.ressources.IControlerRessources;
import fr.univnantes.alma.gtd.model.gestionnaireressources.EtatTache;
import fr.univnantes.alma.gtd.model.gestionnaireressources.Idee;
import fr.univnantes.alma.gtd.model.gestionnaireressources.Projet;
import fr.univnantes.alma.gtd.model.gestionnaireressources.TacheExtendInfo;
public class DialogPanier extends JDialog{
......@@ -47,7 +49,7 @@ public class DialogPanier extends JDialog{
return "Créer contexte";
}
@Override
public String toString(){
return this.getNom();
}
......@@ -95,7 +97,7 @@ public class DialogPanier extends JDialog{
return "Créer Tache";
}
@Override
public String toString(){
return this.getNom();
}
......@@ -115,7 +117,7 @@ public class DialogPanier extends JDialog{
return "Créer Projet";
}
@Override
public String toString(){
return this.getNom();
}
......@@ -150,7 +152,7 @@ public class DialogPanier extends JDialog{
centre.add(prem);
annuler.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
DialogPanier.this.setVisible(false);
......@@ -170,7 +172,7 @@ public class DialogPanier extends JDialog{
listepos.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
listepos.addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
JPanel p = (JPanel)listepos.getSelectedValue();
centre.removeAll();
......@@ -180,16 +182,20 @@ public class DialogPanier extends JDialog{
});
confirmer.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
int choix = listepos.getSelectedIndex();
Boolean result = false;
switch (choix){
case 0 : result = gestR.addProject(formProj.nomP.getText());break;
case 1 :
result = gestR.addTache(formTache.nomT.getText(),
(Integer)formTache.prior.getSelectedItem(),
(Integer)formTache.eff.getSelectedItem(),
TacheExtendInfo info =
new TacheExtendInfo(formTache.nomT.getText(),
(Integer)formTache.prior.getSelectedItem(),
(Integer)formTache.eff.getSelectedItem(),
new ArrayList<String>(),
new ArrayList<String>());
result = gestR.addTache(info,
(EtatTache)formTache.et.getSelectedItem(),
formTache.rev.getDate(),
formTache.ech.getDate(),
......
......@@ -7,6 +7,7 @@ import java.awt.GridLayout;
import java.awt.HeadlessException;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.Vector;
import javax.swing.BorderFactory;
......@@ -36,6 +37,7 @@ import fr.univnantes.alma.gtd.model.gestionnaireressources.Contexte;
import fr.univnantes.alma.gtd.model.gestionnaireressources.EtatTache;
import fr.univnantes.alma.gtd.model.gestionnaireressources.Projet;
import fr.univnantes.alma.gtd.model.gestionnaireressources.Tache;
import fr.univnantes.alma.gtd.model.gestionnaireressources.TacheExtendInfo;
public class OngletProjet extends JPanel {
/** ELEMENT DE L ONGLET PROJET **/
......@@ -340,7 +342,7 @@ public class OngletProjet extends JPanel {
});
addcontactprojet.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode)
arbretache.getLastSelectedPathComponent();
......@@ -367,7 +369,7 @@ public class OngletProjet extends JPanel {
});
deletecontactgest.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
Contact c = (Contact) contacts.getSelectedItem();
if (c!=null){
......@@ -583,10 +585,10 @@ public class OngletProjet extends JPanel {
JOptionPane.ERROR_MESSAGE, null, null, null);
}else{
TacheExtendInfo info = new TacheExtendInfo(tnomtache.getText(), (Integer)tpriorite.getSelectedItem(),
(Integer) teffort.getSelectedItem(),new ArrayList<String>(),new ArrayList<String>());
Projet p = (Projet) node.getUserObject();
gestR.addTache(tnomtache.getText(), (Integer)tpriorite.getSelectedItem(),
(Integer) teffort.getSelectedItem(),
gestR.addTache(info,
(EtatTache) tetat.getSelectedItem(), dreveil.getDate(), decheance.getDate(), p);
createTree();
}
......@@ -705,8 +707,10 @@ public class OngletProjet extends JPanel {
Projet p = gestR.getTaskProjet(t);
gestR.deleteTache(t);
gestR.addTache(tnomtache.getText(), (Integer)tpriorite.getSelectedItem(),
(Integer) teffort.getSelectedItem(),
TacheExtendInfo info = new TacheExtendInfo(tnomtache.getText(), (Integer)tpriorite.getSelectedItem(),
(Integer) teffort.getSelectedItem(),new ArrayList<String>(),new ArrayList<String>());
gestR.addTache(info,
(EtatTache) tetat.getSelectedItem(), dreveil.getDate(), decheance.getDate(), p);
createTree();
}
......
package fr.univnantes.alma.test;
import fr.univnantes.alma.gtd.model.gestionnaireressources.AFaire;
import fr.univnantes.alma.gtd.model.gestionnaireressources.EtatTache;
import junit.framework.TestCase;
public class TestAFaire extends TestCase {
public void testDeleguee() {
AFaire aFaire = new AFaire();
aFaire.deleguee();
assertEquals(aFaire.getEtatTache(),EtatTache.DELEGUEE);
}
public void testEnAttente() {
AFaire aFaire = new AFaire();
aFaire.enAttente();
assertEquals(aFaire.getEtatTache(),EtatTache.ENATTENTE);
}
public void testFinie() {
AFaire aFaire = new AFaire();
aFaire.finie();
assertEquals(aFaire.getEtatTache(),EtatTache.FINIE);
}
public void testEtatsProchains() {
AFaire aFaire = new AFaire();
}
public void testAFaire() {
AFaire aFaire = new AFaire();
aFaire.aFaire();
assertEquals(aFaire.getEtatTache(),EtatTache.AFAIRE);
}
public void testToString() {
AFaire aFaire = new AFaire();
aFaire.deleguee();
assertEquals(aFaire.toString(),"A faire");
}
}
package fr.univnantes.alma.test;
import junit.framework.TestCase;
import fr.univnantes.alma.gtd.controler.connexion.ControlerConnexion;
public class TestControlerConnexion extends TestCase {
public void testConnect() {
ControlerConnexion controler = new ControlerConnexion();
assertFalse(controler.connect("billou", "billou"));
}
public void testDisconnect() {
ControlerConnexion controler = new ControlerConnexion();
controler.disconnect();
assertEquals(ControlerConnexion.utilisateurConnecte,null);
}
public void testVerifyConnection() {
ControlerConnexion controler = new ControlerConnexion();
assertFalse(controler.verifyConnection());
}
}
package fr.univnantes.alma.gtd.tests;
import java.util.List;
import java.util.Vector;
import fr.univnantes.alma.gtd.controler.ressources.ControlerRessources;
import fr.univnantes.alma.gtd.model.gestionnaireressources.Contexte;
import fr.univnantes.alma.gtd.model.gestionnaireressources.Date;
import fr.univnantes.alma.gtd.model.gestionnaireressources.EtatTache;
import fr.univnantes.alma.gtd.model.gestionnaireressources.Projet;
import fr.univnantes.alma.gtd.model.gestionnaireressources.Tache;
import fr.univnantes.alma.gtd.model.gestionnaireressources.TacheExtendInfo;
import junit.framework.TestCase;
public class TestControlerRessources extends TestCase{
public void testDeleteContexte(){
ControlerRessources controlRes = new ControlerRessources();
Contexte c = new Contexte("context");
controlRes.addContexte(c.getTitre());
controlRes.deleteContexte(c);
assertEquals(controlRes.getListeContexte().size(), 0);
}
public void testAgir() {
ControlerRessources controlRes = new ControlerRessources();
Vector<Tache> listeTaches = new Vector<Tache>();
Tache t1 = new Tache();
t1.setPriorite(1);
Tache t2 = new Tache();
t1.setPriorite(2);
Tache t3 = new Tache();
t1.setPriorite(3);
listeTaches.add(t1);
listeTaches.add(t2);
listeTaches.add(t3);
assertEquals(t3, controlRes.agir(listeTaches));
}
public void testDeleteProject(){
ControlerRessources controlRes = new ControlerRessources();
Projet p = new Projet();
controlRes.addProjet(p);
controlRes.deleteProject(p);
assertEquals(controlRes.getListeProjet().size() , 0);
}
public void testDeleteTache(){
ControlerRessources controlRes = new ControlerRessources();
Tache t = new Tache();
assertTrue(controlRes.deleteTache(t));
}
public void testAddProjet(){}
public void testAddProjet2(){}
public void testAddContexte(){}
public void testAddTache(){}
public void testAddProject(){}
public void testAddNoteToProject(){}
public void testUpdateBasket(){}
public void testAddBasket(){}
public void testDeleteContact(){}
public void testDeleteBasket(){}
public void testDeleteNoteFromProject(){}
public void testAddContactToProject(){}
public void testDeleteContactFromProject(){}
public void testGetProjetContacts(){}
public void testGetProjetUrgentTask(){}
public void testSetProjectContext(){}
public void testSetProjetName(){}
public void testGetTaskvoid(){}
public void testGetProjectTasks(){}
public void testGetProjectSubProject(){}
public void testGetContacts(){}
public void testGetListeTache(){}
public void testGetListeProjet(){}
public void testGetListeContexte(){}
public void testGetElements(){}
public void testGetProjetNotes(){}
}
package fr.univnantes.alma.gtd.tests;
import junit.framework.TestCase;
import fr.univnantes.alma.gtd.controler.utilisateurs.ControlerUtilisateurs;
import fr.univnantes.alma.gtd.model.gestionnaireutilisateur.Utilisateur;
public class TestControlerUtilisateurs extends TestCase{
public void testNouveauUtilisateur() {
ControlerUtilisateurs controlUtilisateur = new ControlerUtilisateurs() ;
Utilisateur user = controlUtilisateur.nouveauUtilisateur("abou", "dabi");
assertEquals(user.getLogin(), "abou");
assertEquals(user.getPwd(), "dabi");
}
}
package fr.univnantes.alma.gtd.tests;
import fr.univnantes.alma.gtd.model.gestionnaireressources.Idee;
import junit.framework.TestCase;
public class TestIdee extends TestCase {
public void testIdeeStringString() {
Idee idee = new Idee("nom","description");
assertEquals(idee.getNom(),"nom");
assertEquals(idee.getDescription(),"description");
}
public void testToString() {
Idee idee = new Idee("nom","description");
assertEquals(idee.toString(),"nom");
}
public void testGetNom() {
Idee idee = new Idee("nom","description");
assertEquals(idee.getNom(),"nom");
}
public void testSetNom() {
Idee idee = new Idee();
idee.setNom("nom");
assertEquals(idee.getNom(),"nom");
}
public void testGetDescription() {
Idee idee = new Idee("nom","description");
assertEquals(idee.getDescription(),"description");
}
public void testSetDescription() {
Idee idee = new Idee("nom","description");
idee.setDescription("description");
assertEquals(idee.getDescription(),"description");
}
}
......@@ -39,6 +39,12 @@
<artifactId>h2</artifactId>
<version>1.2.127</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.4</version>
<scope>test</scope>
</dependency>
</dependencies>
......@@ -66,3 +72,4 @@
</organization>
</project>
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter