This class implements the Android Database as a singleton. More...
Public Member Functions | |
void | onCreate (SQLiteDatabase db) |
void | onUpgrade (SQLiteDatabase db, int oldVersion, int newVersion) |
void | printTable (String table) |
This is a debug-method to print local Tables in LogCat. More... | |
void | Table_init () throws SQLiteException |
This method initializes the Tables: More... | |
void | Table_delete (String name) |
This method deletes an existing Database-table by name. More... | |
void | insert (Object obj, int ID_old) throws NoEventGroupException, NoEventException |
This method inserts an Object into the Database. More... | |
List< Event > | getAllEvents () |
This method returns a List of all stored Events. More... | |
String | getEventGroupName (int eventGroupID) |
This method returns the Name of the EventGroup with the given eventGroupID. More... | |
List< SingleEventLocal > | getSingleEventsByEventID (int eventID) |
This method returns all SingleEvents with the given eventID. More... | |
List< SingleEventLocal > | getNearestSingleEvents (int num) |
This method returns a List of the next upcoming SingleEvents. More... | |
SingleEventLocal | getSingleEventBySingleEventID (int singleEventID) |
This method returns a SingleEventLocal-Object with the given singleEventID. More... | |
List< Event > | getEventsWithPermission () |
This method returns a List of all Events with a PermissionCode > 0. More... | |
void | clearPermissions () |
This method sets the PermissionCode of all SingleEvents to 0. | |
void | updatePermissions (List< Integer > eventList, int permissionCode) throws NoEventException, NoEventGroupException |
This Method is for updating. More... | |
void | updateColors (SettingsLocal setLoc) |
This Method gets colors from a SettingsLocal-Object and updates the Database. More... | |
void | deleteEventByEventID (int eventID) throws PermissionException |
This Method deletes an Event and all connected SingleEvents. More... | |
void | deleteExpiredSingleEvents () |
This Method deletes all expired SingleEvents from the Database. | |
void | deleteSingleEvent (int singleEventID) |
This Method deletes a SingleEvent from the Database. More... | |
void | setCanceled (int singleEventID) |
This method sets the durationMinutes for the matching singleEvent to 0. More... | |
boolean | checkSingleEvent (int singleEventID) |
This method checks whether a SingleEvent with the given singleEventID exists in the local database. More... | |
boolean | checkEvent (int eventID) |
This method checks whether an Event with the given eventID exists in the local database. More... | |
boolean | checkEventGroup (int eventGroupID) |
This method checks whether an EventGroup with the given eventGroupID exists in the local database. More... | |
List< SingleEventLocal > | getUpdatedSingleEvents (int num) |
This method is to return the next updated SingleEvents. More... | |
Static Public Member Functions | |
static Database | getInstance (Context context) |
This method is called to get an instance of Database. More... | |
This class implements the Android Database as a singleton.
boolean unicopa.copa.app.Database.checkEvent | ( | int | eventID) |
This method checks whether an Event with the given eventID exists in the local database.
eventID |
boolean unicopa.copa.app.Database.checkEventGroup | ( | int | eventGroupID) |
This method checks whether an EventGroup with the given eventGroupID exists in the local database.
eventGroupID |
boolean unicopa.copa.app.Database.checkSingleEvent | ( | int | singleEventID) |
This method checks whether a SingleEvent with the given singleEventID exists in the local database.
singleEventID |
void unicopa.copa.app.Database.deleteEventByEventID | ( | int | eventID) | throws PermissionException |
This Method deletes an Event and all connected SingleEvents.
If the Event is the last one in the related EventGroup, it will be deleted as well.
eventID |
PermissionException |
void unicopa.copa.app.Database.deleteSingleEvent | ( | int | singleEventID) |
This Method deletes a SingleEvent from the Database.
singleEventID |
List<Event> unicopa.copa.app.Database.getAllEvents | ( | ) |
This method returns a List of all stored Events.
String unicopa.copa.app.Database.getEventGroupName | ( | int | eventGroupID) |
This method returns the Name of the EventGroup with the given eventGroupID.
eventGroupID |
List<Event> unicopa.copa.app.Database.getEventsWithPermission | ( | ) |
This method returns a List of all Events with a PermissionCode > 0.
|
static |
List<SingleEventLocal> unicopa.copa.app.Database.getNearestSingleEvents | ( | int | num) |
This method returns a List of the next upcoming SingleEvents.
num |
SingleEventLocal unicopa.copa.app.Database.getSingleEventBySingleEventID | ( | int | singleEventID) |
This method returns a SingleEventLocal-Object with the given singleEventID.
singleEventID |
List<SingleEventLocal> unicopa.copa.app.Database.getSingleEventsByEventID | ( | int | eventID) |
This method returns all SingleEvents with the given eventID.
eventID |
List<SingleEventLocal> unicopa.copa.app.Database.getUpdatedSingleEvents | ( | int | num) |
This method is to return the next updated SingleEvents.
num |
void unicopa.copa.app.Database.insert | ( | Object | obj, |
int | ID_old | ||
) | throws NoEventGroupException, NoEventException |
This method inserts an Object into the Database.
Allowed Objects are:
EventGroup Event SingleEventLocal
The parameter ID_old is used to update SingleEventLocals and should contain the ID of the SingleEvent that should be updated. If ID_old is not found in the Database or -1, the Object will be inserted.
obj | |
ID_old |
NoEventGroupException | |
NoEventException |
void unicopa.copa.app.Database.printTable | ( | String | table) |
This is a debug-method to print local Tables in LogCat.
table |
void unicopa.copa.app.Database.setCanceled | ( | int | singleEventID) |
This method sets the durationMinutes for the matching singleEvent to 0.
This symbolizes that the SingleEvent is canceled.
singleEventID |
void unicopa.copa.app.Database.Table_delete | ( | String | name) |
This method deletes an existing Database-table by name.
name |
void unicopa.copa.app.Database.Table_init | ( | ) | throws SQLiteException |
This method initializes the Tables:
EventGroup Event SingleEventLocal
that are required in the Application
SQLiteException |
void unicopa.copa.app.Database.updateColors | ( | SettingsLocal | setLoc) |
This Method gets colors from a SettingsLocal-Object and updates the Database.
setLoc |
void unicopa.copa.app.Database.updatePermissions | ( | List< Integer > | eventList, |
int | permissionCode | ||
) | throws NoEventException, NoEventGroupException |
This Method is for updating.
eventList | |
permissionCode |
NoEventException | |
NoEventGroupException |