sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1677173 - in /sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature: AbstractOperation.java LinkOperation.java
Date Fri, 01 May 2015 16:30:14 GMT
Author: desruisseaux
Date: Fri May  1 16:30:13 2015
New Revision: 1677173

URL: http://svn.apache.org/r1677173
Log:
Feature: added AbstractOperation.getDependencies() method.
This information is needed for writing the "SELECT" SQL statement to send to a database server.

Modified:
    sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractOperation.java
    sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/LinkOperation.java

Modified: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractOperation.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractOperation.java?rev=1677173&r1=1677172&r2=1677173&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractOperation.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractOperation.java
[UTF-8] Fri May  1 16:30:13 2015
@@ -17,6 +17,8 @@
 package org.apache.sis.feature;
 
 import java.util.Map;
+import java.util.Set;
+import java.util.Collections;
 import org.opengis.util.GenericName;
 import org.opengis.parameter.GeneralParameterDescriptor;
 import org.opengis.parameter.ParameterDescriptorGroup;
@@ -97,12 +99,12 @@ public abstract class AbstractOperation
      * The value returned by this method depends on the value returned by {@link #getResult()}:
      *
      * <ul>
-     *   <li>If {@code getResult()}} returns {@code null},
+     *   <li>If {@code getResult()} returns {@code null},
      *       then this method should return {@code null}.</li>
-     *   <li>If {@code getResult()}} returns an instance of {@link AttributeType},
+     *   <li>If {@code getResult()} returns an instance of {@link AttributeType},
      *       then this method shall return an instance of {@link Attribute}
      *       and the {@code Attribute.getType() == getResult()} relation should hold.</li>
-     *   <li>If {@code getResult()}} returns an instance of {@link FeatureAssociationRole},
+     *   <li>If {@code getResult()} returns an instance of {@link FeatureAssociationRole},
      *       then this method shall return an instance of {@link FeatureAssociation}
      *       and the {@code FeatureAssociation.getRole() == getResult()} relation should
hold.</li>
      * </ul>
@@ -123,6 +125,23 @@ public abstract class AbstractOperation
     public abstract Property apply(Feature feature, ParameterValueGroup parameters);
 
     /**
+     * Returns the names of feature properties that this operation needs for performing its
task.
+     *
+     * <div class="note"><b>Rational:</b>
+     * this information is needed for writing the {@code SELECT} SQL statement to send to
a database server.
+     * The requested columns will typically be all attributes declared in a {@code FeatureType},
but also
+     * any additional columns needed for the operation while not necessarily included in
the {@code FeatureType}.
+     * </div>
+     *
+     * The default implementation returns an empty set.
+     *
+     * @return The names of feature properties needed by this operation for performing its
task.
+     */
+    public Set<String> getDependencies() {
+        return Collections.emptySet();
+    }
+
+    /**
      * Returns a hash code value for this operation.
      * The default implementation computes a hash code from the {@linkplain #getParameters()
parameters}
      * and {@linkplain #getResult() result type}.

Modified: sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/LinkOperation.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/LinkOperation.java?rev=1677173&r1=1677172&r2=1677173&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/LinkOperation.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/LinkOperation.java
[UTF-8] Fri May  1 16:30:13 2015
@@ -16,8 +16,10 @@
  */
 package org.apache.sis.feature;
 
+import java.util.Set;
 import java.util.Map;
 import java.util.HashMap;
+import java.util.Collections;
 import org.opengis.metadata.Identifier;
 import org.opengis.parameter.ParameterValueGroup;
 import org.opengis.parameter.ParameterDescriptor;
@@ -30,6 +32,7 @@ import org.apache.sis.util.ArgumentCheck
 import org.opengis.feature.Feature;
 import org.opengis.feature.IdentifiedType;
 import org.opengis.feature.Property;
+import org.opengis.feature.PropertyType;
 
 
 /**
@@ -74,7 +77,7 @@ final class LinkOperation extends Abstra
     /**
      * The type of the result.
      */
-    private final IdentifiedType result;
+    private final PropertyType result;
 
     /**
      * The name of the referenced attribute or feature association.
@@ -87,7 +90,7 @@ final class LinkOperation extends Abstra
      * @param identification The name of the link, together with optional information.
      * @param propertyType   The referenced attribute or feature association.
      */
-    LinkOperation(final Map<String, ?> identification, final IdentifiedType propertyType)
{
+    LinkOperation(final Map<String, ?> identification, final PropertyType propertyType)
{
         super(identification);
         result = propertyType;
         propertyName = propertyType.getName().toString();
@@ -110,6 +113,14 @@ final class LinkOperation extends Abstra
     }
 
     /**
+     * Returns the names of feature properties that this operation needs for performing its
task.
+     */
+    @Override
+    public Set<String> getDependencies() {
+        return Collections.singleton(propertyName);
+    }
+
+    /**
      * Returns the property from the referenced attribute of feature association.
      *
      * @param  feature    The feature from which to get the property.



Mime
View raw message