mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
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:
@@ -22,10 +22,12 @@ import static org.alfresco.repo.imap.AlfrescoImapConst.DICTIONARY_TEMPLATE_PREFI
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
@@ -40,6 +42,7 @@ import java.util.TreeMap;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
|
||||
import javax.mail.Flags;
|
||||
import javax.mail.Header;
|
||||
import javax.mail.Flags.Flag;
|
||||
import javax.mail.MessagingException;
|
||||
import javax.mail.internet.AddressException;
|
||||
@@ -166,6 +169,8 @@ public class ImapServiceImpl implements ImapService, OnRestoreNodePolicy, OnCrea
|
||||
|
||||
private boolean imapServerEnabled = false;
|
||||
|
||||
private List<String> messageHeadersToPersist = Collections.<String>emptyList();
|
||||
|
||||
static
|
||||
{
|
||||
qNameToFlag = new HashMap<QName, Flags.Flag>();
|
||||
@@ -343,6 +348,11 @@ public class ImapServiceImpl implements ImapService, OnRestoreNodePolicy, OnCrea
|
||||
this.imapServerEnabled = enabled;
|
||||
}
|
||||
|
||||
public void setMessageHeadersToPersist(List<String> headers)
|
||||
{
|
||||
this.messageHeadersToPersist = headers;
|
||||
}
|
||||
|
||||
public boolean getImapServerEnabled()
|
||||
{
|
||||
return this.imapServerEnabled;
|
||||
@@ -574,22 +584,30 @@ public class ImapServiceImpl implements ImapService, OnRestoreNodePolicy, OnCrea
|
||||
@Override
|
||||
public Void doWork() throws Exception
|
||||
{
|
||||
// Ignore if it is NOT hidden: the shuffle may have finished; the operation may have failed
|
||||
if (!nodeService.exists(nodeRef) || !fileFolderService.isHidden(nodeRef))
|
||||
return serviceRegistry.getTransactionService().getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Since this will run in a different thread, the client thread-local must be set
|
||||
// or else unhiding the node will not unhide it for IMAP.
|
||||
FileFilterMode.setClient(FileFilterMode.Client.imap);
|
||||
|
||||
// Unhide the node, e.g. for archiving
|
||||
fileFolderService.setHidden(nodeRef, false);
|
||||
|
||||
// This is the transaction-aware service
|
||||
fileFolderService.delete(nodeRef);
|
||||
return null;
|
||||
@Override
|
||||
public Void execute() throws Throwable
|
||||
{
|
||||
// Ignore if it is NOT hidden: the shuffle may have finished; the operation may have failed
|
||||
if (!nodeService.exists(nodeRef) || !fileFolderService.isHidden(nodeRef))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Since this will run in a different thread, the client thread-local must be set
|
||||
// or else unhiding the node will not unhide it for IMAP.
|
||||
FileFilterMode.setClient(FileFilterMode.Client.imap);
|
||||
|
||||
// Unhide the node, e.g. for archiving
|
||||
fileFolderService.setHidden(nodeRef, false);
|
||||
|
||||
// This is the transaction-aware service
|
||||
fileFolderService.delete(nodeRef);
|
||||
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
try
|
||||
@@ -2030,6 +2048,50 @@ public class ImapServiceImpl implements ImapService, OnRestoreNodePolicy, OnCrea
|
||||
return fileName;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void persistMessageHeaders(NodeRef messageRef, MimeMessage message)
|
||||
{
|
||||
try
|
||||
{
|
||||
Enumeration<Header> headers = message.getAllHeaders();
|
||||
List<String> messaheHeadersProperties = new ArrayList<String>();
|
||||
while(headers.hasMoreElements())
|
||||
{
|
||||
Header header = headers.nextElement();
|
||||
if (isPersistableHeader(header))
|
||||
{
|
||||
messaheHeadersProperties.add(header.getName() + ImapModel.MESSAGE_HEADER_TO_PERSIST_SPLITTER + header.getValue());
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("[persistHeaders] Persisting Header " + header.getName() + " : " + header.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Map<QName, Serializable> props = new HashMap<QName, Serializable>();
|
||||
props.put(ImapModel.PROP_MESSAGE_HEADERS, (Serializable)messaheHeadersProperties);
|
||||
|
||||
serviceRegistry.getNodeService().addAspect(messageRef, ImapModel.ASPECT_IMAP_MESSAGE_HEADERS, props);
|
||||
}
|
||||
catch(MessagingException me)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isPersistableHeader(Header header)
|
||||
{
|
||||
for (String headerToPersist : messageHeadersToPersist)
|
||||
{
|
||||
if (headerToPersist.equalsIgnoreCase(header.getName()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static class CacheItem
|
||||
{
|
||||
private Date modified;
|
||||
|
Reference in New Issue
Block a user