Java Doc for MailImpl.java in  » Groupware » ivatagroupware » com » ivata » groupware » business » mail » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Groupware » ivatagroupware » com.ivata.groupware.business.mail 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.ivata.groupware.business.mail.MailImpl

MailImpl
public class MailImpl implements Mail,Serializable(Code)

This session bean provides an interface to the mail system. Every mail operation for retrieving deleting and sending messages takes place in this class.


since:
   2002-07-12
author:
   Colin MacLeod
author:
   colin.macleod@ivata.com
author:
   Peter Illes
version:
   $Revision: 1.12 $


Field Summary
 MaskFactorymaskFactory
    

Constructor Summary
public  MailImpl(SecurityServer securityServer, AddressBook addressBook, Settings settings, MaskFactory maskFactory)
    

Initialize the mail implementation.


Parameters:
  securityServer - A valid security server for the current site.

Method Summary
public  MessageDOaddMessageToDraftsFolder(MailSession mailSession, MessageDO messageDO)
    

Add a composed message to the drafts folder for later sending.


Parameters:
  mailSession - valid mail session to which the user should already belogged in.
Parameters:
  messageDO - data object containing full details of themessage to be added to the drafts.
public  voidaddUserAliasEmailAddresses(SecuritySession securitySession, String userName, Collection userAliases, Collection telecomAddresses, String emailAddressHost)
    

Add appropriate user addresses given a list of user aliases.


Parameters:
  securitySession - valid security session.
Parameters:
  userName - name of the user who owns teh aliases.
Parameters:
  userAliases - a Collection of Stringinstances containing the local part of the different email aliasesthis user has.
public  MessageDOappendAttachments(MailSession mailSession, String id, List attachments)
    

Append attachments to a message located in the drafts folder.


Parameters:
  mailSession - valid mail session to which the user should already belogged in.
Parameters:
  id - the unique identifier of the message to which we want to appendattachments.
Parameters:
  attachments - List of Strings -filenames of files waiting in upload directory.
public  voidcreateFolder(MailSession mailSession, String folderName)
    
public  MessageDOcreateThreadMessage(MailSession mailSession, String folderName, List messageIds, Integer thread)
    

Create a new message in the drafts folder from an existing one, based on a 'thread'.

public  voiddeleteMessagesFromTrash(MailSession mailSession, List ids)
    
public  booleandoesFolderExist(MailSession mailSession, String folderName)
    

Check whether or not a given folder pathname exists.


Parameters:
  mailSession - valid mail session to which the user should already belogged in.
Parameters:
  folderName - the full path name of the folder to check.
public  MessageDOfindMessageByFolderMessageId(MailSession mailSession, String folderName, String id)
    

This method retrieves the requested message and sets all the attributes of a MessageDO object for use on client side.


Parameters:
  mailSession - valid mail session to which the user should already belogged in.
Parameters:
  folderName - the name of the folder the message is located in.
Parameters:
  id - the unique identifier of the message.
public  ListfindMessagesInFolder(MailSession mailSession, String folderName, Integer sortBy, boolean sortAscending)
    

Used in the main folder index page, this method returns the contents of a folder as a List of MessageDO instances.

Note: for efficiency reasons, this method does not fill the text, format or attachment values of the returned MessageDO instance.

final public  FileContentDOgetAttachment(MailSession mailSession, String folderName, String messageId, String attachmentId)
    

Retrieve an attachment's content and it's MimeType.

public  ListgetUserAliases(SecuritySession securitySession, String userName)
    

Retrieve all of the email aliases for the user provided, on the curent email server.

final public  StringgetVacationMessage(SecuritySession securitySession, String userName)
    

Get the vacation message for the user provided.

The vacation message is a text the user can set, which will be sent to all emails received at this address while the user is not present.


Parameters:
  userName - the name of the user for whom to get the vacation message.
final public  booleanhasNewMessages(SecuritySession securitySession, String userName, String folderName)
    

Get the time the specified mail folder was last modified as a long.

public  MailSessionlogin(UserDO user, String password)
    

Login to the mail system.

public  voidmoveMessages(MailSession mailSession, String folderName, List ids, String targetFolderName)
    
public  voidsend(MailSession mailSession, MessageDO messageDO)
    

Send a mime email message that is already composed.

public  voidsend(MailSession mailSession, String fromAddress, Collection to, String subject, Object content, String contentType, boolean addToSentFolder)
    

Send an mime email message without using a data object.


Parameters:
  mailSession - valid mail session to which the user should already belogged in.
Parameters:
  fromAddress - the address of the person sending the mail.
final public  voidsetUserAliases(SecuritySession securitySession, String userName, Collection userAliases)
    

Set all of the email aliases for the user provided, on the curent email server.

final public  voidsetVacationMessage(SecuritySession securitySession, String userName, String vacationMessage)
    

Set the vacation message for the user provided.

The vacation message is a text the user can set, which will be sent to all emails received at this address while the user is not present.


Parameters:
  userName - the name of the user for whom to get the vacation message.
Parameters:
  vacationMessage - vacation message text for this user.
public  ValidationErrorsvalidate(SecuritySession securitySession, MessageDO messageDO)
    

Confirm all of the elements of the message are present and valid, before the message is sent.


Parameters:
  messageDO - data object to check for consistency andcompleteness.

Field Detail
maskFactory
MaskFactory maskFactory(Code)




Constructor Detail
MailImpl
public MailImpl(SecurityServer securityServer, AddressBook addressBook, Settings settings, MaskFactory maskFactory)(Code)

Initialize the mail implementation.


Parameters:
  securityServer - A valid security server for the current site. Ifthis is not an instance of com.ivata.groupware.business.mail.server.MailServerthe mail implementation will not be usable.
Parameters:
  persistenceManager - This is used to save/access data from thepersistence store.
Parameters:
  addressBook - This is used to read contacts email details.
Parameters:
  settings - Contains user defined settings and preferences.
Parameters:
  dateFormatter - Used to format mail dates and times.
Parameters:
  idDispenser -




Method Detail
addMessageToDraftsFolder
public MessageDO addMessageToDraftsFolder(MailSession mailSession, MessageDO messageDO) throws SystemException(Code)

Add a composed message to the drafts folder for later sending.


Parameters:
  mailSession - valid mail session to which the user should already belogged in.
Parameters:
  messageDO - data object containing full details of themessage to be added to the drafts. new MessageDO with the id set to thecurrent value in the mail system.



addUserAliasEmailAddresses
public void addUserAliasEmailAddresses(SecuritySession securitySession, String userName, Collection userAliases, Collection telecomAddresses, String emailAddressHost) throws SystemException(Code)

Add appropriate user addresses given a list of user aliases.


Parameters:
  securitySession - valid security session.
Parameters:
  userName - name of the user who owns teh aliases.
Parameters:
  userAliases - a Collection of Stringinstances containing the local part of the different email aliasesthis user has. If the user has no aliaes, an empty collection shouldbe provided.
Parameters:
  telecomAddresess - a Collection containing all theuser's existing email addresses, as TelecomAddressDOinstances.



appendAttachments
public MessageDO appendAttachments(MailSession mailSession, String id, List attachments) throws SystemException(Code)

Append attachments to a message located in the drafts folder.


Parameters:
  mailSession - valid mail session to which the user should already belogged in.
Parameters:
  id - the unique identifier of the message to which we want to appendattachments.
Parameters:
  attachments - List of Strings -filenames of files waiting in upload directory. null when the operation failed, otherwise the newmessage id.
exception:
  MessageNotFoundException - if the folder doesn't exist, or thereis no matching mail in this folder.



createFolder
public void createFolder(MailSession mailSession, String folderName) throws SystemException(Code)

Create a new mail folder.


Parameters:
  mailSession - valid mail session to which the user should already belogged in.
Parameters:
  folderName - the full path name of the folder to create.



createThreadMessage
public MessageDO createThreadMessage(MailSession mailSession, String folderName, List messageIds, Integer thread) throws SystemException(Code)

Create a new message in the drafts folder from an existing one, based on a 'thread'. The thread indicates that the message is a:

  • reply to all recipients of a previous message
  • reply to one recipient of a previous message
  • previous message(s) forwarded to new recipients
  • an existing (draft) message being altered for resending

This new message in the drafts folder can then be used to store attachments or for reviewing before sending.


Parameters:
  mailSession - valid mail session to which the user should already belogged in.
Parameters:
  folderName - the name of the folder to copy existing messages from.
Parameters:
  messageIds - the unique identifier of the messages to be extended.Can be null if a new message is requeested. Whenforwarding, multiple address identifiers may be specified otherwise(if editing a draft message or replying) only one message identifiershould be set in the list.
Parameters:
  thread - set to one of the constants in MailConstantsMailConstants. populated message data object matching the requiredmessage, and with the id set to the message in thedrafts folder.



deleteMessagesFromTrash
public void deleteMessagesFromTrash(MailSession mailSession, List ids) throws SystemException(Code)

Delete a list of messages from the trash folder.


Parameters:
  mailSession - valid mail session to which the user should already belogged in.
Parameters:
  ids - the unique identifiers (String instances) of themessages to be removed.
exception:
  MessageNotFoundException - if the folder doesn't exist, or thereis no matching mail in this folder.



doesFolderExist
public boolean doesFolderExist(MailSession mailSession, String folderName) throws SystemException(Code)

Check whether or not a given folder pathname exists.


Parameters:
  mailSession - valid mail session to which the user should already belogged in.
Parameters:
  folderName - the full path name of the folder to check. true if the folder exists, otherwise false.



findMessageByFolderMessageId
public MessageDO findMessageByFolderMessageId(MailSession mailSession, String folderName, String id) throws SystemException(Code)

This method retrieves the requested message and sets all the attributes of a MessageDO object for use on client side.


Parameters:
  mailSession - valid mail session to which the user should already belogged in.
Parameters:
  folderName - the name of the folder the message is located in.
Parameters:
  id - the unique identifier of the message. a MessageDO instance filled up with the messages attributes,except the contents of the attachments.
exception:
  MessageNotFoundException - if the folder doesn't exist, or thereis no matching mail in this folder.



findMessagesInFolder
public List findMessagesInFolder(MailSession mailSession, String folderName, Integer sortBy, boolean sortAscending) throws SystemException(Code)

Used in the main folder index page, this method returns the contents of a folder as a List of MessageDO instances.

Note: for efficiency reasons, this method does not fill the text, format or attachment values of the returned MessageDO instance. For that, you must call MailImpl.findMessageByFolderMessageId findMessageByFolderMessageId .


Parameters:
  mailSession - valid mail session to which the user should already belogged in.
Parameters:
  folderName - the name of the folder to list.
Parameters:
  sortBy - the field to sort the returned list by. Set to one of theSORT_... constants in MailConstants MailConstants.
Parameters:
  sortAscending - if true then the messages are sorted inascending order, otherwise (false) they are descending. List ofMessageDO instances.



getAttachment
final public FileContentDO getAttachment(MailSession mailSession, String folderName, String messageId, String attachmentId) throws SystemException(Code)

Retrieve an attachment's content and it's MimeType. This method is used to by the download servlet.


Parameters:
  mailSession - valid mail session to which the user should already belogged in.
Parameters:
  folderName - the name of the folder the message is located in.
Parameters:
  messageId - the unique identifier of the message.
Parameters:
  attachmentId - the unique identifier of the attachment. attachment data object containing attachment contentand mime type.
exception:
  MessageNotFoundException - if the folder doesn't exist, or thereis no matching mail in this folder.



getUserAliases
public List getUserAliases(SecuritySession securitySession, String userName) throws SystemException(Code)

Retrieve all of the email aliases for the user provided, on the curent email server. The aliases returned each one containing just the 'user' (or 'local') part of the email address, before the '@' sign.


Parameters:
  userName - the name of the user for whom to retrieve the email aliases. a Collection of String instances containingthe local part of the different email aliases this user has. If the userhas no aliaes, an empty collection is returned.



getVacationMessage
final public String getVacationMessage(SecuritySession securitySession, String userName) throws SystemException(Code)

Get the vacation message for the user provided.

The vacation message is a text the user can set, which will be sent to all emails received at this address while the user is not present.


Parameters:
  userName - the name of the user for whom to get the vacation message. the vacation message text for this user. If the user has novacation message set, null is returned.



hasNewMessages
final public boolean hasNewMessages(SecuritySession securitySession, String userName, String folderName) throws SystemException(Code)

Get the time the specified mail folder was last modified as a long. This can then be saved and compared to subsequent calls of this method to see if the folder has changed.


Parameters:
  userName - the name of the user for whom to locate the folder.
Parameters:
  folderName - the name of the folder to locate. operating system specific timestamp indicating when thefolder was last changed.



login
public MailSession login(UserDO user, String password) throws SystemException(Code)

Login to the mail system. This method should be called before any other, to establish the mail session and store.


Parameters:
  userName - this user name is used to log into the remote system.
Parameters:
  password - the clear-text password to log into the remote system.
throws:
  GroupwareException - if the person cannot log in. the mail session (class Session) in aSessionSerializer.



moveMessages
public void moveMessages(MailSession mailSession, String folderName, List ids, String targetFolderName) throws SystemException(Code)

Move a list of messages from one folder to another.


Parameters:
  mailSession - valid mail session to which the user should already belogged in.
Parameters:
  folderName - the name of the folder the messages are currently located in.
Parameters:
  ids - the unique identifiers (String instances) of themessages to be moved.
Parameters:
  targetFolderName - the name of the the folder the message will be movedto.
exception:
  MessageNotFoundException - if the folder doesn't exist, or thereis no matching mail in this folder.



send
public void send(MailSession mailSession, MessageDO messageDO) throws SystemException(Code)

Send a mime email message that is already composed. If id has been set in messageDO it is assumed to point to a message in the drafts folder. Attachments are copied from the message who match the contents of getAttachmentIds. (All other attachments are discarded.)


Parameters:
  mailSession - valid mail session to which the user should already belogged in.
Parameters:
  messageDO - data object containing full details of themessage to be sent.



send
public void send(MailSession mailSession, String fromAddress, Collection to, String subject, Object content, String contentType, boolean addToSentFolder) throws SystemException(Code)

Send an mime email message without using a data object.


Parameters:
  mailSession - valid mail session to which the user should already belogged in.
Parameters:
  fromAddress - the address of the person sending the mail. This mustbe formatted according to RFC822.
Parameters:
  to - recipients, a Collection containing instances ofString or UserDO orPersonDO. A mixture of these types is allowed. If thetype of an instance is String, then it must be formattedaccording to RFC822.Otherwise, if the type is PersonDO, the methodgetEmailAddress must return a valid address string forthis person.
Parameters:
  subject - clear-text email subject field.
Parameters:
  content - any valid email content type, as defined byMimeMessage.
Parameters:
  contentType - mime type for the content field, asdefined by MimeMessage.
Parameters:
  addToSentFolder - if set to true then the mail is addedto the sent folder of the current email session.



setUserAliases
final public void setUserAliases(SecuritySession securitySession, String userName, Collection userAliases) throws SystemException(Code)

Set all of the email aliases for the user provided, on the curent email server. Each alias in the collection should contain just the 'user' (or 'local') part of the email address, before the '@' sign.


Parameters:
  userName - the name of the user for whom to retrieve the email aliases.
Parameters:
  userAliases - a Collection of Stringinstances containing the local part of the different email aliasesthis user has. If the user has no aliaes, an empty collection shouldbe provided.



setVacationMessage
final public void setVacationMessage(SecuritySession securitySession, String userName, String vacationMessage) throws SystemException(Code)

Set the vacation message for the user provided.

The vacation message is a text the user can set, which will be sent to all emails received at this address while the user is not present.


Parameters:
  userName - the name of the user for whom to get the vacation message.
Parameters:
  vacationMessage - vacation message text for this user. If the userhas no vacation message set, set to null.



validate
public ValidationErrors validate(SecuritySession securitySession, MessageDO messageDO)(Code)

Confirm all of the elements of the message are present and valid, before the message is sent.


Parameters:
  messageDO - data object to check for consistency andcompleteness. a collection of validation errors if any of themandatory fields are missing, or if fields contain invalid values.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.