public class ImapServiceImpl extends java.lang.Object implements ImapService, NodeServicePolicies.OnCreateChildAssociationPolicy, NodeServicePolicies.OnDeleteChildAssociationPolicy, NodeServicePolicies.OnUpdatePropertiesPolicy, NodeServicePolicies.BeforeDeleteNodePolicy
| Modifier and Type | Class and Description |
|---|---|
static class |
ImapServiceImpl.ImapServiceBootstrap
Bootstrap initialization bean for the service implementation.
|
ImapService.EmailBodyFormat, ImapService.FolderStatusPolicy.ArgQNAMEQNAMEARG_0, ARG_1, ARG_2, QNAMEQNAME| Constructor and Description |
|---|
ImapServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef nodeRef)
Called before a node is deleted.
|
protected void |
bindBehaviour() |
com.icegreen.greenmail.store.SimpleStoredMessage |
createImapMessage(FileInfo fileInfo,
boolean generateBody)
Creates a MIME message for the given file
|
void |
deleteMailbox(AlfrescoImapUser user,
java.lang.String mailboxName)
Deletes an existing MailBox.
|
void |
expungeMessage(FileInfo fileInfo)
Expunges (deletes) an IMAP message if its flags indicates
|
void |
extractAttachments(org.alfresco.service.cmr.repository.NodeRef messageRef,
javax.mail.internet.MimeMessage originalMessage)
Extract attachments from message.
|
org.alfresco.service.cmr.repository.NodeRef |
extractAttachments(org.alfresco.service.cmr.repository.NodeRef parentFolder,
org.alfresco.service.cmr.repository.NodeRef messageFile,
javax.mail.internet.MimeMessage originalMessage)
Extract attachments from a MimeMessage
Puts the attachments into a subfolder below the parent folder.
|
java.lang.String |
getAlfrescoServerUID()
This method should returns a unique identifier of Alfresco server.
|
java.lang.String |
getDefaultEmailBodyTemplate(ImapService.EmailBodyFormat type)
Returns a template for email body.
|
java.lang.String |
getDefaultFromAddress() |
java.lang.String |
getDefaultToAddress() |
javax.mail.Flags |
getFlags(FileInfo messageInfo)
Return flags that belong to the specified imap folder.
|
ImapService.FolderStatus |
getFolderStatus(java.lang.String userName,
org.alfresco.service.cmr.repository.NodeRef contextNodeRef,
AlfrescoImapConst.ImapViewMode viewMode)
Search for emails in specified folder depending on view mode.
|
boolean |
getImapServerEnabled()
Determines whether the IMAP server is enabled.
|
com.icegreen.greenmail.store.SimpleStoredMessage |
getMessage(FileInfo mesInfo)
Gets a cached MIME message for the given file, complete with message body.
|
org.alfresco.service.namespace.NamespaceService |
getNamespaceService() |
AlfrescoImapFolder |
getOrCreateMailbox(AlfrescoImapUser user,
java.lang.String mailboxName,
boolean mayExist,
boolean mayCreate)
Returns a reference to a mailbox, either creating a new one or retrieving an existing one.
|
java.lang.String |
getRepositoryTemplatePath() |
org.alfresco.service.cmr.search.SearchService |
getSearchService() |
java.lang.String |
getShareApplicationContextUrl() |
org.alfresco.service.cmr.repository.NodeRef |
getUserImapHomeRef(java.lang.String userName)
Get the node ref of the user's imap home.
|
java.lang.String |
getWebApplicationContextUrl() |
void |
init() |
boolean |
isNodeInSitesLibrary(org.alfresco.service.cmr.repository.NodeRef nodeRef)
Return true if provided nodeRef is in Sites/.../documentlibrary
|
java.util.List |
listMailboxes(AlfrescoImapUser user,
java.lang.String mailboxPattern,
boolean listSubscribed)
Depend on listSubscribed param, list Mailboxes or list subscribed Mailboxes
|
void |
onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef childAssocRef,
boolean isNewNode)
Called after a node child association has been created.
|
void |
onDeleteChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef childAssocRef)
Called after a node child association has been deleted.
|
void |
onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef nodeRef,
java.util.Map before,
java.util.Map after)
Called after a node's properties have been changed.
|
void |
renameMailbox(AlfrescoImapUser user,
java.lang.String oldMailboxName,
java.lang.String newMailboxName)
Renames an existing mailbox.
|
void |
setAttachmentsExtractor(AttachmentsExtractor attachmentsExtractor) |
void |
setDefaultFromAddress(java.lang.String defaultFromAddress) |
void |
setDefaultToAddress(java.lang.String defaultToAddress) |
void |
setExtractAttachmentsEnabled(boolean extractAttachmentsEnabled) |
void |
setFileFolderService(FileFolderService fileFolderService) |
void |
setFlag(FileInfo messageInfo,
javax.mail.Flags.Flag flag,
boolean value)
Set flags to the specified message.
|
void |
setFlags(FileInfo messageInfo,
javax.mail.Flags flags,
boolean value)
Set flags to the specified imapFolder.
|
void |
setFolderCacheSize(int folderCacheSize) |
void |
setIgnoreExtractionFolders(RepositoryFolderConfigBean[] ignoreExtractionFolders) |
void |
setImapConfigMountPoints(ImapConfigMountPointsBean[] imapConfigMountPointsBeans) |
void |
setImapHome(RepositoryFolderConfigBean imapHomeConfigBean) |
void |
setImapServerEnabled(boolean enabled) |
void |
setMessageCache(org.alfresco.repo.cache.SimpleCache messageCache) |
void |
setMimetypeService(org.alfresco.service.cmr.repository.MimetypeService mimetypeService) |
void |
setNamespaceService(org.alfresco.service.namespace.NamespaceService namespaceService) |
void |
setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService) |
void |
setPermissionService(org.alfresco.service.cmr.security.PermissionService permissionService) |
void |
setPolicyFilter(BehaviourFilter policyFilter) |
void |
setRepositoryTemplatePath(java.lang.String repositoryTemplatePath) |
void |
setSearchService(org.alfresco.service.cmr.search.SearchService searchService) |
void |
setServiceRegistry(ServiceRegistry serviceRegistry) |
void |
setSysAdminParams(SysAdminParams sysAdminParams) |
void |
shutdown() |
void |
startup()
This method is run as System within a single transaction on startup.
|
protected void |
startupInTxn(boolean force) |
void |
subscribe(AlfrescoImapUser user,
java.lang.String mailbox)
Subscribes a user to a mailbox.
|
void |
unsubscribe(AlfrescoImapUser user,
java.lang.String mailbox)
Unsubscribes from a given mailbox.
|
public void setSysAdminParams(SysAdminParams sysAdminParams)
public void setMessageCache(org.alfresco.repo.cache.SimpleCache messageCache)
public void setFileFolderService(FileFolderService fileFolderService)
public void setMimetypeService(org.alfresco.service.cmr.repository.MimetypeService mimetypeService)
public void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
public void setPermissionService(org.alfresco.service.cmr.security.PermissionService permissionService)
public void setServiceRegistry(ServiceRegistry serviceRegistry)
public void setPolicyFilter(BehaviourFilter policyFilter)
public void setAttachmentsExtractor(AttachmentsExtractor attachmentsExtractor)
public void setImapHome(RepositoryFolderConfigBean imapHomeConfigBean)
public void setFolderCacheSize(int folderCacheSize)
public java.lang.String getDefaultFromAddress()
getDefaultFromAddress in interface ImapServicepublic void setDefaultFromAddress(java.lang.String defaultFromAddress)
public java.lang.String getDefaultToAddress()
getDefaultToAddress in interface ImapServicepublic void setDefaultToAddress(java.lang.String defaultToAddress)
public java.lang.String getWebApplicationContextUrl()
getWebApplicationContextUrl in interface ImapServicepublic java.lang.String getShareApplicationContextUrl()
getShareApplicationContextUrl in interface ImapServicepublic java.lang.String getRepositoryTemplatePath()
getRepositoryTemplatePath in interface ImapServicepublic void setRepositoryTemplatePath(java.lang.String repositoryTemplatePath)
public void setImapConfigMountPoints(ImapConfigMountPointsBean[] imapConfigMountPointsBeans)
public void setIgnoreExtractionFolders(RepositoryFolderConfigBean[] ignoreExtractionFolders)
public void setExtractAttachmentsEnabled(boolean extractAttachmentsEnabled)
public void setImapServerEnabled(boolean enabled)
public boolean getImapServerEnabled()
ImapServicegetImapServerEnabled in interface ImapServicepublic void init()
public void startup()
public void shutdown()
protected void startupInTxn(boolean force)
protected void bindBehaviour()
public com.icegreen.greenmail.store.SimpleStoredMessage getMessage(FileInfo mesInfo) throws javax.mail.MessagingException
ImapServicegetMessage in interface ImapServicemesInfo - imap file info.javax.mail.MessagingExceptionpublic com.icegreen.greenmail.store.SimpleStoredMessage createImapMessage(FileInfo fileInfo, boolean generateBody) throws javax.mail.MessagingException
ImapServicecreateImapMessage in interface ImapServicefileInfo - imap file info.generateBody - Should the message body be generated?javax.mail.MessagingExceptionpublic void expungeMessage(FileInfo fileInfo)
ImapServiceexpungeMessage in interface ImapServicefileInfo - imap file info.public AlfrescoImapFolder getOrCreateMailbox(AlfrescoImapUser user, java.lang.String mailboxName, boolean mayExist, boolean mayCreate)
ImapServicegetOrCreateMailbox in interface ImapServiceuser - User making the request.mailboxName - String name of the target.mayExist - Is the mailbox allowed to exist already? If false and the mailbox already exists, an error will be thrownmayCreate - If the mailbox does not exist, can one be created? If false then an error is thrown if the folder does not existpublic void deleteMailbox(AlfrescoImapUser user, java.lang.String mailboxName)
ImapServicedeleteMailbox in interface ImapServiceuser - User making the request.mailboxName - String name of the target,public void renameMailbox(AlfrescoImapUser user, java.lang.String oldMailboxName, java.lang.String newMailboxName)
ImapServicerenameMailbox in interface ImapServiceuser - User making the request.oldMailboxName - String name of the existing foldernewMailboxName - String target new namepublic ImapService.FolderStatus getFolderStatus(java.lang.String userName, org.alfresco.service.cmr.repository.NodeRef contextNodeRef, AlfrescoImapConst.ImapViewMode viewMode)
getFolderStatus in interface ImapServicecontextNodeRef - context folder for searchviewMode - context folder view modepublic void subscribe(AlfrescoImapUser user, java.lang.String mailbox)
ImapServicesubscribe in interface ImapServiceuser - User making the requestmailbox - String representation of a mailbox name.public void unsubscribe(AlfrescoImapUser user, java.lang.String mailbox)
ImapServiceunsubscribe in interface ImapServiceuser - User making the requestmailbox - String representation of a mailbox name.public javax.mail.Flags getFlags(FileInfo messageInfo)
getFlags in interface ImapServicemessageInfo - imap folder info.public void setFlags(FileInfo messageInfo, javax.mail.Flags flags, boolean value)
setFlags in interface ImapServicemessageInfo - FileInfo of imap Folder.flags - flags to set.value - value to set.public void setFlag(FileInfo messageInfo, javax.mail.Flags.Flag flag, boolean value)
setFlag in interface ImapServicemessageInfo - FileInfo of imap Folderflag - flag to set.value - value value to set.public java.util.List listMailboxes(AlfrescoImapUser user, java.lang.String mailboxPattern, boolean listSubscribed)
listMailboxes in interface ImapServiceuser - User making the requestmailboxPattern - String name of a mailbox, possible including a wildcard.listSubscribed - list only subscribed folders?public org.alfresco.service.cmr.repository.NodeRef getUserImapHomeRef(java.lang.String userName)
getUserImapHomeRef in interface ImapServiceuserName - user namepublic java.lang.String getDefaultEmailBodyTemplate(ImapService.EmailBodyFormat type)
ImapService"Data Dictionary > IMAP Templates >". This path should be set as the property of the "imapHelper" bean.
In this case it returns NodeRef.toString() of the template. If there are no template in the repository it
returns a default template on the classpath.getDefaultEmailBodyTemplate in interface ImapServicepublic java.lang.String getAlfrescoServerUID()
public void onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef childAssocRef,
boolean isNewNode)
NodeServicePolicies.OnCreateChildAssociationPolicyonCreateChildAssociation in interface NodeServicePolicies.OnCreateChildAssociationPolicychildAssocRef - the child association that has been createdisNewNode - true if the node is new or false if the node is being linked inpublic void onDeleteChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef childAssocRef)
NodeServicePolicies.OnDeleteChildAssociationPolicyonDeleteChildAssociation in interface NodeServicePolicies.OnDeleteChildAssociationPolicychildAssocRef - the child association that has been deletedpublic void onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef nodeRef,
java.util.Map before,
java.util.Map after)
NodeServicePolicies.OnUpdatePropertiesPolicyonUpdateProperties in interface NodeServicePolicies.OnUpdatePropertiesPolicynodeRef - reference to the updated nodebefore - the node's properties before the changeafter - the node's properties after the changepublic void beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef nodeRef)
NodeServicePolicies.BeforeDeleteNodePolicybeforeDeleteNode in interface NodeServicePolicies.BeforeDeleteNodePolicynodeRef - the node referencepublic boolean isNodeInSitesLibrary(org.alfresco.service.cmr.repository.NodeRef nodeRef)
isNodeInSitesLibrary in interface ImapServicenodeRef - nodeRefpublic org.alfresco.service.cmr.repository.NodeRef extractAttachments(org.alfresco.service.cmr.repository.NodeRef parentFolder,
org.alfresco.service.cmr.repository.NodeRef messageFile,
javax.mail.internet.MimeMessage originalMessage)
throws java.io.IOException,
javax.mail.MessagingException
extractAttachments in interface ImapServicemessageFile - the node ref of the message.java.io.IOExceptionjavax.mail.MessagingExceptionpublic void setNamespaceService(org.alfresco.service.namespace.NamespaceService namespaceService)
public org.alfresco.service.namespace.NamespaceService getNamespaceService()
public void setSearchService(org.alfresco.service.cmr.search.SearchService searchService)
public org.alfresco.service.cmr.search.SearchService getSearchService()
public void extractAttachments(org.alfresco.service.cmr.repository.NodeRef messageRef,
javax.mail.internet.MimeMessage originalMessage)
throws java.io.IOException,
javax.mail.MessagingException
ImapServiceextractAttachments in interface ImapServicemessageRef - nodeRef that represents message in Alfresco.originalMessage - original message in eml format.java.io.IOExceptionjavax.mail.MessagingExceptionCopyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.