sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1822977 - in /sis/branches/ISO-19115-3/core/sis-metadata/src: main/java/org/apache/sis/internal/jaxb/code/ main/java/org/apache/sis/metadata/iso/acquisition/ main/java/org/apache/sis/metadata/iso/citation/ main/java/org/apache/sis/metadata...
Date Fri, 02 Feb 2018 15:53:53 GMT
Author: desruisseaux
Date: Fri Feb  2 15:53:52 2018
New Revision: 1822977

URL: http://svn.apache.org/viewvc?rev=1822977&view=rev
Log:
Fix 'required' flag in JAXB annotations.

Modified:
    sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/PT_Locale.java
    sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/acquisition/DefaultOperation.java
    sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultCitation.java
    sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultFeatureCatalogueDescription.java
    sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultVerticalExtent.java
    sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultOperationMetadata.java
    sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultUsage.java
    sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/DefaultNominalResolution.java
    sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultMaintenanceInformation.java
    sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/AbstractElement.java
    sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultConformanceResult.java
    sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultCoverageResult.java
    sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultDataQuality.java
    sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultQuantitativeResult.java
    sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/DefaultGeoreferenceable.java
    sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/DefaultGridSpatialRepresentation.java
    sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/test/xml/PackageVerifier.java
    sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/test/xml/SchemaCompliance.java

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/PT_Locale.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/PT_Locale.java?rev=1822977&r1=1822976&r2=1822977&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/PT_Locale.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/PT_Locale.java
[UTF-8] Fri Feb  2 15:53:52 2018
@@ -155,7 +155,7 @@ public final class PT_Locale extends Xml
         /**
          * Gets the language code for this PT_Locale. Used in ISO 19115-3.
          */
-        @XmlElement(name = "language")
+        @XmlElement(name = "language", required = true)
         private LanguageCode getLanguage() {
             return isLegacyMetadata ? null : languageCode;
         }

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/acquisition/DefaultOperation.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/acquisition/DefaultOperation.java?rev=1822977&r1=1822976&r2=1822977&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/acquisition/DefaultOperation.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/acquisition/DefaultOperation.java
[UTF-8] Fri Feb  2 15:53:52 2018
@@ -237,7 +237,7 @@ public class DefaultOperation extends IS
      * @return unique identification of the operation, or {@code null}.
      */
     @Override
-    @XmlElement(name = "identifier", required = true)
+    @XmlElement(name = "identifier")
     public Identifier getIdentifier() {
         return NonMarshalledAuthority.getMarshallable(identifiers);
     }
@@ -341,7 +341,7 @@ public class DefaultOperation extends IS
      * @return heritage of the operation, or {@code null}.
      */
     @Override
-    @XmlElement(name = "parentOperation", required = true)
+    @XmlElement(name = "parentOperation")
     public Operation getParentOperation() {
         return parentOperation;
     }

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultCitation.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultCitation.java?rev=1822977&r1=1822976&r2=1822977&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultCitation.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultCitation.java
[UTF-8] Fri Feb  2 15:53:52 2018
@@ -297,7 +297,7 @@ public class DefaultCitation extends ISO
      * @return the reference date.
      */
     @Override
-    @XmlElement(name = "date", required = true)
+    @XmlElement(name = "date")
     public Collection<CitationDate> getDates() {
         return dates = nonNullCollection(dates, CitationDate.class);
     }

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultFeatureCatalogueDescription.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultFeatureCatalogueDescription.java?rev=1822977&r1=1822976&r2=1822977&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultFeatureCatalogueDescription.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultFeatureCatalogueDescription.java
[UTF-8] Fri Feb  2 15:53:52 2018
@@ -206,7 +206,7 @@ public class DefaultFeatureCatalogueDesc
      * @return whether or not the feature catalogue is included with the resource.
      */
     @Override
-    @XmlElement(name = "includedWithDataset", required = true)
+    @XmlElement(name = "includedWithDataset")
     public boolean isIncludedWithDataset() {
         return includedWithDataset;
     }
@@ -299,7 +299,7 @@ public class DefaultFeatureCatalogueDesc
      * @return bibliographic reference to one or more external feature catalogues.
      */
     @Override
-    @XmlElement(name = "featureCatalogueCitation", required = true)
+    @XmlElement(name = "featureCatalogueCitation")
     public Collection<Citation> getFeatureCatalogueCitations() {
         return featureCatalogueCitations = nonNullCollection(featureCatalogueCitations, Citation.class);
     }

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultVerticalExtent.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultVerticalExtent.java?rev=1822977&r1=1822976&r2=1822977&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultVerticalExtent.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/extent/DefaultVerticalExtent.java
[UTF-8] Fri Feb  2 15:53:52 2018
@@ -214,7 +214,7 @@ public class DefaultVerticalExtent exten
      * @return the vertical CRS, or {@code null}.
      */
     @Override
-    @XmlElement(name = "verticalCRS", required = true)
+    @XmlElement(name = "verticalCRS")
     public VerticalCRS getVerticalCRS() {
         return verticalCRS;
     }

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultOperationMetadata.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultOperationMetadata.java?rev=1822977&r1=1822976&r2=1822977&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultOperationMetadata.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultOperationMetadata.java
[UTF-8] Fri Feb  2 15:53:52 2018
@@ -349,7 +349,7 @@ public class DefaultOperationMetadata ex
      * This attribute has been added by ISO 19115:2014 standard.
      * If (and only if) marshalling an older standard version, we omit this attribute.
      */
-    @XmlElement(name = "distributedComputingPlatform")
+    @XmlElement(name = "distributedComputingPlatform", required = true)
     private Collection<DistributedComputingPlatform> getDistributedComputingPlatform()
{
         return FilterByVersion.CURRENT_METADATA.accept() ? getDistributedComputingPlatforms()
: null;
     }

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultUsage.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultUsage.java?rev=1822977&r1=1822976&r2=1822977&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultUsage.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultUsage.java
[UTF-8] Fri Feb  2 15:53:52 2018
@@ -256,7 +256,7 @@ public class DefaultUsage extends ISOMet
      * @return means of communicating with person(s) and organization(s) using the resource(s).
      */
     @Override
-    @XmlElement(name = "userContactInfo", required = true)
+    @XmlElement(name = "userContactInfo")
     public Collection<Responsibility> getUserContactInfo() {
         return userContactInfo = nonNullCollection(userContactInfo, Responsibility.class);
     }

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/DefaultNominalResolution.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/DefaultNominalResolution.java?rev=1822977&r1=1822976&r2=1822977&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/DefaultNominalResolution.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/DefaultNominalResolution.java
[UTF-8] Fri Feb  2 15:53:52 2018
@@ -136,7 +136,7 @@ public class DefaultNominalResolution ex
      */
     @Override
     @ValueRange(minimum=0, isMinIncluded=false)
-    @XmlElement(name = "scanningResolution", required = true)
+    @XmlElement(name = "scanningResolution")
     public Double getScanningResolution() {
         return scanningResolution;
     }
@@ -163,7 +163,7 @@ public class DefaultNominalResolution ex
      */
     @Override
     @ValueRange(minimum=0, isMinIncluded=false)
-    @XmlElement(name = "groundResolution", required = true)
+    @XmlElement(name = "groundResolution")
     public Double getGroundResolution() {
         return groundResolution;
     }

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultMaintenanceInformation.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultMaintenanceInformation.java?rev=1822977&r1=1822976&r2=1822977&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultMaintenanceInformation.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultMaintenanceInformation.java
[UTF-8] Fri Feb  2 15:53:52 2018
@@ -187,7 +187,7 @@ public class DefaultMaintenanceInformati
      * @return frequency with which changes and additions are made to the resource, or {@code
null}.
      */
     @Override
-    @XmlElement(name = "maintenanceAndUpdateFrequency", required = true)
+    @XmlElement(name = "maintenanceAndUpdateFrequency")
     public MaintenanceFrequency getMaintenanceAndUpdateFrequency() {
         return maintenanceAndUpdateFrequency;
     }
@@ -506,7 +506,7 @@ public class DefaultMaintenanceInformati
      * This attribute has been added by ISO 19115:2014 standard.
      * If (and only if) marshalling an older standard version, we omit this attribute.
      */
-    @XmlElement(name = "maintenanceDate", required = true)
+    @XmlElement(name = "maintenanceDate")
     private Collection<CitationDate> getMaintenanceDate() {
         return FilterByVersion.CURRENT_METADATA.accept() ? getMaintenanceDates() : null;
     }

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/AbstractElement.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/AbstractElement.java?rev=1822977&r1=1822976&r2=1822977&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/AbstractElement.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/AbstractElement.java
[UTF-8] Fri Feb  2 15:53:52 2018
@@ -43,6 +43,7 @@ import org.apache.sis.internal.jaxb.Filt
 import org.apache.sis.internal.jaxb.LegacyNamespaces;
 import org.apache.sis.util.collection.CheckedContainer;
 import org.apache.sis.util.resources.Errors;
+import org.apache.sis.xml.Namespaces;
 
 import static org.apache.sis.util.collection.Containers.isNullOrEmpty;
 
@@ -534,7 +535,7 @@ public class AbstractElement extends ISO
      * @return date or range of dates on which a data quality measure was applied.
      */
     @Override
-    @XmlElement(name = "dateTime")
+    @XmlElement(name = "dateTime", namespace = Namespaces.DQC)
     @SuppressWarnings("ReturnOfCollectionOrArrayField")
     public Collection<Date> getDates() {
         if (Semaphores.query(Semaphores.NULL_COLLECTION)) {

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultConformanceResult.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultConformanceResult.java?rev=1822977&r1=1822976&r2=1822977&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultConformanceResult.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultConformanceResult.java
[UTF-8] Fri Feb  2 15:53:52 2018
@@ -177,7 +177,7 @@ public class DefaultConformanceResult ex
      * @return explanation of the meaning of conformance, or {@code null}.
      */
     @Override
-    @XmlElement(name = "explanation", required = true)
+    @XmlElement(name = "explanation")
     public InternationalString getExplanation() {
         return explanation;
     }

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultCoverageResult.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultCoverageResult.java?rev=1822977&r1=1822976&r2=1822977&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultCoverageResult.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultCoverageResult.java
[UTF-8] Fri Feb  2 15:53:52 2018
@@ -25,7 +25,6 @@ import org.opengis.metadata.quality.Cove
 import org.opengis.metadata.distribution.DataFile;
 import org.opengis.metadata.spatial.SpatialRepresentation;
 import org.opengis.metadata.spatial.SpatialRepresentationType;
-import org.apache.sis.xml.Namespaces;
 
 
 /**
@@ -243,7 +242,7 @@ public class DefaultCoverageResult exten
      * @return data file containing the result coverage data, or {@code null}.
      */
     @Override
-    @XmlElement(name = "resultFile", namespace = Namespaces.GCX, required = true)
+    @XmlElement(name = "resultFile", required = true)
     public DataFile getResultFile() {
         return resultFile;
     }

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultDataQuality.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultDataQuality.java?rev=1822977&r1=1822976&r2=1822977&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultDataQuality.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultDataQuality.java
[UTF-8] Fri Feb  2 15:53:52 2018
@@ -189,7 +189,7 @@ public class DefaultDataQuality extends
      * @return quantitative quality information for the data.
      */
     @Override
-    @XmlElement(name = "report")
+    @XmlElement(name = "report", required = true)
     public Collection<Element> getReports() {
         return reports = nonNullCollection(reports, Element.class);
     }

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultQuantitativeResult.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultQuantitativeResult.java?rev=1822977&r1=1822976&r2=1822977&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultQuantitativeResult.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultQuantitativeResult.java
[UTF-8] Fri Feb  2 15:53:52 2018
@@ -204,7 +204,7 @@ public class DefaultQuantitativeResult e
      * @return value unit for reporting a data quality result, or {@code null}.
      */
     @Override
-    @XmlElement(name = "valueUnit", required = true)
+    @XmlElement(name = "valueUnit")
     public Unit<?> getValueUnit()  {
         return valueUnit;
     }

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/DefaultGeoreferenceable.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/DefaultGeoreferenceable.java?rev=1822977&r1=1822976&r2=1822977&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/DefaultGeoreferenceable.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/DefaultGeoreferenceable.java
[UTF-8] Fri Feb  2 15:53:52 2018
@@ -26,7 +26,6 @@ import org.opengis.util.InternationalStr
 import org.opengis.metadata.citation.Citation;
 import org.opengis.metadata.spatial.Georeferenceable;
 import org.opengis.metadata.spatial.GeolocationInformation;
-import org.apache.sis.xml.Namespaces;
 
 
 /**
@@ -290,7 +289,7 @@ public class DefaultGeoreferenceable ext
      * @return a geolocalisation of the data.
      */
     @Override
-    @XmlElement(name = "geolocationInformation", namespace = Namespaces.GMI, required = true)
+    @XmlElement(name = "geolocationInformation", required = true)
     public Collection<GeolocationInformation> getGeolocationInformation() {
         return geolocationInformation = nonNullCollection(geolocationInformation, GeolocationInformation.class);
     }

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/DefaultGridSpatialRepresentation.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/DefaultGridSpatialRepresentation.java?rev=1822977&r1=1822976&r2=1822977&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/DefaultGridSpatialRepresentation.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/DefaultGridSpatialRepresentation.java
[UTF-8] Fri Feb  2 15:53:52 2018
@@ -216,7 +216,7 @@ public class DefaultGridSpatialRepresent
      * @return information about spatial-temporal axis properties.
      */
     @Override
-    @XmlElement(name = "axisDimensionProperties", required = true)
+    @XmlElement(name = "axisDimensionProperties")
     public List<Dimension> getAxisDimensionProperties() {
         return axisDimensionProperties = nonNullList(axisDimensionProperties, Dimension.class);
     }

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/test/xml/PackageVerifier.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/test/xml/PackageVerifier.java?rev=1822977&r1=1822976&r2=1822977&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/test/xml/PackageVerifier.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/test/xml/PackageVerifier.java
[UTF-8] Fri Feb  2 15:53:52 2018
@@ -47,7 +47,7 @@ final strictfp class PackageVerifier {
     /**
      * Classes or properties having a JAXB annotation in this namespace should be deprecated.
      */
-    private static final Set<String> DEPRECATED_NAMESPACES = Collections.unmodifiableSet(new
HashSet<>(
+    private static final Set<String> LEGACY_NAMESPACES = Collections.unmodifiableSet(new
HashSet<>(
             Arrays.asList(LegacyNamespaces.GMD, LegacyNamespaces.GMI, LegacyNamespaces.SRV)));
 
     /**
@@ -168,42 +168,61 @@ final strictfp class PackageVerifier {
         /*
          * Properties in the legacy GMD or GMI namespaces may be deprecated, depending if
a replacement
          * is already available or not. However properties in other namespaces should not
be deprecated.
-         * Some validations will be disabled for deprecated properties.
+         * Validation of deprecated properties is skipped because we didn't loaded their
schema.
          */
-        boolean isDeprecated = DEPRECATED_NAMESPACES.contains(namespace);
-        if (!isDeprecated && type.isAnnotationPresent(Deprecated.class)) {
+        if (LEGACY_NAMESPACES.contains(namespace)) {
+            return;
+        }
+        if (type.isAnnotationPresent(Deprecated.class)) {
             throw new SchemaException("Unexpected deprecation status of " + type);
         }
+        /*
+         * Verify that class name exists, then verify its namespace (associated to the null
key by convention).
+         */
         final Map<String, SchemaCompliance.Info> properties = schemas.typeDefinition(className);
         if (properties == null) {
-            if (!isDeprecated) {
-                throw new SchemaException("Unknown name declared in @XmlRootElement of "
+ type);
+            throw new SchemaException("Unknown name declared in @XmlRootElement of " + type);
+        }
+        final String expectedNS = properties.get(null).namespace;
+        if (!namespace.equals(expectedNS)) {
+            throw new SchemaException(className + " shall be associated to namespace " +
expectedNS);
+        }
+        for (final Method method : type.getDeclaredMethods()) {
+            final XmlElement element = method.getDeclaredAnnotation(XmlElement.class);
+            if (element == null) {
+                continue;                               // No @XmlElement annotation - skip
this property.
+            }
+            final String name = element.name();
+            String ns = element.namespace();
+            if (ns.equals(AnnotationConsistencyCheck.DEFAULT)) {
+                ns = namespace;
             }
-        } else {
             /*
-             * Verify the class namespace (associated to the null key by convention),
-             * then verify @XmlElement annotation on each property.
+             * We do not verify fully the properties in legacy namespaces because we didn't
loaded their schemas.
+             * However we verify at least that those properties are not declared as required.
              */
-            final String expectedNS = properties.get(null).namespace;
-            if (!namespace.equals(expectedNS)) {
-                throw new SchemaException(className + " shall be associated to namespace
" + expectedNS);
-            }
-            for (final Method method : type.getDeclaredMethods()) {
-                final XmlElement element = method.getDeclaredAnnotation(XmlElement.class);
-                if (element != null) {
-                    final String name = element.name();
-                    final String ns = element.namespace();
-                    isDeprecated = DEPRECATED_NAMESPACES.contains(ns);
-                    if (!isDeprecated && method.isAnnotationPresent(Deprecated.class))
{
-                        throw new SchemaException("Unexpected deprecation status of " + className
+ '.' + name);
-                    }
-                    final SchemaCompliance.Info info = properties.get(name);
-                    if (info == null) {
-                        if (!isDeprecated) {
-                            throw new SchemaException("Unexpected XML element " + className
+ '.' + name);
-                        }
-                    }
+            if (LEGACY_NAMESPACES.contains(ns)) {
+                if (element.required()) {
+                    throw new SchemaException("Legacy property " + className + '.' + name
+ " should not be required.");
                 }
+                continue;                               // Property in a legacy namespace
- skip it.
+            }
+            /*
+             * Property in non-legacy namespaces should not be deprecated. Verify also their
namespace.
+             */
+            if (method.isAnnotationPresent(Deprecated.class)) {
+                throw new SchemaException("Unexpected deprecation status of " + className
+ '.' + name);
+            }
+            final SchemaCompliance.Info info = properties.get(name);
+            if (info == null) {
+                throw new SchemaException("Unexpected XML element " + className + '.' + name);
+            }
+            if (info.namespace != null && !ns.equals(info.namespace)) {
+                throw new SchemaException(className + '.' + name + " is associated to namespace
" + ns
+                        + " while " + info.namespace + " was expected.");
+            }
+            if (element.required() != info.isRequired) {
+                throw new SchemaException("Wrong requirement flag for " + className + '.'
+ name);
             }
         }
     }

Modified: sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/test/xml/SchemaCompliance.java
URL: http://svn.apache.org/viewvc/sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/test/xml/SchemaCompliance.java?rev=1822977&r1=1822976&r2=1822977&view=diff
==============================================================================
--- sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/test/xml/SchemaCompliance.java
[UTF-8] (original)
+++ sis/branches/ISO-19115-3/core/sis-metadata/src/test/java/org/apache/sis/test/xml/SchemaCompliance.java
[UTF-8] Fri Feb  2 15:53:52 2018
@@ -83,6 +83,7 @@ public final strictfp class SchemaCompli
         m.put("MI_Band_Type",                 "MD_Band_Type");
         m.put("MI_CoverageDescription_Type",  "MD_CoverageDescription_Type");
         m.put("MI_Georectified_Type",         "MD_Georectified_Type");
+        m.put("MI_Georeferenceable_Type",     "MD_Georeferenceable_Type");
         m.put("LE_ProcessStep_Type",          "LI_ProcessStep_Type");
         m.put("AbstractMX_File_Type",         "MX_DataFile_Type");
         m.put("Abstract_DataQuality_Type",    "DQ_DataQuality_Type");
@@ -208,6 +209,13 @@ public final strictfp class SchemaCompli
     private String currentPropertyType;
 
     /**
+     * Default value for the {@code required} attribute of {@link XmlElement}. This default
value should
+     * be {@code true} for properties declared inside a {@code <sequence>} element,
and {@code false} for
+     * properties declared inside a {@code <choice>} element.
+     */
+    private boolean requiredByDefault;
+
+    /**
      * Namespace of the type or properties being defined.
      * This is specified by {@code <xs:schema targetNamespace="(…)">}.
      */
@@ -377,6 +385,7 @@ public final strictfp class SchemaCompli
                          * one class for representing those two distincts ISO types. Note
that not all ISO 19115-2
                          * types extend an ISO 19115-1 type, so we need to apply a case-by-case
approach.
                          */
+                        requiredByDefault = true;
                         name = TYPES_TO_MERGE.getOrDefault(name, name);
                         preparePropertyDefinitions(name);
                         storePropertyDefinition(node);
@@ -402,29 +411,39 @@ public final strictfp class SchemaCompli
      */
     private void storePropertyDefinition(final Node node) throws SchemaException {
         if (XMLConstants.W3C_XML_SCHEMA_NS_URI.equals(node.getNamespaceURI())) {
-            if ("element".equals(node.getNodeName())) {
-                boolean isRequired   = false;
-                boolean isCollection = false;
-                final NamedNodeMap attributes = node.getAttributes();
-                if (attributes != null) {
-                    Node attr = attributes.getNamedItem("minOccurs");
-                    if (attr != null) {
-                        final String value = attr.getNodeValue();
-                        if (value != null) {
-                            isRequired = Integer.parseInt(getMandatoryAttribute(node, "minOccurs"))
> 0;
+            switch (node.getNodeName()) {
+                case "sequence": {
+                    requiredByDefault = true;
+                    break;
+                }
+                case "choice": {
+                    requiredByDefault = false;
+                    break;
+                }
+                case "element": {
+                    boolean isRequired = requiredByDefault;
+                    boolean isCollection = false;
+                    final NamedNodeMap attributes = node.getAttributes();
+                    if (attributes != null) {
+                        Node attr = attributes.getNamedItem("minOccurs");
+                        if (attr != null) {
+                            final String value = attr.getNodeValue();
+                            if (value != null) {
+                                isRequired = Integer.parseInt(value) > 0;
+                            }
                         }
-                    }
-                    attr = attributes.getNamedItem("maxOccurs");
-                    if (attr != null) {
-                        final String value = attr.getNodeValue();
-                        if (value != null) {
-                            isCollection = value.equals("unbounded") || Integer.parseInt(value)
>  1;
+                        attr = attributes.getNamedItem("maxOccurs");
+                        if (attr != null) {
+                            final String value = attr.getNodeValue();
+                            if (value != null) {
+                                isCollection = value.equals("unbounded") || Integer.parseInt(value)
>  1;
+                            }
                         }
                     }
+                    addProperty(getMandatoryAttribute(node, "name").intern(),
+                           trim(getMandatoryAttribute(node, "type"), PROPERTY_TYPE_SUFFIX).intern(),
isRequired, isCollection);
+                    return;
                 }
-                addProperty(getMandatoryAttribute(node, "name").intern(),
-                       trim(getMandatoryAttribute(node, "type"), PROPERTY_TYPE_SUFFIX).intern(),
isRequired, isCollection);
-                return;
             }
         }
         for (Node child = node.getFirstChild(); child != null; child = child.getNextSibling())
{



Mime
View raw message