ajout fonction API
This commit is contained in:
parent
08f2675993
commit
191635b8f7
@ -27,11 +27,11 @@ public class Graphic{
|
|||||||
this.fenetre.setSize(1000, 720);
|
this.fenetre.setSize(1000, 720);
|
||||||
this.fenetre.setLocation(200,200);
|
this.fenetre.setLocation(200,200);
|
||||||
this.fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
this.fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
agf=this.getPromo();
|
this.getPromo();
|
||||||
this.fenetre.setVisible(true);
|
this.fenetre.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private AbstractGroupeFactory getPromo(){
|
private void getPromo(){
|
||||||
this.agf=null;
|
this.agf=null;
|
||||||
try{
|
try{
|
||||||
Class.forName("org.mariadb.jdbc.Driver");
|
Class.forName("org.mariadb.jdbc.Driver");
|
||||||
@ -76,9 +76,38 @@ public class Graphic{
|
|||||||
}catch(ClassNotFoundException e){
|
}catch(ClassNotFoundException e){
|
||||||
System.out.println("pilote non disponible");
|
System.out.println("pilote non disponible");
|
||||||
}
|
}
|
||||||
return factory;
|
|
||||||
}
|
}
|
||||||
private void addSousGroupe(Groupe g){
|
private void addSousGroupe(Groupe g){
|
||||||
|
try{
|
||||||
|
Class.forName("org.mariadb.jdbc.Driver");
|
||||||
|
try{
|
||||||
|
Connection cnx = DriverManager.getConnection(
|
||||||
|
"jdbc:mariadb://dwarves.iut-fbleau.fr/chaignea",
|
||||||
|
"chaignea", "Chaigneauphpmyadmin");
|
||||||
|
try{
|
||||||
|
PreparedStatement pst = cnx.prepareStatement(
|
||||||
|
"SELECT `id`, `nom`, `min`, `max`, `value`, `id-parent` FROM `Groupe` join `TYPE` on Groupe.Type=TYPE.name where Groupe.`id-parent`=?; ");
|
||||||
|
try{
|
||||||
|
|
||||||
|
try{
|
||||||
|
|
||||||
|
}catch(SQLException e){
|
||||||
|
System.out.println("erreur dans la prise de resultat");
|
||||||
|
}
|
||||||
|
rs.close();
|
||||||
|
}catch(SQLException e){
|
||||||
|
System.out.println("erreur dans le resultat");
|
||||||
|
}
|
||||||
|
pst.close();
|
||||||
|
}catch(SQLException e){
|
||||||
|
System.out.println("erreur dans la preparation");
|
||||||
|
}
|
||||||
|
cnx.close();
|
||||||
|
}catch(SQLException e){
|
||||||
|
System.out.println("Erreur dans la connexion!");
|
||||||
|
}
|
||||||
|
}catch(ClassNotFoundException e){
|
||||||
|
System.out.println("pilote non disponible");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -224,7 +224,17 @@ public class AbstractGroupeFactoryNP implements AbstractGroupeFactory {
|
|||||||
* @throws java.lang.NullPointerException si le String est null.
|
* @throws java.lang.NullPointerException si le String est null.
|
||||||
*/
|
*/
|
||||||
public Set<Groupe> getGroupesOfEtudiant(Etudiant etu){
|
public Set<Groupe> getGroupesOfEtudiant(Etudiant etu){
|
||||||
throw new UnsupportedOperationException("pas encore implanté");
|
Collection<Groupe> s= this.brain.values();
|
||||||
|
Set<Groupe> ret=new LinkedHashSet<Groupe>();
|
||||||
|
for(Groupe g: s){
|
||||||
|
for(Etudiant e: g.getEtudiants()){
|
||||||
|
if(e==etu){
|
||||||
|
ret.add(g);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user