GrOOm  0.2
BTS SNIR LaSalle Avignon 2020
Référence de la classe com.example.groom.Occupants
Graphe de collaboration de com.example.groom.Occupants:
Collaboration graph

Fonctions membres publiques

List< OccupantgetListe ()
 
Occupant getOccupant (String nom)
 
long inserer (String nom, String prenom, String fonction)
 
int modifier (int id, Occupant occupant)
 
 Occupants (Context context)
 
int supprimer (int id)
 

Fonctions membres privées

Occupant cursorToServeur (Cursor c, boolean one)
 

Attributs privés

SQLiteDatabase bdd
 
GroomBDD groomBDD
 

Description détaillée

Définition à la ligne 11 du fichier Occupants.java.

Documentation des constructeurs et destructeur

◆ Occupants()

com.example.groom.Occupants.Occupants ( Context  context)

Définition à la ligne 16 du fichier Occupants.java.

Références com.example.groom.GroomBDD.getBDD(), et com.example.groom.GroomBDD.open().

17  {
18  groomBDD = new GroomBDD(context);
19  groomBDD.open();
20  bdd = groomBDD.getBDD();
21  }
SQLiteDatabase getBDD()
Definition: GroomBDD.java:29

Documentation des fonctions membres

◆ cursorToServeur()

Occupant com.example.groom.Occupants.cursorToServeur ( Cursor  c,
boolean  one 
)
private

Définition à la ligne 73 du fichier Occupants.java.

Références com.example.groom.Occupant.setFonction(), com.example.groom.Occupant.setId(), com.example.groom.Occupant.setNom(), et com.example.groom.Occupant.setPrenom().

Référencé par com.example.groom.Occupants.getListe(), et com.example.groom.Occupants.getOccupant().

74  {
75  if (c.getCount() == 0)
76  return null;
77 
78  if(one)
79  c.moveToFirst();
80 
81  Occupant occupant = new Occupant();
82  occupant.setId(c.getInt(0));
83  occupant.setNom(c.getString(1));
84  occupant.setPrenom(c.getString(2));
85  occupant.setFonction(c.getString(3));
86 
87  if (one)
88  c.close();
89  return occupant;
90  }

◆ getListe()

List<Occupant> com.example.groom.Occupants.getListe ( )

Définition à la ligne 23 du fichier Occupants.java.

Références com.example.groom.Occupants.cursorToServeur().

Référencé par com.example.groom.IHMConnexion.listerOccupant().

24  {
25  List<Occupant> occupants = new ArrayList<Occupant>();
26  Cursor cursor = bdd.query("occupants", new String[] {"idOccupant", "nom", "prenom", "fonction"},
27  null, null, null, null, null, null);
28 
29  cursor.moveToFirst();
30  while (!cursor.isAfterLast())
31  {
32  Occupant occupant = cursorToServeur(cursor, false);
33  occupants.add(occupant);
34  cursor.moveToNext();
35  }
36 
37  cursor.close();
38  return occupants;
39  }
Occupant cursorToServeur(Cursor c, boolean one)
Definition: Occupants.java:73

◆ getOccupant()

Occupant com.example.groom.Occupants.getOccupant ( String  nom)

Définition à la ligne 66 du fichier Occupants.java.

Références com.example.groom.Occupants.cursorToServeur().

Référencé par com.example.groom.IHMConnexion.selectionnerOccupant().

67  {
68  Cursor c = bdd.rawQuery("SELECT * FROM occupants WHERE nom = ?", new String[] {nom});
69 
70  return cursorToServeur(c, true);
71  }
Occupant cursorToServeur(Cursor c, boolean one)
Definition: Occupants.java:73

◆ inserer()

long com.example.groom.Occupants.inserer ( String  nom,
String  prenom,
String  fonction 
)

Définition à la ligne 41 du fichier Occupants.java.

Référencé par com.example.groom.IHMConnexion.initialiserAjoutOccupant().

42  {
43  ContentValues values = new ContentValues();
44  values.put("nom", nom);
45  values.put("prenom", prenom);
46  values.put("fonction", fonction);
47 
48  return bdd.insert("occupants", null, values);
49  }

◆ modifier()

int com.example.groom.Occupants.modifier ( int  id,
Occupant  occupant 
)

Définition à la ligne 51 du fichier Occupants.java.

Références com.example.groom.Occupant.getFonction(), com.example.groom.Occupant.getNom(), et com.example.groom.Occupant.getPrenom().

52  {
53  ContentValues values = new ContentValues();
54  values.put("nom", occupant.getNom());
55  values.put("prenom", occupant.getPrenom());
56  values.put("fonction", occupant.getFonction());
57 
58  return bdd.update("occupants", values, "idOccupant = " + id, null);
59  }

◆ supprimer()

int com.example.groom.Occupants.supprimer ( int  id)

Définition à la ligne 61 du fichier Occupants.java.

Référencé par com.example.groom.IHMConnexion.initialiserRetraitOccupant().

62  {
63  return bdd.delete("occupants", "idOccupant = " + id, null);
64  }

Documentation des données membres

◆ bdd

SQLiteDatabase com.example.groom.Occupants.bdd
private

Définition à la ligne 14 du fichier Occupants.java.

◆ groomBDD

GroomBDD com.example.groom.Occupants.groomBDD
private

Définition à la ligne 13 du fichier Occupants.java.


La documentation de cette classe a été générée à partir du fichier suivant :