001: /* Copyright (c) 2001 - 2007 TOPP - www.openplans.org. All rights reserved.
002: * This code is licensed under the GPL 2.0 license, availible at the root
003: * application directory.
004: */
005: package org.vfny.geoserver.global.dto;
006:
007: /**
008: * Data Transfer Object for Contact information.
009: *
010: * <p>
011: * Data Transfer object are used to communicate between the GeoServer
012: * application and its configuration and persistent layers. As such the class
013: * is final - to allow for its future use as an on-the-wire message.
014: * </p>
015: *
016: * <p>
017: * Represents a ContactDTO Information element such as:
018: * </p>
019: * <pre><code>
020: * {ContactInformation}
021: * {ContactPersonPrimary}
022: * {ContactPerson}Chris Holmes{/ContactPerson}
023: * {ContactOrganization}TOPP{/ContactOrganization}
024: * {/ContactPersonPrimary}
025: * {ContactPosition}Computer Scientist{/ContactPosition}
026: * {ContactAddress}
027: * {AddressType}postal{/AddressType}
028: * {Address}Street addresss here{/Address}
029: * {City}New York{/City}
030: * {StateOrProvince}New York{/StateOrProvince}
031: * {PostCode}0001{/PostCode}
032: * {Country}USA{/Country}
033: * {/ContactAddress}
034: * {ContactVoiceTelephone}+1 301 283-1569{/ContactVoiceTelephone}
035: * {ContactFacsimileTelephone}+1 301 283-1569{/ContactFacsimileTelephone}
036: * {/ContactInformation}
037: * </code></pre>
038: *
039: * @author David Zwiers, Refractions Research, Inc.
040: * @version $Id: ContactDTO.java 6326 2007-03-15 18:36:40Z jdeolive $
041: */
042: public final class ContactDTO implements DataTransferObject {
043: /** The name of the contact person */
044: private String contactPerson;
045:
046: /** The name of the organization with which the contact is affiliated. */
047: private String contactOrganization;
048:
049: /** The position of the contact within their organization. */
050: private String contactPosition;
051:
052: /** The type of address specified, such as postal. */
053: private String addressType;
054:
055: /** The actual street address. */
056: private String address;
057:
058: /** The city of the address. */
059: private String addressCity;
060:
061: /** The state/prov. of the address. */
062: private String addressState;
063:
064: /** The postal code for the address. */
065: private String addressPostalCode;
066:
067: /** The country of the address. */
068: private String addressCountry;
069:
070: /** The contact phone number. */
071: private String contactVoice;
072:
073: /** The contact Fax number. */
074: private String contactFacsimile;
075:
076: /** The contact email address. */
077: private String contactEmail;
078:
079: /**
080: * The contact online resource.
081: *
082: */
083: private String onlineResource;
084:
085: /**
086: * ContactConfig constructor.
087: *
088: * <p>
089: * does nothing
090: * </p>
091: */
092: public ContactDTO() {
093: }
094:
095: /**
096: * Contact Data Transfer Object constructor.
097: *
098: * <p>
099: * Creates a copy of the ContactDTO specified.
100: * </p>
101: *
102: * @param c The ContactDTO to create a copy of.
103: *
104: * @throws NullPointerException DOCUMENT ME!
105: */
106: public ContactDTO(ContactDTO c) {
107: if (c == null) {
108: throw new NullPointerException(
109: "Requires a non null ContactDTO");
110: }
111:
112: contactPerson = c.getContactPerson();
113: contactOrganization = c.getContactOrganization();
114: contactPosition = c.getContactPosition();
115: addressType = c.getAddressType();
116: address = c.getAddress();
117: addressCity = c.getAddressCity();
118: addressState = c.getAddressState();
119: addressPostalCode = c.getAddressPostalCode();
120: addressCountry = c.getAddressCountry();
121: contactVoice = c.getContactVoice();
122: contactFacsimile = c.getContactFacsimile();
123: contactEmail = c.getContactEmail();
124: onlineResource = c.getOnlineResource();
125: }
126:
127: /**
128: * Implement clone.
129: *
130: * <p>
131: * Creates a clone of the object. For exact notes see
132: * </p>
133: *
134: * @return A new ContactConfig object.
135: *
136: * @see ContactConfig(ContactConfig).
137: * @see java.lang.Object#clone()
138: */
139: public Object clone() {
140: return new ContactDTO(this );
141: }
142:
143: /**
144: * Implement equals.
145: *
146: * <p>
147: * Checks to see that the ContactConfig passed in is the same as this
148: * ContactConfig.
149: * </p>
150: *
151: * @param obj A ContactConfig object.
152: *
153: * @return true when they are the same.
154: *
155: * @see java.lang.Object#equals(java.lang.Object)
156: */
157: public boolean equals(Object obj) {
158: if (!(obj instanceof ContactDTO) || (obj == null)) {
159: return false;
160: }
161:
162: ContactDTO c = (ContactDTO) obj;
163:
164: return ((contactPerson == c.getContactPerson()) && ((contactOrganization == c
165: .getContactOrganization()) && ((contactPosition == c
166: .getContactPosition()) && ((addressType == c
167: .getAddressType()) && ((address == c.getAddress()) && ((addressCity == c
168: .getAddressCity()) && ((addressState == c
169: .getAddressState()) && ((addressPostalCode == c
170: .getAddressPostalCode()) && ((addressCountry == c
171: .getAddressCountry()) && ((contactVoice == c
172: .getContactVoice()) && ((contactFacsimile == c
173: .getContactFacsimile()) && ((onlineResource == c
174: .getOnlineResource()) && (contactEmail == c
175: .getContactEmail())))))))))))));
176: }
177:
178: public int hashCode() {
179: int i = 1;
180:
181: if (contactPerson != null) {
182: i *= contactPerson.hashCode();
183: }
184:
185: if (address != null) {
186: i *= address.hashCode();
187: }
188:
189: if (contactVoice != null) {
190: i *= contactVoice.hashCode();
191: }
192:
193: if (contactEmail != null) {
194: i *= contactEmail.hashCode();
195: }
196:
197: return i;
198: }
199:
200: /**
201: * getAddress purpose.
202: *
203: * <p>
204: * Description ...
205: * </p>
206: *
207: * @return
208: */
209: public String getAddress() {
210: return address;
211: }
212:
213: /**
214: * getAddressCity purpose.
215: *
216: * <p>
217: * Description ...
218: * </p>
219: *
220: * @return
221: */
222: public String getAddressCity() {
223: return addressCity;
224: }
225:
226: /**
227: * getAddressCountry purpose.
228: *
229: * <p>
230: * Description ...
231: * </p>
232: *
233: * @return
234: */
235: public String getAddressCountry() {
236: return addressCountry;
237: }
238:
239: /**
240: * getAddressPostalCode purpose.
241: *
242: * <p>
243: * Description ...
244: * </p>
245: *
246: * @return
247: */
248: public String getAddressPostalCode() {
249: return addressPostalCode;
250: }
251:
252: /**
253: * getAddressState purpose.
254: *
255: * <p>
256: * Description ...
257: * </p>
258: *
259: * @return
260: */
261: public String getAddressState() {
262: return addressState;
263: }
264:
265: /**
266: * getAddressType purpose.
267: *
268: * <p>
269: * Description ...
270: * </p>
271: *
272: * @return
273: */
274: public String getAddressType() {
275: return addressType;
276: }
277:
278: /**
279: * getContactEmail purpose.
280: *
281: * <p>
282: * Description ...
283: * </p>
284: *
285: * @return
286: */
287: public String getContactEmail() {
288: return contactEmail;
289: }
290:
291: /**
292: * getContactFacsimile purpose.
293: *
294: * <p>
295: * Description ...
296: * </p>
297: *
298: * @return
299: */
300: public String getContactFacsimile() {
301: return contactFacsimile;
302: }
303:
304: /**
305: * getContactOrganization purpose.
306: *
307: * <p>
308: * Description ...
309: * </p>
310: *
311: * @return
312: */
313: public String getContactOrganization() {
314: return contactOrganization;
315: }
316:
317: /**
318: * getContactPerson purpose.
319: *
320: * <p>
321: * Description ...
322: * </p>
323: *
324: * @return
325: */
326: public String getContactPerson() {
327: return contactPerson;
328: }
329:
330: /**
331: * getContactPosition purpose.
332: *
333: * <p>
334: * Description ...
335: * </p>
336: *
337: * @return
338: */
339: public String getContactPosition() {
340: return contactPosition;
341: }
342:
343: /**
344: * getContactVoice purpose.
345: *
346: * <p>
347: * Description ...
348: * </p>
349: *
350: * @return
351: */
352: public String getContactVoice() {
353: return contactVoice;
354: }
355:
356: /**
357: * setAddress purpose.
358: *
359: * <p>
360: * Description ...
361: * </p>
362: *
363: * @param string
364: */
365: public void setAddress(String string) {
366: if (string != null) {
367: address = string;
368: }
369: }
370:
371: /**
372: * setAddressCity purpose.
373: *
374: * <p>
375: * Description ...
376: * </p>
377: *
378: * @param string
379: */
380: public void setAddressCity(String string) {
381: if (string != null) {
382: addressCity = string;
383: }
384: }
385:
386: /**
387: * setAddressCountry purpose.
388: *
389: * <p>
390: * Description ...
391: * </p>
392: *
393: * @param string
394: */
395: public void setAddressCountry(String string) {
396: if (string != null) {
397: addressCountry = string;
398: }
399: }
400:
401: /**
402: * setAddressPostalCode purpose.
403: *
404: * <p>
405: * Description ...
406: * </p>
407: *
408: * @param string
409: */
410: public void setAddressPostalCode(String string) {
411: if (string != null) {
412: addressPostalCode = string;
413: }
414: }
415:
416: /**
417: * setAddressState purpose.
418: *
419: * <p>
420: * Description ...
421: * </p>
422: *
423: * @param string
424: */
425: public void setAddressState(String string) {
426: if (string != null) {
427: addressState = string;
428: }
429: }
430:
431: /**
432: * setAddressType purpose.
433: *
434: * <p>
435: * Description ...
436: * </p>
437: *
438: * @param string
439: */
440: public void setAddressType(String string) {
441: if (string != null) {
442: addressType = string;
443: }
444: }
445:
446: /**
447: * setContactEmail purpose.
448: *
449: * <p>
450: * Description ...
451: * </p>
452: *
453: * @param string
454: */
455: public void setContactEmail(String string) {
456: if (string != null) {
457: contactEmail = string;
458: }
459: }
460:
461: /**
462: * setContactFacsimile purpose.
463: *
464: * <p>
465: * Description ...
466: * </p>
467: *
468: * @param string
469: */
470: public void setContactFacsimile(String string) {
471: if (string != null) {
472: contactFacsimile = string;
473: }
474: }
475:
476: /**
477: * setContactOrganization purpose.
478: *
479: * <p>
480: * Description ...
481: * </p>
482: *
483: * @param string
484: */
485: public void setContactOrganization(String string) {
486: if (string != null) {
487: contactOrganization = string;
488: }
489: }
490:
491: /**
492: * setContactPerson purpose.
493: *
494: * <p>
495: * Description ...
496: * </p>
497: *
498: * @param string
499: */
500: public void setContactPerson(String string) {
501: if (string != null) {
502: contactPerson = string;
503: }
504: }
505:
506: /**
507: * setContactPosition purpose.
508: *
509: * <p>
510: * Description ...
511: * </p>
512: *
513: * @param string
514: */
515: public void setContactPosition(String string) {
516: if (string != null) {
517: contactPosition = string;
518: }
519: }
520:
521: /**
522: * setContactVoice purpose.
523: *
524: * <p>
525: * Description ...
526: * </p>
527: *
528: * @param string
529: */
530: public void setContactVoice(String string) {
531: if (string != null) {
532: contactVoice = string;
533: }
534: }
535:
536: /**
537: * @return Returns the onlineResource.
538: *
539: */
540: public String getOnlineResource() {
541: return onlineResource;
542: }
543:
544: /**
545: * @param onlineResource The onlineResource to set.
546: *
547: */
548: public void setOnlineResource(String onlineResource) {
549: if (onlineResource != null) {
550: this.onlineResource = onlineResource;
551: }
552: }
553: }
|