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 package org.apache.hupa.shared.data;
021
022 import java.io.Serializable;
023 import java.util.ArrayList;
024
025 public class MessageDetails implements Serializable{
026 /**
027 *
028 */
029 private static final long serialVersionUID = 7611536915564919521L;
030 private String text;
031 private ArrayList<MessageAttachment> aList;
032 private long uid;
033 private String raw;
034
035 public String toString() {
036 return "uid=" + String.valueOf(getUid()) +
037 " text.length=" + (text != null ? text.length() : 0) +
038 " raw.length=" + (raw != null ? raw.length() : 0) +
039 " attachments=" + (aList != null ? aList.size() : 0);
040 }
041
042
043 public long getUid() {
044 return uid;
045 }
046
047 public void setUid(long uid) {
048 this.uid = uid;
049 }
050
051 /**
052 * Set a raw String representation of the header
053 *
054 * @param raw
055 */
056 public void setRawHeader(String raw) {
057 this.raw = raw;
058 }
059
060 /**
061 * Return a raw String representation of the header
062 *
063 * @return raw
064 */
065 public String getRawHeader() {
066 return raw;
067 }
068
069 /**
070 * Set the body text of the content
071 *
072 * @param text
073 */
074 public void setText(String text) {
075 this.text = text;
076 }
077
078 /**
079 * Return the body text of the content
080 * @return The text
081 */
082 public String getText() {
083 return text;
084 }
085
086 /**
087 * Set the attachments
088 *
089 * @param aList
090 */
091 public void setMessageAttachments(ArrayList<MessageAttachment> aList) {
092 this.aList = aList;
093 }
094
095 /**
096 * Return the attachments
097 *
098 * @return aList
099 */
100 public ArrayList<MessageAttachment> getMessageAttachments() {
101 return aList;
102 }
103
104
105 public boolean equals(Object obj) {
106 if (obj instanceof MessageDetails) {
107 if (((MessageDetails)obj).getUid() == getUid()) {
108 return true;
109 }
110 }
111 return false;
112 }
113
114 public int hashCode() {
115 Long l = Long.valueOf(getUid());
116 return l.intValue() * 16;
117 }
118 }