sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1463461 - in /sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso: identification/ lineage/ maintenance/ quality/ spatial/
Date Tue, 02 Apr 2013 09:25:02 GMT
Author: desruisseaux
Date: Tue Apr  2 09:25:02 2013
New Revision: 1463461

URL: http://svn.apache.org/r1463461
Log:
Partial revert of the previous commit based on a wrong interpretation of ISO 19115:
Exclusive properties apply only to unions, not to other conditional properties.
For other conditional properties, the condition rather said when the property is mandatory.

Modified:
    sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultAggregateInformation.java
    sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultResolution.java
    sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/DefaultSource.java
    sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultScopeDescription.java
    sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultDataQuality.java
    sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/DefaultGeorectified.java

Modified: sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultAggregateInformation.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultAggregateInformation.java?rev=1463461&r1=1463460&r2=1463461&view=diff
==============================================================================
--- sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultAggregateInformation.java
[UTF-8] (original)
+++ sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultAggregateInformation.java
[UTF-8] Tue Apr  2 09:25:02 2013
@@ -31,11 +31,9 @@ import org.apache.sis.metadata.iso.ISOMe
  * Aggregate dataset information.
  *
  * {@section Relationship between properties}
- * According ISO 19115, the {@linkplain #getAggregateDataSetName() aggregate dataset name}
and
- * {@linkplain #getAggregateDataSetIdentifier() aggregate dataset identifier} properties
are
- * exclusive: setting one of those properties to a non-null value discard the other one.
- * See the {@linkplain #DefaultAggregateInformation(AggregateInformation) constructor javadoc}
- * for information about which property has precedence on copy operations.
+ * According ISO 19115, at least one of {@linkplain #getAggregateDataSetName() aggregate
dataset
+ * name} and {@linkplain #getAggregateDataSetIdentifier() aggregate dataset identifier} shall
be
+ * provided.
  *
  * @author  Guilhem Legal (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
@@ -57,9 +55,14 @@ public class DefaultAggregateInformation
     private static final long serialVersionUID = 5520234916010871192L;
 
     /**
-     * The {@code aggregateDataSetName} or {@code aggregateDataSetIdentifier} property.
+     * Citation information about the aggregate dataset.
+     */
+    private Citation aggregateDataSetName;
+
+    /**
+     * Identification information about aggregate dataset.
      */
-    private Object nameOrIdentifier;
+    private Identifier aggregateDataSetIdentifier;
 
     /**
      * Association type of the aggregate dataset.
@@ -82,22 +85,16 @@ public class DefaultAggregateInformation
      * This is a <cite>shallow</cite> copy constructor, since the other metadata
contained in the
      * given object are not recursively copied.
      *
-     * <p>If both {@linkplain #getAggregateDataSetName() aggregate dataset name} and
-     * {@linkplain #getAggregateDataSetIdentifier() aggregate dataset identifier} are
-     * specified, then the name will have precedence and the identifier is silently discarded.</p>
-     *
      * @param object The metadata to copy values from.
      *
      * @see #castOrCopy(AggregateInformation)
      */
     public DefaultAggregateInformation(final AggregateInformation object) {
         super(object);
-        nameOrIdentifier = object.getAggregateDataSetName();
-        if (nameOrIdentifier == null) {
-            nameOrIdentifier = object.getAggregateDataSetIdentifier();
-        }
-        associationType = object.getAssociationType();
-        initiativeType  = object.getInitiativeType();
+        aggregateDataSetName       = object.getAggregateDataSetName();
+        aggregateDataSetIdentifier = object.getAggregateDataSetIdentifier();
+        associationType            = object.getAssociationType();
+        initiativeType             = object.getInitiativeType();
     }
 
     /**
@@ -126,15 +123,6 @@ public class DefaultAggregateInformation
     }
 
     /**
-     * Invoked every time the code needs to decide whether the provided information
-     * is the name or the identifier. Defined as a method in order to have a single
-     * word to search if we need to revisit the policy.
-     */
-    private boolean isName() {
-        return (nameOrIdentifier instanceof Citation);
-    }
-
-    /**
      * Citation information about the aggregate dataset.
      *
      * @return Citation information about the aggregate dataset, or {@code null}.
@@ -142,23 +130,17 @@ public class DefaultAggregateInformation
     @Override
     @XmlElement(name = "aggregateDataSetName")
     public synchronized Citation getAggregateDataSetName() {
-        return isName() ? (Citation) nameOrIdentifier : null;
+        return aggregateDataSetName;
     }
 
     /**
      * Sets the citation information about the aggregate dataset.
      *
-     * {@section Effect on other properties}
-     * If and only if the {@code newValue} is non-null, then this method automatically
-     * discards the {@linkplain #setAggregateDataSetIdentifier aggregate dataset identifier}.
-     *
      * @param newValue The new citation.
      */
     public synchronized void setAggregateDataSetName(final Citation newValue) {
         checkWritePermission();
-        if (newValue != null || isName()) {
-            nameOrIdentifier = newValue;
-        }
+        aggregateDataSetName = newValue;
     }
 
     /**
@@ -169,23 +151,17 @@ public class DefaultAggregateInformation
     @Override
     @XmlElement(name = "aggregateDataSetIdentifier")
     public synchronized Identifier getAggregateDataSetIdentifier() {
-        return isName() ? null : (Identifier) nameOrIdentifier;
+        return aggregateDataSetIdentifier;
     }
 
     /**
      * Sets the identification information about aggregate dataset.
      *
-     * {@section Effect on other properties}
-     * If and only if the {@code newValue} is non-null, then this method automatically
-     * discards the {@linkplain #setAggregateDataSetName aggregate dataset name}.
-     *
      * @param newValue The new identifier.
      */
     public synchronized void setAggregateDataSetIdentifier(final Identifier newValue) {
         checkWritePermission();
-        if (newValue != null || !isName()) {
-            nameOrIdentifier = newValue;
-        }
+        aggregateDataSetIdentifier = newValue;
     }
 
     /**

Modified: sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultResolution.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultResolution.java?rev=1463461&r1=1463460&r2=1463461&view=diff
==============================================================================
--- sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultResolution.java
[UTF-8] (original)
+++ sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultResolution.java
[UTF-8] Tue Apr  2 09:25:02 2013
@@ -30,6 +30,13 @@ import org.apache.sis.measure.ValueRange
 /**
  * Level of detail expressed as a scale factor or a ground distance.
  *
+ * {@section Relationship between properties}
+ * ISO 19115 defines {@code Resolution} as an <cite>union</cite> (in the C/C++
sense):
+ * only one of the properties in this class can be set to a non-empty value.
+ * Setting any property to a non-empty value discard all the other ones.
+ * See the {@linkplain #DefaultResolution(Resolution) constructor javadoc}
+ * for information about which property has precedence on copy operations.
+ *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @author  Touraïvane (IRD)
  * @author  Cédric Briançon (Geomatys)
@@ -49,19 +56,10 @@ public class DefaultResolution extends I
     private static final long serialVersionUID = -4644465057871958482L;
 
     /**
-     * Level of detail expressed as the scale of a comparable hardcopy map or chart.
-     * This value should be between 0 and 1.
-     * Only one of {@linkplain #getEquivalentScale() equivalent scale} and
-     * {@linkplain #getDistance() ground sample distance} may be provided.
+     * Either the scale as a {@link RepresentativeFraction} instance or the distance
+     * as a {@code Double} instance.
      */
-    private RepresentativeFraction equivalentScale;
-
-    /**
-     * Ground sample distance.
-     * Only one of {@linkplain #getEquivalentScale() equivalent scale} and
-     * {@linkplain #getDistance() ground sample distance} may be provided.
-     */
-    private Double distance;
+    private Object scaleOrDistance;
 
     /**
      * Constructs an initially empty resolution.
@@ -74,14 +72,19 @@ public class DefaultResolution extends I
      * This is a <cite>shallow</cite> copy constructor, since the other metadata
contained in the
      * given object are not recursively copied.
      *
+     * <p>If both {@linkplain #getEquivalentScale() scale} and {@linkplain #getDistance()
distance}
+     * are specified, then the scale will have precedence and the distance is silently discarded.</p>
+     *
      * @param object The metadata to copy values from.
      *
      * @see #castOrCopy(Resolution)
      */
     public DefaultResolution(final Resolution object) {
         super(object);
-        equivalentScale = object.getEquivalentScale();
-        distance        = object.getDistance();
+        scaleOrDistance = object.getEquivalentScale();
+        if (scaleOrDistance == null) {
+            scaleOrDistance = object.getDistance();
+        }
     }
 
     /**
@@ -110,6 +113,15 @@ public class DefaultResolution extends I
     }
 
     /**
+     * Invoked every time the code needs to decide whether the provided information
+     * is scale or distance. Defined as a method in order to have a single word to
+     * search if we need to revisit the policy.
+     */
+    private boolean isDistance() {
+        return (scaleOrDistance instanceof Double);
+    }
+
+    /**
      * Returns the level of detail expressed as the scale of a comparable hardcopy map or
chart.
      * Only one of {@linkplain #getEquivalentScale() equivalent scale} and
      * {@linkplain #getDistance() ground sample distance} may be provided.
@@ -117,17 +129,23 @@ public class DefaultResolution extends I
     @Override
     @XmlElement(name = "equivalentScale")
     public synchronized RepresentativeFraction getEquivalentScale()  {
-        return equivalentScale;
+        return isDistance() ? null : (RepresentativeFraction) scaleOrDistance;
     }
 
     /**
      * Sets the level of detail expressed as the scale of a comparable hardcopy map or chart.
      *
+     * {@section Effect on other properties}
+     * If and only if the {@code newValue} is non-null, then this method automatically
+     * discards the {@linkplain #setDistance distance}.
+     *
      * @param newValue The new equivalent scale.
      */
     public synchronized void setEquivalentScale(final RepresentativeFraction newValue) {
         checkWritePermission();
-        equivalentScale = newValue;
+        if (newValue != null || !isDistance()) {
+            scaleOrDistance = newValue;
+        }
     }
 
     /**
@@ -140,7 +158,7 @@ public class DefaultResolution extends I
 //    @XmlJavaTypeAdapter(GO_Distance.class) // TODO
     @XmlElement(name = "distance")
     public synchronized Double getDistance() {
-        return distance;
+        return isDistance() ? (Double) scaleOrDistance : null;
     }
 
     /**
@@ -150,6 +168,8 @@ public class DefaultResolution extends I
      */
     public synchronized void setDistance(final Double newValue) {
         checkWritePermission();
-        distance = newValue;
+        if (newValue != null || isDistance()) {
+            scaleOrDistance = newValue;
+        }
     }
 }

Modified: sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/DefaultSource.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/DefaultSource.java?rev=1463461&r1=1463460&r2=1463461&view=diff
==============================================================================
--- sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/DefaultSource.java
[UTF-8] (original)
+++ sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/lineage/DefaultSource.java
[UTF-8] Tue Apr  2 09:25:02 2013
@@ -33,20 +33,14 @@ import org.opengis.util.InternationalStr
 import org.apache.sis.metadata.iso.ISOMetadata;
 import org.apache.sis.util.iso.Types;
 import org.apache.sis.xml.Namespaces;
-import org.apache.sis.internal.metadata.ExcludedSet;
-
-import static org.apache.sis.internal.jaxb.MarshalContext.isMarshaling;
-import static org.apache.sis.util.collection.CollectionsExt.isNullOrEmpty;
 
 
 /**
  * Information about the source data used in creating the data specified by the scope.
  *
  * {@section Relationship between properties}
- * According ISO 19115, the {@linkplain #getDescription() description} and {@linkplain #getSourceExtents()
- * source extents} properties are exclusive: setting one of those properties to a non-empty
value discard
- * the other one. See the {@linkplain #DefaultSource(Source) constructor javadoc} for information
about
- * which property has precedence on copy operations.
+ * According ISO 19115, at least one of {@linkplain #getDescription() description} and
+ * {@linkplain #getSourceExtents() source extents} shall be provided.
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @author  Touraïvane (IRD)
@@ -73,9 +67,9 @@ public class DefaultSource extends ISOMe
     private static final long serialVersionUID = 6277132009549470021L;
 
     /**
-     * The {@code description} or the {@code sourceExtents} property.
+     * Detailed description of the level of the source data.
      */
-    private Object descriptionOrExtents;
+    private InternationalString description;
 
     /**
      * Denominator of the representative fraction on a source map.
@@ -93,6 +87,11 @@ public class DefaultSource extends ISOMe
     private Citation sourceCitation;
 
     /**
+     * Information about the spatial, vertical and temporal extent of the source data.
+     */
+    private Collection<Extent> sourceExtents;
+
+    /**
      * Information about an event in the creation process for the source data.
      */
     private Collection<ProcessStep> sourceSteps;
@@ -120,7 +119,7 @@ public class DefaultSource extends ISOMe
      * @param description A detailed description of the level of the source data, or {@code
null}.
      */
     public DefaultSource(final CharSequence description) {
-        descriptionOrExtents = Types.toInternationalString(description);
+        this.description = Types.toInternationalString(description);
     }
 
     /**
@@ -128,26 +127,20 @@ public class DefaultSource extends ISOMe
      * This is a <cite>shallow</cite> copy constructor, since the other metadata
contained in the
      * given object are not recursively copied.
      *
-     * <p>If both {@linkplain #getSourceExtents() source extents} and {@linkplain #getDescription()
-     * description} are specified, then the source extents will have precedence and the description
-     * is silently discarded.</p>
-     *
      * @param object The metadata to copy values from.
      *
      * @see #castOrCopy(Source)
      */
     public DefaultSource(final Source object) {
         super(object);
-        descriptionOrExtents  = object.getDescription();
+        description           = object.getDescription();
         scaleDenominator      = object.getScaleDenominator();
         sourceCitation        = object.getSourceCitation();
+        sourceExtents         = copyCollection(object.getSourceExtents(), Extent.class);
         sourceSteps           = copyCollection(object.getSourceSteps(), ProcessStep.class);
         processedLevel        = object.getProcessedLevel();
         resolution            = object.getResolution();
         sourceReferenceSystem = object.getSourceReferenceSystem();
-        if (descriptionOrExtents == null) {
-            descriptionOrExtents = copyCollection(object.getSourceExtents(), Extent.class);
-        }
     }
 
     /**
@@ -176,37 +169,22 @@ public class DefaultSource extends ISOMe
     }
 
     /**
-     * Invoked every time the code needs to decide whether the provided information
-     * is description or source extents. Defined as a method in order to have a single
-     * word to search if we need to revisit the policy.
-     */
-    private boolean isDescription() {
-        return (descriptionOrExtents instanceof InternationalString);
-    }
-
-    /**
      * Returns a detailed description of the level of the source data.
      */
     @Override
     @XmlElement(name = "description")
     public synchronized InternationalString getDescription() {
-        return isDescription() ? (InternationalString) descriptionOrExtents : null;
+        return description;
     }
 
     /**
      * Sets a detailed description of the level of the source data.
      *
-     * {@section Effect on other properties}
-     * If and only if the {@code newValue} is non-null, then this method automatically
-     * discards the {@linkplain #setSourceExtents source extents} collection.
-     *
      * @param newValue The new description.
      */
     public synchronized void setDescription(final InternationalString newValue) {
         checkWritePermission();
-        if (newValue != null || isDescription()) {
-            descriptionOrExtents = newValue;
-        }
+        description = newValue;
     }
 
     /**
@@ -269,39 +247,20 @@ public class DefaultSource extends ISOMe
 
     /**
      * Returns the information about the spatial, vertical and temporal extent of the source
data.
-     *
-     * {@section Conditions}
-     * This method returns a modifiable collection only if the {@linkplain #getDescription()
-     * description} is not set. Otherwise, this method returns an unmodifiable empty collection.
      */
     @Override
     @XmlElement(name = "sourceExtent")
     public synchronized Collection<Extent> getSourceExtents()  {
-        if (isDescription()) {
-            return isMarshaling() ? null : new ExcludedSet<Extent>("sourceExtent",
"description");
-        }
-        @SuppressWarnings("unchecked")
-        Collection<Extent> sourceExtents = (Collection<Extent>) descriptionOrExtents;
-        sourceExtents = nonNullCollection(sourceExtents, Extent.class);
-        descriptionOrExtents = sourceExtents;
-        return sourceExtents;
+        return sourceExtents = nonNullCollection(sourceExtents, Extent.class);
     }
 
     /**
      * Information about the spatial, vertical and temporal extent of the source data.
      *
-     * {@section Effect on other properties}
-     * If and only if the {@code newValue} is non-null, then this method automatically
-     * discards the {@linkplain #setDescription description}.
-     *
      * @param newValues The new source extents.
      */
     public synchronized void setSourceExtents(final Collection<? extends Extent> newValues)
{
-        @SuppressWarnings("unchecked")
-        final Collection<Extent> sourceExtents = isDescription() ? null : (Collection<Extent>)
descriptionOrExtents;
-        if (sourceExtents != null || !isNullOrEmpty(newValues)) {
-            descriptionOrExtents = writeCollection(newValues, sourceExtents, Extent.class);
-        }
+        sourceExtents = writeCollection(newValues, sourceExtents, Extent.class);
     }
 
     /**

Modified: sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultScopeDescription.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultScopeDescription.java?rev=1463461&r1=1463460&r2=1463461&view=diff
==============================================================================
--- sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultScopeDescription.java
[UTF-8] (original)
+++ sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultScopeDescription.java
[UTF-8] Tue Apr  2 09:25:02 2013
@@ -239,7 +239,7 @@ public class DefaultScopeDescription ext
      *
      * {@section Effect on other properties}
      * If and only if the {@code newValue} is non-empty, then this method automatically
-     * discards the all other properties.
+     * discards all other properties.
      *
      * @param newValues The new attributes.
      */
@@ -264,7 +264,7 @@ public class DefaultScopeDescription ext
      *
      * {@section Effect on other properties}
      * If and only if the {@code newValue} is non-empty, then this method automatically
-     * discards the all other properties.
+     * discards all other properties.
      *
      * @param newValues The new features.
      */
@@ -289,7 +289,7 @@ public class DefaultScopeDescription ext
      *
      * {@section Effect on other properties}
      * If and only if the {@code newValue} is non-empty, then this method automatically
-     * discards the all other properties.
+     * discards all other properties.
      *
      * @param newValues The new feature instances.
      */
@@ -314,7 +314,7 @@ public class DefaultScopeDescription ext
      *
      * {@section Effect on other properties}
      * If and only if the {@code newValue} is non-empty, then this method automatically
-     * discards the all other properties.
+     * discards all other properties.
      *
      * @param newValues The new attribute instances.
      */
@@ -336,7 +336,7 @@ public class DefaultScopeDescription ext
      *
      * {@section Effect on other properties}
      * If and only if the {@code newValue} is non-null, then this method automatically
-     * discards the all other properties.
+     * discards all other properties.
      *
      * @param newValue The new dataset.
      */
@@ -363,7 +363,7 @@ public class DefaultScopeDescription ext
      *
      * {@section Effect on other properties}
      * If and only if the {@code newValue} is non-null, then this method automatically
-     * discards the all other properties.
+     * discards all other properties.
      *
      * @param newValue Other class of information.
      */

Modified: sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultDataQuality.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultDataQuality.java?rev=1463461&r1=1463460&r2=1463461&view=diff
==============================================================================
--- sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultDataQuality.java
[UTF-8] (original)
+++ sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/DefaultDataQuality.java
[UTF-8] Tue Apr  2 09:25:02 2013
@@ -24,21 +24,15 @@ import org.opengis.metadata.lineage.Line
 import org.opengis.metadata.quality.DataQuality;
 import org.opengis.metadata.quality.Element;
 import org.opengis.metadata.quality.Scope;
-import org.apache.sis.internal.metadata.ExcludedSet;
 import org.apache.sis.metadata.iso.ISOMetadata;
 
-import static org.apache.sis.internal.jaxb.MarshalContext.isMarshaling;
-import static org.apache.sis.util.collection.CollectionsExt.isNullOrEmpty;
-
 
 /**
  * Quality information for the data specified by a data quality scope.
  *
  * {@section Relationship between properties}
- * According ISO 19115, the {@linkplain #getLineage() lineage} and {@linkplain #getReports()
reports}
- * properties are exclusive: setting one of those properties to a non-empty value discard
the other one.
- * See the {@linkplain #DefaultDataQuality(DataQuality) constructor javadoc} for information
about
- * which property has precedence on copy operations.
+ * According ISO 19115, at least one of {@linkplain #getLineage() lineage} and
+ * {@linkplain #getReports() reports} shall be provided.
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @author  Touraïvane (IRD)
@@ -64,10 +58,18 @@ public class DefaultDataQuality extends 
     private Scope scope;
 
     /**
-     * Either the lineage as a {@link Lineage} instance or the reports
-     * as a {@code Collection<Element>} instance.
+     * Quantitative quality information for the data specified by the scope.
+     * Should be provided only if {@linkplain Scope#getLevel scope level} is
+     * {@linkplain org.opengis.metadata.maintenance.ScopeCode#DATASET dataset}.
      */
-    private Object lineageOrReports;
+    private Collection<Element> reports;
+
+    /**
+     * Non-quantitative quality information about the lineage of the data specified by the
scope.
+     * Should be provided only if {@linkplain Scope#getLevel scope level} is
+     * {@linkplain org.opengis.metadata.maintenance.ScopeCode#DATASET dataset}.
+     */
+    private Lineage lineage;
 
     /**
      * Constructs an initially empty data quality.
@@ -89,21 +91,15 @@ public class DefaultDataQuality extends 
      * This is a <cite>shallow</cite> copy constructor, since the other metadata
contained in the
      * given object are not recursively copied.
      *
-     * <p>If both {@linkplain #getLineage() lineage} and {@linkplain #getReports()
reports} are
-     * specified, then the reports will have precedence and the lineage is silently discarded.</p>
-     *
      * @param object The metadata to copy values from.
      *
      * @see #castOrCopy(DataQuality)
      */
     public DefaultDataQuality(final DataQuality object) {
         super(object);
-        scope = object.getScope();
-        lineageOrReports = copyCollection(object.getReports(), Element.class);
-        if (lineageOrReports == null) {
-            // Give precedence to quantitative information.
-            lineageOrReports = object.getLineage();
-        }
+        scope   = object.getScope();
+        reports = copyCollection(object.getReports(), Element.class);
+        lineage = object.getLineage();
     }
 
     /**
@@ -151,78 +147,43 @@ public class DefaultDataQuality extends 
     }
 
     /**
-     * Invoked every time the code needs to decide whether the provided information
-     * is lineage or the reports. Defined as a method in order to have a single word
-     * to search if we need to revisit the policy.
-     */
-    private boolean isLineage() {
-        return (lineageOrReports instanceof Lineage);
-    }
-
-    /**
      * Returns the quantitative quality information for the data specified by the scope.
      *
-     * {@section Conditions}
-     * This method returns a modifiable collection only if the {@linkplain #getLineage()
lineage}
-     * is not set. Otherwise, this method returns an unmodifiable empty collection.
-     *
      * @return The quantitative quality information.
      */
     @Override
     @XmlElement(name = "report")
     public synchronized Collection<Element> getReports() {
-        if (isLineage()) {
-            return isMarshaling() ? null : new ExcludedSet<Element>("report", "lineage");
-        }
-        @SuppressWarnings("unchecked")
-        Collection<Element> reports = (Collection<Element>) lineageOrReports;
-        reports = nonNullCollection(reports, Element.class);
-        lineageOrReports = reports;
-        return reports;
+        return reports = nonNullCollection(reports, Element.class);
     }
 
     /**
      * Sets the quantitative quality information for the data specified by the scope.
      *
-     * {@section Effect on other properties}
-     * If and only if the {@code newValue} is non-empty, then this method automatically
-     * discards the {@linkplain #setLineage lineage}.
-     *
      * @param newValues The new reports.
      */
     public synchronized void setReports(final Collection<? extends Element> newValues)
{
-        @SuppressWarnings("unchecked")
-        final Collection<Element> reports = isLineage() ? null : (Collection<Element>)
lineageOrReports;
-        if (reports != null || !isNullOrEmpty(newValues)) {
-            lineageOrReports = writeCollection(newValues, reports, Element.class);
-        }
+        reports = writeCollection(newValues, reports, Element.class);
     }
 
     /**
      * Returns non-quantitative quality information about the lineage of the data specified
-     * by the scope. Note that the lineage and the {@linkplain #getReports() reports} are
-     * mutually exclusive properties.
+     * by the scope.
      */
     @Override
     @XmlElement(name = "lineage")
     public synchronized Lineage getLineage() {
-        return isLineage() ? (Lineage) lineageOrReports : null;
+        return lineage;
     }
 
     /**
      * Sets the non-quantitative quality information about the lineage of the data specified
      * by the scope.
      *
-     * {@section Effect on other properties}
-     * If and only if the {@code newValue} is non-null, then this method automatically
-     * discards the {@linkplain #setReports reports} collection.
-     *
      * @param newValue The new lineage.
      */
     public synchronized void setLineage(final Lineage newValue) {
         checkWritePermission();
-        if (newValue != null || isLineage()) {
-            lineageOrReports = newValue;
-        }
+        lineage = newValue;
     }
 }

Modified: sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/DefaultGeorectified.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/DefaultGeorectified.java?rev=1463461&r1=1463460&r2=1463461&view=diff
==============================================================================
--- sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/DefaultGeorectified.java
[UTF-8] (original)
+++ sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/iso/spatial/DefaultGeorectified.java
[UTF-8] Tue Apr  2 09:25:02 2013
@@ -37,9 +37,9 @@ import org.apache.sis.xml.Namespaces;
  * and orientation indication of whether or not geographic.
  *
  * {@section Relationship between properties}
- * According ISO 19115, the {@linkplain #getCheckPointDescription() check point description}
- * can be provided only if the {@linkplain #isCheckPointAvailable() check point availability}
- * is {@code true}. The setter methods will ensure that this condition is not violated.
+ * Providing the {@linkplain #getCheckPointDescription() check point description} implies
that
+ * {@linkplain #isCheckPointAvailable() check point availability} is {@code true}. The setter
+ * methods will ensure that this condition is not violated.
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @author  Touraïvane (IRD)



Mime
View raw message