The database service provides an interface to the database. More...
Public Member Functions | |
DatabaseService (File database, String username, String password) throws IOException | |
Create a new database service. More... | |
DatabaseService (File database) throws IOException | |
List< EventGroup > | getEventGroups (int categoryNodeID, String searchTerm) throws ObjectNotFoundException |
Get all event groups that match a given category and a search string. More... | |
List< Event > | getEvents (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< SingleEventUpdate > | 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. More... | |
List< SingleEventUpdate > | getSingleEventUpdates (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< SingleEvent > | 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. 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< ServerStatusNote > | getServerStatusNote (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 |
The database service provides an interface to the database.
It allows to obtain objects from and write objects to the database.
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()'.
database | |
username | |
password |
IOException |
void unicopa.copa.server.database.DatabaseService.addAdministrator | ( | int | userID) | throws ObjectNotFoundException |
gives the given user the admin privilege
userID |
ObjectNotFoundException | is 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.
note |
IncorrectObjectException | is 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.
colorCode |
IncorrectObjectException | is 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.
IncorrectObjectException | |
ObjectNotFoundException |
CategoryNodeImpl unicopa.copa.server.database.DatabaseService.getCategoryTree | ( | int | categoryID) | throws ObjectNotFoundException |
Get the categoryNodeImpl with ID=categoryID.
categoryID | the ID of the category |
ObjectNotFoundException | is 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.
eventID | the ID of the event where to get the current SingleEvents from |
since | the date since when SingleEvents should be returned |
ObjectNotFoundException | is thrown if the given event does not exist in the database |
IncorrectObjectException | is 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.
eventID | the ID of the event |
appointedByUserID | the ID of the user that appointed the deputies to be returned, '-1' means all users |
ObjectNotFoundException | is 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.
eventID | the ID of the event |
ObjectNotFoundException | is 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.
userID | the user-ID |
ObjectNotFoundException | is 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.
eventID | the ID of the event. |
ObjectNotFoundException | is 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.
eventGroupID | the ID of the eventGroup. |
ObjectNotFoundException | is 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.
categoryNodeID | the ID of the category node in the category tree whose subtree must contain a category node of the event group |
searchTerm | the exact string the name of the event group must contain |
ObjectNotFoundException | is 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.
eventGroupID | the ID of the event group to get the events from |
categoryNodeID | the ID of the category node in the category tree whose subtree must contain a category node of the event |
ObjectNotFoundException | is 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.
userID |
ObjectNotFoundException | is 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.
eventID | the ID of the event |
ObjectNotFoundException | is 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.
eventID |
ObjectNotFoundException | is 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.
eventID | the ID of the event |
appointedByUserID | the ID of the user that appointed the rightholders to be returned, '-1' means all users |
ObjectNotFoundException | is 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.
eventID | the ID of the event |
ObjectNotFoundException | is 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.
since |
IncorrectObjectException | if the given date is null |
SingleEvent unicopa.copa.server.database.DatabaseService.getSingleEvent | ( | int | id) | throws ObjectNotFoundException |
Get the SingleEvent.
id | the ID of the SingleEvent |
ObjectNotFoundException | is 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.
eventID | the ID of the event where to get updates from |
since | the data from when to return updates |
ObjectNotFoundException | is thrown if the given event does not exist in the database |
IncorrectObjectException | is 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.
since | the data from when to return updates |
userID | the ID of the user |
ObjectNotFoundException | is thrown if the given user does not exist in the database |
IncorrectObjectException | is 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.
eventID | the event ID for the event the users should have subscribed to. |
ObjectNotFoundException | is 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.
familyName | |
generalUserPermission |
IncorrectObjectException | is 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.
userID | the ID of the user |
ObjectNotFoundException | is 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.
userName | the user name of the user |
ObjectNotFoundException | is 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.
the email address of the user |
ObjectNotFoundException | is 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.
userID | the ID of the user |
ObjectNotFoundException | is 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.
userID | the ID of the user |
ObjectNotFoundException | is 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.
userID | the ID of the user who gave the roles |
ObjectNotFoundException | is 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.
userID | the user-ID |
ObjectNotFoundException | is 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.
userID | the ID of the user |
ObjectNotFoundException | is 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.
userID | the ID of the user |
eventID | the ID of the event |
ObjectNotFoundException | is 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.
container |
|
static |
database |
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.
category | the root categoryNodeImpl of the categoryTree that should be inserted |
parent | should be -1 is the inserted CategoryNodeImpl is the root node |
IncorrectObjectException | is thrown if a given categoryNodeImpl is null |
ObjectAlreadyExsistsException | is thrown if one of the categories already exists in the database |
ObjectNotFoundException | is 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.
event |
ObjectNotFoundException | is thrown if one of the categoryIDs in the given event object does not exists in the database |
IncorrectObjectException | is 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
eventGroup | returns the eventGroup ID of the new inserted eventGroup |
ObjectNotFoundException | is thrown if the given category does not exist in the database |
IncorrectObjectException | is 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.
userName | the user name, must not be null, should be unique |
firstName | the first name, must not be null |
familyName | the family name, must not be null |
the E-Mail, must not be null, should be unique | |
titel | the title |
language | the language, default is english |
eMailNotification | should the person be notified per E-Mail |
generalUserPermission | the generalUserPermission, should not be null |
ObjectAlreadyExsistsException | is thrown if there is already an entry with the same email or userName in the database |
IncorrectObjectException | is 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.
eventID | |
possibleOwnerList |
IncorrectObjectException | is thrown if one of the given strings has not the needed form |
ObjectNotFoundException | is 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
userID | |
eventID | |
kindOfPrivilege | |
gavePrivilegeID | |
privDate |
ObjectNotFoundException | is thrown if on of the given users or the given event does not exist in the database |
IncorrectObjectException | is 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
singleEventUpdate |
ObjectNotFoundException | is thrown when there is no Event entry in the database with oldSingleEventID that is given in the singleEventUpdate object |
IncorrectObjectException | is 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.
userID | the ID of the user who to check to be appointed |
appointedByUserID | the ID of the user who appointed |
eventID | the ID of the event |
role | the role the appointed user should have |
IncorrectObjectException | is thrown if the given userRole is invalid |
ObjectNotFoundException | is 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.
userID |
IncorrectObjectException | |
ObjectNotFoundException | is 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.
void unicopa.copa.server.database.DatabaseService.removeAdministrator | ( | int | userID) | throws ObjectNotFoundException |
removes the admin privilege of the given User
userID |
ObjectNotFoundException | is 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.
userID | the ID of the user |
eventID | the ID of the event |
ObjectNotFoundException | is 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.
userID | the ID of the user |
evenID | the ID of the event where to set the role for the user |
role | the role to set |
gavePrivilegeID | the ID of the user that permitted the privilege |
IncorrectObjectException | is thrown if the given userRole is invalid |
ObjectNotFoundException | is 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.
userSetting | the new UserSettings |
userID | the userID |
ObjectNotFoundException | is thrown if the given user does not exist in the database |
IncorrectObjectException | is thrown if the given userSettings is null, the colorCode in the given UserSettings is invalid or the gCMKey in the given UserSettings is invalid |
ObjectAlreadyExsistsException | is thrown if there already is another user with the given gCMKey in the database |