kolibribeans
Class BookTime

java.lang.Object
  |
  +--kolibribeans.BookTime

public class BookTime
extends java.lang.Object

implements BookTime object.


Field Summary
static int CAL_ADDITION
           
static int CAL_FIRST_HOUR
           
static int CAL_LAST_HOUR
           
static int RESERVE_BEFORE
           
static int RESERVE_INTERVAL
           
static int RESERVE_MSG
           
static int RESERVE_SPACE
           
static int RESERVE_URL
           
 
Constructor Summary
BookTime()
          Dummy empty constructor.
 
Method Summary
 void addEventMessage(int eventID, int personID, java.lang.String title, java.lang.String message)
          Insert new message for given event
 boolean allowParticipant(int eventid)
          Exceute query to find out if given person can join the event
 boolean beforeToday(int eventID)
          Find out wether the event is before the current day or after.
 boolean bookEvent(int eventID, int personID, int groupID)
          Book event for the group given in parameters
 boolean bookEvent(int eventID, int personID, int groupID, User user)
           
 void copyEvents(int personID, java.util.Calendar dateBegin, java.util.Calendar dateEnd, java.util.Calendar dateTo)
          Copies bookable times from given interval to given date (+ the same interval).
 java.lang.String countValidUntilTime(int eventid, java.lang.String difference)
           
 java.lang.String countValidUntilTime(java.lang.String begintime, java.lang.String difference)
           
 boolean hasValidTime(int eventID)
          Find out wether the event is before the current day or after.
 int insertNewEvent(int groupID, java.lang.String begin, java.lang.String end, java.lang.String name, java.lang.String msg)
          Insert new event participant into database.
 int insertNewEventGroup(java.lang.String name, java.lang.String validuntil)
          Insert new event group into database.
 void insertNewEventSpace(int eventID, int spaceID)
          Insert new event participant into database.
 boolean insertNewParticipant(int personID, int groupID, int roleID)
          Insert new event participant into database.
 int insertPlace(java.lang.String place)
          Check if the given space name exists in the database.
 int isAllowedBookable(int personID, java.lang.String begintime, java.lang.String endtime)
          Check if the user has events during specified time.
 boolean isBookableEvent(int eventID)
          Check if the user can book the event
 boolean isBookTimeEvent(int eventID)
          Find out if given id represents a bookable event
 boolean isOwnerOfEvent(int personid, int eventid)
          Exceute query to find out if given person own's the event
 boolean isParticipantOfEvent(int personid, int eventid)
          Exceute query to find out if given person is participant of the event
 void listAllSupervisorsEvents(int eventID)
          List all events that are held by the same supervisor on givenevent's day.
 void listAllSupervisorsEvents(javax.servlet.jsp.JspWriter out, int eventID)
           
 void listCourses(int personid, int defaultid, int languageid)
          List all courses that are related to user
 void listCourses(javax.servlet.jsp.JspWriter out, int personid, int defaultid, int languageid)
           
 void listMessages(int eventid)
          List all messages that are related to givent event
 void listMessages(javax.servlet.jsp.JspWriter out, int eventid)
           
 void listParticipants(int eventid, int personID)
          List students that are related to givent event
 void listParticipants(javax.servlet.jsp.JspWriter out, int eventid, int personID)
           
 void listPeople(javax.servlet.jsp.JspWriter out, java.lang.String cond, int def)
          List the users of KOTKA system whose name matches condition.
 void listSupervisors(int personid, int courseid, int defaultid)
          List all supervisor that are related to user's courses or assignments
 void listSupervisors(javax.servlet.jsp.JspWriter out, int personid, int courseid, int defaultid)
           
 void removeEvent(int eventID)
          Mark event to be deleted from database
 void removeParticipationOfEvent(int eventID, int personID)
          Mark person's participation as deleted.
 boolean sendEventMessage(int eventID, java.lang.String title, java.lang.String message, boolean addEventInfo, boolean sendToAll, int personID)
          Send mail to event related person
 boolean sendEventMessage(int eventID, java.lang.String title, java.lang.String message, boolean addEventInfo, boolean sendToAll, int personID, java.lang.String noticebrdMsg, java.lang.String noticebrdUri, java.lang.String noticeUriText)
           
 void setOut(javax.servlet.jsp.JspWriter o)
           
 void setPersonParameter(int personID, java.lang.String value, int typeID)
          Set personal parameters for user.
 void setUser(User u)
           
 void updateEvent(int eventid, java.lang.String placeName, java.lang.String validUntil, java.lang.String info)
           
 void updateEvent(int eventID, java.lang.String title, java.lang.String info, java.lang.String placename, java.lang.String begintime, java.lang.String endtime, java.lang.String validuntil)
          Update event related information
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESERVE_BEFORE

public static int RESERVE_BEFORE

RESERVE_SPACE

public static int RESERVE_SPACE

RESERVE_URL

public static int RESERVE_URL

RESERVE_MSG

public static int RESERVE_MSG

RESERVE_INTERVAL

public static int RESERVE_INTERVAL

CAL_LAST_HOUR

public static int CAL_LAST_HOUR

CAL_FIRST_HOUR

public static int CAL_FIRST_HOUR

CAL_ADDITION

public static int CAL_ADDITION
Constructor Detail

BookTime

public BookTime()
Dummy empty constructor.

Method Detail

setUser

public void setUser(User u)

setOut

public void setOut(javax.servlet.jsp.JspWriter o)

isOwnerOfEvent

public boolean isOwnerOfEvent(int personid,
                              int eventid)
Exceute query to find out if given person own's the event

Parameters:
personid - The person we are interested in
eventid - The event we are interested in

isParticipantOfEvent

public boolean isParticipantOfEvent(int personid,
                                    int eventid)
Exceute query to find out if given person is participant of the event

Parameters:
personid - The person we are interested in
eventid - The event we are interested in

allowParticipant

public boolean allowParticipant(int eventid)
Exceute query to find out if given person can join the event

Parameters:
eventid - The event we are interested in

listCourses

public void listCourses(int personid,
                        int defaultid,
                        int languageid)
List all courses that are related to user

Parameters:
personid - The person we are interested in
defaultid - The course that is elected by default
languageid - The language to be used in listing

listCourses

public void listCourses(javax.servlet.jsp.JspWriter out,
                        int personid,
                        int defaultid,
                        int languageid)

listSupervisors

public void listSupervisors(int personid,
                            int courseid,
                            int defaultid)
List all supervisor that are related to user's courses or assignments

Parameters:
personid - The person we are interested in
courseid - The course in wicth we seek for supervisors, -1 meaning all
defaultid - The supervisor's id that is elected by default

listSupervisors

public void listSupervisors(javax.servlet.jsp.JspWriter out,
                            int personid,
                            int courseid,
                            int defaultid)

listParticipants

public void listParticipants(int eventid,
                             int personID)
List students that are related to givent event

Parameters:
eventid - The event we are interested in

listParticipants

public void listParticipants(javax.servlet.jsp.JspWriter out,
                             int eventid,
                             int personID)

listMessages

public void listMessages(int eventid)
List all messages that are related to givent event

Parameters:
eventid - The event we are interested in

listMessages

public void listMessages(javax.servlet.jsp.JspWriter out,
                         int eventid)

listAllSupervisorsEvents

public void listAllSupervisorsEvents(int eventID)
List all events that are held by the same supervisor on givenevent's day.


listAllSupervisorsEvents

public void listAllSupervisorsEvents(javax.servlet.jsp.JspWriter out,
                                     int eventID)

listPeople

public void listPeople(javax.servlet.jsp.JspWriter out,
                       java.lang.String cond,
                       int def)
List the users of KOTKA system whose name matches condition.

Parameters:
out - The output stream to use.
cond - The condition for the people.
def - The if of the user who is printed as default.

isBookableEvent

public boolean isBookableEvent(int eventID)
Check if the user can book the event

Parameters:
eventID - The event to be booked
Returns:
if booking of event is approvable

isAllowedBookable

public int isAllowedBookable(int personID,
                             java.lang.String begintime,
                             java.lang.String endtime)
Check if the user has events during specified time. If event's priority is higher than normal (1), then return false. If no events or only normal priority events exist, then return true. Booakble event is regarded as high priority.

Parameters:
personID - The person whose event's are to be
begintime - The lower bound in Db format yyyy-mm-dd hh:mm
endtime - The upper bound in DB format yyyy-mm-dd hh:mm
Returns:
the eventid that conflicts, if insert of event is approvable

insertPlace

public int insertPlace(java.lang.String place)
Check if the given space name exists in the database. Add if it doesn't exist.

Parameters:
place - The space name
Returns:
place's id (created or existing)

insertNewEventGroup

public int insertNewEventGroup(java.lang.String name,
                               java.lang.String validuntil)
Insert new event group into database.

Parameters:
name - The event group's name
validuntil - The event group's last vallid date as string, yyyy-mm-dd
Returns:
group's id (created)

insertNewParticipant

public boolean insertNewParticipant(int personID,
                                    int groupID,
                                    int roleID)
Insert new event participant into database. If the user already exists if given eventgroup, no harm is done.

Parameters:
personID - The participant's id
groupID - The group to participate
roleID - The role of participant

insertNewEvent

public int insertNewEvent(int groupID,
                          java.lang.String begin,
                          java.lang.String end,
                          java.lang.String name,
                          java.lang.String msg)
Insert new event participant into database.

Parameters:
groupID - The group to witch event is assosiated
begin - The timestamp of event's begin time
end - The timestamp of event's end time
name - The title for the event
msg - The message for the event

insertNewEventSpace

public void insertNewEventSpace(int eventID,
                                int spaceID)
Insert new event participant into database.

Parameters:
eventID - The event's id
spaceID - The spaces id

addEventMessage

public void addEventMessage(int eventID,
                            int personID,
                            java.lang.String title,
                            java.lang.String message)
Insert new message for given event

Parameters:
eventID - The event's id
personID - The registrator of message
title - The event's title
message - The actual message

removeEvent

public void removeEvent(int eventID)
Mark event to be deleted from database

Parameters:
eventID - The event to be removed

removeParticipationOfEvent

public void removeParticipationOfEvent(int eventID,
                                       int personID)
Mark person's participation as deleted. With negative personid's remove all participants (except the creator). Updates the number of real participants to event table, too.

Parameters:
eventID - The event from witch to be removed
personID - The person to be removed

updateEvent

public void updateEvent(int eventID,
                        java.lang.String title,
                        java.lang.String info,
                        java.lang.String placename,
                        java.lang.String begintime,
                        java.lang.String endtime,
                        java.lang.String validuntil)
Update event related information

Parameters:
eventID - The event to be updated
title - New title to be set
info - New description to be set
placename - New placename to be set

updateEvent

public void updateEvent(int eventid,
                        java.lang.String placeName,
                        java.lang.String validUntil,
                        java.lang.String info)

bookEvent

public boolean bookEvent(int eventID,
                         int personID,
                         int groupID)
Book event for the group given in parameters

Parameters:
eventID - The event to be booked
personID - The event to be booked
groupID - The event to be booked
Returns:
if booking of event was successful

bookEvent

public boolean bookEvent(int eventID,
                         int personID,
                         int groupID,
                         User user)

setPersonParameter

public void setPersonParameter(int personID,
                               java.lang.String value,
                               int typeID)
Set personal parameters for user. If teh user has the same type parameter then update existing one. Assume, that the value is already in correct syntax.

Parameters:
personID - The person whose parameters we'll update
value - New value
typeID - The type of value

isBookTimeEvent

public boolean isBookTimeEvent(int eventID)
Find out if given id represents a bookable event

Parameters:
eventID - The event witch we are interested in.
Returns:
true if the event is bookable.

sendEventMessage

public boolean sendEventMessage(int eventID,
                                java.lang.String title,
                                java.lang.String message,
                                boolean addEventInfo,
                                boolean sendToAll,
                                int personID)
Send mail to event related person

Parameters:
eventID - The event witch we are interested in.
title - The title of the message.
message - The body of email message.
addEventInfo - Decides wether to add event related info to the bottom of the mail.
sendToAll - Decides wether to send the message to all event participants or just to a single person.
personID - The person to be handled.
Returns:
true if the event is bookable.

sendEventMessage

public boolean sendEventMessage(int eventID,
                                java.lang.String title,
                                java.lang.String message,
                                boolean addEventInfo,
                                boolean sendToAll,
                                int personID,
                                java.lang.String noticebrdMsg,
                                java.lang.String noticebrdUri,
                                java.lang.String noticeUriText)

beforeToday

public boolean beforeToday(int eventID)
Find out wether the event is before the current day or after.

Parameters:
eventID - The event witch we are interested in.
Returns:
true if the event is before current day.

hasValidTime

public boolean hasValidTime(int eventID)
Find out wether the event is before the current day or after.

Parameters:
eventID - The event witch we are interested in.
Returns:
true if today is before events validUntil date

copyEvents

public void copyEvents(int personID,
                       java.util.Calendar dateBegin,
                       java.util.Calendar dateEnd,
                       java.util.Calendar dateTo)
Copies bookable times from given interval to given date (+ the same interval). The intervals are allowed to cross.

Parameters:
personID - The person whose events will bo copied
dateBegin - The start day of copy interval.
dateEnd - The end date of copy interval.
dateTo - The date to witch the bookable times will be copied. The interval is as wide as the time between dateBegin and dateEnd.

countValidUntilTime

public java.lang.String countValidUntilTime(int eventid,
                                            java.lang.String difference)

countValidUntilTime

public java.lang.String countValidUntilTime(java.lang.String begintime,
                                            java.lang.String difference)