# HG changeset patch # User Felix Wolfsteller # Date 1318944519 0 # Node ID d9afb16d1fd46fa3d12cb6d18206b0c7cb18aec0 # Parent 0349dd524f9cfcdd603a3d414ad1b0b338b89110 Store parameterization in data, not in fields. flys-artifacts/trunk@3007 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 0349dd524f9c -r d9afb16d1fd4 flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Tue Oct 18 13:26:15 2011 +0000 +++ b/flys-artifacts/ChangeLog Tue Oct 18 13:28:39 2011 +0000 @@ -1,3 +1,10 @@ +2011-10-18 Felix Wolfsteller + + Store parameterization in data, not in Artifact. + + * src/main/java/de/intevation/flys/artifacts/StaticWKmsArtifact.java: + Resolve col_pos and wst_id field, use data instead. + 2011-10-18 Felix Wolfsteller Add convenience-method to add defaultdata (string). diff -r 0349dd524f9c -r d9afb16d1fd4 flys-artifacts/src/main/java/de/intevation/flys/artifacts/StaticWKmsArtifact.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/StaticWKmsArtifact.java Tue Oct 18 13:26:15 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/StaticWKmsArtifact.java Tue Oct 18 13:28:39 2011 +0000 @@ -7,6 +7,8 @@ import org.w3c.dom.Document; +import de.intevation.artifactdatabase.data.DefaultStateData; + import de.intevation.artifactdatabase.state.Facet; import de.intevation.artifactdatabase.state.DefaultOutput; import de.intevation.artifactdatabase.state.State; @@ -50,10 +52,6 @@ /** One and only state to be in. */ protected transient State state = null; - protected int col_pos; - - protected int wst_id; - /** * Trivial Constructor. @@ -79,6 +77,7 @@ state = new StaticState( "state.additional_wkms.static", "state.additional_wkms.static"); + List fs = new ArrayList(); logger.debug(XMLUtils.toString(data)); String code = XMLUtils.xpathString( @@ -86,19 +85,22 @@ logger.debug("makes: " + code); + // TODO Go for JSON, one day. //ex.: flood_protection-wstv-114-12 if (code != null) { String [] parts = code.split("-"); - int col = Integer.valueOf(parts[2]); - int wst = Integer.valueOf(parts[3]); - // These shall be put in data (addData) - this.col_pos = col; - this.wst_id = wst; - // addDataAsString? + + if (parts.length >= 4) { + try { + Integer.valueOf(parts[2]); + Integer.valueOf(parts[3]); + addStringData("col_pos", parts[2]); + addStringData("wst_id", parts[3]); + } + catch (Exception e) {} + } } - // Will get col_id and wst_id - Facet facet = new WKmsFacet(Resources.getMsg(callMeta, "facet.discharge_curves.mainvalues.w", "facet.discharge_curves.mainvalues.w")); @@ -112,6 +114,7 @@ /** * Initialize the static state with output. + * @return static state */ protected State spawnState() { state = new StaticState( @@ -201,8 +204,8 @@ // TODO KIND is not needed. return WKmsFactory.getWKms( WKmsFactory.KIND_PROTECTION, - this.col_pos, - this.wst_id); + Integer.valueOf(getDataAsString("col_pos")), + Integer.valueOf(getDataAsString("wst_id"))); } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :