1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51 package com.ivata.mask.web.demo.customer;
52 import com.ivata.mask.util.StringHandling;
53 import com.ivata.mask.web.demo.valueobject.DemoValueObject;
54 /***
55 * <p>
56 * Represents a single customer of this imaginary system.
57 * </p>
58 *
59 * @since ivata masks 0.4 (2004-05-20)
60 * @author Colin MacLeod
61 * <a href='mailto:colin.macleod@ivata.com'>colin.macleod@ivata.com</a>
62 * @version $Revision: 1.4 $
63 */
64 public final class CustomerDO extends DemoValueObject {
65 /***
66 * <p>
67 * Person's email address (ok - it's a simple system).
68 * </p>
69 */
70 private String emailAddress;
71 /***
72 * <p>
73 * Person's first name(s).
74 * </p>
75 */
76 private String firstName;
77 /***
78 * <p>
79 * Person's last name(s).
80 * </p>
81 */
82 private String lastName;
83 /***
84 * Full customer postal address, including carriage
85 * returns, region/state, country, etc.
86 */
87 private String postalAddress;
88 /***
89 * <p>
90 * Construct a new customer instance with no id.
91 * </p>
92 */
93 public CustomerDO() {
94 super();
95 }
96 /***
97 * <p>
98 * Construct a new customer instance with the given unique identifier.
99 * </p>
100 *
101 * @param idParam unique identifier of this customer.
102 */
103 public CustomerDO(final int idParam) {
104 super(idParam);
105 }
106 /***
107 * Get a text to display describing the customer. If the customer has a
108 * first and last name, then this will return something like "Freddie
109 * Kruger", otherwise just the first or last name is returned -
110 * whichever is present.
111 *
112 * @return customer's name.
113 * @see com.ivata.mask.valueobject.ValueObject#getStringValue()
114 */
115 public String getDisplayValue() {
116 StringBuffer stringValue = new StringBuffer();
117 if (!StringHandling.isNullOrEmpty(firstName)) {
118 stringValue.append(firstName.trim());
119 }
120 if (!StringHandling.isNullOrEmpty(lastName)) {
121 if (stringValue.length() > 0) {
122 stringValue.append(" ");
123 }
124 stringValue.append(lastName.trim());
125 }
126 return stringValue.toString();
127 }
128 /***
129 * Person's email address (ok - it's a simple system).
130 *
131 * @return string email address such as
132 * <code>ted@nowhere.com</code>.
133 */
134 public String getEmailAddress() {
135 return emailAddress;
136 }
137 /***
138 * <p>
139 * Person's first name(s).
140 * </p>
141 *
142 * @return first name such as "Bob", or "Sally".
143 */
144 public String getFirstName() {
145 return firstName;
146 }
147 /***
148 * Person's last name(s).
149 *
150 * @return last name of the customer, such as "Smith" or
151 * "Tarrantino".
152 */
153 public String getLastName() {
154 return lastName;
155 }
156 /***
157 * Full customer postal address, including carriage
158 * returns, region/state, country, etc.
159 *
160 * @return Customer's full snail-mail address.
161 */
162 public String getPostalAddress() {
163 return postalAddress;
164 }
165 /***
166 * Person's email address (ok - it's a simple system).
167 *
168 * @param emailAddressParam string email address such as
169 * <code>ted@nowhere.com</code>.
170 */
171 public void setEmailAddress(final String emailAddressParam) {
172 emailAddress = emailAddressParam;
173 }
174 /***
175 * <p>
176 * Person's first name(s).
177 * </p>
178 *
179 * @param firstNameParam first name such as "Bob", or
180 * "Sally".
181 */
182 public void setFirstName(final String firstNameParam) {
183 firstName = firstNameParam;
184 }
185 /***
186 * Person's last name(s).
187 *
188 * @param lastNameParam last name of the customer, such as "Smith"
189 * or "Tarrantino".
190 */
191 public void setLastName(final String lastNameParam) {
192 lastName = lastNameParam;
193 }
194 /***
195 * Full customer postal address, including carriage
196 * returns, region/state, country, etc.
197 *
198 * @param postalAddressParam Customer's full snail-mail address.
199 */
200 public void setPostalAddress(final String postalAddressParam) {
201 postalAddress = postalAddressParam;
202 }
203 }
204