Merged HEAD-BUG-FIX (5.1/Cloud) to HEAD (5.1/Cloud)

92231: Merged 5.0.N (5.0.1) to HEAD-BUG-FIX (5.1/Cloud)
      91995: MNT-12925: Merged V4.2-BUG-FIX (4.2.5) to 5.0.N (5.0.1)
         91709 : MNT-12896: Merged V4.2.1 (4.2.1.17) to V4.2-BUG-FIX (4.2.5)
            89881: Merged DEV to PATCHES/V4.2.1 (4.2.1.16)
               89858 : MNT-12584 : Files are multiplying themselves when do a move out and move in
                  - UIDPLUS extension implemented : UID EXPUNGE command and APPENDUID and COPYUID response codes
               88997,89016 : MNT-12584 : Files are multiplying themselves when do a move out and move in
                  - UID SEARCH HEADER Message-Id implemented
               88824 : MNT-12585 : All files disappear from a folder if one file is moved out + one file is deleted
                  - greenmail-1.3-patched.jar was patched again to implement DELETED flag search.
                  - Updated source files and diff file for greenmail-1.3-patched.jar library.
               88774 : MNT-12546: Deleting a file in Share may not be reflected in IMAP Outlook 2011, then sync may create EML attachments in Share
                  - Removed force change of UID validity as it is not required.
               88585 : MNT-12518 : Outlook 2013: moving files to a folder and back to original leads to view discrepancies
                  - Test changed according to new delete/append behavior
               88360 : Merged DEV to DEV (V4.2.1-IMAP)
                  88280: MNT-12575: IMAP Needs to RETRY
                     - Incremented MAX-RETRIS parameter up to 20, wrapped Timer to RetryingTransactionHelper.
               88294,88343,88345 : MNT-12546: Deleting a file in Share may not be reflected in IMAP Outlook 2011, then sync may create EML attachments in Share
                  - Fixed IMAP caching of deleted files via Share.
               88291 : MNT-12518 : Outlook 2013: moving files to a folder and back to original leads to view discrepancies
                  - Implement Outlook 2013 move shuffle as copy
            90106: Merged DEV to PATCHES/V4.2.1 (4.2.1.16)
               89996 : MNT-12584 : Files are multiplying themselves when do a move out and move in
                  - Green mail source files have been updated
            90109: Merged DEV to PATCHES/V4.2.1 (4.2.1.16)
               90105 : MNT-12518 : Outlook 2013: moving files to a folder and back to original leads to view discrepancies
                  - Do not use APPENDUID response code to avoid usage of cached messages in Outlook 2013
            90307: Merged DEV to PATCHES/V4.2.1 (4.2.1.16)
               90268,90271 : MNT-12585 : All files disappear from a folder if one file is moved out + one file is deleted
                  - Squeeze UIDVALIDITY. Implement untagged EXPUNGE response
            91371: MNT-12856 : User cannot see document in repository if content was not checked by admin from IMAP
               - AccessDeniedException should not break IMAP response
            91708: MNT-12585 : All files disappear from a folder if one file is moved out + one file is deleted
               - Change reference to greenmail in the pom file.
                 Should have been when the jar changed, however this is not used in the build used to create the artefacts.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@94859 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2015-01-31 11:45:08 +00:00
parent 93ad20b14e
commit 63d0306f84
10 changed files with 258 additions and 62 deletions

View File

@@ -49,7 +49,7 @@ public abstract class AbstractImapFolder implements MailFolder
private List<FolderListener> listeners = new LinkedList<FolderListener>();
protected ServiceRegistry serviceRegistry;
protected static int MAX_RETRIES = 1;
protected static int MAX_RETRIES = 20;
public AbstractImapFolder(ServiceRegistry serviceRegistry)
@@ -103,7 +103,7 @@ public abstract class AbstractImapFolder implements MailFolder
* @param uid - UID of the message
* @param toFolder - reference to the destination folder.
*/
public void copyMessage(final long uid, final MailFolder toFolder) throws FolderException
public long copyMessage(final long uid, final MailFolder toFolder) throws FolderException
{
AbstractImapFolder toImapMailFolder = (AbstractImapFolder) toFolder;
@@ -112,15 +112,14 @@ public abstract class AbstractImapFolder implements MailFolder
throw new FolderException(AlfrescoImapFolderException.PERMISSION_DENIED);
}
CommandCallback<Object> command = new CommandCallback<Object>()
CommandCallback<Long> command = new CommandCallback<Long>()
{
public Object command() throws Throwable
public Long command() throws Throwable
{
copyMessageInternal(uid, toFolder);
return null;
return copyMessageInternal(uid, toFolder);
}
};
command.runFeedback();
return command.runFeedback();
}
/**
@@ -161,6 +160,25 @@ public abstract class AbstractImapFolder implements MailFolder
command.runFeedback();
}
/**
* Deletes messages marked with {@link Flags.Flag#DELETED}. Note that this message deletes the messages with current uid
*/
public void expunge(final long uid) throws FolderException
{
if (isReadOnly())
{
throw new FolderException("Can't expunge - Permission denied");
}
CommandCallback<Object> command = new CommandCallback<Object>()
{
public Object command() throws Throwable
{
expungeInternal(uid);
return null;
}
};
command.runFeedback();
}
/**
* Returns message by its UID.
@@ -258,14 +276,21 @@ public abstract class AbstractImapFolder implements MailFolder
/**
* Simply returns UIDs of all messages in the folder.
* Searches the mailbox for messages that match the given searching criteria
*
* @param searchTerm - not used
* @param searchTerm - search term that contains search criteria.
* @return UIDs of the messages
*/
public long[] search(SearchTerm searchTerm)
public long[] search(final SearchTerm searchTerm)
{
return getMessageUids();
CommandCallback<long[]> command = new CommandCallback<long[]>()
{
public long[] command() throws Throwable
{
return searchInternal(searchTerm);
}
};
return command.run();
}
/**
@@ -377,12 +402,14 @@ public abstract class AbstractImapFolder implements MailFolder
protected abstract long appendMessageInternal(MimeMessage message, Flags flags, Date internalDate) throws Exception;
protected abstract void copyMessageInternal(long uid, MailFolder toFolder) throws Exception;
protected abstract long copyMessageInternal(long uid, MailFolder toFolder) throws Exception;
protected abstract void deleteAllMessagesInternal() throws Exception;
protected abstract void expungeInternal() throws Exception;
protected abstract void expungeInternal(long uid) throws Exception;
protected abstract SimpleStoredMessage getMessageInternal(long uid) throws Exception;
protected abstract List<SimpleStoredMessage> getMessagesInternal();
@@ -393,6 +420,8 @@ public abstract class AbstractImapFolder implements MailFolder
protected abstract void replaceFlagsInternal(Flags flags, long uid, FolderListener silentListener, boolean addUid) throws Exception;
protected abstract long[] searchInternal(SearchTerm searchTerm);
protected abstract void setFlagsInternal(Flags flags, boolean value, long uid, FolderListener silentListener, boolean addUid) throws Exception;
protected abstract class CommandCallback<T>