# HG changeset patch # User Ingo Weinzierl # Date 1336485359 0 # Node ID 5afccab9aac171b3dc4a7d42003f7572a59ec9ef # Parent 055315495f8d6cd32e46bcbebd74557cd1fa9e98 Modified floodmap specific datacage configuration and improved WMS hws layer. flys-artifacts/trunk@4361 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 055315495f8d -r 5afccab9aac1 flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Tue May 08 12:14:55 2012 +0000 +++ b/flys-artifacts/ChangeLog Tue May 08 13:55:59 2012 +0000 @@ -1,3 +1,14 @@ +2012-05-08 Ingo Weinzierl + + * doc/conf/meta-data.xml: Moved the hws layers out to an own node. + + * src/main/java/de/intevation/flys/artifacts/WMSCatchmentArtifact.java, + src/main/java/de/intevation/flys/artifacts/WMSDBArtifact.java: Moved the + 'name' property from WMSCatchmentArtifact to WMSDBArtifact. + + * src/main/java/de/intevation/flys/artifacts/WMSHwsArtifact.java: Create + more specific filter and extent that takes the 'name' into account. + 2012-05-08 Ingo Weinzierl * doc/conf/meta-data.xml: Moved the catchments out to an own node. diff -r 055315495f8d -r 5afccab9aac1 flys-artifacts/doc/conf/meta-data.xml --- a/flys-artifacts/doc/conf/meta-data.xml Tue May 08 12:14:55 2012 +0000 +++ b/flys-artifacts/doc/conf/meta-data.xml Tue May 08 13:55:59 2012 +0000 @@ -608,14 +608,15 @@ - SELECT count(*) as km_exists - FROM hws WHERE river_id = ${river_id} + SELECT count(*) as km_exists, name as name + FROM hws WHERE river_id = ${river_id} GROUP BY name - + + @@ -796,7 +797,6 @@ - @@ -806,6 +806,9 @@ + + + diff -r 055315495f8d -r 5afccab9aac1 flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSCatchmentArtifact.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSCatchmentArtifact.java Tue May 08 12:14:55 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSCatchmentArtifact.java Tue May 08 13:55:59 2012 +0000 @@ -78,12 +78,10 @@ Logger.getLogger(CatchmentState.class); protected int riverId; - protected String name; public CatchmentState(WMSDBArtifact artifact) { super(artifact); riverId = 0; - name = null; } public int getRiverId() { @@ -102,17 +100,6 @@ return riverId; } - public String getName() { - if (name == null) { - String ids = artifact.getDataAsString("ids"); - - String parts[] = ids.split(";"); - name = parts[1]; - } - - return name; - } - @Override protected String getFacetType() { return FLOODMAP_CATCHMENT; diff -r 055315495f8d -r 5afccab9aac1 flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSDBArtifact.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSDBArtifact.java Tue May 08 12:14:55 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSDBArtifact.java Tue May 08 13:55:59 2012 +0000 @@ -105,10 +105,14 @@ protected FLYSArtifact artifact; + protected String name; + + public WMSDBState() {} public WMSDBState(FLYSArtifact artifact) { this.artifact = artifact; + this.name = null; } @Override @@ -223,6 +227,24 @@ return null; } + /** + * Returns the name of the WMS layer. This method extracts the name + * from 'ids' data string. It is expected, that the 'ids' string is + * seperated by ';' and that the name is placed at index 1. + * + * @return the name of the WMS layer. + */ + public String getName() { + if (name == null) { + String ids = artifact.getDataAsString("ids"); + + String parts[] = ids.split(";"); + name = parts[1]; + } + + return name; + } + protected abstract String getFacetType(); protected abstract String getTitle(CallMeta meta); diff -r 055315495f8d -r 5afccab9aac1 flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSHwsArtifact.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSHwsArtifact.java Tue May 08 12:14:55 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSHwsArtifact.java Tue May 08 13:55:59 2012 +0000 @@ -86,13 +86,14 @@ public int getRiverId() { if (riverId == 0) { - String ids = artifact.getDataAsString("ids"); + String ids = artifact.getDataAsString("ids"); + String[] parts = ids.split(";"); try { - riverId = Integer.valueOf(ids); + riverId = Integer.valueOf(parts[0]); } catch (NumberFormatException nfe) { - logger.error("Cannot parse river id from '" + ids + "'"); + logger.error("Cannot parse river id from '" + parts[0] + "'"); } } @@ -125,7 +126,7 @@ @Override protected Envelope getExtent() { - List hws = Hws.getHws(getRiverId()); + List hws = Hws.getHws(getRiverId(), getName()); Envelope max = null; @@ -145,7 +146,8 @@ @Override protected String getFilter() { - return "river_id=" + String.valueOf(getRiverId()); + return "river_id=" + String.valueOf(getRiverId()) + + " AND name='" + getName() + "'"; } @Override