kotkabeans
Class EmailList

java.lang.Object
  |
  +--kotkabeans.EmailList

public class EmailList
extends java.lang.Object

This bean makes queries to database to maintain information related to course(instances)'s email lists.


Field Summary
static int ARCHIVE_LABEL_ID
           
static int ARCHIVE_LANGUAGE_ID
           
static int ARCHIVE_LINK_ID
           
static int ARCHIVE_NAME_ID
           
static int ARCHIVE_NO
           
static int ARCHIVE_OPTION_ID
           
static int ARCHIVE_PUBLIC
           
static int ARCHIVE_PUBLIC_OLD
           
static int ARCHIVE_SECRET
           
static int ARCHIVE_SECRET_OLD
           
static int ARCHIVE_TYPE_ID
           
static int COURSELIST
           
static int COURSEMODE
           
static int GROUPLIST
           
static int KOLIBRIMODE
           
static int MAX_LENGTH
           
static int MIN_LENGTH
           
static int PUBLICMODE
           
 
Constructor Summary
EmailList()
           
EmailList(User user, javax.servlet.jsp.JspWriter out)
          Constructs EventList object
 
Method Summary
 void addAllCourseParticipants(int listid)
           
 void addAllCourseParticipants(int listid, java.lang.String restriction)
           
 void addAllGroupParticipants(int listid, java.lang.String groups)
           
 void addAllGroupParticipants(int listid, java.lang.String groups, boolean ignoreCourse, java.lang.String restriction)
           
 void addAllGroupParticipants(int listid, java.lang.String groups, java.lang.String restriction)
           
 boolean addExtrasToMailingList(int listid, java.lang.String person, java.lang.String address, java.lang.String dist, java.lang.String accept)
          Add a name and address to mailing list
 int addNew(java.lang.String name, int nameSpace, int oid, java.lang.String owner, java.lang.String allowexit, java.lang.String allowattach, java.lang.String allowhtml, java.lang.String allowapp, java.lang.String savemail, java.lang.String description, java.lang.String signature, java.lang.String notify)
          Exceute query save new mailing list to db.
 boolean addSubMailingList(int listid, int sublistid, java.lang.String dist, java.lang.String accept)
          Add a sub mailing list ie make relation between lists
static java.lang.String addToAccept2(int organisationid, java.lang.String address)
           
 java.lang.String addToMailinglist(int listid, int pid)
           
 java.lang.String addToMailingList(int listid, int personid, java.lang.String dist, java.lang.String accept)
          Add participant to mailing list if add details are ok
 void changeOwnerOfList(int listID, java.lang.String newOwner)
          Change owner of a mailing list
static java.lang.String checkListType(int listid)
           
 boolean checkName(java.lang.String name)
          Check that the name of mailing list is valid (syntaxilly) and not in use.
 boolean checkName(java.lang.String name, boolean doFileTest)
           
 EmailListParticipant checkParticipationInList(int listid, int pid)
           
 int countPersonAddresses(int personID)
          Count the number of person's email addresses in system
 EmailListItem getAllDetails(int listID)
          Exceute query to find out all details of specific email list.
static RS2 getEmailLists(int relid, int type)
          Get email lists (and their archives) to a resultSet in easy-print form
 RS2 getEmailLists(int typeid, java.lang.String ids, boolean minInfo, boolean includeDeleted)
           
 EmailListContainer getEmailListsForCourse(int courseID)
          Exceute query to find out all email list related to a course instance.
 java.lang.String getMailingListsSubGroups(int listid, DB db)
           
 EmailListContainer getUsersEmailLists(int pid, boolean notpart)
          Exceute query to find out all email list related to a person
 boolean hasArchiveReadRight(int pid, java.lang.String listname, java.lang.String arcname)
           
 boolean hasArchiveReadRight(int pid, java.lang.String listname, java.lang.String archivename, DB db)
          Check if the user is allowed to read archive's mail, ie. is user on the mailing list.
 boolean isValidArchiveName(int listid, java.lang.String name)
           
 void listMailingListsToOptionList(int def, java.lang.String cond, int ns)
          Execute query to list all mailing list according to conditions, don't list deleted lists.
 void listMailingListsToOptionList(int def, java.lang.String cond, int ns, boolean all)
          Execute query to list all mailing list according to conditions
 void listNameSpacesToOptionList()
          Execute query to list all available name spaces to user
static void nullifyList(int listid)
           
 void printGroupOptions(javax.servlet.jsp.JspWriter out, java.lang.String courseid, java.lang.String groupid, EmailListItem d)
          Exceute query to list all groups related to the courseinstance
 void printGroupOptions(javax.servlet.jsp.JspWriter out, java.lang.String courseid, java.lang.String groupid, EmailListItem d, java.lang.String cond)
           
 void printOptionList(javax.servlet.jsp.JspWriter out, java.lang.String cond)
          Exceute query to list all people's names matches condition
 void printPersonAddresses(int personID, java.lang.String sel, java.lang.String beg)
          Print all person's emailaddresses to option list
 void removeArchiveData(int dataID)
          todo: Pitäisi muuttaa changed-arvoa!!
static void removeFromAccept2(int organisationid, java.lang.String address)
           
 void removeFromMailingList(java.lang.String participant)
          Remove participant from mailing list.
 void removeMailingList(int listID)
          Remove mailing list.
 java.lang.String removeParticipantFromMailingList(int person, int listid)
          Remove participant from mailing list.
 void removeParticipation(int person, int courseid)
          Remove participant from all mailing lists of selected course.
 java.lang.String saveArchiveData(int listID, java.lang.String data, int typeid)
          todo: Tämän pitäisi muutta myös listan changed-arvoa!
 boolean saveEmailList(int id, java.lang.String description)
          Execute query save the info of mailing list to db with insufficient data.
 boolean saveEmailList(int id, java.lang.String allowexit, java.lang.String allowattach, java.lang.String allowhtml, java.lang.String allowapp, java.lang.String description, java.lang.String signature, java.lang.String notify)
          Exceute query save the info of mailing list to db.
 int setArchiveType(int listid, int type)
          Methods for achive saving, coding changed 4.4.2003 Returns the value of new state. --> 1 (salainen) <--> 3 (poistettu) (no) 0--| --> 2 (julkinen) <--> 4 (poistettu)
 int setArchiveType(int listid, int type, boolean force)
           
 void setToCourse(int listid, int courseid, java.lang.String autojoin, java.lang.String dist, java.lang.String accept)
          Mark emaillist to belong to specific courseinstance
 void setToCourseGroups(int listid, int courseid, java.lang.String groups, java.lang.String autojoin, java.lang.String dist, java.lang.String accept)
          Mark groups to be part of mailing list and bound to a course instance
 void setToGroups(int listid, java.lang.String groups, java.lang.String autojoin, java.lang.String dist, java.lang.String accept)
          Mark groups to be part of mailing list and bound to a course instance
 void setToWorld(int listid, java.lang.String dist, java.lang.String accept)
          Mark emaillist to be available for the whole world
 void setUpdatedTime(int id)
          Execute query to update 'last updated' -timestamp of given mailing list
static void undeleteList(int listid)
          Section for undeleting a list !!
static void updateChangesInOrganisation(int organisationid)
           
 boolean updateMailingListFiles()
           
 void updateParticipantEmail(int listid, int personid, int paramid)
          Update the database relation to email addresses for those users, who have email addresses
 void updateRelatedParticipants(int listid)
          Attach participants to mailing list according to dependencies in emaillistrelation table If there are participants who have been marked as deleted, don't add.
 void updateRelatedParticipants(int listid, boolean force)
           
 void updateRelatedParticipants(int listid, boolean force, java.lang.String rest1, java.lang.String rest2)
           
 void writeArchiveInstruction(EmailListItem d)
           
 boolean writeMailingListFiles(EmailListItem d, java.lang.String act)
           
 boolean writeMailingListFiles(int listid, java.lang.String act)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ARCHIVE_LABEL_ID

public static final int ARCHIVE_LABEL_ID
See Also:
Constant Field Values

ARCHIVE_OPTION_ID

public static final int ARCHIVE_OPTION_ID
See Also:
Constant Field Values

ARCHIVE_LANGUAGE_ID

public static final int ARCHIVE_LANGUAGE_ID
See Also:
Constant Field Values

ARCHIVE_LINK_ID

public static final int ARCHIVE_LINK_ID
See Also:
Constant Field Values

ARCHIVE_TYPE_ID

public static final int ARCHIVE_TYPE_ID
See Also:
Constant Field Values

ARCHIVE_NAME_ID

public static final int ARCHIVE_NAME_ID
See Also:
Constant Field Values

MIN_LENGTH

public static int MIN_LENGTH

MAX_LENGTH

public static int MAX_LENGTH

COURSELIST

public static final int COURSELIST
See Also:
Constant Field Values

GROUPLIST

public static final int GROUPLIST
See Also:
Constant Field Values

ARCHIVE_NO

public static final int ARCHIVE_NO
See Also:
Constant Field Values

ARCHIVE_SECRET

public static final int ARCHIVE_SECRET
See Also:
Constant Field Values

ARCHIVE_SECRET_OLD

public static final int ARCHIVE_SECRET_OLD
See Also:
Constant Field Values

ARCHIVE_PUBLIC

public static final int ARCHIVE_PUBLIC
See Also:
Constant Field Values

ARCHIVE_PUBLIC_OLD

public static final int ARCHIVE_PUBLIC_OLD
See Also:
Constant Field Values

COURSEMODE

public static final int COURSEMODE
See Also:
Constant Field Values

KOLIBRIMODE

public static final int KOLIBRIMODE
See Also:
Constant Field Values

PUBLICMODE

public static final int PUBLICMODE
See Also:
Constant Field Values
Constructor Detail

EmailList

public EmailList()

EmailList

public EmailList(User user,
                 javax.servlet.jsp.JspWriter out)
Constructs EventList object

Parameters:
user - The user to be used
out - The default output stream to use.
Method Detail

getEmailListsForCourse

public EmailListContainer getEmailListsForCourse(int courseID)
                                          throws java.lang.Exception
Exceute query to find out all email list related to a course instance.

Returns:
a set of emaillists
java.lang.Exception

getEmailLists

public RS2 getEmailLists(int typeid,
                         java.lang.String ids,
                         boolean minInfo,
                         boolean includeDeleted)
                  throws java.lang.Exception
java.lang.Exception

getUsersEmailLists

public EmailListContainer getUsersEmailLists(int pid,
                                             boolean notpart)
                                      throws java.lang.Exception
Exceute query to find out all email list related to a person

Parameters:
pid - The person we are interested in.
notpart - false - Show only lists where user is participant true - Show only lists where user can join
java.lang.Exception

getAllDetails

public EmailListItem getAllDetails(int listID)
                            throws java.lang.Exception
Exceute query to find out all details of specific email list.

Parameters:
listID - The id of the list we are interested in.
java.lang.Exception

checkName

public boolean checkName(java.lang.String name)
Check that the name of mailing list is valid (syntaxilly) and not in use.


checkName

public boolean checkName(java.lang.String name,
                         boolean doFileTest)

isValidArchiveName

public boolean isValidArchiveName(int listid,
                                  java.lang.String name)
                           throws java.lang.Exception
java.lang.Exception

addNew

public int addNew(java.lang.String name,
                  int nameSpace,
                  int oid,
                  java.lang.String owner,
                  java.lang.String allowexit,
                  java.lang.String allowattach,
                  java.lang.String allowhtml,
                  java.lang.String allowapp,
                  java.lang.String savemail,
                  java.lang.String description,
                  java.lang.String signature,
                  java.lang.String notify)
           throws java.lang.Exception
Exceute query save new mailing list to db.

Parameters:
name - The name for new mailing list.
nameSpace - The namespace to witch the mailing list belongs.
description - The description for the mailing list.
allowexit - Value 'true' or 'false'.
allowattach - Value 'true' or 'false'.
allowhtml - Value 'true' or 'false'.
signature - Signature to be used at the bottom of each mail message.
java.lang.Exception

setToCourse

public void setToCourse(int listid,
                        int courseid,
                        java.lang.String autojoin,
                        java.lang.String dist,
                        java.lang.String accept)
                 throws java.lang.Exception
Mark emaillist to belong to specific courseinstance

java.lang.Exception

setToCourseGroups

public void setToCourseGroups(int listid,
                              int courseid,
                              java.lang.String groups,
                              java.lang.String autojoin,
                              java.lang.String dist,
                              java.lang.String accept)
                       throws java.lang.Exception
Mark groups to be part of mailing list and bound to a course instance

java.lang.Exception

setToWorld

public void setToWorld(int listid,
                       java.lang.String dist,
                       java.lang.String accept)
                throws java.lang.Exception
Mark emaillist to be available for the whole world

java.lang.Exception

setToGroups

public void setToGroups(int listid,
                        java.lang.String groups,
                        java.lang.String autojoin,
                        java.lang.String dist,
                        java.lang.String accept)
                 throws java.lang.Exception
Mark groups to be part of mailing list and bound to a course instance

java.lang.Exception

updateRelatedParticipants

public void updateRelatedParticipants(int listid)
                               throws java.lang.Exception
Attach participants to mailing list according to dependencies in emaillistrelation table If there are participants who have been marked as deleted, don't add.

java.lang.Exception

updateRelatedParticipants

public void updateRelatedParticipants(int listid,
                                      boolean force)
                               throws java.lang.Exception
java.lang.Exception

updateRelatedParticipants

public void updateRelatedParticipants(int listid,
                                      boolean force,
                                      java.lang.String rest1,
                                      java.lang.String rest2)
                               throws java.lang.Exception
java.lang.Exception

addAllCourseParticipants

public void addAllCourseParticipants(int listid)
                              throws java.lang.Exception
java.lang.Exception

addAllCourseParticipants

public void addAllCourseParticipants(int listid,
                                     java.lang.String restriction)
                              throws java.lang.Exception
java.lang.Exception

addAllGroupParticipants

public void addAllGroupParticipants(int listid,
                                    java.lang.String groups)
                             throws java.lang.Exception
java.lang.Exception

addAllGroupParticipants

public void addAllGroupParticipants(int listid,
                                    java.lang.String groups,
                                    java.lang.String restriction)
                             throws java.lang.Exception
java.lang.Exception

addAllGroupParticipants

public void addAllGroupParticipants(int listid,
                                    java.lang.String groups,
                                    boolean ignoreCourse,
                                    java.lang.String restriction)
                             throws java.lang.Exception
java.lang.Exception

changeOwnerOfList

public void changeOwnerOfList(int listID,
                              java.lang.String newOwner)
                       throws java.lang.Exception
Change owner of a mailing list

java.lang.Exception

saveEmailList

public boolean saveEmailList(int id,
                             java.lang.String allowexit,
                             java.lang.String allowattach,
                             java.lang.String allowhtml,
                             java.lang.String allowapp,
                             java.lang.String description,
                             java.lang.String signature,
                             java.lang.String notify)
                      throws java.lang.Exception
Exceute query save the info of mailing list to db.

Parameters:
id - The id of mailing list.
description - The description for the mailing list.
java.lang.Exception

saveEmailList

public boolean saveEmailList(int id,
                             java.lang.String description)
                      throws java.lang.Exception
Execute query save the info of mailing list to db with insufficient data. Works otherwise as above.

java.lang.Exception

setArchiveType

public int setArchiveType(int listid,
                          int type)
                   throws java.lang.Exception
Methods for achive saving, coding changed 4.4.2003 Returns the value of new state. --> 1 (salainen) <--> 3 (poistettu) (no) 0--| --> 2 (julkinen) <--> 4 (poistettu)

java.lang.Exception

setArchiveType

public int setArchiveType(int listid,
                          int type,
                          boolean force)
                   throws java.lang.Exception
java.lang.Exception

saveArchiveData

public java.lang.String saveArchiveData(int listID,
                                        java.lang.String data,
                                        int typeid)
                                 throws java.lang.Exception
todo: Tämän pitäisi muutta myös listan changed-arvoa!

java.lang.Exception

removeArchiveData

public void removeArchiveData(int dataID)
                       throws java.lang.Exception
todo: Pitäisi muuttaa changed-arvoa!!

java.lang.Exception

setUpdatedTime

public void setUpdatedTime(int id)
                    throws java.lang.Exception
Execute query to update 'last updated' -timestamp of given mailing list

Parameters:
id - The id of mailing list.
java.lang.Exception

listNameSpacesToOptionList

public void listNameSpacesToOptionList()
                                throws java.lang.Exception
Execute query to list all available name spaces to user

java.lang.Exception

listMailingListsToOptionList

public void listMailingListsToOptionList(int def,
                                         java.lang.String cond,
                                         int ns)
                                  throws java.lang.Exception
Execute query to list all mailing list according to conditions, don't list deleted lists.

java.lang.Exception

listMailingListsToOptionList

public void listMailingListsToOptionList(int def,
                                         java.lang.String cond,
                                         int ns,
                                         boolean all)
                                  throws java.lang.Exception
Execute query to list all mailing list according to conditions

java.lang.Exception

printOptionList

public void printOptionList(javax.servlet.jsp.JspWriter out,
                            java.lang.String cond)
                     throws java.lang.Exception
Exceute query to list all people's names matches condition

Parameters:
out - The output stream
java.lang.Exception

printGroupOptions

public void printGroupOptions(javax.servlet.jsp.JspWriter out,
                              java.lang.String courseid,
                              java.lang.String groupid,
                              EmailListItem d)
                       throws java.lang.Exception
Exceute query to list all groups related to the courseinstance

Parameters:
out - The output stream
courseid - The courseinstance to be looked at
d - More details about emaillist (for selected-options)
java.lang.Exception

printGroupOptions

public void printGroupOptions(javax.servlet.jsp.JspWriter out,
                              java.lang.String courseid,
                              java.lang.String groupid,
                              EmailListItem d,
                              java.lang.String cond)
                       throws java.lang.Exception
java.lang.Exception

addToMailinglist

public java.lang.String addToMailinglist(int listid,
                                         int pid)
                                  throws java.lang.Exception
java.lang.Exception

addToMailingList

public java.lang.String addToMailingList(int listid,
                                         int personid,
                                         java.lang.String dist,
                                         java.lang.String accept)
                                  throws java.lang.Exception
Add participant to mailing list if add details are ok

Parameters:
listid - The id of list to wicth person should be added.
personid - The id of the person to be added.
Returns:
Returns the errors that occured while adding the participant. If errors have occurred, the person has not been added to mailing list.
java.lang.Exception

addExtrasToMailingList

public boolean addExtrasToMailingList(int listid,
                                      java.lang.String person,
                                      java.lang.String address,
                                      java.lang.String dist,
                                      java.lang.String accept)
                               throws java.lang.Exception
Add a name and address to mailing list

Parameters:
listid - The id of mailing list to join.
person - The name of persn to be joined to mailing list.
address - The email address to be joined.
java.lang.Exception

addSubMailingList

public boolean addSubMailingList(int listid,
                                 int sublistid,
                                 java.lang.String dist,
                                 java.lang.String accept)
                          throws java.lang.Exception
Add a sub mailing list ie make relation between lists

java.lang.Exception

getMailingListsSubGroups

public java.lang.String getMailingListsSubGroups(int listid,
                                                 DB db)
                                          throws java.lang.Exception
java.lang.Exception

updateParticipantEmail

public void updateParticipantEmail(int listid,
                                   int personid,
                                   int paramid)
                            throws java.lang.Exception
Update the database relation to email addresses for those users, who have email addresses

java.lang.Exception

removeFromMailingList

public void removeFromMailingList(java.lang.String participant)
                           throws java.lang.Exception
Remove participant from mailing list.

Returns:
Returns the errors that occured while removing the participant. If errors have occurred, the person has not been removed from mailing list.
java.lang.Exception

removeParticipantFromMailingList

public java.lang.String removeParticipantFromMailingList(int person,
                                                         int listid)
                                                  throws java.lang.Exception
Remove participant from mailing list.

Parameters:
person - The id of the person to be removed.
listid - The id of the list from witch to be removed.
Returns:
Returns the errors that occured while removing the participant. If errors have occurred, the person has not been removed from mailing list.
java.lang.Exception

removeParticipation

public void removeParticipation(int person,
                                int courseid)
                         throws java.lang.Exception
Remove participant from all mailing lists of selected course. Doest not apply to recursive lists..

java.lang.Exception

removeMailingList

public void removeMailingList(int listID)
                       throws java.lang.Exception
Remove mailing list.

java.lang.Exception

printPersonAddresses

public void printPersonAddresses(int personID,
                                 java.lang.String sel,
                                 java.lang.String beg)
                          throws java.lang.Exception
Print all person's emailaddresses to option list

java.lang.Exception

countPersonAddresses

public int countPersonAddresses(int personID)
                         throws java.lang.Exception
Count the number of person's email addresses in system

java.lang.Exception

hasArchiveReadRight

public boolean hasArchiveReadRight(int pid,
                                   java.lang.String listname,
                                   java.lang.String arcname)
                            throws java.lang.Exception
java.lang.Exception

hasArchiveReadRight

public boolean hasArchiveReadRight(int pid,
                                   java.lang.String listname,
                                   java.lang.String archivename,
                                   DB db)
                            throws java.lang.Exception
Check if the user is allowed to read archive's mail, ie. is user on the mailing list. Don't check - if the list has been deleted - if the namespace has been deleted - if the user has been deleted from the list - if the db is open, and leave it open afterwards

java.lang.Exception

checkParticipationInList

public EmailListParticipant checkParticipationInList(int listid,
                                                     int pid)
                                              throws java.lang.Exception
java.lang.Exception

writeMailingListFiles

public boolean writeMailingListFiles(int listid,
                                     java.lang.String act)
                              throws java.lang.Exception
java.lang.Exception

writeMailingListFiles

public boolean writeMailingListFiles(EmailListItem d,
                                     java.lang.String act)
                              throws java.lang.Exception
java.lang.Exception

updateMailingListFiles

public boolean updateMailingListFiles()
                               throws java.lang.Exception
java.lang.Exception

writeArchiveInstruction

public void writeArchiveInstruction(EmailListItem d)
                             throws java.lang.Exception
java.lang.Exception

undeleteList

public static void undeleteList(int listid)
                         throws java.lang.Exception
Section for undeleting a list !! ONLY FOR ADMIN USE !! what happens to archives is a good guestion. Propably continue writing on them.

java.lang.Exception

nullifyList

public static void nullifyList(int listid)
                        throws java.lang.Exception
java.lang.Exception

removeFromAccept2

public static void removeFromAccept2(int organisationid,
                                     java.lang.String address)

addToAccept2

public static java.lang.String addToAccept2(int organisationid,
                                            java.lang.String address)

updateChangesInOrganisation

public static void updateChangesInOrganisation(int organisationid)

checkListType

public static java.lang.String checkListType(int listid)

getEmailLists

public static RS2 getEmailLists(int relid,
                                int type)
Get email lists (and their archives) to a resultSet in easy-print form