Return-Path: X-Original-To: apmail-sis-commits-archive@www.apache.org Delivered-To: apmail-sis-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9584011A6B for ; Tue, 24 Jun 2014 16:44:28 +0000 (UTC) Received: (qmail 98627 invoked by uid 500); 24 Jun 2014 16:44:28 -0000 Delivered-To: apmail-sis-commits-archive@sis.apache.org Received: (qmail 98602 invoked by uid 500); 24 Jun 2014 16:44:28 -0000 Mailing-List: contact commits-help@sis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: sis-dev@sis.apache.org Delivered-To: mailing list commits@sis.apache.org Received: (qmail 98593 invoked by uid 99); 24 Jun 2014 16:44:28 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 24 Jun 2014 16:44:28 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 24 Jun 2014 16:44:25 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id D321323889E1; Tue, 24 Jun 2014 16:44:05 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: svn commit: r1605132 - in /sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso: citation/AbstractParty.java identification/DefaultAssociatedResource.java Date: Tue, 24 Jun 2014 16:44:05 -0000 To: commits@sis.apache.org From: desruisseaux@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20140624164405.D321323889E1@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: desruisseaux Date: Tue Jun 24 16:44:05 2014 New Revision: 1605132 URL: http://svn.apache.org/r1605132 Log: Starting integration of new ISO 19115 classes from RĂ©mi's patches. Added: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/AbstractParty.java (with props) sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultAssociatedResource.java (with props) Added: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/AbstractParty.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/AbstractParty.java?rev=1605132&view=auto ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/AbstractParty.java (added) +++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/AbstractParty.java [UTF-8] Tue Jun 24 16:44:05 2014 @@ -0,0 +1,158 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.sis.metadata.iso.citation; + +import java.util.Collection; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import org.apache.sis.metadata.iso.ISOMetadata; +import org.opengis.metadata.citation.Contact; +///import org.opengis.metadata.citation.Party; +import org.opengis.util.InternationalString; + + +/** + * Information about the individual and / or organisation of the party. + * + * @author Remi Marechal (Geomatys) + * @author Martin Desruisseaux (Geomatys) + * @since 0.5 + * @version 0.5 + * @module + */ +@XmlType(name = "CI_Party_Type", propOrder = { +/// "name", +/// "contactInfo" +}) +@XmlRootElement(name = "CI_Party") +public class AbstractParty extends ISOMetadata /*implements Party*/ { + /** + * Serial number for compatibility with different versions. + */ + private static final long serialVersionUID = 1486981243884830979L; + + /** + * Name of the party. + */ + private InternationalString name; + + /** + * Contact information for the party. + */ + private Collection contactInfo; + + /** + * Constructs an initially empty party. + */ + public AbstractParty() { + } + + /** + * Constructs a party initialized with the specified name and contact information. + * + * @param name Name of the party, or {@code null} if none. + * @param contactInfo Contact information for the party, or {@code null} if none. + */ + public AbstractParty(final InternationalString name, final Contact contactInfo) { + this.name = name; + this.contactInfo = singleton(contactInfo, Contact.class); + } + + /** + * Constructs a new instance initialized with the values from the specified metadata object. + * This is a shallow copy constructor, since the other metadata contained in the + * given object are not recursively copied. + * + * @param object The metadata to copy values from, or {@code null} if none. + * + * @see #castOrCopy(Party) + */ + public AbstractParty(final AbstractParty object) { + super(object); + if (object != null) { + name = object.getName(); + contactInfo = copyList(object.getContactInfo(), Contact.class); + } + } + + /** + * Returns a SIS metadata implementation with the values of the given arbitrary implementation. + * This method performs the first applicable action in the following choices: + * + *
    + *
  • If the given object is {@code null}, then this method returns {@code null}.
  • + *
  • Otherwise if the given object is already an instance of + * {@code AbstractParty}, then it is returned unchanged.
  • + *
  • Otherwise a new {@code AbstractParty} instance is created using the + * {@linkplain #AbstractParty(Party) copy constructor} and returned. + * Note that this is a shallow copy operation, since the other + * metadata contained in the given object are not recursively copied.
  • + *
+ * + * @param object The object to get as a SIS implementation, or {@code null} if none. + * @return A SIS implementation containing the values of the given object (may be the + * given object itself), or {@code null} if the argument was null. + */ + public static AbstractParty castOrCopy(final AbstractParty object) { + if (object == null || object instanceof AbstractParty) { + return (AbstractParty) object; + } + return new AbstractParty(object); + } + + /** + * Return the name of the party. + * + * @return Name of the party. + */ +/// @Override +/// @XmlElement(name = "name") + public InternationalString getName() { + return name; + } + + /** + * Sets the name of the party. + * + * @param newValue The new name of the party. + */ + public void setName(final InternationalString newValue) { + checkWritePermission(); + name = newValue; + } + + /** + * Returns the contact information for the party, or {@code null} if none. + * + * @return Contact information for the party, or {@code null} if none. + */ +/// @Override +/// @XmlElement(name = "contactInfo") + public Collection getContactInfo() { + return contactInfo = nonNullCollection(contactInfo, Contact.class); + } + + /** + * Sets the contact information for the party. + * + * @param newValues The new contact information for the party. + */ + public void setContactInfo(final Collection< ? extends Contact> newValues) { + contactInfo = writeCollection(newValues, contactInfo, Contact.class); + } +} Propchange: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/AbstractParty.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/AbstractParty.java ------------------------------------------------------------------------------ svn:mime-type = text/plain;charset=UTF-8 Added: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultAssociatedResource.java URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultAssociatedResource.java?rev=1605132&view=auto ============================================================================== --- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultAssociatedResource.java (added) +++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultAssociatedResource.java [UTF-8] Tue Jun 24 16:44:05 2014 @@ -0,0 +1,213 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.sis.metadata.iso.identification; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import org.apache.sis.metadata.iso.ISOMetadata; +import org.opengis.metadata.citation.Citation; +///import org.opengis.metadata.identification.AssociatedResource; +import org.opengis.metadata.identification.AssociationType; +import org.opengis.metadata.identification.InitiativeType; + + +/** + * Associated resource information. + * + * @author Remi Marechal (Geomatys) + * @author Martin Desruisseaux (Geomatys) + * @since 0.5 + * @version 0.5 + * @module + */ +@XmlType(name = "MD_AssociatedResource", propOrder = { +/// "name", +/// "associationType", +/// "initiativeType", +/// "metadataReference" +}) +@XmlRootElement(name = "MD_AssociatedResource") +public class DefaultAssociatedResource extends ISOMetadata /*implements AssociatedResource*/ { + /** + * Serial number for compatibility with different versions. + */ + + /** + * Citation information about the associated resource. + */ + private Citation name; + + /** + * Type of relation between the resources. + */ + private AssociationType associationType; + + /** + * Type of initiative under which the associated resource was produced. + */ + private InitiativeType initiativeType; + + /** + * Reference to the metadata of the associated resource. + */ + private Citation metadataReference; + + /** + * Constructs an initially empty associated resource. + */ + public DefaultAssociatedResource() { + } + + /** + * Constructs an associated resource initialized to the specified values. + * + * @param name Citation information about the associated resource. + * @param associationType Type of relation between the resources. + */ + public DefaultAssociatedResource(final Citation name, final AssociationType associationType) { + this.name = name; + this.associationType = associationType; + } + + /** + * Constructs a new instance initialized with the values from the specified metadata object. + * This is a shallow copy constructor, since the other metadata contained in the + * given object are not recursively copied. + * + * @param object The metadata to copy values from, or {@code null} if none. + * + * @see #castOrCopy(AssociatedResource) + */ + public DefaultAssociatedResource(final DefaultAssociatedResource object) { + if (object != null) { + this.name = object.getName(); + this.associationType = object.getAssociationType(); + this.initiativeType = object.getInitiativeType(); + this.metadataReference = object.getMetadataReference(); + } + } + + /** + * Returns a SIS metadata implementation with the values of the given arbitrary implementation. + * This method performs the first applicable action in the following choices: + * + *
    + *
  • If the given object is {@code null}, then this method returns {@code null}.
  • + *
  • Otherwise if the given object is already an instance of + * {@code DefaultAssociatedResource}, then it is returned unchanged.
  • + *
  • Otherwise a new {@code DefaultAssociatedResource} instance is created using the + * {@linkplain #DefaultAssociatedResource(AssociatedResource) copy constructor} and returned. + * Note that this is a shallow copy operation, since the other + * metadata contained in the given object are not recursively copied.
  • + *
+ * + * @param object The object to get as a SIS implementation, or {@code null} if none. + * @return A SIS implementation containing the values of the given object (may be the + * given object itself), or {@code null} if the argument was null. + */ + public static DefaultAssociatedResource castOrCopy(final DefaultAssociatedResource object) { + if (object == null || object instanceof DefaultAssociatedResource) { + return (DefaultAssociatedResource) object; + } + return new DefaultAssociatedResource(object); + } + + /** + * Returns citation information about the associated resource, or {@code null} if none. + * + * @return Citation information about the associated resource, or {@code null} if none. + */ +/// @Override +/// @XmlElement(name = "name") + public Citation getName() { + return name; + } + + /** + * Sets citation information about the associated resource. + * + * @param newValue The new citation information, or {@code null}. + */ + public void setName(final Citation newValue) { + checkWritePermission(); + name = newValue; + } + + /** + * Returns the type of relation between the resources. + * + * @return Type of relation between the resources. + */ +/// @Override +/// @XmlElement(name = "associationType", required = true) + public AssociationType getAssociationType() { + return associationType; + } + + /** + * Sets the type of relation between the resources. + * + * @param newValue The new type of relation. + */ + public void setAssociationType(final AssociationType newValue) { + checkWritePermission(); + associationType = newValue; + } + + /** + * Returns the type of initiative under which the associated resource was produced, or {@code null} if none. + * + * @return The type of initiative under which the associated resource was produced, or {@code null} if none. + */ +/// @Override +/// @XmlElement(name = "initiativeType") + public InitiativeType getInitiativeType() { + return initiativeType; + } + + /** + * Sets a new type of initiative under which the associated resource was produced. + * + * @param newValue The new type of initiative. + */ + public void setInitiativeType(final InitiativeType newValue) { + checkWritePermission(); + initiativeType = newValue; + } + + /** + * Return a reference to the metadata of the associated resource, or {@code null} if none. + * + * @return Reference to the metadata of the associated resource, or {@code null} if none. + */ +/// @Override +/// @XmlElement(name = "metadataReference") + public Citation getMetadataReference() { + return metadataReference; + } + + /** + * Sets the reference to the metadata of the associated resource. + * + * @param newValue The new reference to the metadata. + */ + public void setMetadataReference(final Citation newValue) { + checkWritePermission(); + metadataReference = newValue; + } +} Propchange: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultAssociatedResource.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultAssociatedResource.java ------------------------------------------------------------------------------ svn:mime-type = text/plain;charset=UTF-8