changeset 357:1d11a0531242

Added artifact parameter to facets getDataProviderKeys. artifacts/trunk@3380 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Fri, 09 Dec 2011 16:03:19 +0000
parents 079ab7c971a4
children 03a8f9796571
files ChangeLog artifact-database/src/main/java/de/intevation/artifactdatabase/AbstractCallContext.java artifact-database/src/main/java/de/intevation/artifactdatabase/state/ArtifactAndFacet.java artifact-database/src/main/java/de/intevation/artifactdatabase/state/DefaultFacet.java artifact-database/src/main/java/de/intevation/artifactdatabase/state/Facet.java
diffstat 5 files changed, 19 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Nov 30 11:49:51 2011 +0000
+++ b/ChangeLog	Fri Dec 09 16:03:19 2011 +0000
@@ -1,3 +1,15 @@
+2011-12-09	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	* artifact-database/src/main/java/de/intevation/artifactdatabase/state/Facet.java,
+	  artifact-database/src/main/java/de/intevation/artifactdatabase/state/DefaultFacet.java:
+	  (getDataProviderKeys): Added parameter artifact.
+
+	* artifact-database/src/main/java/de/intevation/artifactdatabase/state/ArtifactAndFacet.java:
+	  Pass artifact to changed getDataProviderKeys of Facet.
+
+	* artifact-database/src/main/java/de/intevation/artifactdatabase/AbstractCallContext.java:
+	  (getDataProvider): Never return null, empty list instead.
+
 2011-11-30	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
 
 	* artifact-database/src/main/java/de/intevation/artifactdatabase/state/ArtifactAndFacet.java
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/AbstractCallContext.java	Wed Nov 30 11:49:51 2011 +0000
+++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/AbstractCallContext.java	Fri Dec 09 16:03:19 2011 +0000
@@ -117,7 +117,7 @@
     public List<DataProvider> getDataProvider(Object key) {
         return dataProviders != null
             ? dataProviders.get(key)
-            : null;//java.util.Collections.emptyList();
+            : java.util.Collections.<DataProvider>emptyList();
     }
 
     /**
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/state/ArtifactAndFacet.java	Wed Nov 30 11:49:51 2011 +0000
+++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/state/ArtifactAndFacet.java	Fri Dec 09 16:03:19 2011 +0000
@@ -13,6 +13,7 @@
 public class ArtifactAndFacet implements DataProvider {
     /** The Artifact. */
     protected Artifact artifact;
+
     /** The (native) facet. */
     protected Facet    facet;
 
@@ -41,7 +42,7 @@
 
     /** (Maybe) Register on blackboard (depending on facet). */
     public void register(CallContext context) {
-        List keys = facet.getDataProviderKeys();
+        List keys = facet.getDataProviderKeys(this.artifact);
         if (keys == null) {
             return;
         }
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/state/DefaultFacet.java	Wed Nov 30 11:49:51 2011 +0000
+++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/state/DefaultFacet.java	Fri Dec 09 16:03:19 2011 +0000
@@ -118,8 +118,9 @@
     /**
      * Return list of keys (objects) for which this facet can provide data
      * ("external parameterization"), for other facets, via blackboard.
+     * @param artifact that this facet belongs to.
      */
-    public List getDataProviderKeys() {
+    public List getDataProviderKeys(Artifact artifact) {
         return null;
     }
 
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/state/Facet.java	Wed Nov 30 11:49:51 2011 +0000
+++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/state/Facet.java	Fri Dec 09 16:03:19 2011 +0000
@@ -53,10 +53,10 @@
     /**
      * Get keys for which this Facet can provide data (for other facets, not
      * for plot).
-     *
+     * @param artifact Artifact that this facet belongs to.
      * @return list of keys
      */
-    List getDataProviderKeys();
+    List getDataProviderKeys(Artifact artifact);
 
 
     /**

http://dive4elements.wald.intevation.org