# HG changeset patch # User Raimund Renkert # Date 1411398337 -7200 # Node ID 8578babdb2c8096fc389f2053a52299a2bf8786e # Parent d08e3737ab2da663693a3281231a63f9c3550305 Configured gauge discharge curve to use a default D4EArtifact and two states to hold the parameters and outs. * Updated configuration * Added new states * Updated facet diff -r d08e3737ab2d -r 8578babdb2c8 artifacts/doc/conf/artifacts/gaugedischargecurve.xml --- a/artifacts/doc/conf/artifacts/gaugedischargecurve.xml Wed Sep 17 19:46:19 2014 +0200 +++ b/artifacts/doc/conf/artifacts/gaugedischargecurve.xml Mon Sep 22 17:05:37 2014 +0200 @@ -1,39 +1,46 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r d08e3737ab2d -r 8578babdb2c8 artifacts/doc/conf/conf.xml --- a/artifacts/doc/conf/conf.xml Wed Sep 17 19:46:19 2014 +0200 +++ b/artifacts/doc/conf/conf.xml Mon Sep 22 17:05:37 2014 +0200 @@ -11,6 +11,7 @@ + @@ -146,7 +147,7 @@ org.dive4elements.artifactdatabase.DefaultArtifactFactory + artifact="org.dive4elements.river.artifacts.D4EArtifact">org.dive4elements.artifactdatabase.DefaultArtifactFactory org.dive4elements.artifactdatabase.DefaultArtifactFactory @@ -289,10 +290,10 @@ - &porosity-artifact; + &gaugedischargecurve-artifact; &sedimentload-artifact; &sedimentload-ls-artifact; diff -r d08e3737ab2d -r 8578babdb2c8 artifacts/src/main/java/org/dive4elements/river/artifacts/model/GaugeDischargeCurveFacet.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/GaugeDischargeCurveFacet.java Wed Sep 17 19:46:19 2014 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/GaugeDischargeCurveFacet.java Mon Sep 22 17:05:37 2014 +0200 @@ -31,14 +31,17 @@ * @author Björn Ricks */ public class GaugeDischargeCurveFacet -extends DefaultFacet +extends DataFacet implements FacetTypes { private static final Logger log = Logger.getLogger(GaugeDischargeCurveFacet.class); + public GaugeDischargeCurveFacet() { + } + public GaugeDischargeCurveFacet(String name, String description) { - super(0, name, description); + super(name, description); } @Override diff -r d08e3737ab2d -r 8578babdb2c8 artifacts/src/main/java/org/dive4elements/river/artifacts/states/GaugeDischargeCurveState.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/GaugeDischargeCurveState.java Mon Sep 22 17:05:37 2014 +0200 @@ -0,0 +1,37 @@ +package org.dive4elements.river.artifacts.states; + +import java.util.List; + +import org.dive4elements.artifactdatabase.state.Facet; +import org.dive4elements.artifacts.CallContext; +import org.dive4elements.river.artifacts.D4EArtifact; +import org.dive4elements.river.artifacts.access.RiverAccess; +import org.dive4elements.river.artifacts.model.GaugeDischargeCurveFacet; +import org.dive4elements.river.artifacts.resources.Resources; + + +public class GaugeDischargeCurveState +extends DefaultState +{ + + @Override + public Object computeAdvance( + D4EArtifact artifact, + String hash, + CallContext context, + List facets, + Object old + ) { + RiverAccess access = new RiverAccess(artifact); + String description = Resources.format(context.getMeta(), + "facet.gauge_discharge_curve.description", + "Discharge curve on gauge", + access.getRiverName(), + artifact.getDataAsString("gauge_name")); + facets.add(new GaugeDischargeCurveFacet("gauge_discharge_curve", description)); + facets.add(new GaugeDischargeCurveFacet("at", "gauge_discharge_curve")); + facets.add(new GaugeDischargeCurveFacet("csv", "gauge_discharge_curve")); + facets.add(new GaugeDischargeCurveFacet("pdf", "gauge_discharge_curve")); + return null; + } +} diff -r d08e3737ab2d -r 8578babdb2c8 artifacts/src/main/java/org/dive4elements/river/artifacts/states/GaugeDischargeInitState.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/GaugeDischargeInitState.java Mon Sep 22 17:05:37 2014 +0200 @@ -0,0 +1,12 @@ +package org.dive4elements.river.artifacts.states; + + +public class GaugeDischargeInitState +extends DefaultState +{ + + @Override + protected String getUIProvider() { + return "gauge_discharge_curve"; + } +}