Author: norman
Date: Mon Jul 18 13:22:10 2011
New Revision: 1147852
URL: http://svn.apache.org/viewvc?rev=1147852&view=rev
Log:
Javadocs and small optimizations
Modified:
james/mailbox/trunk/api/src/main/java/org/apache/james/mailbox/MessageManager.java
james/mailbox/trunk/store/src/main/java/org/apache/james/mailbox/store/StoreMessageManager.java
Modified:
james/mailbox/trunk/api/src/main/java/org/apache/james/mailbox/MessageManager.java
URL:
http://svn.apache.org/viewvc/james/mailbox/trunk/api/src/main/java/org/apache/james/mailbox/MessageManager.java?rev=1147852&r1=1147851&r2=1147852&view=diff
==============================================================================
---
james/mailbox/trunk/api/src/main/java/org/apache/james/mailbox/MessageManager.java
(original)
+++
james/mailbox/trunk/api/src/main/java/org/apache/james/mailbox/MessageManager.java
Mon Jul 18 13:22:10 2011
@@ -190,14 +190,41 @@ public interface MessageManager {
public interface MetaData {
/**
- * Describes the optional data types.
+ * Describes the optional data types which will get set in the {@link
MetaData}.
+ *
+ * These are always set:
+ * - HIGHESTMODSEQ
+ * - PERMANENTFLAGS
+ * - UIDNEXT
+ * - UIDVALIDITY
+ * - MODSEQPERMANET
+ * - WRITABLE
*/
public enum FetchGroup {
- NO_UNSEEN, UNSEEN_COUNT, FIRST_UNSEEN, NO_COUNT
+
+ /**
+ * Only include the message and recent count
+ */
+ NO_UNSEEN,
+
+ /**
+ * Only include the unseen message and recent count
+ */
+ UNSEEN_COUNT,
+
+ /**
+ * Only include the first unseen and the recent count
+ */
+ FIRST_UNSEEN,
+
+ /**
+ * Only return the "always set" metadata as documented above
+ */
+ NO_COUNT
};
/**
- * Gets the UIDs of recent messages.
+ * Gets the UIDs of recent messages if requested or an empty {@link
List} otherwise.
*
* @return the uids flagged RECENT in this mailbox,
*/
@@ -242,9 +269,12 @@ public interface MessageManager {
long getHighestModSeq();
/**
- * Gets the number of messages that this mailbox contains.
+ * Gets the number of messages that this mailbox contains. This is an
+ * optional property.<br>
*
- * @return number of messages contained
+ * @return number of messages contained or -1 when this
+ * optional data has not be requested
+ *
*/
long getMessageCount();
Modified:
james/mailbox/trunk/store/src/main/java/org/apache/james/mailbox/store/StoreMessageManager.java
URL:
http://svn.apache.org/viewvc/james/mailbox/trunk/store/src/main/java/org/apache/james/mailbox/store/StoreMessageManager.java?rev=1147852&r1=1147851&r2=1147852&view=diff
==============================================================================
---
james/mailbox/trunk/store/src/main/java/org/apache/james/mailbox/store/StoreMessageManager.java
(original)
+++
james/mailbox/trunk/store/src/main/java/org/apache/james/mailbox/store/StoreMessageManager.java
Mon Jul 18 13:22:10 2011
@@ -375,7 +375,7 @@ public class StoreMessageManager<Id> imp
*/
public MetaData getMetaData(boolean resetRecent, MailboxSession
mailboxSession,
org.apache.james.mailbox.MessageManager.MetaData.FetchGroup
fetchGroup) throws MailboxException {
- final List<Long> recent = recent(resetRecent, mailboxSession);
+ final List<Long> recent;
final Flags permanentFlags = getPermanentFlags(mailboxSession);
final long uidValidity = getMailboxEntity().getUidValidity();
final long uidNext =
mapperFactory.getMessageMapper(mailboxSession).getLastUid(mailbox) +1;
@@ -388,21 +388,32 @@ public class StoreMessageManager<Id> imp
unseenCount = countUnseenMessagesInMailbox(mailboxSession);
messageCount = getMessageCount(mailboxSession);
firstUnseen = null;
+ recent = recent(resetRecent, mailboxSession);
+
break;
case FIRST_UNSEEN:
firstUnseen = findFirstUnseenMessageUid(mailboxSession);
messageCount = getMessageCount(mailboxSession);
unseenCount = 0;
+ recent = recent(resetRecent, mailboxSession);
+
break;
case NO_UNSEEN:
firstUnseen = null;
unseenCount = 0;
messageCount = getMessageCount(mailboxSession);
+ recent = recent(resetRecent, mailboxSession);
+
break;
default:
firstUnseen = null;
unseenCount = 0;
messageCount = -1;
+ // just reset the recent but not include them in the metadata
+ if (resetRecent) {
+ recent(resetRecent, mailboxSession);
+ }
+ recent = new ArrayList<Long>();
break;
}
return new MailboxMetaData(recent, permanentFlags, uidValidity,
uidNext,highestModSeq, messageCount, unseenCount, firstUnseen,
isWriteable(mailboxSession), isModSeqPermanent(mailboxSession));
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]