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.request;
017    
018    import javax.mail.FetchProfile;
019    
020    import com.hs.mail.imap.ImapSession;
021    import com.hs.mail.imap.ImapSession.State;
022    import com.hs.mail.imap.message.SequenceRange;
023    
024    /**
025     * 
026     * @author Won Chul Doh
027     * @since Jan 28, 2010
028     *
029     */
030    public class FetchRequest extends ImapRequest {
031    
032            private final SequenceRange[] sequenceSet;
033            private final FetchProfile fetchProfile;
034            private final boolean useUID;
035            
036            public FetchRequest(String tag, String command,
037                            SequenceRange[] sequenceSet, FetchProfile fetchProfile,
038                            boolean useUID) {
039                    super(tag, command);
040                    this.sequenceSet = sequenceSet;
041                    this.fetchProfile = fetchProfile;
042                    this.useUID = useUID;
043            }
044    
045            public SequenceRange[] getSequenceSet() {
046                    return sequenceSet;
047            }
048    
049            public FetchProfile getFetchProfile() {
050                    return fetchProfile;
051            }
052    
053            public boolean isUseUID() {
054                    return useUID;
055            }
056    
057            @Override
058            public boolean validForState(State state) {
059                    return state == ImapSession.State.SELECTED;
060            }
061    
062    }