sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1640667 - in /sis/branches/JDK8/core/sis-metadata/src: main/java/org/apache/sis/internal/jaxb/code/ main/java/org/apache/sis/metadata/ main/java/org/apache/sis/metadata/iso/ test/java/org/apache/sis/metadata/ test/java/org/apache/sis/metad...
Date Thu, 20 Nov 2014 04:16:12 GMT
Author: desruisseaux
Date: Thu Nov 20 04:16:11 2014
New Revision: 1640667

URL: http://svn.apache.org/r1640667
Log:
Update for GeoAPI change: Obligation code list replaced by Obligation enum,
for compliance with ISO 19115.

Modified:
    sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/MD_ObligationCode.java
    sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyInformation.java
    sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultExtendedElementInformation.java
    sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyInformationTest.java
    sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java

Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/MD_ObligationCode.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/MD_ObligationCode.java?rev=1640667&r1=1640666&r2=1640667&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/MD_ObligationCode.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/MD_ObligationCode.java
[UTF-8] Thu Nov 20 04:16:11 2014
@@ -16,9 +16,9 @@
  */
 package org.apache.sis.internal.jaxb.code;
 
-import javax.xml.bind.annotation.adapters.XmlAdapter;
-import org.opengis.metadata.Obligation;
-import org.apache.sis.util.iso.Types;
+import javax.xml.bind.annotation.XmlElement;
+import org.opengis.annotation.Obligation;
+import org.apache.sis.internal.jaxb.gmd.EnumAdapter;
 
 
 /**
@@ -28,32 +28,46 @@ import org.apache.sis.util.iso.Types;
  *
  * @author  Cédric Briançon (Geomatys)
  * @since   0.3 (derived from geotk-2.5)
- * @version 0.3
+ * @version 0.5
  * @module
  */
-public final class MD_ObligationCode extends XmlAdapter<String, Obligation> {
+public final class MD_ObligationCode extends EnumAdapter<MD_ObligationCode, Obligation>
{
     /**
-     * Returns the obligation enumeration for the given name.
+     * The enumeration value.
+     */
+    @XmlElement(name = "MD_ObligationCode")
+    private String value;
+
+    /**
+     * Empty constructor for JAXB only.
+     */
+    public MD_ObligationCode() {
+    }
+
+    /**
+     * Returns the wrapped value.
      *
-     * @param value The obligation name.
-     * @return The obligation enumeration for the given name.
+     * @param wrapper The wrapper.
+     * @return The wrapped value.
      */
     @Override
-    public Obligation unmarshal(String value) {
-        return Types.forCodeName(Obligation.class, value, true);
+    public final Obligation unmarshal(final MD_ObligationCode wrapper) {
+        return Obligation.valueOf(name(wrapper.value));
     }
 
     /**
-     * Returns the name of the given obligation.
+     * Wraps the given value.
      *
-     * @param value The obligation enumeration.
-     * @return The name of the given obligation.
+     * @param  e The value to wrap.
+     * @return The wrapped value.
      */
     @Override
-    public String marshal(final Obligation value) {
-        if (value == null) {
+    public final MD_ObligationCode marshal(final Obligation e) {
+        if (e == null) {
             return null;
         }
-        return value.name();
+        final MD_ObligationCode wrapper = new MD_ObligationCode();
+        wrapper.value = value(e);
+        return wrapper;
     }
 }

Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyInformation.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyInformation.java?rev=1640667&r1=1640666&r2=1640667&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyInformation.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyInformation.java
[UTF-8] Thu Nov 20 04:16:11 2014
@@ -21,8 +21,8 @@ import java.util.Collection;
 import java.util.Collections;
 import java.lang.reflect.Method;
 import org.opengis.annotation.UML;
+import org.opengis.annotation.Obligation;
 import org.opengis.metadata.Datatype;
-import org.opengis.metadata.Obligation;
 import org.opengis.metadata.citation.Citation;
 import org.opengis.metadata.ExtendedElementInformation;
 import org.opengis.metadata.citation.Responsibility;

Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultExtendedElementInformation.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultExtendedElementInformation.java?rev=1640667&r1=1640666&r2=1640667&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultExtendedElementInformation.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultExtendedElementInformation.java
[UTF-8] Thu Nov 20 04:16:11 2014
@@ -22,8 +22,8 @@ import java.util.Iterator;
 import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
+import org.opengis.annotation.Obligation;
 import org.opengis.metadata.Datatype;
-import org.opengis.metadata.Obligation;
 import org.opengis.metadata.citation.Responsibility;
 import org.opengis.metadata.ExtendedElementInformation;
 import org.opengis.util.InternationalString;

Modified: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyInformationTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyInformationTest.java?rev=1640667&r1=1640666&r2=1640667&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyInformationTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyInformationTest.java
[UTF-8] Thu Nov 20 04:16:11 2014
@@ -18,8 +18,8 @@ package org.apache.sis.metadata;
 
 import java.util.Locale;
 import org.opengis.util.InternationalString;
+import org.opengis.annotation.Obligation;
 import org.opengis.metadata.Datatype;
-import org.opengis.metadata.Obligation;
 import org.opengis.metadata.Identifier;
 import org.opengis.metadata.citation.Citation;
 import org.opengis.metadata.citation.PresentationForm;

Modified: sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java?rev=1640667&r1=1640666&r2=1640667&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java
[UTF-8] Thu Nov 20 04:16:11 2014
@@ -60,6 +60,7 @@ public final strictfp class AllMetadataT
     @SuppressWarnings("deprecation")
     public AllMetadataTest() {
         super(MetadataStandard.ISO_19115,
+            org.opengis.annotation.Obligation.class,
             org.opengis.metadata.ApplicationSchemaInformation.class,
             org.opengis.metadata.Datatype.class,
             org.opengis.metadata.ExtendedElementInformation.class,
@@ -68,7 +69,6 @@ public final strictfp class AllMetadataT
             org.opengis.metadata.Metadata.class,
             org.opengis.metadata.MetadataExtensionInformation.class,
             org.opengis.metadata.MetadataScope.class,
-//          org.opengis.metadata.Obligation.class, // Excluded CodeList because it doesn't
use the usual kind of adapter.
             org.opengis.metadata.PortrayalCatalogueReference.class,
             org.opengis.metadata.acquisition.AcquisitionInformation.class,
             org.opengis.metadata.acquisition.Context.class,



Mime
View raw message