changeset 6361:01ff5cd6abfa

Set initial facet activity for sediment load fractions.
author Raimund Renkert <rrenkert@intevation.de>
date Tue, 18 Jun 2013 13:14:51 +0200
parents d848c887683a
children 682a73729fda
files artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/SedimentLoadCalculate.java
diffstat 1 files changed, 29 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/SedimentLoadCalculate.java	Tue Jun 18 10:59:58 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/SedimentLoadCalculate.java	Tue Jun 18 13:14:51 2013 +0200
@@ -14,6 +14,8 @@
 import org.apache.log4j.Logger;
 
 import org.dive4elements.artifactdatabase.state.Facet;
+import org.dive4elements.artifactdatabase.state.FacetActivity;
+import org.dive4elements.artifacts.Artifact;
 import org.dive4elements.artifacts.CallContext;
 import org.dive4elements.artifacts.CallMeta;
 import org.dive4elements.river.artifacts.D4EArtifact;
@@ -48,6 +50,33 @@
     public static final String I18N_FACET_SEDIMENTLOAD_TOTAL_LOAD = "facet.sedimentload.total_load";
     public static final String I18N_FACET_SEDIMENTLOAD_TOTAL = "facet.sedimentload.total";
 
+    static {
+        // Active/deactivate facets.
+        FacetActivity.Registry.getInstance().register(
+            "minfo",
+            new FacetActivity() {
+                @Override
+                public Boolean isInitialActive(
+                    Artifact artifact,
+                    Facet    facet,
+                    String   output
+                ) {
+                    String name = facet.getName();
+                    if (name.equals(SEDIMENT_LOAD_COARSE) ||
+                        name.equals(SEDIMENT_LOAD_FINEMIDDLE) ||
+                        name.equals(SEDIMENT_LOAD_SAND) ||
+                        name.equals(SEDIMENT_LOAD_SUSP_SAND) ||
+                        name.equals(SEDIMENT_LOAD_SUSP_SEDIMENT) ||
+                        name.equals(SEDIMENT_LOAD_SUSP_SAND_BED)){
+                        return Boolean.FALSE;
+                    }
+                    else {
+                        return null;
+                    }
+                }
+            });
+    }
+
     @Override
     public Object computeAdvance(D4EArtifact artifact, String hash,
         CallContext context, List<Facet> facets, Object old) {

http://dive4elements.wald.intevation.org