01: /*
02: * Created on Sep 26, 2003
03: *
04: /*
05: Copyright (c) 2003 eInnovation Inc. All rights reserved
06:
07: This library is free software; you can redistribute it and/or modify it under the terms
08: of the GNU Lesser General Public License as published by the Free Software Foundation;
09: either version 2.1 of the License, or (at your option) any later version.
10:
11: This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
12: without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13: See the GNU Lesser General Public License for more details.
14: */
15: package com.openedit.modules.email;
16:
17: /**
18: * @author Matt Avery, mavery@einnovation.com
19: */
20: public class Recipient {
21: protected String fieldEmailAddress;
22: protected String fieldFirstName;
23: protected String fieldLastName;
24:
25: public String getEmailAddress() {
26: return fieldEmailAddress;
27: }
28:
29: public String getFirstName() {
30: return fieldFirstName;
31: }
32:
33: public String getLastName() {
34: return fieldLastName;
35: }
36:
37: public void setEmailAddress(String string) {
38: fieldEmailAddress = string;
39: }
40:
41: public void setFirstName(String string) {
42: fieldFirstName = string;
43: }
44:
45: public void setLastName(String string) {
46: fieldLastName = string;
47: }
48:
49: public String getFullName() {
50: StringBuffer name = new StringBuffer();
51: if (getFirstName() != null) {
52: name.append(getFirstName());
53: }
54: if (getLastName() != null) {
55: if (name.length() > 0) {
56: name.append(" ");
57: }
58: name.append(getLastName());
59: }
60: if (name.indexOf(",") > -1 || name.indexOf(".") > -1) {
61: name.insert(0, "\"");
62: name.append("\"");
63: }
64: return name.toString();
65: }
66:
67: public String toString() {
68: return getFullName() + " <" + getEmailAddress() + ">";
69: }
70: }
|