org.alfresco.email.server.handler
Class AbstractEmailMessageHandler

java.lang.Object
  extended by org.alfresco.email.server.handler.AbstractEmailMessageHandler
All Implemented Interfaces:
EmailMessageHandler
Direct Known Subclasses:
AbstractForumEmailMessageHandler, FolderEmailMessageHandler

public abstract class AbstractEmailMessageHandler
extends java.lang.Object
implements EmailMessageHandler

Abstract class implements common logic for processing email messages.

Since:
2.2

Constructor Summary
AbstractEmailMessageHandler()
           
 
Method Summary
protected  org.alfresco.service.cmr.repository.NodeRef addAttachment(org.alfresco.service.cmr.repository.NodeService nodeService, org.alfresco.service.cmr.repository.NodeRef folder, org.alfresco.service.cmr.repository.NodeRef mainContentNode, java.lang.String fileName)
          Adds new node into Alfresco repository and mark its as an attachment.
protected  void addAttachments(org.alfresco.service.cmr.repository.NodeRef spaceNodeRef, org.alfresco.service.cmr.repository.NodeRef nodeRef, EmailMessage message)
          Extracts the attachments from the given message and adds them to the space.
protected  org.alfresco.service.cmr.repository.NodeRef addContentNode(org.alfresco.service.cmr.repository.NodeService nodeService, org.alfresco.service.cmr.repository.NodeRef parent, java.lang.String name)
          Add new node into Alfresco repository with specified parameters.
protected  org.alfresco.service.cmr.repository.NodeRef addContentNode(org.alfresco.service.cmr.repository.NodeService nodeService, org.alfresco.service.cmr.repository.NodeRef parent, java.lang.String name, org.alfresco.service.namespace.QName assocType)
          Add new node into Alfresco repository with specified parameters.
protected  void addEmailedAspect(org.alfresco.service.cmr.repository.NodeRef nodeRef, EmailMessage message)
          Add emailed aspect to the specified node.
protected  ContentService getContentService()
           
protected  org.alfresco.service.cmr.dictionary.DictionaryService getDictionaryService()
           
protected  org.alfresco.service.cmr.repository.MimetypeService getMimetypeService()
           
protected  org.alfresco.service.cmr.repository.NodeService getNodeService()
           
protected  org.alfresco.service.cmr.repository.NodeRef getTargetNode(java.lang.String to)
           
 void setContentService(ContentService contentService)
           
 void setDictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService)
           
 void setMimetypeService(org.alfresco.service.cmr.repository.MimetypeService mimetypeService)
           
 void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
           
protected  void writeContent(org.alfresco.service.cmr.repository.NodeRef nodeRef, java.io.InputStream content, java.lang.String mimetype, java.lang.String encoding)
          Write content to the node from InputStream.
protected  void writeContent(org.alfresco.service.cmr.repository.NodeRef nodeRef, java.lang.String content)
          Write the content to the node
protected  void writeContent(org.alfresco.service.cmr.repository.NodeRef nodeRef, java.lang.String content, java.lang.String mimetype)
          Write the string as content to the node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.alfresco.email.server.handler.EmailMessageHandler
processMessage
 

Constructor Detail

AbstractEmailMessageHandler

public AbstractEmailMessageHandler()
Method Detail

getContentService

protected ContentService getContentService()
Returns:
Alfresco Content Service.

setContentService

public void setContentService(ContentService contentService)
Parameters:
contentService - Alfresco Content Service.

getDictionaryService

protected org.alfresco.service.cmr.dictionary.DictionaryService getDictionaryService()
Returns:
the Alfresco dictionary service

setDictionaryService

public void setDictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService)
Parameters:
dictionaryService - Alfresco dictionary service

getNodeService

protected org.alfresco.service.cmr.repository.NodeService getNodeService()
Returns:
Alfresco Node Service.

setNodeService

public void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
Parameters:
nodeService - Alfresco Node Service.

getMimetypeService

protected org.alfresco.service.cmr.repository.MimetypeService getMimetypeService()
Returns:
the service used to determine mimeypte and encoding

setMimetypeService

public void setMimetypeService(org.alfresco.service.cmr.repository.MimetypeService mimetypeService)
Parameters:
mimetypeService - the the service to determine mimetype and encoding

getTargetNode

protected org.alfresco.service.cmr.repository.NodeRef getTargetNode(java.lang.String to)
                                                             throws com.sun.star.auth.InvalidArgumentException
Parameters:
to - Email address which user part specifies node-dbid
Returns:
Referance to requested node.
Throws:
com.sun.star.auth.InvalidArgumentException - The exception is thrown if input string has incorrect format or empty.

writeContent

protected void writeContent(org.alfresco.service.cmr.repository.NodeRef nodeRef,
                            java.lang.String content)
Write the content to the node

Parameters:
nodeRef - Target node
content - Content

writeContent

protected void writeContent(org.alfresco.service.cmr.repository.NodeRef nodeRef,
                            java.lang.String content,
                            java.lang.String mimetype)
Write the string as content to the node.

Parameters:
nodeRef - Target node.
content - Text for writting.
mimetype - MIME content type. For exaple you can set this parameter to "text/html" or "text/xml", etc.

writeContent

protected void writeContent(org.alfresco.service.cmr.repository.NodeRef nodeRef,
                            java.io.InputStream content,
                            java.lang.String mimetype,
                            java.lang.String encoding)
Write content to the node from InputStream.

Parameters:
nodeRef - Target node.
content - Content stream.
mimetype - MIME content type.
encoding - Encoding. Can be null for non text based content.

addEmailedAspect

protected void addEmailedAspect(org.alfresco.service.cmr.repository.NodeRef nodeRef,
                                EmailMessage message)
Add emailed aspect to the specified node.

Parameters:
nodeService - Alfresco Node Service.
nodeRef - Target node.
mailParser - Mail message that will be used for extracting necessary information

addContentNode

protected org.alfresco.service.cmr.repository.NodeRef addContentNode(org.alfresco.service.cmr.repository.NodeService nodeService,
                                                                     org.alfresco.service.cmr.repository.NodeRef parent,
                                                                     java.lang.String name,
                                                                     org.alfresco.service.namespace.QName assocType)
Add new node into Alfresco repository with specified parameters. Node content isn't added.

Parameters:
nodeService - Alfresco Node Service
parent - Parent node
name - Name of the new node
assocType - Association type that should be set between parent node and the new one.
Returns:
Reference to created node

addContentNode

protected org.alfresco.service.cmr.repository.NodeRef addContentNode(org.alfresco.service.cmr.repository.NodeService nodeService,
                                                                     org.alfresco.service.cmr.repository.NodeRef parent,
                                                                     java.lang.String name)
Add new node into Alfresco repository with specified parameters. Node content isn't added. New node will be created with ContentModel.ASSOC_CONTAINS association with parent.

Parameters:
nodeService - Alfresco Node Service
parent - Parent node
name - Name of the new node
Returns:
Reference to created node

addAttachment

protected org.alfresco.service.cmr.repository.NodeRef addAttachment(org.alfresco.service.cmr.repository.NodeService nodeService,
                                                                    org.alfresco.service.cmr.repository.NodeRef folder,
                                                                    org.alfresco.service.cmr.repository.NodeRef mainContentNode,
                                                                    java.lang.String fileName)
Adds new node into Alfresco repository and mark its as an attachment.

Parameters:
nodeService - Alfresco Node Service.
folder - Space/Folder to add.
mainContentNode - Main content node. Any mail is added into Alfresco as one main content node and several its attachments. Each attachment related with its main node.
fileName - File name for the attachment.
Returns:
Reference to created node.

addAttachments

protected void addAttachments(org.alfresco.service.cmr.repository.NodeRef spaceNodeRef,
                              org.alfresco.service.cmr.repository.NodeRef nodeRef,
                              EmailMessage message)
Extracts the attachments from the given message and adds them to the space. All attachments are linked back to the original node that they are attached to.

Parameters:
spaceNodeRef - the space to add the documents into
nodeRef - the node to which the documents will be attached
message - the email message


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.