All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.geotoolkit.metadata.iso.citation.DefaultContact Maven / Gradle / Ivy

Go to download

Implementations of metadata derived from ISO 19115. This module provides both an implementation of the metadata interfaces defined in GeoAPI, and a framework for handling those metadata through Java reflection.

There is a newer version: 3.20-geoapi-3.0
Show newest version
/*
 *    Geotoolkit.org - An Open Source Java GIS Toolkit
 *    http://www.geotoolkit.org
 *
 *    (C) 2004-2011, Open Source Geospatial Foundation (OSGeo)
 *    (C) 2009-2011, Geomatys
 *
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the GNU Lesser General Public
 *    License as published by the Free Software Foundation;
 *    version 2.1 of the License.
 *
 *    This library is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *    Lesser General Public License for more details.
 *
 *    This package contains documentation from OpenGIS specifications.
 *    OpenGIS consortium's work is fully acknowledged here.
 */
package org.geotoolkit.metadata.iso.citation;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import net.jcip.annotations.ThreadSafe;

import org.opengis.util.InternationalString;
import org.opengis.metadata.citation.Address;
import org.opengis.metadata.citation.Contact;
import org.opengis.metadata.citation.Telephone;
import org.opengis.metadata.citation.OnlineResource;

import org.geotoolkit.metadata.iso.MetadataEntity;


/**
 * Information required to enable contact with the responsible person and/or organization.
 *
 * @author Martin Desruisseaux (IRD, Geomatys)
 * @author Touraïvane (IRD)
 * @author Cédric Briançon (Geomatys)
 * @version 3.18
 *
 * @since 2.1
 * @module
 */
@ThreadSafe
@XmlType(name = "CI_Contact_Type", propOrder={
    "phone",
    "address",
    "onlineResource",
    "hoursOfService",
    "contactInstructions"
})
@XmlRootElement(name = "CI_Contact")
public class DefaultContact extends MetadataEntity implements Contact {
    /**
     * Serial number for inter-operability with different versions.
     */
    private static final long serialVersionUID = 3283637180253117382L;

    /**
     * Contact informations for the Open Geospatial consortium.
     * "Open Geospatial consortium" is the new name for "OpenGIS consortium".
     *
     * @see DefaultOnlineResource#OGC
     */
    public static final Contact OGC;
    static {
        final DefaultContact c = new DefaultContact(DefaultOnlineResource.OGC);
        c.freeze();
        OGC = c;
    }

    /**
     * Contact informations for the OpenGIS consortium.
     * "OpenGIS consortium" is the old name for "Open Geospatial consortium".
     *
     * @see DefaultOnlineResource#OPEN_GIS
     */
    public static final Contact OPEN_GIS;
    static {
        final DefaultContact c = new DefaultContact(DefaultOnlineResource.OPEN_GIS);
        c.freeze();
        OPEN_GIS = c;
    }

    /**
     * Contact informations for the
     * European Petroleum Survey Group.
     *
     * @see DefaultOnlineResource#EPSG
     */
    public static final Contact EPSG;
    static {
        final DefaultContact c = new DefaultContact(DefaultOnlineResource.EPSG);
        c.freeze();
        EPSG = c;
    }

    /**
     * Contact informations for the
     * NetCDF library.
     *
     * @see DefaultOnlineResource#NETCDF
     *
     * @since 3.08
     */
    public static final Contact NETCDF;
    static {
        final DefaultContact c = new DefaultContact(DefaultOnlineResource.NETCDF);
        c.freeze();
        NETCDF = c;
    }

    /**
     * Contact informations for the
     * GeoTIFF group.
     *
     * @see DefaultOnlineResource#GEOTIFF
     */
    public static final Contact GEOTIFF;
    static {
        final DefaultContact c = new DefaultContact(DefaultOnlineResource.GEOTIFF);
        c.freeze();
        GEOTIFF = c;
    }

    /**
     * Contact informations for ESRI.
     *
     * @see DefaultOnlineResource#ESRI
     */
    public static final Contact ESRI;
    static {
        final DefaultContact c = new DefaultContact(DefaultOnlineResource.ESRI);
        c.freeze();
        ESRI = c;
    }

    /**
     * Contact informations for Oracle.
     *
     * @see DefaultOnlineResource#ORACLE
     */
    public static final Contact ORACLE;
    static {
        final DefaultContact c = new DefaultContact(DefaultOnlineResource.ORACLE);
        c.freeze();
        ORACLE = c;
    }

    /**
     * Contact informations for PostGIS.
     *
     * @see DefaultOnlineResource#POSTGIS
     *
     * @since 2.4
     */
    public static final Contact POSTGIS;
    static {
        final DefaultContact c = new DefaultContact(DefaultOnlineResource.POSTGIS);
        c.freeze();
        POSTGIS = c;
    }

    /**
     * Contact informations for Sun Microsystems.
     *
     * @see DefaultOnlineResource#SUN_MICROSYSTEMS
     *
     * @since 2.2
     */
    public static final Contact SUN_MICROSYSTEMS;
    static {
        final DefaultContact c = new DefaultContact(DefaultOnlineResource.SUN_MICROSYSTEMS);
        c.freeze();
        SUN_MICROSYSTEMS = c;
    }

    /**
     * Contact informations for the Geotoolkit.org project.
     *
     * @see DefaultOnlineResource#GEOTOOLKIT
     */
    public static final Contact GEOTOOLKIT;
    static {
        final DefaultContact c = new DefaultContact(DefaultOnlineResource.GEOTOOLKIT);
        c.freeze();
        GEOTOOLKIT = c;
    }

    /**
     * Contact informations for the GeoTools project.
     *
     * @see DefaultOnlineResource#GEOTOOLS
     */
    public static final Contact GEOTOOLS;
    static {
        final DefaultContact c = new DefaultContact(DefaultOnlineResource.GEOTOOLS);
        c.freeze();
        GEOTOOLS = c;
    }

    /**
     * Supplemental instructions on how or when to contact the individual or organization.
     */
    private InternationalString contactInstructions;

    /**
     * Time period (including time zone) when individuals can contact the organization or
     * individual.
     */
    private InternationalString hoursOfService;

    /**
     * On-line information that can be used to contact the individual or organization.
     */
    private OnlineResource onlineResource;

    /**
     * Physical and email address at which the organization or individual may be contacted.
     */
    private Address address;

    /**
     * Telephone numbers at which the organization or individual may be contacted.
     */
    private Telephone phone;

    /**
     * Constructs an initially empty contact.
     */
    public DefaultContact() {
        // empty constructor. Use set methods and call freeze
        // before returning this instance to client code
    }

    /**
     * Constructs a metadata entity initialized with the values from the specified metadata.
     *
     * @param source The metadata to copy, or {@code null} if none.
     *
     * @since 2.4
     */
    public DefaultContact(final Contact source) {
        super(source);
    }

    /**
     * Constructs a contact initialized to the specified online resource.
     *
     * @param resource The on-line information that can be used to contact the individual or organization.
     */
    public DefaultContact(final OnlineResource resource) {
        setOnlineResource(resource);
    }

    /**
     * Returns a Geotk metadata implementation with the same values than the given arbitrary
     * implementation. If the given object is {@code null}, then this method returns {@code null}.
     * Otherwise if the given object is already a Geotk implementation, then the given object is
     * returned unchanged. Otherwise a new Geotk implementation is created and initialized to the
     * attribute values of the given object, using a shallow copy operation
     * (i.e. attributes are not cloned).
     *
     * @param  object The object to wrap in a Geotk implementation, or {@code null} if none.
     * @return A Geotk implementation containing the values of the given object (may be the
     *         given object itself), or {@code null} if the argument was null.
     *
     * @since 3.18
     */
    public static DefaultContact wrap(final Contact object) {
        return (object == null) || (object instanceof DefaultContact)
                ? (DefaultContact) object : new DefaultContact(object);
    }

    /**
     * Returns the physical and email address at which the organization or individual may be contacted.
     * Returns {@code null} if none.
     */
    @Override
    @XmlElement(name = "address")
    public synchronized Address getAddress() {
        return address;
    }

    /**
     * Sets the physical and email address at which the organization or individual may be contacted.
     *
     * @param newValue The new address.
     */
    public synchronized void setAddress(final Address newValue) {
        checkWritePermission();
        address = newValue;
    }

    /**
     * Returns supplemental instructions on how or when to contact the individual or organization.
     * Returns {@code null} if none.
     */
    @Override
    @XmlElement(name = "contactInstructions")
    public synchronized InternationalString getContactInstructions() {
        return contactInstructions;
    }

    /**
     * Sets supplemental instructions on how or when to contact the individual or organization.
     *
     * @param newValue The new contact instructions.
     */
    public synchronized void setContactInstructions(final InternationalString newValue) {
        checkWritePermission();
        contactInstructions = newValue;
    }

    /**
     * Return on-line information that can be used to contact the individual or organization.
     * Returns {@code null} if none.
     */
    @Override
    @XmlElement(name = "onlineResource")
    public synchronized OnlineResource getOnlineResource() {
        return onlineResource;
    }

    /**
     * Sets on-line information that can be used to contact the individual or organization.
     *
     * @param newValue The new online resource.
     */
    public synchronized void setOnlineResource(final OnlineResource newValue) {
        checkWritePermission();
        onlineResource = newValue;
    }

    /**
     * Returns telephone numbers at which the organization or individual may be contacted.
     * Returns {@code null} if none.
     */
    @Override
    @XmlElement(name = "phone")
    public synchronized Telephone getPhone() {
        return phone;
    }

    /**
     * Sets telephone numbers at which the organization or individual may be contacted.
     *
     * @param newValue The new telephone.
     */
    public synchronized void setPhone(final Telephone newValue) {
        checkWritePermission();
        phone = newValue;
    }

    /**
     * Returns time period (including time zone) when individuals can contact the organization or
     * individual. Returns {@code null} if none.
     */
    @Override
    @XmlElement(name = "hoursOfService")
    public synchronized InternationalString getHoursOfService() {
        return hoursOfService;
    }

    /**
     * Sets time period (including time zone) when individuals can contact the organization or
     * individual.
     *
     * @param newValue The new hours of service.
     */
    public synchronized void setHoursOfService(final InternationalString newValue) {
        checkWritePermission();
        hoursOfService = newValue;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy