public interface ImapService
Modifier and Type | Interface and Description |
---|---|
static class |
ImapService.EmailBodyFormat
Helper enumeration to handle email body format text/html and text/plain for Alfresco/Share webapp
|
static class |
ImapService.FolderStatus |
Modifier and Type | Method and Description |
---|---|
com.icegreen.greenmail.store.SimpleStoredMessage |
createImapMessage(FileInfo messageFileInfo,
boolean generateBody)
Creates a MIME message for the given file
|
void |
deleteMailbox(AlfrescoImapUser user,
String mailboxName)
Deletes an existing MailBox.
|
void |
expungeMessage(FileInfo messageFileInfo)
Expunges (deletes) an IMAP message if its flags indicates
|
void |
extractAttachments(org.alfresco.service.cmr.repository.NodeRef messageRef,
MimeMessage originalMessage)
Extract attachments from message.
|
String |
generateUniqueFilename(org.alfresco.service.cmr.repository.NodeRef destFolderNodeRef,
String fileName) |
String |
getContentFolderUrl(org.alfresco.service.cmr.repository.NodeRef siteContainerNodeRef)
Get the web URL for the document's parent folder
|
String |
getDefaultEmailBodyTemplate(ImapService.EmailBodyFormat type)
Returns a template for email body.
|
String |
getDefaultFromAddress() |
String |
getDefaultToAddress() |
Flags |
getFlags(FileInfo messageFileInfo)
Return flags that belong to the specified imap folder.
|
ImapService.FolderStatus |
getFolderStatus(String userName,
org.alfresco.service.cmr.repository.NodeRef contextNodeRef,
AlfrescoImapConst.ImapViewMode viewMode)
Search for emails in specified folder depend on view mode.
|
boolean |
getImapServerEnabled()
Determines whether the IMAP server is enabled.
|
com.icegreen.greenmail.store.SimpleStoredMessage |
getMessage(FileInfo messageFileInfo)
Gets a cached MIME message for the given file, complete with message body.
|
org.alfresco.service.cmr.repository.NodeRef |
getNodeSiteContainer(org.alfresco.service.cmr.repository.NodeRef nodeRef)
Get the node's site container if it belongs to Sites.
|
AlfrescoImapFolder |
getOrCreateMailbox(AlfrescoImapUser user,
String mailboxName,
boolean mayExist,
boolean mayCreate)
Returns a reference to a mailbox, either creating a new one or retrieving an existing one.
mailbox parameter may specify absolute or relative path to a folder. |
String |
getPathFromRepo(org.alfresco.service.cmr.repository.ChildAssociationRef assocRef) |
String |
getPathFromSites(org.alfresco.service.cmr.repository.NodeRef nodeRef) |
String |
getRepositoryTemplatePath() |
String |
getShareApplicationContextUrl() |
org.alfresco.service.cmr.repository.NodeRef |
getUserImapHomeRef(String userName)
Get the node ref of the user's imap home.
|
String |
getWebApplicationContextUrl() |
List<AlfrescoImapFolder> |
listMailboxes(AlfrescoImapUser user,
String mailboxPattern,
boolean listSubscribed)
Returns an collection of mailboxes.
|
void |
persistMessageHeaders(org.alfresco.service.cmr.repository.NodeRef nodeRef,
MimeMessage message) |
void |
renameMailbox(AlfrescoImapUser user,
String oldMailboxName,
String newMailboxName)
Renames an existing mailbox.
|
void |
setFlag(FileInfo messageFileInfo,
Flags.Flag flag,
boolean value)
Set flag to the specified imapFolder.
|
void |
setFlags(FileInfo messageFileInfo,
Flags flags,
boolean value)
Set flags to the specified imapFolder.
|
void |
subscribe(AlfrescoImapUser user,
String mailbox)
Subscribes a user to a mailbox.
|
void |
unsubscribe(AlfrescoImapUser user,
String mailbox)
Unsubscribes from a given mailbox.
|
List<AlfrescoImapFolder> listMailboxes(AlfrescoImapUser user, String mailboxPattern, boolean listSubscribed)
user
- User making the requestmailboxPattern
- String name of a mailbox, possible including a wildcard.listSubscribed
- list only subscribed folders?void deleteMailbox(AlfrescoImapUser user, String mailboxName)
user
- User making the request.mailboxName
- String name of the target,void renameMailbox(AlfrescoImapUser user, String oldMailboxName, String newMailboxName)
user
- User making the request.oldMailboxName
- String name of the existing foldernewMailboxName
- String target new nameAlfrescoImapFolder getOrCreateMailbox(AlfrescoImapUser user, String mailboxName, boolean mayExist, boolean mayCreate)
mailbox
parameter may specify absolute or relative path to a folder. Absolute path uniquely identifies some directory, whereas relative path implies that root
folder should be IMAP home
directory for the specified user
rather than IMAP root
(i.e. IMAP mount point
). Mailbox will
be found or created (mayCreate=true
, mayExist=false
or ) in user
's IMAP home
directory if relative path is specified.mayExist
and mayCreate parameters' combinations and results:
mayCreate=false
, mayExist=true
- mailbox is found and not created if it doesn't exist. Error is thrown if mailbox doesn't not exist;mayCreate=true
, mayExist=true
- mailbox is created if it doesn't exist or it is just found in other case. No error is thrown;mayCreate=true
, mayExist=false
- mailbox is created if it doesn't exist. Error is thrown if it is already created;mayCreate=false
, mayExist=false
- error is thrown that mailbox cannot be created if doesn't exist. Error is thrown that mailbox should not
exist in other case.user
- 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 existorg.alfresco.service.cmr.repository.NodeRef getUserImapHomeRef(String userName)
userName
- user namevoid subscribe(AlfrescoImapUser user, String mailbox)
user
- User making the requestmailbox
- String representation of a mailbox name.void unsubscribe(AlfrescoImapUser user, String mailbox)
user
- User making the requestmailbox
- String representation of a mailbox name.ImapService.FolderStatus getFolderStatus(String userName, org.alfresco.service.cmr.repository.NodeRef contextNodeRef, AlfrescoImapConst.ImapViewMode viewMode)
userName
- user namecontextNodeRef
- context NodeRefviewMode
- (ARCHIVE, MIXED or VIRTUAL)com.icegreen.greenmail.store.SimpleStoredMessage getMessage(FileInfo messageFileInfo) throws MessagingException
messageFileInfo
- imap file info.MessagingException
com.icegreen.greenmail.store.SimpleStoredMessage createImapMessage(FileInfo messageFileInfo, boolean generateBody) throws MessagingException
messageFileInfo
- imap file info.generateBody
- Should the message body be generated?MessagingException
void expungeMessage(FileInfo messageFileInfo)
messageFileInfo
- imap file info.Flags getFlags(FileInfo messageFileInfo)
messageFileInfo
- imap folder info.void setFlags(FileInfo messageFileInfo, Flags flags, boolean value)
messageFileInfo
- FileInfo of imap Folder.flags
- flags to set.value
- value to set.void setFlag(FileInfo messageFileInfo, Flags.Flag flag, boolean value)
messageFileInfo
- FileInfo of imap Folderflag
- flag to set.value
- value value to set.String getDefaultFromAddress()
String getDefaultToAddress()
String getRepositoryTemplatePath()
String getWebApplicationContextUrl()
String getShareApplicationContextUrl()
String getDefaultEmailBodyTemplate(ImapService.EmailBodyFormat type)
"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.type
- one of the possible body types text/html and text/plainorg.alfresco.service.cmr.repository.NodeRef getNodeSiteContainer(org.alfresco.service.cmr.repository.NodeRef nodeRef)
nodeRef
- nodeRefString getContentFolderUrl(org.alfresco.service.cmr.repository.NodeRef siteContainerNodeRef)
siteContainerNodeRef
- or null if the document is not from siteboolean getImapServerEnabled()
void extractAttachments(org.alfresco.service.cmr.repository.NodeRef messageRef, MimeMessage originalMessage) throws IOException, MessagingException
messageRef
- nodeRef that represents message in Alfresco.originalMessage
- original message in eml format.IOException
MessagingException
String generateUniqueFilename(org.alfresco.service.cmr.repository.NodeRef destFolderNodeRef, String fileName)
void persistMessageHeaders(org.alfresco.service.cmr.repository.NodeRef nodeRef, MimeMessage message)
String getPathFromSites(org.alfresco.service.cmr.repository.NodeRef nodeRef)
nodeRef
- NodeRefString getPathFromRepo(org.alfresco.service.cmr.repository.ChildAssociationRef assocRef)
assocRef
- an association between the node and it's parentCopyright © 2005–2017 Alfresco Software. All rights reserved.