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