in geronimo-mail_2.1_impl/geronimo-mail_2.1_provider/src/main/java/org/apache/geronimo/mail/store/imap/IMAPMessage.java [1155:1194]
protected boolean evaluateFetch(FetchProfile profile) {
// the fetch profile can contain a number of different item types. Validate
// whether we need any of these and return true on the first mismatch.
// the UID is a common fetch request, put it first.
if (profile.contains(UIDFolder.FetchProfileItem.UID) && uid == -1) {
return true;
}
if (profile.contains(FetchProfile.Item.ENVELOPE) && envelope == null) {
return true;
}
if (profile.contains(FetchProfile.Item.FLAGS) && flags == null) {
return true;
}
if (profile.contains(FetchProfile.Item.CONTENT_INFO) && bodyStructure == null) {
return true;
}
// The following profile items are our implementation of items that the
// Sun IMAPFolder implementation supports.
if (profile.contains(IMAPFolder.FetchProfileItem.HEADERS) && !allHeadersRetrieved) {
return true;
}
if (profile.contains(IMAPFolder.FetchProfileItem.SIZE) && bodyStructure.bodySize < 0) {
return true;
}
// last bit after checking each of the information types is to see if
// particular headers have been requested and whether those are on the
// set we do have loaded.
String [] requestedHeaders = profile.getHeaderNames();
// ok, any missing header in the list is enough to force us to request the
// information.
for (int i = 0; i < requestedHeaders.length; i++) {
if (headers.getHeader(requestedHeaders[i]) == null) {
return true;
}
}
// this message, at least, does not need anything fetched.
return false;
}