Package org.alfresco.repo.imap
Class AlfrescoImapFolder
java.lang.Object
org.alfresco.repo.imap.AbstractImapFolder
org.alfresco.repo.imap.AlfrescoImapFolder
- All Implemented Interfaces:
com.icegreen.greenmail.store.MailFolder,Serializable
Implementation of greenmail MailFolder. It represents an Alfresco content folder and handles
appendMessage, copyMessage, expunge (delete), getMessages, getMessage and so requests.
- Author:
- Mike Shavnev, David Ward
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.alfresco.repo.imap.AbstractImapFolder
AbstractImapFolder.CommandCallback<T> -
Field Summary
Fields inherited from class org.alfresco.repo.imap.AbstractImapFolder
logger, MAX_RETRIES, serviceRegistry -
Constructor Summary
ConstructorsConstructorDescriptionAlfrescoImapFolder(FileInfo folderInfo, String userName, String folderName, String folderPath, AlfrescoImapConst.ImapViewMode viewMode, boolean extractAttachmentsEnabled, ImapService imapService, ServiceRegistry serviceRegistry, int mountPointId) ConstructsAlfrescoImapFolderobject.AlfrescoImapFolder(FileInfo folderInfo, String userName, String folderName, String folderPath, AlfrescoImapConst.ImapViewMode viewMode, ImapService imapService, ServiceRegistry serviceRegistry, Boolean selectable, boolean extractAttachmentsEnabled, int mountPointId) ConstructsAlfrescoImapFolderobject. -
Method Summary
Modifier and TypeMethodDescriptionprotected longappendMessageInternal(jakarta.mail.internet.MimeMessage message, jakarta.mail.Flags flags, Date internalDate) Appends message to the folder.protected longcopyMessageInternal(long uid, com.icegreen.greenmail.store.MailFolder toFolder) Copies message with the given UID to the specifiedMailFolder.voidMarks all messages in the folder as deleted usingjavax.mail.Flags.Flag#DELETEDflag.protected voidDeletes messages marked withjavax.mail.Flags.Flag#DELETED.protected voidexpungeInternal(long uid) Deletes messages marked withjavax.mail.Flags.Flag#DELETED.intReturns the MSN number of the first unseen message.protected ImapService.FolderStatusintReturns count of the messages in the folder.protected com.icegreen.greenmail.store.SimpleStoredMessagegetMessageInternal(long uid) Returns message by its UID.protected List<com.icegreen.greenmail.store.SimpleStoredMessage>Returns list of all messages in the folder.protected List<com.icegreen.greenmail.store.SimpleStoredMessage>getMessagesInternal(com.icegreen.greenmail.foedus.util.MsgRangeFilter msgRangeFilter) Returns list of messages by filter.long[]Returns UIDs of all messages in the folder.intgetMsn(long uid) Returns message sequence number in the folder by its UID.getName()protected List<com.icegreen.greenmail.store.SimpleStoredMessage>Returns the list of messages that have nojavax.mail.Flags.Flag#DELETEDflag set for current user.jakarta.mail.FlagsReturns permanent flags.intgetRecentCount(boolean reset) Returns count of messages withjavax.mail.Flags.Flag#RECENTflag.longReturns UIDNEXT value of the folder.longReturns UIDVALIDITY value of the folder.intReturns count of the messages withjavax.mail.Flags.Flag#SEENin the folder for the current user.booleanbooleanisMarked()protected booleanWhether the folder is read-only for user.booleanprotected voidreplaceFlagsInternal(jakarta.mail.Flags flags, long uid, com.icegreen.greenmail.store.FolderListener silentListener, boolean addUid) Replaces flags for the message with the given UID.booleanreset()Invalidates the current cached stateprotected long[]searchInternal(jakarta.mail.search.SearchTerm searchTerm) protected voidsetFlagsInternal(jakarta.mail.Flags flags, boolean value, long uid, com.icegreen.greenmail.store.FolderListener silentListener, boolean addUid) Sets flags for the message with the given UID.Methods inherited from class org.alfresco.repo.imap.AbstractImapFolder
addListener, appendMessage, checkParameter, copyMessage, deleteAllMessages, expunge, expunge, getMessage, getMessages, getMessages, getNonDeletedMessages, notifyFlagUpdate, removeListener, replaceFlags, search, setFlags, signalDeletion, store, store
-
Constructor Details
-
AlfrescoImapFolder
public AlfrescoImapFolder(FileInfo folderInfo, String userName, String folderName, String folderPath, AlfrescoImapConst.ImapViewMode viewMode, boolean extractAttachmentsEnabled, ImapService imapService, ServiceRegistry serviceRegistry, int mountPointId) ConstructsAlfrescoImapFolderobject.- Parameters:
folderInfo- - reference to theFileInfoobject representing the folder.userName- - name of user (e.g. "admin" for admin user).folderName- - name of the folder.folderPath- - path of the folder.viewMode- - defines view mode. Can be one of the following:AlfrescoImapConst.ImapViewMode.ARCHIVEorAlfrescoImapConst.ImapViewMode.VIRTUAL.extractAttachmentsEnabled- booleanimapService- ImapServiceserviceRegistry- ServiceRegistrymountPointId- - id of the mount point.
-
AlfrescoImapFolder
public AlfrescoImapFolder(FileInfo folderInfo, String userName, String folderName, String folderPath, AlfrescoImapConst.ImapViewMode viewMode, ImapService imapService, ServiceRegistry serviceRegistry, Boolean selectable, boolean extractAttachmentsEnabled, int mountPointId) ConstructsAlfrescoImapFolderobject.- Parameters:
folderInfo- - reference to theFileInfoobject representing the folder.userName- - name of the user (e.g. "admin" for admin user).folderName- - name of the folder.folderPath- - path of the folder.viewMode- - defines view mode. Can be one of the following:AlfrescoImapConst.ImapViewMode.ARCHIVEorAlfrescoImapConst.ImapViewMode.VIRTUAL.imapService- - the IMAP service.serviceRegistry- ServiceRegistryselectable- - defines whether the folder is selectable or not.extractAttachmentsEnabled- booleanmountPointId- int
-
-
Method Details
-
isExtractAttachmentsEnabled
public boolean isExtractAttachmentsEnabled() -
getFullName
- Specified by:
getFullNamein interfacecom.icegreen.greenmail.store.MailFolder
-
getName
- Specified by:
getNamein interfacecom.icegreen.greenmail.store.MailFolder
-
isSelectable
public boolean isSelectable()- Specified by:
isSelectablein interfacecom.icegreen.greenmail.store.MailFolder
-
reset
public boolean reset()Invalidates the current cached state- Returns:
trueif this instance is still valid for reuse
-
getFolderStatus
-
appendMessageInternal
protected long appendMessageInternal(jakarta.mail.internet.MimeMessage message, jakarta.mail.Flags flags, Date internalDate) throws FileExistsException, FileNotFoundException, IOException, jakarta.mail.MessagingException Appends message to the folder.- Specified by:
appendMessageInternalin classAbstractImapFolder- Parameters:
message- - message.flags- - message flags.internalDate- - not used. Current date used instead.- Throws:
FileExistsExceptionFileNotFoundExceptionIOExceptionjakarta.mail.MessagingException
-
copyMessageInternal
protected long copyMessageInternal(long uid, com.icegreen.greenmail.store.MailFolder toFolder) throws jakarta.mail.MessagingException, FileExistsException, FileNotFoundException, IOException Copies message with the given UID to the specifiedMailFolder.- Specified by:
copyMessageInternalin classAbstractImapFolder- Parameters:
uid- - UID of the messagetoFolder- - reference to the destination folder.- Throws:
jakarta.mail.MessagingExceptionIOExceptionFileNotFoundExceptionFileExistsException
-
deleteAllMessagesInternal
public void deleteAllMessagesInternal() throws com.icegreen.greenmail.store.FolderExceptionMarks all messages in the folder as deleted usingjavax.mail.Flags.Flag#DELETEDflag.- Specified by:
deleteAllMessagesInternalin classAbstractImapFolder- Throws:
com.icegreen.greenmail.store.FolderException
-
expungeInternal
protected void expungeInternal() throws com.icegreen.greenmail.store.FolderExceptionDeletes messages marked withjavax.mail.Flags.Flag#DELETED. Note that this message deletes all messages with this flag.- Specified by:
expungeInternalin classAbstractImapFolder- Throws:
com.icegreen.greenmail.store.FolderException
-
expungeInternal
Deletes messages marked withjavax.mail.Flags.Flag#DELETED. Note that this message deletes the message with current uid- Specified by:
expungeInternalin classAbstractImapFolder- Throws:
Exception
-
getFirstUnseen
public int getFirstUnseen()Returns the MSN number of the first unseen message.- Specified by:
getFirstUnseenin interfacecom.icegreen.greenmail.store.MailFolder- Returns:
- MSN number of the first unseen message.
-
getMessageInternal
protected com.icegreen.greenmail.store.SimpleStoredMessage getMessageInternal(long uid) throws jakarta.mail.MessagingException Returns message by its UID.- Specified by:
getMessageInternalin classAbstractImapFolder- Parameters:
uid- - UID of the message.- Returns:
- message.
- Throws:
jakarta.mail.MessagingException
-
getMessageCount
public int getMessageCount()Returns count of the messages in the folder.- Specified by:
getMessageCountin interfacecom.icegreen.greenmail.store.MailFolder- Returns:
- Count of the messages.
-
getMessageUids
public long[] getMessageUids()Returns UIDs of all messages in the folder.- Specified by:
getMessageUidsin interfacecom.icegreen.greenmail.store.MailFolder- Returns:
- UIDS of the messages.
-
getMessagesInternal
Returns list of all messages in the folder.- Specified by:
getMessagesInternalin classAbstractImapFolder- Returns:
- list of
SimpleStoredMessageobjects.
-
getMessagesInternal
protected List<com.icegreen.greenmail.store.SimpleStoredMessage> getMessagesInternal(com.icegreen.greenmail.foedus.util.MsgRangeFilter msgRangeFilter) Returns list of messages by filter.- Specified by:
getMessagesInternalin classAbstractImapFolder- Parameters:
msgRangeFilter- -MsgRangeFilterobject representing filter.- Returns:
- list of filtered messages.
-
getMsn
public int getMsn(long uid) throws com.icegreen.greenmail.store.FolderException Returns message sequence number in the folder by its UID.- Specified by:
getMsnin interfacecom.icegreen.greenmail.store.MailFolder- Parameters:
uid- - message UID.- Returns:
- message sequence number.
- Throws:
com.icegreen.greenmail.store.FolderException- if no message with given UID.
-
getNonDeletedMessagesInternal
Returns the list of messages that have nojavax.mail.Flags.Flag#DELETEDflag set for current user.- Specified by:
getNonDeletedMessagesInternalin classAbstractImapFolder- Returns:
- the list of non-deleted messages.
-
getPermanentFlags
public jakarta.mail.Flags getPermanentFlags()Returns permanent flags.- Specified by:
getPermanentFlagsin interfacecom.icegreen.greenmail.store.MailFolder- Returns:
Flagsobject containing flags.
-
getRecentCount
public int getRecentCount(boolean reset) Returns count of messages withjavax.mail.Flags.Flag#RECENTflag. Ifresetparameter istrue- removesjavax.mail.Flags.Flag#RECENTflag from the message for current user.- Specified by:
getRecentCountin interfacecom.icegreen.greenmail.store.MailFolder- Parameters:
reset- - if true thejavax.mail.Flags.Flag#RECENTwill be deleted for current user if exists.- Returns:
- returns count of recent messages.
-
getUidNext
public long getUidNext()Returns UIDNEXT value of the folder.- Specified by:
getUidNextin interfacecom.icegreen.greenmail.store.MailFolder- Returns:
- UIDNEXT value.
-
getUidValidity
public long getUidValidity()Returns UIDVALIDITY value of the folder.- Specified by:
getUidValidityin interfacecom.icegreen.greenmail.store.MailFolder- Returns:
- UIDVALIDITY value.
-
getUnseenCount
public int getUnseenCount()Returns count of the messages withjavax.mail.Flags.Flag#SEENin the folder for the current user.- Specified by:
getUnseenCountin interfacecom.icegreen.greenmail.store.MailFolder- Returns:
- Count of the unseen messages for current user.
-
replaceFlagsInternal
protected void replaceFlagsInternal(jakarta.mail.Flags flags, long uid, com.icegreen.greenmail.store.FolderListener silentListener, boolean addUid) throws com.icegreen.greenmail.store.FolderException, jakarta.mail.MessagingException Replaces flags for the message with the given UID. IfaddUidis set totrueFolderListenerobjects defined for this folder will be notified.silentListenercan be provided - this listener wouldn't be notified.- Specified by:
replaceFlagsInternalin classAbstractImapFolder- Parameters:
flags- - new flags.uid- - message UID.silentListener- - listener that shouldn't be notified.addUid- - defines whether or not listeners be notified.- Throws:
com.icegreen.greenmail.store.FolderExceptionjakarta.mail.MessagingException
-
searchInternal
protected long[] searchInternal(jakarta.mail.search.SearchTerm searchTerm) - Specified by:
searchInternalin classAbstractImapFolder
-
setFlagsInternal
protected void setFlagsInternal(jakarta.mail.Flags flags, boolean value, long uid, com.icegreen.greenmail.store.FolderListener silentListener, boolean addUid) throws jakarta.mail.MessagingException, com.icegreen.greenmail.store.FolderException Sets flags for the message with the given UID. IfaddUidis set totrueFolderListenerobjects defined for this folder will be notified.silentListenercan be provided - this listener wouldn't be notified.- Specified by:
setFlagsInternalin classAbstractImapFolder- Parameters:
flags- - new flags.value- - flags value.uid- - message UID.silentListener- - listener that shouldn't be notified.addUid- - defines whether or not listeners be notified.- Throws:
jakarta.mail.MessagingExceptioncom.icegreen.greenmail.store.FolderException
-
getFolderPath
-
getFolderInfo
-
isMarked
public boolean isMarked()- Specified by:
isMarkedin interfacecom.icegreen.greenmail.store.MailFolder
-
isReadOnly
protected boolean isReadOnly()Whether the folder is read-only for user.- Specified by:
isReadOnlyin classAbstractImapFolder- Returns:
boolean
-
getViewMode
-