changeset 4676:c5c31299bca1

Hide facets returning raw data and fixed display name.
author Raimund Renkert <rrenkert@intevation.de>
date Fri, 14 Dec 2012 10:06:23 +0100
parents 3862f207db26
children 481ac6468016
files flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/DifferencesState.java
diffstat 1 files changed, 53 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/DifferencesState.java	Thu Dec 13 17:20:24 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/DifferencesState.java	Fri Dec 14 10:06:23 2012 +0100
@@ -7,6 +7,8 @@
 import org.apache.log4j.Logger;
 
 import de.intevation.artifactdatabase.state.Facet;
+import de.intevation.artifactdatabase.state.FacetActivity;
+import de.intevation.artifacts.Artifact;
 import de.intevation.artifacts.CallContext;
 import de.intevation.artifacts.CallMeta;
 import de.intevation.flys.artifacts.FLYSArtifact;
@@ -15,8 +17,10 @@
 import de.intevation.flys.artifacts.model.FacetTypes;
 import de.intevation.flys.artifacts.model.minfo.BedDiffCalculation;
 import de.intevation.flys.artifacts.model.minfo.BedDiffEpochFacet;
+import de.intevation.flys.artifacts.model.minfo.BedDiffEpochFilterFacet;
 import de.intevation.flys.artifacts.model.minfo.BedDiffEpochResult;
 import de.intevation.flys.artifacts.model.minfo.BedDiffYearFacet;
+import de.intevation.flys.artifacts.model.minfo.BedDiffYearFilterFacet;
 import de.intevation.flys.artifacts.model.minfo.BedDiffYearResult;
 import de.intevation.flys.artifacts.model.minfo.BedDifferencesResult;
 import de.intevation.flys.artifacts.resources.Resources;
@@ -96,7 +100,7 @@
                     createBedDiffYearDescription(
                         meta,
                         (BedDiffYearResult)results[idx],
-                        false),
+                        true),
                     ComputeType.ADVANCE,
                     stateId,
                     hash));
@@ -116,7 +120,7 @@
                         meta,
                         (BedDiffYearResult)results[idx],
                         0,
-                        false),
+                        true),
                     ComputeType.ADVANCE,
                     stateId,
                     hash));
@@ -127,7 +131,7 @@
                         meta,
                         (BedDiffYearResult)results[idx],
                         1,
-                        false),
+                        true),
                     ComputeType.ADVANCE,
                     stateId,
                     hash));
@@ -137,49 +141,49 @@
                     createBedDiffAbsoluteDescription(
                         meta,
                         (BedDiffYearResult)results[idx],
-                        false),
+                        true),
                     ComputeType.ADVANCE,
                     stateId,
                     hash));
-                newFacets.add(new BedDiffYearFacet(
+                newFacets.add(new BedDiffYearFilterFacet(
                     idx,
                     BED_DIFFERENCE_YEAR_FILTERED,
                     createBedDiffYearDescription(
                         meta,
                         (BedDiffYearResult)results[idx],
-                        true),
+                        false),
                     ComputeType.ADVANCE,
                     stateId,
                     hash));
-                newFacets.add(new BedDiffYearFacet(
+                newFacets.add(new BedDiffYearFilterFacet(
                     idx,
                     BED_DIFFERENCE_YEAR_HEIGHT1_FILTERED,
                     createBedDiffHeightDescription(
                         meta,
                         (BedDiffYearResult)results[idx],
                         0,
-                        true),
+                        false),
                     ComputeType.ADVANCE,
                     stateId,
                     hash));
-                 newFacets.add(new BedDiffYearFacet(
+                 newFacets.add(new BedDiffYearFilterFacet(
                     idx,
                     BED_DIFFERENCE_YEAR_HEIGHT2_FILTERED,
                     createBedDiffHeightDescription(
                         meta,
                         (BedDiffYearResult)results[idx],
                         1,
-                        true),
+                        false),
                     ComputeType.ADVANCE,
                     stateId,
                     hash));
-                newFacets.add(new BedDiffYearFacet(
+                newFacets.add(new BedDiffYearFilterFacet(
                     idx,
                     BED_DIFFERENCE_HEIGHT_YEAR_FILTERED,
                     createBedDiffAbsoluteDescription(
                         meta,
                         (BedDiffYearResult)results[idx],
-                        true),
+                        false),
                     ComputeType.ADVANCE,
                     stateId,
                     hash));
@@ -191,7 +195,7 @@
                     createBedDiffEpochDescription(
                         meta,
                         (BedDiffEpochResult)results[idx],
-                        false),
+                        true),
                     ComputeType.ADVANCE,
                     stateId,
                     hash));
@@ -202,7 +206,7 @@
                         meta,
                         (BedDiffEpochResult)results[idx],
                         0,
-                        false),
+                        true),
                     ComputeType.ADVANCE,
                     stateId,
                     hash));
@@ -213,39 +217,39 @@
                         meta,
                         (BedDiffEpochResult)results[idx],
                         1,
-                        false),
+                        true),
                     ComputeType.ADVANCE,
                     stateId,
                     hash));
-                newFacets.add(new BedDiffEpochFacet(
+                newFacets.add(new BedDiffEpochFilterFacet(
                     idx,
                     BED_DIFFERENCE_EPOCH_FILTERED,
                     createBedDiffEpochDescription(
                         meta,
                         (BedDiffEpochResult)results[idx],
-                        true),
+                        false),
                     ComputeType.ADVANCE,
                     stateId,
                     hash));
-                newFacets.add(new BedDiffEpochFacet(
+                newFacets.add(new BedDiffEpochFilterFacet(
                     idx,
                     BED_DIFFERENCE_EPOCH_HEIGHT1_FILTERED,
                     createBedDiffHeightEpochDescription(
                         meta,
                         (BedDiffEpochResult)results[idx],
                         0,
-                        true),
+                        false),
                     ComputeType.ADVANCE,
                     stateId,
                     hash));
-                newFacets.add(new BedDiffEpochFacet(
+                newFacets.add(new BedDiffEpochFilterFacet(
                     idx,
                     BED_DIFFERENCE_EPOCH_HEIGHT2_FILTERED,
                     createBedDiffHeightEpochDescription(
                         meta,
                         (BedDiffEpochResult)results[idx],
                         1,
-                        true),
+                        false),
                     ComputeType.ADVANCE,
                     stateId,
                     hash));
@@ -358,4 +362,32 @@
         }
         return Resources.getMsg(meta, i18n, i18n, new Object[] { range });
     }
+
+    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(BED_DIFFERENCE_EPOCH) ||
+                        name.equals(BED_DIFFERENCE_EPOCH_HEIGHT1) ||
+                        name.equals(BED_DIFFERENCE_EPOCH_HEIGHT2) ||
+                        name.equals(BED_DIFFERENCE_HEIGHT_YEAR) ||
+                        name.equals(BED_DIFFERENCE_YEAR) ||
+                        name.equals(BED_DIFFERENCE_YEAR_HEIGHT1) ||
+                        name.equals(BED_DIFFERENCE_YEAR_HEIGHT2)) {
+                        return Boolean.FALSE;
+                    }
+                    else {
+                        return Boolean.TRUE;
+                    }
+                }
+            });
+    }
 }

http://dive4elements.wald.intevation.org