fi.paatti.paattidatabaseutils.dbservice
Interface PaattiResearchDBService

All Known Implementing Classes:
PaattiDBService

public interface PaattiResearchDBService

The research interface for the database.

Author:
Lauri Satokangas, lauri.n.satokangas@student.jyu.fi, Tapio Keränen, t.tapio.keranen@student.jyu.fi
 

Method Summary
 boolean addScheduleToGroup(Object groupID, Object scheduleID)
          Adds the schedule to the group.
 boolean addUserToGroup(Object groupId, Object userId)
          Adds the user to the group.
 Object createGroup(String name, String description, Object role, Object research, int editor, Object groupID)
          Saves the group's information to the database.
 Object createResearch(String name, String description, Object researchID)
          Saves the research's information to the database.
 Object createSchedule(String description, Date zeroTime, Object scheduleID, com.vaadin.data.util.IndexedContainer scheduledEvents)
          Creates a new schedule.
 Object createUser(Object userId, String userName, String firstName, String lastName, String userPassword, String userDescription)
          Saves user's information to the database.
 Object getCellValueFromTable(String tableName, String columnName, String idColumn, Object rowId)
          Returns the value of the given column.
 com.vaadin.data.util.sqlcontainer.SQLContainer getChoiceContainer(Object eventId)
          Returns all the choices that belong to the event with the given id.
 ChoiceContainer getChoiceContainerWithListener(Object eventId)
          Returns the ChoiceContainer containing all the choices from the given event.
 com.vaadin.data.util.sqlcontainer.SQLContainer getEventsInSchedule(Object scheduleId)
          Returns all the events that belong to the schedule with the given id.
 com.vaadin.data.util.sqlcontainer.SQLContainer getGroupResearch(Object groupId)
          Returns all the researches that belong to the group with the given id.
 com.vaadin.data.util.sqlcontainer.SQLContainer getGroupRole(Object groupId)
          Returns the role of the given group.
 com.vaadin.data.util.sqlcontainer.SQLContainer getGroupSchedules(Object groupId)
          Returns all the schedules that belong to the group with the given id.
 com.vaadin.data.util.sqlcontainer.SQLContainer getGroupUsers(Object groupId)
          Returns all the users that belong to the group with the given id.
 com.vaadin.data.util.sqlcontainer.SQLContainer getResearchGroups(Object researchId)
          Returns all the groups that belong to the research with the given id.
 com.vaadin.data.util.sqlcontainer.SQLContainer getSQLContainerFromDBTable(String tableName, String nameOfIdColumn, boolean noDeletedRows)
          Returns the SQLContainer for the given database table.
 com.vaadin.data.util.sqlcontainer.SQLContainer getSQLContainerFromDBTableFiltered(String tableName, String nameOfIdColumn, boolean noDeletedRows, com.vaadin.data.Container.Filter filter)
          Returns the SQLContainer for the given database table.
 com.vaadin.data.util.sqlcontainer.SQLContainer getTaskContainer(Object eventId)
          Returns all the tasks that belong to the event with the given id.
 TaskContainer getTaskContainerWithListener(Object eventId)
          Returns the TaskContainer containing all the tasks from the given event.
 com.vaadin.data.util.sqlcontainer.SQLContainer getUserEventData(Object userId)
          Returns all the event data that belongs to the user with the given id.
 com.vaadin.data.util.sqlcontainer.SQLContainer getUserGroups(Object userId)
          Returns all the groups that belong to the user with the given id.
 com.vaadin.data.util.sqlcontainer.SQLContainer getUserGroupsdRolesAndResearches(Integer userID)
          Returns the roles and researches of the user's groups.
 boolean removeRowFromTable(Object itemID, String tableName, String idColumnName)
          Removes the row from the table.
 boolean removeUserFromGroup(Object groupId, Object userId)
          Removes the user from the group.
 

Method Detail

getSQLContainerFromDBTable

com.vaadin.data.util.sqlcontainer.SQLContainer getSQLContainerFromDBTable(String tableName,
                                                                          String nameOfIdColumn,
                                                                          boolean noDeletedRows)
Returns the SQLContainer for the given database table.

SHOULD NOT BE USED FOR DELETING ROWS! (instead, just change the row status to 'DELETED'.

Parameters:
tableName - the name of the table.
nameOfIdColumn - the name of the id column.
noDeletedRows - whether to filter deleted rows or not.
Returns:
SQLContainer containing the items from the given table.

getSQLContainerFromDBTableFiltered

com.vaadin.data.util.sqlcontainer.SQLContainer getSQLContainerFromDBTableFiltered(String tableName,
                                                                                  String nameOfIdColumn,
                                                                                  boolean noDeletedRows,
                                                                                  com.vaadin.data.Container.Filter filter)
Returns the SQLContainer for the given database table. The given filter (if any) will be applied to the SQLContainer to exclude rows from the results.

SHOULD NOT BE USED FOR DELETING ROWS! (instead, just change the row status to 'DELETED'.

Parameters:
tableName - the name of the table.
nameOfIdColumn - the name of the id column.
noDeletedRows - whether to include "DELETED" rows or not.
filter - the filter to be used.
Returns:
SQLContainer containing the filtered items from the given table.

getGroupUsers

com.vaadin.data.util.sqlcontainer.SQLContainer getGroupUsers(Object groupId)
Returns all the users that belong to the group with the given id.

Parameters:
groupId - the group's id.
Returns:
SQLContainer containing the members of the group.

getGroupSchedules

com.vaadin.data.util.sqlcontainer.SQLContainer getGroupSchedules(Object groupId)
Returns all the schedules that belong to the group with the given id.

Parameters:
groupId - the group's id.
Returns:
SQLContainer containing the schedules of the group.

getGroupResearch

com.vaadin.data.util.sqlcontainer.SQLContainer getGroupResearch(Object groupId)
Returns all the researches that belong to the group with the given id.

Parameters:
groupId - the group's id.
Returns:
SQLContainer containing all the researches of the group.

getResearchGroups

com.vaadin.data.util.sqlcontainer.SQLContainer getResearchGroups(Object researchId)
Returns all the groups that belong to the research with the given id.

Parameters:
researchId - the research's id.
Returns:
SQLContainer containing all the groups of the research.

getUserGroups

com.vaadin.data.util.sqlcontainer.SQLContainer getUserGroups(Object userId)
Returns all the groups that belong to the user with the given id.

Parameters:
userId - the user's id.
Returns:
SQLContainer containing all groups of the user.

getUserEventData

com.vaadin.data.util.sqlcontainer.SQLContainer getUserEventData(Object userId)
Returns all the event data that belongs to the user with the given id.

Parameters:
userId - the user's id.
Returns:
SQLContainer containing all the event data of the user.

getEventsInSchedule

com.vaadin.data.util.sqlcontainer.SQLContainer getEventsInSchedule(Object scheduleId)
Returns all the events that belong to the schedule with the given id.

Parameters:
scheduleId - the schedule's id.
Returns:
SQLContainer containing all the events of the schedule.

getChoiceContainer

com.vaadin.data.util.sqlcontainer.SQLContainer getChoiceContainer(Object eventId)
Returns all the choices that belong to the event with the given id.

Parameters:
eventId - the event's id.
Returns:
SQLContainer containing all the choices of the event.

getTaskContainer

com.vaadin.data.util.sqlcontainer.SQLContainer getTaskContainer(Object eventId)
Returns all the tasks that belong to the event with the given id.

Parameters:
eventId - the event's id.
Returns:
SQLContainer containing all the tasks of the event.

createUser

Object createUser(Object userId,
                  String userName,
                  String firstName,
                  String lastName,
                  String userPassword,
                  String userDescription)
Saves user's information to the database. If the user with the given id already exists in the database, the existing name and description values are replaced. If no user was found, a new row is created to the database with the given values.

Parameters:
userId - the id of the user.
userName - the user name of the user.
firstName - the first name of the user.
lastName - the last name of the user.
userPassword - the password of the user.
userDescription - the description of the user.
Returns:
True if successful and no exception was thrown, otherwise false.

removeRowFromTable

boolean removeRowFromTable(Object itemID,
                           String tableName,
                           String idColumnName)
Removes the row from the table. Removing means setting the row's row status to 'DELETED'.

Parameters:
itemID - the id of the row to be removed.
tableName - the name of the table containing the row
idColumnName - the id column of the table
Returns:
True if successful and no exception was thrown, otherwise false.

createResearch

Object createResearch(String name,
                      String description,
                      Object researchID)
Saves the research's information to the database. If the research with the given id already exists in the database, the existing name and description values are replaced. If no research was found, a new row is created to the database with the given values.

Parameters:
name - the name of the research.
description - the description of the research.
researchID - the id of the research.
Returns:
RowId if successful and no exception was thrown; otherwise null.

createGroup

Object createGroup(String name,
                   String description,
                   Object role,
                   Object research,
                   int editor,
                   Object groupID)
Saves the group's information to the database. If a group with the given id already exists in the database, the existing name, description, role, and editor values are replaced. If no group was found, a new row is created to the database with the given values.

Parameters:
name - the name of ther group.
description - the description of the group.
role - the role of the group.
research - the id of the research this group belong to.
editor - the id of the editor.
groupID - the id of the group.
Returns:
RowId if successful and no exception was thrown, otherwise null.

getCellValueFromTable

Object getCellValueFromTable(String tableName,
                             String columnName,
                             String idColumn,
                             Object rowId)
Returns the value of the given column.

Parameters:
tableName - the name of the table the column belongs to.
columnName - the name of the column.
idColumn - the ID column of the table.
rowId - the ID of the row where the value will be taken from.
Returns:
The found value or null if none found.

addUserToGroup

boolean addUserToGroup(Object groupId,
                       Object userId)
Adds the user to the group. If the user already belongs to the group, the rowstatus of the BELONGS table is set to 'ACTIVE'. If no row is found in the table, a new row is created with the given values.

Parameters:
groupId - the id of the group
userId - the id of the user
Returns:
True if successful and no exception was thrown, otherwise false.

removeUserFromGroup

boolean removeUserFromGroup(Object groupId,
                            Object userId)
Removes the user from the group. Removing the user from the group means setting the row status in BELONGS table to 'DELETED'.

Parameters:
groupId - the ID of the user's group.
userId - the ID of the user.
Returns:
True if successful, otherwise false.

createSchedule

Object createSchedule(String description,
                      Date zeroTime,
                      Object scheduleID,
                      com.vaadin.data.util.IndexedContainer scheduledEvents)
Creates a new schedule.

Parameters:
description - the description of the schedule.
zeroTime - the start date of the schedule.
scheduleID - the id of the schedule.
scheduledEvents - the list of events that belong to the schedule.
Returns:
The row id of the schedule if successful, otherwise null.

addScheduleToGroup

boolean addScheduleToGroup(Object groupID,
                           Object scheduleID)
Adds the schedule to the group.

Parameters:
groupID - the id of the group.
scheduleID - the id of the schedule.
Returns:
True if succesful and no exception was thrown, otherwise false.

getTaskContainerWithListener

TaskContainer getTaskContainerWithListener(Object eventId)
Returns the TaskContainer containing all the tasks from the given event. The TaskContainer is an extended version of SQLContainer. A listener can be added to it for getting the new row ID after a successful insertion to the database.

Parameters:
eventId - the ID of the event.
Returns:
All the tasks of the event.

getChoiceContainerWithListener

ChoiceContainer getChoiceContainerWithListener(Object eventId)
Returns the ChoiceContainer containing all the choices from the given event. The ChoiceContainer is an extended version of SQLContainer. A listener can be added to it for getting the new row ID after a successful insertion to the database.

Parameters:
eventId - the ID of the event.
Returns:
All the choices of the event.

getUserGroupsdRolesAndResearches

com.vaadin.data.util.sqlcontainer.SQLContainer getUserGroupsdRolesAndResearches(Integer userID)
Returns the roles and researches of the user's groups. These properties can be accessed with the values from PaattiColumnNames.

Parameters:
userID - the ID of the user.
Returns:
The SQLContainer containing the user's role and research info.

getGroupRole

com.vaadin.data.util.sqlcontainer.SQLContainer getGroupRole(Object groupId)
Returns the role of the given group.

Parameters:
groupId - the id of the group.
Returns:
The SQLContainer containing the group's role info.


Copyright © 2012. All Rights Reserved.