Oracle Ultra Search APIs
9.2

oracle.ultrasearch.query
Class EmailUtil

java.lang.Object
  |
  +--oracle.ultrasearch.query.EmailUtil

public class EmailUtil
extends java.lang.Object

This class implements the Ultra Search Java Email Utility API.

It defines all constants and methods for accessing email source data.

An email source represents all emails sent to a specific email address or it's aliases. The most popular use of an email source is to represent all emails sent to a mailing list.

The methods implemented by this API can be classified as follows:

Methods that retrieve email data

These methods return email data such as the list of existing email sources in the Ultra Search instance, information about a particular email source, the number of messages in an email source and the header fields of a message.

The methods that fall under this class are as follows:

Methods that return HTML code or are related to the presentation of HTML code

These methods perform the following tasks:

The methods that fall under this class are as follows:

Ultra Search instance methods

These methods are related to the database instance.

The methods that fall under this class are as follows:

Utility methods

These methods exist as convenience method for the client web application developer. They encapsulate commonly performed tasks.

The methods that fall under this class are as follows:

Since:
9.0.2

Constructor Summary
EmailUtil()
          Default constructor
 
Method Summary
 java.lang.String createLink(int emailSourceId)
          A utility method that creates a link that when clicked on, will render a page showing emails belonging to an email source.
 java.lang.String createLink(int emailSourceId, int messageId)
          A utility method that creates a link that when clicked on, will render a page showing the contents of an email.
 java.lang.String createLink(int emailSourceId, int messageId, int attachId)
          A utility method that creates a link that when clicked on, will render a page showing the contents of an email attachment of a specific email.
 EmailHeader getEmailHeader(int emailSourceId, int messageId)
          Gets the header information of an email.
 java.util.Vector getEmailHeaders(int emailSourceId, int startIndex, int endIndex)
          Gets header information of a number of email messages
 EmailSource getEmailSource(int emailSourceId)
          Gets one email source
 EmailSource[] getEmailSources()
          Gets a list of email sources that are defined in the Oracle Ultra Search instance.
 java.lang.String getMailPagePath()
          Gets the URL path of the web application (JSP or Servlet) that will render the contents of an email.
 int getMessageCount(int emailSourceId)
          Gets the number of messages in an email source.
 javax.mail.internet.MimeMessage getMimeMessage(int emailSourceId, int messageId)
          Gets an email message as a javax.mail.internet.MimeMessage object.
 java.lang.String htmlEncode(java.lang.String str)
          Convenience method for converting certain characters into HTML encoding.
 void setInstance(Instance inst)
          Sets the Instance object used by the class to create database connections to the Ultra Search instance.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EmailUtil

public EmailUtil()
Default constructor
Method Detail

setInstance

public void setInstance(Instance inst)
Sets the Instance object used by the class to create database connections to the Ultra Search instance.
Parameters:
inst - The instance object

createLink

public java.lang.String createLink(int emailSourceId)
A utility method that creates a link that when clicked on, will render a page showing emails belonging to an email source.

This method uses the URL defined by the setMailPagePath method. Therefore, setMailPagePath must be correctly called first.

Parameters:
emailSourceId - The ID of the email source.
Returns:
A url that points to the page that displays emails belonging to the email source.

createLink

public java.lang.String createLink(int emailSourceId,
                                   int messageId)
A utility method that creates a link that when clicked on, will render a page showing the contents of an email.

This method uses the URL defined by the setMailPagePath method. Therefore, setMailPagePath must be correctly called first.

Parameters:
emailSourceId - The ID of the email source.
messageId - The ID of the message within the email source.
Returns:
A url that points to the page that displays the email.

createLink

public java.lang.String createLink(int emailSourceId,
                                   int messageId,
                                   int attachId)
A utility method that creates a link that when clicked on, will render a page showing the contents of an email attachment of a specific email.

This method uses the URL defined by the setMailPagePath method. Therefore, setMailPagePath must be correctly called first.

Parameters:
emailSourceId - The ID of the email source.
messageId - The ID of the message within the email source.
attachId - The ID of the attachment to the specified email.
Returns:
A url that points to the page that displays the email.

htmlEncode

public java.lang.String htmlEncode(java.lang.String str)
Convenience method for converting certain characters into HTML encoding.

This method analyzes the input string and performs the following conversions:

Parameters:
str - The input string to convert.
Returns:
The converted version of the input string.

getMessageCount

public int getMessageCount(int emailSourceId)
                    throws java.sql.SQLException
Gets the number of messages in an email source.
Parameters:
emailSourceId - The number id of the email source.
Returns:
The number of messages in the email source.
Throws:
java.sql.SQLException - when a database error occurs.

getEmailSource

public EmailSource getEmailSource(int emailSourceId)
                           throws java.sql.SQLException
Gets one email source

Returns an EmailSource object

Parameters:
emailSourceId - the email data source id
Returns:
null if no email source found.
Throws:
java.sql.SQLException - when a database error occurs.

getEmailSources

public EmailSource[] getEmailSources()
                              throws java.sql.SQLException
Gets a list of email sources that are defined in the Oracle Ultra Search instance.
Returns:
An array of EmailSource objects where each EmailSource object encapsulates information about one email source.
Throws:
java.sql.SQLException - when a database error occurs.

getEmailHeader

public EmailHeader getEmailHeader(int emailSourceId,
                                  int messageId)
                           throws java.sql.SQLException
Gets the header information of an email.
Parameters:
emailSourceId - The ID of the email source.
messageId - The ID of the message within the email source.
Returns:
An EmailHeader object
Throws:
java.sql.SQLException - when a database error occurs.

getEmailHeaders

public java.util.Vector getEmailHeaders(int emailSourceId,
                                        int startIndex,
                                        int endIndex)
                                 throws java.sql.SQLException
Gets header information of a number of email messages
Parameters:
emailSourceId - The ID of the email source.
startIndex - The index of the first email header returned.
endIndex - The index of the last email header returned.
Returns:
A Vector of EmailHeader objects
Throws:
java.sql.SQLException - when a database error occurs.

getMimeMessage

public javax.mail.internet.MimeMessage getMimeMessage(int emailSourceId,
                                                      int messageId)
                                               throws java.sql.SQLException,
                                                      java.io.IOException,
                                                      javax.mail.MessagingException
Gets an email message as a javax.mail.internet.MimeMessage object.

The email message comes from the email archive directory which is directly accessible by the database server machine (which may not be the same machine as the application server).

Parameters:
emailSourceId - The ID of the email source.
messageId - The ID of the message within the email source.
Returns:
A MimeMessage object representing the email.
Throws:
java.sql.SQLException - when a database error occurs.
java.io.IOException - when an error occurs while opening the cached email file.
javax.mail.MessagingException - when an error occurs in the Java Mail layer.

getMailPagePath

public java.lang.String getMailPagePath()
Gets the URL path of the web application (JSP or Servlet) that will render the contents of an email.
Returns:
a portion of a URL string representing the mail rendering application.

Oracle Ultra Search APIs
9.2