org.vfny.geoserver.config.ContactConfig Maven / Gradle / Ivy
/* Copyright (c) 2001 - 2007 TOPP - www.openplans.org. All rights reserved.
* This code is licensed under the GPL 2.0 license, availible at the root
* application directory.
*/
package org.vfny.geoserver.config;
import org.vfny.geoserver.global.dto.ContactDTO;
/**
* Represents a Contact (or Party).
*
*
* This is used by GeoServer to represent a contact person or organization
* associated with the Service.
*
*
*
* The configuration file represents Contact information using the following
* XML fragment (at the time of writing):
*
*
* {ContactInformation}
* {ContactPersonPrimary}
* {ContactPerson}Chris Holmes{/ContactPerson}
* {ContactOrganization}TOPP{/ContactOrganization}
* {/ContactPersonPrimary}
* {ContactPosition}Computer Scientist{/ContactPosition}
* {ContactAddress}
* {AddressType}postal{/AddressType}
* {Address}Street addresss here{/Address}
* {City}New York{/City}
* {StateOrProvince}New York{/StateOrProvince}
* {PostCode}0001{/PostCode}
* {Country}USA{/Country}
* {/ContactAddress}
* {ContactVoiceTelephone}+1 301 283-1569{/ContactVoiceTelephone}
* {ContactFacsimileTelephone}+1 301 283-1569{/ContactFacsimileTelephone}
* {/ContactInformation}
*
*
*
* To communicate with the running GeoServer application, represented by the
* classes in global, the Contact information will need to be placed into the
* ContactDTO.
*
*
* @author David Zwiers, Refractions Research, Inc.
* @version $Id: ContactConfig.java 6326 2007-03-15 18:36:40Z jdeolive $
*/
public class ContactConfig {
/** The name of the contact person */
private String contactPerson;
/** The name of the organization with which the contact is affiliated. */
private String contactOrganization;
/** The position of the contact within their organization. */
private String contactPosition;
/** The type of address specified, such as postal. */
private String addressType;
/** The actual street address. */
private String address;
/** The city of the address. */
private String addressCity;
/** The state/prov. of the address. */
private String addressState;
/** The postal code for the address. */
private String addressPostalCode;
/** The country of the address. */
private String addressCountry;
/** The contact phone number. */
private String contactVoice;
/** The contact Fax number. */
private String contactFacsimile;
/** The contact email address. */
private String contactEmail;
/**
* The contact online resource.
*
*/
private String onlineResource;
/**
* Default ContactConfig constructor.
*
*
* Creates an empty ContactConfig object which must be setup prior to use.
*
*/
public ContactConfig() {
}
/**
* ContactConfig constructor.
*
*
* Creates a copy of the ContactConfig specified, or returns a default
* ContactConfig when null is provided. None of the data is cloned, as
* String are stored in a hashtable in memory.
*
*
* @param dto The ContactConfig to create a copy of.
*/
public ContactConfig(ContactDTO dto) {
update(dto);
}
/**
* Update the configuration to reflect the provided Data Transfer Object.
*
*
* This may be used as a course grained set method, this is the entry point
* for the live GeoServer application to update the configuration system
* when a new XML file is loaded.
*
*
* @param dto Data Transfer Object representing Contact Information
*
* @throws NullPointerException DOCUMENT ME!
*/
public void update(ContactDTO dto) {
if (dto == null) {
throw new NullPointerException("Contact Data Transfer Object required");
}
contactPerson = dto.getContactPerson();
contactOrganization = dto.getContactOrganization();
contactPosition = dto.getContactPosition();
addressType = dto.getAddressType();
address = dto.getAddress();
addressCity = dto.getAddressCity();
addressState = dto.getAddressState();
addressPostalCode = dto.getAddressPostalCode();
addressCountry = dto.getAddressCountry();
contactVoice = dto.getContactVoice();
contactFacsimile = dto.getContactFacsimile();
contactEmail = dto.getContactEmail();
onlineResource = dto.getOnlineResource();
}
public ContactDTO toDTO() {
ContactDTO dto = new ContactDTO();
dto.setContactPerson(contactPerson);
dto.setContactOrganization(contactOrganization);
dto.setContactPosition(contactPosition);
dto.setAddressType(addressType);
dto.setAddress(address);
dto.setAddressCity(addressCity);
dto.setAddressState(addressState);
dto.setAddressPostalCode(addressPostalCode);
dto.setAddressCountry(addressCountry);
dto.setContactVoice(contactVoice);
dto.setContactFacsimile(contactFacsimile);
dto.setContactEmail(contactEmail);
dto.setOnlineResource(onlineResource);
return dto;
}
/**
* getAddress purpose.
*
*
* Description ...
*
*
* @return
*/
public String getAddress() {
return address;
}
/**
* getAddressCity purpose.
*
*
* Description ...
*
*
* @return
*/
public String getAddressCity() {
return addressCity;
}
/**
* getAddressCountry purpose.
*
*
* Description ...
*
*
* @return
*/
public String getAddressCountry() {
return addressCountry;
}
/**
* getAddressPostalCode purpose.
*
*
* Description ...
*
*
* @return
*/
public String getAddressPostalCode() {
return addressPostalCode;
}
/**
* getAddressState purpose.
*
*
* Description ...
*
*
* @return
*/
public String getAddressState() {
return addressState;
}
/**
* getAddressType purpose.
*
*
* Description ...
*
*
* @return
*/
public String getAddressType() {
return addressType;
}
/**
* getContactEmail purpose.
*
*
* Description ...
*
*
* @return
*/
public String getContactEmail() {
return contactEmail;
}
/**
* getContactFacsimile purpose.
*
*
* Description ...
*
*
* @return
*/
public String getContactFacsimile() {
return contactFacsimile;
}
/**
* getContactOrganization purpose.
*
*
* Description ...
*
*
* @return
*/
public String getContactOrganization() {
return contactOrganization;
}
/**
* getContactPerson purpose.
*
*
* Description ...
*
*
* @return
*/
public String getContactPerson() {
return contactPerson;
}
/**
* getContactPosition purpose.
*
*
* Description ...
*
*
* @return
*/
public String getContactPosition() {
return contactPosition;
}
/**
* getContactVoice purpose.
*
*
* Description ...
*
*
* @return
*/
public String getContactVoice() {
return contactVoice;
}
/**
* setAddress purpose.
*
*
* Description ...
*
*
* @param string
*/
public void setAddress(String string) {
if (string != null) {
address = string;
}
}
/**
* setAddressCity purpose.
*
*
* Description ...
*
*
* @param string
*/
public void setAddressCity(String string) {
if (string != null) {
addressCity = string;
}
}
/**
* setAddressCountry purpose.
*
*
* Description ...
*
*
* @param string
*/
public void setAddressCountry(String string) {
if (string != null) {
addressCountry = string;
}
}
/**
* setAddressPostalCode purpose.
*
*
* Description ...
*
*
* @param string
*/
public void setAddressPostalCode(String string) {
if (string != null) {
addressPostalCode = string;
}
}
/**
* setAddressState purpose.
*
*
* Description ...
*
*
* @param string
*/
public void setAddressState(String string) {
if (string != null) {
addressState = string;
}
}
/**
* setAddressType purpose.
*
*
* Description ...
*
*
* @param string
*/
public void setAddressType(String string) {
if (string != null) {
addressType = string;
}
}
/**
* setContactEmail purpose.
*
*
* Description ...
*
*
* @param string
*/
public void setContactEmail(String string) {
if (string != null) {
contactEmail = string;
}
}
/**
* setContactFacsimile purpose.
*
*
* Description ...
*
*
* @param string
*/
public void setContactFacsimile(String string) {
if (string != null) {
contactFacsimile = string;
}
}
/**
* setContactOrganization purpose.
*
*
* Description ...
*
*
* @param string
*/
public void setContactOrganization(String string) {
if (string != null) {
contactOrganization = string;
}
}
/**
* setContactPerson purpose.
*
*
* Description ...
*
*
* @param string
*/
public void setContactPerson(String string) {
if (string != null) {
contactPerson = string;
}
}
/**
* setContactPosition purpose.
*
*
* Description ...
*
*
* @param string
*/
public void setContactPosition(String string) {
if (string != null) {
contactPosition = string;
}
}
/**
* setContactVoice purpose.
*
*
* Description ...
*
*
* @param string
*/
public void setContactVoice(String string) {
if (string != null) {
contactVoice = string;
}
}
/**
* @return Returns the onlineResource.
*
* @uml.property name="onlineResource"
*/
public String getOnlineResource() {
return onlineResource;
}
/**
* @param onlineResource The onlineResource to set.
*
* @uml.property name="onlineResource"
*/
public void setOnlineResource(String onlineResource) {
if (onlineResource != null) {
this.onlineResource = onlineResource;
}
}
}