CopaServer
Change of Plan Application
 All Classes Functions Pages
Public Member Functions | Static Public Member Functions | List of all members
unicopa.copa.server.database.DatabaseService Class Reference

The database service provides an interface to the database. More...

Collaboration diagram for unicopa.copa.server.database.DatabaseService:
Collaboration graph

Public Member Functions

 DatabaseService (File database, String username, String password) throws IOException
 Create a new database service. More...
 
 DatabaseService (File database) throws IOException
 
List< EventGroupgetEventGroups (int categoryNodeID, String searchTerm) throws ObjectNotFoundException
 Get all event groups that match a given category and a search string. More...
 
List< EventgetEvents (int eventGroupID, int categoryNodeID) throws ObjectNotFoundException
 Get all events of an event group that match a given category. More...
 
EventGroup getEventGroup (int eventGroupID) throws ObjectNotFoundException
 Get the eventGroup by its ID. More...
 
Event getEvent (int eventID) throws ObjectNotFoundException
 Get the event by its ID. More...
 
List< SingleEventUpdategetSubscribedSingleEventUpdates (int userID, Date since) throws ObjectNotFoundException, IncorrectObjectException
 Get the SingleEventUpdates of SingleEvents that belong to an event the user subscribed and that occured since the given date. More...
 
List< SingleEventUpdategetSingleEventUpdates (int eventID, Date since) throws ObjectNotFoundException, IncorrectObjectException
 Get the SingleEventUpdates that belong to the specified event and that occured since the given date. More...
 
List< Integer > getSubscribedUserIDs (int eventID) throws ObjectNotFoundException
 Get a list of user-IDs of users that are subscribers for the event. More...
 
int getUserID (String userName) throws ObjectNotFoundException
 Get the ID of a user. More...
 
int getUserIDByEmail (String email) throws ObjectNotFoundException
 Get the ID of a user by his email address. More...
 
String getEmailAddress (int userID) throws ObjectNotFoundException
 Get the email address of the given user. More...
 
UserSettings getUserSettings (int userID) throws ObjectNotFoundException
 Get the user settings of the given user. More...
 
SingleEvent getSingleEvent (int id) throws ObjectNotFoundException
 Get the SingleEvent. More...
 
List< SingleEventgetCurrentSingleEvents (int eventID, Date since) throws ObjectNotFoundException, IncorrectObjectException
 Get all (still valid) SingleEvents for an Event where the scheduled date is past the given date. More...
 
List< String > getRightholders (int eventID, int appointedByUserID) throws ObjectNotFoundException
 Get the names of rightholders for an event. More...
 
List< String > getRightholders (int eventID) throws ObjectNotFoundException
 Get the names of all rightholders for an event. More...
 
Map< UserRole, List< Integer > > getUsersPriviligedEvents (int userID) throws ObjectNotFoundException
 Get all events where a user holds higher roles. More...
 
Map< UserRole, List< UserData > > getUsersAppointedUsers (int userID) throws ObjectNotFoundException
 Get all users a user gave higher roles to. More...
 
boolean isAppointedBy (int userID, int appointedByUserID, int eventID, UserRole role) throws ObjectNotFoundException, IncorrectObjectException
 Check whether a user is appointed by another user with a special role at a specific event. More...
 
UserRole getUserRole (int userID) throws ObjectNotFoundException
 Get the role a user holds in general. More...
 
UserRole getUsersRoleForEvent (int userID, int eventID) throws ObjectNotFoundException
 Get the role a user holds for a specific event. More...
 
void addAdministrator (int userID) throws ObjectNotFoundException
 gives the given user the admin privilege More...
 
void removeAdministrator (int userID) throws ObjectNotFoundException
 removes the admin privilege of the given User More...
 
void setUserRoleForEvent (int userID, int eventID, UserRole role, int gavePrivilegeID) throws IncorrectObjectException, ObjectNotFoundException
 Set the role of a user for a specific event. More...
 
List< String > getDeputies (int eventID, int appointedByUserID) throws ObjectNotFoundException
 Get the names of deputies for an event. More...
 
List< String > getDeputies (int eventID) throws ObjectNotFoundException
 Get the names of all deputies for an event. More...
 
List< String > getOwners (int eventID) throws ObjectNotFoundException
 Get the names of all owners for an event. More...
 
List< Integer > getUserByFamilyNameWithPermission (String familyName, GeneralUserPermission generalUserPermission) throws IncorrectObjectException
 Returns the list of userIDs of all users that have the given familyName and have a generalUserPermission that is higher or equal to the given one. More...
 
CategoryNodeImpl getCategoryTree (int categoryID) throws ObjectNotFoundException
 Get the categoryNodeImpl with ID=categoryID. More...
 
void updateUserSetting (UserSettings userSetting, int userID) throws ObjectNotFoundException, IncorrectObjectException, ObjectAlreadyExsistsException
 Update the UserSettings of the User with ID = userID. More...
 
void checkColor (String colorCode) throws IncorrectObjectException
 Checks if the given colerCode only Contains a-f,A-F,0-9 and has the length of 6, if it does not match this pattern an IncorrectObjectException is thrown. More...
 
String getUserName (int userID) throws ObjectNotFoundException
 Returns the userName to a given userID. More...
 
UserData getUserData (int userID) throws ObjectNotFoundException
 Get the UserData of a user. More...
 
void removePrivilege (int userID, int eventID) throws ObjectNotFoundException
 Removes the Privilege from the user with ID=userID for the event with ID=evenID. More...
 
void insertPerson (String userName, String firstName, String familyName, String email, String titel, String language, boolean eMailNotification, GeneralUserPermission generalUserPermission) throws ObjectAlreadyExsistsException, IncorrectObjectException
 Inserts a new Person into the database. More...
 
void insertSingleEventUpdate (SingleEventUpdate singleEventUpdate) throws ObjectNotFoundException, IncorrectObjectException
 Inserts the given singleEventUpdate into the database. More...
 
int insertEvent (Event event) throws ObjectNotFoundException, IncorrectObjectException
 Inserts the given Event into the database. More...
 
void insertCategoryTree (CategoryNodeImpl category, int parent) throws IncorrectObjectException, ObjectAlreadyExsistsException, ObjectNotFoundException
 Inserts the given CategoryNodeImpl into the database, also all child CategoryNodeImpls will be inserted. More...
 
void insertPrivilege (int userID, int eventID, int kindOfPrivilege, int gavePrivilegeID, Date privDate) throws ObjectNotFoundException, IncorrectObjectException
 inserts a privilege entry with the given parameters, if the given user has an privilege for that event, the old one is replaced by the new one More...
 
int insertEventGroup (EventGroup eventGroup) throws ObjectNotFoundException, IncorrectObjectException
 inserts the given EventGroup into the database, also inserts the eventGroupHasCategorys entries More...
 
void addServerStatusNote (String note) throws IncorrectObjectException
 Add a new status note entry into the database. More...
 
List< ServerStatusNotegetServerStatusNote (Date since) throws IncorrectObjectException
 Get all server status notes since the given Date. More...
 
GeneralUserPermission getGeneralUserPermission (int userID) throws ObjectNotFoundException, IncorrectObjectException
 Returns the GeneralUserPermission for the given user. More...
 
List< String > getPossibleOwners (int eventID) throws ObjectNotFoundException
 Returns the list of possible Owners for the given event. More...
 
void insertPossibleOwners (int eventID, List< String > possibleOwnerList) throws IncorrectObjectException, ObjectNotFoundException
 Inserts the given list of names as possible owners for the event with the given id. More...
 
void clear () throws ObjectNotFoundException, IncorrectObjectException
 Deletes all entries (except the dummy entries) of the tables: eventGroups, events, categories, eventGroup_has_Categories, category_Connections, singleEvents, singleEventUpdates, subscriptionLists, event_has_Categories, privilege. More...
 
void deletePrivilege ()
 Deletes all entries of the table privilege.
 
void importEvents (EventImportContainer container) throws ObjectNotFoundException, IncorrectObjectException, ObjectAlreadyExsistsException
 Clean the database (delete all EventGroups, SingleEvents, Events and dependent data except the dummy entries) and import the events given by an EventImportContainer. More...
 
List< Integer > matchOwners (int userID) throws ObjectNotFoundException
 Try to match the given user as an owner to events by using the possible owners list the events were imported with. More...
 
Map< Integer, List< Integer > > matchOwners ()
 Try to find users to be owners for each event by using the possible owners list the events were imported with. More...
 

Static Public Member Functions

static void initDB (File database) throws DatabaseUtil.ConnectException, FileNotFoundException, SQLException, IOException
 

Detailed Description

The database service provides an interface to the database.

It allows to obtain objects from and write objects to the database.

Author
Felix Wiemuth, David Knacker

Constructor & Destructor Documentation

unicopa.copa.server.database.DatabaseService.DatabaseService ( File  database,
String  username,
String  password 
) throws IOException

Create a new database service.

Note: The database must already be initialized by calling static method 'initDB()'.

Parameters
database
username
password
Exceptions
IOException

Member Function Documentation

void unicopa.copa.server.database.DatabaseService.addAdministrator ( int  userID) throws ObjectNotFoundException

gives the given user the admin privilege

Parameters
userID
Exceptions
ObjectNotFoundExceptionis thrown if the given user does not exist in the database
void unicopa.copa.server.database.DatabaseService.addServerStatusNote ( String  note) throws IncorrectObjectException

Add a new status note entry into the database.

Parameters
note
Exceptions
IncorrectObjectExceptionis thrown if the given string is longer than the corresponding database attribute, or is null
void unicopa.copa.server.database.DatabaseService.checkColor ( String  colorCode) throws IncorrectObjectException

Checks if the given colerCode only Contains a-f,A-F,0-9 and has the length of 6, if it does not match this pattern an IncorrectObjectException is thrown.

Parameters
colorCode
Exceptions
IncorrectObjectExceptionis thrown if the given colorCode is invalid
void unicopa.copa.server.database.DatabaseService.clear ( ) throws ObjectNotFoundException, IncorrectObjectException

Deletes all entries (except the dummy entries) of the tables: eventGroups, events, categories, eventGroup_has_Categories, category_Connections, singleEvents, singleEventUpdates, subscriptionLists, event_has_Categories, privilege.

Exceptions
IncorrectObjectException
ObjectNotFoundException
CategoryNodeImpl unicopa.copa.server.database.DatabaseService.getCategoryTree ( int  categoryID) throws ObjectNotFoundException

Get the categoryNodeImpl with ID=categoryID.

Parameters
categoryIDthe ID of the category
Returns
the categoryNodeImpl
Exceptions
ObjectNotFoundExceptionis thrown if the given category does not exist in the database
List<SingleEvent> unicopa.copa.server.database.DatabaseService.getCurrentSingleEvents ( int  eventID,
Date  since 
) throws ObjectNotFoundException, IncorrectObjectException

Get all (still valid) SingleEvents for an Event where the scheduled date is past the given date.

Parameters
eventIDthe ID of the event where to get the current SingleEvents from
sincethe date since when SingleEvents should be returned
Returns
the list of singleEvents
Exceptions
ObjectNotFoundExceptionis thrown if the given event does not exist in the database
IncorrectObjectExceptionis thrown if the given date is null
List<String> unicopa.copa.server.database.DatabaseService.getDeputies ( int  eventID,
int  appointedByUserID 
) throws ObjectNotFoundException

Get the names of deputies for an event.

Parameters
eventIDthe ID of the event
appointedByUserIDthe ID of the user that appointed the deputies to be returned, '-1' means all users
Returns
the list of user names
Exceptions
ObjectNotFoundExceptionis thrown if the given user or the event does not exist in the database
List<String> unicopa.copa.server.database.DatabaseService.getDeputies ( int  eventID) throws ObjectNotFoundException

Get the names of all deputies for an event.

Parameters
eventIDthe ID of the event
Returns
the list of user names
Exceptions
ObjectNotFoundExceptionis thrown if the given event does not exist in the database
String unicopa.copa.server.database.DatabaseService.getEmailAddress ( int  userID) throws ObjectNotFoundException

Get the email address of the given user.

Parameters
userIDthe user-ID
Returns
the E-Mail address as String
Exceptions
ObjectNotFoundExceptionis thrown if the given user does not exist in the database
Event unicopa.copa.server.database.DatabaseService.getEvent ( int  eventID) throws ObjectNotFoundException

Get the event by its ID.

Parameters
eventIDthe ID of the event.
Returns
the event
Exceptions
ObjectNotFoundExceptionis thrown if the given event does not exist in the database
EventGroup unicopa.copa.server.database.DatabaseService.getEventGroup ( int  eventGroupID) throws ObjectNotFoundException

Get the eventGroup by its ID.

Parameters
eventGroupIDthe ID of the eventGroup.
Returns
the EventGroup
Exceptions
ObjectNotFoundExceptionis thrown if the given eventgroup does not exists in the database
List<EventGroup> unicopa.copa.server.database.DatabaseService.getEventGroups ( int  categoryNodeID,
String  searchTerm 
) throws ObjectNotFoundException

Get all event groups that match a given category and a search string.

Parameters
categoryNodeIDthe ID of the category node in the category tree whose subtree must contain a category node of the event group
searchTermthe exact string the name of the event group must contain
Returns
a List of EventGroups
Exceptions
ObjectNotFoundExceptionis thrown if the given CategoryNode or one of the childNodes in CategeoryNode is not existend in the databse
List<Event> unicopa.copa.server.database.DatabaseService.getEvents ( int  eventGroupID,
int  categoryNodeID 
) throws ObjectNotFoundException

Get all events of an event group that match a given category.

Parameters
eventGroupIDthe ID of the event group to get the events from
categoryNodeIDthe ID of the category node in the category tree whose subtree must contain a category node of the event
Returns
a list of Events
Exceptions
ObjectNotFoundExceptionis thrown if the given eventGroup, or category does not exists in the database
GeneralUserPermission unicopa.copa.server.database.DatabaseService.getGeneralUserPermission ( int  userID) throws ObjectNotFoundException, IncorrectObjectException

Returns the GeneralUserPermission for the given user.

Parameters
userID
Returns
the GeneralUserPermission
Exceptions
ObjectNotFoundExceptionis thrown if the userID does not exist in the database
IncorrectObjectException
List<String> unicopa.copa.server.database.DatabaseService.getOwners ( int  eventID) throws ObjectNotFoundException

Get the names of all owners for an event.

Parameters
eventIDthe ID of the event
Returns
the list of user names
Exceptions
ObjectNotFoundExceptionis thrown if the given event does not exist in the database
List<String> unicopa.copa.server.database.DatabaseService.getPossibleOwners ( int  eventID) throws ObjectNotFoundException

Returns the list of possible Owners for the given event.

Parameters
eventID
Returns
Exceptions
ObjectNotFoundExceptionis thrown if the given event does not exist
List<String> unicopa.copa.server.database.DatabaseService.getRightholders ( int  eventID,
int  appointedByUserID 
) throws ObjectNotFoundException

Get the names of rightholders for an event.

Parameters
eventIDthe ID of the event
appointedByUserIDthe ID of the user that appointed the rightholders to be returned, '-1' means all users
Returns
the list of the rightholder names
Exceptions
ObjectNotFoundExceptionis thrown if the given event or the given user does not exist in the database
List<String> unicopa.copa.server.database.DatabaseService.getRightholders ( int  eventID) throws ObjectNotFoundException

Get the names of all rightholders for an event.

Parameters
eventIDthe ID of the event
Returns
the list of the rightholder names
Exceptions
ObjectNotFoundExceptionis thrown if the given event does not exist in the database
List<ServerStatusNote> unicopa.copa.server.database.DatabaseService.getServerStatusNote ( Date  since) throws IncorrectObjectException

Get all server status notes since the given Date.

Parameters
since
Returns
the list of serverStatusNotes
Exceptions
IncorrectObjectExceptionif the given date is null
SingleEvent unicopa.copa.server.database.DatabaseService.getSingleEvent ( int  id) throws ObjectNotFoundException

Get the SingleEvent.

Parameters
idthe ID of the SingleEvent
Returns
the singleEvent
Exceptions
ObjectNotFoundExceptionis thrown if the given singleEvent does not exist in the database
List<SingleEventUpdate> unicopa.copa.server.database.DatabaseService.getSingleEventUpdates ( int  eventID,
Date  since 
) throws ObjectNotFoundException, IncorrectObjectException

Get the SingleEventUpdates that belong to the specified event and that occured since the given date.

Parameters
eventIDthe ID of the event where to get updates from
sincethe data from when to return updates
Returns
the list of SingleEventUpdates
Exceptions
ObjectNotFoundExceptionis thrown if the given event does not exist in the database
IncorrectObjectExceptionis thrown if the given date is null
List<SingleEventUpdate> unicopa.copa.server.database.DatabaseService.getSubscribedSingleEventUpdates ( int  userID,
Date  since 
) throws ObjectNotFoundException, IncorrectObjectException

Get the SingleEventUpdates of SingleEvents that belong to an event the user subscribed and that occured since the given date.

Parameters
sincethe data from when to return updates
userIDthe ID of the user
Returns
the list of the singleEventUpdates
Exceptions
ObjectNotFoundExceptionis thrown if the given user does not exist in the database
IncorrectObjectExceptionis thrown if the given date is null
List<Integer> unicopa.copa.server.database.DatabaseService.getSubscribedUserIDs ( int  eventID) throws ObjectNotFoundException

Get a list of user-IDs of users that are subscribers for the event.

Parameters
eventIDthe event ID for the event the users should have subscribed to.
Returns
a list of user-IDs of the subscribers
Exceptions
ObjectNotFoundExceptionis thrown if the given event does not exist in the database
List<Integer> unicopa.copa.server.database.DatabaseService.getUserByFamilyNameWithPermission ( String  familyName,
GeneralUserPermission  generalUserPermission 
) throws IncorrectObjectException

Returns the list of userIDs of all users that have the given familyName and have a generalUserPermission that is higher or equal to the given one.

Parameters
familyName
generalUserPermission
Returns
Exceptions
IncorrectObjectExceptionis thrown if the given gerneralUserPermission is not valid
UserData unicopa.copa.server.database.DatabaseService.getUserData ( int  userID) throws ObjectNotFoundException

Get the UserData of a user.

Parameters
userIDthe ID of the user
Returns
Exceptions
ObjectNotFoundExceptionis thrown if the given user does not exist in the database
int unicopa.copa.server.database.DatabaseService.getUserID ( String  userName) throws ObjectNotFoundException

Get the ID of a user.

Parameters
userNamethe user name of the user
Returns
the userID
Exceptions
ObjectNotFoundExceptionis thrown if the given user does not exist in the database
int unicopa.copa.server.database.DatabaseService.getUserIDByEmail ( String  email) throws ObjectNotFoundException

Get the ID of a user by his email address.

Parameters
emailthe email address of the user
Returns
the userID
Exceptions
ObjectNotFoundExceptionis thrown if the given email does not match to a entry in the database
String unicopa.copa.server.database.DatabaseService.getUserName ( int  userID) throws ObjectNotFoundException

Returns the userName to a given userID.

Parameters
userIDthe ID of the user
Returns
the userName
Exceptions
ObjectNotFoundExceptionis thrown if the given user does not exist in the database
UserRole unicopa.copa.server.database.DatabaseService.getUserRole ( int  userID) throws ObjectNotFoundException

Get the role a user holds in general.

This will be either UserRole.USER or UserRole.ADMINISTRATOR.

Parameters
userIDthe ID of the user
Returns
the role the user holds
Exceptions
ObjectNotFoundExceptionis thrown if the given user does not exist in the database
Map<UserRole, List<UserData> > unicopa.copa.server.database.DatabaseService.getUsersAppointedUsers ( int  userID) throws ObjectNotFoundException

Get all users a user gave higher roles to.

The map returned maps from DEPUTY and OWNER to the user data of the users who got this role.

Parameters
userIDthe ID of the user who gave the roles
Returns
the map with the userRole and the associated List of userIDs
Exceptions
ObjectNotFoundExceptionis thrown if the given user does not exist in the database
UserSettings unicopa.copa.server.database.DatabaseService.getUserSettings ( int  userID) throws ObjectNotFoundException

Get the user settings of the given user.

Parameters
userIDthe user-ID
Returns
the UserSettings for the user
Exceptions
ObjectNotFoundExceptionis thrown if the given user does not exist in the database
Map<UserRole, List<Integer> > unicopa.copa.server.database.DatabaseService.getUsersPriviligedEvents ( int  userID) throws ObjectNotFoundException

Get all events where a user holds higher roles.

The map returned maps from RIGHTHOLDER, DEPUTY and OWNER to the IDs of the events where the user hold this role.

Parameters
userIDthe ID of the user
Returns
the map with the userRole and the associated List of userIDs
Exceptions
ObjectNotFoundExceptionis thrown if the given user does not exist in the database
UserRole unicopa.copa.server.database.DatabaseService.getUsersRoleForEvent ( int  userID,
int  eventID 
) throws ObjectNotFoundException

Get the role a user holds for a specific event.

The roles will be checked and returned in the following order: UserRole.ADMINISTRATOR if the user holds this role in general, UserRole.RIGHTHOLER, UserRole.DEPUTY, UserRole.OWNER if the user holds the role for the specified event UserRole.User otherwise.

Parameters
userIDthe ID of the user
eventIDthe ID of the event
Returns
the role the user holds for the specified event
Exceptions
ObjectNotFoundExceptionis thrown if the given user or the event does not exist in the database
void unicopa.copa.server.database.DatabaseService.importEvents ( EventImportContainer  container) throws ObjectNotFoundException, IncorrectObjectException, ObjectAlreadyExsistsException

Clean the database (delete all EventGroups, SingleEvents, Events and dependent data except the dummy entries) and import the events given by an EventImportContainer.

Parameters
container
Exceptions
ObjectNotFoundException
IncorrectObjectException
ObjectAlreadyExsistsException
static void unicopa.copa.server.database.DatabaseService.initDB ( File  database) throws DatabaseUtil.ConnectException, FileNotFoundException, SQLException, IOException
static
Parameters
database
Exceptions
unicopa.copa.server.database.util.DatabaseUtil.ConnectException
FileNotFoundException
SQLException
IOException
void unicopa.copa.server.database.DatabaseService.insertCategoryTree ( CategoryNodeImpl  category,
int  parent 
) throws IncorrectObjectException, ObjectAlreadyExsistsException, ObjectNotFoundException

Inserts the given CategoryNodeImpl into the database, also all child CategoryNodeImpls will be inserted.

Parameters
categorythe root categoryNodeImpl of the categoryTree that should be inserted
parentshould be -1 is the inserted CategoryNodeImpl is the root node
Exceptions
IncorrectObjectExceptionis thrown if a given categoryNodeImpl is null
ObjectAlreadyExsistsExceptionis thrown if one of the categories already exists in the database
ObjectNotFoundExceptionis thrown if there is not Category in the database with ID=parent
int unicopa.copa.server.database.DatabaseService.insertEvent ( Event  event) throws ObjectNotFoundException, IncorrectObjectException

Inserts the given Event into the database.

It also inserts the EventhasCategories entries.

Parameters
event
Exceptions
ObjectNotFoundExceptionis thrown if one of the categoryIDs in the given event object does not exists in the database
IncorrectObjectExceptionis thrown it the given event object or the name in the event object is null
int unicopa.copa.server.database.DatabaseService.insertEventGroup ( EventGroup  eventGroup) throws ObjectNotFoundException, IncorrectObjectException

inserts the given EventGroup into the database, also inserts the eventGroupHasCategorys entries

Parameters
eventGroupreturns the eventGroup ID of the new inserted eventGroup
Exceptions
ObjectNotFoundExceptionis thrown if the given category does not exist in the database
IncorrectObjectExceptionis thrown if the category, the eventGroupInfo or the eventGroupName in the given eventGroup is null, or if one of the given strings is longer than the corresponding database attribute
void unicopa.copa.server.database.DatabaseService.insertPerson ( String  userName,
String  firstName,
String  familyName,
String  email,
String  titel,
String  language,
boolean  eMailNotification,
GeneralUserPermission  generalUserPermission 
) throws ObjectAlreadyExsistsException, IncorrectObjectException

Inserts a new Person into the database.

Parameters
userNamethe user name, must not be null, should be unique
firstNamethe first name, must not be null
familyNamethe family name, must not be null
emailthe E-Mail, must not be null, should be unique
titelthe title
languagethe language, default is english
eMailNotificationshould the person be notified per E-Mail
generalUserPermissionthe generalUserPermission, should not be null
Exceptions
ObjectAlreadyExsistsExceptionis thrown if there is already an entry with the same email or userName in the database
IncorrectObjectExceptionis thrown if the userName, the firstName, the familyName or the email is null
void unicopa.copa.server.database.DatabaseService.insertPossibleOwners ( int  eventID,
List< String >  possibleOwnerList 
) throws IncorrectObjectException, ObjectNotFoundException

Inserts the given list of names as possible owners for the event with the given id.

Parameters
eventID
possibleOwnerList
Exceptions
IncorrectObjectExceptionis thrown if one of the given strings has not the needed form
ObjectNotFoundExceptionis thrown if the given event does not exist in the database
void unicopa.copa.server.database.DatabaseService.insertPrivilege ( int  userID,
int  eventID,
int  kindOfPrivilege,
int  gavePrivilegeID,
Date  privDate 
) throws ObjectNotFoundException, IncorrectObjectException

inserts a privilege entry with the given parameters, if the given user has an privilege for that event, the old one is replaced by the new one

Parameters
userID
eventID
kindOfPrivilege
gavePrivilegeID
privDate
Exceptions
ObjectNotFoundExceptionis thrown if on of the given users or the given event does not exist in the database
IncorrectObjectExceptionis thrown if the given date is invalid
void unicopa.copa.server.database.DatabaseService.insertSingleEventUpdate ( SingleEventUpdate  singleEventUpdate) throws ObjectNotFoundException, IncorrectObjectException

Inserts the given singleEventUpdate into the database.

This includes the new SingleEvent that is given in singleEventUpdate. If oldSingleEventID = 0 then updatedSingleEvent is inserted as a new SingleEvent (). If the updatedSingleEvent = null, then the SingleEvent counts as canceled

Parameters
singleEventUpdate
Exceptions
ObjectNotFoundExceptionis thrown when there is no Event entry in the database with oldSingleEventID that is given in the singleEventUpdate object
IncorrectObjectExceptionis thrown if the given singleEventUpdate or the updateDate object is null
boolean unicopa.copa.server.database.DatabaseService.isAppointedBy ( int  userID,
int  appointedByUserID,
int  eventID,
UserRole  role 
) throws ObjectNotFoundException, IncorrectObjectException

Check whether a user is appointed by another user with a special role at a specific event.

Parameters
userIDthe ID of the user who to check to be appointed
appointedByUserIDthe ID of the user who appointed
eventIDthe ID of the event
rolethe role the appointed user should have
Returns
true if the user granted the privilege to the user for the given event, else false
Exceptions
IncorrectObjectExceptionis thrown if the given userRole is invalid
ObjectNotFoundExceptionis thrown if the given user does not exist in the database
List<Integer> unicopa.copa.server.database.DatabaseService.matchOwners ( int  userID) throws ObjectNotFoundException

Try to match the given user as an owner to events by using the possible owners list the events were imported with.

Parameters
userID
Exceptions
IncorrectObjectException
ObjectNotFoundExceptionis thrown if the given user does not exist in the database
Map<Integer, List<Integer> > unicopa.copa.server.database.DatabaseService.matchOwners ( )

Try to find users to be owners for each event by using the possible owners list the events were imported with.

Returns
returns a map<userID,List<eventID>> with all userIDs that were set as owner for all events in the corresponding list
void unicopa.copa.server.database.DatabaseService.removeAdministrator ( int  userID) throws ObjectNotFoundException

removes the admin privilege of the given User

Parameters
userID
Exceptions
ObjectNotFoundExceptionis thrown if the given user does not exist in the database
void unicopa.copa.server.database.DatabaseService.removePrivilege ( int  userID,
int  eventID 
) throws ObjectNotFoundException

Removes the Privilege from the user with ID=userID for the event with ID=evenID.

Parameters
userIDthe ID of the user
eventIDthe ID of the event
Exceptions
ObjectNotFoundExceptionis thrown if the given user, or the given event does not exist in the database
void unicopa.copa.server.database.DatabaseService.setUserRoleForEvent ( int  userID,
int  eventID,
UserRole  role,
int  gavePrivilegeID 
) throws IncorrectObjectException, ObjectNotFoundException

Set the role of a user for a specific event.

Parameters
userIDthe ID of the user
evenIDthe ID of the event where to set the role for the user
rolethe role to set
gavePrivilegeIDthe ID of the user that permitted the privilege
Exceptions
IncorrectObjectExceptionis thrown if the given userRole is invalid
ObjectNotFoundExceptionis thrown if one of the given users or the event does not exist in the database
void unicopa.copa.server.database.DatabaseService.updateUserSetting ( UserSettings  userSetting,
int  userID 
) throws ObjectNotFoundException, IncorrectObjectException, ObjectAlreadyExsistsException

Update the UserSettings of the User with ID = userID.

Parameters
userSettingthe new UserSettings
userIDthe userID
Exceptions
ObjectNotFoundExceptionis thrown if the given user does not exist in the database
IncorrectObjectExceptionis thrown if the given userSettings is null, the colorCode in the given UserSettings is invalid or the gCMKey in the given UserSettings is invalid
ObjectAlreadyExsistsExceptionis thrown if there already is another user with the given gCMKey in the database

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