sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1380265 - in /incubator/sis/trunk/sis-metadata/src: ./ main/ main/java/ main/java/org/ main/java/org/apache/ main/java/org/apache/sis/ main/java/org/apache/sis/metadata/ main/java/org/apache/sis/metadata/iso/ main/java/org/apache/sis/metad...
Date Mon, 03 Sep 2012 15:10:59 GMT
Author: desruisseaux
Date: Mon Sep  3 15:10:58 2012
New Revision: 1380265

URL: http://svn.apache.org/viewvc?rev=1380265&view=rev
Log:
Skeleton implementation of GeoAPI Citation (SIS-55).

Added:
    incubator/sis/trunk/sis-metadata/src/
    incubator/sis/trunk/sis-metadata/src/main/
    incubator/sis/trunk/sis-metadata/src/main/java/
    incubator/sis/trunk/sis-metadata/src/main/java/org/
    incubator/sis/trunk/sis-metadata/src/main/java/org/apache/
    incubator/sis/trunk/sis-metadata/src/main/java/org/apache/sis/
    incubator/sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/
    incubator/sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/ModifiableMetadata.java
  (with props)
    incubator/sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/UnmodifiableMetadataException.java
  (with props)
    incubator/sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/
    incubator/sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/
    incubator/sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultCitation.java
  (with props)

Added: incubator/sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/ModifiableMetadata.java
URL: http://svn.apache.org/viewvc/incubator/sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/ModifiableMetadata.java?rev=1380265&view=auto
==============================================================================
--- incubator/sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/ModifiableMetadata.java
(added)
+++ incubator/sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/ModifiableMetadata.java
Mon Sep  3 15:10:58 2012
@@ -0,0 +1,385 @@
+/*
+ * 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;
+
+import java.util.ArrayList;
+import java.util.Set;
+import java.util.List;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedHashSet;
+import java.util.NoSuchElementException;
+
+import org.opengis.util.CodeList;
+
+
+/**
+ * Base class for metadata that may (or may not) be modifiable. Implementations will typically
+ * provide {@code set*(...)} methods for each corresponding {@code get*()} method. An initially
+ * modifiable metadata may become unmodifiable at a later stage (typically after its construction
+ * is completed) by the call to the {@link #freeze()} method.
+ *
+ * {@section Guidline for implementors}
+ * Subclasses should follow the pattern below for every {@code get} and {@code set} methods,
+ * with a different processing for singleton value or for {@linkplain Collection collections}.
+ * <p>
+ * For singleton value:
+ *
+ * {@preformat java
+ *     private Foo property;
+ *
+ *     public synchronized Foo getProperty() {
+ *         return property;
+ *     }
+ *
+ *     public synchronized void setProperty(Foo newValue) {
+ *         checkWritePermission();
+ *         property = newValue;
+ *     }
+ * }
+ *
+ * For collections (note that the call to {@link #checkWritePermission()} is implicit):
+ *
+ * {@preformat java
+ *     private Collection<Foo> properties;
+ *
+ *     public synchronized Collection<Foo> getProperties() {
+ *         return properties = nonNullCollection(properties, Foo.class);
+ *     }
+ *
+ *     public synchronized void setProperties(Collection<Foo> newValues) {
+ *         properties = copyCollection(newValues, properties, Foo.class);
+ *     }
+ * }
+ *
+ * @author  Martin Desruisseaux (Geomatys)
+ * @since   0.3 (derived from geotk-2.1)
+ * @version 0.3
+ * @module
+ */
+public abstract class ModifiableMetadata {
+    /**
+     * Constructs an initially empty metadata.
+     */
+    protected ModifiableMetadata() {
+        super();
+    }
+
+    /**
+     * Returns {@code true} if this metadata is modifiable. This method returns
+     * {@code false} if {@link #freeze()} has been invoked on this object.
+     *
+     * @return {@code true} if this metadata is modifiable.
+     *
+     * @see #freeze()
+     * @see #checkWritePermission()
+     */
+    public final boolean isModifiable() {
+        return true; // To be implemented later.
+    }
+
+    /**
+     * Checks if changes in the metadata are allowed. All {@code setFoo(...)} methods in
+     * subclasses should invoke this method (directly or indirectly) before to apply any
+     * change.
+     *
+     * @throws UnmodifiableMetadataException if this metadata is unmodifiable.
+     *
+     * @see #isModifiable()
+     * @see #freeze()
+     */
+    protected void checkWritePermission() throws UnmodifiableMetadataException {
+        assert Thread.holdsLock(this);
+        if (!isModifiable()) {
+            throw new UnmodifiableMetadataException("Unmodifiable metadata"); // TODO: localize
+        }
+    }
+
+    /**
+     * Copies the content of one list ({@code source}) into an other ({@code target}).
+     * This method performs the following steps:
+     * <p>
+     * <ul>
+     *   <li>Invokes {@link #checkWritePermission()} in order to ensure that this metadata
is
+     *       modifiable.</li>
+     *   <li>If {@code source} is {@linkplain XCollections#isNullOrEmpty(Collection)
null or
+     *       empty}, returns {@code null} (meaning that the metadata is not provided).</li>
+     *   <li>If {@code target} is null, creates a new {@link List}.</li>
+     *   <li>Copies the content of the given {@code source} into the target.</li>
+     * </ul>
+     *
+     * @param  <E>         The type of elements in the list.
+     * @param  source      The source list, or {@code null}.
+     * @param  target      The target list, or {@code null} if not yet created.
+     * @param  elementType The base type of elements to put in the list.
+     * @return A list (possibly the {@code target} instance) containing the {@code source}
+     *         elements, or {@code null} if the source was null.
+     * @throws UnmodifiableMetadataException if this metadata is unmodifiable.
+     *
+     * @see #nonNullList(List, Class)
+     */
+    @SuppressWarnings("unchecked")
+    protected final <E> List<E> copyList(final Collection<? extends E>
source,
+            List<E> target, final Class<E> elementType)
+            throws UnmodifiableMetadataException
+    {
+        // See the comments in copyCollection(...) for implementation notes.
+        if (source != target) {
+            checkWritePermission();
+            if (source == null) {
+                target = null;
+            } else {
+                if (target != null) {
+                    target.clear();
+                } else {
+                    target = new ArrayList<E>(source.size());
+                }
+                target.addAll(source);
+            }
+        }
+        return target;
+    }
+
+    /**
+     * Copies the content of one Set ({@code source}) into an other ({@code target}).
+     * This method performs the following steps:
+     * <p>
+     * <ul>
+     *   <li>Invokes {@link #checkWritePermission()} in order to ensure that this metadata
is
+     *       modifiable.</li>
+     *   <li>If {@code source} is {@linkplain XCollections#isNullOrEmpty(Collection)
null or
+     *       empty}, returns {@code null} (meaning that the metadata is not provided).</li>
+     *   <li>If {@code target} is null, creates a new {@link Set}.</li>
+     *   <li>Copies the content of the given {@code source} into the target.</li>
+     * </ul>
+     *
+     * @param  <E>         The type of elements in the set.
+     * @param  source      The source set, or {@code null}.
+     * @param  target      The target set, or {@code null} if not yet created.
+     * @param  elementType The base type of elements to put in the set.
+     * @return A set (possibly the {@code target} instance) containing the {@code source}
+     *         elements, or {@code null} if the source was null.
+     * @throws UnmodifiableMetadataException if this metadata is unmodifiable.
+     *
+     * @see #nonNullSet(Set, Class)
+     */
+    @SuppressWarnings("unchecked")
+    protected final <E> Set<E> copySet(final Collection<? extends E> source,
+            Set<E> target, final Class<E> elementType)
+            throws UnmodifiableMetadataException
+    {
+        // See the comments in copyCollection(...) for implementation notes.
+        if (source != target) {
+            checkWritePermission();
+            if (source == null) {
+                target = null;
+            } else {
+                if (target != null) {
+                    target.clear();
+                } else {
+                    target = new LinkedHashSet<E>(source.size());
+                }
+                target.addAll(source);
+            }
+        }
+        return target;
+    }
+
+    /**
+     * Copies the content of one collection ({@code source}) into an other ({@code target}).
+     * This method performs the following steps:
+     * <p>
+     * <ul>
+     *   <li>Invokes {@link #checkWritePermission()} in order to ensure that this metadata
is
+     *       modifiable.</li>
+     *   <li>If {@code source} is {@linkplain XCollections#isNullOrEmpty(Collection)
null or
+     *       empty}, returns {@code null} (meaning that the metadata is not provided).</li>
+     *   <li>If {@code target} is null, creates a new {@link Set} or a new {@link
List}
+     *       depending on the value returned by {@link #collectionType(Class)}.</li>
+     *   <li>Copies the content of the given {@code source} into the target.</li>
+     * </ul>
+     *
+     * {@section Choosing a collection type}
+     * Implementations shall invoke {@link #copyList copyList} or {@link #copySet copySet}
methods
+     * instead than this method when the collection type is enforced by ISO specification.
+     * When the type is not enforced by the specification, some freedom are allowed at
+     * implementor choice. The default implementation invokes {@link #collectionType(Class)}
+     * in order to get a hint about whatever a {@link List} or a {@link Set} should be used.
+     *
+     * @param  <E>         The type of elements in the collection.
+     * @param  source      The source collection, or {@code null}.
+     * @param  target      The target collection, or {@code null} if not yet created.
+     * @param  elementType The base type of elements to put in the collection.
+     * @return A collection (possibly the {@code target} instance) containing the {@code
source}
+     *         elements, or {@code null} if the source was null.
+     * @throws UnmodifiableMetadataException if this metadata is unmodifiable.
+     */
+    @SuppressWarnings("unchecked")
+    protected final <E> Collection<E> copyCollection(final Collection<? extends
E> source,
+            Collection<E> target, final Class<E> elementType)
+            throws UnmodifiableMetadataException
+    {
+        /*
+         * It is not worth to copy the content if the current and the new instance are the
+         * same. This is safe only using the != operator, not the !equals(Object) method.
+         * This optimization is required for efficient working of PropertyAccessor.set(...).
+         */
+        if (source != target) {
+            checkWritePermission();
+            if (source == null) {
+                target = null;
+            } else {
+                if (target != null) {
+                    target.clear();
+                } else {
+                    final int capacity = source.size();
+                    if (useSet(elementType)) {
+                        target = new LinkedHashSet<E>(capacity);
+                    } else {
+                        target = new ArrayList<E>(capacity);
+                    }
+                }
+                target.addAll(source);
+            }
+        }
+        return target;
+    }
+
+    /**
+     * Returns the specified list, or a new one if {@code c} is null.
+     * This is a convenience method for implementation of {@code getFoo()}
+     * methods.
+     *
+     * @param  <E> The type of elements in the list.
+     * @param  c The list to checks.
+     * @param  elementType The element type (used only if {@code c} is null).
+     * @return {@code c}, or a new list if {@code c} is null.
+     */
+    // See the comments in nonNullCollection(...) for implementation notes.
+    protected final <E> List<E> nonNullList(final List<E> c, final Class<E>
elementType) {
+        assert Thread.holdsLock(this);
+        if (c != null) {
+            return c;
+        }
+        if (isModifiable()) {
+            return new ArrayList<E>();
+        }
+        return Collections.emptyList();
+    }
+
+    /**
+     * Returns the specified set, or a new one if {@code c} is null.
+     * This is a convenience method for implementation of {@code getFoo()}
+     * methods.
+     *
+     * @param  <E> The type of elements in the set.
+     * @param  c The set to checks.
+     * @param  elementType The element type (used only if {@code c} is null).
+     * @return {@code c}, or a new set if {@code c} is null.
+     */
+    // See the comments in nonNullCollection(...) for implementation notes.
+    protected final <E> Set<E> nonNullSet(final Set<E> c, final Class<E>
elementType) {
+        assert Thread.holdsLock(this);
+        if (c != null) {
+            return c;
+        }
+        if (isModifiable()) {
+            return new LinkedHashSet<E>();
+        }
+        return Collections.emptySet();
+    }
+
+    /**
+     * Returns the specified collection, or a new one if {@code c} is null.
+     * This is a convenience method for implementation of {@code getFoo()}
+     * methods.
+     *
+     * {@section Choosing a collection type}
+     * Implementations shall invoke {@link #nonNullList nonNullList} or {@link #nonNullSet
+     * nonNullSet} instead than this method when the collection type is enforced by ISO
+     * specification. When the type is not enforced by the specification, some freedom are
+     * allowed at implementor choice. The default implementation invokes
+     * {@link #collectionType(Class)} in order to get a hint about whatever a {@link List}
+     * or a {@link Set} should be used.
+     *
+     * @param  <E> The type of elements in the collection.
+     * @param  c The collection to checks.
+     * @param  elementType The element type (used only if {@code c} is null).
+     * @return {@code c}, or a new collection if {@code c} is null.
+     */
+    // Despite the javadoc claims, we do not yet return null during copy operations.
+    // However a future version may do so if it appears worth on a performance point of view.
+    protected final <E> Collection<E> nonNullCollection(final Collection<E>
c, final Class<E> elementType) {
+        assert Thread.holdsLock(this);
+        if (c != null) {
+            assert collectionType(elementType).isAssignableFrom(c.getClass());
+            return c;
+        }
+        final boolean isModifiable = isModifiable();
+        if (useSet(elementType)) {
+            if (isModifiable) {
+                return new LinkedHashSet<E>();
+            } else {
+                return Collections.emptySet();
+            }
+        } else {
+            if (isModifiable) {
+                return new ArrayList<E>();
+            } else {
+                return Collections.emptyList();
+            }
+        }
+    }
+
+    /**
+     * Returns {@code true} if we should use a {@link Set} instead than a {@link List}
+     * for elements of the given type.
+     */
+    private <E> boolean useSet(final Class<E> elementType) {
+        final Class<? extends Collection<E>> type = collectionType(elementType);
+        if (Set.class.isAssignableFrom(type)) {
+            return true;
+        }
+        if (List.class.isAssignableFrom(type)) {
+            return false;
+        }
+        throw new NoSuchElementException("Unsupported data type");
+    }
+
+    /**
+     * Returns the type of collection to use for the given type. The current implementation
can
+     * return only two values: <code>{@linkplain Set}.class</code> if the attribute
should not
+     * accept duplicated values, or <code>{@linkplain List}.class</code> otherwise.
Future Geotk
+     * versions may accept other types.
+     * <p>
+     * The default implementation returns <code>{@linkplain Set}.class</code>
if the element type
+     * is assignable to {@link Enum} or {@link CodeList}, and <code>{@linkplain List}.class</code>
+     * otherwise. Subclasses can override this method for choosing different kind of collections.
+     * <em>Note however that {@link Set} should be used only with immutable element
types</em>,
+     * for {@linkplain Object#hashCode() hash code} stability.
+     *
+     * @param  <E> The type of elements in the collection to be created.
+     * @param  elementType The type of elements in the collection to be created.
+     * @return {@code List.class} or {@code Set.class} depending on whatever the
+     *         attribute shall accept duplicated values or not.
+     */
+    @SuppressWarnings({"rawtypes","unchecked"})
+    protected <E> Class<? extends Collection<E>> collectionType(final Class<E>
elementType) {
+        return (Class) (CodeList.class.isAssignableFrom(elementType) ||
+                            Enum.class.isAssignableFrom(elementType) ? Set.class : List.class);
+    }
+}

Propchange: incubator/sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/ModifiableMetadata.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/ModifiableMetadata.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/UnmodifiableMetadataException.java
URL: http://svn.apache.org/viewvc/incubator/sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/UnmodifiableMetadataException.java?rev=1380265&view=auto
==============================================================================
--- incubator/sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/UnmodifiableMetadataException.java
(added)
+++ incubator/sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/UnmodifiableMetadataException.java
Mon Sep  3 15:10:58 2012
@@ -0,0 +1,45 @@
+/*
+ * 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;
+
+
+/**
+ * Thrown when a setter method is invoked on an initially
+ * {@linkplain org.apache.sis.metadata.ModifiableMetadata modifiable metadata},
+ * but this metadata has since be declared unmodifiable.
+ *
+ * @author Martin Desruisseaux (Geomatys)
+ * @version 3.00
+ *
+ * @since 2.4
+ * @module
+ */
+public class UnmodifiableMetadataException extends UnsupportedOperationException {
+    /**
+     * For cross-version compatibility.
+     */
+    private static final long serialVersionUID = -1885135341334523675L;
+
+    /**
+     * Creates a new exception with the specified detail message.
+     *
+     * @param message The detail message.
+     */
+    public UnmodifiableMetadataException(final String message) {
+        super(message);
+    }
+}

Propchange: incubator/sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/UnmodifiableMetadataException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/UnmodifiableMetadataException.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultCitation.java
URL: http://svn.apache.org/viewvc/incubator/sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultCitation.java?rev=1380265&view=auto
==============================================================================
--- incubator/sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultCitation.java
(added)
+++ incubator/sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultCitation.java
Mon Sep  3 15:10:58 2012
@@ -0,0 +1,323 @@
+/*
+ * 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.Date;
+import java.util.Collection;
+
+import org.opengis.metadata.Identifier;
+import org.opengis.metadata.citation.Citation;
+import org.opengis.metadata.citation.CitationDate;
+import org.opengis.metadata.citation.PresentationForm;
+import org.opengis.metadata.citation.ResponsibleParty;
+import org.opengis.metadata.citation.Series;
+import org.opengis.util.InternationalString;
+
+import org.apache.sis.metadata.ModifiableMetadata;
+
+
+/**
+ * Standardized resource reference.
+ *
+ * @author  Martin Desruisseaux (IRD, Geomatys)
+ * @author  Cédric Briançon (Geomatys)
+ * @since   0.3 (derived from geotk-2.1)
+ * @version 0.3
+ * @module
+ */
+public class DefaultCitation extends ModifiableMetadata implements Citation {
+    /**
+     * Serial number for inter-operability with different versions.
+     */
+    private static final long serialVersionUID = 2595269795652984755L;
+
+    /**
+     * Name by which the cited resource is known.
+     */
+    private InternationalString title;
+
+    /**
+     * Short name or other language name by which the cited information is known.
+     * Example: "DCW" as an alternative title for "Digital Chart of the World.
+     */
+    private Collection<InternationalString> alternateTitles;
+
+    /**
+     * Reference date for the cited resource.
+     */
+    private Collection<CitationDate> dates;
+
+    /**
+     * Version of the cited resource.
+     */
+    private InternationalString edition;
+
+    /**
+     * Date of the edition in milliseconds elapsed sine January 1st, 1970,
+     * or {@link Long#MIN_VALUE} if none.
+     */
+    private long editionDate;
+
+    /**
+     * Name and position information for an individual or organization that is responsible
+     * for the resource. Returns an empty string if there is none.
+     */
+    private Collection<ResponsibleParty> citedResponsibleParties;
+
+    /**
+     * Mode in which the resource is represented, or an empty string if none.
+     */
+    private Collection<PresentationForm> presentationForms;
+
+    /**
+     * Information about the series, or aggregate dataset, of which the dataset is a part.
+     * May be {@code null} if none.
+     */
+    private Series series;
+
+    /**
+     * Other information required to complete the citation that is not recorded elsewhere.
+     * May be {@code null} if none.
+     */
+    private InternationalString otherCitationDetails;
+
+    /**
+     * Common title with holdings note. Note: title identifies elements of a series
+     * collectively, combined with information about what volumes are available at the
+     * source cited. May be {@code null} if there is no title.
+     */
+    private InternationalString collectiveTitle;
+
+    /**
+     * Constructs an initially empty citation.
+     */
+    public DefaultCitation() {
+        editionDate = Long.MIN_VALUE;
+    }
+
+    /**
+     * Returns the name by which the cited resource is known.
+     */
+    @Override
+    public synchronized InternationalString getTitle() {
+        return title;
+    }
+
+    /**
+     * Sets the name by which the cited resource is known.
+     *
+     * @param newValue The new title.
+     */
+    public synchronized void setTitle(final InternationalString newValue) {
+        checkWritePermission();
+        title = newValue;
+    }
+
+    /**
+     * Returns the short name or other language name by which the cited information is known.
+     * Example: "DCW" as an alternative title for "Digital Chart of the World".
+     */
+    @Override
+    public synchronized Collection<InternationalString> getAlternateTitles() {
+        return alternateTitles = nonNullCollection(alternateTitles, InternationalString.class);
+    }
+
+    /**
+     * Sets the short name or other language name by which the cited information is known.
+     *
+     * @param newValues The new alternate titles.
+     */
+    public synchronized void setAlternateTitles(final Collection<? extends InternationalString>
newValues) {
+        alternateTitles = copyCollection(newValues, alternateTitles, InternationalString.class);
+    }
+
+    /**
+     * Returns the reference date for the cited resource.
+     */
+    @Override
+    public synchronized Collection<CitationDate> getDates() {
+        return dates = nonNullCollection(dates, CitationDate.class);
+    }
+
+    /**
+     * Sets the reference date for the cited resource.
+     *
+     * @param newValues The new dates.
+     */
+    public synchronized void setDates(final Collection<? extends CitationDate> newValues)
{
+        dates = copyCollection(newValues, dates, CitationDate.class);
+    }
+
+    /**
+     * Returns the version of the cited resource.
+     */
+    @Override
+    public synchronized InternationalString getEdition() {
+        return edition;
+    }
+
+    /**
+     * Sets the version of the cited resource.
+     *
+     * @param newValue The new edition.
+     */
+    public synchronized void setEdition(final InternationalString newValue) {
+        checkWritePermission();
+        edition = newValue;
+    }
+
+    /**
+     * Returns the date of the edition, or {@code null} if none.
+     */
+    @Override
+    public synchronized Date getEditionDate() {
+        return (editionDate != Long.MIN_VALUE) ? new Date(editionDate) : null;
+    }
+
+    /**
+     * Sets the date of the edition, or {@code null} if none.
+     *
+     * @param newValue The new edition date.
+     */
+    public synchronized void setEditionDate(final Date newValue) {
+        checkWritePermission();
+        editionDate = (newValue != null) ? newValue.getTime() : Long.MIN_VALUE;
+    }
+
+    /**
+     * Returns the unique identifier for the resource. Example: Universal Product Code (UPC),
+     * National Stock Number (NSN).
+     */
+    @Override
+    public Collection<Identifier> getIdentifiers() {
+        return null; // Not yet implemented on intend.
+    }
+
+    /**
+     * Returns the name and position information for an individual or organization that is
+     * responsible for the resource. Returns an empty string if there is none.
+     */
+    @Override
+    public synchronized Collection<ResponsibleParty> getCitedResponsibleParties() {
+        return citedResponsibleParties = nonNullCollection(citedResponsibleParties, ResponsibleParty.class);
+    }
+
+    /**
+     * Sets the name and position information for an individual or organization that is responsible
+     * for the resource. Returns an empty string if there is none.
+     *
+     * @param newValues The new cited responsible parties.
+     */
+    public synchronized void setCitedResponsibleParties(final Collection<? extends ResponsibleParty>
newValues) {
+        citedResponsibleParties = copyCollection(newValues, citedResponsibleParties, ResponsibleParty.class);
+    }
+
+    /**
+     * Returns the mode in which the resource is represented, or an empty string if none.
+     */
+    @Override
+    public synchronized Collection<PresentationForm> getPresentationForms() {
+        return presentationForms = nonNullCollection(presentationForms, PresentationForm.class);
+    }
+
+    /**
+     * Sets the mode in which the resource is represented, or an empty string if none.
+     *
+     * @param newValues The new presentation form.
+     */
+    public synchronized void setPresentationForms(final Collection<? extends PresentationForm>
newValues) {
+        presentationForms = copyCollection(newValues, presentationForms, PresentationForm.class);
+    }
+
+    /**
+     * Returns the information about the series, or aggregate dataset, of which the dataset
is
+     * a part. Returns {@code null} if none.
+     */
+    @Override
+    public synchronized Series getSeries() {
+        return series;
+    }
+
+    /**
+     * Sets the information about the series, or aggregate dataset, of which the dataset
is
+     * a part. Set to {@code null} if none.
+     *
+     * @param newValue The new series.
+     */
+    public synchronized void setSeries(final Series newValue) {
+        checkWritePermission();
+        series = newValue;
+    }
+
+    /**
+     * Returns other information required to complete the citation that is not recorded elsewhere.
+     * Returns {@code null} if none.
+     */
+    @Override
+    public synchronized InternationalString getOtherCitationDetails() {
+        return otherCitationDetails;
+    }
+
+    /**
+     * Sets other information required to complete the citation that is not recorded elsewhere.
+     * Sets to {@code null} if none.
+     *
+     * @param newValue Other citations details.
+     */
+    public synchronized void setOtherCitationDetails(final InternationalString newValue)
{
+        checkWritePermission();
+        otherCitationDetails = newValue;
+    }
+
+    /**
+     * Returns the common title with holdings note. Note: title identifies elements of a
series
+     * collectively, combined with information about what volumes are available at the
+     * source cited. Returns {@code null} if there is no title.
+     */
+    @Override
+    public synchronized InternationalString getCollectiveTitle() {
+        return collectiveTitle;
+    }
+
+    /**
+     * Sets the common title with holdings note. Note: title identifies elements of a series
+     * collectively, combined with information about what volumes are available at the
+     * source cited. Set to {@code null} if there is no title.
+     *
+     * @param newValue The new collective title.
+     */
+    public synchronized void setCollectiveTitle(final InternationalString newValue) {
+        checkWritePermission();
+        collectiveTitle = newValue;
+    }
+
+    /**
+     * Returns the International Standard Book Number, or {@code null} if none.
+     */
+    @Override
+    public synchronized String getISBN() {
+        return null; // Not yet implemented on intend.
+    }
+
+    /**
+     * Returns the International Standard Serial Number, or {@code null} if none.
+     */
+    @Override
+    public synchronized String getISSN() {
+        return null; // Not yet implemented on intend.
+    }
+}

Propchange: incubator/sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultCitation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultCitation.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message