org.olat.core.util.mail
Class ContactList

java.lang.Object
  extended by org.olat.core.util.mail.ContactList

public class ContactList
extends java.lang.Object

The ContactList is used to group e-mail addresses and name such a group. It is the frameworks implementation of a MailList. The e-mail adresses are given either by providing them as strings or in the form of identites (org.olat.core.id.Identity). Further it is possible to add all contacts from another ContactList.

TODO:pb:a remove dependency to EmailPrioInstitutional if a solution for core.id.user is found Moreover one can specify to use the users institional e-mail first and use the other e-mail as fall-back. Initial Date: Sep 23, 2004

Author:
patrick

Constructor Summary
ContactList(java.lang.String name)
          A ContacList must have at least a name != null, matching ^[^;,:]*$
ContactList(java.lang.String name, java.lang.String description)
          A ContactList must have at least a name != null, matching ^[a-zA-Z ]*$, and can have a description.
 
Method Summary
 void add(ContactList emailList)
          add members of another ContactList to this ContactList.
 void add(Identity identity)
          contribute a contact as an identity.
 void add(java.lang.String emailAddress)
          contribute a contact as a string email address.
 void addAllIdentites(java.util.List listOfIdentity)
          add all identity-Objects in the provided list.
 java.lang.String getDescription()
          Description getter
 javax.mail.internet.InternetAddress[] getEmailsAsAddresses()
          The e-mail addresses are generated as InternetAddresses, the priority of the institutional email is taken in account.
 java.util.ArrayList getEmailsAsStrings()
          the returned ArrayList contains String Objects representing the e-mail addresses added.
 java.lang.String getName()
          Name getter
 java.lang.String getRFC2822Name()
          ContactList-name as String formatted according to RFC2822
 java.lang.String getRFC2822NameWithAddresses()
          ContactList-name and e-mail adresses as String formatted according to http://www.rfc.net/rfc2822.html
 boolean isEmailPrioInstitutional()
          check the priority of the institutional mail is set.
 void remove(Identity identity)
           
 void setEmailPrioInstitutional(boolean emailPrioInstitutional)
          set the priority of the institutional mail.
 java.lang.String toString()
          A comma separated list of e-mail addresses.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ContactList

public ContactList(java.lang.String name)
A ContacList must have at least a name != null, matching ^[^;,:]*$

Parameters:
name -

ContactList

public ContactList(java.lang.String name,
                   java.lang.String description)
A ContactList must have at least a name != null, matching ^[a-zA-Z ]*$, and can have a description.

Parameters:
name -
description -
Method Detail

isEmailPrioInstitutional

public boolean isEmailPrioInstitutional()
check the priority of the institutional mail is set.

Returns:
Returns the emailPrioInstitutional.

setEmailPrioInstitutional

public void setEmailPrioInstitutional(boolean emailPrioInstitutional)
set the priority of the institutional mail.

Parameters:
emailPrioInstitutional - The emailPrioInstitutional to set.

add

public void add(java.lang.String emailAddress)
contribute a contact as a string email address.

Parameters:
emailAddress -

add

public void add(Identity identity)
contribute a contact as an identity.

Parameters:
identity -

remove

public void remove(Identity identity)

getName

public java.lang.String getName()
Name getter

Returns:

getRFC2822Name

public java.lang.String getRFC2822Name()
ContactList-name as String formatted according to RFC2822

Returns:

getRFC2822NameWithAddresses

public java.lang.String getRFC2822NameWithAddresses()
ContactList-name and e-mail adresses as String formatted according to http://www.rfc.net/rfc2822.html

Returns:

getDescription

public java.lang.String getDescription()
Description getter

Returns:

getEmailsAsStrings

public java.util.ArrayList getEmailsAsStrings()
the returned ArrayList contains String Objects representing the e-mail addresses added.

Returns:

add

public void add(ContactList emailList)
add members of another ContactList to this ContactList.

Parameters:
emailList -

toString

public java.lang.String toString()
A comma separated list of e-mail addresses. The ContactList name is ommitted, if the form ContactList.Name:member1@host.suffix,member2@host.suffix,...,memberN@host.suffix; is needed, please use the appropriate getRFC2822xxx getter method.

Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

addAllIdentites

public void addAllIdentites(java.util.List listOfIdentity)
add all identity-Objects in the provided list.

Parameters:
listOfIdentity - List containing Identites

getEmailsAsAddresses

public javax.mail.internet.InternetAddress[] getEmailsAsAddresses()
                                                           throws javax.mail.internet.AddressException
The e-mail addresses are generated as InternetAddresses, the priority of the institutional email is taken in account.

Returns:
the email addresses as InternetAddresses
Throws:
javax.mail.internet.AddressException