You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2022/11/17 15:15:11 UTC
[sis] 01/01: Merge branch 'geoapi-3.1' This is the upgrade of metadata quality package from ISO 19115 to ISO 19157.
This is an automated email from the ASF dual-hosted git repository.
desruisseaux pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sis.git
commit 0e32b83323d2d1ad1a065d4521096b06c86a6db8
Merge: cdb3752112 86bb5bbf6b
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Thu Nov 17 16:14:08 2022 +0100
Merge branch 'geoapi-3.1'
This is the upgrade of metadata quality package from ISO 19115 to ISO 19157.
https://issues.apache.org/jira/browse/SIS-394
.../org/apache/sis/feature/AbstractAttribute.java | 3 +-
.../apache/sis/feature/DefaultAttributeType.java | 3 +-
.../main/java/org/apache/sis/feature/Features.java | 6 +-
.../apache/sis/internal/jaxb/FilterByVersion.java | 4 +-
.../apache/sis/internal/jaxb/cat/CodeListUID.java | 10 +-
.../sis/internal/jaxb/code/package-info.java | 3 +-
.../apache/sis/internal/jaxb/gco/GO_DateTime.java | 26 +-
.../apache/sis/internal/jaxb/gco/package-info.java | 2 +-
.../internal/jaxb/metadata/DQM_BasicMeasure.java | 91 ++++
.../internal/jaxb/metadata/DQM_Description.java | 91 ++++
.../sis/internal/jaxb/metadata/DQM_Measure.java | 91 ++++
.../sis/internal/jaxb/metadata/DQM_Parameter.java | 93 ++++
.../jaxb/metadata/DQM_SourceReference.java | 91 ++++
.../jaxb/metadata/DQ_EvaluationMethod.java | 96 ++++
.../jaxb/metadata/DQ_MeasureReference.java | 96 ++++
.../DQ_StandaloneQualityReportInformation.java | 98 ++++
.../sis/internal/jaxb/metadata/package-info.java | 3 +-
.../internal/jaxb/metadata/replace/Parameter.java | 178 +++++++
.../jaxb/metadata/replace/QualityParameter.java | 217 ++++++++
.../jaxb/metadata/replace/ServiceParameter.java | 243 ++++-----
.../jaxb/metadata/replace/package-info.java | 19 +-
.../sis/internal/metadata/ReferencingServices.java | 18 +-
.../org/apache/sis/metadata/MetadataStandard.java | 64 ++-
.../org/apache/sis/metadata/PropertyAccessor.java | 4 +-
.../java/org/apache/sis/metadata/SpecialCases.java | 19 +-
.../sis/metadata/StandardImplementation.java | 6 +-
.../sis/metadata/iso/acquisition/package-info.java | 2 +-
.../sis/metadata/iso/citation/package-info.java | 2 +-
.../sis/metadata/iso/constraint/package-info.java | 2 +-
.../sis/metadata/iso/content/package-info.java | 2 +-
.../metadata/iso/distribution/package-info.java | 2 +-
.../sis/metadata/iso/extent/package-info.java | 2 +-
.../metadata/iso/identification/package-info.java | 2 +-
.../sis/metadata/iso/lineage/package-info.java | 2 +-
.../sis/metadata/iso/maintenance/package-info.java | 2 +-
.../org/apache/sis/metadata/iso/package-info.java | 2 +-
.../metadata/iso/quality/AbstractCompleteness.java | 2 +-
.../iso/quality/AbstractDataEvaluation.java | 71 +++
.../sis/metadata/iso/quality/AbstractElement.java | 570 +++++++++++----------
.../iso/quality/AbstractLogicalConsistency.java | 2 +-
.../metadata/iso/quality/AbstractMetaquality.java | 77 +++
.../iso/quality/AbstractPositionalAccuracy.java | 12 +-
.../sis/metadata/iso/quality/AbstractResult.java | 102 +++-
.../iso/quality/AbstractTemporalAccuracy.java | 42 +-
...lAccuracy.java => AbstractTemporalQuality.java} | 46 +-
.../iso/quality/AbstractThematicAccuracy.java | 13 +-
.../DefaultAbsoluteExternalPositionalAccuracy.java | 5 +-
.../quality/DefaultAccuracyOfATimeMeasurement.java | 10 +-
.../iso/quality/DefaultAggregationDerivation.java | 65 +++
.../metadata/iso/quality/DefaultBasicMeasure.java | 191 +++++++
.../iso/quality/DefaultCompletenessCommission.java | 3 +-
.../iso/quality/DefaultCompletenessOmission.java | 3 +-
.../iso/quality/DefaultConceptualConsistency.java | 7 +-
.../metadata/iso/quality/DefaultConfidence.java | 69 +++
.../iso/quality/DefaultConformanceResult.java | 7 +-
.../iso/quality/DefaultCoverageResult.java | 68 ++-
.../metadata/iso/quality/DefaultDataQuality.java | 78 ++-
.../metadata/iso/quality/DefaultDescription.java | 142 +++++
.../iso/quality/DefaultDescriptiveResult.java | 112 ++++
.../iso/quality/DefaultDomainConsistency.java | 3 +-
...ctElement.java => DefaultEvaluationMethod.java} | 320 +++---------
.../iso/quality/DefaultFormatConsistency.java | 5 +-
.../iso/quality/DefaultFullInspection.java | 65 +++
.../DefaultGriddedDataPositionalAccuracy.java | 3 +-
.../metadata/iso/quality/DefaultHomogeneity.java | 69 +++
.../iso/quality/DefaultIndirectEvaluation.java | 112 ++++
.../sis/metadata/iso/quality/DefaultMeasure.java | 397 ++++++++++++++
.../iso/quality/DefaultMeasureReference.java | 169 ++++++
.../DefaultNonQuantitativeAttributeAccuracy.java | 22 +-
...efaultNonQuantitativeAttributeCorrectness.java} | 47 +-
.../DefaultQuantitativeAttributeAccuracy.java | 3 +-
.../iso/quality/DefaultQuantitativeResult.java | 31 +-
.../DefaultRelativeInternalPositionalAccuracy.java | 3 +-
.../iso/quality/DefaultRepresentativity.java | 69 +++
.../iso/quality/DefaultSampleBasedInspection.java | 160 ++++++
.../iso/quality/DefaultSourceReference.java | 101 ++++
.../DefaultStandaloneQualityReportInformation.java | 132 +++++
.../iso/quality/DefaultTemporalConsistency.java | 8 +-
.../iso/quality/DefaultTemporalValidity.java | 8 +-
.../DefaultThematicClassificationCorrectness.java | 3 +-
.../iso/quality/DefaultTopologicalConsistency.java | 9 +-
.../sis/metadata/iso/quality/DefaultUsability.java | 19 +-
...Usability.java => DefaultUsabilityElement.java} | 55 +-
.../sis/metadata/iso/quality/ISOMetadata.java | 60 +++
.../sis/metadata/iso/quality/package-info.java | 94 +---
.../sis/metadata/iso/spatial/package-info.java | 2 +-
.../java/org/apache/sis/metadata/package-info.java | 2 +-
.../apache/sis/util/iso/DefaultNameFactory.java | 80 ++-
.../org/apache/sis/util/iso/DefaultTypeName.java | 231 +++++----
.../main/java/org/apache/sis/util/iso/Names.java | 95 +++-
.../java/org/apache/sis/util/iso/TypeNames.java | 41 +-
.../main/java/org/apache/sis/xml/Namespaces.java | 80 +--
.../src/main/java/org/apache/sis/xml/readme.html | 16 +-
.../org/apache/sis/xml/RenameOnImport.lst | 14 +-
.../internal/jaxb/cat/CodeListMarshallingTest.java | 2 +-
.../metadata/replace/QualityParameterTest.java | 107 ++++
.../metadata/replace/ServiceParameterTest.java | 14 +-
.../sis/metadata/PropertyConsistencyCheck.java | 5 +-
.../apache/sis/metadata/iso/AllMetadataTest.java | 35 +-
.../DefaultServiceIdentificationTest.java | 7 +-
.../quality/AbstractPositionalAccuracyTest.java | 13 +-
.../iso/quality/DefaultDomainConsistencyTest.java | 47 ++
.../iso/quality/DefaultQuantitativeResultTest.java | 50 ++
.../apache/sis/test/suite/MetadataTestSuite.java | 3 +
.../sis/test/xml/AnnotationConsistencyCheck.java | 38 +-
.../java/org/apache/sis/util/iso/NamesTest.java | 35 +-
.../org/apache/sis/util/iso/TypeNamesTest.java | 10 +-
.../sis/metadata/xml/2007/PositionalAccuracy.xml | 11 +-
.../apache/sis/metadata/xml/2007/ProcessStep.xml | 2 +-
.../metadata/xml/2007/ServiceIdentification.xml | 2 +-
.../org/apache/sis/metadata/xml/2016/Citation.xml | 4 +-
.../org/apache/sis/metadata/xml/2016/Extent.xml | 2 +-
.../org/apache/sis/metadata/xml/2016/Locales.xml | 2 +-
.../org/apache/sis/metadata/xml/2016/Metadata.xml | 20 +-
.../apache/sis/metadata/xml/2016/Multiplicity.xml | 2 +-
.../sis/metadata/xml/2016/PositionalAccuracy.xml | 33 +-
.../apache/sis/metadata/xml/2016/ProcessStep.xml | 2 +-
.../metadata/xml/2016/ServiceIdentification.xml | 6 +-
.../internal/referencing/ServicesForMetadata.java | 17 +-
.../sis/parameter/DefaultParameterDescriptor.java | 36 +-
.../parameter/DefaultParameterDescriptorTest.java | 50 +-
.../org/apache/sis/parameter/ParametersTest.java | 6 +-
.../apache/sis/internal/system/DataDirectory.java | 2 +-
.../org/apache/sis/internal/util/Constants.java | 7 +-
.../src/main/java/org/apache/sis/util/Classes.java | 190 +++++--
.../src/main/java/org/apache/sis/util/Numbers.java | 9 +-
.../org/apache/sis/util/UnknownNameException.java | 7 +-
.../test/java/org/apache/sis/util/ClassesTest.java | 86 +++-
pom.xml | 2 +-
129 files changed, 5177 insertions(+), 1507 deletions(-)
diff --cc core/sis-feature/src/main/java/org/apache/sis/feature/Features.java
index 59c7dc74cb,86e00cb23d..c12479051f
--- a/core/sis-feature/src/main/java/org/apache/sis/feature/Features.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/feature/Features.java
@@@ -20,17 -20,28 +20,16 @@@ import java.util.Map
import java.util.Optional;
import java.util.IdentityHashMap;
import org.opengis.util.GenericName;
- import org.opengis.util.NameFactory;
import org.opengis.util.InternationalString;
-import org.opengis.metadata.maintenance.ScopeCode;
import org.opengis.metadata.quality.ConformanceResult;
import org.opengis.metadata.quality.DataQuality;
import org.opengis.metadata.quality.Element;
import org.opengis.metadata.quality.Result;
import org.apache.sis.util.Static;
+ import org.apache.sis.util.iso.Names;
import org.apache.sis.util.iso.DefaultNameFactory;
- import org.apache.sis.internal.system.DefaultFactories;
import org.apache.sis.internal.feature.Resources;
-// Branch-dependent imports
-import org.opengis.feature.Attribute;
-import org.opengis.feature.AttributeType;
-import org.opengis.feature.Feature;
-import org.opengis.feature.FeatureType;
-import org.opengis.feature.FeatureAssociationRole;
-import org.opengis.feature.IdentifiedType;
-import org.opengis.feature.InvalidPropertyValueException;
-import org.opengis.feature.Operation;
-import org.opengis.feature.PropertyType;
-
/**
* Static methods working on features or attributes.
@@@ -198,15 -238,14 +197,14 @@@ public final class Features extends Sta
*
* @since 0.8
*/
- public static GenericName getValueTypeName(final PropertyType property) {
- if (property instanceof FeatureAssociationRole) {
+ public static GenericName getValueTypeName(final AbstractIdentifiedType property) {
+ if (property instanceof DefaultAssociationRole) {
// Tested first because this is the main interest for this method.
- return DefaultAssociationRole.getValueTypeName((FeatureAssociationRole) property);
- } else if (property instanceof AttributeType<?>) {
- return Names.createTypeName(((AttributeType<?>) property).getValueClass());
- } else if (property instanceof Operation) {
- final IdentifiedType result = ((Operation) property).getResult();
+ return DefaultAssociationRole.getValueTypeName((DefaultAssociationRole) property);
+ } else if (property instanceof DefaultAttributeType<?>) {
- final DefaultNameFactory factory = DefaultFactories.forBuildin(NameFactory.class, DefaultNameFactory.class);
- return factory.toTypeName(((DefaultAttributeType<?>) property).getValueClass());
++ return Names.createTypeName(((DefaultAttributeType<?>) property).getValueClass());
+ } else if (property instanceof AbstractOperation) {
+ final AbstractIdentifiedType result = ((AbstractOperation) property).getResult();
if (result != null) {
return result.getName();
}
diff --cc core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/DQM_BasicMeasure.java
index 0000000000,c4b045f3a8..891d2bf1af
mode 000000,100644..100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/DQM_BasicMeasure.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/DQM_BasicMeasure.java
@@@ -1,0 -1,92 +1,91 @@@
+ /*
+ * 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.internal.jaxb.metadata;
+
+ import javax.xml.bind.annotation.XmlElementRef;
-import org.opengis.metadata.quality.BasicMeasure;
+ import org.apache.sis.metadata.iso.quality.DefaultBasicMeasure;
+ import org.apache.sis.internal.jaxb.gco.PropertyType;
+
+
+ /**
+ * JAXB adapter mapping implementing class to the GeoAPI interface. See
+ * package documentation for more information about JAXB and interface.
+ *
+ * @author Martin Desruisseaux (Geomatys)
+ * @version 1.3
+ * @since 1.3
+ * @module
+ */
-public final class DQM_BasicMeasure extends PropertyType<DQM_BasicMeasure, BasicMeasure> {
++public final class DQM_BasicMeasure extends PropertyType<DQM_BasicMeasure, DefaultBasicMeasure> {
+ /**
+ * Empty constructor for JAXB only.
+ */
+ public DQM_BasicMeasure() {
+ }
+
+ /**
+ * Returns the GeoAPI interface which is bound by this adapter.
+ * This method is indirectly invoked by the private constructor
+ * below, so it shall not depend on the state of this object.
+ *
- * @return {@code BasicMeasure.class}
++ * @return {@code DefaultBasicMeasure.class}
+ */
+ @Override
- protected Class<BasicMeasure> getBoundType() {
- return BasicMeasure.class;
++ protected Class<DefaultBasicMeasure> getBoundType() {
++ return DefaultBasicMeasure.class;
+ }
+
+ /**
+ * Constructor for the {@link #wrap} method only.
+ */
- private DQM_BasicMeasure(final BasicMeasure metadata) {
++ private DQM_BasicMeasure(final DefaultBasicMeasure metadata) {
+ super(metadata);
+ }
+
+ /**
+ * Invoked by {@link PropertyType} at marshalling time for wrapping the given metadata value
+ * in a {@code <dqm:DQ_BasicMeasure>} XML element.
+ *
+ * @param metadata the metadata element to marshal.
+ * @return a {@code PropertyType} wrapping the given the metadata element.
+ */
+ @Override
- protected DQM_BasicMeasure wrap(final BasicMeasure metadata) {
++ protected DQM_BasicMeasure wrap(final DefaultBasicMeasure metadata) {
+ return new DQM_BasicMeasure(metadata);
+ }
+
+ /**
+ * Invoked by JAXB at marshalling time for getting the actual metadata to write
+ * inside the {@code <dqm:DQ_BasicMeasure>} XML element.
+ * This is the value or a copy of the value given in argument to the {@code wrap} method.
+ *
+ * @return the metadata to be marshalled.
+ */
+ @XmlElementRef
+ public DefaultBasicMeasure getElement() {
- return DefaultBasicMeasure.castOrCopy(metadata);
++ return metadata;
+ }
+
+ /**
+ * Invoked by JAXB at unmarshalling time for storing the result temporarily.
+ *
+ * @param metadata the unmarshalled metadata.
+ */
+ public void setElement(final DefaultBasicMeasure metadata) {
+ this.metadata = metadata;
+ }
+ }
diff --cc core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/DQM_Description.java
index 0000000000,30e555685f..e0d21d9efb
mode 000000,100644..100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/DQM_Description.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/DQM_Description.java
@@@ -1,0 -1,92 +1,91 @@@
+ /*
+ * 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.internal.jaxb.metadata;
+
+ import javax.xml.bind.annotation.XmlElementRef;
-import org.opengis.metadata.quality.Description;
+ import org.apache.sis.metadata.iso.quality.DefaultDescription;
+ import org.apache.sis.internal.jaxb.gco.PropertyType;
+
+
+ /**
+ * JAXB adapter mapping implementing class to the GeoAPI interface. See
+ * package documentation for more information about JAXB and interface.
+ *
+ * @author Martin Desruisseaux (Geomatys)
+ * @version 1.3
+ * @since 1.3
+ * @module
+ */
-public final class DQM_Description extends PropertyType<DQM_Description, Description> {
++public final class DQM_Description extends PropertyType<DQM_Description, DefaultDescription> {
+ /**
+ * Empty constructor for JAXB only.
+ */
+ public DQM_Description() {
+ }
+
+ /**
+ * Returns the GeoAPI interface which is bound by this adapter.
+ * This method is indirectly invoked by the private constructor
+ * below, so it shall not depend on the state of this object.
+ *
- * @return {@code Description.class}
++ * @return {@code DefaultDescription.class}
+ */
+ @Override
- protected Class<Description> getBoundType() {
- return Description.class;
++ protected Class<DefaultDescription> getBoundType() {
++ return DefaultDescription.class;
+ }
+
+ /**
+ * Constructor for the {@link #wrap} method only.
+ */
- private DQM_Description(final Description metadata) {
++ private DQM_Description(final DefaultDescription metadata) {
+ super(metadata);
+ }
+
+ /**
+ * Invoked by {@link PropertyType} at marshalling time for wrapping the given metadata value
+ * in a {@code <dqm:DQ_Description>} XML element.
+ *
+ * @param metadata the metadata element to marshal.
+ * @return a {@code PropertyType} wrapping the given the metadata element.
+ */
+ @Override
- protected DQM_Description wrap(final Description metadata) {
++ protected DQM_Description wrap(final DefaultDescription metadata) {
+ return new DQM_Description(metadata);
+ }
+
+ /**
+ * Invoked by JAXB at marshalling time for getting the actual metadata to write
+ * inside the {@code <dqm:DQ_Description>} XML element.
+ * This is the value or a copy of the value given in argument to the {@code wrap} method.
+ *
+ * @return the metadata to be marshalled.
+ */
+ @XmlElementRef
+ public DefaultDescription getElement() {
- return DefaultDescription.castOrCopy(metadata);
++ return metadata;
+ }
+
+ /**
+ * Invoked by JAXB at unmarshalling time for storing the result temporarily.
+ *
+ * @param metadata the unmarshalled metadata.
+ */
+ public void setElement(final DefaultDescription metadata) {
+ this.metadata = metadata;
+ }
+ }
diff --cc core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/DQM_Measure.java
index 0000000000,9f0eb67d3f..9849de5be8
mode 000000,100644..100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/DQM_Measure.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/DQM_Measure.java
@@@ -1,0 -1,92 +1,91 @@@
+ /*
+ * 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.internal.jaxb.metadata;
+
+ import javax.xml.bind.annotation.XmlElementRef;
-import org.opengis.metadata.quality.Measure;
+ import org.apache.sis.metadata.iso.quality.DefaultMeasure;
+ import org.apache.sis.internal.jaxb.gco.PropertyType;
+
+
+ /**
+ * JAXB adapter mapping implementing class to the GeoAPI interface. See
+ * package documentation for more information about JAXB and interface.
+ *
+ * @author Martin Desruisseaux (Geomatys)
+ * @version 1.3
+ * @since 1.3
+ * @module
+ */
-public final class DQM_Measure extends PropertyType<DQM_Measure, Measure> {
++public final class DQM_Measure extends PropertyType<DQM_Measure, DefaultMeasure> {
+ /**
+ * Empty constructor for JAXB only.
+ */
+ public DQM_Measure() {
+ }
+
+ /**
+ * Returns the GeoAPI interface which is bound by this adapter.
+ * This method is indirectly invoked by the private constructor
+ * below, so it shall not depend on the state of this object.
+ *
- * @return {@code Measure.class}
++ * @return {@code DefaultMeasure.class}
+ */
+ @Override
- protected Class<Measure> getBoundType() {
- return Measure.class;
++ protected Class<DefaultMeasure> getBoundType() {
++ return DefaultMeasure.class;
+ }
+
+ /**
+ * Constructor for the {@link #wrap} method only.
+ */
- private DQM_Measure(final Measure metadata) {
++ private DQM_Measure(final DefaultMeasure metadata) {
+ super(metadata);
+ }
+
+ /**
+ * Invoked by {@link PropertyType} at marshalling time for wrapping the given metadata value
+ * in a {@code <dqm:DQ_Measure>} XML element.
+ *
+ * @param metadata the metadata element to marshal.
+ * @return a {@code PropertyType} wrapping the given the metadata element.
+ */
+ @Override
- protected DQM_Measure wrap(final Measure metadata) {
++ protected DQM_Measure wrap(final DefaultMeasure metadata) {
+ return new DQM_Measure(metadata);
+ }
+
+ /**
+ * Invoked by JAXB at marshalling time for getting the actual metadata to write
+ * inside the {@code <dqm:DQ_Measure>} XML element.
+ * This is the value or a copy of the value given in argument to the {@code wrap} method.
+ *
+ * @return the metadata to be marshalled.
+ */
+ @XmlElementRef
+ public DefaultMeasure getElement() {
- return DefaultMeasure.castOrCopy(metadata);
++ return metadata;
+ }
+
+ /**
+ * Invoked by JAXB at unmarshalling time for storing the result temporarily.
+ *
+ * @param metadata the unmarshalled metadata.
+ */
+ public void setElement(final DefaultMeasure metadata) {
+ this.metadata = metadata;
+ }
+ }
diff --cc core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/DQM_SourceReference.java
index 0000000000,5f18c9688c..26e4563f68
mode 000000,100644..100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/DQM_SourceReference.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/DQM_SourceReference.java
@@@ -1,0 -1,92 +1,91 @@@
+ /*
+ * 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.internal.jaxb.metadata;
+
+ import javax.xml.bind.annotation.XmlElementRef;
-import org.opengis.metadata.quality.SourceReference;
+ import org.apache.sis.metadata.iso.quality.DefaultSourceReference;
+ import org.apache.sis.internal.jaxb.gco.PropertyType;
+
+
+ /**
+ * JAXB adapter mapping implementing class to the GeoAPI interface. See
+ * package documentation for more information about JAXB and interface.
+ *
+ * @author Martin Desruisseaux (Geomatys)
+ * @version 1.3
+ * @since 1.3
+ * @module
+ */
-public final class DQM_SourceReference extends PropertyType<DQM_SourceReference, SourceReference> {
++public final class DQM_SourceReference extends PropertyType<DQM_SourceReference, DefaultSourceReference> {
+ /**
+ * Empty constructor for JAXB only.
+ */
+ public DQM_SourceReference() {
+ }
+
+ /**
+ * Returns the GeoAPI interface which is bound by this adapter.
+ * This method is indirectly invoked by the private constructor
+ * below, so it shall not depend on the state of this object.
+ *
- * @return {@code SourceReference.class}
++ * @return {@code DefaultSourceReference.class}
+ */
+ @Override
- protected Class<SourceReference> getBoundType() {
- return SourceReference.class;
++ protected Class<DefaultSourceReference> getBoundType() {
++ return DefaultSourceReference.class;
+ }
+
+ /**
+ * Constructor for the {@link #wrap} method only.
+ */
- private DQM_SourceReference(final SourceReference metadata) {
++ private DQM_SourceReference(final DefaultSourceReference metadata) {
+ super(metadata);
+ }
+
+ /**
+ * Invoked by {@link PropertyType} at marshalling time for wrapping the given metadata value
+ * in a {@code <dqm:DQ_SourceReference>} XML element.
+ *
+ * @param metadata the metadata element to marshal.
+ * @return a {@code PropertyType} wrapping the given the metadata element.
+ */
+ @Override
- protected DQM_SourceReference wrap(final SourceReference metadata) {
++ protected DQM_SourceReference wrap(final DefaultSourceReference metadata) {
+ return new DQM_SourceReference(metadata);
+ }
+
+ /**
+ * Invoked by JAXB at marshalling time for getting the actual metadata to write
+ * inside the {@code <dqm:DQ_SourceReference>} XML element.
+ * This is the value or a copy of the value given in argument to the {@code wrap} method.
+ *
+ * @return the metadata to be marshalled.
+ */
+ @XmlElementRef
+ public DefaultSourceReference getElement() {
- return DefaultSourceReference.castOrCopy(metadata);
++ return metadata;
+ }
+
+ /**
+ * Invoked by JAXB at unmarshalling time for storing the result temporarily.
+ *
+ * @param metadata the unmarshalled metadata.
+ */
+ public void setElement(final DefaultSourceReference metadata) {
+ this.metadata = metadata;
+ }
+ }
diff --cc core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/DQ_EvaluationMethod.java
index 0000000000,60426907b1..74d8248f88
mode 000000,100644..100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/DQ_EvaluationMethod.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/DQ_EvaluationMethod.java
@@@ -1,0 -1,97 +1,96 @@@
+ /*
+ * 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.internal.jaxb.metadata;
+
+ import javax.xml.bind.annotation.XmlElementRef;
-import org.opengis.metadata.quality.EvaluationMethod;
+ import org.apache.sis.metadata.iso.quality.DefaultEvaluationMethod;
+ import org.apache.sis.internal.jaxb.gco.PropertyType;
+
+
+ /**
+ * JAXB adapter mapping implementing class to the GeoAPI interface. See
+ * package documentation for more information about JAXB and interface.
+ *
+ * <p>This adapter excludes the value when marshalling the older version of ISO 19115 standard.
+ * That exclusion is systematic because the type did not existed in the old standard version.</p>
+ *
+ * @author Alexis Gaillard (Geomatys)
+ * @author Martin Desruisseaux (Geomatys)
+ * @version 1.3
+ * @since 1.3
+ * @module
+ */
-public final class DQ_EvaluationMethod extends PropertyType<DQ_EvaluationMethod, EvaluationMethod> {
++public final class DQ_EvaluationMethod extends PropertyType<DQ_EvaluationMethod, DefaultEvaluationMethod> {
+ /**
+ * Empty constructor for JAXB only.
+ */
+ public DQ_EvaluationMethod() {
+ }
+
+ /**
+ * Returns the GeoAPI interface which is bound by this adapter.
+ * This method is indirectly invoked by the private constructor
+ * below, so it shall not depend on the state of this object.
+ *
- * @return {@code EvaluationMethod.class}
++ * @return {@code DefaultEvaluationMethod.class}
+ */
+ @Override
- protected Class<EvaluationMethod> getBoundType() {
- return EvaluationMethod.class;
++ protected Class<DefaultEvaluationMethod> getBoundType() {
++ return DefaultEvaluationMethod.class;
+ }
+
+ /**
+ * Constructor for the {@link #wrap} method only.
+ */
- private DQ_EvaluationMethod(final EvaluationMethod metadata) {
++ private DQ_EvaluationMethod(final DefaultEvaluationMethod metadata) {
+ super(metadata);
+ }
+
+ /**
+ * Invoked by {@link PropertyType} at marshalling time for wrapping the given metadata value
+ * in a {@code <mdq:DQ_EvaluationMethod>} XML element.
+ *
+ * @param metadata the metadata element to marshal.
+ * @return a {@code PropertyType} wrapping the given the metadata element,
+ * or {@code null} if marshalling a too old version of the standard.
+ */
+ @Override
- protected DQ_EvaluationMethod wrap(final EvaluationMethod metadata) {
++ protected DQ_EvaluationMethod wrap(final DefaultEvaluationMethod metadata) {
+ return accept2014() ? new DQ_EvaluationMethod(metadata) : null;
+ }
+
+ /**
+ * Invoked by JAXB at marshalling time for getting the actual metadata to write
+ * inside the {@code <mdq:DQ_EvaluationMethod>} XML element.
+ * This is the value or a copy of the value given in argument to the {@code wrap} method.
+ *
+ * @return the metadata to be marshalled.
+ */
+ @XmlElementRef
+ public DefaultEvaluationMethod getElement() {
- return DefaultEvaluationMethod.castOrCopy(metadata);
++ return metadata;
+ }
+
+ /**
+ * Invoked by JAXB at unmarshalling time for storing the result temporarily.
+ *
+ * @param metadata the unmarshalled metadata.
+ */
+ public void setElement(final DefaultEvaluationMethod metadata) {
+ this.metadata = metadata;
+ }
+ }
diff --cc core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/DQ_MeasureReference.java
index 0000000000,f79e9f4fee..466237525f
mode 000000,100644..100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/DQ_MeasureReference.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/DQ_MeasureReference.java
@@@ -1,0 -1,97 +1,96 @@@
+ /*
+ * 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.internal.jaxb.metadata;
+
+ import javax.xml.bind.annotation.XmlElementRef;
-import org.opengis.metadata.quality.MeasureReference;
+ import org.apache.sis.metadata.iso.quality.DefaultMeasureReference;
+ import org.apache.sis.internal.jaxb.gco.PropertyType;
+
+
+ /**
+ * JAXB adapter mapping implementing class to the GeoAPI interface. See
+ * package documentation for more information about JAXB and interface.
+ *
+ * <p>This adapter excludes the value when marshalling the older version of ISO 19115 standard.
+ * That exclusion is systematic because the type did not existed in the old standard version.</p>
+ *
+ * @author Alexis Gaillard (Geomatys)
+ * @author Martin Desruisseaux (Geomatys)
+ * @version 1.3
+ * @since 1.3
+ * @module
+ */
-public final class DQ_MeasureReference extends PropertyType<DQ_MeasureReference, MeasureReference> {
++public final class DQ_MeasureReference extends PropertyType<DQ_MeasureReference, DefaultMeasureReference> {
+ /**
+ * Empty constructor for JAXB only.
+ */
+ public DQ_MeasureReference() {
+ }
+
+ /**
+ * Returns the GeoAPI interface which is bound by this adapter.
+ * This method is indirectly invoked by the private constructor
+ * below, so it shall not depend on the state of this object.
+ *
- * @return {@code MeasureReference.class}
++ * @return {@code DefaultMeasureReference.class}
+ */
+ @Override
- protected Class<MeasureReference> getBoundType() {
- return MeasureReference.class;
++ protected Class<DefaultMeasureReference> getBoundType() {
++ return DefaultMeasureReference.class;
+ }
+
+ /**
+ * Constructor for the {@link #wrap} method only.
+ */
- private DQ_MeasureReference(final MeasureReference metadata) {
++ private DQ_MeasureReference(final DefaultMeasureReference metadata) {
+ super(metadata);
+ }
+
+ /**
+ * Invoked by {@link PropertyType} at marshalling time for wrapping the given metadata value
+ * in a {@code <mdq:DQ_MeasureReference>} XML element.
+ *
+ * @param metadata the metadata element to marshal.
+ * @return a {@code PropertyType} wrapping the given the metadata element,
+ * or {@code null} if marshalling a too old version of the standard.
+ */
+ @Override
- protected DQ_MeasureReference wrap(final MeasureReference metadata) {
++ protected DQ_MeasureReference wrap(final DefaultMeasureReference metadata) {
+ return accept2014() ? new DQ_MeasureReference(metadata) : null;
+ }
+
+ /**
+ * Invoked by JAXB at marshalling time for getting the actual metadata to write
+ * inside the {@code <mdq:DQ_MeasureReference>} XML element.
+ * This is the value or a copy of the value given in argument to the {@code wrap} method.
+ *
+ * @return the metadata to be marshalled.
+ */
+ @XmlElementRef
+ public DefaultMeasureReference getElement() {
- return DefaultMeasureReference.castOrCopy(metadata);
++ return metadata;
+ }
+
+ /**
+ * Invoked by JAXB at unmarshalling time for storing the result temporarily.
+ *
+ * @param metadata the unmarshalled metadata.
+ */
+ public void setElement(final DefaultMeasureReference metadata) {
+ this.metadata = metadata;
+ }
+ }
diff --cc core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/DQ_StandaloneQualityReportInformation.java
index 0000000000,a4449f863e..b219193903
mode 000000,100644..100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/DQ_StandaloneQualityReportInformation.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/DQ_StandaloneQualityReportInformation.java
@@@ -1,0 -1,99 +1,98 @@@
+ /*
+ * 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.internal.jaxb.metadata;
+
+ import javax.xml.bind.annotation.XmlElementRef;
-import org.opengis.metadata.quality.StandaloneQualityReportInformation;
+ import org.apache.sis.metadata.iso.quality.DefaultStandaloneQualityReportInformation;
+ import org.apache.sis.internal.jaxb.gco.PropertyType;
+
+
+ /**
+ * JAXB adapter mapping implementing class to the GeoAPI interface. See
+ * package documentation for more information about JAXB and interface.
+ *
+ * <p>This adapter excludes the value when marshalling the older version of ISO 19115 standard.
+ * That exclusion is systematic because the type did not existed in the old standard version.</p>
+ *
+ * @author Alexis Gaillard (Geomatys)
+ * @author Martin Desruisseaux (Geomatys)
+ * @version 1.3
+ * @since 1.3
+ * @module
+ */
+ public final class DQ_StandaloneQualityReportInformation extends
- PropertyType<DQ_StandaloneQualityReportInformation, StandaloneQualityReportInformation>
++ PropertyType<DQ_StandaloneQualityReportInformation, DefaultStandaloneQualityReportInformation>
+ {
+ /**
+ * Empty constructor for JAXB only.
+ */
+ public DQ_StandaloneQualityReportInformation() {
+ }
+
+ /**
+ * Returns the GeoAPI interface which is bound by this adapter.
+ * This method is indirectly invoked by the private constructor
+ * below, so it shall not depend on the state of this object.
+ *
- * @return {@code StandaloneQualityReportInformation.class}
++ * @return {@code DefaultStandaloneQualityReportInformation.class}
+ */
+ @Override
- protected Class<StandaloneQualityReportInformation> getBoundType() {
- return StandaloneQualityReportInformation.class;
++ protected Class<DefaultStandaloneQualityReportInformation> getBoundType() {
++ return DefaultStandaloneQualityReportInformation.class;
+ }
+
+ /**
+ * Constructor for the {@link #wrap} method only.
+ */
- private DQ_StandaloneQualityReportInformation(final StandaloneQualityReportInformation metadata) {
++ private DQ_StandaloneQualityReportInformation(final DefaultStandaloneQualityReportInformation metadata) {
+ super(metadata);
+ }
+
+ /**
+ * Invoked by {@link PropertyType} at marshalling time for wrapping the given metadata value
+ * in a {@code <mdq:DQ_StandaloneQualityReportInformation>} XML element.
+ *
+ * @param metadata the metadata element to marshal.
+ * @return a {@code PropertyType} wrapping the given the metadata element,
+ * or {@code null} if marshalling a too old version of the standard.
+ */
+ @Override
- protected DQ_StandaloneQualityReportInformation wrap(final StandaloneQualityReportInformation metadata) {
++ protected DQ_StandaloneQualityReportInformation wrap(final DefaultStandaloneQualityReportInformation metadata) {
+ return accept2014() ? new DQ_StandaloneQualityReportInformation(metadata) : null;
+ }
+
+ /**
+ * Invoked by JAXB at marshalling time for getting the actual metadata to write
+ * inside the {@code <mdq:DQ_StandaloneQualityReportInformation>} XML element.
+ * This is the value or a copy of the value given in argument to the {@code wrap} method.
+ *
+ * @return the metadata to be marshalled.
+ */
+ @XmlElementRef
+ public DefaultStandaloneQualityReportInformation getElement() {
- return DefaultStandaloneQualityReportInformation.castOrCopy(metadata);
++ return metadata;
+ }
+
+ /**
+ * Invoked by JAXB at unmarshalling time for storing the result temporarily.
+ *
+ * @param metadata the unmarshalled metadata.
+ */
+ public void setElement(final DefaultStandaloneQualityReportInformation metadata) {
+ this.metadata = metadata;
+ }
+ }
diff --cc core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/replace/Parameter.java
index 0000000000,7d1235839a..a8f6f96cac
mode 000000,100644..100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/replace/Parameter.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/replace/Parameter.java
@@@ -1,0 -1,173 +1,178 @@@
+ /*
+ * 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.internal.jaxb.metadata.replace;
+
++import java.util.Set;
+ import java.util.Objects;
++import javax.measure.Unit;
+ import org.opengis.util.TypeName;
+ import org.opengis.metadata.Identifier;
+ import org.opengis.parameter.ParameterValue;
+ import org.opengis.parameter.ParameterDescriptor;
+ import org.apache.sis.internal.simple.SimpleIdentifiedObject;
+ import org.apache.sis.internal.metadata.ReferencingServices;
+ import org.apache.sis.util.ComparisonMode;
+
-import static org.apache.sis.util.Utilities.deepEquals;
-
+
+ /**
+ * Base class for ISO/OGC parameter classes replaced by {@code ParameterDescriptor} in GeoAPI.
+ * GeoAPI tries to provides a single API for the parameter classes defined in various specifications
+ * (ISO 19111, ISO 19115, ISO 19157, Web Processing Service).
+ * But we still need separated representations at XML (un)marshalling time.
+ *
+ * <p>Note that this implementation is simple and serves no other purpose than being a container for XML
+ * parsing and formatting. For real parameter framework, consider using {@link org.apache.sis.parameter}
+ * package instead.</p>
+ *
+ * @param <T> the type of parameter values.
+ *
+ * @author Martin Desruisseaux (Geomatys)
+ * @version 1.3
+ * @since 1.3
+ * @module
+ */
+ abstract class Parameter<T> extends SimpleIdentifiedObject implements ParameterDescriptor<T> {
+ /**
+ * A copy of {@code this} as a fully-implemented parameter descriptor.
+ * This is created when first needed for implementation of {@link #createValue()}.
+ * Should not be created for other purposes — in particular for implementation of getter methods —
+ * because it would create an infinite loop in {@code DefaultParameterDescriptor} copy constructor.
+ */
+ private transient volatile ParameterDescriptor<T> descriptor;
+
+ /**
+ * Creates an initially empty parameter.
+ * This constructor is needed by JAXB at unmarshalling time.
+ */
+ Parameter() {
+ }
+
+ /**
+ * Creates a parameter with the values of the given descriptor.
+ * This is used at marshalling time for converting a generic descriptor
+ * to the standard-specific parameter representation defined by subclass.
+ *
+ * @param parameter the parameter to marshal.
+ */
+ Parameter(final ParameterDescriptor<T> parameter) {
+ super(parameter);
+ descriptor = parameter;
+ }
+
+ /**
+ * Returns the name that describes the type of parameter values.
+ * The default implementation returns a non-null value only if this class is wrapping
+ * another parameter descriptor. Subclasses should override this method for computing
+ * a type name if this method returns null.
+ *
+ * @return the type name of value component(s) in this parameter, or {@code null} if unknown.
+ */
- @Override
+ public TypeName getValueType() {
- final ParameterDescriptor<T> p = descriptor;
- return (p != null) ? p.getValueType() : null;
++ return ReferencingServices.getInstance().getValueType(descriptor);
+ }
+
+ /**
+ * Returns the class that describes the type of parameter values.
+ * The default implementation returns a non-null value only if this class is wrapping
+ * another parameter descriptor. Subclasses should override this method for computing
+ * a class if this method returns null.
+ *
+ * @return the value class inferred from the attribute type, or {@code null} if unknown.
+ */
+ @Override
+ public Class<T> getValueClass() {
+ final ParameterDescriptor<T> p = descriptor;
+ return (p != null) ? p.getValueClass() : null;
+ }
+
+ /**
+ * Creates a new instance of {@code ParameterValue}.
+ * This method delegates the work to {@link org.apache.sis.parameter.DefaultParameterDescriptor}
+ * since this {@code ServiceParameter} class is not a full-featured parameter descriptor implementation.
+ *
+ * @return a new instance of {@code ParameterValue}.
+ */
+ @Override
+ public final ParameterValue<T> createValue() {
+ ParameterDescriptor<T> p;
+ synchronized (this) {
+ p = descriptor;
+ if (p == null) {
+ descriptor = p = ReferencingServices.getInstance().toImplementation(this);
+ }
+ }
+ return p.createValue();
+ }
+
++ /**
++ * Optional properties.
++ * @return {@code null}.
++ */
++ @Override public Set<T> getValidValues() {return null;} // Really null, not an empty set. See method contract.
++ @Override public Comparable<T> getMinimumValue() {return null;}
++ @Override public Comparable<T> getMaximumValue() {return null;}
++ @Override public T getDefaultValue() {return null;}
++ @Override public Unit<?> getUnit() {return null;}
++
+ /*
- * Do not override getValidValues(), getMinimumValue(), getMaximumValue(), getDefaultValue() or getUnit()
++ * Do not redirect getValidValues(), getMinimumValue(), getMaximumValue(), getDefaultValue() or getUnit()
+ * in order to keep property values stable before and after the `descriptor` field has been initialized.
+ * The `equals(Object)` method assumes that all those methods return null.
+ */
+
+ /**
+ * Compares this object with the given one for equality. This implementation should be consistent
+ * with {@link org.apache.sis.parameter.DefaultParameterDescriptor#equals(Object)} implementation,
+ * with the simplification that some {@code Parameter} property values are always null.
+ *
+ * @param object the object to compare with this reference system.
+ * @param mode the strictness level of the comparison.
+ * @return {@code true} if both objects are equal.
+ */
+ @Override
+ public final boolean equals(final Object object, final ComparisonMode mode) {
+ if (object == this) {
+ return true;
+ }
+ if (super.equals(object, mode) && object instanceof ParameterDescriptor<?>) {
+ final ParameterDescriptor<?> that = (ParameterDescriptor<?>) object;
+ if (that.getUnit() == null &&
+ that.getDefaultValue() == null &&
+ that.getValueClass() == getValueClass())
+ {
+ if (mode.isIgnoringMetadata()) {
+ return Objects.equals(toString(getName()), toString(that.getName()));
+ // super.equals(…) already compared `getName()` in other modes.
+ }
- return deepEquals(that.getValueType(), getValueType(), mode) &&
- deepEquals(that.getDescription(), getDescription(), mode) &&
- that.getDirection() == getDirection() &&
- that.getMinimumOccurs() == getMinimumOccurs() &&
- that.getMaximumOccurs() == getMaximumOccurs() &&
- that.getValidValues() == null &&
- that.getMinimumValue() == null &&
- that.getMaximumValue() == null;
++ return that.getMinimumOccurs() == getMinimumOccurs() &&
++ that.getMaximumOccurs() == getMaximumOccurs() &&
++ that.getValidValues() == null &&
++ that.getMinimumValue() == null &&
++ that.getMaximumValue() == null;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Null-safe string representation of the given identifier, for comparison purpose.
+ * We ignore codespace because they can not be represented in ISO 19139 XML documents.
+ */
+ private static String toString(final Identifier identifier) {
+ return (identifier != null) ? identifier.toString() : null;
+ }
+ }
diff --cc core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/replace/QualityParameter.java
index 0000000000,b902327e87..1c22dba88d
mode 000000,100644..100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/replace/QualityParameter.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/replace/QualityParameter.java
@@@ -1,0 -1,246 +1,217 @@@
+ /*
+ * 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.internal.jaxb.metadata.replace;
+
+ import java.util.Map;
+ import javax.xml.bind.annotation.XmlType;
+ import javax.xml.bind.annotation.XmlElement;
+ import javax.xml.bind.annotation.XmlRootElement;
+ import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+ import org.opengis.util.TypeName;
+ import org.opengis.util.InternationalString;
+ import org.opengis.metadata.Identifier;
-import org.opengis.metadata.quality.Description;
-import org.opengis.metadata.quality.ValueStructure;
+ import org.opengis.parameter.ParameterDescriptor;
+ import org.opengis.referencing.operation.Matrix;
+ import org.apache.sis.metadata.iso.DefaultIdentifier;
+ import org.apache.sis.metadata.iso.quality.DefaultDescription;
+ import org.apache.sis.internal.jaxb.gco.GO_GenericName;
+ import org.apache.sis.util.Classes;
+ import org.apache.sis.util.iso.Names;
+ import org.apache.sis.xml.Namespaces;
+
+ // Branch-dependent imports
-import org.opengis.coverage.Coverage;
+ import org.opengis.referencing.ReferenceIdentifier;
++import org.apache.sis.internal.metadata.ReferencingServices;
+
+
+ /**
+ * Parameter information conform to the ISO 19157:2013 specification.
+ * GeoAPI tries to provides a single API for the parameter classes defined in various specifications
+ * (ISO 19111, ISO 19115, ISO 19157, Web Processing Service).
+ * But we still need separated representations at XML (un)marshalling time.
+ * This class is for the ISO 19157:2013 case.
+ *
+ * <p>Note that this implementation is simple and serves no other purpose than being a container for XML
+ * parsing and formatting. For real parameter framework, consider using {@link org.apache.sis.parameter}
+ * package instead.</p>
+ *
+ * <h2>Note about raw-type usage</h2>
+ * We use raw type (i.e. we implement {@code ParameterDescriptor} instead of {@code ParameterDescriptor<T>})
+ * because there is no way we can know {@code <T>} for sure at unmarshalling time. This is not a recommended
+ * practice, so <strong>this class shall not be in public API</strong>. However it should be okay to create
+ * {@code QualityParameter} instances in Apache SIS internal code if all methods creating such instances
+ * declare {@code ParameterDescriptor<?>} as their return type.
+ *
+ * @author Martin Desruisseaux (Geomatys)
+ * @version 1.3
+ * @since 1.3
+ * @module
+ */
+ @SuppressWarnings("rawtypes") // For the omission of <T> in Parameter<T> - see javadoc.
+ @XmlType(name = "DQM_Parameter_Type", namespace = Namespaces.DQM, propOrder = {
+ "code",
+ "definition",
+ "description",
- "valueType",
- "valueStructure"
++ "valueType"
+ })
+ @XmlRootElement(name = "DQM_Parameter", namespace = Namespaces.DQM)
+ public final class QualityParameter extends Parameter {
+ /**
+ * Name of the data quality parameter, to be represented as identifier code.
+ *
+ * @see #getName()
+ */
+ @XmlElement(name="name", required=true)
+ String code;
+
+ /**
+ * Definition of the data quality parameter.
+ * Stored in {@link Identifier#getDescription()}.
+ *
+ * @see #getName()
+ */
+ @XmlElement(required = true)
+ InternationalString definition;
+
+ /**
+ * Description of the data quality parameter.
+ *
+ * @see #getDescription()
+ */
+ @XmlElement
- Description description;
++ DefaultDescription description;
+
+ /**
+ * Value type of the data quality parameter (shall be one of the data types defined in ISO/TS 19103:2005).
+ *
+ * @see #getValueType()
+ * @see #getValueClass()
+ */
+ @XmlElement(required = true)
+ @XmlJavaTypeAdapter(GO_GenericName.class) // Not in package-info because shall not be applied to getLegacyName().
+ TypeName valueType;
+
- /**
- * Structure of the data quality parameter.
- *
- * @see #getValueClass()
- */
- @XmlElement
- ValueStructure valueStructure;
-
+ /**
+ * Creates an initially empty parameter.
+ * This constructor is needed by JAXB at unmarshalling time.
+ *
+ * <p><strong>Consider this constructor as private</strong> except for testing purpose.
+ * See <cite>Note about raw-type usage</cite> in class javadoc.</p>
+ */
+ QualityParameter() {
+ }
+
+ /**
+ * Creates a parameter initialized to the values of the given one.
+ * This is used for marshalling an arbitrary parameter as an ISO 19157 parameter.
+ */
+ @SuppressWarnings("unchecked")
+ private QualityParameter(final ParameterDescriptor<?> parameter) {
+ super(parameter);
+ final Identifier id = parameter.getName();
+ if (id != null) {
+ code = id.getCode();
- definition = id.getDescription();
+ }
- InternationalString text = parameter.getDescription();
- if (text != null) {
- description = new DefaultDescription(text);
- }
- valueType = parameter.getValueType();
- valueStructure = ValueStructure.valueOf(parameter.getValueClass()).orElse(null);
++ valueType = ReferencingServices.getInstance().getValueType(parameter);
+ }
+
+ /**
+ * Returns the given parameter as an instance of {@code QualityParameter}.
+ *
+ * @param parameter the parameter (may be {@code null}).
+ * @return the service parameter, or {@code null} if the given argument was null.
+ */
+ public static QualityParameter castOrCopy(final ParameterDescriptor<?> parameter) {
+ if (parameter == null || parameter instanceof QualityParameter) {
+ return (QualityParameter) parameter;
+ }
+ return new QualityParameter(parameter);
+ }
+
++ @Override public int getMinimumOccurs() {return 0;}
++ @Override public int getMaximumOccurs() {return 1;}
++
+ /**
+ * Returns the name as an {@code Identifier}, which is the type requested by ISO 19111.
+ * Note that this is different than the type requested by ISO 19157, which is {@link String}.
+ *
+ * @return the parameter name as an identifier (the type specified by ISO 19111).
+ */
+ @Override
+ public synchronized ReferenceIdentifier getName() {
+ if (name == null && code != null) {
+ final RS_Identifier id = new RS_Identifier(null, code, null);
+ id.setDescription(definition);
+ id.transitionTo(DefaultIdentifier.State.FINAL);
+ name = id;
+ }
+ return name;
+ }
+
- /**
- * Returns a narrative explanation of the role of the parameter.
- *
- * @return a narrative explanation of the role of the parameter, or {@code null} if none.
- */
- @Override
- public InternationalString getDescription() {
- final Description description = this.description;
- return (description != null) ? description.getTextDescription() : null;
- }
-
+ /**
+ * Infers the value class from the type name.
+ * This method is the reason why we can not parameterize this {@code QualityParameter} class
+ * (see <cite>Note about raw-type usage</cite> in class javadoc), because there is no way we
+ * can ensure that the class inferred from {@link #valueType} is really for type {@code <T>}.
+ *
+ * @return the value class inferred from the attribute type, or {@code null} if unknown.
+ */
+ @Override
+ public Class<?> getValueClass() {
+ Class<?> type = super.getValueClass();
+ if (type == null) {
- final ValueStructure s = valueStructure;
- type = (s != null) ? s.toJavaType().orElse(null) : Names.toClass(valueType);
++ type = Names.toClass(valueType);
+ }
+ return type;
+ }
+
+ /**
+ * Returns the name that describes the type of parameter values.
+ *
+ * @return the type name of value component(s) in this parameter.
+ */
+ @Override
+ public TypeName getValueType() {
+ return valueType;
+ }
+
+ /**
+ * Suggests a type name for the components of given collection or array class.
+ * The component type is fetched on a <cite>best effort</cite> basis only.
+ * This method does the following checks:
+ * <ul>
+ * <li>If the given class is a class, then its {@linkplain Class#getComponentType() component type} is used.</li>
+ * <li>Otherwise if the class is an {@link Iterable}, then the upper bound of elements is fetched.</li>
+ * <li>Otherwise if the class is a {@link Map}, then the upper bound of keys is fetched.</li>
+ * <li>Otherwise if the class is a {@link Matrix} or {@link Coverage}, then {@link Double} components is assumed.</li>
+ * <li>Otherwise the given class is used as if it was already a component type (i.e. a singleton item).</li>
+ * </ul>
+ *
- * This method is used for mapping {@link Class} to ({@link ValueStructure}, {@link TypeName}) pair.
- * The other member of the pair is given by {@link ValueStructure#valueOf(Class)}.
- *
+ * @param valueClass the type of values for which to infer a {@link TypeName} instance.
+ * @return a type name for components of the given type.
+ */
+ public static TypeName getValueType(Class<?> valueClass) {
+ if (valueClass.isArray()) {
+ valueClass = valueClass.getComponentType();
+ } else if (Iterable.class.isAssignableFrom(valueClass) || Map.class.isAssignableFrom(valueClass)) {
+ valueClass = Classes.boundOfParameterizedDeclaration(valueClass);
- } else if (Matrix.class.isAssignableFrom(valueClass) || Coverage.class.isAssignableFrom(valueClass)) {
++ } else if (Matrix.class.isAssignableFrom(valueClass)) {
+ valueClass = Double.class;
+ }
+ return Names.createTypeName(valueClass);
+ }
+ }
diff --cc core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/replace/ServiceParameter.java
index 6d9d652e73,c0a46ff19a..797c9f9987
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/replace/ServiceParameter.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/replace/ServiceParameter.java
@@@ -27,11 -24,9 +24,7 @@@ import org.opengis.util.TypeName
import org.opengis.util.MemberName;
import org.opengis.util.GenericName;
import org.opengis.util.InternationalString;
--import org.opengis.metadata.Identifier;
- import org.opengis.parameter.ParameterValue;
-import org.opengis.parameter.ParameterDirection;
import org.opengis.parameter.ParameterDescriptor;
- import org.opengis.referencing.ReferenceIdentifier;
- import org.apache.sis.internal.simple.SimpleIdentifiedObject;
import org.apache.sis.internal.jaxb.FilterByVersion;
import org.apache.sis.internal.xml.LegacyNamespaces;
import org.apache.sis.internal.jaxb.gco.GO_GenericName;
@@@ -43,8 -37,9 +35,10 @@@ import org.apache.sis.xml.Namespaces
import static org.apache.sis.internal.util.CollectionsExt.nonNull;
+ // Branch-dependent imports
+ import org.opengis.referencing.ReferenceIdentifier;
++import org.apache.sis.internal.metadata.ReferencingServices;
+
/**
* Parameter information conform to the ISO 19115:2014 specification.
@@@ -109,8 -102,18 +100,10 @@@ public final class ServiceParameter ext
@XmlJavaTypeAdapter(GO_GenericName.Since2014.class)
MemberName memberName;
- /**
- * Indication if the parameter is an input to the service, an output or both.
- *
- * @see #getDirection()
- */
- @XmlElement(required = true)
- ParameterDirection direction;
-
/**
* A narrative explanation of the role of the parameter.
+ *
+ * @see #getDescription()
*/
@XmlElement
InternationalString description;
@@@ -193,11 -212,17 +200,17 @@@
}
}
if (id != null) {
- final Class<?> valueClass = parameter.getValueClass();
- if (valueClass != null) {
- final String code = id.getCode();
- if (code != null) {
- return Names.createMemberName(id.getCodeSpace(), null, code, valueClass);
+ final String code = id.getCode();
+ if (code != null) {
+ final String namespace = id.getCodeSpace();
- final TypeName type = parameter.getValueType();
++ final TypeName type = ReferencingServices.getInstance().getValueType(parameter);
+ if (type != null) {
+ return Names.createMemberName(namespace, null, code, type);
+ } else {
+ final Class<?> valueClass = parameter.getValueClass();
+ if (valueClass != null) {
+ return Names.createMemberName(namespace, null, code, valueClass);
+ }
}
}
}
@@@ -277,23 -318,20 +306,10 @@@
*/
@Override
public Class<?> getValueClass() {
- return (memberName != null) ? Names.toClass(memberName.getAttributeType()) : null;
- }
-
- /**
- * For JAXB marshalling of ISO 19139:2007 document only.
- * Note that there is not setter method, since we expect the same information
- * to be provided in the {@link #name} attribute type.
- */
- @XmlElement(name = "valueType", namespace = LegacyNamespaces.SRV)
- @XmlJavaTypeAdapter(GO_GenericName.class) // Not in package-info because shall not be applied to getLegacyName().
- final TypeName getValueType() {
- if (memberName != null && FilterByVersion.LEGACY_METADATA.accept()) {
- return memberName.getAttributeType();
- }
- return null;
+ final Class<?> type = super.getValueClass();
+ return (type != null) ? type : Names.toClass(getValueType());
}
- /**
- * Returns an indication if the parameter is an input to the service, an output or both.
- *
- * @return indication if the parameter is an input or output to the service, or {@code null} if unspecified.
- */
- @Override
- public ParameterDirection getDirection() {
- return direction;
- }
-
/**
* Returns a narrative explanation of the role of the parameter.
*
diff --cc core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/replace/package-info.java
index 9753a896dc,8d09ded25c..93e2c1d536
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/replace/package-info.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/replace/package-info.java
@@@ -45,6 -46,9 +46,7 @@@
@XmlJavaTypeAdapters({
@XmlJavaTypeAdapter(GO_Boolean.class),
@XmlJavaTypeAdapter(MD_Identifier.class),
+ @XmlJavaTypeAdapter(DQM_Description.class),
- @XmlJavaTypeAdapter(DQM_ValueStructure.class),
- @XmlJavaTypeAdapter(SV_ParameterDirection.class),
// Java types, primitive types and basic OGC types handling
@XmlJavaTypeAdapter(StringAdapter.class),
@@@ -62,5 -66,8 +64,6 @@@ import javax.xml.bind.annotation.adapte
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapters;
import org.apache.sis.internal.xml.LegacyNamespaces;
import org.apache.sis.internal.jaxb.metadata.MD_Identifier;
+ import org.apache.sis.internal.jaxb.metadata.DQM_Description;
-import org.apache.sis.internal.jaxb.code.SV_ParameterDirection;
-import org.apache.sis.internal.jaxb.code.DQM_ValueStructure;
import org.apache.sis.internal.jaxb.gco.*;
import org.apache.sis.xml.Namespaces;
diff --cc core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java
index b3de0b6559,9503ab5e1e..a23f41e400
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java
@@@ -35,6 -35,6 +35,9 @@@ import org.apache.sis.internal.system.D
import org.apache.sis.internal.system.OptionalDependency;
import org.apache.sis.internal.system.Modules;
++// Branch-dependent imports
++import org.opengis.util.TypeName;
++
/**
* Provides access to services defined in the {@code "sis-referencing"} module.
@@@ -250,6 -250,6 +253,16 @@@ public class ReferencingServices extend
//// ////
///////////////////////////////////////////////////////////////////////////////////////
++ /**
++ * Returns the name of the type of values.
++ *
++ * @param parameter parameter for which to get the name of type of values, or {@code null}.
++ * @return name of type of values, or {@code null} if not supported by given implementation.
++ */
++ public TypeName getValueType(ParameterDescriptor<?> parameter) {
++ return null;
++ }
++
/**
* Returns a fully implemented parameter descriptor.
*
diff --cc core/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataStandard.java
index bcf143b4cc,447f79c90f..38d54ddfda
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataStandard.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/MetadataStandard.java
@@@ -114,12 -113,15 +114,15 @@@ public class MetadataStandard implement
* than GeoAPI, but have a slight performance cost at construction time. Performance
* after construction should be the same.</p>
*/
- static final boolean IMPLEMENTATION_CAN_ALTER_API = false;
+ static final boolean IMPLEMENTATION_CAN_ALTER_API = true;
/**
- * Metadata instances defined in this class. The current implementation does not yet
- * contains the user-defined instances. However this may be something we will need to
- * do in the future.
+ * Metadata instances defined in this class. Standards will be tested in the order they appear in this array.
+ * So if {@link #isSupported(String)} may return {@code true} for two or more standards, the standard which
+ * should have precedence should be declared first.
+ *
+ * <p>The current implementation does not yet contains the user-defined instances.
+ * However it may be something that we will need to do in the future.</p>
*/
private static final MetadataStandard[] INSTANCES;
@@@ -141,16 -151,17 +152,17 @@@
*/
public static final MetadataStandard ISO_19123;
static {
+ final String[] prefix = {"Default", "Abstract"};
final String[] acronyms = {"CoordinateSystem", "CS", "CoordinateReferenceSystem", "CRS"};
-- // If new StandardImplementation instances are added below, please update StandardImplementation.readResolve().
- ISO_19115 = new StandardImplementation("ISO 19115", "org.opengis.metadata.", "org.apache.sis.metadata.iso.", prefix, null, null);
- ISO_19111 = new StandardImplementation("ISO 19111", "org.opengis.referencing.", "org.apache.sis.referencing.", prefix, acronyms, new MetadataStandard[] {ISO_19115});
- ISO_19123 = new MetadataStandard ("ISO 19123", "org.opengis.coverage.", new MetadataStandard[] {ISO_19111});
- ISO_19115 = new StandardImplementation("ISO 19115", "org.opengis.metadata.", "org.apache.sis.metadata.iso.", null, (MetadataStandard[]) null);
- ISO_19157 = new StandardImplementation("ISO 19157", "org.opengis.metadata.quality.", "org.apache.sis.metadata.iso.quality.", null, ISO_19115);
- ISO_19111 = new StandardImplementation("ISO 19111", "org.opengis.referencing.", "org.apache.sis.referencing.", acronyms, ISO_19157, ISO_19115);
++ ISO_19115 = new StandardImplementation("ISO 19115", "org.opengis.metadata.", "org.apache.sis.metadata.iso.", prefix, null, (MetadataStandard[]) null);
++ ISO_19157 = new StandardImplementation("ISO 19157", "org.opengis.metadata.quality.", "org.apache.sis.metadata.iso.quality.", prefix, null, ISO_19115);
++ ISO_19111 = new StandardImplementation("ISO 19111", "org.opengis.referencing.", "org.apache.sis.referencing.", prefix, acronyms, ISO_19157, ISO_19115);
+ ISO_19123 = new MetadataStandard ("ISO 19123", "org.opengis.coverage.", ISO_19111);
INSTANCES = new MetadataStandard[] {
- ISO_19111,
+ ISO_19157, // Need to be declared before ISO 19115.
ISO_19115,
+ ISO_19111,
ISO_19123
};
SystemListener.add(new SystemListener(Modules.METADATA) {
diff --cc core/sis-metadata/src/main/java/org/apache/sis/metadata/StandardImplementation.java
index 6cd2ecee7b,c254319109..c56cbfad50
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/StandardImplementation.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/StandardImplementation.java
@@@ -86,7 -81,7 +86,7 @@@ final class StandardImplementation exte
* @param dependencies the dependencies to other metadata standards, or {@code null} if none.
*/
StandardImplementation(final String citation, final String interfacePackage, final String implementationPackage,
- final String[] prefix, final String[] acronyms, final MetadataStandard[] dependencies)
- final String[] acronyms, final MetadataStandard... dependencies)
++ final String[] prefix, final String[] acronyms, final MetadataStandard... dependencies)
{
super(citation, interfacePackage, dependencies);
this.implementationPackage = implementationPackage;
diff --cc core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/AbstractDataEvaluation.java
index 0000000000,1e1e04860f..2ea38764d2
mode 000000,100644..100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/AbstractDataEvaluation.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/AbstractDataEvaluation.java
@@@ -1,0 -1,117 +1,71 @@@
+ /*
+ * 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.quality;
+
+ import javax.xml.bind.annotation.XmlType;
+ import javax.xml.bind.annotation.XmlRootElement;
+ import javax.xml.bind.annotation.XmlSeeAlso;
-import org.opengis.metadata.quality.DataEvaluation;
-import org.opengis.metadata.quality.FullInspection;
-import org.opengis.metadata.quality.IndirectEvaluation;
-import org.opengis.metadata.quality.SampleBasedInspection;
+
+
+ /**
+ * Data evaluation method.
- * See the {@link DataEvaluation} GeoAPI interface for more details.
+ *
+ * <h2>Limitations</h2>
+ * <ul>
+ * <li>Instances of this class are not synchronized for multi-threading.
+ * Synchronization, if needed, is caller's responsibility.</li>
+ * <li>Serialized objects of this class are not guaranteed to be compatible with future Apache SIS releases.
+ * Serialization support is appropriate for short term storage or RMI between applications running the
+ * same version of Apache SIS. For long term storage, use {@link org.apache.sis.xml.XML} instead.</li>
+ * </ul>
+ *
+ * @author Alexis Gaillard (Geomatys)
+ * @author Martin Desruisseaux (Geomatys)
+ * @version 1.3
+ * @since 1.3
+ * @module
+ */
+ @XmlType(name = "AbstractDQ_DataEvaluation_Type")
+ @XmlRootElement(name = "AbstractDQ_DataEvaluation")
+ @XmlSeeAlso({
+ DefaultFullInspection.class,
+ DefaultIndirectEvaluation .class,
+ DefaultSampleBasedInspection.class
+ })
-public class AbstractDataEvaluation extends DefaultEvaluationMethod implements DataEvaluation {
++public class AbstractDataEvaluation extends DefaultEvaluationMethod {
+ /**
+ * Serial number for inter-operability with different versions.
+ */
+ private static final long serialVersionUID = 6572802343890855687L;
+
+ /**
+ * Constructs an initially empty Evaluation for data.
+ */
+ public AbstractDataEvaluation() {
+ }
+
+ /**
+ * Constructs a new instance initialized with the values from the specified metadata object.
+ * This is a <cite>shallow</cite> 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(DataEvaluation)
+ */
- public AbstractDataEvaluation(final DataEvaluation object) {
++ public AbstractDataEvaluation(final AbstractDataEvaluation object) {
+ super(object);
+ }
-
- /**
- * Returns a SIS metadata implementation with the values of the given arbitrary implementation.
- * This method performs the first applicable action in the following choices:
- *
- * <ul>
- * <li>If the given object is {@code null}, then this method returns {@code null}.</li>
- * <li>Otherwise if the given object is an instance of {@link IndirectEvaluation},
- * {@link SampleBasedInspection} or {@link FullInspection}, then this method delegates to
- * the {@code castOrCopy(…)} method of the corresponding SIS subclass.
- * Note that if the given object implements more than one of the above-cited interfaces,
- * then the {@code castOrCopy(…)} method to be used is unspecified.</li>
- * <li>Otherwise if the given object is already an instance of
- * {@code AbstractDataEvaluation}, then it is returned unchanged.</li>
- * <li>Otherwise a new {@code AbstractDataEvaluation} instance is created using the
- * {@linkplain #AbstractDataEvaluation(DataEvaluation) copy constructor} and returned.
- * Note that this is a <cite>shallow</cite> copy operation, since the other
- * metadata contained in the given object are not recursively copied.</li>
- * </ul>
- *
- * @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 AbstractDataEvaluation castOrCopy(final DataEvaluation object) {
- if (object instanceof FullInspection) {
- return DefaultFullInspection.castOrCopy((FullInspection) object);
- }
- if (object instanceof SampleBasedInspection) {
- return DefaultSampleBasedInspection.castOrCopy((SampleBasedInspection) object);
- }
- if (object instanceof IndirectEvaluation) {
- return DefaultIndirectEvaluation.castOrCopy((IndirectEvaluation) object);
- }
- if (object == null || object instanceof AbstractDataEvaluation) {
- return (AbstractDataEvaluation) object;
- }
- return new AbstractDataEvaluation(object);
- }
+ }
diff --cc core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/AbstractElement.java
index 5febb30461,b4b639256b..c4edef7186
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/AbstractElement.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/AbstractElement.java
@@@ -17,10 -17,10 +17,9 @@@
package org.apache.sis.metadata.iso.quality;
import java.util.Date;
- import java.util.Iterator;
import java.util.Collection;
- import java.util.AbstractList;
- import java.io.Serializable;
-import java.util.Collections;
+ import java.util.function.Function;
+ import java.util.function.BiConsumer;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@@@ -29,23 -30,23 +29,20 @@@ import org.opengis.metadata.Identifier
import org.opengis.metadata.citation.Citation;
import org.opengis.metadata.quality.Result;
import org.opengis.metadata.quality.Element;
- import org.opengis.metadata.quality.Usability;
-import org.opengis.metadata.quality.UsabilityElement;
import org.opengis.metadata.quality.Completeness;
-import org.opengis.metadata.quality.TemporalQuality;
+import org.opengis.metadata.quality.TemporalAccuracy;
import org.opengis.metadata.quality.ThematicAccuracy;
import org.opengis.metadata.quality.PositionalAccuracy;
import org.opengis.metadata.quality.LogicalConsistency;
import org.opengis.metadata.quality.EvaluationMethodType;
-import org.opengis.metadata.quality.EvaluationMethod;
-import org.opengis.metadata.quality.MeasureReference;
-import org.opengis.metadata.quality.Metaquality;
++import org.opengis.metadata.quality.Usability;
import org.opengis.util.InternationalString;
- import org.apache.sis.metadata.iso.ISOMetadata;
- import org.apache.sis.internal.system.Semaphores;
import org.apache.sis.internal.jaxb.FilterByVersion;
+ import org.apache.sis.internal.jaxb.gco.InternationalStringAdapter;
+ import org.apache.sis.internal.metadata.Dependencies;
import org.apache.sis.internal.xml.LegacyNamespaces;
- import org.apache.sis.util.collection.CheckedContainer;
- import org.apache.sis.util.resources.Errors;
import static org.apache.sis.util.collection.Containers.isNullOrEmpty;
- import static org.apache.sis.internal.metadata.ImplementationHelper.valueIfDefined;
/**
@@@ -94,219 -103,37 +99,35 @@@ public class AbstractElement extends IS
/**
* Serial number for inter-operability with different versions.
*/
- private static final long serialVersionUID = 3963454452767190970L;
-
- /**
- * Name of the test applied to the data.
- */
- @SuppressWarnings("serial")
- private Collection<InternationalString> namesOfMeasure;
+ private static final long serialVersionUID = -406229448295586970L;
/**
- * Code identifying a registered standard procedure, or {@code null} if none.
+ * Clause in the standalone quality report where this data quality element is described.
*/
@SuppressWarnings("serial")
- private Identifier measureIdentification;
+ private InternationalString standaloneQualityReportDetails;
/**
- * Description of the measure being determined.
+ * Reference to measure used.
*/
-- @SuppressWarnings("serial")
- private InternationalString measureDescription;
- private MeasureReference measureReference;
++ private DefaultMeasureReference measureReference;
/**
- * Type of method used to evaluate quality of the dataset, or {@code null} if unspecified.
+ * Evaluation information.
*/
-- @SuppressWarnings("serial")
- private EvaluationMethodType evaluationMethodType;
- private EvaluationMethod evaluationMethod;
++ private DefaultEvaluationMethod evaluationMethod;
/**
- * Description of the evaluation method.
+ * Value (or set of values) obtained from applying a data quality measure.
*/
@SuppressWarnings("serial")
- private InternationalString evaluationMethodDescription;
-
- /**
- * Reference to the procedure information, or {@code null} if none.
- */
- @SuppressWarnings("serial")
- private Citation evaluationProcedure;
-
- /**
- * Start time ({@code date1}) and end time ({@code date2}) on which a data quality measure was applied.
- *
- * @todo Needs to be made unmodifiable after transition to {@link State#FINAL}.
- */
- private Dates dates;
-
- /**
- * The start and end times as a list of O, 1 or 2 elements.
- */
- private static final class Dates extends AbstractList<Date>
- implements CheckedContainer<Date>, Cloneable, Serializable
- {
- /**
- * For cross-version compatibility.
- */
- private static final long serialVersionUID = 1210175223467194009L;
-
- /**
- * Start time ({@code date1}) and end time ({@code date2}) on which a data quality measure
- * was applied. Value is {@link Long#MIN_VALUE} if this information is not available.
- */
- private long date1, date2;
-
- /**
- * Creates a new list initialized with no dates.
- */
- Dates() {
- clear();
- }
-
- /**
- * Returns the type of elements in this list.
- */
- @Override
- public Class<Date> getElementType() {
- return Date.class;
- }
-
- /**
- * Removes all dates in this list.
- */
- @Override
- public void clear() {
- date1 = Long.MIN_VALUE;
- date2 = Long.MIN_VALUE;
- }
-
- /**
- * Returns the number of elements in this list.
- */
- @Override
- public int size() {
- if (date2 != Long.MIN_VALUE) return 2;
- if (date1 != Long.MIN_VALUE) return 1;
- return 0;
- }
-
- /**
- * Returns the value at the given index.
- */
- @Override
- @SuppressWarnings("fallthrough")
- public Date get(final int index) {
- long date = date1;
- switch (index) {
- case 1: date = date2; // Fall through
- case 0: if (date != Long.MIN_VALUE) return new Date(date); // else fallthrough.
- default: throw new IndexOutOfBoundsException(Errors.format(Errors.Keys.IndexOutOfBounds_1, index));
- }
- }
-
- /**
- * Sets the value at the given index.
- * Null values are not allowed.
- */
- @Override
- public Date set(final int index, final Date value) {
- final long date = value.getTime();
- final Date previous = get(index);
- switch (index) {
- case 0: date1 = date; break;
- case 1: date2 = date; break;
- }
- modCount++;
- return previous;
- }
-
- /**
- * Removes the value at the given index.
- */
- @Override
- @SuppressWarnings("fallthrough")
- public Date remove(final int index) {
- final Date previous = get(index);
- switch (index) {
- case 0: date1 = date2; // Fallthrough
- case 1: date2 = Long.MIN_VALUE; break;
- }
- modCount++;
- return previous;
- }
-
- /**
- * Adds a date at the given position.
- * Null values are not allowed.
- */
- @Override
- public void add(final int index, final Date value) {
- final long date = value.getTime();
- if (date2 == Long.MIN_VALUE) {
- switch (index) {
- case 0: {
- date2 = date1;
- date1 = date;
- modCount++;
- return;
- }
- case 1: {
- if (date1 == Long.MIN_VALUE) {
- break; // Exception will be thrown below.
- }
- date2 = date;
- modCount++;
- return;
- }
- }
- }
- throw new IndexOutOfBoundsException(Errors.format(Errors.Keys.IndexOutOfBounds_1, index));
- }
-
- /**
- * Adds all content from the given collection into this collection.
- */
- @Override
- @SuppressWarnings("fallthrough")
- public boolean addAll(final Collection<? extends Date> dates) {
- final int c = modCount;
- if (dates != null) {
- final Iterator<? extends Date> it = dates.iterator();
- switch (size()) { // Fallthrough everywhere.
- case 0: if (!it.hasNext()) break;
- date1 = it.next().getTime();
- modCount++;
- case 1: if (!it.hasNext()) break;
- date2 = it.next().getTime();
- modCount++;
- default: if (!it.hasNext()) break;
- throw new IllegalArgumentException(Errors.format(
- Errors.Keys.TooManyCollectionElements_3, "dates", 2, dates.size()));
- }
- }
- return modCount != c;
- }
-
- /**
- * Returns a clone of this list.
- */
- @Override
- public Object clone() {
- try {
- return super.clone();
- } catch (CloneNotSupportedException e) {
- throw new AssertionError(e);
- }
- }
- }
+ private Collection<Result> results;
/**
- * Value (or set of values) obtained from applying a data quality measure or the out
- * come of evaluating the obtained value (or set of values) against a specified
- * acceptable conformance quality level.
+ * In case of aggregation or derivation, indicates the original element.
*/
@SuppressWarnings("serial")
- private Collection<Result> results;
+ private Collection<Element> derivedElements;
/**
* Constructs an initially empty element.
@@@ -336,14 -163,14 +157,17 @@@
public AbstractElement(final Element object) {
super(object);
if (object != null) {
- namesOfMeasure = copyCollection(object.getNamesOfMeasure(), InternationalString.class);
- measureIdentification = object.getMeasureIdentification();
- measureDescription = object.getMeasureDescription();
- evaluationMethodType = object.getEvaluationMethodType();
- evaluationMethodDescription = object.getEvaluationMethodDescription();
- evaluationProcedure = object.getEvaluationProcedure();
- results = copyCollection(object.getResults(), Result.class);
- writeDates(object.getDates());
- standaloneQualityReportDetails = object.getStandaloneQualityReportDetails();
- if ((measureReference = object.getMeasureReference()) == null) {
- DefaultMeasureReference candidate = new DefaultMeasureReference();
- if (candidate.setLegacy(object)) measureReference = candidate;
++ if (object instanceof AbstractElement) {
++ final AbstractElement impl = (AbstractElement) object;
++ standaloneQualityReportDetails = impl.getStandaloneQualityReportDetails();
++ evaluationMethod = impl.getEvaluationMethod();
++ derivedElements = copyCollection(impl.getDerivedElements(), Element.class);
++ if ((measureReference = impl.getMeasureReference()) == null) {
++ DefaultMeasureReference candidate = new DefaultMeasureReference();
++ if (candidate.setLegacy(object)) measureReference = candidate;
++ }
+ }
- evaluationMethod = object.getEvaluationMethod();
- results = copyCollection(object.getResults(), Result.class);
- derivedElements = copyCollection(object.getDerivedElements(), Element.class);
++ results = copyCollection(object.getResults(), Result.class);
}
}
@@@ -354,9 -181,9 +178,8 @@@
* <ul>
* <li>If the given object is {@code null}, then this method returns {@code null}.</li>
* <li>Otherwise if the given object is an instance of {@link PositionalAccuracy},
- * {@link TemporalAccuracy}, {@link ThematicAccuracy}, {@link LogicalConsistency},
- * {@link Completeness} or {@link Usability}, then this method delegates to the
- * {@code castOrCopy(…)} method of the corresponding SIS subclass.
- * {@link TemporalQuality}, {@link ThematicAccuracy}, {@link LogicalConsistency},
- * {@link Completeness}, {@link UsabilityElement} or {@link Metaquality},
++ * {@link ThematicAccuracy}, {@link LogicalConsistency} or {@link Completeness},
+ * then this method delegates to the {@code castOrCopy(…)} method of the corresponding SIS subclass.
* Note that if the given object implements more than one of the above-cited interfaces,
* then the {@code castOrCopy(…)} method to be used is unspecified.</li>
* <li>Otherwise if the given object is already an instance of
@@@ -375,8 -202,8 +198,8 @@@
if (object instanceof PositionalAccuracy) {
return AbstractPositionalAccuracy.castOrCopy((PositionalAccuracy) object);
}
- if (object instanceof TemporalQuality) {
- return AbstractTemporalQuality.castOrCopy((TemporalQuality) object);
+ if (object instanceof TemporalAccuracy) {
- return AbstractTemporalAccuracy.castOrCopy((TemporalAccuracy) object);
++ return AbstractTemporalQuality.castOrCopy((TemporalAccuracy) object);
}
if (object instanceof ThematicAccuracy) {
return AbstractThematicAccuracy.castOrCopy((ThematicAccuracy) object);
@@@ -387,8 -214,11 +210,8 @@@
if (object instanceof Completeness) {
return AbstractCompleteness.castOrCopy((Completeness) object);
}
- if (object instanceof UsabilityElement) {
- return DefaultUsabilityElement.castOrCopy((UsabilityElement) object);
- }
- if (object instanceof Metaquality) {
- return AbstractMetaquality.castOrCopy((Metaquality) object);
+ if (object instanceof Usability) {
- return DefaultUsability.castOrCopy((Usability) object);
++ return DefaultUsabilityElement.castOrCopy((Usability) object);
}
// Intentionally tested after the sub-interfaces.
if (object == null || object instanceof AbstractElement) {
@@@ -397,18 -227,105 +220,100 @@@
return new AbstractElement(object);
}
+ /**
+ * Returns the clause in the standalone quality report where this data quality element is described.
+ * May apply to any related data quality element (original results in case of derivation or aggregation).
+ *
+ * @return clause where this data quality element is described, or {@code null} if none.
+ *
+ * @since 1.3
+ */
- @Override
+ @XmlElement(name = "standaloneQualityReportDetails")
+ @XmlJavaTypeAdapter(InternationalStringAdapter.Since2014.class)
+ public InternationalString getStandaloneQualityReportDetails() {
+ return standaloneQualityReportDetails;
+ }
+
+ /**
+ * Sets the clause in the standalone quality report where this data quality element is described.
+ *
+ * @param newValue the clause in the standalone quality report.
+ *
+ * @since 1.3
+ */
+ public void setStandaloneQualityReportDetails(final InternationalString newValue) {
+ checkWritePermission(standaloneQualityReportDetails);
+ standaloneQualityReportDetails = newValue;
+ }
+
+ /**
+ * Returns an identifier of a measure fully described elsewhere.
+ *
+ * @return reference to the measure used, or {@code null} if none.
+ *
+ * @since 1.3
+ */
- @Override
+ @XmlElement(name = "measure", required = false)
- public MeasureReference getMeasureReference() {
- return (measureReference != null) ? measureReference : Element.super.getMeasureReference();
++ public DefaultMeasureReference getMeasureReference() {
++ return measureReference;
+ }
+
+ /**
+ * Sets an identifier of a measure fully described elsewhere.
+ *
+ * @param newValues the new measure identifier.
+ *
+ * @since 1.3
+ */
- public void setMeasureReference(final MeasureReference newValues) {
++ public void setMeasureReference(final DefaultMeasureReference newValues) {
+ checkWritePermission(measureReference);
+ measureReference = newValues;
+ }
+
+ /**
+ * Returns the value of a {@link #measureReference} property.
+ * This is used only for deprecated setter methods from older ISO 19115 version.
+ *
+ * @see #getEvaluationMethodProperty(Function)
+ */
- private <V> V getMeasureReferenceProperty(final Function<MeasureReference,V> getter) {
- final MeasureReference m = measureReference;
++ private <V> V getMeasureReferenceProperty(final Function<DefaultMeasureReference,V> getter) {
++ final DefaultMeasureReference m = measureReference;
+ return (m != null) && FilterByVersion.LEGACY_METADATA.accept() ? getter.apply(m) : null;
+ }
+
+ /**
+ * Sets the value of a {@link #measureReference} property.
+ * This is used only for deprecated setter methods from older ISO 19115 version.
+ *
+ * @see #setEvaluationMethodProperty(BiConsumer, Object)
+ */
+ private <V> void setMeasureReferenceProperty(final BiConsumer<DefaultMeasureReference,V> setter, final V newValue) {
+ if (newValue != null) {
- if (!(measureReference instanceof DefaultEvaluationMethod)) {
- measureReference = new DefaultMeasureReference(measureReference);
++ if (measureReference == null) {
++ measureReference = new DefaultMeasureReference();
+ }
- setter.accept((DefaultMeasureReference) measureReference, newValue);
++ setter.accept(measureReference, newValue);
+ }
+ }
+
/**
* Returns the name of the test applied to the data.
*
* @return name of the test applied to the data.
*
- * @see <a href="https://issues.apache.org/jira/browse/SIS-394">Issue SIS-394</a>
+ * @deprecated Replaced by {@link DefaultMeasureReference#getNamesOfMeasure()}.
*/
@Override
+ @Deprecated
@XmlElement(name = "nameOfMeasure", namespace = LegacyNamespaces.GMD)
public Collection<InternationalString> getNamesOfMeasure() {
- if (!FilterByVersion.LEGACY_METADATA.accept()) return null;
- return namesOfMeasure = nonNullCollection(namesOfMeasure, InternationalString.class);
+ if (!FilterByVersion.LEGACY_METADATA.accept()) {
+ return null;
+ }
+ if (measureReference == null) {
+ measureReference = new DefaultMeasureReference();
+ }
- if (measureReference instanceof DefaultMeasureReference) {
- return ((DefaultMeasureReference) measureReference).getNamesOfMeasure();
- }
- return Collections.unmodifiableCollection(measureReference.getNamesOfMeasure());
++ return measureReference.getNamesOfMeasure();
}
/**
@@@ -425,12 -347,13 +335,13 @@@
*
* @return code identifying a registered standard procedure, or {@code null}.
*
- * @see <a href="https://issues.apache.org/jira/browse/SIS-394">Issue SIS-394</a>
+ * @deprecated Replaced by {@link DefaultMeasureReference#getMeasureIdentification()}.
*/
@Override
+ @Deprecated
@XmlElement(name = "measureIdentification", namespace = LegacyNamespaces.GMD)
public Identifier getMeasureIdentification() {
- return FilterByVersion.LEGACY_METADATA.accept() ? measureIdentification : null;
- return getMeasureReferenceProperty(MeasureReference::getMeasureIdentification);
++ return getMeasureReferenceProperty(DefaultMeasureReference::getMeasureIdentification);
}
/**
@@@ -448,22 -373,76 +361,75 @@@
*
* @return description of the measure being determined, or {@code null}.
*
- * @see <a href="https://issues.apache.org/jira/browse/SIS-394">Issue SIS-394</a>
+ * @deprecated Replaced by {@link DefaultMeasureReference#getMeasureDescription()}.
*/
@Override
+ @Deprecated
@XmlElement(name = "measureDescription", namespace = LegacyNamespaces.GMD)
public InternationalString getMeasureDescription() {
- return FilterByVersion.LEGACY_METADATA.accept() ? measureDescription : null;
- return getMeasureReferenceProperty(MeasureReference::getMeasureDescription);
++ return getMeasureReferenceProperty(DefaultMeasureReference::getMeasureDescription);
}
/**
* Sets the description of the measure being determined.
*
* @param newValue the new measure description.
+ *
+ * @deprecated Replaced by {@link DefaultMeasureReference#setMeasureDescription(InternationalString)}.
*/
+ @Deprecated
public void setMeasureDescription(final InternationalString newValue) {
- checkWritePermission(measureDescription);
- measureDescription = newValue;
+ setMeasureReferenceProperty(DefaultMeasureReference::setMeasureDescription, newValue);
+ }
+
+ /**
+ * Returns the evaluation information.
+ *
+ * @return information about the evaluation method, or {@code null} if none.
+ *
+ * @since 1.3
+ */
- @Override
+ @XmlElement(name = "evaluationMethod", required = false)
- public EvaluationMethod getEvaluationMethod() {
++ public DefaultEvaluationMethod getEvaluationMethod() {
+ return evaluationMethod;
+ }
+
+ /**
+ * Sets the evaluation information.
+ *
+ * @param newValue the new evaluation information.
+ *
+ * @since 1.3
+ */
- public void setEvaluationMethod(final EvaluationMethod newValue) {
++ public void setEvaluationMethod(final DefaultEvaluationMethod newValue) {
+ checkWritePermission(evaluationMethod);
+ evaluationMethod = newValue;
+ }
+
+ /**
+ * Returns the value of a {@link #evaluationMethod} property.
+ * This is used only for deprecated setter methods from older ISO 19115 version.
+ *
+ * @see #getMeasureReferenceProperty(Function)
+ */
- private <V> V getEvaluationMethodProperty(final Function<EvaluationMethod,V> getter) {
- final EvaluationMethod m = evaluationMethod;
++ private <V> V getEvaluationMethodProperty(final Function<DefaultEvaluationMethod,V> getter) {
++ final DefaultEvaluationMethod m = evaluationMethod;
+ return (m != null) && FilterByVersion.LEGACY_METADATA.accept() ? getter.apply(m) : null;
+ }
+
+ /**
+ * Sets the value of a {@link #evaluationMethod} property.
+ * This is used only for deprecated setter methods from older ISO 19115 version.
+ *
+ * @see #setMeasureReferenceProperty(BiConsumer, Object)
+ */
+ private <V> void setEvaluationMethodProperty(final BiConsumer<DefaultEvaluationMethod,V> setter, final V newValue) {
+ if (newValue != null) {
- if (!(evaluationMethod instanceof DefaultEvaluationMethod)) {
- evaluationMethod = new DefaultEvaluationMethod(evaluationMethod);
++ if (evaluationMethod == null) {
++ evaluationMethod = new DefaultEvaluationMethod();
+ }
- setter.accept((DefaultEvaluationMethod) evaluationMethod, newValue);
++ setter.accept(evaluationMethod, newValue);
+ }
}
/**
@@@ -471,12 -450,13 +437,13 @@@
*
* @return type of method used to evaluate quality, or {@code null}.
*
- * @see <a href="https://issues.apache.org/jira/browse/SIS-394">Issue SIS-394</a>
+ * @deprecated Replaced by {@link DefaultEvaluationMethod#getEvaluationMethodType()}.
*/
@Override
+ @Deprecated
@XmlElement(name = "evaluationMethodType", namespace = LegacyNamespaces.GMD)
public EvaluationMethodType getEvaluationMethodType() {
- return FilterByVersion.LEGACY_METADATA.accept() ? evaluationMethodType : null;
- return getEvaluationMethodProperty(EvaluationMethod::getEvaluationMethodType);
++ return getEvaluationMethodProperty(DefaultEvaluationMethod::getEvaluationMethodType);
}
/**
@@@ -494,12 -476,13 +463,13 @@@
*
* @return description of the evaluation method, or {@code null}.
*
- * @see <a href="https://issues.apache.org/jira/browse/SIS-394">Issue SIS-394</a>
+ * @deprecated Replaced by {@link DefaultEvaluationMethod#getEvaluationMethodDescription()}.
*/
@Override
+ @Deprecated
@XmlElement(name = "evaluationMethodDescription", namespace = LegacyNamespaces.GMD)
public InternationalString getEvaluationMethodDescription() {
- return FilterByVersion.LEGACY_METADATA.accept() ? evaluationMethodDescription : null;
- return getEvaluationMethodProperty(EvaluationMethod::getEvaluationMethodDescription);
++ return getEvaluationMethodProperty(DefaultEvaluationMethod::getEvaluationMethodDescription);
}
/**
@@@ -517,12 -502,13 +489,13 @@@
*
* @return reference to the procedure information, or {@code null}.
*
- * @see <a href="https://issues.apache.org/jira/browse/SIS-394">Issue SIS-394</a>
+ * @deprecated Replaced by {@link DefaultEvaluationMethod#getEvaluationProcedure()}.
*/
@Override
+ @Deprecated
@XmlElement(name = "evaluationProcedure", namespace = LegacyNamespaces.GMD)
public Citation getEvaluationProcedure() {
- return FilterByVersion.LEGACY_METADATA.accept() ? evaluationProcedure : null;
- return getEvaluationMethodProperty(EvaluationMethod::getEvaluationProcedure);
++ return getEvaluationMethodProperty(DefaultEvaluationMethod::getEvaluationProcedure);
}
/**
@@@ -541,18 -529,24 +516,21 @@@
* Returns an empty collection if this information is not available.
*
* @return date or range of dates on which a data quality measure was applied.
+ *
+ * @deprecated Replaced by {@link DefaultEvaluationMethod#getDates()}.
*/
@Override
+ @Deprecated
+ @Dependencies("getEvaluationMethod")
@XmlElement(name = "dateTime", namespace = LegacyNamespaces.GMD)
- @SuppressWarnings("ReturnOfCollectionOrArrayField")
public Collection<Date> getDates() {
- if (Semaphores.query(Semaphores.NULL_COLLECTION)) {
- return isNullOrEmpty(dates) ? null : dates;
+ if (!FilterByVersion.LEGACY_METADATA.accept()) {
+ return null;
}
- if (dates == null) {
- dates = new Dates();
+ if (evaluationMethod == null) {
+ evaluationMethod = new DefaultEvaluationMethod();
}
- return dates;
- if (evaluationMethod instanceof DefaultEvaluationMethod) {
- return ((DefaultEvaluationMethod) evaluationMethod).getDates();
- }
- return Collections.unmodifiableCollection(evaluationMethod.getDates());
++ return evaluationMethod.getDates();
}
/**
@@@ -606,4 -585,52 +569,51 @@@
public void setResults(final Collection<? extends Result> newValues) {
results = writeCollection(newValues, results, Result.class);
}
+
+ /**
+ * Returns the original elements in case of aggregation or derivation.
+ *
+ * @return original element(s) when there is an aggregation or derivation.
+ *
+ * @since 1.3
+ */
- @Override
+ // @XmlElement at the end of this class.
+ public Collection<Element> getDerivedElements() {
+ return derivedElements = nonNullCollection(derivedElements, Element.class);
+ }
+
+ /**
+ * Sets the original elements in case of aggregation or derivation.
+ *
+ * @param newValues the new elements.
+ *
+ * @since 1.3
+ */
+ public void setDerivedElements(final Collection<? extends Element> newValues) {
+ derivedElements = writeCollection(newValues, derivedElements, Element.class);
+ }
+
+
+
+
+ //////////////////////////////////////////////////////////////////////////////////////////////////
+ //////// ////////
+ //////// XML support with JAXB ////////
+ //////// ////////
+ //////// The following methods are invoked by JAXB using reflection (even if ////////
+ //////// they are private) or are helpers for other methods invoked by JAXB. ////////
+ //////// Those methods can be safely removed if Geographic Markup Language ////////
+ //////// (GML) support is not needed. ////////
+ //////// ////////
+ //////////////////////////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Invoked by JAXB at both marshalling and unmarshalling time.
+ * This attribute has been added by ISO 19157:2013 standard.
+ * If (and only if) marshalling an older standard version, we omit this attribute.
+ */
+ @XmlElement(name = "derivedElement")
+ private Collection<Element> getDerivedElement() {
+ return FilterByVersion.CURRENT_METADATA.accept() ? getDerivedElements() : null;
+ }
}
diff --cc core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/AbstractMetaquality.java
index 0000000000,79bf5758ba..5f773f575d
mode 000000,100644..100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/AbstractMetaquality.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/AbstractMetaquality.java
@@@ -1,0 -1,122 +1,77 @@@
+ /*
+ * 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.quality;
+
+ import javax.xml.bind.annotation.XmlType;
+ import javax.xml.bind.annotation.XmlRootElement;
+ import javax.xml.bind.annotation.XmlSeeAlso;
-import org.opengis.metadata.quality.Metaquality;
-import org.opengis.metadata.quality.Confidence;
-import org.opengis.metadata.quality.Representativity;
-import org.opengis.metadata.quality.Homogeneity;
+
+
+ /**
+ * Information about the reliability of data quality results.
+ * The following properties are mandatory in a well-formed metadata according ISO 19157:
+ *
+ * <div class="preformat">{@code DQ_Metaquality}
+ * {@code ├─result…………………………} Value obtained from applying a data quality measure.
+ * {@code └─derivedElement……} Derived element.</div>
+ *
+ * <h2>Limitations</h2>
+ * <ul>
+ * <li>Instances of this class are not synchronized for multi-threading.
+ * Synchronization, if needed, is caller's responsibility.</li>
+ * <li>Serialized objects of this class are not guaranteed to be compatible with future Apache SIS releases.
+ * Serialization support is appropriate for short term storage or RMI between applications running the
+ * same version of Apache SIS. For long term storage, use {@link org.apache.sis.xml.XML} instead.</li>
+ * </ul>
+ *
+ * @author Alexis Gaillard (Geomatys)
+ * @author Martin Desruisseaux (Geomatys)
+ * @version 1.3
+ * @since 1.3
+ * @module
+ */
+ @XmlType(name = "AbstractDQ_Metaquality_Type")
+ @XmlRootElement(name = "AbstractDQ_Metaquality")
+ @XmlSeeAlso({
+ DefaultConfidence.class,
+ DefaultRepresentativity.class,
+ DefaultHomogeneity.class
+ })
-public class AbstractMetaquality extends AbstractElement implements Metaquality {
++public class AbstractMetaquality extends AbstractElement {
+ /**
+ * Serial number for inter-operability with different versions.
+ */
+ private static final long serialVersionUID = -3672977971960830867L;
+
+ /**
+ * Constructs an initially empty metaquality.
+ */
+ public AbstractMetaquality() {
+ }
+
+ /**
+ * Constructs a new instance initialized with the values from the specified metadata object.
+ * This is a <cite>shallow</cite> 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(Metaquality)
+ */
+ @SuppressWarnings("unchecked")
- public AbstractMetaquality(final Metaquality object) {
++ public AbstractMetaquality(final AbstractMetaquality object) {
+ super(object);
+ }
-
- /**
- * Returns a SIS metadata implementation with the values of the given arbitrary implementation.
- * This method performs the first applicable action in the following choices:
- *
- * <ul>
- * <li>If the given object is {@code null}, then this method returns {@code null}.</li>
- * <li>Otherwise if the given object is an instance of {@link Confidence}, {@link Representativity} or {@link Homogeneity},
- * then this method delegates to the {@code castOrCopy(…)} method of the corresponding SIS subclass.
- * Note that if the given object implements more than one of the above-cited interfaces,
- * then the {@code castOrCopy(…)} method to be used is unspecified.</li>
- * <li>Otherwise if the given object is already an instance of
- * {@code AbstractMetaquality}, then it is returned unchanged.</li>
- * <li>Otherwise a new {@code AbstractMetaquality} instance is created using the
- * {@linkplain #AbstractMetaquality(Metaquality) copy constructor} and returned.
- * Note that this is a <cite>shallow</cite> copy operation, since the other
- * metadata contained in the given object are not recursively copied.</li>
- * </ul>
- *
- * @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 AbstractMetaquality castOrCopy(final Metaquality object) {
- if (object instanceof Confidence) {
- return DefaultConfidence.castOrCopy((Confidence) object);
- }
- if (object instanceof Representativity) {
- return DefaultRepresentativity.castOrCopy((Representativity) object);
- }
- if (object instanceof Homogeneity) {
- return DefaultHomogeneity.castOrCopy((Homogeneity) object);
- }
- // Intentionally tested after the sub-interfaces.
- if (object == null || object instanceof AbstractMetaquality) {
- return (AbstractMetaquality) object;
- }
- return new AbstractMetaquality(object);
- }
+ }
diff --cc core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/AbstractResult.java
index eb3f97f9e8,2813fc5e2b..9c7253670c
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/AbstractResult.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/AbstractResult.java
@@@ -23,11 -26,15 +26,16 @@@ import org.opengis.metadata.quality.Res
import org.opengis.metadata.quality.CoverageResult;
import org.opengis.metadata.quality.ConformanceResult;
import org.opengis.metadata.quality.QuantitativeResult;
- import org.apache.sis.metadata.iso.ISOMetadata;
-import org.opengis.metadata.quality.DescriptiveResult;
-import org.opengis.metadata.maintenance.Scope;
+ import org.apache.sis.internal.jaxb.metadata.MD_Scope;
+ import org.apache.sis.internal.jaxb.gco.GO_DateTime;
+ import org.apache.sis.internal.metadata.ImplementationHelper;
+
++// Branch-dependent imports
++import org.opengis.metadata.quality.Scope;
+
/**
- * Type of test applied to the data specified by a data quality scope.
+ * Base class of more specific result classes.
*
* <h2>Limitations</h2>
* <ul>
@@@ -74,6 -98,12 +99,13 @@@ public class AbstractResult extends ISO
*/
public AbstractResult(final Result object) {
super(object);
- if (object != null) {
- resultScope = object.getResultScope();
- dateTime = ImplementationHelper.toMilliseconds(object.getDateTime());
++ if (object instanceof AbstractResult) {
++ final AbstractResult impl = (AbstractResult) object;
++ resultScope = impl.getResultScope();
++ dateTime = ImplementationHelper.toMilliseconds(impl.getDateTime());
+ } else {
+ dateTime = Long.MIN_VALUE;
+ }
}
/**
@@@ -83,8 -113,8 +115,8 @@@
* <ul>
* <li>If the given object is {@code null}, then this method returns {@code null}.</li>
* <li>Otherwise if the given object is an instance of {@link ConformanceResult},
- * {@link QuantitativeResult}or {@link CoverageResult}, then this method delegates to
- * the {@code castOrCopy(…)} method of the corresponding SIS subclass.
- * {@link QuantitativeResult}, {@link DescriptiveResult} or {@link CoverageResult},
++ * {@link QuantitativeResult} or {@link CoverageResult},
+ * then this method delegates to the {@code castOrCopy(…)} method of the corresponding SIS subclass.
* Note that if the given object implements more than one of the above-cited interfaces,
* then the {@code castOrCopy(…)} method to be used is unspecified.</li>
* <li>Otherwise if the given object is already an instance of
@@@ -109,10 -136,66 +138,61 @@@
if (object instanceof ConformanceResult) {
return DefaultConformanceResult.castOrCopy((ConformanceResult) object);
}
- if (object instanceof DescriptiveResult) {
- return DefaultDescriptiveResult.castOrCopy((DescriptiveResult) object);
- }
+ if (object instanceof CoverageResult) {
+ return DefaultCoverageResult.castOrCopy((CoverageResult) object);
+ }
// Intentionally tested after the sub-interfaces.
if (object == null || object instanceof AbstractResult) {
return (AbstractResult) object;
}
return new AbstractResult(object);
}
+
+ /**
+ * Returns the scope of the result.
+ *
+ * @return scope of the result, or {@code null} if unspecified.
+ *
+ * @since 1.3
+ */
- @Override
+ @XmlElement(name = "resultScope")
+ @XmlJavaTypeAdapter(MD_Scope.Since2014.class)
+ public Scope getResultScope() {
+ return resultScope;
+ }
+
+ /**
+ * Sets the scope of the result.
+ *
+ * @param newValue the new evaluation procedure.
+ *
+ * @since 1.3
+ */
+ public void setResultScope(final Scope newValue) {
+ resultScope = newValue;
+ }
+
+ /**
+ * Returns the date when the result was generated.
+ *
+ * @return date of the result, or {@code null} if none.
+ *
+ * @since 1.3
+ */
- @Override
+ @XmlElement(name = "dateTime")
+ @XmlJavaTypeAdapter(GO_DateTime.Since2014.class)
+ public Date getDateTime() {
+ return ImplementationHelper.toDate(dateTime);
+ }
+
+ /**
+ * Sets the date when the result was generated.
+ *
+ * @param newValue the new date, or {@code null}.
+ *
+ * @since 1.3
+ */
+ public void setDateTime(final Date newValue) {
+ dateTime = ImplementationHelper.toMilliseconds(newValue);
+ }
}
diff --cc core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/AbstractTemporalQuality.java
index 4efd56c06c,18267041b7..6bf966de6d
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/AbstractTemporalQuality.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/AbstractTemporalQuality.java
@@@ -19,7 -19,7 +19,6 @@@ package org.apache.sis.metadata.iso.qua
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSeeAlso;
- import org.opengis.metadata.quality.TemporalAccuracy;
-import org.opengis.metadata.quality.TemporalQuality;
import org.opengis.metadata.quality.TemporalValidity;
import org.opengis.metadata.quality.TemporalConsistency;
import org.opengis.metadata.quality.AccuracyOfATimeMeasurement;
@@@ -55,7 -56,7 +55,7 @@@ import org.opengis.metadata.quality.Tem
DefaultTemporalConsistency.class,
DefaultTemporalValidity.class
})
- public class AbstractTemporalAccuracy extends AbstractElement implements TemporalAccuracy {
-public class AbstractTemporalQuality extends AbstractElement implements TemporalQuality {
++public class AbstractTemporalQuality extends AbstractElement implements TemporalAccuracy {
/**
* Serial number for inter-operability with different versions.
*/
@@@ -74,9 -75,9 +74,9 @@@
*
* @param object the metadata to copy values from, or {@code null} if none.
*
- * @see #castOrCopy(TemporalQuality)
+ * @see #castOrCopy(TemporalAccuracy)
*/
- public AbstractTemporalAccuracy(final TemporalAccuracy object) {
- public AbstractTemporalQuality(final TemporalQuality object) {
++ public AbstractTemporalQuality(final TemporalAccuracy object) {
super(object);
}
@@@ -92,10 -93,10 +92,10 @@@
* Note that if the given object implements more than one of the above-cited interfaces,
* then the {@code castOrCopy(…)} method to be used is unspecified.</li>
* <li>Otherwise if the given object is already an instance of
- * {@code AbstractTemporalAccuracy}, then it is returned unchanged.</li>
- * <li>Otherwise a new {@code AbstractTemporalAccuracy} instance is created using the
- * {@linkplain #AbstractTemporalAccuracy(TemporalAccuracy) copy constructor}
- * and returned. Note that this is a <cite>shallow</cite> copy operation, since the other
+ * {@code AbstractTemporalQuality}, then it is returned unchanged.</li>
+ * <li>Otherwise a new {@code AbstractTemporalQuality} instance is created using the
- * {@linkplain #AbstractTemporalQuality(TemporalQuality) copy constructor} and returned.
++ * {@linkplain #AbstractTemporalQuality(TemporalAccuracy) copy constructor} and returned.
+ * Note that this is a <cite>shallow</cite> copy operation, since the other
* metadata contained in the given object are not recursively copied.</li>
* </ul>
*
@@@ -103,7 -104,8 +103,8 @@@
* @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 AbstractTemporalAccuracy castOrCopy(final TemporalAccuracy object) {
+ @SuppressWarnings("deprecation")
- public static AbstractTemporalQuality castOrCopy(final TemporalQuality object) {
++ public static AbstractTemporalQuality castOrCopy(final TemporalAccuracy object) {
if (object instanceof AccuracyOfATimeMeasurement) {
return DefaultAccuracyOfATimeMeasurement.castOrCopy((AccuracyOfATimeMeasurement) object);
}
@@@ -113,10 -115,12 +114,9 @@@
if (object instanceof TemporalValidity) {
return DefaultTemporalValidity.castOrCopy((TemporalValidity) object);
}
- // Intentionally tested after the sub-interfaces.
- if (object == null || object instanceof AbstractTemporalAccuracy) {
- return (AbstractTemporalAccuracy) object;
- if (object instanceof TemporalAccuracy) {
- return AbstractTemporalAccuracy.castOrCopy((TemporalAccuracy) object);
- }
+ if (object == null || object instanceof AbstractTemporalQuality) {
+ return (AbstractTemporalQuality) object;
}
- return new AbstractTemporalAccuracy(object);
+ return new AbstractTemporalQuality(object);
}
}
diff --cc core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/AbstractThematicAccuracy.java
index 7bf8f7c992,314b3859e5..fe5f07b7d6
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/AbstractThematicAccuracy.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/AbstractThematicAccuracy.java
@@@ -21,8 -21,8 +21,8 @@@ import javax.xml.bind.annotation.XmlSee
import javax.xml.bind.annotation.XmlRootElement;
import org.opengis.metadata.quality.ThematicAccuracy;
import org.opengis.metadata.quality.ThematicClassificationCorrectness;
- import org.opengis.metadata.quality.NonQuantitativeAttributeAccuracy;
-import org.opengis.metadata.quality.NonQuantitativeAttributeCorrectness;
import org.opengis.metadata.quality.QuantitativeAttributeAccuracy;
++import org.opengis.metadata.quality.NonQuantitativeAttributeAccuracy;
/**
@@@ -107,8 -106,8 +106,8 @@@ public class AbstractThematicAccuracy e
if (object instanceof QuantitativeAttributeAccuracy) {
return DefaultQuantitativeAttributeAccuracy.castOrCopy((QuantitativeAttributeAccuracy) object);
}
- if (object instanceof NonQuantitativeAttributeCorrectness) {
- return DefaultNonQuantitativeAttributeCorrectness.castOrCopy((NonQuantitativeAttributeCorrectness) object);
+ if (object instanceof NonQuantitativeAttributeAccuracy) {
- return DefaultNonQuantitativeAttributeAccuracy.castOrCopy((NonQuantitativeAttributeAccuracy) object);
++ return DefaultNonQuantitativeAttributeCorrectness.castOrCopy((NonQuantitativeAttributeAccuracy) object);
}
if (object instanceof ThematicClassificationCorrectness) {
return DefaultThematicClassificationCorrectness.castOrCopy((ThematicClassificationCorrectness) object);
diff --cc core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultAggregationDerivation.java
index 0000000000,cc1290f709..e1a9a8b96b
mode 000000,100644..100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultAggregationDerivation.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultAggregationDerivation.java
@@@ -1,0 -1,94 +1,65 @@@
+ /*
+ * 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.quality;
+
+ import javax.xml.bind.annotation.XmlType;
+ import javax.xml.bind.annotation.XmlRootElement;
-import org.opengis.metadata.quality.AggregationDerivation;
+
+
+ /**
+ * Aggregation or derivation method.
- * See the {@link AggregationDerivation} GeoAPI interface for more details.
+ *
+ * <h2>Limitations</h2>
+ * <ul>
+ * <li>Instances of this class are not synchronized for multi-threading.
+ * Synchronization, if needed, is caller's responsibility.</li>
+ * <li>Serialized objects of this class are not guaranteed to be compatible with future Apache SIS releases.
+ * Serialization support is appropriate for short term storage or RMI between applications running the
+ * same version of Apache SIS. For long term storage, use {@link org.apache.sis.xml.XML} instead.</li>
+ * </ul>
+ *
+ * @author Alexis Gaillard (Geomatys)
+ * @author Martin Desruisseaux (Geomatys)
+ * @version 1.3
+ * @since 1.3
+ * @module
+ */
+ @XmlType(name = "DQ_AggregationDerivation_Type")
+ @XmlRootElement(name = "DQ_AggregationDerivation")
-public class DefaultAggregationDerivation extends DefaultEvaluationMethod implements AggregationDerivation {
++public class DefaultAggregationDerivation extends DefaultEvaluationMethod {
+ /**
+ * Serial number for inter-operability with different versions.
+ */
+ private static final long serialVersionUID = -4384680754006555546L;
+
+ /**
+ * Constructs an initially empty aggregation derivation.
+ */
+ public DefaultAggregationDerivation() {
+ }
+
+ /**
+ * Constructs a new instance initialized with the values from the specified metadata object.
+ * This is a <cite>shallow</cite> 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(DefaultAggregationDerivation)
+ */
- public DefaultAggregationDerivation(final AggregationDerivation object) {
++ public DefaultAggregationDerivation(final DefaultAggregationDerivation object) {
+ super(object);
+ }
-
- /**
- * Returns a SIS metadata implementation with the values of the given arbitrary implementation.
- * This method performs the first applicable action in the following choices:
- *
- * <ul>
- * <li>If the given object is {@code null}, then this method returns {@code null}.</li>
- * <li>Otherwise if the given object is already an instance of
- * {@code DefaultAggregationDerivation}, then it is returned unchanged.</li>
- * <li>Otherwise a new {@code DefaultAggregationDerivation} instance is created using the
- * {@linkplain #DefaultAggregationDerivation(AggregationDerivation) copy constructor}
- * and returned. Note that this is a <cite>shallow</cite> copy operation, since the other
- * metadata contained in the given object are not recursively copied.</li>
- * </ul>
- *
- * @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 DefaultAggregationDerivation castOrCopy(final AggregationDerivation object) {
- if (object == null || object instanceof DefaultAggregationDerivation) {
- return (DefaultAggregationDerivation) object;
- }
- return new DefaultAggregationDerivation(object);
- }
+ }
diff --cc core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultBasicMeasure.java
index 0000000000,df1ea55daf..42767b6bbf
mode 000000,100644..100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultBasicMeasure.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultBasicMeasure.java
@@@ -1,0 -1,225 +1,191 @@@
+ /*
+ * 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.quality;
+
+ import javax.xml.bind.annotation.XmlType;
+ import javax.xml.bind.annotation.XmlElement;
+ import javax.xml.bind.annotation.XmlRootElement;
+ import org.opengis.util.TypeName;
+ import org.opengis.util.InternationalString;
-import org.opengis.metadata.quality.Description;
-import org.opengis.metadata.quality.BasicMeasure;
+ import org.apache.sis.xml.Namespaces;
+
+
+ /**
+ * Data quality basic measure.
- * See the {@link BasicMeasure} GeoAPI interface for more details.
+ * The following property is mandatory in a well-formed metadata according ISO 19157:
+ *
+ * <div class="preformat">{@code DQM_BasicMeasure}
+ * {@code ├─name……………………} Name of the data quality basic measure applied to the data.
+ * {@code ├─definition……} Definition of the data quality basic measure.
+ * {@code ├─example……………} Illustration of the use of a data quality measure.
+ * {@code └─valueType………} Value type for the result of the basic measure (shall be one of the data types defined in ISO/TS 19103:2005).</div>
+ *
+ * <h2>Limitations</h2>
+ * <ul>
+ * <li>Instances of this class are not synchronized for multi-threading.
+ * Synchronization, if needed, is caller's responsibility.</li>
+ * <li>Serialized objects of this class are not guaranteed to be compatible with future Apache SIS releases.
+ * Serialization support is appropriate for short term storage or RMI between applications running the
+ * same version of Apache SIS. For long term storage, use {@link org.apache.sis.xml.XML} instead.</li>
+ * </ul>
+ *
+ * @author Alexis Gaillard (Geomatys)
+ * @author Martin Desruisseaux (Geomatys)
+ * @version 1.3
+ * @since 1.3
+ * @module
+ */
+ @XmlType(name = "DQM_BasicMeasure_Type", namespace = Namespaces.DQM, propOrder = {
+ "name",
+ "definition",
+ "example",
+ "valueType"
+ })
+ @XmlRootElement(name = "DQM_BasicMeasure", namespace = Namespaces.DQM)
-public class DefaultBasicMeasure extends ISOMetadata implements BasicMeasure {
++public class DefaultBasicMeasure extends ISOMetadata {
+ /**
+ * Serial number for inter-operability with different versions.
+ */
+ private static final long serialVersionUID = -1665043206717367320L;
+
+ /**
+ * Name of the data quality basic measure applied to the data.
+ */
+ @SuppressWarnings("serial")
+ private InternationalString name;
+
+ /**
+ * Definition of the data quality basic measure.
+ */
+ @SuppressWarnings("serial")
+ private InternationalString definition;
+
+ /**
+ * Illustration of the use of a data quality measure.
+ */
+ @SuppressWarnings("serial")
- private Description example;
++ private DefaultDescription example;
+
+ /**
+ * Value type for the result of the basic measure.
+ */
+ @SuppressWarnings("serial")
+ private TypeName valueType;
+
+ /**
+ * Constructs an initially empty basic measure.
+ */
+ public DefaultBasicMeasure() {
+ }
+
+ /**
+ * Constructs a new instance initialized with the values from the specified metadata object.
+ * This is a <cite>shallow</cite> 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(BasicMeasure)
+ */
- public DefaultBasicMeasure(final BasicMeasure object) {
++ public DefaultBasicMeasure(final DefaultBasicMeasure object) {
+ super(object);
+ if (object != null) {
+ name = object.getName();
+ definition = object.getDefinition();
+ example = object.getExample();
+ valueType = object.getValueType();
+ }
+ }
+
- /**
- * Returns a SIS metadata implementation with the values of the given arbitrary implementation.
- * This method performs the first applicable action in the following choices:
- *
- * <ul>
- * <li>If the given object is {@code null}, then this method returns {@code null}.</li>
- * <li>Otherwise if the given object is already an instance of
- * {@code BasicMeasure}, then it is returned unchanged.</li>
- * <li>Otherwise a new {@code BasicMeasure} instance is created using the
- * {@linkplain #BasicMeasure(Measure) copy constructor} and returned.
- * Note that this is a <cite>shallow</cite> copy operation, since the other
- * metadata contained in the given object are not recursively copied.</li>
- * </ul>
- *
- * @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 DefaultBasicMeasure castOrCopy(final BasicMeasure object) {
- if (object == null || object instanceof DefaultBasicMeasure) {
- return (DefaultBasicMeasure) object;
- }
- return new DefaultBasicMeasure(object);
- }
-
+ /**
+ * Returns the name of the data quality basic measure.
+ *
+ * @return name of the data quality basic measure.
+ */
- @Override
+ @XmlElement(name = "name", required = true)
+ public InternationalString getName() {
+ return name;
+ }
+
+ /**
+ * Sets the name of the data quality basic measure.
+ *
+ * @param newValue the new basic measure name.
+ */
+ public void setName(final InternationalString newValue) {
+ checkWritePermission(name);
+ name = newValue;
+ }
+
+ /**
+ * Returns the definition of the data quality basic measure.
+ *
+ * @return definition of the data quality basic measure.
+ */
- @Override
+ @XmlElement(name = "definition", required = true)
+ public InternationalString getDefinition() {
+ return definition;
+ }
+
+ /**
+ * Sets the definition of the data quality basic measure.
+ *
+ * @param newValue the new basic measure definition.
+ */
+ public void setDefinition(final InternationalString newValue) {
+ checkWritePermission(definition);
+ definition = newValue;
+ }
+
+ /**
+ * Returns the illustration of the use of a data quality measure.
+ *
+ * @return usage example, or {@code null} if none.
+ */
- @Override
+ @XmlElement(name = "example")
- public Description getExample() {
++ public DefaultDescription getExample() {
+ return example;
+ }
+
+ /**
+ * Sets the illustration of the use of a data quality measure.
+ *
+ * @param newValues the new basic measure example.
+ */
- public void setExample(final Description newValues) {
++ public void setExample(final DefaultDescription newValues) {
+ checkWritePermission(example);
+ example = newValues;
+ }
+
+ /**
+ * Returns the value type for the result of the basic measure.
+ *
+ * @return value type of the result for the basic measure.
+ */
- @Override
+ @XmlElement(name = "valueType", required = true)
+ public TypeName getValueType() {
+ return valueType;
+ }
+
+ /**
+ * Sets the value type for the result of the basic measure.
+ *
+ * @param newValue the new basic measure value type.
+ */
+ public void setValueType(final TypeName newValue) {
+ checkWritePermission(valueType);
+ valueType = newValue;
+ }
+ }
diff --cc core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultConfidence.java
index 0000000000,959f34e61c..b8c4de7a46
mode 000000,100644..100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultConfidence.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultConfidence.java
@@@ -1,0 -1,98 +1,69 @@@
+ /*
+ * 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.quality;
+
+ import javax.xml.bind.annotation.XmlType;
+ import javax.xml.bind.annotation.XmlRootElement;
-import org.opengis.metadata.quality.Confidence;
+
+
+ /**
+ * Trustworthiness of a data quality result.
- * See the {@link Confidence} GeoAPI interface for more details.
+ * The following properties are mandatory in a well-formed metadata according ISO 19157:
+ *
+ * <div class="preformat">{@code DQ_Confidence}
+ * {@code ├─result…………………………} Value obtained from applying a data quality measure.
+ * {@code └─derivedElement……} Derived element.</div>
+ *
+ * <h2>Limitations</h2>
+ * <ul>
+ * <li>Instances of this class are not synchronized for multi-threading.
+ * Synchronization, if needed, is caller's responsibility.</li>
+ * <li>Serialized objects of this class are not guaranteed to be compatible with future Apache SIS releases.
+ * Serialization support is appropriate for short term storage or RMI between applications running the
+ * same version of Apache SIS. For long term storage, use {@link org.apache.sis.xml.XML} instead.</li>
+ * </ul>
+ *
+ * @author Alexis Gaillard (Geomatys)
+ * @author Martin Desruisseaux (Geomatys)
+ * @version 1.3
+ * @since 1.3
+ * @module
+ */
+ @XmlType(name = "DQ_Confidence_Type")
+ @XmlRootElement(name = "DQ_Confidence")
-public class DefaultConfidence extends AbstractMetaquality implements Confidence {
++public class DefaultConfidence extends AbstractMetaquality {
+ /**
+ * Serial number for inter-operability with different versions.
+ */
+ private static final long serialVersionUID = -6402647913250621833L;
+ /**
+ * Constructs an initially empty aggregation derivation.
+ */
+ public DefaultConfidence() {
+ }
+
+ /**
+ * Constructs a new instance initialized with the values from the specified metadata object.
+ * This is a <cite>shallow</cite> 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(Confidence)
+ */
- public DefaultConfidence(final Confidence object) {
++ public DefaultConfidence(final DefaultConfidence object) {
+ super(object);
+ }
-
- /**
- * Returns a SIS metadata implementation with the values of the given arbitrary implementation.
- * This method performs the first applicable action in the following choices:
- *
- * <ul>
- * <li>If the given object is {@code null}, then this method returns {@code null}.</li>
- * <li>Otherwise if the given object is already an instance of
- * {@code DefaultConfidence}, then it is returned unchanged.</li>
- * <li>Otherwise a new {@code DefaultConfidence} instance is created using the
- * {@linkplain #DefaultConfidence(Confidence) copy constructor}
- * and returned. Note that this is a <cite>shallow</cite> copy operation, since the other
- * metadata contained in the given object are not recursively copied.</li>
- * </ul>
- *
- * @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 DefaultConfidence castOrCopy(final Confidence object) {
- if (object == null || object instanceof DefaultConfidence) {
- return (DefaultConfidence) object;
- }
- return new DefaultConfidence(object);
- }
+ }
diff --cc core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultCoverageResult.java
index c5ff4a8eda,ef87d901d4..b5e87d7e58
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultCoverageResult.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultCoverageResult.java
@@@ -123,8 -134,9 +134,11 @@@ public class DefaultCoverageResult exte
spatialRepresentationType = object.getSpatialRepresentationType();
resultSpatialRepresentation = object.getResultSpatialRepresentation();
resultContentDescription = object.getResultContentDescription();
- resultContent = copyCollection(object.getResultContent(), RangeDimension.class);
resultFormat = object.getResultFormat();
resultFile = object.getResultFile();
++ if (object instanceof DefaultCoverageResult) {
++ resultContent = copyCollection(((DefaultCoverageResult) object).getResultContent(), RangeDimension.class);
++ }
}
}
@@@ -195,6 -207,31 +209,30 @@@
resultSpatialRepresentation = newValue;
}
+ /**
+ * Provides the description of the content of the result coverage.
+ * This is the semantic definition of the data quality measures.
+ *
+ * @return description of the content of the result coverage.
+ *
+ * @since 1.3
+ */
- @Override
+ // @XmlElement(name = "resultContent") // Pending new ISO 19157 version.
+ public Collection<RangeDimension> getResultContent() {
+ return resultContent = nonNullCollection(resultContent, RangeDimension.class);
+ }
+
+ /**
+ * Sets the description of the content of the result coverage.
+ *
+ * @param newValues the new descriptions.
+ *
+ * @since 1.3
+ */
+ public void setResultContent(final Collection<RangeDimension> newValues) {
+ resultContent = writeCollection(newValues, resultContent, RangeDimension.class);
+ }
+
/**
* Returns the description of the content of the result coverage, i.e. semantic definition
* of the data quality measures.
diff --cc core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultDataQuality.java
index 34bf01f2ad,10be7cc10e..a1bcd1e90a
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultDataQuality.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultDataQuality.java
@@@ -23,10 -23,8 +23,8 @@@ import javax.xml.bind.annotation.XmlRoo
import org.opengis.metadata.lineage.Lineage;
import org.opengis.metadata.quality.DataQuality;
import org.opengis.metadata.quality.Element;
- import org.opengis.metadata.quality.Scope;
-import org.opengis.metadata.quality.StandaloneQualityReportInformation;
import org.opengis.metadata.maintenance.ScopeCode;
+import org.apache.sis.metadata.iso.ISOMetadata;
- import org.apache.sis.metadata.iso.maintenance.DefaultScope;
import org.apache.sis.internal.jaxb.FilterByVersion;
import org.apache.sis.internal.xml.LegacyNamespaces;
@@@ -92,6 -91,13 +91,13 @@@ public class DefaultDataQuality extend
@SuppressWarnings("serial")
private Lineage lineage;
+ /**
+ * Reference to an external standalone quality report.
+ * Can be used for providing more details than reported as standard metadata.
+ */
+ @SuppressWarnings("serial")
- private StandaloneQualityReportInformation standaloneQualityReport;
++ private DefaultStandaloneQualityReportInformation standaloneQualityReport;
+
/**
* Constructs an initially empty data quality.
*/
@@@ -133,9 -139,10 +139,12 @@@
public DefaultDataQuality(final DataQuality object) {
super(object);
if (object != null) {
- scope = object.getScope();
- reports = copyCollection(object.getReports(), Element.class);
- standaloneQualityReport = object.getStandaloneQualityReport();
- lineage = object.getLineage();
+ scope = object.getScope();
+ reports = copyCollection(object.getReports(), Element.class);
+ lineage = object.getLineage();
++ if (object instanceof DefaultDataQuality) {
++ standaloneQualityReport = ((DefaultDataQuality) object).getStandaloneQualityReport();
++ }
}
}
@@@ -205,6 -212,32 +214,31 @@@
reports = writeCollection(newValues, reports, Element.class);
}
+ /**
+ * Returns the reference to an external standalone quality report.
+ * Can be used for providing more details than reported as standard metadata.
+ *
+ * @return reference to an external standalone quality report, or {@code null} if none.
+ *
+ * @since 1.3
+ */
- @Override
+ @XmlElement(name = "standaloneQualityReport")
- public StandaloneQualityReportInformation getStandaloneQualityReport() {
++ public DefaultStandaloneQualityReportInformation getStandaloneQualityReport() {
+ return standaloneQualityReport;
+ }
+
+ /**
+ * Sets the quality of the reported information.
+ *
+ * @param newValue the new quality information.
+ *
+ * @since 1.3
+ */
- public void setStandaloneQualityReport(final StandaloneQualityReportInformation newValue) {
++ public void setStandaloneQualityReport(final DefaultStandaloneQualityReportInformation newValue) {
+ checkWritePermission(standaloneQualityReport);
+ standaloneQualityReport = newValue;
+ }
+
/**
* Returns non-quantitative quality information about the lineage of the data specified by the scope.
*
diff --cc core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultDescription.java
index 0000000000,53337934f1..bf3450ec8f
mode 000000,100644..100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultDescription.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultDescription.java
@@@ -1,0 -1,172 +1,142 @@@
+ /*
+ * 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.quality;
+
+ import javax.xml.bind.annotation.XmlType;
+ import javax.xml.bind.annotation.XmlElement;
+ import javax.xml.bind.annotation.XmlRootElement;
+ import org.opengis.util.InternationalString;
-import org.opengis.metadata.quality.Description;
+ import org.opengis.metadata.identification.BrowseGraphic;
+ import org.apache.sis.util.iso.Types;
+ import org.apache.sis.xml.Namespaces;
+
+
+ /**
+ * Data quality measure description.
+ * The following property is mandatory in a well-formed metadata according ISO 19157:
+ *
+ * <div class="preformat">{@code DQM_Description}
+ * {@code └─textDescription……………} Text description.</div>
+ *
+ * <h2>Limitations</h2>
+ * <ul>
+ * <li>Instances of this class are not synchronized for multi-threading.
+ * Synchronization, if needed, is caller's responsibility.</li>
+ * <li>Serialized objects of this class are not guaranteed to be compatible with future Apache SIS releases.
+ * Serialization support is appropriate for short term storage or RMI between applications running the
+ * same version of Apache SIS. For long term storage, use {@link org.apache.sis.xml.XML} instead.</li>
+ * </ul>
+ *
+ * @author Alexis Gaillard (Geomatys)
+ * @author Martin Desruisseaux (Geomatys)
+ * @version 1.3
+ * @since 1.3
+ * @module
+ */
+ @XmlType(name = "DQM_Description_Type", namespace = Namespaces.DQM, propOrder = {
+ "textDescription",
+ "extendedDescription"
+ })
+ @XmlRootElement(name = "DQM_Description", namespace = Namespaces.DQM)
-public class DefaultDescription extends ISOMetadata implements Description {
++public class DefaultDescription extends ISOMetadata {
+ /**
+ * Serial number for inter-operability with different versions.
+ */
+ private static final long serialVersionUID = 4878784271547209576L;
+
+ /**
+ * Text description.
+ */
+ @SuppressWarnings("serial")
+ private InternationalString textDescription;
+
+ /**
+ * Illustration.
+ */
+ @SuppressWarnings("serial")
+ private BrowseGraphic extendedDescription;
+
+ /**
+ * Constructs an initially empty description.
+ */
+ public DefaultDescription() {
+ }
+
+ /**
+ * Constructs a description initialized with the given text.
+ *
+ * @param text text description, or {@code null} if none.
+ */
+ public DefaultDescription(final CharSequence text) {
+ textDescription = Types.toInternationalString(text);
+ }
+
+ /**
+ * Constructs a new instance initialized with the values from the specified metadata object.
+ * This is a <cite>shallow</cite> 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(Description)
+ */
- public DefaultDescription(final Description object) {
++ public DefaultDescription(final DefaultDescription object) {
+ super(object);
+ if (object != null) {
+ textDescription = object.getTextDescription();
+ extendedDescription = object.getExtendedDescription();
+ }
+ }
+
- /**
- * Returns a SIS metadata implementation with the values of the given arbitrary implementation.
- * This method performs the first applicable action in the following choices:
- *
- * <ul>
- * <li>If the given object is {@code null}, then this method returns {@code null}.</li>
- * <li>Otherwise if the given object is already an instance of
- * {@code DefaultDescription}, then it is returned unchanged.</li>
- * <li>Otherwise a new {@code DefaultDescription} instance is created using the
- * {@linkplain #DefaultDescription(Description) copy constructor} and returned.
- * Note that this is a <cite>shallow</cite> copy operation, since the other
- * metadata contained in the given object are not recursively copied.</li>
- * </ul>
- *
- * @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 DefaultDescription castOrCopy(final Description object) {
- if (object == null || object instanceof DefaultDescription) {
- return (DefaultDescription) object;
- }
- return new DefaultDescription(object);
- }
-
+ /**
+ * Returns the text description.
+ *
+ * @return text description.
+ */
- @Override
+ @XmlElement(name = "textDescription", required = true)
+ public InternationalString getTextDescription() {
+ return textDescription;
+ }
+
+ /**
+ * Sets the text description.
+ *
+ * @param newValue the new description text.
+ */
+ public void setTextDescription(final InternationalString newValue) {
+ checkWritePermission(textDescription);
+ textDescription = newValue;
+ }
+
+ /**
+ * Returns the illustration.
+ *
+ * @return description illustration, or {@code null} if none.
+ */
- @Override
+ @XmlElement(name = "extendedDescription")
+ public BrowseGraphic getExtendedDescription() {
+ return extendedDescription;
+ }
+
+ /**
+ * Sets the illustration.
+ *
+ * @param newValue the new description illustration.
+ */
+ public void setExtendedDescription(final BrowseGraphic newValue) {
+ checkWritePermission(extendedDescription);
+ extendedDescription = newValue;
+ }
+ }
diff --cc core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultDescriptiveResult.java
index 0000000000,96b6c1dbe8..92d1c7d47f
mode 000000,100644..100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultDescriptiveResult.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultDescriptiveResult.java
@@@ -1,0 -1,142 +1,112 @@@
+ /*
+ * 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.quality;
+
+ import javax.xml.bind.annotation.XmlType;
+ import javax.xml.bind.annotation.XmlElement;
+ import javax.xml.bind.annotation.XmlRootElement;
+ import org.opengis.util.InternationalString;
-import org.opengis.metadata.quality.DescriptiveResult;
+ import org.apache.sis.util.iso.Types;
+
+
+ /**
+ * Data quality descriptive result.
- * See the {@link DescriptiveResult} GeoAPI interface for more details.
+ * The following properties are mandatory in a well-formed metadata according ISO 19157:
+ *
+ * <div class="preformat">{@code DQ_DescriptiveResult}
+ * {@code └─statement……………} textual expression of the descriptive result.</div>
+ *
+ * <h2>Limitations</h2>
+ * <ul>
+ * <li>Instances of this class are not synchronized for multi-threading.
+ * Synchronization, if needed, is caller's responsibility.</li>
+ * <li>Serialized objects of this class are not guaranteed to be compatible with future Apache SIS releases.
+ * Serialization support is appropriate for short term storage or RMI between applications running the
+ * same version of Apache SIS. For long term storage, use {@link org.apache.sis.xml.XML} instead.</li>
+ * </ul>
+ *
+ * @author Alexis Gaillard (Geomatys)
+ * @author Martin Desruisseaux (Geomatys)
+ * @version 1.3
+ * @since 1.3
+ * @module
+ */
+ @XmlType(name = "DQ_DescriptiveResult_Type", propOrder = {
+ "statement"
+ })
+ @XmlRootElement(name = "DQ_DescriptiveResult")
-public class DefaultDescriptiveResult extends AbstractResult implements DescriptiveResult {
++public class DefaultDescriptiveResult extends AbstractResult {
+ /**
+ * Serial number for inter-operability with different versions.
+ */
+ private static final long serialVersionUID = 5786649528259918304L;
+
+ /**
+ * Textual expression of the descriptive result.
+ */
+ @SuppressWarnings("serial")
+ private InternationalString statement;
+
+ /**
+ * Constructs an initially empty descriptive result.
+ */
+ public DefaultDescriptiveResult() {
+ }
+
+ /**
+ * Creates a conformance result initialized to the given values.
+ *
+ * @param text statement against which data is being evaluated, or {@code null}.
+ */
+ public DefaultDescriptiveResult(final CharSequence text) {
+ statement = Types.toInternationalString(text);
+ }
+
+ /**
+ * Constructs a new instance initialized with the values from the specified metadata object.
+ * This is a <cite>shallow</cite> 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(DescriptiveResult)
+ */
- public DefaultDescriptiveResult(final DescriptiveResult object) {
++ public DefaultDescriptiveResult(final DefaultDescriptiveResult object) {
+ super(object);
+ if (object != null) {
+ statement = object.getStatement();
+ }
+ }
+
- /**
- * Returns a SIS metadata implementation with the values of the given arbitrary implementation.
- * This method performs the first applicable action in the following choices:
- *
- * <ul>
- * <li>If the given object is {@code null}, then this method returns {@code null}.</li>
- * <li>Otherwise if the given object is already an instance of
- * {@code DefaultDescriptiveResult}, then it is returned unchanged.</li>
- * <li>Otherwise a new {@code DefaultDescriptiveResult} instance is created using the
- * {@linkplain #DefaultDescriptiveResult(DescriptiveResult) copy constructor} and returned.
- * Note that this is a <cite>shallow</cite> copy operation, since the other
- * metadata contained in the given object are not recursively copied.</li>
- * </ul>
- *
- * @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 DefaultDescriptiveResult castOrCopy(final DescriptiveResult object) {
- if (object == null || object instanceof DefaultDescriptiveResult) {
- return (DefaultDescriptiveResult) object;
- }
- return new DefaultDescriptiveResult(object);
- }
-
+ /**
+ * Returns the textual expression of the descriptive result.
+ *
+ * @return textual expression of the result.
+ */
- @Override
+ @XmlElement(name = "statement", required = true)
+ public InternationalString getStatement() {
+ return statement;
+ }
+
+ /**
+ * Sets the textual expression of the descriptive result.
+ *
+ * @param newValue the new expression.
+ */
+ public void setStatement(final InternationalString newValue) {
+ checkWritePermission(statement);
+ statement = newValue;
+ }
+ }
diff --cc core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultEvaluationMethod.java
index 5febb30461,dc9013c527..d541d32db1
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultEvaluationMethod.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultEvaluationMethod.java
@@@ -25,22 -25,13 +25,10 @@@ import javax.xml.bind.annotation.XmlTyp
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSeeAlso;
- import org.opengis.metadata.Identifier;
+ import org.opengis.util.InternationalString;
import org.opengis.metadata.citation.Citation;
- import org.opengis.metadata.quality.Result;
- import org.opengis.metadata.quality.Element;
- import org.opengis.metadata.quality.Usability;
- import org.opengis.metadata.quality.Completeness;
- import org.opengis.metadata.quality.TemporalAccuracy;
- import org.opengis.metadata.quality.ThematicAccuracy;
- import org.opengis.metadata.quality.PositionalAccuracy;
- import org.opengis.metadata.quality.LogicalConsistency;
-import org.opengis.metadata.quality.EvaluationMethod;
import org.opengis.metadata.quality.EvaluationMethodType;
- import org.opengis.util.InternationalString;
- import org.apache.sis.metadata.iso.ISOMetadata;
-import org.opengis.metadata.quality.DataEvaluation;
-import org.opengis.metadata.quality.AggregationDerivation;
import org.apache.sis.internal.system.Semaphores;
- import org.apache.sis.internal.jaxb.FilterByVersion;
- import org.apache.sis.internal.xml.LegacyNamespaces;
import org.apache.sis.util.collection.CheckedContainer;
import org.apache.sis.util.resources.Errors;
@@@ -49,11 -40,8 +37,7 @@@ import static org.apache.sis.internal.m
/**
- * Type of test applied to the data specified by a data quality scope.
- * The following property is mandatory in a well-formed metadata according ISO 19115:
- *
- * <div class="preformat">{@code DQ_Element}
- * {@code └─result……………} Value obtained from applying a data quality measure.</div>
+ * Description of the evaluation method and procedure applied.
- * See the {@link EvaluationMethod} GeoAPI interface for more details.
*
* <h2>Limitations</h2>
* <ul>
@@@ -78,19 -62,15 +58,15 @@@
"evaluationMethodType",
"evaluationMethodDescription",
"evaluationProcedure",
- "dates",
- "results"
+ "referenceDocuments",
+ "dates"
})
- @XmlRootElement(name = "AbstractDQ_Element")
+ @XmlRootElement(name = "DQ_EvaluationMethod")
@XmlSeeAlso({
- AbstractCompleteness.class,
- AbstractLogicalConsistency.class,
- AbstractPositionalAccuracy.class,
- AbstractThematicAccuracy.class,
- AbstractTemporalAccuracy.class,
- DefaultUsability.class
+ AbstractDataEvaluation.class,
+ DefaultAggregationDerivation.class
})
- public class AbstractElement extends ISOMetadata implements Element {
-public class DefaultEvaluationMethod extends ISOMetadata implements EvaluationMethod {
++public class DefaultEvaluationMethod extends ISOMetadata {
/**
* Serial number for inter-operability with different versions.
*/
@@@ -329,16 -274,13 +270,11 @@@
* This is a <cite>shallow</cite> 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(Element)
+ * @param object the metadata to copy values from, or {@code null} if none.
- *
- * @see #castOrCopy(EvaluationMethod)
*/
- public AbstractElement(final Element object) {
- public DefaultEvaluationMethod(final EvaluationMethod object) {
++ public DefaultEvaluationMethod(final DefaultEvaluationMethod object) {
super(object);
if (object != null) {
- namesOfMeasure = copyCollection(object.getNamesOfMeasure(), InternationalString.class);
- measureIdentification = object.getMeasureIdentification();
- measureDescription = object.getMeasureDescription();
evaluationMethodType = object.getEvaluationMethodType();
evaluationMethodDescription = object.getEvaluationMethodDescription();
evaluationProcedure = object.getEvaluationProcedure();
@@@ -347,136 -289,51 +283,14 @@@
}
}
- /**
- * Returns a SIS metadata implementation with the values of the given arbitrary implementation.
- * This method performs the first applicable action in the following choices:
- *
- * <ul>
- * <li>If the given object is {@code null}, then this method returns {@code null}.</li>
- * <li>Otherwise if the given object is an instance of {@link DataEvaluation} or {@link AggregationDerivation},
- * then this method delegates to the {@code castOrCopy(…)} method of the corresponding SIS subclass.
- * Note that if the given object implements more than one of the above-cited interfaces,
- * then the {@code castOrCopy(…)} method to be used is unspecified.</li>
- * <li>Otherwise if the given object is already an instance of
- * {@code DefaultEvaluationMethod}, then it is returned unchanged.</li>
- * <li>Otherwise a new {@code DefaultEvaluationMethod} instance is created using the
- * {@linkplain #DefaultEvaluationMethod(EvaluationMethod) copy constructor}
- * and returned. Note that this is a <cite>shallow</cite> copy operation, since the other
- * metadata contained in the given object are not recursively copied.</li>
- * </ul>
- *
- * @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 DefaultEvaluationMethod castOrCopy(final EvaluationMethod object) {
- if (object instanceof DataEvaluation) {
- return AbstractDataEvaluation.castOrCopy((DataEvaluation) object);
- }
- if (object instanceof AggregationDerivation) {
- return DefaultAggregationDerivation.castOrCopy((AggregationDerivation) object);
- }
- // Intentionally tested after the sub-interfaces.
- if (object == null || object instanceof DefaultEvaluationMethod) {
- return (DefaultEvaluationMethod) object;
- }
- return new DefaultEvaluationMethod(object);
- }
-
/**
- * Returns a SIS metadata implementation with the values of the given arbitrary implementation.
- * This method performs the first applicable action in the following choices:
- *
- * <ul>
- * <li>If the given object is {@code null}, then this method returns {@code null}.</li>
- * <li>Otherwise if the given object is an instance of {@link PositionalAccuracy},
- * {@link TemporalAccuracy}, {@link ThematicAccuracy}, {@link LogicalConsistency},
- * {@link Completeness} or {@link Usability}, then this method delegates to the
- * {@code castOrCopy(…)} method of the corresponding SIS subclass.
- * Note that if the given object implements more than one of the above-cited interfaces,
- * then the {@code castOrCopy(…)} method to be used is unspecified.</li>
- * <li>Otherwise if the given object is already an instance of
- * {@code AbstractElement}, then it is returned unchanged.</li>
- * <li>Otherwise a new {@code AbstractElement} instance is created using the
- * {@linkplain #AbstractElement(Element) copy constructor}
- * and returned. Note that this is a <cite>shallow</cite> copy operation, since the other
- * metadata contained in the given object are not recursively copied.</li>
- * </ul>
- *
- * @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 AbstractElement castOrCopy(final Element object) {
- if (object instanceof PositionalAccuracy) {
- return AbstractPositionalAccuracy.castOrCopy((PositionalAccuracy) object);
- }
- if (object instanceof TemporalAccuracy) {
- return AbstractTemporalAccuracy.castOrCopy((TemporalAccuracy) object);
- }
- if (object instanceof ThematicAccuracy) {
- return AbstractThematicAccuracy.castOrCopy((ThematicAccuracy) object);
- }
- if (object instanceof LogicalConsistency) {
- return AbstractLogicalConsistency.castOrCopy((LogicalConsistency) object);
- }
- if (object instanceof Completeness) {
- return AbstractCompleteness.castOrCopy((Completeness) object);
- }
- if (object instanceof Usability) {
- return DefaultUsability.castOrCopy((Usability) object);
- }
- // Intentionally tested after the sub-interfaces.
- if (object == null || object instanceof AbstractElement) {
- return (AbstractElement) object;
- }
- return new AbstractElement(object);
- }
-
- /**
- * Returns the name of the test applied to the data.
- *
- * @return name of the test applied to the data.
- *
- * @see <a href="https://issues.apache.org/jira/browse/SIS-394">Issue SIS-394</a>
- */
- @Override
- @XmlElement(name = "nameOfMeasure", namespace = LegacyNamespaces.GMD)
- public Collection<InternationalString> getNamesOfMeasure() {
- if (!FilterByVersion.LEGACY_METADATA.accept()) return null;
- return namesOfMeasure = nonNullCollection(namesOfMeasure, InternationalString.class);
- }
-
- /**
- * Sets the name of the test applied to the data.
- *
- * @param newValues the new name of measures.
- */
- public void setNamesOfMeasure(final Collection<? extends InternationalString> newValues) {
- namesOfMeasure = writeCollection(newValues, namesOfMeasure, InternationalString.class);
- }
-
- /**
- * Returns the code identifying a registered standard procedure, or {@code null} if none.
- *
- * @return code identifying a registered standard procedure, or {@code null}.
- *
- * @see <a href="https://issues.apache.org/jira/browse/SIS-394">Issue SIS-394</a>
- */
- @Override
- @XmlElement(name = "measureIdentification", namespace = LegacyNamespaces.GMD)
- public Identifier getMeasureIdentification() {
- return FilterByVersion.LEGACY_METADATA.accept() ? measureIdentification : null;
- }
-
- /**
- * Sets the code identifying a registered standard procedure.
- *
- * @param newValue the new measure identification.
- */
- public void setMeasureIdentification(final Identifier newValue) {
- checkWritePermission(measureIdentification);
- measureIdentification = newValue;
- }
-
- /**
- * Returns the description of the measure being determined.
- *
- * @return description of the measure being determined, or {@code null}.
+ * Returns the type of method used to evaluate quality of the data.
*
- * @see <a href="https://issues.apache.org/jira/browse/SIS-394">Issue SIS-394</a>
+ * @return type of method used to evaluate quality, or {@code null} if none.
*/
- @Override
- @XmlElement(name = "measureDescription", namespace = LegacyNamespaces.GMD)
- public InternationalString getMeasureDescription() {
- return FilterByVersion.LEGACY_METADATA.accept() ? measureDescription : null;
- }
-
- /**
- * Sets the description of the measure being determined.
- *
- * @param newValue the new measure description.
- */
- public void setMeasureDescription(final InternationalString newValue) {
- checkWritePermission(measureDescription);
- measureDescription = newValue;
- }
-
- /**
- * Returns the type of method used to evaluate quality of the dataset.
- *
- * @return type of method used to evaluate quality, or {@code null}.
- *
- * @see <a href="https://issues.apache.org/jira/browse/SIS-394">Issue SIS-394</a>
- */
-- @Override
- @XmlElement(name = "evaluationMethodType", namespace = LegacyNamespaces.GMD)
+ @XmlElement(name = "evaluationMethodType")
public EvaluationMethodType getEvaluationMethodType() {
- return FilterByVersion.LEGACY_METADATA.accept() ? evaluationMethodType : null;
+ return evaluationMethodType;
}
/**
@@@ -492,14 -349,12 +306,11 @@@
/**
* Returns the description of the evaluation method.
*
- * @return description of the evaluation method, or {@code null}.
- *
- * @see <a href="https://issues.apache.org/jira/browse/SIS-394">Issue SIS-394</a>
+ * @return description of the evaluation method, or {@code null} if none.
*/
-- @Override
- @XmlElement(name = "evaluationMethodDescription", namespace = LegacyNamespaces.GMD)
+ @XmlElement(name = "evaluationMethodDescription")
public InternationalString getEvaluationMethodDescription() {
- return FilterByVersion.LEGACY_METADATA.accept() ? evaluationMethodDescription : null;
+ return evaluationMethodDescription;
}
/**
@@@ -513,16 -368,14 +324,13 @@@
}
/**
- * Returns the reference to the procedure information, or {@code null} if none.
- *
- * @return reference to the procedure information, or {@code null}.
+ * Returns the reference to the procedure information.
*
- * @see <a href="https://issues.apache.org/jira/browse/SIS-394">Issue SIS-394</a>
+ * @return reference to the procedure information, or {@code null} if none.
*/
-- @Override
- @XmlElement(name = "evaluationProcedure", namespace = LegacyNamespaces.GMD)
+ @XmlElement(name = "evaluationProcedure")
public Citation getEvaluationProcedure() {
- return FilterByVersion.LEGACY_METADATA.accept() ? evaluationProcedure : null;
+ return evaluationProcedure;
}
/**
@@@ -535,6 -388,26 +343,25 @@@
evaluationProcedure = newValue;
}
+ /**
+ * Returns information on documents which are referenced in developing and applying a data quality evaluation method.
+ *
+ * @return documents referenced in data quality evaluation method.
+ */
- @Override
+ @XmlElement(name = "referenceDoc")
+ public Collection<Citation> getReferenceDocuments() {
+ return referenceDocuments = nonNullCollection(referenceDocuments, Citation.class);
+ }
+
+ /**
+ * Sets the information on documents referenced in data quality evaluation method.
+ *
+ * @param newValues the new name of measures.
+ */
+ public void setReferenceDocuments(final Collection<? extends Citation> newValues) {
+ referenceDocuments = writeCollection(newValues, referenceDocuments, Citation.class);
+ }
+
/**
* Returns the date or range of dates on which a data quality measure was applied.
* The collection size is 1 for a single date, or 2 for a range.
@@@ -542,8 -415,8 +369,7 @@@
*
* @return date or range of dates on which a data quality measure was applied.
*/
-- @Override
- @XmlElement(name = "dateTime", namespace = LegacyNamespaces.GMD)
+ @XmlElement(name = "dateTime")
@SuppressWarnings("ReturnOfCollectionOrArrayField")
public Collection<Date> getDates() {
if (Semaphores.query(Semaphores.NULL_COLLECTION)) {
diff --cc core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultFullInspection.java
index 0000000000,a2c82991a5..98e3e45c98
mode 000000,100644..100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultFullInspection.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultFullInspection.java
@@@ -1,0 -1,94 +1,65 @@@
+ /*
+ * 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.quality;
+
+ import javax.xml.bind.annotation.XmlType;
+ import javax.xml.bind.annotation.XmlRootElement;
-import org.opengis.metadata.quality.FullInspection;
+
+
+ /**
+ * Full inspection.
- * See the {@link FullInspection} GeoAPI interface for more details.
+ *
+ * <h2>Limitations</h2>
+ * <ul>
+ * <li>Instances of this class are not synchronized for multi-threading.
+ * Synchronization, if needed, is caller's responsibility.</li>
+ * <li>Serialized objects of this class are not guaranteed to be compatible with future Apache SIS releases.
+ * Serialization support is appropriate for short term storage or RMI between applications running the
+ * same version of Apache SIS. For long term storage, use {@link org.apache.sis.xml.XML} instead.</li>
+ * </ul>
+ *
+ * @author Alexis Gaillard (Geomatys)
+ * @author Martin Desruisseaux (Geomatys)
+ * @version 1.3
+ * @since 1.3
+ * @module
+ */
+ @XmlType(name = "DQ_FullInspection_Type")
+ @XmlRootElement(name = "DQ_FullInspection")
-public class DefaultFullInspection extends AbstractDataEvaluation implements FullInspection {
++public class DefaultFullInspection extends AbstractDataEvaluation {
+ /**
+ * Serial number for inter-operability with different versions.
+ */
+ private static final long serialVersionUID = 4610611512901660745L;
+
+ /**
+ * Constructs an initially empty Full Inspection.
+ */
+ public DefaultFullInspection() {
+ }
+
+ /**
+ * Constructs a new instance initialized with the values from the specified metadata object.
+ * This is a <cite>shallow</cite> 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(FullInspection)
+ */
- public DefaultFullInspection(final FullInspection object) {
++ public DefaultFullInspection(final DefaultFullInspection object) {
+ super(object);
+ }
-
- /**
- * Returns a SIS metadata implementation with the values of the given arbitrary implementation.
- * This method performs the first applicable action in the following choices:
- *
- * <ul>
- * <li>If the given object is {@code null}, then this method returns {@code null}.</li>
- * <li>Otherwise if the given object is already an instance of
- * {@code DefaultFullInspection}, then it is returned unchanged.</li>
- * <li>Otherwise a new {@code DefaultFullInspection} instance is created using the
- * {@linkplain #DefaultFullInspection(FullInspection) copy constructor}
- * and returned. Note that this is a <cite>shallow</cite> copy operation, since the other
- * metadata contained in the given object are not recursively copied.</li>
- * </ul>
- *
- * @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 DefaultFullInspection castOrCopy(final FullInspection object) {
- if (object == null || object instanceof DefaultFullInspection) {
- return (DefaultFullInspection) object;
- }
- return new DefaultFullInspection(object);
- }
+ }
diff --cc core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultHomogeneity.java
index 0000000000,79b30a6fd3..97c9012b9d
mode 000000,100644..100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultHomogeneity.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultHomogeneity.java
@@@ -1,0 -1,98 +1,69 @@@
+ /*
+ * 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.quality;
+
+ import javax.xml.bind.annotation.XmlType;
+ import javax.xml.bind.annotation.XmlRootElement;
-import org.opengis.metadata.quality.Homogeneity;
+
+
+ /**
+ * Expected or tested uniformity of the results obtained for a data quality evaluation.
- * See the {@link Homogeneity} GeoAPI interface for more details.
+ * The following properties are mandatory in a well-formed metadata according ISO 19157:
+ *
+ * <div class="preformat">{@code DQ_Homogeneity}
+ * {@code ├─result…………………………} Value obtained from applying a data quality measure.
+ * {@code └─derivedElement……} Derived element.</div>
+ *
+ * <h2>Limitations</h2>
+ * <ul>
+ * <li>Instances of this class are not synchronized for multi-threading.
+ * Synchronization, if needed, is caller's responsibility.</li>
+ * <li>Serialized objects of this class are not guaranteed to be compatible with future Apache SIS releases.
+ * Serialization support is appropriate for short term storage or RMI between applications running the
+ * same version of Apache SIS. For long term storage, use {@link org.apache.sis.xml.XML} instead.</li>
+ * </ul>
+ *
+ * @author Alexis Gaillard (Geomatys)
+ * @author Martin Desruisseaux (Geomatys)
+ * @version 1.3
+ * @since 1.3
+ * @module
+ */
+ @XmlType(name = "DQ_Homogeneity_Type")
+ @XmlRootElement(name = "DQ_Homogeneity")
-public class DefaultHomogeneity extends AbstractMetaquality implements Homogeneity {
++public class DefaultHomogeneity extends AbstractMetaquality {
+ /**
+ * Serial number for inter-operability with different versions.
+ */
+ private static final long serialVersionUID = -8440822895642971849L;
+ /**
+ * Constructs an initially empty aggregation derivation.
+ */
+ public DefaultHomogeneity() {
+ }
+
+ /**
+ * Constructs a new instance initialized with the values from the specified metadata object.
+ * This is a <cite>shallow</cite> 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(Homogeneity)
+ */
- public DefaultHomogeneity(final Homogeneity object) {
++ public DefaultHomogeneity(final DefaultHomogeneity object) {
+ super(object);
+ }
-
- /**
- * Returns a SIS metadata implementation with the values of the given arbitrary implementation.
- * This method performs the first applicable action in the following choices:
- *
- * <ul>
- * <li>If the given object is {@code null}, then this method returns {@code null}.</li>
- * <li>Otherwise if the given object is already an instance of
- * {@code DefaultHomogeneity}, then it is returned unchanged.</li>
- * <li>Otherwise a new {@code DefaultHomogeneity} instance is created using the
- * {@linkplain #DefaultHomogeneity(Homogeneity) copy constructor}
- * and returned. Note that this is a <cite>shallow</cite> copy operation, since the other
- * metadata contained in the given object are not recursively copied.</li>
- * </ul>
- *
- * @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 DefaultHomogeneity castOrCopy(final Homogeneity object) {
- if (object == null || object instanceof DefaultHomogeneity) {
- return (DefaultHomogeneity) object;
- }
- return new DefaultHomogeneity(object);
- }
+ }
diff --cc core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultIndirectEvaluation.java
index 0000000000,474eebaf4a..17c138a4e7
mode 000000,100644..100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultIndirectEvaluation.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultIndirectEvaluation.java
@@@ -1,0 -1,142 +1,112 @@@
+ /*
+ * 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.quality;
+
+ import javax.xml.bind.annotation.XmlType;
+ import javax.xml.bind.annotation.XmlElement;
+ import javax.xml.bind.annotation.XmlRootElement;
+ import org.opengis.util.InternationalString;
-import org.opengis.metadata.quality.IndirectEvaluation;
+ import org.apache.sis.util.iso.Types;
+
+
+ /**
+ * Indirect evaluation.
- * See the {@link IndirectEvaluation} GeoAPI interface for more details.
+ * The following properties are mandatory in a well-formed metadata according ISO 19157:
+ *
+ * <div class="preformat">{@code DQ_IndirectEvaluation}
+ * {@code └─deductiveSource……………} Information on which data are used as sources in deductive evaluation method.</div>
+ *
+ * <h2>Limitations</h2>
+ * <ul>
+ * <li>Instances of this class are not synchronized for multi-threading.
+ * Synchronization, if needed, is caller's responsibility.</li>
+ * <li>Serialized objects of this class are not guaranteed to be compatible with future Apache SIS releases.
+ * Serialization support is appropriate for short term storage or RMI between applications running the
+ * same version of Apache SIS. For long term storage, use {@link org.apache.sis.xml.XML} instead.</li>
+ * </ul>
+ *
+ * @author Alexis Gaillard (Geomatys)
+ * @author Martin Desruisseaux (Geomatys)
+ * @version 1.3
+ * @since 1.3
+ * @module
+ */
+ @XmlType(name = "DQ_IndirectEvaluation_Type", propOrder = {
+ "deductiveSource"
+ })
+ @XmlRootElement(name = "DQ_IndirectEvaluation")
-public class DefaultIndirectEvaluation extends AbstractDataEvaluation implements IndirectEvaluation {
++public class DefaultIndirectEvaluation extends AbstractDataEvaluation {
+ /**
+ * Serial number for inter-operability with different versions.
+ */
+ private static final long serialVersionUID = 5634950981839012526L;
+
+ /**
+ * Information on which data are used as sources in deductive evaluation method.
+ */
+ @SuppressWarnings("serial")
+ private InternationalString deductiveSource;
+
+ /**
+ * Constructs an initially empty descriptive result.
+ */
+ public DefaultIndirectEvaluation() {
+ }
+
+ /**
+ * Creates a conformance result initialized to the given values.
+ *
+ * @param source information on which data are used as sources, or {@code null}.
+ */
+ public DefaultIndirectEvaluation(final CharSequence source) {
+ deductiveSource = Types.toInternationalString(source);
+ }
+
+ /**
+ * Constructs a new instance initialized with the values from the specified metadata object.
+ * This is a <cite>shallow</cite> 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(IndirectEvaluation)
+ */
- public DefaultIndirectEvaluation(final IndirectEvaluation object) {
++ public DefaultIndirectEvaluation(final DefaultIndirectEvaluation object) {
+ super(object);
+ if (object != null) {
+ deductiveSource = object.getDeductiveSource();
+ }
+ }
+
- /**
- * Returns a SIS metadata implementation with the values of the given arbitrary implementation.
- * This method performs the first applicable action in the following choices:
- *
- * <ul>
- * <li>If the given object is {@code null}, then this method returns {@code null}.</li>
- * <li>Otherwise if the given object is already an instance of
- * {@code DefaultIndirectEvaluation}, then it is returned unchanged.</li>
- * <li>Otherwise a new {@code DefaultIndirectEvaluation} instance is created using the
- * {@linkplain #DefaultIndirectEvaluation(IndirectEvaluation) copy constructor}
- * and returned. Note that this is a <cite>shallow</cite> copy operation, since the other
- * metadata contained in the given object are not recursively copied.</li>
- * </ul>
- *
- * @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 DefaultIndirectEvaluation castOrCopy(final IndirectEvaluation object) {
- if (object == null || object instanceof DefaultIndirectEvaluation) {
- return (DefaultIndirectEvaluation) object;
- }
- return new DefaultIndirectEvaluation(object);
- }
-
+ /**
+ * Returns the information on which data are used as sources in deductive evaluation method.
+ *
+ * @return information on which data are used.
+ */
- @Override
+ @XmlElement(name = "deductiveSource", required = true)
+ public InternationalString getDeductiveSource() {
+ return deductiveSource;
+ }
+
+ /**
+ * Sets the information on which data are used as sources in deductive evaluation method.
+ *
+ * @param newValue the new information.
+ */
+ public void setDeductiveSource(final InternationalString newValue) {
+ checkWritePermission(deductiveSource);
+ deductiveSource = newValue;
+ }
+ }
diff --cc core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultMeasure.java
index 0000000000,6ab9a82c89..8bba7fa959
mode 000000,100644..100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultMeasure.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultMeasure.java
@@@ -1,0 -1,469 +1,397 @@@
+ /*
+ * 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.quality;
+
+ import java.util.Collection;
+ import javax.xml.bind.annotation.XmlType;
+ import javax.xml.bind.annotation.XmlElement;
+ import javax.xml.bind.annotation.XmlRootElement;
+ import org.opengis.util.TypeName;
+ import org.opengis.util.InternationalString;
+ import org.opengis.parameter.ParameterDescriptor;
+ import org.opengis.metadata.Identifier;
-import org.opengis.metadata.quality.Measure;
-import org.opengis.metadata.quality.BasicMeasure;
-import org.opengis.metadata.quality.Description;
-import org.opengis.metadata.quality.SourceReference;
-import org.opengis.metadata.quality.ValueStructure;
+ import org.apache.sis.xml.Namespaces;
+
+
+ /**
+ * Data quality measure.
- * See the {@link Measure} GeoAPI interface for more details.
+ * The following properties are mandatory in a well-formed metadata according ISO 19157:
+ *
+ * <div class="preformat">{@code DQM_Measure}
+ * {@code ├─measureIdentifier……} Value uniquely identifying the measure within a namespace.
+ * {@code ├─name………………………………………} Name of the data quality measure applied to the data.
+ * {@code ├─elementName……………………} Name of the data quality element for which quality is reported.
+ * {@code ├─definition………………………} Definition of the fundamental concept for the data quality measure.
+ * {@code └─valueType…………………………} Value type for reporting a data quality result (shall be one of the data types defined in ISO/19103:2005).</div>
+ *
+ * <h2>Limitations</h2>
+ * <ul>
+ * <li>Instances of this class are not synchronized for multi-threading.
+ * Synchronization, if needed, is caller's responsibility.</li>
+ * <li>Serialized objects of this class are not guaranteed to be compatible with future Apache SIS releases.
+ * Serialization support is appropriate for short term storage or RMI between applications running the
+ * same version of Apache SIS. For long term storage, use {@link org.apache.sis.xml.XML} instead.</li>
+ * </ul>
+ *
+ * @author Alexis Gaillard (Geomatys)
+ * @author Martin Desruisseaux (Geomatys)
+ * @version 1.3
+ * @since 1.3
+ * @module
+ */
+ @XmlType(name = "DQM_Measure_Type", namespace = Namespaces.DQM, propOrder = {
+ "measureIdentifier",
+ "name",
+ "aliases",
+ "elementNames",
+ "definition",
+ "description",
+ "valueType",
- "valueStructure",
+ "examples",
+ "basicMeasure",
+ "sourceReferences",
+ "parameters"
+ })
+ @XmlRootElement(name = "DQM_Measure", namespace = Namespaces.DQM)
-public class DefaultMeasure extends ISOMetadata implements Measure {
++public class DefaultMeasure extends ISOMetadata {
+ /**
+ * Serial number for inter-operability with different versions.
+ */
+ private static final long serialVersionUID = -2004468907779670827L;
+
+ /**
+ * Value uniquely identifying the measure within a namespace.
+ */
+ @SuppressWarnings("serial")
+ private Identifier measureIdentifier;
+
+ /**
+ * Name of the data quality measure applied to the data.
+ */
+ @SuppressWarnings("serial")
+ private InternationalString name;
+
+ /**
+ * Another recognized name, an abbreviation or a short name for the same data quality measure.
+ */
+ @SuppressWarnings("serial")
+ private Collection<InternationalString> aliases;
+
+ /**
+ * Name of the data quality element for which quality is reported.
+ */
+ @SuppressWarnings("serial")
+ private Collection<TypeName> elementNames;
+
+ /**
+ * Definition of the fundamental concept for the data quality measure.
+ */
+ @SuppressWarnings("serial")
- private BasicMeasure basicMeasure;
++ private DefaultBasicMeasure basicMeasure;
+
+ /**
+ * Definition of the fundamental concept for the data quality measure.
+ */
+ @SuppressWarnings("serial")
+ private InternationalString definition;
+
+ /**
+ * Description of the data quality measure.
+ * Includes methods of calculation, with all formulae and/or illustrations
+ * needed to establish the result of applying the measure.
+ */
+ @SuppressWarnings("serial")
- private Description description;
++ private DefaultDescription description;
+
+ /**
+ * Reference to the source of an item that has been adopted from an external source.
+ */
+ @SuppressWarnings("serial")
- private Collection<SourceReference> sourceReferences;
++ private Collection<DefaultSourceReference> sourceReferences;
+
+ /**
+ * Value type for reporting a data quality result.
+ */
+ @SuppressWarnings("serial")
+ private TypeName valueType;
+
- /**
- * Structure for reporting a complex data quality result.
- */
- private ValueStructure valueStructure;
-
+ /**
+ * Auxiliary variable used by the data quality measure, including its name, definition and optionally its description.
+ */
+ @SuppressWarnings("serial")
+ private Collection<ParameterDescriptor<?>> parameters;
+
+ /**
+ * Illustration of the use of a data quality measure.
+ */
+ @SuppressWarnings("serial")
- private Collection<Description> examples;
++ private Collection<DefaultDescription> examples;
+
+ /**
+ * Constructs an initially empty element.
+ */
+ public DefaultMeasure() {
+ }
+
+ /**
+ * Constructs a new instance initialized with the values from the specified metadata object.
+ * This is a <cite>shallow</cite> 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(Measure)
+ */
+ @SuppressWarnings({"unchecked", "rawtypes"})
- public DefaultMeasure(final Measure object) {
++ public DefaultMeasure(final DefaultMeasure object) {
+ super(object);
+ if (object != null) {
+ measureIdentifier = object.getMeasureIdentifier();
+ name = object.getName();
+ aliases = copyCollection(object.getAliases(), InternationalString.class);
+ elementNames = copyCollection(object.getElementNames(), TypeName.class);
+ definition = object.getDefinition();
+ description = object.getDescription();
+ valueType = object.getValueType();
- valueStructure = object.getValueStructure();
- examples = copyCollection(object.getExamples(), Description.class);
++ examples = copyCollection(object.getExamples(), DefaultDescription.class);
+ basicMeasure = object.getBasicMeasure();
- sourceReferences = copyCollection(object.getSourceReferences(), SourceReference.class);
++ sourceReferences = copyCollection(object.getSourceReferences(), DefaultSourceReference.class);
+ parameters = copyCollection(object.getParameters(), (Class) ParameterDescriptor.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:
- *
- * <ul>
- * <li>If the given object is {@code null}, then this method returns {@code null}.</li>
- * <li>Otherwise if the given object is already an instance of
- * {@code DefaultMeasure}, then it is returned unchanged.</li>
- * <li>Otherwise a new {@code DefaultMeasure} instance is created using the
- * {@linkplain #DefaultMeasure(Measure) copy constructor} and returned.
- * Note that this is a <cite>shallow</cite> copy operation, since the other
- * metadata contained in the given object are not recursively copied.</li>
- * </ul>
- *
- * @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 DefaultMeasure castOrCopy(final Measure object) {
- if (object instanceof DefaultMeasure) {
- return (DefaultMeasure) object;
- }
- return new DefaultMeasure(object);
- }
-
+ /**
+ * Returns the value uniquely identifying the measure within a namespace.
+ *
+ * @return value uniquely identifying the measure within a namespace.
+ */
- @Override
+ @XmlElement(name = "measureIdentifier", required = true)
+ public Identifier getMeasureIdentifier() {
+ return measureIdentifier;
+ }
+
+ /**
+ * Sets the value uniquely identifying the measure within a namespace.
+ *
+ * @param newValue the new measure identification.
+ */
+ public void setMeasureIdentifier(final Identifier newValue) {
+ checkWritePermission(measureIdentifier);
+ measureIdentifier = newValue;
+ }
+
+ /**
+ * Returns the name of the data quality measure applied to the data.
+ *
+ * @return name of the data quality measure applied to the data.
+ */
- @Override
+ @XmlElement(name = "name", required = true)
+ public InternationalString getName() {
+ return name;
+ }
+
+ /**
+ * Sets the name of the data quality measure applied to the data.
+ *
+ * @param newValue the new quality measure name.
+ */
+ public void setName(final InternationalString newValue) {
+ checkWritePermission(name);
+ name = newValue;
+ }
+
+ /**
+ * Returns other recognized names, abbreviations or short names for the same data quality measure.
+ * It may be a different commonly used name, or an abbreviation, or a short name.
+ *
+ * @return others recognized names, abbreviations or short names.
+ */
- @Override
+ @XmlElement(name = "alias")
+ public Collection<InternationalString> getAliases() {
+ return aliases = nonNullCollection(aliases, InternationalString.class);
+ }
+
+ /**
+ * Sets other recognized names or abbreviations for the same data quality measure.
+ *
+ * @param newValues the new measure aliases.
+ */
+ public void setAliases(final Collection<? extends InternationalString> newValues) {
+ aliases = writeCollection(newValues, aliases, InternationalString.class);
+ }
+
+ /**
+ * Returns the names of the data quality element to which a measure applies.
+ *
+ * @return names of the data quality element for which quality is reported.
+ */
- @Override
+ @XmlElement(name = "elementName", required = true)
+ public Collection<TypeName> getElementNames() {
+ return elementNames = nonNullCollection(elementNames, TypeName.class);
+ }
+
+ /**
+ * Sets the name of the data quality element for which quality is reported.
+ *
+ * @param newValues the new measure element names.
+ */
+ public void setElementNames(final Collection<? extends TypeName> newValues) {
+ elementNames = writeCollection(newValues, elementNames, TypeName.class);
+ }
+
+ /**
+ * Returns predefined basic measure on which this measure is based.
+ *
+ * @return predefined basic measure on which this measure is based, or {@code null} if none.
+ */
- @Override
+ @XmlElement(name = "basicMeasure")
- public BasicMeasure getBasicMeasure() {
++ public DefaultBasicMeasure getBasicMeasure() {
+ return basicMeasure;
+ }
+
+ /**
+ * Sets the predefined basic measure on which this measure is based.
+ *
+ * @param newValue the new basic measure.
+ */
- public void setBasicMeasure(final BasicMeasure newValue) {
++ public void setBasicMeasure(final DefaultBasicMeasure newValue) {
+ checkWritePermission(basicMeasure);
+ basicMeasure = newValue;
+ }
+
+ /**
+ * Returns the definition of the fundamental concept for the data quality measure.
+ * If the measure is derived from a {@linkplain #getBasicMeasure() basic measure},
+ * the definition is based on the basic measure definition and specialized for this measure.
+ *
+ * @return definition of the fundamental concept for the data quality measure.
+ */
- @Override
+ @XmlElement(name = "definition", required = true)
+ public InternationalString getDefinition() {
+ return definition;
+ }
+
+ /**
+ * Sets the definition of the fundamental concept for the data quality measure.
+ *
+ * @param newValue the new measure definition.
+ */
+ public void setDefinition(final InternationalString newValue) {
+ checkWritePermission(definition);
+ definition = newValue;
+ }
+
+ /**
+ * Description of the data quality measure.
+ * Includes methods of calculation, with all formulae and/or illustrations
+ * needed to establish the result of applying the measure.
+ *
+ * @return description of data quality measure, or {@code null} if none.
+ */
- @Override
+ @XmlElement(name = "description")
- public Description getDescription() {
++ public DefaultDescription getDescription() {
+ return description;
+ }
+
+ /**
+ * Sets the description of the data quality measure.
+ *
+ * @param newValue the new measure description.
+ */
- public void setDescription(final Description newValue) {
++ public void setDescription(final DefaultDescription newValue) {
+ checkWritePermission(description);
+ description = newValue;
+ }
+
+ /**
+ * Returns references to the source of an item that has been adopted from an external source.
+ *
+ * @return references to the source.
+ */
- @Override
+ @XmlElement(name = "sourceReference")
- public Collection<SourceReference> getSourceReferences() {
- return sourceReferences = nonNullCollection(sourceReferences, SourceReference.class);
++ public Collection<DefaultSourceReference> getSourceReferences() {
++ return sourceReferences = nonNullCollection(sourceReferences, DefaultSourceReference.class);
+ }
+
+ /**
+ * Sets the reference to the source of an item that has been adopted from an external source.
+ *
+ * @param newValues the new source references.
+ */
- public void setSourceReferences(final Collection<? extends SourceReference> newValues) {
- sourceReferences = writeCollection(newValues, sourceReferences, SourceReference.class);
++ public void setSourceReferences(final Collection<? extends DefaultSourceReference> newValues) {
++ sourceReferences = writeCollection(newValues, sourceReferences, DefaultSourceReference.class);
+ }
+
+ /**
+ * Returns the value type for reporting a data quality result.
+ *
+ * @return value type for reporting a data quality result.
+ */
- @Override
+ @XmlElement(name = "valueType", required = true)
+ public TypeName getValueType() {
+ return valueType;
+ }
+
+ /**
+ * Sets the value type for reporting a data quality result.
+ *
+ * @param newValue the new measure value type.
+ */
+ public void setValueType(final TypeName newValue) {
+ checkWritePermission(valueType);
+ valueType = newValue;
+ }
+
- /**
- * Returns the structure for reporting a complex data quality result.
- *
- * @return structure for reporting a complex data quality result, or {@code null} if none.
- */
- @Override
- @XmlElement(name = "valueStructure")
- public ValueStructure getValueStructure() {
- return valueStructure;
- }
-
- /**
- * Sets the structure for reporting a complex data quality result.
- *
- * @param newValue the new measure value structure.
- */
- public void setValueStructure(final ValueStructure newValue) {
- checkWritePermission(valueStructure);
- valueStructure = newValue;
- }
-
+ /**
+ * Returns auxiliary variable(s) used by the data quality measure.
+ * It shall include its name, definition and value type.
+ *
+ * @return auxiliary variable(s) used by data quality measure.
+ */
- @Override
+ @XmlElement(name = "parameter")
+ @SuppressWarnings({"unchecked", "rawtypes"})
+ public Collection<ParameterDescriptor<?>> getParameters() {
+ return parameters = nonNullCollection(parameters, (Class) ParameterDescriptor.class);
+ }
+
+ /**
+ * Sets the auxiliary variable used by the data quality measure.
+ *
+ * @param newValues the new measure parameters.
+ */
+ @SuppressWarnings({"unchecked", "rawtypes"})
+ public void setParameters(final Collection<? extends ParameterDescriptor<?>> newValues) {
+ parameters = writeCollection(newValues, parameters, (Class) ParameterDescriptor.class);
+ }
+
+ /**
+ * Returns illustrations of the use of a data quality measure.
+ *
+ * @return examples of applying the measure or the result obtained for the measure.
+ */
- @Override
+ @XmlElement(name = "example")
- public Collection<Description> getExamples() {
- return examples = nonNullCollection(examples, Description.class);
++ public Collection<DefaultDescription> getExamples() {
++ return examples = nonNullCollection(examples, DefaultDescription.class);
+ }
+
+ /**
+ * Sets the illustrations of the use of a data quality measure.
+ *
+ * @param newValues the new examples.
+ */
- public void setExamples(final Collection<? extends Description> newValues) {
- examples = writeCollection(newValues, examples, Description.class);
++ public void setExamples(final Collection<? extends DefaultDescription> newValues) {
++ examples = writeCollection(newValues, examples, DefaultDescription.class);
+ }
+ }
diff --cc core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultMeasureReference.java
index 0000000000,60283f4a61..13df93f65f
mode 000000,100644..100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultMeasureReference.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultMeasureReference.java
@@@ -1,0 -1,201 +1,169 @@@
+ /*
+ * 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.quality;
+
+
+ import java.util.Collection;
+ import javax.xml.bind.annotation.XmlType;
+ import javax.xml.bind.annotation.XmlElement;
+ import javax.xml.bind.annotation.XmlRootElement;
+ import org.opengis.util.InternationalString;
+ import org.opengis.metadata.Identifier;
+ import org.opengis.metadata.quality.Element;
-import org.opengis.metadata.quality.MeasureReference;
+ import org.apache.sis.internal.util.CollectionsExt;
+
+
+ /**
+ * Reference to the measure used.
- * See the {@link MeasureReference} GeoAPI interface for more details.
+ *
+ * <h2>Limitations</h2>
+ * <ul>
+ * <li>Instances of this class are not synchronized for multi-threading.
+ * Synchronization, if needed, is caller's responsibility.</li>
+ * <li>Serialized objects of this class are not guaranteed to be compatible with future Apache SIS releases.
+ * Serialization support is appropriate for short term storage or RMI between applications running the
+ * same version of Apache SIS. For long term storage, use {@link org.apache.sis.xml.XML} instead.</li>
+ * </ul>
+ *
+ * @author Alexis Gaillard (Geomatys)
+ * @author Martin Desruisseaux (Geomatys)
+ * @version 1.3
+ * @since 1.3
+ * @module
+ */
+ @XmlType(name = "DQ_MeasureReference_Type", propOrder = {
+ "measureIdentification",
+ "namesOfMeasure",
+ "measureDescription"
+ })
+ @XmlRootElement(name = "DQ_MeasureReference")
-public class DefaultMeasureReference extends ISOMetadata implements MeasureReference {
++public class DefaultMeasureReference extends ISOMetadata {
+ /**
+ * Serial number for inter-operability with different versions.
+ */
+ private static final long serialVersionUID = -1841855681786546466L;
+
+ /**
+ * Value uniquely identifying the measure within a namespace.
+ */
+ @SuppressWarnings("serial")
+ private Identifier measureIdentification;
+
+ /**
+ * Name of the test applied to the data.
+ */
+ @SuppressWarnings("serial")
+ private Collection<InternationalString> namesOfMeasure;
+
+ /**
+ * Description of the measure.
+ */
+ @SuppressWarnings("serial")
+ private InternationalString measureDescription;
+
+ /**
+ * Constructs an initially empty measure reference.
+ */
+ public DefaultMeasureReference() {
+ }
+
+ /**
+ * Constructs a new instance initialized with the values from the specified metadata object.
+ * This is a <cite>shallow</cite> 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(MeasureReference)
+ */
- public DefaultMeasureReference(final MeasureReference object) {
++ public DefaultMeasureReference(final DefaultMeasureReference object) {
+ super(object);
+ if (object != null) {
+ measureIdentification = object.getMeasureIdentification();
+ measureDescription = object.getMeasureDescription();
+ namesOfMeasure = copyCollection(object.getNamesOfMeasure(), InternationalString.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:
- *
- * <ul>
- * <li>If the given object is {@code null}, then this method returns {@code null}.</li>
- * <li>Otherwise if the given object is already an instance of
- * {@code DefaultMeasureReference}, then it is returned unchanged.</li>
- * <li>Otherwise a new {@code DefaultMeasureReference} instance is created using the
- * {@linkplain #DefaultMeasureReference(MeasureReference) copy constructor}
- * and returned. Note that this is a <cite>shallow</cite> copy operation, since the other
- * metadata contained in the given object are not recursively copied.</li>
- * </ul>
- *
- * @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 DefaultMeasureReference castOrCopy(final MeasureReference object) {
- if (object == null || object instanceof DefaultMeasureReference) {
- return (DefaultMeasureReference) object;
- }
- return new DefaultMeasureReference(object);
- }
-
+ /**
+ * Initializes a measure reference from the deprecated properties of the given element.
+ * This is used for transition from legacy ISO 19115 to newer ISO 19157 model.
+ */
+ @SuppressWarnings("deprecation")
+ final boolean setLegacy(final Element element) {
+ return (null != (measureIdentification = element.getMeasureIdentification()))
+ | (null != (namesOfMeasure = copyCollection(element.getNamesOfMeasure(), InternationalString.class)))
+ | (null != (measureDescription = CollectionsExt.first(element.getNamesOfMeasure())));
+ }
+
+ /**
+ * Returns a value uniquely identifying the measure within a namespace.
+ *
+ * @return code identifying a registered measure, or {@code null} if none.
+ */
- @Override
+ @XmlElement(name = "measureIdentification")
+ public Identifier getMeasureIdentification() {
+ return measureIdentification;
+ }
+
+ /**
+ * Sets the identifier of the measure.
+ *
+ * @param newValue the new measure identification.
+ */
+ public void setMeasureIdentification(final Identifier newValue) {
+ checkWritePermission(measureIdentification);
+ measureIdentification = newValue;
+ }
+
+ /**
+ * Returns the names of the test applied to the data.
+ *
+ * @return names of the test applied to the data.
+ */
- @Override
+ @XmlElement(name = "nameOfMeasure")
+ public Collection<InternationalString> getNamesOfMeasure() {
+ return namesOfMeasure = nonNullCollection(namesOfMeasure, InternationalString.class);
+ }
+
+ /**
+ * Sets the names of the test applied to the data.
+ *
+ * @param newValues the new name of measures.
+ */
+ public void setNamesOfMeasure(final Collection<? extends InternationalString> newValues) {
+ namesOfMeasure = writeCollection(newValues, namesOfMeasure, InternationalString.class);
+ }
+
+ /**
+ * Returns the description of the measure.
+ *
+ * @return description of the measure, or {@code null}.
+ */
- @Override
+ @XmlElement(name = "measureDescription")
+ public InternationalString getMeasureDescription() {
+ return measureDescription;
+ }
+
+ /**
+ * Sets the description of the measure.
+ *
+ * @param newValue the new measure description.
+ */
+ public void setMeasureDescription(final InternationalString newValue) {
+ checkWritePermission(measureDescription);
+ measureDescription = newValue;
+ }
+ }
diff --cc core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultNonQuantitativeAttributeCorrectness.java
index 98d462774e,c5f707fa2f..70e6ed7393
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultNonQuantitativeAttributeCorrectness.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultNonQuantitativeAttributeCorrectness.java
@@@ -17,16 -17,18 +17,16 @@@
package org.apache.sis.metadata.iso.quality;
import javax.xml.bind.annotation.XmlType;
+ import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlRootElement;
import org.opengis.metadata.quality.NonQuantitativeAttributeAccuracy;
- import org.apache.sis.internal.xml.LegacyNamespaces;
-import org.opengis.metadata.quality.NonQuantitativeAttributeCorrectness;
/**
- * Accuracy of non-quantitative attributes.
- * The following property is mandatory in a well-formed metadata according ISO 19115:
+ * Correctness of non-quantitative attributes.
- * See the {@link NonQuantitativeAttributeCorrectness} GeoAPI interface for more details.
+ * The following property is mandatory in a well-formed metadata according ISO 19157:
*
- * <div class="preformat">{@code DQ_NonQuantitativeAttributeAccuracy}
+ * <div class="preformat">{@code DQ_CompletenessOmission}
* {@code └─result……………} Value obtained from applying a data quality measure.</div>
*
* <h2>Limitations</h2>
@@@ -38,15 -40,19 +38,19 @@@
* same version of Apache SIS. For long term storage, use {@link org.apache.sis.xml.XML} instead.</li>
* </ul>
*
- * @author Martin Desruisseaux (IRD, Geomatys)
- * @version 1.0
- * @since 0.3
+ * @author Martin Desruisseaux (Geomatys)
+ * @author Alexis Gaillard (Geomatys)
+ * @version 1.3
+ * @since 1.3
* @module
*/
- @XmlType(name = "DQ_NonQuantitativeAttributeAccuracy_Type", namespace = LegacyNamespaces.GMD) // TODO: renamed NonQuantitativeAttributeCorrectness
- @XmlRootElement(name = "DQ_NonQuantitativeAttributeAccuracy", namespace = LegacyNamespaces.GMD)
- public class DefaultNonQuantitativeAttributeAccuracy extends AbstractThematicAccuracy
+ @XmlType(name = "DQ_NonQuantitativeAttributeCorrectness_Type")
+ @XmlRootElement(name = "DQ_NonQuantitativeAttributeCorrectness")
+ @XmlSeeAlso({
+ DefaultNonQuantitativeAttributeAccuracy.class
+ })
+ public class DefaultNonQuantitativeAttributeCorrectness extends AbstractThematicAccuracy
- implements NonQuantitativeAttributeCorrectness
+ implements NonQuantitativeAttributeAccuracy
{
/**
* Serial number for inter-operability with different versions.
@@@ -66,9 -72,9 +70,9 @@@
*
* @param object the metadata to copy values from, or {@code null} if none.
*
- * @see #castOrCopy(NonQuantitativeAttributeCorrectness)
+ * @see #castOrCopy(NonQuantitativeAttributeAccuracy)
*/
- public DefaultNonQuantitativeAttributeAccuracy(final NonQuantitativeAttributeAccuracy object) {
- public DefaultNonQuantitativeAttributeCorrectness(final NonQuantitativeAttributeCorrectness object) {
++ public DefaultNonQuantitativeAttributeCorrectness(final NonQuantitativeAttributeAccuracy object) {
super(object);
}
@@@ -79,9 -85,9 +83,9 @@@
* <ul>
* <li>If the given object is {@code null}, then this method returns {@code null}.</li>
* <li>Otherwise if the given object is already an instance of
- * {@code DefaultNonQuantitativeAttributeAccuracy}, then it is returned unchanged.</li>
- * <li>Otherwise a new {@code DefaultNonQuantitativeAttributeAccuracy} instance is created using the
- * {@linkplain #DefaultNonQuantitativeAttributeAccuracy(NonQuantitativeAttributeAccuracy) copy constructor}
+ * {@code DefaultNonQuantitativeAttributeCorrectness}, then it is returned unchanged.</li>
+ * <li>Otherwise a new {@code DefaultNonQuantitativeAttributeCorrectness} instance is created using the
- * {@linkplain #DefaultNonQuantitativeAttributeCorrectness(NonQuantitativeAttributeCorrectness) copy constructor}
++ * {@linkplain #DefaultNonQuantitativeAttributeCorrectness(NonQuantitativeAttributeAccuracy) copy constructor}
* and returned. Note that this is a <cite>shallow</cite> copy operation, since the other
* metadata contained in the given object are not recursively copied.</li>
* </ul>
@@@ -90,10 -96,14 +94,11 @@@
* @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 DefaultNonQuantitativeAttributeAccuracy castOrCopy(final NonQuantitativeAttributeAccuracy object) {
- if (object == null || object instanceof DefaultNonQuantitativeAttributeAccuracy) {
- return (DefaultNonQuantitativeAttributeAccuracy) object;
+ @SuppressWarnings("deprecation")
- public static DefaultNonQuantitativeAttributeCorrectness castOrCopy(final NonQuantitativeAttributeCorrectness object) {
- if (object instanceof NonQuantitativeAttributeAccuracy) {
- return DefaultNonQuantitativeAttributeAccuracy.castOrCopy((NonQuantitativeAttributeAccuracy) object);
- }
++ public static DefaultNonQuantitativeAttributeCorrectness castOrCopy(final NonQuantitativeAttributeAccuracy object) {
+ if (object == null || object instanceof DefaultNonQuantitativeAttributeCorrectness) {
+ return (DefaultNonQuantitativeAttributeCorrectness) object;
}
- return new DefaultNonQuantitativeAttributeAccuracy(object);
+ return new DefaultNonQuantitativeAttributeCorrectness(object);
}
}
diff --cc core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultRepresentativity.java
index 0000000000,b5a09faada..b83a76f5fa
mode 000000,100644..100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultRepresentativity.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultRepresentativity.java
@@@ -1,0 -1,98 +1,69 @@@
+ /*
+ * 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.quality;
+
+ import javax.xml.bind.annotation.XmlType;
+ import javax.xml.bind.annotation.XmlRootElement;
-import org.opengis.metadata.quality.Representativity;
+
+
+ /**
+ * Degree to which the sample used has produced a result which is representation of the data.
- * See the {@link Representativity} GeoAPI interface for more details.
+ * The following properties are mandatory in a well-formed metadata according ISO 19157:
+ *
+ * <div class="preformat">{@code DQ_Representativity}
+ * {@code ├─result…………………………} Value obtained from applying a data quality measure.
+ * {@code └─derivedElement……} Derived element.</div>
+ *
+ * <h2>Limitations</h2>
+ * <ul>
+ * <li>Instances of this class are not synchronized for multi-threading.
+ * Synchronization, if needed, is caller's responsibility.</li>
+ * <li>Serialized objects of this class are not guaranteed to be compatible with future Apache SIS releases.
+ * Serialization support is appropriate for short term storage or RMI between applications running the
+ * same version of Apache SIS. For long term storage, use {@link org.apache.sis.xml.XML} instead.</li>
+ * </ul>
+ *
+ * @author Alexis Gaillard (Geomatys)
+ * @author Martin Desruisseaux (Geomatys)
+ * @version 1.3
+ * @since 1.3
+ * @module
+ */
+ @XmlType(name = "DQ_Representativity_Type")
+ @XmlRootElement(name = "DQ_Representativity")
-public class DefaultRepresentativity extends AbstractMetaquality implements Representativity {
++public class DefaultRepresentativity extends AbstractMetaquality {
+ /**
+ * Serial number for inter-operability with different versions.
+ */
+ private static final long serialVersionUID = 5570834596540938580L;
+ /**
+ * Constructs an initially empty aggregation derivation.
+ */
+ public DefaultRepresentativity() {
+ }
+
+ /**
+ * Constructs a new instance initialized with the values from the specified metadata object.
+ * This is a <cite>shallow</cite> 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(Representativity)
+ */
- public DefaultRepresentativity(final Representativity object) {
++ public DefaultRepresentativity(final DefaultRepresentativity object) {
+ super(object);
+ }
-
- /**
- * Returns a SIS metadata implementation with the values of the given arbitrary implementation.
- * This method performs the first applicable action in the following choices:
- *
- * <ul>
- * <li>If the given object is {@code null}, then this method returns {@code null}.</li>
- * <li>Otherwise if the given object is already an instance of
- * {@code DefaultRepresentativity}, then it is returned unchanged.</li>
- * <li>Otherwise a new {@code DefaultRepresentativity} instance is created using the
- * {@linkplain #DefaultRepresentativity(Representativity) copy constructor}
- * and returned. Note that this is a <cite>shallow</cite> copy operation, since the other
- * metadata contained in the given object are not recursively copied.</li>
- * </ul>
- *
- * @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 DefaultRepresentativity castOrCopy(final Representativity object) {
- if (object == null || object instanceof DefaultRepresentativity) {
- return (DefaultRepresentativity) object;
- }
- return new DefaultRepresentativity(object);
- }
+ }
diff --cc core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultSampleBasedInspection.java
index 0000000000,b26cba5ff6..7069686c25
mode 000000,100644..100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultSampleBasedInspection.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultSampleBasedInspection.java
@@@ -1,0 -1,191 +1,160 @@@
+ /*
+ * 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.quality;
+
+ import javax.xml.bind.annotation.XmlType;
+ import javax.xml.bind.annotation.XmlElement;
+ import javax.xml.bind.annotation.XmlRootElement;
+ import org.opengis.util.InternationalString;
-import org.opengis.metadata.quality.SampleBasedInspection;
+
+
+ /**
+ * Sample based inspection.
+ * The following properties are mandatory in a well-formed metadata according ISO 19157:
+ *
+ * <div class="preformat">{@code DQ_SampleBasedInspection}
+ * {@code ├─samplingScheme……………} Type of sampling scheme and description of the sampling procedure.
+ * {@code ├─lotDescription……………} How lots are defined.
+ * {@code └─samplingRatio………………} How many samples on average are extracted for inspection from each lot of population.</div>
+ *
+ * <h2>Limitations</h2>
+ * <ul>
+ * <li>Instances of this class are not synchronized for multi-threading.
+ * Synchronization, if needed, is caller's responsibility.</li>
+ * <li>Serialized objects of this class are not guaranteed to be compatible with future Apache SIS releases.
+ * Serialization support is appropriate for short term storage or RMI between applications running the
+ * same version of Apache SIS. For long term storage, use {@link org.apache.sis.xml.XML} instead.</li>
+ * </ul>
+ *
+ * @author Alexis Gaillard (Geomatys)
+ * @author Martin Desruisseaux (Geomatys)
+ * @version 1.3
+ * @since 1.3
+ * @module
+ */
+ @XmlType(name = "DQ_SampleBasedInspection_Type", propOrder = {
+ "samplingScheme",
+ "lotDescription",
+ "samplingRatio"
+ })
+ @XmlRootElement(name = "DQ_SampleBasedInspection")
-public class DefaultSampleBasedInspection extends AbstractDataEvaluation implements SampleBasedInspection {
++public class DefaultSampleBasedInspection extends AbstractDataEvaluation {
+ /**
+ * Serial number for inter-operability with different versions.
+ */
+ private static final long serialVersionUID = -811881513591264926L;
+
+ /**
+ * Information of the type of sampling scheme and description of the sampling procedure.
+ */
+ @SuppressWarnings("serial")
+ private InternationalString samplingScheme;
+
+ /**
+ * Information of how lots are defined.
+ */
+ @SuppressWarnings("serial")
+ private InternationalString lotDescription;
+
+ /**
+ * Information on how many samples on average are extracted for inspection from each lot of population.
+ */
+ @SuppressWarnings("serial")
+ private InternationalString samplingRatio;
+
+ /**
+ * Constructs an initially empty sample based description.
+ */
+ public DefaultSampleBasedInspection() {
+ }
+
+ /**
+ * Constructs a new instance initialized with the values from the specified metadata object.
+ * This is a <cite>shallow</cite> 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(SampleBasedInspection)
+ */
- public DefaultSampleBasedInspection(final SampleBasedInspection object) {
++ public DefaultSampleBasedInspection(final DefaultSampleBasedInspection object) {
+ super(object);
+ if (object != null) {
+ samplingScheme = object.getSamplingScheme();
+ lotDescription = object.getLotDescription();
+ samplingRatio = object.getSamplingRatio();
+ }
+ }
+
- /**
- * Returns a SIS metadata implementation with the values of the given arbitrary implementation.
- * This method performs the first applicable action in the following choices:
- *
- * <ul>
- * <li>If the given object is {@code null}, then this method returns {@code null}.</li>
- * <li>Otherwise if the given object is already an instance of
- * {@code DefaultSampleBasedInspection}, then it is returned unchanged.</li>
- * <li>Otherwise a new {@code DefaultSampleBasedInspection} instance is created using the
- * {@linkplain #DefaultSampleBasedInspection(SampleBasedInspection) copy constructor}
- * and returned. Note that this is a <cite>shallow</cite> copy operation, since the other
- * metadata contained in the given object are not recursively copied.</li>
- * </ul>
- *
- * @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 DefaultSampleBasedInspection castOrCopy(final SampleBasedInspection object) {
- if (object == null || object instanceof DefaultSampleBasedInspection) {
- return (DefaultSampleBasedInspection) object;
- }
- return new DefaultSampleBasedInspection(object);
- }
-
+ /**
+ * Returns the information of the type of sampling scheme and description of the sampling procedure.
+ *
+ * @return sampling scheme and sampling procedure.
+ */
- @Override
+ @XmlElement(name = "samplingScheme", required = true)
+ public InternationalString getSamplingScheme() {
+ return samplingScheme;
+ }
+
+ /**
+ * Sets the information of the type of sampling scheme and description of the sampling procedure.
+ *
+ * @param newValue the new sampling scheme.
+ */
+ public void setSamplingScheme(final InternationalString newValue) {
+ checkWritePermission(samplingScheme);
+ samplingScheme = newValue;
+ }
+
+ /**
+ * Returns the information of how lots are defined.
+ *
+ * @return information on lots.
+ */
- @Override
+ @XmlElement(name = "lotDescription", required = true)
+ public InternationalString getLotDescription() {
+ return lotDescription;
+ }
+
+ /**
+ * Sets the information of how lots are defined.
+ *
+ * @param newValue the new information.
+ */
+ public void setLotDescription(final InternationalString newValue) {
+ checkWritePermission(lotDescription);
+ lotDescription = newValue;
+ }
+
+ /**
+ * Returns the information on how many samples on average are extracted for inspection from each lot of population.
+ *
+ * @return average number of samples extracted for inspection.
+ */
- @Override
+ @XmlElement(name = "samplingRatio", required = true)
+ public InternationalString getSamplingRatio() {
+ return samplingRatio;
+ }
+
+ /**
+ * Sets the information on how many samples on average are extracted for inspection from each lot of population.
+ *
+ * @param newValue the new information.
+ */
+ public void setSamplingRatio(final InternationalString newValue) {
+ checkWritePermission(samplingRatio);
+ samplingRatio = newValue;
+ }
+ }
diff --cc core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultSourceReference.java
index 0000000000,bc3c51a452..18e0f16e8b
mode 000000,100644..100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultSourceReference.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultSourceReference.java
@@@ -1,0 -1,130 +1,101 @@@
+ /*
+ * 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.quality;
+
+ import javax.xml.bind.annotation.XmlType;
+ import javax.xml.bind.annotation.XmlElement;
+ import javax.xml.bind.annotation.XmlRootElement;
+ import org.opengis.metadata.citation.Citation;
-import org.opengis.metadata.quality.SourceReference;
+ import org.apache.sis.xml.Namespaces;
+
+
+ /**
+ * Reference to the source of the data quality measure.
+ * The following property is mandatory in a well-formed metadata according ISO 19157:
+ *
+ * <div class="preformat">{@code DQM_SourceReference}
+ * {@code └─citation……………} References to the source.</div>
+ *
+ * <h2>Limitations</h2>
+ * <ul>
+ * <li>Instances of this class are not synchronized for multi-threading.
+ * Synchronization, if needed, is caller's responsibility.</li>
+ * <li>Serialized objects of this class are not guaranteed to be compatible with future Apache SIS releases.
+ * Serialization support is appropriate for short term storage or RMI between applications running the
+ * same version of Apache SIS. For long term storage, use {@link org.apache.sis.xml.XML} instead.</li>
+ * </ul>
+ *
+ * @author Alexis Gaillard (Geomatys)
+ * @author Martin Desruisseaux (Geomatys)
+ * @version 1.3
+ * @since 1.3
+ * @module
+ */
+ @XmlType(name = "DQM_SourceReference_Type", namespace = Namespaces.DQM)
+ @XmlRootElement(name = "DQM_SourceReference", namespace = Namespaces.DQM)
-public class DefaultSourceReference extends ISOMetadata implements SourceReference {
++public class DefaultSourceReference extends ISOMetadata {
+ /**
+ * Serial number for inter-operability with different versions.
+ */
+ private static final long serialVersionUID = 2923526577209702000L;
+
+ /**
+ * References to the source.
+ */
+ @SuppressWarnings("serial")
+ private Citation citation;
+
+ /**
+ * Constructs an initially empty source reference.
+ */
+ public DefaultSourceReference() {
+ }
+
+ /**
+ * Constructs a new instance initialized with the values from the specified metadata object.
+ * This is a <cite>shallow</cite> 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(SourceReference)
+ */
- public DefaultSourceReference(final SourceReference object) {
++ public DefaultSourceReference(final DefaultSourceReference object) {
+ super(object);
+ if (object != null) {
+ citation = object.getCitation();
+ }
+ }
+
- /**
- * Returns a SIS metadata implementation with the values of the given arbitrary implementation.
- * This method performs the first applicable action in the following choices:
- *
- * <ul>
- * <li>If the given object is {@code null}, then this method returns {@code null}.</li>
- * <li>Otherwise if the given object is already an instance of
- * {@code DefaultSourceReference}, then it is returned unchanged.</li>
- * <li>Otherwise a new {@code DefaultSourceReference} instance is created using the
- * {@linkplain #DefaultSourceReference(SourceReference) copy constructor} and returned.
- * Note that this is a <cite>shallow</cite> copy operation, since the other
- * metadata contained in the given object are not recursively copied.</li>
- * </ul>
- *
- * @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 DefaultSourceReference castOrCopy(final SourceReference object) {
- if (object == null || object instanceof DefaultSourceReference) {
- return (DefaultSourceReference) object;
- }
- return new DefaultSourceReference(object);
- }
-
+ /**
+ * Returns the references to the source.
+ *
+ * @return reference to the source.
+ */
- @Override
+ @XmlElement(name = "citation", required = true)
+ public Citation getCitation() {
+ return citation;
+ }
+
+ /**
+ * Sets the references to the source.
+ *
+ * @param newValue the new source references.
+ */
+ public void setCitation(final Citation newValue) {
+ checkWritePermission(citation);
+ citation = newValue;
+ }
+ }
diff --cc core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultStandaloneQualityReportInformation.java
index 0000000000,84e0aca75e..975704ca33
mode 000000,100644..100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultStandaloneQualityReportInformation.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultStandaloneQualityReportInformation.java
@@@ -1,0 -1,163 +1,132 @@@
+ /*
+ * 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.quality;
+
+ import javax.xml.bind.annotation.XmlType;
+ import javax.xml.bind.annotation.XmlElement;
+ import javax.xml.bind.annotation.XmlRootElement;
+ import org.opengis.util.InternationalString;
+ import org.opengis.metadata.citation.Citation;
-import org.opengis.metadata.quality.StandaloneQualityReportInformation;
+
+
+ /**
+ * Reference to an external standalone quality report.
- * See the {@link StandaloneQualityReportInformation} GeoAPI interface for more details.
+ * The following property is mandatory in a well-formed metadata according ISO 19157:
+ *
+ * <div class="preformat">{@code DQ_Element}
+ * {@code ├─reportReference……} Reference to the procedure information.
+ * {@code └─abstract………………………} Description of the evaluation method.</div>
+ *
+ * <h2>Limitations</h2>
+ * <ul>
+ * <li>Instances of this class are not synchronized for multi-threading.
+ * Synchronization, if needed, is caller's responsibility.</li>
+ * <li>Serialized objects of this class are not guaranteed to be compatible with future Apache SIS releases.
+ * Serialization support is appropriate for short term storage or RMI between applications running the
+ * same version of Apache SIS. For long term storage, use {@link org.apache.sis.xml.XML} instead.</li>
+ * </ul>
+ *
+ * @author Alexis Gaillard (Geomatys)
+ * @author Martin Desruisseaux (Geomatys)
+ * @version 1.3
+ * @since 1.3
+ * @module
+ */
+ @XmlType(name = "DQ_StandaloneQualityReportInformation_Type", propOrder = {
+ "reportReference",
+ "abstract"
+ })
+ @XmlRootElement(name = "DQ_StandaloneQualityReportInformation")
-public class DefaultStandaloneQualityReportInformation extends ISOMetadata implements StandaloneQualityReportInformation {
++public class DefaultStandaloneQualityReportInformation extends ISOMetadata {
+ /**
+ * Serial number for inter-operability with different versions.
+ */
+ private static final long serialVersionUID = -6646482698986737797L;
+
+ /**
+ * Reference to the associated standalone quality report.
+ */
+ @SuppressWarnings("serial")
+ private Citation reportReference;
+
+ /**
+ * Abstract for the associated standalone quality report.
+ */
+ @SuppressWarnings("serial")
+ private InternationalString summary;
+
+ /**
+ * Constructs an initially empty standalone quality report information.
+ */
+ public DefaultStandaloneQualityReportInformation() {
+ }
+
+ /**
+ * Constructs a new instance initialized with the values from the specified metadata object.
+ * This is a <cite>shallow</cite> 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(StandaloneQualityReportInformation)
+ */
- public DefaultStandaloneQualityReportInformation(final StandaloneQualityReportInformation object) {
++ public DefaultStandaloneQualityReportInformation(final DefaultStandaloneQualityReportInformation object) {
+ super(object);
+ if (object != null) {
+ reportReference = object.getReportReference();
+ summary = object.getAbstract();
+ }
+ }
+
- /**
- * Returns a SIS metadata implementation with the values of the given arbitrary implementation.
- * This method performs the first applicable action in the following choices:
- *
- * <ul>
- * <li>If the given object is {@code null}, then this method returns {@code null}.</li>
- * <li>Otherwise if the given object is already an instance of
- * {@code DefaultStandaloneQualityReportInformation}, then it is returned unchanged.</li>
- * <li>Otherwise a new {@code DefaultStandaloneQualityReportInformation} instance is created using the
- * {@linkplain #DefaultStandaloneQualityReportInformation(StandaloneQualityReportInformation) copy constructor}
- * and returned. Note that this is a <cite>shallow</cite> copy operation, since the other
- * metadata contained in the given object are not recursively copied.</li>
- * </ul>
- *
- * @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 DefaultStandaloneQualityReportInformation castOrCopy(final StandaloneQualityReportInformation object) {
- if (object instanceof StandaloneQualityReportInformation) {
- return DefaultStandaloneQualityReportInformation.castOrCopy((DefaultStandaloneQualityReportInformation) object);
- }
- return new DefaultStandaloneQualityReportInformation(object);
- }
-
+ /**
+ * Returns the reference to the associated standalone quality report.
+ *
+ * @return reference of the standalone quality report.
+ */
- @Override
+ @XmlElement(name = "reportReference", required = true)
+ public Citation getReportReference() {
+ return reportReference;
+ }
+
+ /**
+ * Sets the reference to the associated standalone quality report.
+ *
+ * @param newValue the new reference.
+ */
+ public void setReportReference(final Citation newValue) {
+ checkWritePermission(reportReference);
+ reportReference = newValue;
+ }
+
+ /**
+ * Returns the abstract for the standalone quality report.
+ *
+ * @return abstract of the standalone quality report.
+ */
- @Override
+ @XmlElement(name = "abstract", required = true)
+ public InternationalString getAbstract() {
+ return summary;
+ }
+
+ /**
+ * Sets the abstract for the associated standalone quality report.
+ *
+ * @param newValue the new abstract.
+ */
+ public void setAbstract(final InternationalString newValue) {
+ checkWritePermission(summary);
+ summary = newValue;
+ }
+ }
diff --cc core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultUsabilityElement.java
index 5b97a6dcee,83ef926889..f2afaf101f
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultUsabilityElement.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultUsabilityElement.java
@@@ -17,9 -17,10 +17,9 @@@
package org.apache.sis.metadata.iso.quality;
import javax.xml.bind.annotation.XmlType;
+ import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlRootElement;
import org.opengis.metadata.quality.Usability;
- import org.apache.sis.internal.xml.LegacyNamespaces;
-import org.opengis.metadata.quality.UsabilityElement;
/**
@@@ -38,18 -39,18 +38,18 @@@
* same version of Apache SIS. For long term storage, use {@link org.apache.sis.xml.XML} instead.</li>
* </ul>
*
- * @author Cédric Briançon (Geomatys)
- * @author Martin Desruisseaux (Geomatys)
- * @version 1.0
- * @since 0.3
+ * @author Martin Desruisseaux (IRD, Geomatys)
+ * @author Alexis Gaillard (Geomatys)
+ * @version 1.3
+ * @since 1.3
* @module
- *
- * @deprecated Not found in ISO 19115-3:2016 schemas.
*/
- @Deprecated
- @XmlType(name = "QE_Usability_Type", namespace = LegacyNamespaces.GMI)
- @XmlRootElement(name = "QE_Usability", namespace = LegacyNamespaces.GMI)
- public class DefaultUsability extends AbstractElement implements Usability {
+ @XmlType(name = "DQ_UsabilityElement_Type")
+ @XmlRootElement(name = "DQ_UsabilityElement")
+ @XmlSeeAlso({
+ DefaultUsability.class
+ })
-public class DefaultUsabilityElement extends AbstractElement implements UsabilityElement {
++public class DefaultUsabilityElement extends AbstractElement implements Usability {
/**
* Serial number for inter-operability with different versions.
*/
@@@ -66,11 -67,11 +66,11 @@@
* This is a <cite>shallow</cite> 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.
+ * @param object the metadata to copy values from, or {@code null} if none.
*
- * @see #castOrCopy(UsabilityElement)
+ * @see #castOrCopy(Usability)
*/
- public DefaultUsability(final Usability object) {
- public DefaultUsabilityElement(final UsabilityElement object) {
++ public DefaultUsabilityElement(final Usability object) {
super(object);
}
@@@ -81,10 -82,10 +81,10 @@@
* <ul>
* <li>If the given object is {@code null}, then this method returns {@code null}.</li>
* <li>Otherwise if the given object is already an instance of
- * {@code DefaultUsability}, then it is returned unchanged.</li>
- * <li>Otherwise a new {@code DefaultUsability} instance is created using the
- * {@linkplain #DefaultUsability(Usability) copy constructor}
- * and returned. Note that this is a <cite>shallow</cite> copy operation, since the other
+ * {@code DefaultUsabilityElement}, then it is returned unchanged.</li>
+ * <li>Otherwise a new {@code DefaultUsabilityElement} instance is created using the
- * {@linkplain #DefaultUsabilityElement(UsabilityElement) copy constructor} and returned.
++ * {@linkplain #DefaultUsabilityElement(Usability) copy constructor} and returned.
+ * Note that this is a <cite>shallow</cite> copy operation, since the other
* metadata contained in the given object are not recursively copied.</li>
* </ul>
*
@@@ -92,10 -93,14 +92,11 @@@
* @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 DefaultUsability castOrCopy(final Usability object) {
- if (object == null || object instanceof DefaultUsability) {
- return (DefaultUsability) object;
+ @SuppressWarnings("deprecation")
- public static DefaultUsabilityElement castOrCopy(final UsabilityElement object) {
- if (object instanceof Usability) {
- return DefaultUsability.castOrCopy((Usability) object);
- }
++ public static DefaultUsabilityElement castOrCopy(final Usability object) {
+ if (object == null || object instanceof DefaultUsabilityElement) {
+ return (DefaultUsabilityElement) object;
}
- return new DefaultUsability(object);
+ return new DefaultUsabilityElement(object);
}
}
diff --cc core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/package-info.java
index f68c3e3d20,e0a8813103..bde3483a09
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/package-info.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/package-info.java
@@@ -131,10 -58,20 +58,19 @@@
@XmlJavaTypeAdapters({
@XmlJavaTypeAdapter(CI_Citation.class),
@XmlJavaTypeAdapter(DQ_Element.class),
+ @XmlJavaTypeAdapter(DQ_EvaluationMethod.class),
@XmlJavaTypeAdapter(DQ_EvaluationMethodTypeCode.class),
+ @XmlJavaTypeAdapter(DQ_MeasureReference.class),
@XmlJavaTypeAdapter(DQ_Result.class),
+ @XmlJavaTypeAdapter(DQ_StandaloneQualityReportInformation.class),
+ @XmlJavaTypeAdapter(DQM_BasicMeasure.class),
+ @XmlJavaTypeAdapter(DQM_Description.class),
+ // @XmlJavaTypeAdapter(DQM_Measure.class), // Not directly referenced, but a "weak" association exists.
+ @XmlJavaTypeAdapter(DQM_Parameter.class),
+ @XmlJavaTypeAdapter(DQM_SourceReference.class),
- @XmlJavaTypeAdapter(DQM_ValueStructure.class),
@XmlJavaTypeAdapter(GO_Boolean.class),
@XmlJavaTypeAdapter(GO_DateTime.class),
+ @XmlJavaTypeAdapter(GO_GenericName.class),
@XmlJavaTypeAdapter(GO_Record.class),
@XmlJavaTypeAdapter(GO_RecordType.class),
@XmlJavaTypeAdapter(LI_Lineage.class),
diff --cc core/sis-metadata/src/main/java/org/apache/sis/util/iso/DefaultNameFactory.java
index fdfb57fe38,32854fd0cb..5a8c9304e6
--- a/core/sis-metadata/src/main/java/org/apache/sis/util/iso/DefaultNameFactory.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/util/iso/DefaultNameFactory.java
@@@ -218,14 -243,16 +243,15 @@@ public class DefaultNameFactory extend
* Creates a member name from the given character sequence and attribute type.
* The default implementation returns a new or an existing {@link DefaultMemberName} instance.
*
- * @param scope the {@linkplain AbstractName#scope() scope} of the member name to be created,
+ * @param scope the {@linkplain AbstractName#scope() scope} of the member name to create,
* or {@code null} for a global namespace.
* @param name the member name as a string or an international string.
- * @param attributeType the type of the data associated with the record member.
+ * @param attributeType the type of the data associated with the member.
* @return the member name for the given character sequence.
*
+ * @see Names#createMemberName(CharSequence, String, CharSequence, TypeName)
* @see Names#createMemberName(CharSequence, String, CharSequence, Class)
*/
- @Override
public MemberName createMemberName(final NameSpace scope, final CharSequence name, final TypeName attributeType) {
return pool.unique(new DefaultMemberName(scope, name, attributeType));
}
diff --cc core/sis-metadata/src/main/java/org/apache/sis/util/iso/DefaultTypeName.java
index c065bd66b3,7e00cfc999..e39ab6d1fe
--- a/core/sis-metadata/src/main/java/org/apache/sis/util/iso/DefaultTypeName.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/util/iso/DefaultTypeName.java
@@@ -189,20 -245,22 +245,21 @@@ public class DefaultTypeName extends De
if (object == null || object instanceof DefaultTypeName) {
return (DefaultTypeName) object;
}
- return new DefaultTypeName(object.scope(), object.toInternationalString());
- return new DefaultTypeName(object.scope(), object.toInternationalString(), object.toJavaType().orElse(null));
++ return new DefaultTypeName(object.scope(), object.toInternationalString(), null);
}
/**
- * Sets {@link #valueClass} to the given value, only if the scope and the name of this {@code TypeName}
- * are equal to the given values. The check for scope and name is a protection against renaming that user
- * could apply if they subclass {@link DefaultNameFactory}. If the user performed such renaming, then the
- * value class may be wrong, so we will ignore the given value class and let {@link #toClass()} computes
- * the class itself.
+ * Returns the Java type represented by this name.
+ * This is the type either specified explicitly at construction time or inferred from the type name.
+ *
+ * @return the Java type (usually a {@link Class}) for this type name.
+ *
+ * @see Names#toClass(TypeName)
+ *
+ * @since 1.3
*/
- final void setValueClass(final NameSpace scope, final String name, final Class<?> valueClass) {
- if (scope == super.scope() && name.equals(super.toString())) {
- this.valueClass = valueClass;
- }
- @Override
+ public Optional<Type> toJavaType() {
+ return Optional.ofNullable(javaType);
}
/**
diff --cc core/sis-metadata/src/main/java/org/apache/sis/util/iso/Names.java
index 8fc8d6b6bc,08ebe2d76b..e52da849da
--- a/core/sis-metadata/src/main/java/org/apache/sis/util/iso/Names.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/util/iso/Names.java
@@@ -274,7 -292,30 +292,30 @@@ public final class Names extends Stati
ensureNonNull("valueClass", valueClass);
final DefaultNameFactory factory = DefaultFactories.forBuildin(NameFactory.class, DefaultNameFactory.class);
return factory.createMemberName(createNameSpace(factory, namespace, separator), localPart,
- factory.toTypeName(valueClass)); // SIS-specific method.
+ factory.toTypeName(valueClass)); // SIS-specific method.
+ }
+
+ /**
+ * Creates a member name for attribute values of the given type.
+ * This is a shortcut for {@link DefaultNameFactory#createMemberName(NameSpace, CharSequence, TypeName)}.
+ * See {@linkplain #createMemberName(CharSequence, String, CharSequence, Class) performance note}.
+ *
+ * @param namespace the namespace, or {@code null} for the global namespace.
+ * @param separator the separator between the namespace and the local part, or {@code null}
+ * for the {@linkplain DefaultNameSpace#DEFAULT_SEPARATOR default separator}.
+ * @param localPart the name which is locale in the given namespace.
+ * @param attributeType the type of the data associated with the member.
+ * @return a member name in the given namespace for values of the given type.
+ *
+ * @since 1.3
+ */
+ public static MemberName createMemberName(final CharSequence namespace, final String separator,
+ final CharSequence localPart, final TypeName attributeType)
+ {
+ ensureNonNull("localPart", localPart);
+ ensureNonNull("attributeType", attributeType);
- final NameFactory factory = DefaultFactories.forBuildin(NameFactory.class);
++ final DefaultNameFactory factory = DefaultFactories.forBuildin(NameFactory.class, DefaultNameFactory.class);
+ return factory.createMemberName(createNameSpace(factory, namespace, separator), localPart, attributeType);
}
/**
@@@ -362,22 -402,19 +402,21 @@@
if (type == null) {
return null;
}
- Class<?> c;
- final Type t = type.toJavaType().orElse(null);
- if (t instanceof Class<?>) {
- return (Class<?>) t;
+ if (type instanceof DefaultTypeName) {
- c = ((DefaultTypeName) type).toClass();
- } else {
- try {
- c = TypeNames.toClass(TypeNames.namespace(type.scope()), type.toString());
- } catch (ClassNotFoundException e) {
- throw new UnknownNameException(TypeNames.unknown(type), e);
- }
- if (c == null) {
- throw new UnknownNameException(TypeNames.unknown(type));
- }
- if (c == Void.TYPE) {
- c = null;
++ final Type t = ((DefaultTypeName) type).toJavaType().orElse(null);
++ if (t instanceof Class<?>) {
++ return (Class<?>) t;
+ }
}
+ final Class<?> c;
+ try {
+ c = TypeNames.toClass(TypeNames.namespace(type.scope()), type.toString());
+ } catch (ClassNotFoundException e) {
+ throw new UnknownNameException(TypeNames.unknown(type), e);
+ }
+ if (c == Void.TYPE) {
+ throw new UnknownNameException(TypeNames.unknown(type));
+ }
return c;
}
diff --cc core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/metadata/replace/QualityParameterTest.java
index 0000000000,b51c43b2f7..52ad321b87
mode 000000,100644..100644
--- a/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/metadata/replace/QualityParameterTest.java
+++ b/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/metadata/replace/QualityParameterTest.java
@@@ -1,0 -1,117 +1,107 @@@
+ /*
+ * 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.internal.jaxb.metadata.replace;
+
+ import javax.xml.bind.JAXBException;
-import org.opengis.metadata.Identifier;
-import org.opengis.referencing.operation.Matrix;
-import org.opengis.metadata.quality.ValueStructure;
++import org.opengis.referencing.ReferenceIdentifier;
+ import org.apache.sis.util.iso.Names;
+ import org.apache.sis.util.SimpleInternationalString;
+ import org.apache.sis.metadata.iso.quality.DefaultDescription;
+ import org.apache.sis.test.xml.TestCase;
+ import org.apache.sis.xml.Namespaces;
+ import org.junit.Test;
+
+ import static org.apache.sis.test.MetadataAssert.*;
+
+
+ /**
+ * Tests {@link QualityParameter}.
+ *
+ * @author Martin Desruisseaux (Geomatys)
+ * @version 1.3
+ * @since 1.3
+ * @module
+ */
+ public final strictfp class QualityParameterTest extends TestCase {
+ /**
+ * Creates the parameter to use for testing purpose.
+ *
+ * @return the test parameter.
+ */
+ public static QualityParameter create() {
+ final QualityParameter param = new QualityParameter();
- param.code = "some parameter";
- param.definition = new SimpleInternationalString("a definition");
- param.description = new DefaultDescription("a description");
- param.valueStructure = ValueStructure.MATRIX;
- param.valueType = Names.createTypeName(Integer.class);
++ param.code = "some parameter";
++ param.definition = new SimpleInternationalString("a definition");
++ param.description = new DefaultDescription("a description");
++ param.valueType = Names.createTypeName(Integer.class);
+ return param;
+ }
+
+ /**
+ * Tests {@link QualityParameter#getName()}.
+ */
+ @Test
+ public void testGetName() {
+ final QualityParameter param = create();
- final Identifier name = param.getName();
++ final ReferenceIdentifier name = param.getName();
+ assertNull ("codeSpace", name.getCodeSpace());
+ assertEquals("code", "some parameter", name.getCode());
- assertEquals("definition", "a definition", String.valueOf(name .getDescription()));
- assertEquals("description", "a description", String.valueOf(param.getDescription()));
+ }
+
+ /**
+ * Tests {@link QualityParameter#getValueType()} and {@link QualityParameter#getValueClass()}.
+ */
+ @Test
+ public void testGetValueType() {
+ final QualityParameter param = create();
- assertEquals("valueClass", Matrix.class, param.getValueClass());
+ assertEquals("valueType", "OGC:Integer", param.getValueType().toFullyQualifiedName().toString());
+ }
+
+ /**
+ * Tests marshalling of a parameter.
+ *
+ * @throws JAXBException if an error occurred during marshalling.
+ */
+ @Test
+ public void testMarshal() throws JAXBException {
+ final String xml = marshal(create());
+ assertXmlEquals(
+ "<dqm:DQM_Parameter xmlns:dqm=\"" + Namespaces.DQM + '"' +
+ " xmlns:gco=\"" + Namespaces.GCO + "\">\n" +
+ " <dqm:name>\n" +
+ " <gco:CharacterString>some parameter</gco:CharacterString>\n" +
+ " </dqm:name>\n" +
+ " <dqm:definition>\n" +
+ " <gco:CharacterString>a definition</gco:CharacterString>\n" +
+ " </dqm:definition>\n" +
+ " <dqm:description>\n" +
+ " <dqm:DQM_Description>\n" +
+ " <dqm:textDescription>\n" +
+ " <gco:CharacterString>a description</gco:CharacterString>\n" +
+ " </dqm:textDescription>\n" +
+ " </dqm:DQM_Description>\n" +
+ " </dqm:description>\n" +
+ " <dqm:valueType>\n" +
+ " <gco:TypeName>\n" +
+ " <gco:aName>\n" +
+ " <gco:CharacterString>Integer</gco:CharacterString>\n" +
+ " </gco:aName>\n" +
+ " </gco:TypeName>\n" +
+ " </dqm:valueType>\n" +
- " <dqm:valueStructure>\n" +
- " <dqm:DQM_ValueStructure codeList=\"http://standards.iso.org/iso/19115/resources/Codelist/cat/codelists.xml#DQM_ValueStructure\""
- + " codeListValue=\"matrix\">Matrix</dqm:DQM_ValueStructure>\n" +
- " </dqm:valueStructure>\n" +
+ "</dqm:DQM_Parameter>\n", xml, "xmlns:*");
+ }
+ }
diff --cc core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/metadata/replace/ServiceParameterTest.java
index d4e0633d8f,43f95e4e8f..efbbe32f01
--- a/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/metadata/replace/ServiceParameterTest.java
+++ b/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/metadata/replace/ServiceParameterTest.java
@@@ -18,6 -18,8 +18,7 @@@ package org.apache.sis.internal.jaxb.me
import javax.xml.bind.JAXBException;
import org.opengis.util.MemberName;
-import org.opengis.metadata.Identifier;
-import org.opengis.parameter.ParameterDirection;
++import org.opengis.referencing.ReferenceIdentifier;
import org.apache.sis.xml.Namespaces;
import org.apache.sis.util.iso.Names;
import org.apache.sis.test.xml.TestCase;
@@@ -42,11 -44,12 +43,11 @@@ public final strictfp class ServicePara
* @return the test parameter.
*/
public static ServiceParameter create() {
- final MemberName paramName = Names.createMemberName(null, null, "Version", String.class);
+ final MemberName name = Names.createMemberName("TestSpace", null, "My service parameter", String.class);
final ServiceParameter param = new ServiceParameter();
- param.memberName = paramName;
+ param.memberName = name;
param.optionality = true;
param.repeatability = false;
- param.direction = ParameterDirection.IN;
return param;
}
@@@ -56,8 -59,11 +57,11 @@@
@Test
public void testGetName() {
final ServiceParameter param = create();
- assertEquals("name", "Version", String.valueOf(param.getName()));
- assertEquals("valueClass", String.class, param.getValueClass());
- final Identifier name = param.getName();
++ final ReferenceIdentifier name = param.getName();
+ assertEquals("codeSpace", "TestSpace", name.getCodeSpace());
+ assertEquals("code", "My service parameter", name.getCode());
+ assertEquals("name", "TestSpace:My service parameter", String.valueOf(name));
+ assertNull ("description", param.getDescription());
}
/**
diff --cc core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyConsistencyCheck.java
index 8c48fa7977,d7e84f067c..566131986f
--- a/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyConsistencyCheck.java
+++ b/core/sis-metadata/src/test/java/org/apache/sis/metadata/PropertyConsistencyCheck.java
@@@ -380,6 -382,6 +381,8 @@@ public abstract strictfp class Property
* ensure that there is no cycle.
*/
for (final String ref : dep.value()) {
++ if ("getEvaluationMethod".equals(ref)) continue; // Because missing UML annotation.
++
// Verify that the dependency is a property name.
assertEquals(name, names.get(ref), ref);
diff --cc core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java
index 99dbd133bf,8af05c4c90..4fbd58b112
--- a/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java
+++ b/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java
@@@ -210,6 -245,30 +211,36 @@@ public final strictfp class AllMetadata
loggings.assertNoUnexpectedLog();
}
+ /**
+ * Returns the name of the XML root element for an interface described by the given UML.
+ * This method does the generic work described in super-class, then applies special rules
+ * specific to the metadata package.
++ *
++ * @deprecated the complete function is available only on development branch because it depends on GeoAPI 3.1.
+ */
+ @Override
- protected String getExpectedXmlRootElementName(final Stereotype stereotype, final UML uml) {
- String name = super.getExpectedXmlRootElementName(stereotype, uml);
++ @Deprecated
++ protected String getExpectedXmlRootElementName(final UML uml) {
++ String name = super.getExpectedXmlRootElementName(uml);
+ if (name.equals("DQ_CoverageResult")) name = "QE_CoverageResult";
+ return name;
+ }
+
+ /**
+ * Returns the name of the XML type for an interface described by the given UML.
+ * This method does the generic work described in super-class, then applies special rules
+ * specific to the metadata package.
++ *
++ * @deprecated the complete function is available only on development branch because it depends on GeoAPI 3.1.
+ */
+ @Override
- protected String getExpectedXmlTypeName(final Stereotype stereotype, final UML uml) {
- String name = super.getExpectedXmlTypeName(stereotype, uml);
++ @Deprecated
++ protected String getExpectedXmlTypeName(final UML uml) {
++ String name = super.getExpectedXmlTypeName(uml);
+ if (name.equals("DQ_CoverageResult_Type")) name = "QE_CoverageResult_Type";
+ return name;
+ }
+
/**
* Returns the ISO 19115-3 wrapper for the given GeoAPI type,
* or {@code null} if no adapter is expected for the given type.
diff --cc core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultServiceIdentificationTest.java
index b0c6b8c0ed,63e0e8a3fc..b27d919138
--- a/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultServiceIdentificationTest.java
+++ b/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultServiceIdentificationTest.java
@@@ -92,10 -97,10 +92,9 @@@ public final strictfp class DefaultServ
assertEquals("connectPoints", NilReason.MISSING, NilReason.forObject(getSingleton(op.getConnectPoints())));
final ParameterDescriptor<?> param = getSingleton(op.getParameters());
- assertEquals("name", "Version", String.valueOf(param.getName()));
- assertEquals("minimumOccurs", 0, param.getMinimumOccurs());
- assertEquals("maximumOccurs", 1, param.getMaximumOccurs());
- // assertEquals("direction", ParameterDirection.IN, param.getDirection());
+ assertEquals("name", "My service parameter", String.valueOf(param.getName()));
+ assertEquals("minimumOccurs", 0, param.getMinimumOccurs());
+ assertEquals("maximumOccurs", 1, param.getMaximumOccurs());
- assertEquals("direction", ParameterDirection.IN, param.getDirection());
}
/**
diff --cc core/sis-metadata/src/test/java/org/apache/sis/test/xml/AnnotationConsistencyCheck.java
index 2fddaa9136,f01b235e72..b446b3100d
--- a/core/sis-metadata/src/test/java/org/apache/sis/test/xml/AnnotationConsistencyCheck.java
+++ b/core/sis-metadata/src/test/java/org/apache/sis/test/xml/AnnotationConsistencyCheck.java
@@@ -299,28 -304,20 +299,26 @@@ public abstract strictfp class Annotati
break;
}
}
- /*
- * GeoAPI has not yet been upgraded to ISO 19157. Interfaces in the "org.opengis.metadata.quality"
- * package are still defined according the old specification. Those types have the "DQ_" or "QE_"
- * prefix. This issue applies also to properties (starting with a lower case).
- */
if (identifier.startsWith("DQ_")) {
- assertEquals("Unexpected @Specification value.", Specification.ISO_19157, uml.specification());
- assertEquals("Specification version should be ISO 19157.", (short) 0, uml.version());
+ assertEquals("Unexpected @Specification value.", Specification.ISO_19115, uml.specification());
return Namespaces.MDQ;
}
+ if (identifier.startsWith("DQM_")) {
- assertEquals("Unexpected @Specification value.", Specification.ISO_19157, uml.specification());
- assertEquals("Specification version should be ISO 19157.", (short) 0, uml.version());
+ return Namespaces.DQM;
+ }
if (identifier.startsWith("QE_")) {
assertEquals("Unexpected @Specification value.", Specification.ISO_19115_2, uml.specification());
- assertEquals("Specification version should be legacy ISO 19115-2.", (short) 2009, uml.version());
- return LegacyNamespaces.GMI;
+ switch (/*uml.version()*/ 0) {
+ case 0: return Namespaces.MDQ;
+ case 2009: return LegacyNamespaces.GMI;
+ default: fail("Unexpected version number in " + uml);
+ }
+ }
+ if (org.opengis.metadata.quality.DataQuality.class.isAssignableFrom(impl) || // For properties in those types.
+ org.opengis.metadata.quality.Element.class.isAssignableFrom(impl) ||
+ org.opengis.metadata.quality.Result.class.isAssignableFrom(impl))
+ {
+ return Namespaces.MDQ;
}
/*
* General cases (after we processed all the special cases)
@@@ -604,9 -587,31 +602,31 @@@
case "getNominalSpatialResolution":
case "getTransferFunctionType": {
final Class<?> dc = method.getDeclaringClass();
- return org.opengis.metadata.content.SampleDimension.class.isAssignableFrom(dc)
+ return org.apache.sis.metadata.iso.content.DefaultSampleDimension.class.isAssignableFrom(dc)
&& !org.opengis.metadata.content.Band.class.isAssignableFrom(dc);
}
+ /*
+ * `Metaquality` override `Element` with only a change of obligation.
+ * We do not duplicate the Java methods only for that.
+ */
+ case "getDerivedElements": {
- return org.opengis.metadata.quality.Metaquality.class.isAssignableFrom(method.getDeclaringClass());
++ return true;
+ }
+ /*
+ * - "resultContent" is a property in the ISO 10157 model but not yet in the XML schema.
+ * - "resultFormat" and "resultFile" differ in XML schema compared to abstract model (different obligation).
+ */
+ case "getResultContent":
+ case "getResultFormat":
+ case "getResultFile": {
+ return org.opengis.metadata.quality.CoverageResult.class.isAssignableFrom(method.getDeclaringClass());
+ }
+ /*
+ * GeoAPI addition, not in standard model.
+ */
+ case "getMeasure": {
+ return org.opengis.metadata.quality.Element.class.isAssignableFrom(method.getDeclaringClass());
+ }
/*
* Standard Java methods overridden in some GeoAPI interfaces for Javadoc purposes.
*/
diff --cc core/sis-metadata/src/test/java/org/apache/sis/util/iso/TypeNamesTest.java
index c217af0338,c15347b357..95c210a6d5
--- a/core/sis-metadata/src/test/java/org/apache/sis/util/iso/TypeNamesTest.java
+++ b/core/sis-metadata/src/test/java/org/apache/sis/util/iso/TypeNamesTest.java
@@@ -57,7 -57,7 +57,7 @@@ public final strictfp class TypeNamesTe
final DefaultNameFactory factory = DefaultFactories.forBuildin(NameFactory.class, DefaultNameFactory.class);
final TypeName type = factory.toTypeName(valueClass);
assertNotNull(name, type);
- assertSame (name, valueClass, ((DefaultTypeName) type).toClass());
- assertSame (name, valueClass, type.toJavaType().get());
++ assertSame (name, valueClass, ((DefaultTypeName) type).toJavaType().get());
assertEquals (name, namespace, type.scope().name().toString());
assertEquals (name, name, type.toString());
assertEquals (name, valueClass, TypeNames.toClass(namespace, name));
diff --cc core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java
index 13db4b9354,0ea509b445..83bb8dce44
--- a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java
@@@ -89,6 -70,6 +89,9 @@@ import org.apache.sis.util.Utilities
import static java.util.logging.Logger.getLogger;
++// Branch-dependent imports
++import org.opengis.util.TypeName;
++
/**
* Implements the referencing services needed by the {@code "sis-metadata"} module.
@@@ -477,6 -458,6 +480,15 @@@ public final class ServicesForMetadata
//// ////
///////////////////////////////////////////////////////////////////////////////////////
++ /**
++ * Returns the name of the type of values.
++ */
++ @Override
++ public TypeName getValueType(final ParameterDescriptor<?> parameter) {
++ return (parameter instanceof DefaultParameterDescriptor<?>)
++ ? ((DefaultParameterDescriptor<?>) parameter).getValueType() : null;
++ }
++
/**
* Returns a fully implemented parameter descriptor.
*
diff --cc core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptor.java
index 68b7afd3e8,c664309e4c..dd93e21fee
--- a/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptor.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptor.java
@@@ -317,7 -315,30 +319,29 @@@ public class DefaultParameterDescriptor
}
/**
- * Returns the class that describe the type of the parameter.
+ * Returns the name that describes the type of parameter values.
+ * This is closely related to the {@link Class} returned by {@link #getValueClass()}:
+ *
+ * <ul>
+ * <li>If the value class is a collection (e.g. {@link java.util.List} or array),
+ * then this method returns the type of <em>elements</em> in the collection.</li>
+ * <li>Otherwise this method returns the value class using the mapping documented in
+ * {@link org.apache.sis.util.iso.DefaultTypeName} javadoc.</li>
+ * </ul>
+ *
+ * {@code TypeName} is used for encoding parameters in XML or JSON documents,
+ * while {@link #getValueClass()} is used for programmatic purposes.
+ *
+ * @return the type name of value component(s) in this parameter.
+ *
+ * @since 1.3
+ */
- @Override
+ public TypeName getValueType() {
+ return QualityParameter.getValueType(valueClass);
+ }
+
+ /**
+ * Returns the class that describes the type of parameter values.
*
* @return the parameter value class.
*/
@@@ -490,11 -508,12 +514,11 @@@
return getMinimumOccurs() == that.getMinimumOccurs() &&
getMaximumOccurs() == that.getMaximumOccurs() &&
getValueClass() == that.getValueClass() &&
- Objects. equals(getValidValues(), that.getValidValues()) &&
- Objects. equals(getMinimumValue(), that.getMinimumValue()) &&
- Objects. equals(getMaximumValue(), that.getMaximumValue()) &&
- Objects.deepEquals(getDefaultValue(), that.getDefaultValue()) &&
- Utilities.deepEquals(getUnit(), that.getUnit(), mode);
- Utilities.deepEquals(getValueType(), that.getValueType(), mode) &&
+ Objects. equals(getValidValues(), that.getValidValues()) &&
+ Objects. equals(getMinimumValue(), that.getMinimumValue()) &&
+ Objects. equals(getMaximumValue(), that.getMaximumValue()) &&
+ Objects .deepEquals(getDefaultValue(), that.getDefaultValue()) &&
+ Utilities.deepEquals(getUnit(), that.getUnit(), mode);
}
case STRICT: {
final DefaultParameterDescriptor<?> that = (DefaultParameterDescriptor<?>) object;
diff --cc core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorTest.java
index 6aef74bef8,3667a0ff5b..ad06faa1da
--- a/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/parameter/DefaultParameterDescriptorTest.java
@@@ -159,6 -159,7 +159,7 @@@ public final strictfp class DefaultPara
public void testOptionalInteger() {
final ParameterDescriptor<Integer> descriptor = createSimpleOptional("Simple param", Integer.class);
assertEquals("name", "Simple param", descriptor.getName().getCode());
- assertEquals("valueType", "Integer", descriptor.getValueType().toString());
++ assertEquals("valueType", "Integer", ((DefaultParameterDescriptor<?>) descriptor).getValueType().toString());
assertEquals("valueClass", Integer.class, descriptor.getValueClass());
assertNull ("validValues", descriptor.getValidValues());
assertNull ("defaultValue", descriptor.getDefaultValue());
@@@ -184,6 -185,7 +185,7 @@@
}
final ParameterDescriptor<Integer> descriptor = create("Test range", 4, 20, 12);
assertEquals("name", "Test range", descriptor.getName().getCode());
- assertEquals("valueType", "Integer", descriptor.getValueType().toString());
++ assertEquals("valueType", "Integer", ((DefaultParameterDescriptor<?>) descriptor).getValueType().toString());
assertEquals("valueClass", Integer.class, descriptor.getValueClass());
assertNull ("validValues", descriptor.getValidValues());
assertEquals("defaultValue", Integer.valueOf(12), descriptor.getDefaultValue());
@@@ -215,7 -217,7 +217,7 @@@
public void testDoubleType() {
final ParameterDescriptor<Double> descriptor = create("Length measure", 4, 20, 12, Units.METRE);
assertEquals("name", "Length measure", descriptor.getName().getCode());
- assertEquals("unit", Units.METRE, descriptor.getUnit());
- assertEquals("valueType", "Real", descriptor.getValueType().toString());
++ assertEquals("valueType", "Real", ((DefaultParameterDescriptor<?>) descriptor).getValueType().toString());
assertEquals("class", Double.class, descriptor.getValueClass());
assertEquals("defaultValue", Double.valueOf(12), descriptor.getDefaultValue());
assertEquals("minimum", Double.valueOf( 4), descriptor.getMinimumValue());
@@@ -252,15 -256,16 +256,16 @@@
final String[] enumeration = {"Apple", "Orange", "りんご"};
final ParameterDescriptor<String> descriptor = create(
"Enumeration param", String.class, enumeration, "Apple");
- assertEquals ("name", "Enumeration param", descriptor.getName().getCode());
- assertEquals ("valueClass", String.class, descriptor.getValueClass());
- assertArrayEquals("validValues", enumeration, descriptor.getValidValues().toArray());
- assertEquals ("defaultValue", "Apple", descriptor.getDefaultValue());
- assertNull ("minimumValue", descriptor.getMinimumValue());
- assertNull ("maximumValue", descriptor.getMaximumValue());
- assertEquals ("minimumOccurs", 1, descriptor.getMinimumOccurs());
- assertEquals ("maximumOccurs", 1, descriptor.getMaximumOccurs());
- assertNull ("unit", descriptor.getUnit());
+ assertEquals ("name", "Enumeration param", descriptor.getName().getCode());
- assertEquals ("valueType", "CharacterString", descriptor.getValueType().toString());
++ assertEquals ("valueType", "CharacterString", ((DefaultParameterDescriptor<?>) descriptor).getValueType().toString());
+ assertEquals ("valueClass", String.class, descriptor.getValueClass());
+ assertArrayEquals("validValues", enumeration, descriptor.getValidValues().toArray());
+ assertEquals ("defaultValue", "Apple", descriptor.getDefaultValue());
+ assertNull ("minimumValue", descriptor.getMinimumValue());
+ assertNull ("maximumValue", descriptor.getMaximumValue());
+ assertEquals ("minimumOccurs", 1, descriptor.getMinimumOccurs());
+ assertEquals ("maximumOccurs", 1, descriptor.getMaximumOccurs());
+ assertNull ("unit", descriptor.getUnit());
/*
* Invalid operation: element not in the list of valid elements.
*/
diff --cc core/sis-referencing/src/test/java/org/apache/sis/parameter/ParametersTest.java
index e39d6a434e,908b73d1e2..ffd1d97eba
--- a/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParametersTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParametersTest.java
@@@ -21,9 -21,10 +21,8 @@@ import java.util.Collection
import java.util.Collections;
import javax.measure.Unit;
import org.opengis.parameter.ParameterDescriptor;
-import org.opengis.parameter.ParameterDirection;
import org.opengis.parameter.ParameterValue;
- import org.opengis.referencing.ReferenceIdentifier;
import org.opengis.parameter.ParameterValueGroup;
-import org.opengis.util.TypeName;
import org.opengis.util.GenericName;
import org.opengis.util.InternationalString;
import org.apache.sis.measure.Range;
diff --cc core/sis-utility/src/test/java/org/apache/sis/util/ClassesTest.java
index 6cdb46c06d,d6903c1f67..7b0ea11ba9
--- a/core/sis-utility/src/test/java/org/apache/sis/util/ClassesTest.java
+++ b/core/sis-utility/src/test/java/org/apache/sis/util/ClassesTest.java
@@@ -44,6 -47,10 +47,8 @@@ import java.io.InvalidObjectException
import java.io.NotSerializableException;
import java.io.Serializable;
import java.awt.geom.Point2D;
+ import javax.print.attribute.standard.PrinterStateReason;
+ import javax.print.attribute.standard.PrinterStateReasons;
-import org.opengis.util.InternationalString;
-import org.opengis.metadata.extent.Extent;
import org.opengis.referencing.IdentifiedObject;
import org.opengis.referencing.ReferenceSystem;
import org.opengis.referencing.cs.EllipsoidalCS;