001    /****************************************************************
002     * Licensed to the Apache Software Foundation (ASF) under one   *
003     * or more contributor license agreements.  See the NOTICE file *
004     * distributed with this work for additional information        *
005     * regarding copyright ownership.  The ASF licenses this file   *
006     * to you under the Apache License, Version 2.0 (the            *
007     * "License"); you may not use this file except in compliance   *
008     * with the License.  You may obtain a copy of the License at   *
009     *                                                              *
010     *   http://www.apache.org/licenses/LICENSE-2.0                 *
011     *                                                              *
012     * Unless required by applicable law or agreed to in writing,   *
013     * software distributed under the License is distributed on an  *
014     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
015     * KIND, either express or implied.  See the License for the    *
016     * specific language governing permissions and limitations      *
017     * under the License.                                           *
018     ****************************************************************/
019    
020    
021    package org.apache.hupa.shared.rpc;
022    
023    import java.io.Serializable;
024    
025    import net.customware.gwt.dispatch.shared.Action;
026    
027    import org.apache.hupa.shared.data.IMAPFolder;
028    
029    public class RawMessage implements Action<RawMessageResult>, Serializable {
030    
031        private static final long serialVersionUID = 5826298202494313834L;
032        private IMAPFolder folder;
033        private long uid;
034    
035        public RawMessage(IMAPFolder folder, long uid) {
036            this.folder = folder;
037            this.uid = uid;
038        }
039    
040        @SuppressWarnings("unused")
041        private RawMessage() {
042        }
043        
044        public IMAPFolder getFolder() {
045            return folder;
046        }
047        
048        public long getUid() {
049            return uid;
050        }
051        
052        public boolean equals(Object obj) {
053            if (obj instanceof RawMessage) {
054                RawMessage action = (RawMessage) obj;
055                if (action.getFolder().equals(getFolder()) && action.getUid() == getUid()) {
056                    return true;
057                }
058            }
059            return false;
060        }
061        
062        public int hashCode() {
063            return (int) (getFolder().hashCode() * getUid());
064        }
065        
066    }