Mercurial > dive4elements > river
diff flys-artifacts/src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java @ 4133:c722c08cf502
Merged heads.
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Mon, 15 Oct 2012 09:31:50 +0200 |
parents | e0354aed0cd3 |
children | a2735a4bf75e |
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java Mon Oct 15 09:29:25 2012 +0200 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java Mon Oct 15 09:31:50 2012 +0200 @@ -36,7 +36,7 @@ /** - * Artifact to access names of Points Of Interest along a segment of a river. + * Artifact to access main and extreme values of a river. * This artifact neglects (Static)FLYSArtifacts capabilities of interaction * with the StateEngine by overriding the getState*-methods. */ @@ -96,27 +96,41 @@ logger.debug("MainValuesArtifact.setup"); state = new StaticState(STATIC_STATE_NAME); - Facet qfacet0 = new MainValuesQFacet( - DURATION_MAINVALUES_Q, - Resources.getMsg( - callMeta, - "facet.discharge_curves.mainvalues.q", - "facet.discharge_curves.mainvalues.q"), - false); - Facet qfacet1 = new MainValuesQFacet( - COMPUTED_DISCHARGE_MAINVALUES_Q, - Resources.getMsg( - callMeta, - "facet.discharge_curves.mainvalues.q", - "facet.discharge_curves.mainvalues.q"), - false); - Facet qfacet2 = new MainValuesQFacet( - MAINVALUES_Q, - Resources.getMsg( - callMeta, - "facet.discharge_curves.mainvalues.q", - "facet.discharge_curves.mainvalues.q"), - true); + List<Facet> fs = new ArrayList<Facet>(); + facets.put(state.getID(), fs); + spawnState(); + super.setup(identifier, factory, context, callMeta, data); + String restriction = getDatacageIDValue(data); + logger.debug("mainvalue restriction " + restriction); + boolean restricted = restriction.endsWith("q") || restriction.endsWith("w"); + if (!restricted || restriction.endsWith("q")) { + Facet qfacet0 = new MainValuesQFacet( + DURATION_MAINVALUES_Q, + Resources.getMsg( + callMeta, + "facet.discharge_curves.mainvalues.q", + "facet.discharge_curves.mainvalues.q"), + false); + Facet qfacet1 = new MainValuesQFacet( + COMPUTED_DISCHARGE_MAINVALUES_Q, + Resources.getMsg( + callMeta, + "facet.discharge_curves.mainvalues.q", + "facet.discharge_curves.mainvalues.q"), + false); + Facet qfacet2 = new MainValuesQFacet( + MAINVALUES_Q, + Resources.getMsg( + callMeta, + "facet.discharge_curves.mainvalues.q", + "facet.discharge_curves.mainvalues.q"), + true); + + fs.add(qfacet0); + fs.add(qfacet1); + fs.add(qfacet2); + } + if (!restricted || restriction.endsWith("w")) { Facet wfacet1 = new MainValuesWFacet( COMPUTED_DISCHARGE_MAINVALUES_W, Resources.getMsg( @@ -131,17 +145,9 @@ "facet.discharge_curves.mainvalues.w", "facet.discharge_curves.mainvalues.w"), true); - - List<Facet> fs = new ArrayList<Facet>(); - fs.add(qfacet0); - fs.add(qfacet1); - fs.add(qfacet2); - fs.add(wfacet1); - fs.add(wfacet2); - - facets.put(state.getID(), fs); - spawnState(); - super.setup(identifier, factory, context, callMeta, data); + fs.add(wfacet1); + fs.add(wfacet2); + } }