001 /* 002 * Copyright 2010 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 package com.hs.mail.imap.message.response; 017 018 import com.hs.mail.imap.mailbox.Mailbox; 019 020 /** 021 * 022 * @author Won Chul Doh 023 * @since Mar 19, 2010 024 * 025 */ 026 public class SelectResponse extends AbstractImapResponse { 027 028 private Mailbox mailbox; 029 private long firstUnseen = 0; 030 private int messageCount = 0; 031 private int recentMessageCount = 0; 032 033 public SelectResponse(Mailbox mailbox) { 034 super(); 035 this.mailbox = mailbox; 036 } 037 038 /** 039 * Gets the UID of the first unseen message. 040 * 041 * @return UID of the first unseen message, zero if not exist unseen message 042 */ 043 public long getFirstUnseen() { 044 return firstUnseen; 045 } 046 047 public void setFirstUnseen(long firstUnseen) { 048 this.firstUnseen = firstUnseen; 049 } 050 051 /** 052 * Gets the number of messages that this mailbox contains. 053 * 054 * @return number of messages contained 055 */ 056 public int getMessageCount() { 057 return messageCount; 058 } 059 060 public void setMessageCount(int count) { 061 this.messageCount = count; 062 } 063 064 /** 065 * Gets the number of recent messages. 066 * 067 * @return number of recent messages 068 */ 069 public int getRecentMessageCount() { 070 return recentMessageCount; 071 } 072 073 public void setRecentMessageCount(int count) { 074 this.recentMessageCount = count; 075 } 076 077 /** 078 * Gets the next unique identifier predicted. 079 * 080 * @return the UID that will be assigned to the next appended message 081 */ 082 public long getNextUid() { 083 return mailbox.getNextUID(); 084 } 085 086 /** 087 * Gets the unique identifier validity value. 088 * 089 * @return UIDVALIDITY 090 */ 091 public long getUidValidity() { 092 return mailbox.getUidValidity(); 093 } 094 095 }