# HG changeset patch # User Raimund Renkert # Date 1355475983 -3600 # Node ID c5c31299bca16cabc4915b22dcc60af15d812b68 # Parent 3862f207db267f2f5c16b498790ac0453c671ff4 Hide facets returning raw data and fixed display name. diff -r 3862f207db26 -r c5c31299bca1 flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/DifferencesState.java --- 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; + } + } + }); + } }