[Dive4elements-commits] [PATCH] Set initial facet activity for sediment load fractions

Wald Commits scm-commit at wald.intevation.org
Tue Jun 18 13:15:24 CEST 2013


# HG changeset patch
# User Raimund Renkert <rrenkert at intevation.de>
# Date 1371554091 -7200
# Node ID 01ff5cd6abfa102dcf1680381d8be6c3dac44618
# Parent  d848c887683af8b0f6c91f6cd7f1fda3d220612c
Set initial facet activity for sediment load fractions.

diff -r d848c887683a -r 01ff5cd6abfa artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/SedimentLoadCalculate.java
--- 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) {


More information about the Dive4elements-commits mailing list