com.xmlserv.app.phonebook
Class Mailinglist

java.lang.Object
  |
  +--com.xmlserv.app.phonebook.Mailinglist

public class Mailinglist
extends java.lang.Object


Constructor Summary
Mailinglist(java.sql.Connection con, int id, int userid)
          Load an existing Mailinglist.
Mailinglist(java.sql.Connection con, int userid, java.lang.String name)
          Create a new Mailinglist saving data to the DB.
Mailinglist(int userid)
          Create empty Mailinglist.
 
Method Summary
 void addMember(java.sql.Connection con, int memberid)
           
 void addMember(java.sql.Connection con, PhoneBook.Entry entry)
           
 void clear(java.sql.Connection con)
          Remove all members from the list.
 boolean contains(java.sql.Connection con, int pbid)
          Check whether the given phonebook entry is a member of this mailinglist.
 void delete(java.sql.Connection con)
          Delete the list.
 void deleteMember(java.sql.Connection con, int member)
          Delete a single member from the list.
 javax.mail.internet.InternetAddress[] getAddressList(java.sql.Connection con)
          Get the list of maiaddresses.
 int getId()
           
 int getListSize(java.sql.Connection con)
           
 java.lang.String getName()
           
 int getUserid()
           
static org.jdom.Element list(java.sql.Connection con, int userid)
          List all mailinglists for the given user.
static org.jdom.Element list(java.sql.Connection con, int userid, boolean showall)
           
 void load(java.sql.Connection con)
          Load data from DB.
 void save(java.sql.Connection con)
          Save to DB.
 void setMemberlist(java.sql.Connection con, int[] memberlist)
           
 void setName(java.lang.String name)
           
 void setUserid(int userid)
          Changing userid can only be done before calling save() for the first time.
 org.jdom.Element toElement(java.sql.Connection con)
          Convert to an Element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Mailinglist

public Mailinglist(java.sql.Connection con,
                   int id,
                   int userid)
            throws XMLServException
Load an existing Mailinglist.

Mailinglist

public Mailinglist(java.sql.Connection con,
                   int userid,
                   java.lang.String name)
            throws XMLServException
Create a new Mailinglist saving data to the DB.

Mailinglist

public Mailinglist(int userid)
Create empty Mailinglist.
Method Detail

list

public static org.jdom.Element list(java.sql.Connection con,
                                    int userid)
                             throws XMLServException
List all mailinglists for the given user.

list

public static org.jdom.Element list(java.sql.Connection con,
                                    int userid,
                                    boolean showall)
                             throws XMLServException
Parameters:
showall - Show mailinglists marked as deleted.

save

public void save(java.sql.Connection con)
          throws XMLServException
Save to DB. To be called after using the set*() methods to make changes permanent.

load

public void load(java.sql.Connection con)
          throws XMLServException
Load data from DB.

delete

public void delete(java.sql.Connection con)
            throws XMLServException
Delete the list.

setMemberlist

public void setMemberlist(java.sql.Connection con,
                          int[] memberlist)
                   throws XMLServException

clear

public void clear(java.sql.Connection con)
           throws XMLServException
Remove all members from the list.

deleteMember

public void deleteMember(java.sql.Connection con,
                         int member)
                  throws XMLServException
Delete a single member from the list.

addMember

public void addMember(java.sql.Connection con,
                      PhoneBook.Entry entry)
               throws XMLServException

addMember

public void addMember(java.sql.Connection con,
                      int memberid)
               throws XMLServException

contains

public boolean contains(java.sql.Connection con,
                        int pbid)
                 throws XMLServException
Check whether the given phonebook entry is a member of this mailinglist.
Returns:
true if ID is a member, false otherwise.

getAddressList

public javax.mail.internet.InternetAddress[] getAddressList(java.sql.Connection con)
                                                     throws XMLServException
Get the list of maiaddresses.

getListSize

public int getListSize(java.sql.Connection con)
                throws XMLServException

toElement

public org.jdom.Element toElement(java.sql.Connection con)
                           throws XMLServException
Convert to an Element. This lists the users entire phonebook, marking the entries as selected when part of this mailinglist.

getId

public int getId()

getUserid

public int getUserid()

setUserid

public void setUserid(int userid)
Changing userid can only be done before calling save() for the first time. The userid of a Mailinglist loaded from DB cannot be changed.

getName

public java.lang.String getName()

setName

public void setName(java.lang.String name)