You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by rd...@apache.org on 2008/09/18 23:45:03 UTC
svn commit: r696828 [8/32] - in /james/protocols/imap/trunk:
api/src/main/java/org/apache/james/api/imap/
api/src/main/java/org/apache/james/api/imap/display/
api/src/main/java/org/apache/james/api/imap/imap4rev1/
api/src/main/java/org/apache/james/api...
Modified: james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/MessageResult.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/MessageResult.java?rev=696828&r1=696827&r2=696828&view=diff
==============================================================================
--- james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/MessageResult.java (original)
+++ james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/MessageResult.java Thu Sep 18 14:44:56 2008
@@ -68,29 +68,36 @@
* Indicates the results fetched.
*/
public interface FetchGroup {
-
+
/**
* For example: could have best performance when doing store and then
* forget. UIDs are always returned
*/
public static final int MINIMAL = 0x00;
+
/**
*
*/
public static final int MIME_DESCRIPTOR = 0x01;
public static final int SIZE = 0x20;
+
public static final int INTERNAL_DATE = 0x40;
+
public static final int FLAGS = 0x80;
+
public static final int HEADERS = 0x100;
+
public static final int FULL_CONTENT = 0x200;
+
public static final int BODY_CONTENT = 0x400;
+
public static final int MIME_HEADERS = 0x800;
+
public static final int MIME_CONTENT = 0x1000;
-
+
/**
- * Contents to be fetched.
- * Composed bitwise.
+ * Contents to be fetched. Composed bitwise.
*
* @return bitwise descripion
* @see #MINIMAL
@@ -105,26 +112,24 @@
* @see #MIME_CONTENT
*/
public int content();
-
+
/**
- * Gets contents to be fetched for contained parts.
- * For each part to be contained,
- * only one descriptor should be contained.
- * @return <code>Set</code> of {@link PartContentDescriptor},
- * or null if there is no part content to be fetched
+ * Gets contents to be fetched for contained parts. For each part to be
+ * contained, only one descriptor should be contained.
+ *
+ * @return <code>Set</code> of {@link PartContentDescriptor}, or null
+ * if there is no part content to be fetched
*/
public Set getPartContentDescriptors();
-
+
/**
- * Describes the contents to be fetched for a mail part.
- * All implementations MUST implement equals.
- * Two implementations are equal if and only if
- * their paths are equal.
+ * Describes the contents to be fetched for a mail part. All
+ * implementations MUST implement equals. Two implementations are equal
+ * if and only if their paths are equal.
*/
public interface PartContentDescriptor {
/**
- * Contents to be fetched.
- * Composed bitwise.
+ * Contents to be fetched. Composed bitwise.
*
* @return bitwise descripion
* @see #MINIMAL
@@ -138,17 +143,19 @@
* @see #BODY_CONTENT
*/
public int content();
-
+
/**
* Path describing the part to be fetched.
+ *
* @return path describing the part, not null
*/
public MimePath path();
}
}
-
+
/**
* Gets the results set.
+ *
* @return bitwise indication of result set
* @see MessageResultUtils#isIncluded(MessageResult, int)
*/
@@ -185,267 +192,283 @@
Flags getFlags() throws MailboxManagerException;
int getSize();
-
+
/**
* Gets headers for the message.
- * @return <code>Header</code> <code>Iterator</code>,
- * or null if {@link FetchGroup#HEADERS} was not fetched
+ *
+ * @return <code>Header</code> <code>Iterator</code>, or null if
+ * {@link FetchGroup#HEADERS} was not fetched
*/
Iterator headers() throws MailboxManagerException;
-
+
/**
- * Iterates the message headers for the given
- * part in a multipart message.
- * @param path describing the part's position within
- * a multipart message
- * @return <code>Header</code> <code>Iterator</code>,
- * or null when {@link FetchGroup#mimeHeaders()} does not
- * include the index and when the mime part cannot be found
+ * Iterates the message headers for the given part in a multipart message.
+ *
+ * @param path
+ * describing the part's position within a multipart message
+ * @return <code>Header</code> <code>Iterator</code>, or null when
+ * {@link FetchGroup#mimeHeaders()} does not include the index and
+ * when the mime part cannot be found
* @throws MailboxManagerException
*/
Iterator iterateHeaders(MimePath path) throws MailboxManagerException;
-
+
/**
- * Iterates the MIME headers for the given
- * part in a multipart message.
- * @param path describing the part's position within
- * a multipart message
- * @return <code>Header</code> <code>Iterator</code>,
- * or null when {@link FetchGroup#mimeHeaders()} does not
- * include the index and when the mime part cannot be found
+ * Iterates the MIME headers for the given part in a multipart message.
+ *
+ * @param path
+ * describing the part's position within a multipart message
+ * @return <code>Header</code> <code>Iterator</code>, or null when
+ * {@link FetchGroup#mimeHeaders()} does not include the index and
+ * when the mime part cannot be found
* @throws MailboxManagerException
*/
Iterator iterateMimeHeaders(MimePath path) throws MailboxManagerException;
-
+
/**
* A header.
*/
public interface Header extends Content {
-
+
/**
* Gets the name of this header.
+ *
* @return name of this header
- * @throws MessagingException
+ * @throws MessagingException
*/
public String getName() throws MailboxManagerException;
-
+
/**
* Gets the (unparsed) value of this header.
+ *
* @return value of this header
* @throws MessagingException
*/
public String getValue() throws MailboxManagerException;
}
-
+
/**
- * Gets the full message including headers and body.
- * The message data should have normalised line endings (CRLF).
- * @return <code>Content</code>,
- * or or null if {@link FetchGroup#FULL_CONTENT} has not been included in the
- * results
+ * Gets the full message including headers and body. The message data should
+ * have normalised line endings (CRLF).
+ *
+ * @return <code>Content</code>, or or null if
+ * {@link FetchGroup#FULL_CONTENT} has not been included in the
+ * results
*/
Content getFullContent() throws MailboxManagerException;
-
/**
* Gets the full content of the given mime part.
- * @param path describes the part
- * @return <code>Content</code>,
- * or null when {@link FetchGroup#mimeBodies()} did not been include
- * the given index and when the mime part cannot be found
+ *
+ * @param path
+ * describes the part
+ * @return <code>Content</code>, or null when
+ * {@link FetchGroup#mimeBodies()} did not been include the given
+ * index and when the mime part cannot be found
* @throws MailboxManagerException
*/
Content getFullContent(MimePath path) throws MailboxManagerException;
-
+
/**
- * Gets the body of the message excluding headers.
- * The message data should have normalised line endings (CRLF).
- * @return <code>Content</code>,
- * or or null if {@link FetchGroup#FULL_CONTENT} has not been included in the
- * results
+ * Gets the body of the message excluding headers. The message data should
+ * have normalised line endings (CRLF).
+ *
+ * @return <code>Content</code>, or or null if
+ * {@link FetchGroup#FULL_CONTENT} has not been included in the
+ * results
*/
Content getBody() throws MailboxManagerException;
-
+
/**
* Gets the body of the given mime part.
- * @param path describes the part
- * @return <code>Content</code>,
- * or null when {@link FetchGroup#mimeBodies()} did not been include
- * the given index and when the mime part cannot be found
+ *
+ * @param path
+ * describes the part
+ * @return <code>Content</code>, or null when
+ * {@link FetchGroup#mimeBodies()} did not been include the given
+ * index and when the mime part cannot be found
* @throws MailboxManagerException
*/
Content getBody(MimePath path) throws MailboxManagerException;
-
/**
* Gets the body of the given mime part.
- * @param path describes the part
- * @return <code>Content</code>,
- * or null when {@link FetchGroup#mimeBodies()} did not been include
- * the given index and when the mime part cannot be found
+ *
+ * @param path
+ * describes the part
+ * @return <code>Content</code>, or null when
+ * {@link FetchGroup#mimeBodies()} did not been include the given
+ * index and when the mime part cannot be found
* @throws MailboxManagerException
*/
Content getMimeBody(MimePath path) throws MailboxManagerException;
/**
- * IMAP needs to know the size of the content before it starts to write it out.
- * This interface allows direct writing whilst exposing total size.
+ * IMAP needs to know the size of the content before it starts to write it
+ * out. This interface allows direct writing whilst exposing total size.
*/
public interface Content {
/**
* Writes content into the given buffer.
- * @param buffer <code>StringBuffer</code>, not null
+ *
+ * @param buffer
+ * <code>StringBuffer</code>, not null
* @throws MessagingException
*/
public void writeTo(StringBuffer buffer);
-
+
/**
* Writes content to the given channel.
- * @param channel <code>Channel</code> open, not null
+ *
+ * @param channel
+ * <code>Channel</code> open, not null
* @throws MailboxManagerException
- * @throws IOException when channel IO fails
+ * @throws IOException
+ * when channel IO fails
*/
public void writeTo(WritableByteChannel channel) throws IOException;
-
+
/**
* Size (in octets) of the content.
+ *
* @return number of octets to be written
* @throws MessagingException
*/
public long size();
}
-
+
/**
- * Describes a path within a multipart MIME message.
- * All implementations must implement equals.
- * Two paths are equal if and only if
- * each position is identical.
+ * Describes a path within a multipart MIME message. All implementations
+ * must implement equals. Two paths are equal if and only if each position
+ * is identical.
*/
public interface MimePath {
-
+
/**
* Gets the positions of each part in the path.
+ *
* @return part positions describing the path
*/
public int[] getPositions();
}
-
+
public interface MimeDescriptor extends Headers {
/**
* Gets the top level MIME content media type.
- * @return top level MIME content media type,
- * or null if default
+ *
+ * @return top level MIME content media type, or null if default
*/
public String getMimeType();
-
+
/**
* Gets the MIME content subtype.
- * @return the MIME content subtype,
- * or null if default
+ *
+ * @return the MIME content subtype, or null if default
*/
public String getMimeSubType();
-
+
/**
* Gets the MIME <code>Content-ID</code> header value.
- * @return MIME <code>Content-ID</code>,
- * possibly null
+ *
+ * @return MIME <code>Content-ID</code>, possibly null
*/
public String getContentID();
-
+
/**
* Gets MIME <code>Content-Description</code> header value.
- * @return MIME <code>Content-Description</code>,
- * possibly null
+ *
+ * @return MIME <code>Content-Description</code>, possibly null
*/
public String getContentDescription();
-
+
/**
* Gets MIME <code>Content-Location</code> header value.
- * @return parsed MIME <code>Content-Location</code>,
- * possibly null
+ *
+ * @return parsed MIME <code>Content-Location</code>, possibly null
*/
public String getContentLocation();
-
+
/**
* Gets MIME <code>Content-MD5</code> header value.
- * @return parsed MIME <code>Content-MD5</code>,
- * possibly null
+ *
+ * @return parsed MIME <code>Content-MD5</code>, possibly null
*/
public String getContentMD5();
-
+
/**
* Gets the MIME content transfer encoding.
- * @return MIME <code>Content-Transfer-Encoding</code>,
- * possibly null
+ *
+ * @return MIME <code>Content-Transfer-Encoding</code>, possibly null
*/
public String getTransferContentEncoding();
-
+
/**
- * Gets the languages,
- * From the MIME <code>Content-Language</code> header value.
+ * Gets the languages, From the MIME <code>Content-Language</code>
+ * header value.
+ *
* @return <code>List</code> of <code>String</code> names
*/
public List getLanguages();
-
+
/**
* Gets MIME <code>Content-Disposition</code>.
- * @return <code>Content-Disposition</code>,
- * or null if no disposition header exists
+ *
+ * @return <code>Content-Disposition</code>, or null if no
+ * disposition header exists
*/
public String getDisposition();
-
+
/**
- * Gets MIME <code>Content-Disposition</code>
- * parameters.
- * @return <code>Content-Disposition</code>
- * values indexed by names
+ * Gets MIME <code>Content-Disposition</code> parameters.
+ *
+ * @return <code>Content-Disposition</code> values indexed by names
*/
public Map getDispositionParams();
-
+
/**
- * Gets the number of lines of text in a part
- * of type <code>TEXT</code> when transfer
- * encoded.
+ * Gets the number of lines of text in a part of type <code>TEXT</code>
+ * when transfer encoded.
*
- * @return <code>CRLF</code> count
- * when a <code>TEXT</code> type, otherwise -1
+ * @return <code>CRLF</code> count when a <code>TEXT</code> type,
+ * otherwise -1
*/
public long getLines();
-
+
/**
* The number of octets contained in the body of this part.
*
* @return number of octets
*/
public long getBodyOctets();
-
+
/**
* Gets parts.
- * @return <code>MimeDescriptor</code> <code>Iterator</code>
- * when a composite top level MIME media type,
- * null otherwise
+ *
+ * @return <code>MimeDescriptor</code> <code>Iterator</code> when a
+ * composite top level MIME media type, null otherwise
*/
public Iterator parts();
-
+
/**
* Gets embedded message.
- * @return <code>MimeDescriptor</code> when top level MIME type is <code>message</code>,
- * null otherwise
+ *
+ * @return <code>MimeDescriptor</code> when top level MIME type is
+ * <code>message</code>, null otherwise
*/
public MimeDescriptor embeddedMessage();
-
+
/**
* Gets headers.
- * @return <code>Header</code> <code>Iterator</code>,
- * not null
+ *
+ * @return <code>Header</code> <code>Iterator</code>, not null
*/
public Iterator headers();
-
+
/**
* Gets MIME body parameters parsed from <code>Content-Type</code>.
- * @return <code>Header</code> <code>Iterator</code>,
- * not null
+ *
+ * @return <code>Header</code> <code>Iterator</code>, not null
*/
public Iterator contentTypeParameters();
}
Modified: james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/SearchQuery.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/SearchQuery.java?rev=696828&r1=696827&r2=696828&view=diff
==============================================================================
--- james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/SearchQuery.java (original)
+++ james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/SearchQuery.java Thu Sep 18 14:44:56 2008
@@ -28,130 +28,181 @@
import javax.mail.Flags.Flag;
/**
- * <p>Models a query used to search for messages.
- * A query is the logical <code>AND</code> of the contained criteria.
- * </p><p>
+ * <p>
+ * Models a query used to search for messages. A query is the logical
+ * <code>AND</code> of the contained criteria.
+ * </p>
+ * <p>
* Each <code>Criterion</code> is composed of an <code>Operator</code>
- * (combining value and operation) together with field
- * information (optional since the criteria type may imply a particular
- * field).
- * Factory methods are provided for criteria.
- * </p>
+ * (combining value and operation) together with field information (optional
+ * since the criteria type may imply a particular field). Factory methods are
+ * provided for criteria.
+ * </p>
*/
public class SearchQuery {
/**
* Creates a filter for message size less than the given value
- * @param value messages with size less than this value will be selected
- * by the returned criterion
+ *
+ * @param value
+ * messages with size less than this value will be selected by
+ * the returned criterion
* @return <code>Criterion</code>, not null
*/
public static final Criterion sizeLessThan(long value) {
- return new SizeCriterion(new NumericOperator(value, NumericOperator.LESS_THAN));
+ return new SizeCriterion(new NumericOperator(value,
+ NumericOperator.LESS_THAN));
}
/**
* Creates a filter for message size greater than the given value
- * @param value messages with size greater than this value will be selected
- * by the returned criterion
+ *
+ * @param value
+ * messages with size greater than this value will be selected by
+ * the returned criterion
* @return <code>Criterion</code>, not null
*/
public static final Criterion sizeGreaterThan(long value) {
- return new SizeCriterion(new NumericOperator(value, NumericOperator.GREATER_THAN));
+ return new SizeCriterion(new NumericOperator(value,
+ NumericOperator.GREATER_THAN));
}
-
+
/**
* Creates a filter for message size equal to the given value
- * @param value messages with size equal to this value will be selected
- * by the returned criterion
+ *
+ * @param value
+ * messages with size equal to this value will be selected by the
+ * returned criterion
* @return <code>Criterion</code>, not null
*/
public static final Criterion sizeEquals(long value) {
- return new SizeCriterion(new NumericOperator(value, NumericOperator.EQUALS));
+ return new SizeCriterion(new NumericOperator(value,
+ NumericOperator.EQUALS));
}
-
+
/**
- * Creates a filter matching messages with internal date after the given date.
- * @param day one based day of the month
- * @param month one based month of the year
- * @param year year
+ * Creates a filter matching messages with internal date after the given
+ * date.
+ *
+ * @param day
+ * one based day of the month
+ * @param month
+ * one based month of the year
+ * @param year
+ * year
* @return <code>Criterion</code>, not null
*/
public static final Criterion internalDateAfter(int day, int month, int year) {
- return new InternalDateCriterion(new DateOperator(DateOperator.AFTER, day, month, year));
+ return new InternalDateCriterion(new DateOperator(DateOperator.AFTER,
+ day, month, year));
}
/**
* Creates a filter matching messages with internal date on the given date.
- * @param day one based day of the month
- * @param month one based month of the year
- * @param year year
+ *
+ * @param day
+ * one based day of the month
+ * @param month
+ * one based month of the year
+ * @param year
+ * year
* @return <code>Criterion</code>, not null
*/
public static final Criterion internalDateOn(int day, int month, int year) {
- return new InternalDateCriterion(new DateOperator(DateOperator.ON, day, month, year));
+ return new InternalDateCriterion(new DateOperator(DateOperator.ON, day,
+ month, year));
}
-
/**
- * Creates a filter matching messages with internal date before the given date.
- * @param day one based day of the month
- * @param month one based month of the year
- * @param year year
- * @return <code>Criterion</code>, not null
- */
- public static final Criterion internalDateBefore(int day, int month, int year) {
- return new InternalDateCriterion(new DateOperator(DateOperator.BEFORE, day, month, year));
+ * Creates a filter matching messages with internal date before the given
+ * date.
+ *
+ * @param day
+ * one based day of the month
+ * @param month
+ * one based month of the year
+ * @param year
+ * year
+ * @return <code>Criterion</code>, not null
+ */
+ public static final Criterion internalDateBefore(int day, int month,
+ int year) {
+ return new InternalDateCriterion(new DateOperator(DateOperator.BEFORE,
+ day, month, year));
}
-
/**
* Creates a filter matching messages with the date of the given header
* after the given date. If the header's value is not a date then it will
* not be included.
- * @param headerName name of the header whose value will be compared, not null
- * @param day one based day of the month
- * @param month one based month of the year
- * @param year year
- * @return <code>Criterion</code>, not null
- */
- public static final Criterion headerDateAfter(String headerName, int day, int month, int year) {
- return new HeaderCriterion(headerName, new DateOperator(DateOperator.AFTER, day, month, year));
+ *
+ * @param headerName
+ * name of the header whose value will be compared, not null
+ * @param day
+ * one based day of the month
+ * @param month
+ * one based month of the year
+ * @param year
+ * year
+ * @return <code>Criterion</code>, not null
+ */
+ public static final Criterion headerDateAfter(String headerName, int day,
+ int month, int year) {
+ return new HeaderCriterion(headerName, new DateOperator(
+ DateOperator.AFTER, day, month, year));
}
-
+
/**
- * Creates a filter matching messages with the date of the given header
- * on the given date. If the header's value is not a date then it will
- * not be included.
- * @param headerName name of the header whose value will be compared, not null
- * @param day one based day of the month
- * @param month one based month of the year
- * @param year year
- * @return <code>Criterion</code>, not null
- */
- public static final Criterion headerDateOn(String headerName, int day, int month, int year) {
- return new HeaderCriterion(headerName, new DateOperator(DateOperator.ON, day, month, year));
+ * Creates a filter matching messages with the date of the given header on
+ * the given date. If the header's value is not a date then it will not be
+ * included.
+ *
+ * @param headerName
+ * name of the header whose value will be compared, not null
+ * @param day
+ * one based day of the month
+ * @param month
+ * one based month of the year
+ * @param year
+ * year
+ * @return <code>Criterion</code>, not null
+ */
+ public static final Criterion headerDateOn(String headerName, int day,
+ int month, int year) {
+ return new HeaderCriterion(headerName, new DateOperator(
+ DateOperator.ON, day, month, year));
}
-
+
/**
* Creates a filter matching messages with the date of the given header
* before the given date. If the header's value is not a date then it will
* not be included.
- * @param headerName name of the header whose value will be compared, not null
- * @param day one based day of the month
- * @param month one based month of the year
- * @param year year
- * @return <code>Criterion</code>, not null
- */
- public static final Criterion headerDateBefore(String headerName, int day, int month, int year) {
- return new HeaderCriterion(headerName, new DateOperator(DateOperator.BEFORE, day, month, year));
+ *
+ * @param headerName
+ * name of the header whose value will be compared, not null
+ * @param day
+ * one based day of the month
+ * @param month
+ * one based month of the year
+ * @param year
+ * year
+ * @return <code>Criterion</code>, not null
+ */
+ public static final Criterion headerDateBefore(String headerName, int day,
+ int month, int year) {
+ return new HeaderCriterion(headerName, new DateOperator(
+ DateOperator.BEFORE, day, month, year));
}
-
+
/**
- * Creates a filter matching messages whose header value contains the given value.
- * @param headerName name of the header whose value will be compared, not null
- * @param value when null or empty the existance of the header will be checked,
- * otherwise contained value
+ * Creates a filter matching messages whose header value contains the given
+ * value.
+ *
+ * @param headerName
+ * name of the header whose value will be compared, not null
+ * @param value
+ * when null or empty the existance of the header will be
+ * checked, otherwise contained value
* @return <code>Criterion</code>, not null
*/
public static final Criterion headerContains(String headerName, String value) {
@@ -161,51 +212,62 @@
return new HeaderCriterion(headerName, new ContainsOperator(value));
}
}
-
+
/**
* Creates a filter matching messages with a header matching the given name.
- * @param headerName name of the header whose value will be compared, not null
+ *
+ * @param headerName
+ * name of the header whose value will be compared, not null
* @return <code>Criterion</code>, not null
*/
public static final Criterion headerExists(String headerName) {
return new HeaderCriterion(headerName, ExistsOperator.exists());
}
-
+
/**
- * Creates a filter matching messages which contains the given text
- * either within the body or in the headers. Implementations may choose
- * to ignore mime parts which cannot be decoded to text.
- * @param value search value
+ * Creates a filter matching messages which contains the given text either
+ * within the body or in the headers. Implementations may choose to ignore
+ * mime parts which cannot be decoded to text.
+ *
+ * @param value
+ * search value
* @return <code>Criterion</code>, not null
*/
public static final Criterion mailContains(String value) {
return new TextCriterion(value, TextCriterion.FULL_MESSAGE);
}
-
+
/**
- * Creates a filter matching messages which contains the given text
- * within the body. Implementations may choose
- * to ignore mime parts which cannot be decoded to text.
- * @param value search value
+ * Creates a filter matching messages which contains the given text within
+ * the body. Implementations may choose to ignore mime parts which cannot be
+ * decoded to text.
+ *
+ * @param value
+ * search value
* @return <code>Criterion</code>, not null
*/
public static final Criterion bodyContains(String value) {
return new TextCriterion(value, TextCriterion.BODY);
}
-
+
/**
* Creates a filter matching messages within any of the given ranges.
- * @param range <code>NumericRange</code>'s, not null
+ *
+ * @param range
+ * <code>NumericRange</code>'s, not null
* @return <code>Criterion</code>, not null
*/
public static final Criterion uid(NumericRange[] range) {
return new UidCriterion(range);
}
-
+
/**
* Creates a filter composing the two different criteria.
- * @param one <code>Criterion</code>, not null
- * @param two <code>Criterion</code>, not null
+ *
+ * @param one
+ * <code>Criterion</code>, not null
+ * @param two
+ * <code>Criterion</code>, not null
* @return <code>Criterion</code>, not null
*/
public static final Criterion or(Criterion one, Criterion two) {
@@ -214,11 +276,14 @@
criteria.add(two);
return new ConjunctionCriterion(ConjunctionCriterion.OR, criteria);
}
-
+
/**
* Creates a filter composing the two different criteria.
- * @param one <code>Criterion</code>, not null
- * @param two <code>Criterion</code>, not null
+ *
+ * @param one
+ * <code>Criterion</code>, not null
+ * @param two
+ * <code>Criterion</code>, not null
* @return <code>Criterion</code>, not null
*/
public static final Criterion and(Criterion one, Criterion two) {
@@ -227,19 +292,23 @@
criteria.add(two);
return new ConjunctionCriterion(ConjunctionCriterion.AND, criteria);
}
-
+
/**
* Creates a filter composing the listed criteria.
- * @param criteria <code>List</code> of {@link Criterion}
+ *
+ * @param criteria
+ * <code>List</code> of {@link Criterion}
* @return <code>Criterion</code>, not null
*/
public static final Criterion and(List criteria) {
return new ConjunctionCriterion(ConjunctionCriterion.AND, criteria);
}
-
+
/**
* Creates a filter inverting the given criteria.
- * @param criterion <code>Criterion</code>, not null
+ *
+ * @param criterion
+ * <code>Criterion</code>, not null
* @return <code>Criterion</code>, not null
*/
public static final Criterion not(Criterion criterion) {
@@ -247,12 +316,15 @@
criteria.add(criterion);
return new ConjunctionCriterion(ConjunctionCriterion.NOR, criteria);
}
-
+
/**
* Creates a filter on the given flag.
- * @param flag <code>Flag</code>, not null
- * @param isSet true if the messages with the flag set should be matched,
- * false otherwise
+ *
+ * @param flag
+ * <code>Flag</code>, not null
+ * @param isSet
+ * true if the messages with the flag set should be matched,
+ * false otherwise
* @return <code>Criterion</code>, not null
*/
public static final Criterion flagSet(final Flag flag, final boolean isSet) {
@@ -264,32 +336,39 @@
}
return result;
}
-
+
/**
* Creates a filter on the given flag selecting messages where the given
* flag is selected.
- * @param flag <code>Flag</code>, not null
+ *
+ * @param flag
+ * <code>Flag</code>, not null
* @return <code>Criterion</code>, not null
*/
public static final Criterion flagIsSet(final Flag flag) {
return new FlagCriterion(flag, BooleanOperator.set());
}
-
+
/**
* Creates a filter on the given flag selecting messages where the given
* flag is not selected.
- * @param flag <code>Flag</code>, not null
+ *
+ * @param flag
+ * <code>Flag</code>, not null
* @return <code>Criterion</code>, not null
*/
public static final Criterion flagIsUnSet(final Flag flag) {
return new FlagCriterion(flag, BooleanOperator.unset());
}
-
+
/**
* Creates a filter on the given flag.
- * @param flag <code>Flag</code>, not null
- * @param isSet true if the messages with the flag set should be matched,
- * false otherwise
+ *
+ * @param flag
+ * <code>Flag</code>, not null
+ * @param isSet
+ * true if the messages with the flag set should be matched,
+ * false otherwise
* @return <code>Criterion</code>, not null
*/
public static final Criterion flagSet(final String flag, final boolean isSet) {
@@ -301,77 +380,84 @@
}
return result;
}
-
+
/**
* Creates a filter on the given flag selecting messages where the given
* flag is selected.
- * @param flag <code>Flag</code>, not null
+ *
+ * @param flag
+ * <code>Flag</code>, not null
* @return <code>Criterion</code>, not null
*/
public static final Criterion flagIsSet(final String flag) {
return new CustomFlagCriterion(flag, BooleanOperator.set());
}
-
+
/**
* Creates a filter on the given flag selecting messages where the given
* flag is not selected.
- * @param flag <code>Flag</code>, not null
+ *
+ * @param flag
+ * <code>Flag</code>, not null
* @return <code>Criterion</code>, not null
*/
public static final Criterion flagIsUnSet(final String flag) {
return new CustomFlagCriterion(flag, BooleanOperator.unset());
}
-
+
/**
* Creates a filter matching all messages.
+ *
* @return <code>Criterion</code>, not null
*/
public static final Criterion all() {
return AllCriterion.all();
}
-
+
private final Set recentMessageUids = new HashSet();
+
private final List criterias = new ArrayList();
-
- public void andCriteria(Criterion crit) {
- criterias.add(crit);
- }
-
- public List getCriterias() {
- return criterias;
- }
-
- /**
- * Gets the UIDS of messages which are recent for this
- * client session.
- * The list of recent mail is maintained in the protocol
- * layer since the mechanics are protocol specific.
+
+ public void andCriteria(Criterion crit) {
+ criterias.add(crit);
+ }
+
+ public List getCriterias() {
+ return criterias;
+ }
+
+ /**
+ * Gets the UIDS of messages which are recent for this client session. The
+ * list of recent mail is maintained in the protocol layer since the
+ * mechanics are protocol specific.
+ *
* @return mutable <code>Set</code> of <code>Long</code> UIDS
*/
public Set getRecentMessageUids() {
return recentMessageUids;
}
-
- // @Override
- public String toString() {
- return "Search:"+criterias.toString();
- }
-
+
+ // @Override
+ public String toString() {
+ return "Search:" + criterias.toString();
+ }
+
/**
* @see java.lang.Object#hashCode()
*/
- //@Override
+ // @Override
public int hashCode() {
final int PRIME = 31;
int result = 1;
- result = PRIME * result + ((criterias == null) ? 0 : criterias.hashCode());
+ result = PRIME * result
+ + ((criterias == null) ? 0 : criterias.hashCode());
return result;
}
/**
* @see java.lang.Object#equals(java.lang.Object)
*/
- //@Override
+ // @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
@@ -387,55 +473,55 @@
return false;
return true;
}
-
-
+
/**
- * Numbers within a particular range.
- * Range includes both high and low boundaries.
- * May be a single value.
- * {@link Long#MAX_VALUE} represents unlimited in either direction.
+ * Numbers within a particular range. Range includes both high and low
+ * boundaries. May be a single value. {@link Long#MAX_VALUE} represents
+ * unlimited in either direction.
*/
- public static final class NumericRange {
- private final long lowValue;
+ public static final class NumericRange {
+ private final long lowValue;
+
private final long highValue;
-
+
public NumericRange(final long value) {
super();
this.lowValue = value;
this.highValue = value;
}
-
+
public NumericRange(final long lowValue, final long highValue) {
super();
this.lowValue = lowValue;
this.highValue = highValue;
}
-
+
public final long getHighValue() {
return highValue;
}
-
+
public final long getLowValue() {
return lowValue;
}
-
+
/**
* Is the given value in this range?
- * @param value value to be tested
- * @return true if the value is in range,
- * false otherwise
+ *
+ * @param value
+ * value to be tested
+ * @return true if the value is in range, false otherwise
*/
public boolean isIn(long value) {
if (lowValue == Long.MAX_VALUE) {
return highValue >= value;
- }
+ }
return lowValue <= value && highValue >= value;
}
-
+
/**
* @see java.lang.Object#hashCode()
*/
- //@Override
+ // @Override
public int hashCode() {
final int PRIME = 31;
int result = 1;
@@ -447,7 +533,7 @@
/**
* @see java.lang.Object#equals(java.lang.Object)
*/
- //@Override
+ // @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
@@ -464,58 +550,60 @@
}
/**
- * Constructs a <code>String</code> with all attributes
- * in name = value format.
- *
- * @return a <code>String</code> representation
- * of this object.
- */
- public String toString()
- {
- return new StringBuffer().append(this.lowValue)
- .append("->").append(this.highValue).toString();
+ * Constructs a <code>String</code> with all attributes in name =
+ * value format.
+ *
+ * @return a <code>String</code> representation of this object.
+ */
+ public String toString() {
+ return new StringBuffer().append(this.lowValue).append("->")
+ .append(this.highValue).toString();
}
-
-
+
}
-
+
/**
* Marker superclass for criteria.
*/
- public static abstract class Criterion {}
-
+ public static abstract class Criterion {
+ }
+
/**
- * Conjuction applying to the contained criteria.
- * {@link #getType} indicates how the conjoined criteria
- * should be related.
+ * Conjuction applying to the contained criteria. {@link #getType} indicates
+ * how the conjoined criteria should be related.
*/
public static final class ConjunctionCriterion extends Criterion {
/** Logical <code>AND</code> */
public static final int AND = 1;
+
/** Logical <code>OR</code> */
public static final int OR = 2;
+
/** Logical <code>NOT</code> */
public static final int NOR = 3;
-
+
private final int type;
+
private final List criteria;
-
+
public ConjunctionCriterion(final int type, final List criteria) {
super();
this.type = type;
this.criteria = criteria;
}
-
+
/**
* Gets the criteria related through this conjuction.
+ *
* @return <code>List</code> of {@link Criterion}
*/
public final List getCriteria() {
return criteria;
}
-
+
/**
* Gets the type of conjunction.
+ *
* @return the type, either {@link #AND}, {@link #OR} or {@link NOR}
*/
public final int getType() {
@@ -525,11 +613,12 @@
/**
* @see java.lang.Object#hashCode()
*/
- //@Override
+ // @Override
public int hashCode() {
final int PRIME = 31;
int result = 1;
- result = PRIME * result + ((criteria == null) ? 0 : criteria.hashCode());
+ result = PRIME * result
+ + ((criteria == null) ? 0 : criteria.hashCode());
result = PRIME * result + type;
return result;
}
@@ -537,7 +626,7 @@
/**
* @see java.lang.Object#equals(java.lang.Object)
*/
- //@Override
+ // @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
@@ -557,43 +646,39 @@
}
/**
- * Constructs a <code>String</code> with all attributes
- * in name = value format.
- *
- * @return a <code>String</code> representation
- * of this object.
+ * Constructs a <code>String</code> with all attributes in name =
+ * value format.
+ *
+ * @return a <code>String</code> representation of this object.
*/
- public String toString()
- {
+ public String toString() {
final String TAB = " ";
-
+
StringBuffer retValue = new StringBuffer();
-
- retValue.append("ConjunctionCriterion ( ")
- .append("criteria = ").append(this.criteria).append(TAB)
- .append("type = ").append(this.type).append(TAB)
- .append(" )");
-
+
+ retValue.append("ConjunctionCriterion ( ").append("criteria = ")
+ .append(this.criteria).append(TAB).append("type = ")
+ .append(this.type).append(TAB).append(" )");
+
return retValue.toString();
}
-
-
+
}
-
+
/**
* Any message.
*/
public static final class AllCriterion extends Criterion {
private static final AllCriterion ALL = new AllCriterion();
-
+
private static final Criterion all() {
return ALL;
}
-
+
/**
* @see java.lang.Object#equals(java.lang.Object)
*/
- //@Override
+ // @Override
public boolean equals(Object obj) {
return obj instanceof AllCriterion;
}
@@ -601,7 +686,7 @@
/**
* @see java.lang.Object#hashCode()
*/
- //@Override
+ // @Override
public int hashCode() {
return 1729;
}
@@ -610,7 +695,7 @@
return "AllCriterion";
}
}
-
+
/**
* Message text.
*/
@@ -619,12 +704,14 @@
* Only the message body content.
*/
public static final int BODY = 1;
+
/**
* The full message content including headers.
*/
public static final int FULL_MESSAGE = 2;
-
+
private final int type;
+
private final ContainsOperator operator;
private TextCriterion(final String value, final int type) {
@@ -632,9 +719,10 @@
this.operator = new ContainsOperator(value);
this.type = type;
}
-
+
/**
* Gets the type of text to be searched.
+ *
* @return the type, either {@link #BODY} or {@link #FULL_MESSAGE}
*/
public final int getType() {
@@ -643,6 +731,7 @@
/**
* Gets the search operation and value to be evaluated.
+ *
* @return the <code>Operator</code>, not null
*/
public final ContainsOperator getOperator() {
@@ -652,11 +741,12 @@
/**
* @see java.lang.Object#hashCode()
*/
- //@Override
+ // @Override
public int hashCode() {
final int PRIME = 31;
int result = 1;
- result = PRIME * result + ((operator == null) ? 0 : operator.hashCode());
+ result = PRIME * result
+ + ((operator == null) ? 0 : operator.hashCode());
result = PRIME * result + type;
return result;
}
@@ -664,7 +754,7 @@
/**
* @see java.lang.Object#equals(java.lang.Object)
*/
- //@Override
+ // @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
@@ -684,35 +774,34 @@
}
/**
- * Constructs a <code>String</code> with all attributes
- * in name = value format.
- *
- * @return a <code>String</code> representation
- * of this object.
+ * Constructs a <code>String</code> with all attributes in name =
+ * value format.
+ *
+ * @return a <code>String</code> representation of this object.
*/
- public String toString()
- {
+ public String toString() {
final String TAB = " ";
-
+
StringBuffer retValue = new StringBuffer();
-
- retValue.append("TextCriterion ( ")
- .append("operator = ").append(this.operator).append(TAB)
- .append("type = ").append(this.type).append(TAB)
- .append(" )");
-
+
+ retValue.append("TextCriterion ( ").append("operator = ").append(
+ this.operator).append(TAB).append("type = ").append(
+ this.type).append(TAB).append(" )");
+
return retValue.toString();
}
}
-
+
/**
* Header value content search.
*/
public static final class HeaderCriterion extends Criterion {
private final HeaderOperator operator;
+
private final String headerName;
- private HeaderCriterion(final String headerName, final HeaderOperator operator) {
+ private HeaderCriterion(final String headerName,
+ final HeaderOperator operator) {
super();
this.operator = operator;
this.headerName = headerName;
@@ -720,6 +809,7 @@
/**
* Gets the name of the header whose value is to be searched.
+ *
* @return the headerName
*/
public final String getHeaderName() {
@@ -728,6 +818,7 @@
/**
* Gets the search operation and value to be evaluated.
+ *
* @return the <code>Operator</code>, not null
*/
public final HeaderOperator getOperator() {
@@ -737,19 +828,21 @@
/**
* @see java.lang.Object#hashCode()
*/
- //@Override
+ // @Override
public int hashCode() {
final int PRIME = 31;
int result = 1;
- result = PRIME * result + ((headerName == null) ? 0 : headerName.hashCode());
- result = PRIME * result + ((operator == null) ? 0 : operator.hashCode());
+ result = PRIME * result
+ + ((headerName == null) ? 0 : headerName.hashCode());
+ result = PRIME * result
+ + ((operator == null) ? 0 : operator.hashCode());
return result;
}
/**
* @see java.lang.Object#equals(java.lang.Object)
*/
- //@Override
+ // @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
@@ -772,29 +865,25 @@
}
/**
- * Constructs a <code>String</code> with all attributes
- * in name = value format.
- *
- * @return a <code>String</code> representation
- * of this object.
+ * Constructs a <code>String</code> with all attributes in name =
+ * value format.
+ *
+ * @return a <code>String</code> representation of this object.
*/
- public String toString()
- {
+ public String toString() {
final String TAB = " ";
-
+
StringBuffer retValue = new StringBuffer();
-
- retValue.append("HeaderCriterion ( ")
- .append("headerName = ").append(this.headerName).append(TAB)
- .append("operator = ").append(this.operator).append(TAB)
- .append(" )");
-
+
+ retValue.append("HeaderCriterion ( ").append("headerName = ")
+ .append(this.headerName).append(TAB).append("operator = ")
+ .append(this.operator).append(TAB).append(" )");
+
return retValue.toString();
}
-
-
+
}
-
+
/**
* Filters on the internal date.
*/
@@ -808,6 +897,7 @@
/**
* Gets the search operation and value to be evaluated.
+ *
* @return the <code>Operator</code>, not null
*/
public final DateOperator getOperator() {
@@ -817,18 +907,19 @@
/**
* @see java.lang.Object#hashCode()
*/
- //@Override
+ // @Override
public int hashCode() {
final int PRIME = 31;
int result = 1;
- result = PRIME * result + ((operator == null) ? 0 : operator.hashCode());
+ result = PRIME * result
+ + ((operator == null) ? 0 : operator.hashCode());
return result;
}
/**
* @see java.lang.Object#equals(java.lang.Object)
*/
- //@Override
+ // @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
@@ -846,38 +937,37 @@
}
/**
- * Constructs a <code>String</code> with all attributes
- * in name = value format.
- *
- * @return a <code>String</code> representation
- * of this object.
+ * Constructs a <code>String</code> with all attributes in name =
+ * value format.
+ *
+ * @return a <code>String</code> representation of this object.
*/
- public String toString()
- {
+ public String toString() {
final String TAB = " ";
-
+
StringBuffer retValue = new StringBuffer();
-
- retValue.append("InternalDateCriterion ( ")
- .append("operator = ").append(this.operator).append(TAB)
- .append(" )");
-
+
+ retValue.append("InternalDateCriterion ( ").append("operator = ")
+ .append(this.operator).append(TAB).append(" )");
+
return retValue.toString();
}
}
-
+
/**
* Filters on the size of the message in octets.
*/
public static final class SizeCriterion extends Criterion {
private final NumericOperator operator;
+
private SizeCriterion(final NumericOperator operator) {
super();
this.operator = operator;
}
-
+
/**
* Gets the search operation and value to be evaluated.
+ *
* @return the <code>NumericOperator</code>, not null
*/
public final NumericOperator getOperator() {
@@ -887,18 +977,19 @@
/**
* @see java.lang.Object#hashCode()
*/
- //@Override
+ // @Override
public int hashCode() {
final int PRIME = 31;
int result = 1;
- result = PRIME * result + ((operator == null) ? 0 : operator.hashCode());
+ result = PRIME * result
+ + ((operator == null) ? 0 : operator.hashCode());
return result;
}
/**
* @see java.lang.Object#equals(java.lang.Object)
*/
- //@Override
+ // @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
@@ -916,49 +1007,50 @@
}
/**
- * Constructs a <code>String</code> with all attributes
- * in name = value format.
- *
- * @return a <code>String</code> representation
- * of this object.
+ * Constructs a <code>String</code> with all attributes in name =
+ * value format.
+ *
+ * @return a <code>String</code> representation of this object.
*/
- public String toString()
- {
+ public String toString() {
final String TAB = " ";
-
+
StringBuffer retValue = new StringBuffer();
-
- retValue.append("SizeCriterion ( ")
- .append("operator = ").append(this.operator).append(TAB)
- .append(" )");
-
+
+ retValue.append("SizeCriterion ( ").append("operator = ").append(
+ this.operator).append(TAB).append(" )");
+
return retValue.toString();
}
}
-
+
/**
* Filters on a custom flag valuation.
*/
public static final class CustomFlagCriterion extends Criterion {
private final String flag;
+
private final BooleanOperator operator;
-
- private CustomFlagCriterion(final String flag, final BooleanOperator operator) {
+
+ private CustomFlagCriterion(final String flag,
+ final BooleanOperator operator) {
super();
this.flag = flag;
this.operator = operator;
}
-
+
/**
* Gets the custom flag to be search.
+ *
* @return the flag name, not null
*/
public final String getFlag() {
return flag;
}
-
+
/**
* Gets the value to be tested.
+ *
* @return the <code>BooleanOperator</code>, not null
*/
public final BooleanOperator getOperator() {
@@ -968,19 +1060,20 @@
/**
* @see java.lang.Object#hashCode()
*/
- //@Override
+ // @Override
public int hashCode() {
final int PRIME = 31;
int result = 1;
result = PRIME * result + ((flag == null) ? 0 : flag.hashCode());
- result = PRIME * result + ((operator == null) ? 0 : operator.hashCode());
+ result = PRIME * result
+ + ((operator == null) ? 0 : operator.hashCode());
return result;
}
/**
* @see java.lang.Object#equals(java.lang.Object)
*/
- //@Override
+ // @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
@@ -1003,34 +1096,32 @@
}
/**
- * Constructs a <code>String</code> with all attributes
- * in name = value format.
- *
- * @return a <code>String</code> representation
- * of this object.
+ * Constructs a <code>String</code> with all attributes in name =
+ * value format.
+ *
+ * @return a <code>String</code> representation of this object.
*/
- public String toString()
- {
+ public String toString() {
final String TAB = " ";
-
+
StringBuffer retValue = new StringBuffer();
-
- retValue.append("CustomFlagCriterion ( ")
- .append("flag = ").append(this.flag).append(TAB)
- .append("operator = ").append(this.operator).append(TAB)
- .append(" )");
-
+
+ retValue.append("CustomFlagCriterion ( ").append("flag = ").append(
+ this.flag).append(TAB).append("operator = ").append(
+ this.operator).append(TAB).append(" )");
+
return retValue.toString();
}
}
-
+
/**
* Filters on a standard flag.
*/
public static final class FlagCriterion extends Criterion {
private final Flag flag;
+
private final BooleanOperator operator;
-
+
private FlagCriterion(final Flag flag, final BooleanOperator operator) {
super();
this.flag = flag;
@@ -1039,6 +1130,7 @@
/**
* Gets the flag filtered on.
+ *
* @return the flag, not null
*/
public final Flag getFlag() {
@@ -1047,6 +1139,7 @@
/**
* Gets the test to be preformed.
+ *
* @return the <code>BooleanOperator</code>, not null
*/
public final BooleanOperator getOperator() {
@@ -1056,19 +1149,20 @@
/**
* @see java.lang.Object#hashCode()
*/
- //@Override
+ // @Override
public int hashCode() {
final int PRIME = 31;
int result = 1;
result = PRIME * result + ((flag == null) ? 0 : flag.hashCode());
- result = PRIME * result + ((operator == null) ? 0 : operator.hashCode());
+ result = PRIME * result
+ + ((operator == null) ? 0 : operator.hashCode());
return result;
}
/**
* @see java.lang.Object#equals(java.lang.Object)
*/
- //@Override
+ // @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
@@ -1091,29 +1185,25 @@
}
/**
- * Constructs a <code>String</code> with all attributes
- * in name = value format.
- *
- * @return a <code>String</code> representation
- * of this object.
+ * Constructs a <code>String</code> with all attributes in name =
+ * value format.
+ *
+ * @return a <code>String</code> representation of this object.
*/
- public String toString()
- {
+ public String toString() {
final String TAB = " ";
-
+
StringBuffer retValue = new StringBuffer();
-
- retValue.append("FlagCriterion ( ")
- .append("flag = ").append(this.flag).append(TAB)
- .append("operator = ").append(this.operator).append(TAB)
- .append(" )");
-
+
+ retValue.append("FlagCriterion ( ").append("flag = ").append(
+ this.flag).append(TAB).append("operator = ").append(
+ this.operator).append(TAB).append(" )");
+
return retValue.toString();
}
-
-
+
}
-
+
/**
* Filters on message identity.
*/
@@ -1127,6 +1217,7 @@
/**
* Gets the filtering operation.
+ *
* @return the <code>InOperator</code>
*/
public final InOperator getOperator() {
@@ -1136,18 +1227,19 @@
/**
* @see java.lang.Object#hashCode()
*/
- //@Override
+ // @Override
public int hashCode() {
final int PRIME = 31;
int result = 1;
- result = PRIME * result + ((operator == null) ? 0 : operator.hashCode());
+ result = PRIME * result
+ + ((operator == null) ? 0 : operator.hashCode());
return result;
}
/**
* @see java.lang.Object#equals(java.lang.Object)
*/
- //@Override
+ // @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
@@ -1165,41 +1257,40 @@
}
/**
- * Constructs a <code>String</code> with all attributes
- * in name = value format.
- *
- * @return a <code>String</code> representation
- * of this object.
+ * Constructs a <code>String</code> with all attributes in name =
+ * value format.
+ *
+ * @return a <code>String</code> representation of this object.
*/
- public String toString()
- {
+ public String toString() {
final String TAB = " ";
-
+
StringBuffer retValue = new StringBuffer();
-
- retValue.append("UidCriterion ( ")
- .append("operator = ").append(this.operator).append(TAB)
- .append(" )");
-
+
+ retValue.append("UidCriterion ( ").append("operator = ").append(
+ this.operator).append(TAB).append(" )");
+
return retValue.toString();
}
-
+
}
-
+
/**
* Search operator.
*/
- public interface Operator {}
-
+ public interface Operator {
+ }
+
/**
* Marks operator as suitable for header value searching.
*/
- public interface HeaderOperator extends Operator {}
-
+ public interface HeaderOperator extends Operator {
+ }
+
/**
* Contained value search.
*/
- public static final class ContainsOperator implements HeaderOperator{
+ public static final class ContainsOperator implements HeaderOperator {
private final String value;
public ContainsOperator(final String value) {
@@ -1209,6 +1300,7 @@
/**
* Gets the value to be searched for.
+ *
* @return the value
*/
public final String getValue() {
@@ -1218,7 +1310,7 @@
/**
* @see java.lang.Object#hashCode()
*/
- //@Override
+ // @Override
public int hashCode() {
final int PRIME = 31;
int result = 1;
@@ -1229,7 +1321,7 @@
/**
* @see java.lang.Object#equals(java.lang.Object)
*/
- //@Override
+ // @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
@@ -1247,32 +1339,29 @@
}
/**
- * Constructs a <code>String</code> with all attributes
- * in name = value format.
- *
- * @return a <code>String</code> representation
- * of this object.
+ * Constructs a <code>String</code> with all attributes in name =
+ * value format.
+ *
+ * @return a <code>String</code> representation of this object.
*/
- public String toString()
- {
+ public String toString() {
final String TAB = " ";
-
+
StringBuffer retValue = new StringBuffer();
-
- retValue.append("ContainsOperator ( ")
- .append("value = ").append(this.value).append(TAB)
- .append(" )");
-
+
+ retValue.append("ContainsOperator ( ").append("value = ").append(
+ this.value).append(TAB).append(" )");
+
return retValue.toString();
}
}
-
+
/**
* Existance search.
*/
- public static final class ExistsOperator implements HeaderOperator {
+ public static final class ExistsOperator implements HeaderOperator {
private static final ExistsOperator EXISTS = new ExistsOperator();
-
+
public static final ExistsOperator exists() {
return EXISTS;
}
@@ -1280,7 +1369,7 @@
/**
* @see java.lang.Object#equals(java.lang.Object)
*/
- //@Override
+ // @Override
public boolean equals(Object obj) {
return obj instanceof ExistsOperator;
}
@@ -1288,7 +1377,7 @@
/**
* @see java.lang.Object#hashCode()
*/
- //@Override
+ // @Override
public int hashCode() {
return 42;
}
@@ -1296,29 +1385,30 @@
/**
* @see java.lang.Object#toString()
*/
- //@Override
+ // @Override
public String toString() {
return "ExistsCriterion";
}
-
+
}
-
+
/**
* Boolean value search.
*/
public static final class BooleanOperator implements Operator {
-
+
private static final BooleanOperator SET = new BooleanOperator(true);
+
private static final BooleanOperator UNSET = new BooleanOperator(false);
-
+
public static final BooleanOperator set() {
return SET;
}
-
+
public static final BooleanOperator unset() {
return UNSET;
}
-
+
private final boolean set;
private BooleanOperator(final boolean set) {
@@ -1328,9 +1418,9 @@
/**
* Is the search for set?
- * @return true indicates that set values
- * should be selected, false indicates
- * that unset values should be selected
+ *
+ * @return true indicates that set values should be selected, false
+ * indicates that unset values should be selected
*/
public final boolean isSet() {
return set;
@@ -1339,7 +1429,7 @@
/**
* @see java.lang.Object#hashCode()
*/
- //@Override
+ // @Override
public int hashCode() {
final int PRIME = 31;
int result = 1;
@@ -1350,7 +1440,7 @@
/**
* @see java.lang.Object#equals(java.lang.Object)
*/
- //@Override
+ // @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
@@ -1365,39 +1455,38 @@
}
/**
- * Constructs a <code>String</code> with all attributes
- * in name = value format.
- *
- * @return a <code>String</code> representation
- * of this object.
+ * Constructs a <code>String</code> with all attributes in name =
+ * value format.
+ *
+ * @return a <code>String</code> representation of this object.
*/
- public String toString()
- {
+ public String toString() {
final String TAB = " ";
-
+
StringBuffer retValue = new StringBuffer();
-
- retValue.append("BooleanOperator ( ")
- .append("set = ").append(this.set).append(TAB)
- .append(" )");
-
+
+ retValue.append("BooleanOperator ( ").append("set = ").append(
+ this.set).append(TAB).append(" )");
+
return retValue.toString();
}
-
-
+
}
-
+
/**
* Searches numberic values.
*/
public static final class NumericOperator implements Operator {
public static final int EQUALS = 1;
+
public static final int LESS_THAN = 2;
+
public static final int GREATER_THAN = 3;
-
+
private final long value;
+
private final int type;
-
+
private NumericOperator(final long value, final int type) {
super();
this.value = value;
@@ -1406,7 +1495,9 @@
/**
* Gets the operation type
- * @return the type either {@link #EQUALS}, {@link #LESS_THAN} or {@link #GREATER_THAN}
+ *
+ * @return the type either {@link #EQUALS}, {@link #LESS_THAN} or
+ * {@link #GREATER_THAN}
*/
public final int getType() {
return type;
@@ -1414,6 +1505,7 @@
/**
* Gets the value to be compared.
+ *
* @return the value
*/
public final long getValue() {
@@ -1423,7 +1515,7 @@
/**
* @see java.lang.Object#hashCode()
*/
- //@Override
+ // @Override
public int hashCode() {
final int PRIME = 31;
int result = 1;
@@ -1435,7 +1527,7 @@
/**
* @see java.lang.Object#equals(java.lang.Object)
*/
- //@Override
+ // @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
@@ -1452,74 +1544,82 @@
}
/**
- * Constructs a <code>String</code> with all attributes
- * in name = value format.
- *
- * @return a <code>String</code> representation
- * of this object.
+ * Constructs a <code>String</code> with all attributes in name =
+ * value format.
+ *
+ * @return a <code>String</code> representation of this object.
*/
- public String toString()
- {
+ public String toString() {
final String TAB = " ";
-
+
StringBuffer retValue = new StringBuffer();
-
- retValue.append("NumericOperator ( ")
- .append("type = ").append(this.type).append(TAB)
- .append("value = ").append(this.value).append(TAB)
- .append(" )");
-
+
+ retValue.append("NumericOperator ( ").append("type = ").append(
+ this.type).append(TAB).append("value = ")
+ .append(this.value).append(TAB).append(" )");
+
return retValue.toString();
}
}
-
+
/**
* Operates on a date.
*/
- public static final class DateOperator implements HeaderOperator {
+ public static final class DateOperator implements HeaderOperator {
public static final int BEFORE = 1;
+
public static final int AFTER = 2;
+
public static final int ON = 3;
-
+
private final int type;
+
private final int day;
+
private final int month;
+
private final int year;
-
- public DateOperator(final int type, final int day, final int month, final int year) {
+
+ public DateOperator(final int type, final int day, final int month,
+ final int year) {
super();
this.type = type;
this.day = day;
this.month = month;
this.year = year;
}
-
+
/**
* Gets the day-of-the-month.
+ *
* @return the day, one based
*/
public final int getDay() {
return day;
}
-
+
/**
* Gets the month-of-the-year.
+ *
* @return the month, one based
*/
public final int getMonth() {
return month;
}
-
+
/**
* Gets the operator type.
- * @return the type, either {@link #BEFORE}, {@link #AFTER} or {@link ON}
+ *
+ * @return the type, either {@link #BEFORE}, {@link #AFTER} or
+ * {@link ON}
*/
public final int getType() {
return type;
}
-
+
/**
* Gets the year.
+ *
* @return the year
*/
public final int getYear() {
@@ -1529,7 +1629,7 @@
/**
* @see java.lang.Object#hashCode()
*/
- //@Override
+ // @Override
public int hashCode() {
final int PRIME = 31;
int result = 1;
@@ -1543,7 +1643,7 @@
/**
* @see java.lang.Object#equals(java.lang.Object)
*/
- //@Override
+ // @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
@@ -1564,30 +1664,27 @@
}
/**
- * Constructs a <code>String</code> with all attributes
- * in name = value format.
- *
- * @return a <code>String</code> representation
- * of this object.
+ * Constructs a <code>String</code> with all attributes in name =
+ * value format.
+ *
+ * @return a <code>String</code> representation of this object.
*/
- public String toString()
- {
+ public String toString() {
final String TAB = " ";
-
+
StringBuffer retValue = new StringBuffer();
-
- retValue.append("DateOperator ( ")
- .append("day = ").append(this.day).append(TAB)
- .append("month = ").append(this.month).append(TAB)
- .append("type = ").append(this.type).append(TAB)
- .append("year = ").append(this.year).append(TAB)
- .append(" )");
-
+
+ retValue.append("DateOperator ( ").append("day = ")
+ .append(this.day).append(TAB).append("month = ").append(
+ this.month).append(TAB).append("type = ").append(
+ this.type).append(TAB).append("year = ").append(
+ this.year).append(TAB).append(" )");
+
return retValue.toString();
}
-
+
}
-
+
/**
* Search for numbers within set of ranges.
*/
@@ -1600,8 +1697,9 @@
}
/**
- * Gets the filtering ranges.
- * Values falling within these ranges will be selected.
+ * Gets the filtering ranges. Values falling within these ranges will be
+ * selected.
+ *
* @return the <code>NumericRange</code>'s search on, not null
*/
public final NumericRange[] getRange() {
@@ -1611,7 +1709,7 @@
/**
* @see java.lang.Object#hashCode()
*/
- //@Override
+ // @Override
public int hashCode() {
return range.length;
}
@@ -1619,7 +1717,7 @@
/**
* @see java.lang.Object#equals(java.lang.Object)
*/
- //@Override
+ // @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
@@ -1634,25 +1732,21 @@
}
/**
- * Constructs a <code>String</code> with all attributes
- * in name = value format.
- *
- * @return a <code>String</code> representation
- * of this object.
+ * Constructs a <code>String</code> with all attributes in name =
+ * value format.
+ *
+ * @return a <code>String</code> representation of this object.
*/
- public String toString()
- {
+ public String toString() {
final String TAB = " ";
-
+
StringBuffer retValue = new StringBuffer();
-
- retValue.append("InOperator ( ")
- .append("range = ").append(this.range).append(TAB)
- .append(" )");
-
+
+ retValue.append("InOperator ( ").append("range = ").append(
+ this.range).append(TAB).append(" )");
+
return retValue.toString();
}
-
-
+
}
}
Modified: james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/UnsupportedCriteriaException.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/UnsupportedCriteriaException.java?rev=696828&r1=696827&r2=696828&view=diff
==============================================================================
--- james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/UnsupportedCriteriaException.java (original)
+++ james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/UnsupportedCriteriaException.java Thu Sep 18 14:44:56 2008
@@ -25,7 +25,7 @@
public class UnsupportedCriteriaException extends MailboxManagerException {
private static final long serialVersionUID = 3791907285083231285L;
-
+
public UnsupportedCriteriaException(String string) {
super(string);
}
Modified: james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/impl/FetchGroupImpl.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/impl/FetchGroupImpl.java?rev=696828&r1=696827&r2=696828&view=diff
==============================================================================
--- james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/impl/FetchGroupImpl.java (original)
+++ james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/impl/FetchGroupImpl.java Thu Sep 18 14:44:56 2008
@@ -31,35 +31,41 @@
* Specifies a fetch group.
*/
public class FetchGroupImpl implements MessageResult.FetchGroup {
-
- public static final MessageResult.FetchGroup MINIMAL
- = new FetchGroupImpl(MessageResult.FetchGroup.MINIMAL);
- public static final MessageResult.FetchGroup SIZE
- = new FetchGroupImpl(MessageResult.FetchGroup.SIZE);
- public static final MessageResult.FetchGroup INTERNAL_DATE
- = new FetchGroupImpl(MessageResult.FetchGroup.INTERNAL_DATE);
- public static final MessageResult.FetchGroup FLAGS
- = new FetchGroupImpl(MessageResult.FetchGroup.FLAGS);
- public static final MessageResult.FetchGroup HEADERS
- = new FetchGroupImpl(MessageResult.FetchGroup.HEADERS);
- public static final MessageResult.FetchGroup FULL_CONTENT
- = new FetchGroupImpl(MessageResult.FetchGroup.FULL_CONTENT);
- public static final MessageResult.FetchGroup BODY_CONTENT
- = new FetchGroupImpl(MessageResult.FetchGroup.BODY_CONTENT);
-
-
+
+ public static final MessageResult.FetchGroup MINIMAL = new FetchGroupImpl(
+ MessageResult.FetchGroup.MINIMAL);
+
+ public static final MessageResult.FetchGroup SIZE = new FetchGroupImpl(
+ MessageResult.FetchGroup.SIZE);
+
+ public static final MessageResult.FetchGroup INTERNAL_DATE = new FetchGroupImpl(
+ MessageResult.FetchGroup.INTERNAL_DATE);
+
+ public static final MessageResult.FetchGroup FLAGS = new FetchGroupImpl(
+ MessageResult.FetchGroup.FLAGS);
+
+ public static final MessageResult.FetchGroup HEADERS = new FetchGroupImpl(
+ MessageResult.FetchGroup.HEADERS);
+
+ public static final MessageResult.FetchGroup FULL_CONTENT = new FetchGroupImpl(
+ MessageResult.FetchGroup.FULL_CONTENT);
+
+ public static final MessageResult.FetchGroup BODY_CONTENT = new FetchGroupImpl(
+ MessageResult.FetchGroup.BODY_CONTENT);
+
private int content = MessageResult.FetchGroup.MINIMAL;
+
private Set partContentDescriptors;
-
+
public FetchGroupImpl() {
super();
}
-
+
public FetchGroupImpl(int content) {
super();
this.content = content;
}
-
+
public FetchGroupImpl(int content, Set partContentDescriptors) {
super();
this.content = content;
@@ -69,18 +75,20 @@
public int content() {
return content;
}
-
+
public void or(int content) {
this.content = this.content | content;
}
-
+
public String toString() {
return "Fetch " + content;
}
/**
* Gets content descriptors for the parts to be fetched.
- * @return <code>Set</code> of {@link FetchGroup.PartContentDescriptor}, possibly null
+ *
+ * @return <code>Set</code> of {@link FetchGroup.PartContentDescriptor},
+ * possibly null
*/
public Set getPartContentDescriptors() {
return partContentDescriptors;
@@ -88,16 +96,20 @@
/**
* Adds content for the particular part.
- * @param path <code>MimePath</code>, not null
- * @param content bitwise content constant
+ *
+ * @param path
+ * <code>MimePath</code>, not null
+ * @param content
+ * bitwise content constant
*/
public void addPartContent(MimePath path, int content) {
if (partContentDescriptors == null) {
partContentDescriptors = new HashSet();
}
PartContentDescriptorImpl currentDescriptor = null;
- for (Iterator it=partContentDescriptors.iterator();it.hasNext();) {
- PartContentDescriptorImpl descriptor = (PartContentDescriptorImpl) it.next();
+ for (Iterator it = partContentDescriptors.iterator(); it.hasNext();) {
+ PartContentDescriptorImpl descriptor = (PartContentDescriptorImpl) it
+ .next();
if (path.equals(descriptor.path())) {
currentDescriptor = descriptor;
break;
@@ -107,7 +119,7 @@
currentDescriptor = new PartContentDescriptorImpl(path);
partContentDescriptors.add(currentDescriptor);
}
-
+
currentDescriptor.or(content);
}
}
Modified: james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/impl/ListResultImpl.java
URL: http://svn.apache.org/viewvc/james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/impl/ListResultImpl.java?rev=696828&r1=696827&r2=696828&view=diff
==============================================================================
--- james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/impl/ListResultImpl.java (original)
+++ james/protocols/imap/trunk/mailbox/src/main/java/org/apache/james/mailboxmanager/impl/ListResultImpl.java Thu Sep 18 14:44:56 2008
@@ -24,21 +24,24 @@
public class ListResultImpl implements ListResult, Comparable {
public static ListResult createNoSelect(String name, String delimiter) {
- return new ListResultImpl(name, delimiter, false, SELECTABILITY_FLAG_NOSELECT);
+ return new ListResultImpl(name, delimiter, false,
+ SELECTABILITY_FLAG_NOSELECT);
}
-
private final String name;
+
private final String delimiter;
+
private final boolean noInferiors;
+
private final int selectability;
public ListResultImpl(String name, String delimiter) {
this(name, delimiter, false, SELECTABILITY_FLAG_NONE);
}
-
- public ListResultImpl(final String name, final String delimiter, final boolean noInferiors,
- final int selectability) {
+
+ public ListResultImpl(final String name, final String delimiter,
+ final boolean noInferiors, final int selectability) {
super();
this.name = name;
this.delimiter = delimiter;
@@ -48,6 +51,7 @@
/**
* Is this mailbox <code>\Noinferiors</code> as per RFC3501.
+ *
* @return true if marked, false otherwise
*/
public final boolean isNoInferiors() {
@@ -56,16 +60,16 @@
/**
* Gets the RFC3501 Selectability flag setting.
+ *
* @return {@link ListResult#SELECTABILITY_FLAG_NONE},
- * {@link ListResult#SELECTABILITY_FLAG_MARKED},
- * {@link ListResult#SELECTABILITY_FLAG_NOSELECT},
- * or {@link ListResult#SELECTABILITY_FLAG_UNMARKED}
+ * {@link ListResult#SELECTABILITY_FLAG_MARKED},
+ * {@link ListResult#SELECTABILITY_FLAG_NOSELECT}, or
+ * {@link ListResult#SELECTABILITY_FLAG_UNMARKED}
*/
public final int getSelectability() {
return selectability;
}
-
public String getHierarchyDelimiter() {
return delimiter;
}
@@ -117,13 +121,12 @@
result = 1;
} else if (this.name == null) {
result = otherName == null ? 0 : 1;
- } else if (otherName == null){
+ } else if (otherName == null) {
result = -1;
} else {
result = name.compareTo(otherName);
}
return result;
}
-
-
+
}
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org