com/scalagent/joram/mom/dest/mail/SenderInfo.java

00001 /*
00002  * JORAM: Java(TM) Open Reliable Asynchronous Messaging
00003  * Copyright (C) 2003 - 2007 ScalAgent Distributed Technologies
00004  *
00005  * This library is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU Lesser General Public
00007  * License as published by the Free Software Foundation; either
00008  * version 2.1 of the License, or any later version.
00009  * 
00010  * This library is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Lesser General Public License for more details.
00014  * 
00015  * You should have received a copy of the GNU Lesser General Public
00016  * License along with this library; if not, write to the Free Software
00017  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
00018  * USA.
00019  *
00020  * Initial developer(s): Nicolas Tachker (ScalAgent)
00021  * Contributor(s): 
00022  */
00023 package com.scalagent.joram.mom.dest.mail;
00024 
00025 public class SenderInfo implements java.io.Serializable {
00029   private static final long serialVersionUID = 1L;
00030   public String smtpServer;
00031   public String to;
00032   public String cc;
00033   public String bcc;
00034   public String from;
00035   public String subject;
00036   public String selector;
00037   
00038   public SenderInfo(String smtpServer,
00039                     String to,
00040                     String cc,
00041                     String bcc,
00042                     String from,
00043                     String subject,
00044                     String selector) {
00045     this.smtpServer = smtpServer;
00046     this.to = to;
00047     this.cc = cc;
00048     this.bcc = bcc;
00049     this.from = from;
00050     this.subject = subject;
00051     this.selector = selector;
00052   }
00053   
00054   public String toString() {
00055     StringBuffer sb = new StringBuffer();
00056     sb.append("(smtp=");
00057     sb.append(smtpServer);
00058     sb.append(",to=");
00059     sb.append(to);
00060     sb.append(",cc=");
00061     sb.append(cc);
00062     sb.append(",bcc=");
00063     sb.append(bcc);
00064     sb.append(",from=");
00065     sb.append(from);
00066     sb.append(",subject=");
00067     sb.append(subject);
00068     sb.append(",selector=");
00069     sb.append(selector);
00070     sb.append(")");
00071     return sb.toString();
00072   }
00073 
00074   public boolean equals(Object obj) {
00075     if (! (obj instanceof SenderInfo))
00076       return false;
00077     else {
00078       SenderInfo si = (SenderInfo) obj;
00079       boolean b = true;
00080       if ((smtpServer != null) && (si.smtpServer != null))
00081         b &= smtpServer.equals(si.smtpServer);
00082       if ((to != null) && (si.to != null))
00083         b &= to.equals(si.to);
00084       if ((cc != null) && (si.cc != null))
00085         b &= cc.equals(si.cc);
00086       if ((bcc != null) && (si.bcc != null))
00087         b &= bcc.equals(si.bcc);
00088       if ((from != null) && (si.from != null))
00089         b &= from.equals(si.from);
00090       if ((subject != null) && (si.subject != null))
00091         b &= subject.equals(si.subject);
00092       if ((selector != null) && (si.selector != null))
00093         b &= selector.equals(si.selector);
00094       return b;
00095     }
00096   }
00097 }

Generated on Tue Sep 16 16:14:23 2008 for joram by  doxygen 1.5.0