CopaApp
Change of Plan Application
 All Classes Functions Variables Pages
Public Member Functions | Static Public Member Functions | List of all members
unicopa.copa.app.Database Class Reference

This class implements the Android Database as a singleton. More...

Inheritance diagram for unicopa.copa.app.Database:
Inheritance graph
Collaboration diagram for unicopa.copa.app.Database:
Collaboration graph

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< EventgetAllEvents ()
 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< SingleEventLocalgetSingleEventsByEventID (int eventID)
 This method returns all SingleEvents with the given eventID. More...
 
List< SingleEventLocalgetNearestSingleEvents (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< EventgetEventsWithPermission ()
 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< SingleEventLocalgetUpdatedSingleEvents (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...
 

Detailed Description

This class implements the Android Database as a singleton.

Author
Robin Muench, Martin Rabe

Member Function Documentation

boolean unicopa.copa.app.Database.checkEvent ( int  eventID)

This method checks whether an Event with the given eventID exists in the local database.

Parameters
eventID
Returns
boolean unicopa.copa.app.Database.checkEventGroup ( int  eventGroupID)

This method checks whether an EventGroup with the given eventGroupID exists in the local database.

Parameters
eventGroupID
Returns
boolean unicopa.copa.app.Database.checkSingleEvent ( int  singleEventID)

This method checks whether a SingleEvent with the given singleEventID exists in the local database.

Parameters
singleEventID
Returns
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.

Parameters
eventID
Exceptions
PermissionException
void unicopa.copa.app.Database.deleteSingleEvent ( int  singleEventID)

This Method deletes a SingleEvent from the Database.

Parameters
singleEventID
List<Event> unicopa.copa.app.Database.getAllEvents ( )

This method returns a List of all stored Events.

Returns
String unicopa.copa.app.Database.getEventGroupName ( int  eventGroupID)

This method returns the Name of the EventGroup with the given eventGroupID.

Parameters
eventGroupID
Returns
List<Event> unicopa.copa.app.Database.getEventsWithPermission ( )

This method returns a List of all Events with a PermissionCode > 0.

Returns
static Database unicopa.copa.app.Database.getInstance ( Context  context)
static

This method is called to get an instance of Database.

Returns
Database
List<SingleEventLocal> unicopa.copa.app.Database.getNearestSingleEvents ( int  num)

This method returns a List of the next upcoming SingleEvents.

Parameters
num
Returns
SingleEventLocal unicopa.copa.app.Database.getSingleEventBySingleEventID ( int  singleEventID)

This method returns a SingleEventLocal-Object with the given singleEventID.

Parameters
singleEventID
Returns
List<SingleEventLocal> unicopa.copa.app.Database.getSingleEventsByEventID ( int  eventID)

This method returns all SingleEvents with the given eventID.

Parameters
eventID
Returns
List<SingleEventLocal> unicopa.copa.app.Database.getUpdatedSingleEvents ( int  num)

This method is to return the next updated SingleEvents.

Parameters
num
Returns
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.

Parameters
obj
ID_old
Exceptions
NoEventGroupException
NoEventException
void unicopa.copa.app.Database.printTable ( String  table)

This is a debug-method to print local Tables in LogCat.

Parameters
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.

Parameters
singleEventID
void unicopa.copa.app.Database.Table_delete ( String  name)

This method deletes an existing Database-table by name.

Parameters
name
void unicopa.copa.app.Database.Table_init ( ) throws SQLiteException

This method initializes the Tables:

EventGroup Event SingleEventLocal

that are required in the Application

Exceptions
SQLiteException
void unicopa.copa.app.Database.updateColors ( SettingsLocal  setLoc)

This Method gets colors from a SettingsLocal-Object and updates the Database.

Parameters
setLoc
void unicopa.copa.app.Database.updatePermissions ( List< Integer >  eventList,
int  permissionCode 
) throws NoEventException, NoEventGroupException

This Method is for updating.

Parameters
eventList
permissionCode
Exceptions
NoEventException
NoEventGroupException

The documentation for this class was generated from the following file: