com.knowgate.hipermail
Class RecipientsHelper

java.lang.Object
  extended by com.knowgate.hipermail.RecipientsHelper

public class RecipientsHelper
extends java.lang.Object

Helper class for working with recipients lists


Constructor Summary
RecipientsHelper()
          Default Constructor
RecipientsHelper(MimeMessage oMsg)
          Create RecipientsHelper and fill it with MimeMessage recipients
RecipientsHelper(java.lang.String sWorkAreaGUID)
          Construct and set default workarea for this recipients helper
 
Method Summary
static int acknowledgeNotification(JDCConnection oCon, MultipartReport oCnt)
           
 void addRecipients(Address[] oAddrs, Message.RecipientType oRecTp)
          Add recipients of a given type
static void clearRecipientsForMessage(JDCConnection oConn, java.lang.String sGuMimeMsg)
          Delete rows at k_inet_addrs table for given message
 java.lang.String[] getAddresses(Message.RecipientType oRecTp)
          Get array with recipients of a given type
static InternetAddress getFromAddress(MimeMessage oMsg)
           
 Address[] getRecipients(Message.RecipientType oRecTp)
          Get array with recipients of a given type
static InternetAddress getReplyAddress(MimeMessage oMsg)
           
 boolean hasLists()
          If called after parseRecipientsList(), this methods returns whether or not any distribution list was expanded during the parsing process
static java.lang.String joinAddressList(Address[] aRecipients)
          Join mail addresses array on a single String
 void parseRecipientsList(JDCConnection oAdCn, java.lang.String sDelimitedList, Message.RecipientType oRecTp)
          Parse a String of comma or semicolon delimited addresses Addresses may be of any format accepted by DBInetAddr.parseAddress() method.
 void setRecipients(Address[] oAddrs, Message.RecipientType oRecTp)
           
 void setRecipients(MimeMessage oMsg)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RecipientsHelper

public RecipientsHelper()
Default Constructor


RecipientsHelper

public RecipientsHelper(java.lang.String sWorkAreaGUID)
Construct and set default workarea for this recipients helper


RecipientsHelper

public RecipientsHelper(MimeMessage oMsg)
                 throws MessagingException
Create RecipientsHelper and fill it with MimeMessage recipients

Parameters:
oMsg - MimeMessage
Throws:
MessagingException
Method Detail

hasLists

public boolean hasLists()
If called after parseRecipientsList(), this methods returns whether or not any distribution list was expanded during the parsing process

Returns:
boolean

getAddresses

public java.lang.String[] getAddresses(Message.RecipientType oRecTp)
Get array with recipients of a given type

Parameters:
oRecTp - RecipientType
Returns:
InternetAddress[]

getRecipients

public Address[] getRecipients(Message.RecipientType oRecTp)
Get array with recipients of a given type

Parameters:
oRecTp - RecipientType
Returns:
InternetAddress[]

setRecipients

public void setRecipients(Address[] oAddrs,
                          Message.RecipientType oRecTp)
                   throws java.lang.ClassCastException
Throws:
java.lang.ClassCastException

setRecipients

public void setRecipients(MimeMessage oMsg)
                   throws java.lang.ClassCastException,
                          MessagingException
Throws:
java.lang.ClassCastException
MessagingException

addRecipients

public void addRecipients(Address[] oAddrs,
                          Message.RecipientType oRecTp)
                   throws java.lang.ClassCastException
Add recipients of a given type

Parameters:
oAddrs - InternetAddress[]
oRecTp - RecipientType
Throws:
java.lang.ClassCastException

joinAddressList

public static java.lang.String joinAddressList(Address[] aRecipients)
Join mail addresses array on a single String

Parameters:
aRecipients - Address[]
Returns:
String Mail addresses delimited by semicolons

parseRecipientsList

public void parseRecipientsList(JDCConnection oAdCn,
                                java.lang.String sDelimitedList,
                                Message.RecipientType oRecTp)
                         throws java.sql.SQLException,
                                java.lang.IndexOutOfBoundsException,
                                java.lang.NullPointerException,
                                AddressException,
                                java.io.UnsupportedEncodingException

Parse a String of comma or semicolon delimited addresses

Addresses may be of any format accepted by DBInetAddr.parseAddress() method.
Distribution lists present at input string are expanded into BCC internal array.
Distribution list names begin with "list@" and end with ".list".
Or, also distribution list names are enclosed by brackets like "{this is a list}"
Thus if "engineers" is the GUID of a list containing members luke@engineers.com,peter@engineers.com then TO "jhon@code.com,martin@maths.com,list@engineers.list,steve@maths.com" will be parsed as
TO jhon@code.com,martin@maths.com,steve@maths.com
BCC luke@engineers.com,peter@engineers.com

Parameters:
oAdCn - JDCConnection
sDelimitedList - String with addresses to be parsed
oRecTp - RecipientType
Throws:
java.sql.SQLException
java.lang.IndexOutOfBoundsException
java.lang.NullPointerException
AddressException
java.io.UnsupportedEncodingException

clearRecipientsForMessage

public static void clearRecipientsForMessage(JDCConnection oConn,
                                             java.lang.String sGuMimeMsg)
                                      throws java.sql.SQLException
Delete rows at k_inet_addrs table for given message

Parameters:
oConn - JDCConnection
sGuMimeMsg - String GUID of message which addresses are to be cleared
Throws:
java.sql.SQLException

getFromAddress

public static InternetAddress getFromAddress(MimeMessage oMsg)
                                      throws MessagingException
Throws:
MessagingException

getReplyAddress

public static InternetAddress getReplyAddress(MimeMessage oMsg)
                                       throws MessagingException
Throws:
MessagingException

acknowledgeNotification

public static int acknowledgeNotification(JDCConnection oCon,
                                          MultipartReport oCnt)
                                   throws java.sql.SQLException,
                                          java.io.IOException,
                                          MessagingException
Throws:
java.sql.SQLException
java.io.IOException
MessagingException