# HG changeset patch # User Felix Wolfsteller # Date 1364885904 -7200 # Node ID 33d735f5433e087e1909bf26230e4bc0d487a2c3 # Parent 6dbc111e9aec00be855f9216d672d2a9f7af2af9# Parent fcf28185ca30c699c195b03d3fd374033f67feb8 Merged. diff -r 6dbc111e9aec -r 33d735f5433e .hgtags --- a/.hgtags Thu Mar 28 12:11:13 2013 +0100 +++ b/.hgtags Tue Apr 02 08:58:24 2013 +0200 @@ -37,3 +37,4 @@ 88e3473a38467e8b5bb7d99e92c3f1a795515bf5 2.9.12 7fa94b793cbe0133503741e142832c8f2ff1aa4b 2.9.13 a5f5599f6fd5e37975d71b8a323aadfeb8d017e6 2.9.14 +437109b3cf49ce83d5bd4d005c71509e966b8cf7 2.9.15 diff -r 6dbc111e9aec -r 33d735f5433e contrib/make_flys_release/bin/make-importer-package.sh --- a/contrib/make_flys_release/bin/make-importer-package.sh Thu Mar 28 12:11:13 2013 +0100 +++ b/contrib/make_flys_release/bin/make-importer-package.sh Tue Apr 02 08:58:24 2013 +0200 @@ -4,11 +4,9 @@ # See README for more information # The working directory. Resulting tarball will be placed in the directory above. -PKG_DIR=/tmp/flys-importer -# Default conf -CONF_DIR=/path/to/conf/dir +PKG_DIR=~/tmp/flys-importer # Path to the flys checkout -FLYS_DIR=/path/to/flys/root +FLYS_DIR=~/flys/flys/ # Tarball that will be extracted into flys-imprter/opt EXTRAS=$1 @@ -48,7 +46,10 @@ fi cp ${FLYS_DIR}/flys-backend/doc/schema/*.sql $PKG_DIR/schema -cp ${FLYS_DIR}/flys-backend/doc/documentation/de/importer-manual.pdf $PKG_DIR + +cd ${FLYS_DIR}/flys-backend/doc/documentation/de/ +make importer-manual.pdf +cp importer-manual.pdf $PKG_DIR sed -i 's/shpimporter\/shp/geodaesie\/shp/' $PKG_DIR/run_geo.sh diff -r 6dbc111e9aec -r 33d735f5433e contrib/make_flys_release/make_release.sh --- a/contrib/make_flys_release/make_release.sh Thu Mar 28 12:11:13 2013 +0100 +++ b/contrib/make_flys_release/make_release.sh Tue Apr 02 08:58:24 2013 +0200 @@ -50,7 +50,7 @@ Default: $DEFAULT_WD -t Tag the current default branch as "VERSION" -o, --oracle Release is for oracle. - VERSION must be in the format MAYOR.MINOR.PATCH + VERSION must be in the format MAYOR.MINOR.PATCH or default EOF exit 0 } @@ -80,7 +80,7 @@ # Backend configuration BACKENDURL=${BACKENDURL:-czech-republic.atlas.intevation.de} BACKENDPORT=${BACKENDPORT:-5432} -BACKENDBACK=${BACKENDBACK:-flys_2913} +BACKENDBACK=${BACKENDBACK:-flys_devel} BACKENDUSER=${BACKENDUSER:-flys_dami} BACKENDPASS=${BACKENDPASS:-flys_dami} INITSQLS=${INITSQLS:-} @@ -119,7 +119,11 @@ fi VERSION=$1 -ARTIFACT_PORT=${ARTIFACT_PORT:-`echo 1$VERSION | sed 's/\.//g'`} +if [ "$VERSION" = "default" ]; then + ARTIFACT_PORT=${ARTIFACT_PORT:-29999} +else + ARTIFACT_PORT=${ARTIFACT_PORT:-`echo 1$VERSION | sed 's/\.//g'`} +fi if [ -z $WORK_DIR ]; then WORK_DIR=$DEFAULT_WD diff -r 6dbc111e9aec -r 33d735f5433e flys-artifacts/contrib/inline-dc-attribute.xsl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-artifacts/contrib/inline-dc-attribute.xsl Tue Apr 02 08:58:24 2013 +0200 @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${ + {$ + + + + + + + + + + + + + + + + + + + + + diff -r 6dbc111e9aec -r 33d735f5433e flys-artifacts/doc/conf/artifacts/sqrelation.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-artifacts/doc/conf/artifacts/sqrelation.xml Tue Apr 02 08:58:24 2013 +0200 @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 6dbc111e9aec -r 33d735f5433e flys-artifacts/doc/conf/conf.xml --- a/flys-artifacts/doc/conf/conf.xml Thu Mar 28 12:11:13 2013 +0100 +++ b/flys-artifacts/doc/conf/conf.xml Tue Apr 02 08:58:24 2013 +0200 @@ -122,6 +122,9 @@ de.intevation.artifactdatabase.DefaultArtifactFactory + de.intevation.artifactdatabase.DefaultArtifactFactory + diff -r 6dbc111e9aec -r 33d735f5433e flys-artifacts/doc/conf/meta-data.xml --- a/flys-artifacts/doc/conf/meta-data.xml Thu Mar 28 12:11:13 2013 +0100 +++ b/flys-artifacts/doc/conf/meta-data.xml Tue Apr 02 08:58:24 2013 +0200 @@ -1,4 +1,4 @@ - + @@ -36,13 +36,13 @@ COALESCE(ld_from, '') AS ldf, COALESCE(ld_to, '') AS ldt FROM master_artifacts_range - WHERE gid = CAST(${artifact-id} as uuid) + WHERE gid = CAST(${artifact-id} AS uuid) - + - + @@ -59,10 +59,10 @@ - SELECT id AS river_id, name as river_name FROM rivers + SELECT id AS river_id, name AS river_name FROM rivers WHERE lower(name) LIKE lower(${river}) - + Base-data macros (mostly data imported from wst-files). @@ -77,22 +77,19 @@ description AS prot_description FROM wsts WHERE kind = 0 AND river_id = ${river_id} - - - + + - - - - - - - - + + + - + @@ -108,22 +105,19 @@ description AS prot_description FROM wsts WHERE kind = 0 AND river_id = ${river_id} - - - + + - - - - - - - - + + + - + @@ -139,22 +133,18 @@ description AS prot_description FROM wsts WHERE kind = 1 AND river_id = ${river_id} - - - + + - - - - - - - - - - - + + + + + @@ -170,22 +160,19 @@ description AS prot_description FROM wsts WHERE kind = 1 AND river_id = ${river_id} - - - + + - - - - - - - - + + + - + @@ -201,22 +188,19 @@ description AS prot_description FROM wsts WHERE kind = 1 AND river_id = ${river_id} - - - + + - - - - - - - - + + + - + @@ -231,23 +215,19 @@ description AS prot_description FROM wsts WHERE kind = 2 AND river_id = ${river_id} - - - - - + + + - - - - - - - - + + + - + @@ -262,22 +242,19 @@ description AS prot_description FROM wsts WHERE kind = 2 AND river_id = ${river_id} - - - + + - - - - - - - - + + + - + @@ -292,22 +269,19 @@ description AS prot_description FROM wsts WHERE kind = 2 AND river_id = ${river_id} - - - + + - - - - - - - - + + + - + @@ -322,22 +296,19 @@ description AS prot_description FROM wsts WHERE kind = 2 AND river_id = ${river_id} - - - + + - - - - - - - - + + + - + @@ -353,22 +324,19 @@ description AS prot_description FROM wsts WHERE kind = 3 AND river_id = ${river_id} - - - + + - - - - - - - - + + + - + @@ -383,22 +351,19 @@ description AS prot_description FROM wsts WHERE kind = 4 AND river_id = ${river_id} - - - + + - - - - - - - - + + + - + @@ -413,22 +378,19 @@ description AS prot_description FROM wsts WHERE kind = 4 AND river_id = ${river_id} - - - + + - - - - - - - - + + + - + @@ -443,22 +405,18 @@ description AS prot_description FROM wsts WHERE kind = 4 AND river_id = ${river_id} - - - - + + - - - - - - - - + + + - + @@ -466,129 +424,98 @@ - - - - - SELECT id AS prot_id, - description AS prot_description - FROM wsts WHERE kind = 5 AND river_id = ${river_id} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + SELECT id AS prot_id, description AS prot_description FROM wsts WHERE kind = 5 AND river_id = ${river_id} - - - - - + + + + + + + + + + + + + + + + + + + + + + SELECT id AS prot_id, + description AS prot_description + FROM wsts WHERE kind = 5 AND river_id = ${river_id} + + + - - - - - - - - + + + - + - - - - - - - - - - - - + + + - - - - + - - - - + - - - - - + SELECT id AS anno_id, name AS anno_description FROM annotation_types - - - - - - - + + + - - + SELECT DISTINCT @@ -599,13 +526,11 @@ WHERE cs.river_id = ${river_id} AND csl.km BETWEEN ${fromkm} AND ${tokm} - - - - - - - + + + @@ -613,8 +538,7 @@ - - + SELECT DISTINCT @@ -625,52 +549,44 @@ WHERE river_id = ${river_id} AND he.km BETWEEN ${fromkm} AND ${tokm} - - - - - - - - - + + + + - + SELECT id AS fvmid, description AS fvmd FROM flow_velocity_measurements WHERE river_id = ${river_id} - - - - - + + - - SELECT id, description, station, datetime, v, w, q - FROM flow_velocity_measure_values - WHERE measurements_id = ${fvmid} - AND station BETWEEN ${fromkm} AND ${tokm} - - - - - - - - + + SELECT id, description, station, datetime, v, w, q + FROM flow_velocity_measure_values + WHERE measurements_id = ${fvmid} + AND station BETWEEN ${fromkm} AND ${tokm} + + + + - - - - + + + + @@ -682,13 +598,11 @@ description AS bedh_descr FROM bed_height_single WHERE river_id = ${river_id} - - - - - - - + + + @@ -824,7 +738,6 @@ - @@ -843,28 +756,31 @@ - - - + + + - - - - - SELECT id AS gauge_id, - name AS gauge_name - FROM gauges WHERE river_id = ${river_id} - - - - - - - - - - + + + + + SELECT id AS gauge_id, + name AS gauge_name + FROM gauges WHERE river_id = ${river_id} + + + + - - - - - + --> + + + + + @@ -914,680 +830,671 @@ - - - - - SELECT id AS gauge_id, - name AS gauge_name - FROM gauges WHERE river_id = ${river_id} - - - - - - - - - - - - - - + + + + + SELECT id AS gauge_id, + name AS gauge_name + FROM gauges WHERE river_id = ${river_id} + + + + + + + - + - - - - - - - - - + + + + + + + + + - - - - - - - + - - - FIXME: Following two macros look identical to me. - - - - - - - - - - - - - - - - - - - SELECT d.id AS dem_id, - r.a AS dem_lower, - r.b AS dem_upper, - d.name AS name, - d.projection || ' | ' || t.start_time || ' - ' || t.stop_time AS info - FROM dem d - JOIN ranges r ON d.range_id = r.id - JOIN time_intervals t ON d.time_interval_id = t.id - WHERE d.river_id = ${river_id} - - - - - - - - - - - - - - - - SELECT DISTINCT - name AS hws_name, - official AS hws_official, - kind_id AS hws_kind - FROM hws_lines - WHERE river_id = ${river_id} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SELECT DISTINCT - name AS hws_points_name, - official AS hws_points_official, - kind_id AS hws_points_kind - FROM hws_points - WHERE river_id = ${river_id} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SELECT count(*) as km_exists - FROM river_axes_km WHERE river_id = ${river_id} - - - - - - - - - - - - - - Grab only the actual first - - SELECT DISTINCT - cs.kind_id as kind_id, - ck.name as kind_name - FROM cross_section_tracks cs - JOIN cross_section_track_kinds ck on cs.kind_id = ck.id - WHERE river_id = ${river_id} - AND kind_id=1 - - - - - - - - - - - - - Now the other tracks - - SELECT DISTINCT - cs.kind_id as kind_id, - ck.name as kind_name, - cs.name as layer_name - FROM cross_section_tracks cs - JOIN cross_section_track_kinds ck on cs.kind_id = ck.id - WHERE river_id = ${river_id} - AND kind_id=0 - - - - - - - - - - - - - - - + + + + + + + + + + FIXME: Following two macros look identical to me. + + + + + + + + + + + - SELECT DISTINCT - ax.kind_id as kind_id, - ak.name as kind_name - FROM river_axes ax - JOIN axis_kinds ak on ax.kind_id = ak.id - WHERE river_id = ${river_id} - AND kind_id=1 + SELECT d.id AS dem_id, + r.a AS dem_lower, + r.b AS dem_upper, + d.name AS name, + d.projection || ' | ' || t.start_time || ' - ' || t.stop_time AS info + FROM dem d + JOIN ranges r ON d.range_id = r.id + JOIN time_intervals t ON d.time_interval_id = t.id + WHERE d.river_id = ${river_id} - - - - - - - - + + + - - - SELECT DISTINCT - ak.name as kind_name, - ax.kind_id as kind_id, - ax.name as layer_name - FROM river_axes ax - JOIN axis_kinds ak on ax.kind_id = ak.id - WHERE river_id = ${river_id} - AND kind_id <> 1 - + + + + + + + + + + + + - - - - - - - - + - - - - - - - - - + + + + + + + + + + + + + - - - - - SELECT count(*) as km_exists, name as name - FROM hydr_boundaries WHERE river_id = ${river_id} AND kind = 1 GROUP BY name - - - - - - - - - - - - - - - - SELECT count(*) as km_exists, name as name - FROM hydr_boundaries WHERE river_id = ${river_id} AND kind = 2 GROUP BY name - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + SELECT DISTINCT + name AS hws_name, + official AS hws_official, + kind_id AS hws_kind + FROM hws_lines + WHERE river_id = ${river_id} + + + + + + + + + + + + + SELECT DISTINCT + name AS hws_name, + official AS hws_official, + kind_id AS hws_kind + FROM hws_points + WHERE river_id = ${river_id} + + + + + + + + + + + + + SELECT count(*) AS km_exists + FROM river_axes_km WHERE river_id = ${river_id} + + + + + + + + + + + + Grab only the actual first + + SELECT DISTINCT + cs.kind_id AS kind_id, + ck.name AS kind_name + FROM cross_section_tracks cs + JOIN cross_section_track_kinds ck on cs.kind_id = ck.id + WHERE river_id = ${river_id} + AND kind_id=1 + + + + + + + + + Now the other tracks + + SELECT DISTINCT + cs.kind_id AS kind_id, + ck.name AS kind_name, + cs.name AS layer_name + FROM cross_section_tracks cs + JOIN cross_section_track_kinds ck on cs.kind_id = ck.id + WHERE river_id = ${river_id} + AND kind_id=0 + + + + + + + + + + + + + + + SELECT DISTINCT + ax.kind_id AS kind_id, + ak.name AS kind_name + FROM river_axes ax + JOIN axis_kinds ak on ax.kind_id = ak.id + WHERE river_id = ${river_id} + AND kind_id=1 + + + + + + + + + + SELECT DISTINCT + ak.name AS kind_name, + ax.kind_id AS kind_id, + ax.name AS layer_name + FROM river_axes ax + JOIN axis_kinds ak on ax.kind_id = ak.id + WHERE river_id = ${river_id} + AND kind_id <> 1 + + + + + + + + + + + + + + + SELECT DISTINCT + name + FROM hydr_boundaries + WHERE river_id = ${river_id} + AND kind = 2 + + + + + + + + SELECT DISTINCT + name + FROM hydr_boundaries_poly + WHERE river_id = ${river_id} + AND kind = 2 + + + + + + + + + + + SELECT DISTINCT + name + FROM hydr_boundaries + WHERE river_id = ${river_id} + AND kind = 1 + + What about all other line kinds? + + + + + + + + + + + + + + SELECT DISTINCT + b.sectie AS sectie_id, + sk.name AS sectie + FROM hydr_boundaries_poly b + JOIN sectie_kinds sk ON b.sectie = sk.id + WHERE b.river_id = ${river_id} + AND b.kind = 1 + + + + + + + + + + + + SELECT DISTINCT + b.sobek AS sobek_id, + sk.name AS sobek + FROM hydr_boundaries_poly b + JOIN sobek_kinds sk ON b.sobek = sk.id + WHERE b.river_id = ${river_id} + AND b.kind = 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT DISTINCT + fp.kind_id AS kind_id, + flk.name AS kind_name + FROM floodplain fp + JOIN floodplain_kinds flk on fp.kind_id = flk.id + WHERE river_id = ${river_id} + AND kind_id=1 + + + + + + + + + + SELECT DISTINCT + flk.name AS kind_name, + fp.kind_id AS kind_id, + fp.name AS layer_name + FROM floodplain fp + JOIN floodplain_kinds flk on fp.kind_id = flk.id + WHERE river_id = ${river_id} + AND kind_id <> 1 + + + + + + + + + + + + + + Call from a context where fed_name hws_kind hws_name and river_id is + availble + + + + + + - - - - - SELECT count(*) as km_exists, name as name - FROM hydr_boundaries_poly WHERE river_id = ${river_id} AND kind = 1 GROUP BY name - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - SELECT count(*) as km_exists, name as name - FROM hydr_boundaries_poly WHERE river_id = ${river_id} AND kind = 2 GROUP BY name + SELECT DISTINCT + fs.name AS fed_name, + fs.id AS fed_id + FROM hws_lines hws + JOIN fed_states fs ON hws.fed_state_id = fs.id + WHERE river_id = ${river_id} + AND hws.official=1 - - - - - - - - - + + + + SELECT DISTINCT + name AS hws_name, + kind_id AS hws_kind + FROM hws_lines + WHERE river_id = ${river_id} + AND official=1 + AND fed_state_id = ${fed_id} ORDER BY name + + + + + + - - - - - - SELECT count(*) as km_exists - FROM floodplain WHERE river_id = ${river_id} - - - - - - - - - - - - - - - Call from a context where fed_name hws_kind hws_name and river_id is - availble - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SELECT DISTINCT - fs.name AS fed_name, - fs.id AS fed_id - FROM hws_lines hws - JOIN fed_states fs ON hws.fed_state_id = fs.id - WHERE river_id = ${river_id} - AND hws.official=1 - - - - - SELECT DISTINCT - name AS hws_name, - kind_id AS hws_kind - FROM hws_lines - WHERE river_id = ${river_id} - AND official=1 - AND fed_state_id = ${fed_id} ORDER BY name - - - - - - - - - - - SELECT distinct - name AS hws_name, - kind_id AS hws_kind - FROM hws_lines - WHERE river_id = ${river_id} - AND official=1 - AND fed_state_id IS NULL - ORDER BY name - - - - - - - - - - SELECT DISTINCT - fs.name AS fed_name, - fs.id AS fed_id - FROM hws_lines hws - JOIN fed_states fs ON hws.fed_state_id = fs.id - WHERE river_id = ${river_id} - AND hws.official=0 - - - - - SELECT DISTINCT - name AS hws_name, - kind_id AS hws_kind - FROM hws_lines - WHERE river_id = ${river_id} - AND official=0 - AND fed_state_id = ${fed_id} ORDER BY name - - - - - - - - - - - SELECT distinct - name AS hws_name, - kind_id AS hws_kind - FROM hws_lines - WHERE river_id = ${river_id} - AND official=0 - AND fed_state_id IS NULL ORDER BY name - - - - - - + + + SELECT distinct + name AS hws_name, + kind_id AS hws_kind + FROM hws_lines + WHERE river_id = ${river_id} + AND official=1 + AND fed_state_id IS NULL + ORDER BY name + + + + + + + + + + SELECT DISTINCT + fs.name AS fed_name, + fs.id AS fed_id + FROM hws_lines hws + JOIN fed_states fs ON hws.fed_state_id = fs.id + WHERE river_id = ${river_id} + AND hws.official=0 + + + + + SELECT DISTINCT + name AS hws_name, + kind_id AS hws_kind + FROM hws_lines + WHERE river_id = ${river_id} + AND official=0 + AND fed_state_id = ${fed_id} ORDER BY name + + + + + + + + + + SELECT distinct + name AS hws_name, + kind_id AS hws_kind + FROM hws_lines + WHERE river_id = ${river_id} + AND official=0 + AND fed_state_id IS NULL ORDER BY name + + + + + + - - - Call from a context where fed_name hws_kind hws_name and river_id is - availble - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + Call from a context where fed_name hws_kind hws_name and river_id is + availble + + + + + + - - - - - - SELECT DISTINCT - fs.name AS fed_name, - fs.id AS fed_id - FROM hws_points hws - JOIN fed_states fs ON hws.fed_state_id = fs.id - WHERE river_id = ${river_id} - AND hws.official=1 - - - - - SELECT DISTINCT - name AS hws_name, - kind_id AS hws_kind - FROM hws_points - WHERE river_id = ${river_id} - AND official=1 - AND fed_state_id = ${fed_id} ORDER BY name - - - - - - - - - - - SELECT distinct - name AS hws_name, - kind_id AS hws_kind - FROM hws_points - WHERE river_id = ${river_id} - AND official=1 - AND fed_state_id IS NULL - ORDER BY name - - - - - - - - - - SELECT DISTINCT - fs.name AS fed_name, - fs.id AS fed_id - FROM hws_points hws - JOIN fed_states fs ON hws.fed_state_id = fs.id - WHERE river_id = ${river_id} - AND hws.official=0 - - - - - SELECT DISTINCT - name AS hws_name, - kind_id AS hws_kind - FROM hws_points - WHERE river_id = ${river_id} - AND official=0 - AND fed_state_id = ${fed_id} ORDER BY name - - - - - - - - - - - SELECT distinct - name AS hws_name, - kind_id AS hws_kind - FROM hws_points - WHERE river_id = ${river_id} - AND official=0 - AND fed_state_id IS NULL ORDER BY name - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT DISTINCT + fs.name AS fed_name, + fs.id AS fed_id + FROM hws_points hws + JOIN fed_states fs ON hws.fed_state_id = fs.id + WHERE river_id = ${river_id} + AND hws.official=1 + + + + + SELECT DISTINCT + name AS hws_name, + kind_id AS hws_kind + FROM hws_points + WHERE river_id = ${river_id} + AND official=1 + AND fed_state_id = ${fed_id} ORDER BY name + + + + + + + + + + SELECT distinct + name AS hws_name, + kind_id AS hws_kind + FROM hws_points + WHERE river_id = ${river_id} + AND official=1 + AND fed_state_id IS NULL + ORDER BY name + + + + + + + + + + SELECT DISTINCT + fs.name AS fed_name, + fs.id AS fed_id + FROM hws_points hws + JOIN fed_states fs ON hws.fed_state_id = fs.id + WHERE river_id = ${river_id} + AND hws.official=0 + + + + + SELECT DISTINCT + name AS hws_name, + kind_id AS hws_kind + FROM hws_points + WHERE river_id = ${river_id} + AND official=0 + AND fed_state_id = ${fed_id} ORDER BY name + + + + + + + + + + SELECT distinct + name AS hws_name, + kind_id AS hws_kind + FROM hws_points + WHERE river_id = ${river_id} + AND official=0 + AND fed_state_id IS NULL ORDER BY name + + + + + + @@ -1602,13 +1509,11 @@ WHERE b.river_id = ${river_id} AND b.kind_id <> 0 - - - - - - - + + + @@ -1622,17 +1527,15 @@ AND kind_id = 0 OR kind_id IS NULL - + - - - - - - - + + + - + @@ -1645,183 +1548,160 @@ - - - - - - - + + + - - - - SELECT count(*) as km_exists, name as name - FROM fixpoints WHERE river_id = ${river_id} GROUP BY name - - - - - - - - - - - - - - - - SELECT count(*) as km_exists, name as name - FROM gauge_location WHERE river_id = ${river_id} GROUP BY name - - - - - - - - - - - - - - - - - - - - SELECT count(*) as uesg_exist, name as name - FROM floodmaps - WHERE river_id = ${river_id} AND kind = 111 - GROUP BY name, kind - - - - - - - - - - - - - - - - SELECT count(*) as uesg_exist, name as name - FROM floodmaps - WHERE river_id = ${river_id} AND kind = 112 - GROUP BY name, kind - - - - - - - - - - - - - - - - - - SELECT count(*) as uesg_exist, name as name - FROM floodmaps - WHERE river_id = ${river_id} AND kind = 121 - GROUP BY name, kind - - - - - - - - - - - - - - - - SELECT count(*) as uesg_exist, name as name - FROM floodmaps - WHERE river_id = ${river_id} AND kind = 122 - GROUP BY name, kind - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + SELECT count(*) AS km_exists, name AS name + FROM fixpoints WHERE river_id = ${river_id} GROUP BY name + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + SELECT count(*) AS uesg_exist, name AS name + FROM floodmaps + WHERE river_id = ${river_id} AND kind = 111 + GROUP BY name, kind + + + + + + + + + + + + SELECT count(*) AS uesg_exist, name AS name + FROM floodmaps + WHERE river_id = ${river_id} AND kind = 112 + GROUP BY name, kind + + + + + + + + + + + + + + SELECT count(*) AS uesg_exist, name AS name + FROM floodmaps + WHERE river_id = ${river_id} AND kind = 121 + GROUP BY name, kind + + + + + + + + + + + + SELECT count(*) AS uesg_exist, name AS name + FROM floodmaps + WHERE river_id = ${river_id} AND kind = 122 + GROUP BY name, kind + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1836,25 +1716,25 @@ + - SELECT id AS bedh_id, - year AS bedh_year, - description AS bedh_descr - FROM bed_height_single WHERE river_id = ${river_id} + SELECT id AS bedh_id, + year AS bedh_year, + description AS bedh_descr + FROM bed_height_single WHERE river_id = ${river_id} - - - - - - - + + + + @@ -1864,17 +1744,16 @@ description AS bedh_descr FROM bed_height_epoch WHERE river_id = ${river_id} - - - - - - - + + + - + + @@ -1885,718 +1764,741 @@ - - - - - - - Get the user and collection-id. - - - SELECT u.id AS user_id, c.id AS collection_id, c.name as collection_name - FROM collections c JOIN users u ON c.user_id = u.id - WHERE u.gid = CAST(${user-id} AS uuid) - ORDER BY c.creation DESC - - + - - - SELECT m.id AS a_id, - m.state AS a_state, - m.gid AS a_gid, - m.creation AS a_creation, - COALESCE(ld_mode, '') AS ld_m, - COALESCE(ld_locations, '') AS ld_l, - COALESCE(ld_from, '') AS ld_f, - COALESCE(ld_to, '') AS ld_t - FROM master_artifacts_range m - WHERE m.collection_id = ${collection_id} AND m.gid <> CAST(${artifact-id} AS uuid) - AND EXISTS ( - SELECT id FROM artifact_data ad WHERE ad.artifact_id = m.id AND k = 'river' AND v = ${river}) - - - - - - - - - - - - - - - - - - SELECT m.id AS a_id, - m.state AS a_state, - m.gid AS a_gid, - m.creation AS a_creation, - ardg.v AS gaugy, - arv.v AS wqsingle - FROM master_artifacts m, - artifact_data ardg, - artifact_data arv - WHERE m.collection_id = ${collection_id} - AND m.gid = CAST(${artifact-id} AS uuid) - AND ardg.artifact_id = m.id - AND ardg.k = 'ld_gaugename' - AND arv.artifact_id = m.id - AND arv.k = 'wq_single' - AND EXISTS ( - SELECT id - FROM artifact_data ad - WHERE ad.artifact_id = m.id - AND k = 'river' - AND v = ${river}) - - + + + + Get the user and collection-id. + + SELECT u.id AS user_id, c.id AS collection_id, c.name AS collection_name + FROM collections c JOIN users u ON c.user_id = u.id + WHERE u.gid = CAST(${user-id} AS uuid) + ORDER BY c.creation DESC + + + + + SELECT m.id AS a_id, + m.state AS a_state, + m.gid AS a_gid, + m.creation AS a_creation, + COALESCE(ld_mode, '') AS ld_m, + COALESCE(ld_locations, '') AS ld_l, + COALESCE(ld_from, '') AS ld_f, + COALESCE(ld_to, '') AS ld_t + FROM master_artifacts_range m + WHERE m.collection_id = ${collection_id} AND m.gid <> CAST(${artifact-id} AS uuid) + AND EXISTS ( + SELECT id FROM artifact_data ad WHERE ad.artifact_id = m.id AND k = 'river' AND v = ${river}) + + + + + + + + + + + + + + + + + + SELECT m.id AS a_id, + m.state AS a_state, + m.gid AS a_gid, + m.creation AS a_creation, + ardg.v AS gaugy, + arv.v AS wqsingle + FROM master_artifacts m, + artifact_data ardg, + artifact_data arv + WHERE m.collection_id = ${collection_id} + AND m.gid = CAST(${artifact-id} AS uuid) + AND ardg.artifact_id = m.id + AND ardg.k = 'ld_gaugename' + AND arv.artifact_id = m.id + AND arv.k = 'wq_single' + AND EXISTS ( + SELECT id + FROM artifact_data ad + WHERE ad.artifact_id = m.id + AND k = 'river' + AND v = ${river}) + + SELECT ol.wst_id AS wstid, ol.wst_column_pos AS wstcolpos, ol.name AS olname, ol.value AS oval FROM official_q_values ol WHERE ol.value = CAST(${wqsingle} AS NUMERIC(10,2)) AND ol.gauge_name = ${gaugy} - + - + - - - - - - + + + + + + - - SHOW W-DIFFERENCES - + + SHOW W-DIFFERENCES + - - - - - + + + + + - SELECT a.gid as aid, f.id AS fid, f.name AS facet_name, f.num AS facet_num, f.description as facet_description - FROM outs as o, facets as f, artifacts as a + SELECT a.gid AS aid, f.id AS fid, f.name AS facet_name, f.num AS facet_num, f.description AS facet_description + FROM outs AS o, facets AS f, artifacts AS a WHERE f.name = 'w_differences' and f.out_id = o.id and o.artifact_id = ${a_id} and a.id = ${a_id} - + - - - - - - - - - - - - - - - SHOW REFERENCE CURVE - - - - - - - - - - - SELECT a.gid as aid, f.id AS fid, f.name AS facet_name, f.num AS facet_num, f.description as facet_description - FROM outs as o, facets as f, artifacts as a - WHERE f.name = 'reference_curve' and f.out_id = o.id and o.artifact_id = ${a_id} and a.id = ${a_id} - - - - - + - - + + - - - - - - - - - - SHOW COMPUTED DISCHARGE CURVES - - - - - - - - - - SELECT a.gid as aid, f.id AS fid, f.name AS facet_name, f.num AS facet_num, f.description as facet_description - FROM outs as o, facets as f, artifacts as a - WHERE f.name = 'computed_discharge_curve.q' and f.out_id = o.id and o.artifact_id = ${a_id} and a.id = ${a_id} - - - - - - - - - - + - - - - - - - CROSS SECTION - - - - - - - - - - - SELECT id AS out_id - FROM outs - WHERE artifact_id = ${a_id} AND name = 'cross_section' - - - - - SELECT name AS facet_name, num as facet_num, description AS facet_description - FROM facets - WHERE out_id = ${out_id} - ORDER BY num ASC, name DESC - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SELECT id AS out_id - FROM outs - WHERE artifact_id = ${a_id} AND name = 'longitudinal_section' - - - - - SELECT name AS facet_name, num as facet_num, description AS facet_description - FROM facets - WHERE out_id = ${out_id} - ORDER BY num ASC, name DESC - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SELECT id AS out_id - FROM outs - WHERE artifact_id = ${a_id} AND name = 'fix_longitudinal_section_curve' - - - - - - SELECT name AS facet_name, num as facet_num, description AS facet_description - FROM facets - WHERE out_id = ${out_id} AND ( name LIKE 'fix_deviation_ls%' OR name LIKE 'fix_sector_average_ls%' OR name LIKE 'fix_analysis_events_ls%' OR name LIKE 'fix_reference_events_ls%' ) - ORDER BY num ASC, name DESC - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SELECT id AS out_id - FROM outs - WHERE artifact_id = ${a_id} AND name = 'fix_deltawt_curve' - - - - - SELECT name AS facet_name, num as facet_num, description AS facet_description - FROM facets - WHERE out_id = ${out_id} and ( name LIKE 'fix_sector_average_dwt%' OR name LIKE 'fix_deviation_dwt%' OR name = 'fix_analysis_events_dwt' OR name = 'fix_reference_events_dwt' OR name = 'fix_analysis_periods_dwt' ) - ORDER BY num ASC, name DESC - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - SELECT id AS out_id - FROM outs - WHERE artifact_id = ${a_id} AND name = 'fix_derivate_curve' - - - - - SELECT name AS facet_name, num as facet_num, description AS facet_description - FROM facets - WHERE out_id = ${out_id} and name = 'fix_derivate_curve' - ORDER BY num ASC, name DESC - - - - - - - - - - - - - - - - - - - - - - + + SHOW REFERENCE CURVE + - - - - - - - - SELECT id AS out_id - FROM outs - WHERE artifact_id = ${a_id} AND name = 'fix_wq_curve' - - - - - SELECT name AS facet_name, num as facet_num, description AS facet_description - FROM facets - WHERE out_id = ${out_id} and ( name LIKE 'fix_sector_average_wq%' OR name = 'fix_wq_curve' OR name LIKE 'fix_analysis_events_wq%' OR name LIKE 'fix_reference_events_wq%' ) - ORDER BY num ASC, name DESC - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + - SELECT a.gid as aid, f.id AS fid, f.name AS facet_name, f.num AS facet_num, f.description as facet_description - FROM outs as o, facets as f, artifacts as a - WHERE (f.name = 'duration_curve.q' or f.name = 'duration_curve.w') and f.out_id = o.id and o.artifact_id = ${a_id} and a.id = ${a_id} + SELECT a.gid AS aid, f.id AS fid, f.name AS facet_name, f.num AS facet_num, f.description AS facet_description + FROM outs AS o, facets AS f, artifacts AS a + WHERE f.name = 'reference_curve' and f.out_id = o.id and o.artifact_id = ${a_id} and a.id = ${a_id} - + - + - - + + - + - - - - - - - - WATERLEVELS - ONLY SHOW Ws - - - + + + + + - - - - - - - - SELECT id AS out_id - FROM outs - WHERE artifact_id = ${a_id} AND name = 'longitudinal_section' - - - - - SELECT name AS facet_name, num as facet_num, description AS facet_description - FROM facets - WHERE out_id = ${out_id} and name = 'longitudinal_section.w' - ORDER BY num ASC, name DESC - - - - - - - - - - - - - - - - - - - - - + + SHOW COMPUTED DISCHARGE CURVES + - - SHOW FLOODMAPS - - - - - - - - - - - SELECT a.gid as aid, f.id AS fid, f.name AS facet_name, f.num AS facet_num, f.description as facet_description - FROM outs as o, facets as f, artifacts as a - WHERE f.name = 'floodmap.wsplgen' and f.out_id = o.id and o.artifact_id = ${a_id} and a.id = ${a_id} - - - - - - - - - - - - - - - - - - - MINFO bedheight difference - - - - - - - + + + + + - SELECT a.gid as aid, f.id AS fid, f.name AS facet_name, f.num AS facet_num, f.description as facet_description - FROM outs as o, facets as f, artifacts as a - WHERE (f.name = 'fix_sector_average_ls_0' or f.name = 'fix_sector_average_ls_1' or f.name = 'fix_sector_average_ls_2' - or f.name = 'fix_sector_average_ls_3' or f.name = 'fix_analysis_events_ls' or f.name = 'fix_reference_events_ls') - and f.out_id = o.id and o.artifact_id = ${a_id} and a.id = ${a_id} + SELECT a.gid AS aid, f.id AS fid, f.name AS facet_name, f.num AS facet_num, f.description AS facet_description + FROM outs AS o, facets AS f, artifacts AS a + WHERE f.name = 'computed_discharge_curve.q' and f.out_id = o.id and o.artifact_id = ${a_id} and a.id = ${a_id} - - - - - - - - - - - - - + + + + + + + + + + - - - - + + + + - - MINFO bedheight middle - + + CROSS SECTION + - - - - - + + + + + - SELECT a.gid as aid, f.id AS fid, f.name AS facet_name, f.num AS facet_num, f.description as facet_description - FROM outs as o, facets as f, artifacts as a - WHERE (f.name = 'longitudinal_section.w' or f.name = 'heightmarks_points') - and f.out_id = o.id and o.artifact_id = ${a_id} and a.id = ${a_id} + SELECT id AS out_id + FROM outs + WHERE artifact_id = ${a_id} AND name = 'cross_section' - - - + + + + SELECT name AS facet_name, num AS facet_num, description AS facet_description + FROM facets + WHERE out_id = ${out_id} + ORDER BY num ASC, name DESC + + + - - - - - + + + + + - + + + + + + + + + + + + + + + + + + + SELECT id AS out_id + FROM outs + WHERE artifact_id = ${a_id} AND name = 'longitudinal_section' + + + + + SELECT name AS facet_name, num AS facet_num, description AS facet_description + FROM facets + WHERE out_id = ${out_id} + ORDER BY num ASC, name DESC + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT id AS out_id + FROM outs + WHERE artifact_id = ${a_id} AND name = 'fix_longitudinal_section_curve' + + + + + + SELECT name AS facet_name, num AS facet_num, description AS facet_description + FROM facets + WHERE out_id = ${out_id} AND ( + name LIKE 'fix_deviation_ls%' OR + name LIKE 'fix_sector_average_ls%' OR + name LIKE 'fix_analysis_events_ls%' OR + name LIKE 'fix_reference_events_ls%' ) + ORDER BY num ASC, name DESC + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT id AS out_id + FROM outs + WHERE artifact_id = ${a_id} AND name = 'fix_deltawt_curve' + + + + + SELECT name AS facet_name, num AS facet_num, description AS facet_description + FROM facets + WHERE out_id = ${out_id} and ( + name LIKE 'fix_sector_average_dwt%' OR + name LIKE 'fix_deviation_dwt%' OR + name = 'fix_analysis_events_dwt' OR + name = 'fix_reference_events_dwt' OR + name = 'fix_analysis_periods_dwt' ) + ORDER BY num ASC, name DESC + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT id AS out_id + FROM outs + WHERE artifact_id = ${a_id} AND name = 'fix_derivate_curve' + + + + + SELECT name AS facet_name, num AS facet_num, description AS facet_description + FROM facets + WHERE out_id = ${out_id} and name = 'fix_derivate_curve' + ORDER BY num ASC, name DESC + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT id AS out_id + FROM outs + WHERE artifact_id = ${a_id} AND name = 'fix_wq_curve' + + + + + SELECT name AS facet_name, num AS facet_num, description AS facet_description + FROM facets + WHERE out_id = ${out_id} and ( + name LIKE 'fix_sector_average_wq%' OR + name = 'fix_wq_curve' OR + name LIKE 'fix_analysis_events_wq%' OR + name LIKE 'fix_reference_events_wq%' ) + ORDER BY num ASC, name DESC + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT a.gid AS aid, + f.id AS fid, + f.name AS facet_name, + f.num AS facet_num, + f.description AS facet_description + FROM outs AS o, facets AS f, artifacts AS a + WHERE + (f.name = 'duration_curve.q' OR f.name = 'duration_curve.w') AND + f.out_id = o.id AND + o.artifact_id = ${a_id} AND + a.id = ${a_id} + + + + + + + + + + + + + + + + + + + WATERLEVELS - ONLY SHOW Ws + + + + + + + + + + + + SELECT id AS out_id + FROM outs + WHERE artifact_id = ${a_id} AND name = 'longitudinal_section' + + + + + SELECT name AS facet_name, num AS facet_num, description AS facet_description + FROM facets + WHERE out_id = ${out_id} and name = 'longitudinal_section.w' + ORDER BY num ASC, name DESC + + + + + + + + + + + + + + + + + + + + + + + SHOW FLOODMAPS + + + + + + + + + + SELECT a.gid AS aid, + f.id AS fid, + f.name AS facet_name, + f.num AS facet_num, + f.description AS facet_description + FROM outs AS o, facets AS f, artifacts AS a + WHERE f.name = 'floodmap.wsplgen' AND + f.out_id = o.id AND + o.artifact_id = ${a_id} AND + a.id = ${a_id} + + + + + + + + + + + + + + + + + + + MINFO bedheight difference + + + + + + + + + + SELECT a.gid AS aid, + f.id AS fid, + f.name AS facet_name, + f.num AS facet_num, + f.description AS facet_description + FROM outs AS o, facets AS f, artifacts AS a + WHERE ( + f.name = 'fix_sector_average_ls_0' OR + f.name = 'fix_sector_average_ls_1' OR + f.name = 'fix_sector_average_ls_2' OR + f.name = 'fix_sector_average_ls_3' OR + f.name = 'fix_analysis_events_ls' OR + f.name = 'fix_reference_events_ls' + ) AND f.out_id = o.id AND o.artifact_id = ${a_id} AND a.id = ${a_id} + + + + + + + + + + + + + + + + + + + + + MINFO bedheight middle + + + + + + + + + + SELECT a.gid AS aid, + f.id AS fid, + f.name AS facet_name, + f.num AS facet_num, + f.description AS facet_description + FROM outs AS o, facets AS f, artifacts AS a + WHERE ( + f.name = 'longitudinal_section.w' OR + f.name = 'heightmarks_points' + ) AND f.out_id = o.id AND o.artifact_id = ${a_id} AND a.id = ${a_id} + + + + + + + + + + + - + - - - - + + + + - + + + + SELECT id AS out_id + FROM outs + WHERE artifact_id = ${a_id} AND name = 'floodmap' + + - SELECT id AS out_id - FROM outs - WHERE artifact_id = ${a_id} AND name = 'floodmap' + SELECT name AS facet_name, + num AS facet_num, + description AS facet_description + FROM facets + WHERE out_id = ${out_id} AND name = 'floodmap.usershape' + ORDER BY num ASC, name DESC - - - - SELECT name AS facet_name, num as facet_num, description AS facet_description - FROM facets - WHERE out_id = ${out_id} and name = 'floodmap.usershape' - ORDER BY num ASC, name DESC - - - - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - Include System specific part when 'load-system' is in parameters. - ----------------------------------------------------------------- - - - - - - + + + Include System specific part when 'load-system' is in parameters. + ----------------------------------------------------------------- + + + - - - Include System specific part only if no user ID is given. - --------------------------------------------------------- - - + + Include System specific part only if no user ID is given. + --------------------------------------------------------- + + + diff -r 6dbc111e9aec -r 33d735f5433e flys-artifacts/src/main/java/de/intevation/flys/artifacts/SQRelationArtifact.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/SQRelationArtifact.java Tue Apr 02 08:58:24 2013 +0200 @@ -0,0 +1,158 @@ +package de.intevation.flys.artifacts; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.log4j.Logger; +import org.w3c.dom.Document; + +import de.intevation.artifactdatabase.data.DefaultStateData; +import de.intevation.artifactdatabase.state.DefaultOutput; +import de.intevation.artifactdatabase.state.Facet; +import de.intevation.artifacts.ArtifactFactory; +import de.intevation.artifacts.ArtifactNamespaceContext; +import de.intevation.artifacts.CallMeta; +import de.intevation.artifacts.common.utils.XMLUtils; +import de.intevation.flys.artifacts.model.sq.StaticSQRelation; +import de.intevation.flys.artifacts.resources.Resources; +import de.intevation.flys.artifacts.states.StaticState; +import de.intevation.flys.artifacts.states.sq.SQStaticState; + + +public class SQRelationArtifact +extends AbstractStaticStateArtifact +{ + private static final Logger logger = + Logger.getLogger(SQRelationArtifact.class); + + public static final String XPATH_RIVER = "/art:action/art:river/@art:name"; + public static final String XPATH_STATION = + "/art:action/art:measurement_station/@art:number"; + public static final String NAME = "staticsqrelation"; + public static final String STATIC_STATE_NAME = "state.sqrelation.static"; + public static final String UIPROVIDER = "static_sqrelation"; + public static final String SQ_RELATION_OUT_A = "sq_relation_a"; + public static final String SQ_RELATION_OUT_B = "sq_relation_b"; + public static final String SQ_RELATION_OUT_C = "sq_relation_c"; + public static final String SQ_RELATION_OUT_D = "sq_relation_d"; + public static final String SQ_RELATION_OUT_E = "sq_relation_e"; + public static final String SQ_RELATION_OUT_F = "sq_relation_f"; + + + @Override + public void setup( + String identifier, + ArtifactFactory factory, + Object context, + CallMeta callmeta, + Document data + ) { + logger.debug("SQRelationArtifact.setup()"); + + String river = XMLUtils.xpathString( + data, + XPATH_RIVER, + ArtifactNamespaceContext.INSTANCE); + String station = XMLUtils.xpathString( + data, + XPATH_STATION, + ArtifactNamespaceContext.INSTANCE); + + addData( + "river", + new DefaultStateData( + "river", + Resources.getMsg(callmeta, "static.sq.river", "Rivername"), + "String", + river)); + addData( + "station", + new DefaultStateData( + "station", + Resources.getMsg(callmeta, "static.sq.station", "Station"), + "String", + station)); + super.setup(identifier, factory, context, callmeta, data); + } + + @Override + protected void initStaticState() { + StaticState state = new SQStaticState(STATIC_STATE_NAME); + + List fs = new ArrayList(); + state.staticCompute(fs, this); + + if (hasParameter(StaticSQRelation.Parameter.A, fs)) { + DefaultOutput outputA = new DefaultOutput( + SQ_RELATION_OUT_A, + "output.static.sqrelation.a", + "image/png", + fs, + "chart"); + state.addOutput(outputA); + } + if (hasParameter(StaticSQRelation.Parameter.B, fs)) { + DefaultOutput outputB = new DefaultOutput( + SQ_RELATION_OUT_B, + "output.static.sqrelation.b", + "image/png", + fs, + "chart"); + state.addOutput(outputB); + } + if (hasParameter(StaticSQRelation.Parameter.C, fs)) { + DefaultOutput outputC = new DefaultOutput( + SQ_RELATION_OUT_C, + "output.static.sqrelation.c", + "image/png", + fs, + "chart"); + state.addOutput(outputC); + } + if (hasParameter(StaticSQRelation.Parameter.D, fs)) { + DefaultOutput outputD = new DefaultOutput( + SQ_RELATION_OUT_D, + "output.static.sqrelation.d", + "image/png", + fs, + "chart"); + state.addOutput(outputD); + } + if (hasParameter(StaticSQRelation.Parameter.E, fs)) { + DefaultOutput outputE = new DefaultOutput( + SQ_RELATION_OUT_E, + "output.static.sqrelation.e", + "image/png", + fs, + "chart"); + state.addOutput(outputE); + } + if (hasParameter(StaticSQRelation.Parameter.F, fs)) { + DefaultOutput outputF = new DefaultOutput( + SQ_RELATION_OUT_F, + "output.static.sqrelation.f", + "image/png", + fs, + "chart"); + state.addOutput(outputF); + } + addFacets(STATIC_STATE_NAME, fs); + state.setUIProvider(UIPROVIDER); + setStaticState(state); + } + + @Override + public String getName() { + return NAME; + } + + private boolean hasParameter(StaticSQRelation.Parameter p, List fs) { + for (Facet f : fs) { + if (f.getName().equals("sq_" + + p.toString().toLowerCase() + "_curve")) { + return true; + } + } + return false; + } +} diff -r 6dbc111e9aec -r 33d735f5433e flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSFloodplainArtifact.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSFloodplainArtifact.java Thu Mar 28 12:11:13 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSFloodplainArtifact.java Tue Apr 02 08:58:24 2013 +0200 @@ -84,21 +84,6 @@ riverId = 0; } - public int getRiverId() { - if (riverId == 0) { - String ids = artifact.getDataAsString("ids"); - - try { - riverId = Integer.parseInt(ids); - } - catch (NumberFormatException nfe) { - logger.error("Cannot parse river id from '" + ids + "'"); - } - } - - return riverId; - } - protected River getRiver() { return RiverFactory.getRiver(getRiverId()); } @@ -121,19 +106,46 @@ @Override protected Envelope getExtent(boolean reproject) { - River river = getRiver(); - Floodplain plain = Floodplain.getFloodplain(river.getName()); + River river = getRiver(); + List fps; - Envelope e = plain.getGeom().getEnvelopeInternal(); + String kind = getIdPart(2); - return e != null && reproject - ? GeometryUtils.transform(e, getSrid()) - : e; + if (kind != null && ! kind.equals("1")) { + fps = Floodplain.getFloodplains(river.getName(), + getName(), Integer.parseInt(kind)); + } else { + fps = Floodplain.getFloodplains(river.getName(), 1); + } + + Envelope max = null; + + for (Floodplain fp: fps) { + Envelope env = fp.getGeom().getEnvelopeInternal(); + + if (max == null) { + max = env; + continue; + } + + max.expandToInclude(env); + } + + return max != null && reproject + ? GeometryUtils.transform(max, getSrid()) + : max; } @Override protected String getFilter() { - return "river_id=" + String.valueOf(getRiverId()); + String kind = getIdPart(2); + if (kind != null && ! kind.equals("1")) { + return "river_id=" + String.valueOf(getRiverId()) + + " AND kind_id=" + kind + + " AND name='" + getName() + "'"; + } + return "river_id=" + String.valueOf(getRiverId()) + + " AND kind_id=1"; } @Override diff -r 6dbc111e9aec -r 33d735f5433e flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSHydrBoundaryArtifact.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSHydrBoundaryArtifact.java Thu Mar 28 12:11:13 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSHydrBoundaryArtifact.java Tue Apr 02 08:58:24 2013 +0200 @@ -102,8 +102,14 @@ @Override protected Envelope getExtent(boolean reproject) { - List boundaries = HydrBoundary.getHydrBoundaries( - getRiverId(), getName()); + List boundaries; + String kind = getIdPart(2); + if (kind != null) { + boundaries = HydrBoundary.getHydrBoundaries(getRiverId(), + getName(), Integer.parseInt(kind)); + } else { + boundaries = HydrBoundary.getHydrBoundaries(getRiverId(), getName()); + } Envelope max = null; @@ -125,6 +131,12 @@ @Override protected String getFilter() { + String kind = getIdPart(2); + if (kind != null) { + return "river_id=" + String.valueOf(getRiverId()) + + " AND name='" + getName() + "'" + + " AND kind = " + kind; + } return "river_id=" + String.valueOf(getRiverId()) + " AND name='" + getName() + "'"; } diff -r 6dbc111e9aec -r 33d735f5433e flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSHydrBoundaryPolyArtifact.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSHydrBoundaryPolyArtifact.java Thu Mar 28 12:11:13 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSHydrBoundaryPolyArtifact.java Tue Apr 02 08:58:24 2013 +0200 @@ -102,8 +102,31 @@ @Override protected Envelope getExtent(boolean reproject) { - List boundaries = HydrBoundaryPoly.getHydrBoundaries( - getRiverId(), getName()); + String kind = getIdPart(2); + String sectie = getIdPart(3); + String sobek = getIdPart(4); + int kindId = -1; + int sectieId = -1; + int sobekId = -1; + + if (kind != null) { + kindId = Integer.parseInt(kind); + } + if (sectie != null && !sectie.equals("-1")) { + sectieId = Integer.parseInt(sectie); + } + if (sobek != null && !sobek.equals("-1")) { + sobekId = Integer.parseInt(sobek); + } + + List boundaries; + if (kindId == -1 && sobekId == -1 && sectieId == -1) { + boundaries = HydrBoundaryPoly.getHydrBoundaries( + getRiverId(), getName()); + } else { + boundaries = HydrBoundaryPoly.getHydrBoundaries( + getRiverId(), kindId, sectieId, sobekId); + } Envelope max = null; @@ -125,8 +148,29 @@ @Override protected String getFilter() { + // Expected id string: + // river_id;layer_name;kind;sectie;sobek + String kind = getIdPart(2); + String sectie = getIdPart(3); + String sobek = getIdPart(4); + + String filter = ""; + if (kind != null && !kind.equals("-1")) { + filter += " AND kind = " + kind; + } + if (sectie != null && !sectie.equals("-1")) { + filter += " AND sectie = " + sectie; + } + if (sobek != null && !sobek.equals("-1")) { + filter += " AND sobek = " + sobek; + } + + if (filter.isEmpty()) { + filter = " AND name='" + getName() + "'"; + } + return "river_id=" + String.valueOf(getRiverId()) - + " AND name='" + getName() + "'"; + + filter; } @Override @@ -134,10 +178,10 @@ String srid = getSrid(); if (FLYSUtils.isUsingOracle()) { - return "geom FROM hydr_boundaries USING SRID " + srid; + return "geom FROM hydr_boundaries_poly USING SRID " + srid; } else { - return "geom FROM hydr_boundaries USING UNIQUE id USING SRID " + srid; + return "geom FROM hydr_boundaries_poly USING UNIQUE id USING SRID " + srid; } } diff -r 6dbc111e9aec -r 33d735f5433e flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/StaticSQRelationAccess.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/StaticSQRelationAccess.java Tue Apr 02 08:58:24 2013 +0200 @@ -0,0 +1,31 @@ +package de.intevation.flys.artifacts.access; + +import org.apache.log4j.Logger; + +import de.intevation.flys.artifacts.FLYSArtifact; + + +public class StaticSQRelationAccess +extends RiverAccess +{ + /** The logger that is used in this state. */ + private static final Logger logger = + Logger.getLogger(StaticSQRelationAccess.class); + + private String measurementStation; + + public StaticSQRelationAccess(FLYSArtifact artifact) { + super(artifact); + } + + /** Get measurement station */ + public String getMeasurementStation() { + if (measurementStation == null) { + measurementStation = getString("station"); + } + if (logger.isDebugEnabled()) { + logger.debug("measurement station: '" + measurementStation + "'"); + } + return measurementStation; + } +} diff -r 6dbc111e9aec -r 33d735f5433e flys-artifacts/src/main/java/de/intevation/flys/artifacts/datacage/templating/Builder.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/datacage/templating/Builder.java Thu Mar 28 12:11:13 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/datacage/templating/Builder.java Tue Apr 02 08:58:24 2013 +0200 @@ -32,6 +32,7 @@ import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; +import org.w3c.dom.NamedNodeMap; /** Handles and evaluate meta-data template against dbs. */ @@ -185,7 +186,7 @@ } /** - * Handle a \ node. + * Handle a dc:context node. */ protected void context(Node parent, Element current) throws SQLException @@ -282,72 +283,82 @@ return new ResultData(rd.getColumnLabels(), filtered); } + protected void filter(Node parent, Element current) + throws SQLException + { + String expr = current.getAttribute("expr"); + + if ((expr = expr.trim()).length() == 0) { + expr = null; + } + + NodeList subs = current.getChildNodes(); + int S = subs.getLength(); + if (S == 0) { + log.debug("dc:filter has no children"); + return; + } + + ResultData orig = null; + Pair pair = null; + + if (expr != null && !connectionsStack.isEmpty()) { + pair = connectionsStack.peek(); + orig = pair.getB(); + pair.setB(createFilteredResultData(orig, expr)); + } + + try { + for (int i = 0; i < S; ++i) { + build(parent, subs.item(i)); + } + } + finally { + if (orig != null) { + pair.setB(orig); + } + } + } + /** * Kind of foreach over results of a statement within a context. */ - protected void elements(Node parent, Element current) + protected void foreach(Node parent, Element current) throws SQLException { - log.debug("dc:elements"); + log.debug("dc:for-each"); if (connectionsStack.isEmpty()) { - log.warn("dc:elements without having results"); + log.debug("dc:for-each without having results"); return; } - String filter = current.getAttribute("filter"); - - if ((filter = filter.trim()).length() == 0) { - filter = null; - } - NodeList subs = current.getChildNodes(); int S = subs.getLength(); if (S == 0) { - log.debug("dc:elements has no children"); + log.debug("dc:for-each has no children"); return; } Pair pair = connectionsStack.peek(); - ResultData rd = connectionsStack.peek().getB(); - ResultData orig = rd; - - if (filter != null) { - ResultData rdCopy = createFilteredResultData(rd, filter); - pair.setB(rdCopy); - rd = rdCopy; - } - try { - String [] columns = rd.getColumnLabels(); + ResultData rd = pair.getB(); - //if (log.isDebugEnabled()) { - // log.debug("pushing vars: " - // + java.util.Arrays.toString(columns)); - //} + String [] columns = rd.getColumnLabels(); - for (Object [] row: rd.getRows()) { - frames.enter(); - try { - frames.put(columns, row); - //if (log.isDebugEnabled()) { - // log.debug("current vars: " + frames.dump()); - //} - for (int i = 0; i < S; ++i) { - build(parent, subs.item(i)); - } - } - finally { - frames.leave(); + for (Object [] row: rd.getRows()) { + frames.enter(); + try { + frames.put(columns, row); + for (int i = 0; i < S; ++i) { + build(parent, subs.item(i)); } } - } - finally { - if (filter != null) { - pair.setB(orig); - } + finally { + frames.leave(); + } } } @@ -660,45 +671,47 @@ } else { String localName = current.getLocalName(); + Element curr = (Element)current; if ("attribute".equals(localName)) { - attribute(parent, (Element)current); + attribute(parent, curr); } else if ("context".equals(localName)) { - context(parent, (Element)current); + context(parent, curr); } else if ("if".equals(localName)) { - ifClause(parent, (Element)current); + ifClause(parent, curr); } else if ("choose".equals(localName)) { - choose(parent, (Element)current); + choose(parent, curr); } else if ("call-macro".equals(localName)) { - callMacro(parent, (Element)current); + callMacro(parent, curr); } else if ("macro-body".equals(localName)) { - macroBody(parent, (Element)current); + macroBody(parent, curr); } - else if ("macro".equals(localName)) { - // Simply ignore the definition. + else if ("macro".equals(localName) + || "comment".equals(localName) + || "statement".equals(localName)) { + // Simply ignore them. } else if ("element".equals(localName)) { - element(parent, (Element)current); + element(parent, curr); } - else if ("elements".equals(localName)) { - elements(parent, (Element)current); + else if ("for-each".equals(localName)) { + foreach(parent, curr); + } + else if ("filter".equals(localName)) { + filter(parent, curr); } else if ("text".equals(localName)) { - text(parent, (Element)current); + text(parent, curr); } else if ("variable".equals(localName)) { - variable((Element)current); - } - else if ("comment".equals(localName) - || "statement".equals(localName)) { - // ignore comments and statements in output + variable(curr); } else if ("convert".equals(localName)) { - convert((Element)current); + convert(curr); } else { log.warn("unknown '" + localName + "' -> ignore"); @@ -721,13 +734,17 @@ Node copy = owner.importNode(current, false); - if (copy.getNodeType() == Node.ATTRIBUTE_NODE) { - evaluateAttributeValue((Attr)copy); + NodeList children = current.getChildNodes(); + for (int i = 0, N = children.getLength(); i < N; ++i) { + build(copy, children.item(i)); } - else { - NodeList children = current.getChildNodes(); - for (int i = 0, N = children.getLength(); i < N; ++i) { - build(copy, children.item(i)); + if (copy.getNodeType() == Node.ELEMENT_NODE) { + NamedNodeMap nnm = ((Element)copy).getAttributes(); + for (int i = 0, N = nnm.getLength(); i < N; ++i) { + Node n = nnm.item(i); + if (n.getNodeType() == Node.ATTRIBUTE_NODE) { + evaluateAttributeValue((Attr)n); + } } } parent.appendChild(copy); diff -r 6dbc111e9aec -r 33d735f5433e flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/StaticSQCacheKey.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/StaticSQCacheKey.java Tue Apr 02 08:58:24 2013 +0200 @@ -0,0 +1,30 @@ +package de.intevation.flys.artifacts.model.sq; + +import java.io.Serializable; + + +public class StaticSQCacheKey +implements Serializable +{ + public static final String CACHE_NAME = "static-sq-relation"; + + private String river; + private int measurementId; + + public StaticSQCacheKey(String river, int measurementId) { + this.river = river; + this.measurementId = measurementId; + } + + public int hashCode() { + return this.river.hashCode() | measurementId; + } + + public boolean equals(Object other) { + if (!(other instanceof StaticSQCacheKey)) { + return false; + } + StaticSQCacheKey o = (StaticSQCacheKey) other; + return this.river == o.river && this.measurementId == o.measurementId; + } +} diff -r 6dbc111e9aec -r 33d735f5433e flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/StaticSQContainer.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/StaticSQContainer.java Tue Apr 02 08:58:24 2013 +0200 @@ -0,0 +1,85 @@ +package de.intevation.flys.artifacts.model.sq; + +import java.util.ArrayList; +import java.util.List; + + +public class StaticSQContainer +{ + private String description; + private String stationName; + private double km; + + private List relations; + + + public StaticSQContainer() { + relations = new ArrayList(); + } + + public StaticSQContainer( + String stationName, + String description, + double km + ) { + this.stationName = stationName; + this.description = description; + this.km = km; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getStationName() { + return stationName; + } + + public void setStationName(String stationName) { + this.stationName = stationName; + } + + public double getKm() { + return km; + } + + public void setKm(double km) { + this.km = km; + } + + public List getSQRelations() { + return relations; + } + + public void setSQRelations(List relations) { + this.relations = relations; + } + + public void addSQRelation(StaticSQRelation relation) { + this.relations.add(relation); + } + + public StaticSQRelation getSQRelation(int ndx) { + return this.relations.get(ndx); + } + + public int size() { + return this.relations.size(); + } + + public List getRelationsByParameter( + StaticSQRelation.Parameter parameter + ) { + List result = new ArrayList(); + for (StaticSQRelation relation : relations) { + if (relation.getParameter() == parameter) { + result.add(relation); + } + } + return result; + } +} diff -r 6dbc111e9aec -r 33d735f5433e flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/StaticSQFactory.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/StaticSQFactory.java Tue Apr 02 08:58:24 2013 +0200 @@ -0,0 +1,123 @@ +package de.intevation.flys.artifacts.model.sq; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +import net.sf.ehcache.Cache; +import net.sf.ehcache.Element; + +import org.apache.log4j.Logger; +import org.hibernate.Query; +import org.hibernate.Session; + +import de.intevation.flys.artifacts.cache.CacheFactory; +import de.intevation.flys.backend.SessionHolder; + + +public class StaticSQFactory +{ + private static final Logger log = + Logger.getLogger(StaticSQFactory.class); + + public static final String SQL_SQ = + "SELECT " + + "sq.description AS description,"+ + "ti.start_time AS start_time," + + "ti.stop_time AS stop_time, " + + "ms.name AS station_name, " + + "ms.station AS station_km, " + + "ms.measurement_type AS measurement_type, " + + "sqv.parameter AS parameter, " + + "sqv.a AS a, " + + "sqv.b AS b, " + + "sqv.qmax AS qmax " + + "FROM sq_relation sq " + + "JOIN time_intervals ti ON ti.id = sq.time_interval_id " + + "JOIN rivers r ON r.id = sq.river_id " + + "JOIN sq_relation_value sqv ON sqv.sq_relation_id = sq.id " + + "JOIN measurement_station ms ON sqv.measurement_station_id = ms.id " + + "WHERE " + + "r.name = :river " + + "AND ms.id = :ms_id "; + + + private StaticSQFactory() { + } + + public static StaticSQContainer getSQRelations( + String river, + int measurementStation + ) { + Cache cache = CacheFactory.getCache(StaticSQCacheKey.CACHE_NAME); + + StaticSQCacheKey cacheKey; + + if (cache != null) { + cacheKey = new StaticSQCacheKey(river, measurementStation); + Element element = cache.get(cacheKey); + if (element != null) { + log.debug("Got static bedheight values from cache"); + return (StaticSQContainer)element.getValue(); + } + } + else { + cacheKey = null; + } + + StaticSQContainer values = getUncached(river, measurementStation); + + if (values != null && cacheKey != null) { + log.debug("Store static sq relations in cache."); + Element element = new Element(cacheKey, values); + cache.put(element); + } + return values; + } + + private static StaticSQContainer getUncached( + String river, + int measurementStation + ) { + Session session = SessionHolder.HOLDER.get(); + + Query query = session.createSQLQuery(SQL_SQ) + .addScalar("description") + .addScalar("start_time") + .addScalar("stop_time") + .addScalar("station_name") + .addScalar("station_km") + .addScalar("measurement_type") + .addScalar("parameter") + .addScalar("a") + .addScalar("b") + .addScalar("qmax"); + + query.setParameter("river", river); + query.setParameter("ms_id", measurementStation); + + List list = query.list(); + + if (list.isEmpty()) { + return new StaticSQContainer(); + } + + StaticSQContainer sq = new StaticSQContainer(); + sq.setDescription((String)list.get(0)[0]); + sq.setStationName((String)list.get(0)[3]); + sq.setKm(((BigDecimal)list.get(0)[4]).doubleValue()); + + for (Object[] row : list) { + StaticSQRelation relation = new StaticSQRelation(); + relation.setStartTime((Date)row[1]); + relation.setStopTime((Date)row[2]); + relation.setType((String)row[5]); + relation.setParameter((String)row[6]); + relation.setA(((BigDecimal)row[7]).doubleValue()); + relation.setB(((BigDecimal)row[8]).doubleValue()); + relation.setQmax(((BigDecimal)row[9]).doubleValue()); + sq.addSQRelation(relation); + } + return sq; + } +} diff -r 6dbc111e9aec -r 33d735f5433e flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/StaticSQRelation.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/StaticSQRelation.java Tue Apr 02 08:58:24 2013 +0200 @@ -0,0 +1,103 @@ +package de.intevation.flys.artifacts.model.sq; + +import java.io.Serializable; +import java.util.Date; + + +public class StaticSQRelation implements Serializable{ + + private Date startTime; + private Date stopTime; + private String type; + private Parameter parameter; + private double a; + private double b; + private double qmax; + + public static enum Parameter { + A, B, C, D, E, F + } + + + public StaticSQRelation() { + } + + public StaticSQRelation( + Date startTime, + Date stopTime, + String type, + Parameter parameter, + double a, + double b + ) { + this.startTime = startTime; + this.stopTime = stopTime; + this.type = type; + this.parameter = parameter; + this.a = a; + this.b = b; + } + + public Date getStartTime() { + return startTime; + } + + public void setStartTime(Date startTime) { + this.startTime = startTime; + } + + public Date getStopTime() { + return stopTime; + } + + public void setStopTime(Date stopTime) { + this.stopTime = stopTime; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public Parameter getParameter() { + return parameter; + } + + public void setParameter(Parameter parameter) { + this.parameter = parameter; + } + + public void setParameter(String parameter) { + if (parameter == null) { + return; + } + this.parameter = Parameter.valueOf(parameter); + } + + public double getA() { + return a; + } + + public void setA(double a) { + this.a = a; + } + + public double getB() { + return b; + } + + public void setB(double b) { + this.b = b; + } + + public double getQmax() { + return qmax; + } + + public void setQmax(double qmax) { + this.qmax = qmax; + } +} diff -r 6dbc111e9aec -r 33d735f5433e flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/MeasurementStationInfoService.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/MeasurementStationInfoService.java Thu Mar 28 12:11:13 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/MeasurementStationInfoService.java Tue Apr 02 08:58:24 2013 +0200 @@ -15,7 +15,6 @@ import de.intevation.artifacts.GlobalContext; import de.intevation.flys.model.MeasurementStation; -import de.intevation.flys.model.Gauge; import de.intevation.flys.model.Range; import de.intevation.flys.model.TimeInterval; @@ -106,8 +105,7 @@ } } - Gauge gauge = mstation.getGauge(); - String gaugename = gauge.getName(); + String gaugename= mstation.getGaugeName(); if (gaugename != null) { Element egauge = ec.create("gauge"); diff -r 6dbc111e9aec -r 33d735f5433e flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/sq/SQStaticState.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/sq/SQStaticState.java Tue Apr 02 08:58:24 2013 +0200 @@ -0,0 +1,80 @@ +package de.intevation.flys.artifacts.states.sq; + +import java.text.DateFormat; +import java.util.List; + + +import org.apache.log4j.Logger; + +import de.intevation.artifactdatabase.state.Facet; +import de.intevation.flys.artifacts.FLYSArtifact; +import de.intevation.flys.artifacts.access.StaticSQRelationAccess; +import de.intevation.flys.artifacts.model.sq.StaticSQContainer; +import de.intevation.flys.artifacts.model.sq.StaticSQFactory; +import de.intevation.flys.artifacts.model.sq.StaticSQRelation; +import de.intevation.flys.artifacts.states.StaticState; + + +public class SQStaticState +extends StaticState +{ + private static final Logger log = + Logger.getLogger(SQStaticState.class); + + public SQStaticState() { + super(); + } + + public SQStaticState(String name) { + super(name); + } + + @Override + public Object staticCompute( + List facets, + FLYSArtifact artifact + ) { + StaticSQRelationAccess access = new StaticSQRelationAccess(artifact); + + String river = access.getRiver(); + String measurementStation = access.getMeasurementStation(); + + int ms = -1; + try { + ms = Integer.parseInt(measurementStation); + } + catch (NumberFormatException nfe) { + log.error("Unparseable measurement station: " + measurementStation); + return null; + } + + StaticSQContainer sqRelations = + StaticSQFactory.getSQRelations(river, ms); + + for (StaticSQRelation.Parameter p: StaticSQRelation.Parameter.values()) { + + List relations = + sqRelations.getRelationsByParameter(p); + + if (!relations.isEmpty()) { + int count = 0; + + for (StaticSQRelation relation : relations) { + String name = "sq_" + p.toString().toLowerCase() + "_curve"; + DateFormat df = + DateFormat.getDateInstance(DateFormat.SHORT); + String desc = p.toString() + ": " + + df.format(relation.getStartTime()) + " - " + + df.format(relation.getStopTime()); + facets.add(new StaticSQRelationFacet( + count, + name, + desc, + relation)); + count++; + } + } + } + return null; + } +} diff -r 6dbc111e9aec -r 33d735f5433e flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/sq/StaticSQRelationFacet.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/sq/StaticSQRelationFacet.java Tue Apr 02 08:58:24 2013 +0200 @@ -0,0 +1,49 @@ +package de.intevation.flys.artifacts.states.sq; + +import de.intevation.artifactdatabase.state.DefaultFacet; +import de.intevation.artifactdatabase.state.Facet; +import de.intevation.artifacts.Artifact; +import de.intevation.artifacts.CallContext; +import de.intevation.flys.artifacts.math.fitting.Function; +import de.intevation.flys.artifacts.math.fitting.FunctionFactory; +import de.intevation.flys.artifacts.model.sq.SQFunction; +import de.intevation.flys.artifacts.model.sq.StaticSQRelation; + + +public class StaticSQRelationFacet +extends DefaultFacet +implements Facet +{ + public static final String FUNCTION = "sq-pow"; + + private StaticSQRelation relation; + + + public StaticSQRelationFacet( + int ndx, + String name, + String description, + StaticSQRelation relation) { + super(ndx, name, description); + this.relation = relation; + } + + @Override + public Object getData(Artifact artifact, CallContext context) { + double qmax = relation.getQmax(); + double[] coeffs = new double[] {relation.getA(), relation.getB()}; + Function func = FunctionFactory.getInstance().getFunction(FUNCTION); + de.intevation.flys.artifacts.math.Function function = + func.instantiate(coeffs); + SQFunction sqf = new SQFunction(function, 0, qmax); + return sqf; + } + + @Override + public Facet deepCopy() { + StaticSQRelationFacet copy = + new StaticSQRelationFacet(index, name, description, relation); + copy.set(this); + return copy; + } +} diff -r 6dbc111e9aec -r 33d735f5433e flys-artifacts/src/main/resources/messages.properties --- a/flys-artifacts/src/main/resources/messages.properties Thu Mar 28 12:11:13 2013 +0100 +++ b/flys-artifacts/src/main/resources/messages.properties Tue Apr 02 08:58:24 2013 +0200 @@ -592,6 +592,8 @@ sq.km.chart.title = Measuring Points sq.km.chart.km.axis = km sq.km.chart.date.axis = Date +static.sq.river = River +static.sq.station = Station module.winfo = WINFO module.minfo = MINFO diff -r 6dbc111e9aec -r 33d735f5433e flys-artifacts/src/main/resources/messages_de.properties --- a/flys-artifacts/src/main/resources/messages_de.properties Thu Mar 28 12:11:13 2013 +0100 +++ b/flys-artifacts/src/main/resources/messages_de.properties Tue Apr 02 08:58:24 2013 +0200 @@ -595,6 +595,8 @@ sq.km.chart.title = Messstellen sq.km.chart.km.axis = km sq.km.chart.date.axis = Datum +static.sq.river = Gewaesser +static.sq.station = Messstelle module.winfo = WINFO module.minfo = MINFO diff -r 6dbc111e9aec -r 33d735f5433e flys-artifacts/src/main/resources/messages_de_DE.properties --- a/flys-artifacts/src/main/resources/messages_de_DE.properties Thu Mar 28 12:11:13 2013 +0100 +++ b/flys-artifacts/src/main/resources/messages_de_DE.properties Tue Apr 02 08:58:24 2013 +0200 @@ -593,6 +593,8 @@ sq.km.chart.title = Messstellen sq.km.chart.km.axis = km sq.km.chart.date.axis = Datum +static.sq.river = Gewaesser +static.sq.station = Messstelle module.winfo = WINFO module.minfo = MINFO diff -r 6dbc111e9aec -r 33d735f5433e flys-artifacts/src/main/resources/messages_en.properties --- a/flys-artifacts/src/main/resources/messages_en.properties Thu Mar 28 12:11:13 2013 +0100 +++ b/flys-artifacts/src/main/resources/messages_en.properties Tue Apr 02 08:58:24 2013 +0200 @@ -593,6 +593,8 @@ sq.km.chart.title = Measuring Points sq.km.chart.km.axis = km sq.km.chart.date.axis = Date +static.sq.river = River +static.sq.station = Station module.winfo = WINFO module.minfo = MINFO diff -r 6dbc111e9aec -r 33d735f5433e flys-backend/contrib/shpimporter/boundaries.py --- a/flys-backend/contrib/shpimporter/boundaries.py Thu Mar 28 12:11:13 2013 +0100 +++ b/flys-backend/contrib/shpimporter/boundaries.py Tue Apr 02 08:58:24 2013 +0200 @@ -32,7 +32,7 @@ def isShapeRelevant(self, name, path): shp = ogr.Open(path) if self.isGeometryValid(shp.GetLayerByName(name).GetGeomType()) and \ - self.getKind(path) > 0: + self.getKind(path) > 0 and not "talaue" in path.lower(): return True else: return False @@ -59,9 +59,13 @@ newFeat.SetField("kind", kind) if self.IsFieldSet(feat, "SECTIE"): newFeat.SetField("sectie", feat.GetField("SECTIE")) + else: + newFeat.SetField("sectie", 0) if self.IsFieldSet(feat, "SOBEK"): newFeat.SetField("sobek", feat.GetField("SOBEK")) + else: + newFeat.SetField("sobek", 0) if self.IsFieldSet(feat, "river_id"): newFeat.SetField("river_id", feat.GetField("river_id")) @@ -102,10 +106,13 @@ if self.IsFieldSet(feat, "SECTIE"): newFeat.SetField("sectie", feat.GetField("SECTIE")) + else: + newFeat.SetField("sectie", 0) if self.IsFieldSet(feat, "SOBEK"): newFeat.SetField("sobek", feat.GetField("SOBEK")) - + else: + newFeat.SetField("sobek", 0) if self.IsFieldSet(feat, "river_id"): newFeat.SetField("river_id", feat.GetField("river_id")) diff -r 6dbc111e9aec -r 33d735f5433e flys-backend/doc/schema/oracle-minfo.sql --- a/flys-backend/doc/schema/oracle-minfo.sql Thu Mar 28 12:11:13 2013 +0100 +++ b/flys-backend/doc/schema/oracle-minfo.sql Tue Apr 02 08:58:24 2013 +0200 @@ -137,6 +137,7 @@ id NUMBER(38,0) NOT NULL, sediment_density_id NUMBER(38,0) NOT NULL, station NUMBER(38,2) NOT NULL, + shore_offset NUMBER(38,2), density NUMBER(38,2) NOT NULL, description VARCHAR(256), year NUMBER(38,0), @@ -322,7 +323,7 @@ parameter VARCHAR(1) NOT NULL, a NUMBER(38,20) NOT NULL, b NUMBER(38,20) NOT NULL, - qmax NUMBER(38,20), + qmax NUMBER(38,20) NOT NULL, rsq NUMBER(38,3), ntot NUMBER(38,0), noutl NUMBER(38,0), diff -r 6dbc111e9aec -r 33d735f5433e flys-backend/doc/schema/oracle-spatial.sql --- a/flys-backend/doc/schema/oracle-spatial.sql Thu Mar 28 12:11:13 2013 +0100 +++ b/flys-backend/doc/schema/oracle-spatial.sql Tue Apr 02 08:58:24 2013 +0200 @@ -5,7 +5,7 @@ name VARCHAR(64) ); INSERT INTO axis_kinds(id, name) VALUES (0, 'Unbekannt'); -INSERT INTO axis_kinds(id, name) VALUES (1, 'Aktuell'); +INSERT INTO axis_kinds(id, name) VALUES (1, 'aktuelle Achse'); INSERT INTO axis_kinds(id, name) VALUES (2, 'Sonstige'); -- Geodaesie/Flussachse+km/achse @@ -54,7 +54,7 @@ name VARCHAR(64) ); INSERT INTO cross_section_track_kinds(id, name) VALUES (0, 'Sonstige'); -INSERT INTO cross_section_track_kinds(id, name) VALUES (1, 'Aktuell'); +INSERT INTO cross_section_track_kinds(id, name) VALUES (1, 'aktuelle Querprofilspuren'); CREATE SEQUENCE CROSS_SECTION_TRACKS_ID_SEQ; CREATE TABLE cross_section_tracks ( @@ -137,7 +137,7 @@ name VARCHAR(64) ); INSERT INTO floodplain_kinds(id, name) VALUES (0, 'Sonstige'); -INSERT INTO floodplain_kinds(id, name) VALUES (1, 'Aktuell'); +INSERT INTO floodplain_kinds(id, name) VALUES (1, 'aktuelle Talaue'); CREATE SEQUENCE FLOODPLAIN_ID_SEQ; CREATE TABLE floodplain( @@ -242,7 +242,7 @@ id NUMBER PRIMARY KEY NOT NULL, name VARCHAR(64) NOT NULL ); -INSERT INTO sectie_kinds (id, name) VALUES (0, 'Unbekannt'); +INSERT INTO sectie_kinds (id, name) VALUES (0, 'SECTIE Unbekannt'); INSERT INTO sectie_kinds (id, name) VALUES (1, 'Flussschlauch'); INSERT INTO sectie_kinds (id, name) VALUES (2, 'Uferbank'); INSERT INTO sectie_kinds (id, name) VALUES (3, 'Überflutungsbereich'); @@ -251,7 +251,7 @@ id NUMBER PRIMARY KEY NOT NULL, name VARCHAR(64) NOT NULL ); -INSERT INTO sobek_kinds (id, name) VALUES (0, 'Unbekannt'); +INSERT INTO sobek_kinds (id, name) VALUES (0, 'SOBEK Unbekannt'); INSERT INTO sobek_kinds (id, name) VALUES (1, 'Stromführend'); INSERT INTO sobek_kinds (id, name) VALUES (2, 'Stromspeichernd'); @@ -337,9 +337,9 @@ GEOM MDSYS.SDO_GEOMETRY, river_id NUMBER(38) REFERENCES rivers(id) ON DELETE CASCADE, name VARCHAR(255), - kind NUMBER(38) REFERENCES boundary_kinds(id), - sectie NUMBER(38) REFERENCES sectie_kinds(id), - sobek NUMBER(38) REFERENCES sobek_kinds(id), + kind NUMBER(38) REFERENCES boundary_kinds(id) NOT NULL DEFAULT 0, + sectie NUMBER(38) REFERENCES sectie_kinds(id) NOT NULL DEFAULT 0, + sobek NUMBER(38) REFERENCES sobek_kinds(id) NOT NULL DEFAULT 0, path VARCHAR(256), id NUMBER PRIMARY KEY NOT NULL ); @@ -356,9 +356,9 @@ GEOM MDSYS.SDO_GEOMETRY, river_id NUMBER(38) REFERENCES rivers(id) ON DELETE CASCADE, name VARCHAR(255), - kind NUMBER(38) REFERENCES boundary_kinds(id), - sectie NUMBER(38) REFERENCES sectie_kinds(id), - sobek NUMBER(38) REFERENCES sobek_kinds(id), + kind NUMBER(38) REFERENCES boundary_kinds(id) NOT NULL DEFAULT 0, + sectie NUMBER(38) REFERENCES sectie_kinds(id) NOT NULL DEFAULT 0, + sobek NUMBER(38) REFERENCES sobek_kinds(id) NOT NULL DEFAULT 0, path VARCHAR(256), id NUMBER PRIMARY KEY NOT NULL ); diff -r 6dbc111e9aec -r 33d735f5433e flys-backend/doc/schema/postgresql-minfo.sql --- a/flys-backend/doc/schema/postgresql-minfo.sql Thu Mar 28 12:11:13 2013 +0100 +++ b/flys-backend/doc/schema/postgresql-minfo.sql Tue Apr 02 08:58:24 2013 +0200 @@ -137,6 +137,7 @@ id int NOT NULL, sediment_density_id int NOT NULL, station NUMERIC NOT NULL, + shore_offset NUMERIC, density NUMERIC NOT NULL, description VARCHAR(256), year int, @@ -322,7 +323,7 @@ parameter VARCHAR(1) NOT NULL, a NUMERIC NOT NULL, b NUMERIC NOT NULL, - qmax NUMERIC, + qmax NUMERIC NOT NULL, rsq NUMERIC, ntot int, noutl int, diff -r 6dbc111e9aec -r 33d735f5433e flys-backend/doc/schema/postgresql-spatial.sql --- a/flys-backend/doc/schema/postgresql-spatial.sql Thu Mar 28 12:11:13 2013 +0100 +++ b/flys-backend/doc/schema/postgresql-spatial.sql Tue Apr 02 08:58:24 2013 +0200 @@ -5,7 +5,7 @@ name VARCHAR(64) ); INSERT INTO axis_kinds(id, name) VALUES (0, 'Unbekannt'); -INSERT INTO axis_kinds(id, name) VALUES (1, 'Aktuell'); +INSERT INTO axis_kinds(id, name) VALUES (1, 'aktuelle Achse'); INSERT INTO axis_kinds(id, name) VALUES (2, 'Sonstige'); -- Geodaesie/Flussachse+km/achse @@ -41,7 +41,7 @@ name VARCHAR(64) ); INSERT INTO cross_section_track_kinds(id, name) VALUES (0, 'Sonstige'); -INSERT INTO cross_section_track_kinds(id, name) VALUES (1, 'Aktuell'); +INSERT INTO cross_section_track_kinds(id, name) VALUES (1, 'aktuelle Querprofilspuren'); CREATE SEQUENCE CROSS_SECTION_TRACKS_ID_SEQ; CREATE TABLE cross_section_tracks ( @@ -102,7 +102,7 @@ name VARCHAR(64) ); INSERT INTO floodplain_kinds(id, name) VALUES (0, 'Sonstige'); -INSERT INTO floodplain_kinds(id, name) VALUES (1, 'Aktuell'); +INSERT INTO floodplain_kinds(id, name) VALUES (1, 'aktuelle Talaue'); CREATE SEQUENCE FLOODPLAIN_ID_SEQ; CREATE TABLE floodplain ( @@ -250,7 +250,7 @@ id int PRIMARY KEY NOT NULL, name VARCHAR(64) NOT NULL ); -INSERT INTO sectie_kinds (id, name) VALUES (0, 'Unbekannt'); +INSERT INTO sectie_kinds (id, name) VALUES (0, 'SECTIE Unbekannt'); INSERT INTO sectie_kinds (id, name) VALUES (1, 'Flussschlauch'); INSERT INTO sectie_kinds (id, name) VALUES (2, 'Uferbank'); INSERT INTO sectie_kinds (id, name) VALUES (3, 'Überflutungsbereich'); @@ -259,7 +259,7 @@ id int PRIMARY KEY NOT NULL, name VARCHAR(64) NOT NULL ); -INSERT INTO sobek_kinds (id, name) VALUES (0, 'Unbekannt'); +INSERT INTO sobek_kinds (id, name) VALUES (0, 'SOBEK Unbekannt'); INSERT INTO sobek_kinds (id, name) VALUES (1, 'Stromführend'); INSERT INTO sobek_kinds (id, name) VALUES (2, 'Stromspeichernd'); @@ -277,9 +277,9 @@ id int PRIMARY KEY NOT NULL, river_id int REFERENCES rivers(id) ON DELETE CASCADE, name VARCHAR(255), - kind int REFERENCES boundary_kinds(id), - sectie int REFERENCES sectie_kinds(id), - sobek int REFERENCES sobek_kinds(id), + kind int REFERENCES boundary_kinds(id) NOT NULL DEFAULT 0, + sectie int REFERENCES sectie_kinds(id) NOT NULL DEFAULT 0, + sobek int REFERENCES sobek_kinds(id) NOT NULL DEFAULT 0, path VARCHAR(256) ); SELECT AddGeometryColumn('hydr_boundaries','geom',31467,'MULTILINESTRING',3); @@ -291,9 +291,9 @@ id int PRIMARY KEY NOT NULL, river_id int REFERENCES rivers(id) ON DELETE CASCADE, name VARCHAR(255), - kind int REFERENCES boundary_kinds(id), - sectie int REFERENCES sectie_kinds(id), - sobek int REFERENCES sobek_kinds(id), + kind int REFERENCES boundary_kinds(id) NOT NULL DEFAULT 0, + sectie int REFERENCES sectie_kinds(id) NOT NULL DEFAULT 0, + sobek int REFERENCES sobek_kinds(id) NOT NULL DEFAULT 0, path VARCHAR(256) ); SELECT AddGeometryColumn('hydr_boundaries_poly','geom',31467,'MULTIPOLYGON',3); diff -r 6dbc111e9aec -r 33d735f5433e flys-backend/src/main/java/de/intevation/flys/importer/ImportMeasurementStation.java --- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportMeasurementStation.java Thu Mar 28 12:11:13 2013 +0100 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportMeasurementStation.java Tue Apr 02 08:58:24 2013 +0200 @@ -71,7 +71,7 @@ } if (range == null) { - log.warn("No range found for measurement station'" + name + "'"); + log.warn("No range found for measurement station '" + name + "'"); } TimeInterval observationTimerange = this.observationTimerange diff -r 6dbc111e9aec -r 33d735f5433e flys-backend/src/main/java/de/intevation/flys/importer/ImportSQRelationValue.java --- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportSQRelationValue.java Thu Mar 28 12:11:13 2013 +0100 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportSQRelationValue.java Tue Apr 02 08:58:24 2013 +0200 @@ -80,7 +80,7 @@ List result = query.list(); if (result.isEmpty()) { - log.error("No measurement stations found."); + log.error("No measurement stations found at km " + km); return null; } diff -r 6dbc111e9aec -r 33d735f5433e flys-backend/src/main/java/de/intevation/flys/importer/ImportSedimentDensityValue.java --- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportSedimentDensityValue.java Thu Mar 28 12:11:13 2013 +0100 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportSedimentDensityValue.java Tue Apr 02 08:58:24 2013 +0200 @@ -23,6 +23,8 @@ protected BigDecimal station; + protected BigDecimal shoreOffset; + protected BigDecimal density; private BigDecimal year; @@ -32,11 +34,13 @@ public ImportSedimentDensityValue( BigDecimal station, + BigDecimal shoreOffset, BigDecimal density, BigDecimal year, String description ) { this.station = station; + this.shoreOffset = shoreOffset; this.density = density; this.year = year; this.description = description; @@ -60,12 +64,14 @@ "from SedimentDensityValue where " + " sedimentDensity=:sedimentDensity and " + " station=:station and " + + " shoreOffset=:shoreOffset and " + " density=:density and " + " year=:year and " + " description=:description"); query.setParameter("sedimentDensity", sedimentDensity); query.setParameter("station", station); + query.setParameter("shoreOffset", shoreOffset); query.setParameter("density", density); query.setParameter("year", year); query.setParameter("description", description); @@ -77,6 +83,7 @@ peer = new SedimentDensityValue( sedimentDensity, station, + shoreOffset, density, year, description); diff -r 6dbc111e9aec -r 33d735f5433e flys-backend/src/main/java/de/intevation/flys/importer/parsers/BedHeightEpochParser.java --- a/flys-backend/src/main/java/de/intevation/flys/importer/parsers/BedHeightEpochParser.java Thu Mar 28 12:11:13 2013 +0100 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/parsers/BedHeightEpochParser.java Tue Apr 02 08:58:24 2013 +0200 @@ -45,7 +45,7 @@ km = new BigDecimal(nf.parse(values[0]).doubleValue()); } catch (ParseException e) { - log.warn("Error while parsing number from data row: " + line); + log.warn("Unparseable number in data row: " + line); return; } @@ -70,7 +70,7 @@ obj.addValue(value); } catch (ParseException e) { - log.warn("Error while parsing number from data row: " + line); + log.warn("Unparseable number in data row: " + line); } } } diff -r 6dbc111e9aec -r 33d735f5433e flys-backend/src/main/java/de/intevation/flys/importer/parsers/BedHeightParser.java --- a/flys-backend/src/main/java/de/intevation/flys/importer/parsers/BedHeightParser.java Thu Mar 28 12:11:13 2013 +0100 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/parsers/BedHeightParser.java Tue Apr 02 08:58:24 2013 +0200 @@ -235,7 +235,7 @@ obj.setTimeInterval(new ImportTimeInterval(fromYear, toYear)); } catch (NumberFormatException e) { - log.warn("BHP: Error while parsing timeinterval!", e); + log.warn("BHP: could not parse timeinterval", e); } return true; @@ -256,7 +256,7 @@ return true; } catch (NumberFormatException e) { - log.warn("BHP: Error while parsing sounding width: " + line, e); + log.warn("BHP: Could not parse sounding width: " + line, e); log.warn("-> Set default value '0'"); } obj.setSoundingWidth(0); @@ -316,7 +316,7 @@ return true; } catch (ParseException e) { - log.warn("BHP: Error while parsing range!", e); + log.warn("BHP: could not parse range", e); } } diff -r 6dbc111e9aec -r 33d735f5433e flys-backend/src/main/java/de/intevation/flys/importer/parsers/BedHeightSingleParser.java --- a/flys-backend/src/main/java/de/intevation/flys/importer/parsers/BedHeightSingleParser.java Thu Mar 28 12:11:13 2013 +0100 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/parsers/BedHeightSingleParser.java Tue Apr 02 08:58:24 2013 +0200 @@ -82,7 +82,7 @@ obj.addValue(value); } catch (ParseException e) { - log.warn("BSP: Error while parsing data row.", e); + log.warn("BSP: unparseable value in data row.", e); } } @@ -94,7 +94,7 @@ } catch (NumberFormatException nfe) { log.warn( - "Error parsing " + + "Could not parse " + value + " in bed heigt single row: " + line); diff -r 6dbc111e9aec -r 33d735f5433e flys-backend/src/main/java/de/intevation/flys/importer/parsers/FlowVelocityMeasurementParser.java --- a/flys-backend/src/main/java/de/intevation/flys/importer/parsers/FlowVelocityMeasurementParser.java Thu Mar 28 12:11:13 2013 +0100 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/parsers/FlowVelocityMeasurementParser.java Tue Apr 02 08:58:24 2013 +0200 @@ -96,7 +96,7 @@ )); } catch (ParseException pe) { - log.warn("Error while parsing flow velocity values.", pe); + log.warn("Unparseable flow velocity values:", pe); } } } diff -r 6dbc111e9aec -r 33d735f5433e flys-backend/src/main/java/de/intevation/flys/importer/parsers/FlowVelocityModelParser.java --- a/flys-backend/src/main/java/de/intevation/flys/importer/parsers/FlowVelocityModelParser.java Thu Mar 28 12:11:13 2013 +0100 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/parsers/FlowVelocityModelParser.java Tue Apr 02 08:58:24 2013 +0200 @@ -200,7 +200,7 @@ new BigDecimal(nf.parse(qStr).doubleValue()) }; } catch (ParseException pe) { - log.warn("Error while parsing Q value: '" + qStr + "'"); + log.warn("Could not parse Q value: '" + qStr + "'"); } } @@ -232,7 +232,7 @@ )); } catch (ParseException pe) { - log.warn("Error while parsing flow velocity values.", pe); + log.warn("Unparseable flow velocity values:", pe); } } } diff -r 6dbc111e9aec -r 33d735f5433e flys-backend/src/main/java/de/intevation/flys/importer/parsers/MorphologicalWidthParser.java --- a/flys-backend/src/main/java/de/intevation/flys/importer/parsers/MorphologicalWidthParser.java Thu Mar 28 12:11:13 2013 +0100 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/parsers/MorphologicalWidthParser.java Tue Apr 02 08:58:24 2013 +0200 @@ -108,7 +108,7 @@ )); } catch (ParseException pe) { - log.warn("MWP: Error while parsing numbers in '" + line + "'"); + log.warn("MWP: unparseable number in data row: " + line); } } diff -r 6dbc111e9aec -r 33d735f5433e flys-backend/src/main/java/de/intevation/flys/importer/parsers/SQRelationParser.java --- a/flys-backend/src/main/java/de/intevation/flys/importer/parsers/SQRelationParser.java Thu Mar 28 12:11:13 2013 +0100 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/parsers/SQRelationParser.java Tue Apr 02 08:58:24 2013 +0200 @@ -119,10 +119,18 @@ Integer nOutlier = parseInteger(cols[11], line); Double cFer = parseDouble(cols[12], line); Double cDuan = parseDouble(cols[13], line); - if (km == null || a == null || b == null || cols[1].length() == 0) { - log.error("Incomplete SQ-relation row (missing km, a, b or parameter): " - + line); - return; + if (km == null || a == null || b == null || + qMax == null || cols[1].length() == 0) { + if (km == null) { + log.error("No km for measurement station: Can not reference measurement station: " + + line); + } + if ( a == null || b == null || + qMax == null || cols[1].length() == 0) { + log.error("Incomplete SQ-relation row (missing a, b, Qmax or parameter): " + + line); + } + return; } current.addValue(new ImportSQRelationValue( cols[1], @@ -143,7 +151,7 @@ result = Double.valueOf(value.replace(",", ".")); } catch (NumberFormatException nfe) { - log.warn("parsing " + value + " in sq relation row: " + line); + log.warn("Unparseable " + value + " in sq relation row: " + line); } return result; } @@ -154,7 +162,7 @@ result = Integer.valueOf(value); } catch (NumberFormatException nfe) { - log.warn("parsing " + value + " in sq relation row: " + line); + log.warn("Unparseable " + value + " in sq relation row: " + line); } return result; } diff -r 6dbc111e9aec -r 33d735f5433e flys-backend/src/main/java/de/intevation/flys/importer/parsers/SedimentDensityParser.java --- a/flys-backend/src/main/java/de/intevation/flys/importer/parsers/SedimentDensityParser.java Thu Mar 28 12:11:13 2013 +0100 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/parsers/SedimentDensityParser.java Tue Apr 02 08:58:24 2013 +0200 @@ -85,27 +85,12 @@ if (handleMetaDepth(line)) { return; } - else if (handleMetaColumns(line)) { - return; - } else { log.warn("Unknown meta line: '" + line + "'"); } } - private boolean handleMetaColumns(String line) { - String[] columns = line.split(";"); - for (int i = 0; i < columns.length; i++) { - if (columns[i].contains("Sedimentdichte")) { - this.densitsyColumn = i; - return true; - } - } - return false; - } - - protected boolean handleMetaDepth(String line) { Matcher m = META_DEPTH.matcher(line); @@ -126,7 +111,7 @@ return true; } catch (ParseException pe) { - log.warn("Error while parsing numbers in: '" + line + "'"); + log.warn("Unparseable numbers in: '" + line + "'"); } } else { @@ -145,41 +130,33 @@ return; } - BigDecimal km; - BigDecimal density; + BigDecimal km = null; + BigDecimal shoreOffset = null; + BigDecimal density = null; try { - km = new BigDecimal(nf.parse(vals[0]).doubleValue()); - density = new BigDecimal(nf.parse(vals[this.densitsyColumn]).doubleValue()); - + km = new BigDecimal(nf.parse(vals[0]).doubleValue()); + density = new BigDecimal(nf.parse(vals[2]).doubleValue()); + if (!vals[1].isEmpty()) { + shoreOffset = new BigDecimal(nf.parse(vals[1]).doubleValue()); + } } catch (ParseException pe) { - log.warn("Error while parsing numbers in '" + line + "'"); - return; + log.warn("Unparseable numbers in '" + line + "'"); } + if (km == null || density == null) { + log.warn("SDP: No km nor density given. Skip line"); + return; + } + BigDecimal year = null; - try { - year = - new BigDecimal(nf.parse(vals[vals.length - 1]).doubleValue()); - } - catch(ParseException pe) { - try { - Date d = DateGuesser.guessDate(vals[vals.length - 1]); - Calendar c = Calendar.getInstance(); - c.setTime(d); - year = new BigDecimal(c.get(Calendar.YEAR)); - } - catch (IllegalArgumentException iae) { - log.warn("Error while parsing date in '" + line + "'"); - return; - } - } current.addValue(new ImportSedimentDensityValue( km, + shoreOffset, density, year, - vals[vals.length - 1]) + currentDescription) ); } diff -r 6dbc111e9aec -r 33d735f5433e flys-backend/src/main/java/de/intevation/flys/importer/parsers/SedimentYieldParser.java --- a/flys-backend/src/main/java/de/intevation/flys/importer/parsers/SedimentYieldParser.java Thu Mar 28 12:11:13 2013 +0100 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/parsers/SedimentYieldParser.java Tue Apr 02 08:58:24 2013 +0200 @@ -228,7 +228,7 @@ } } catch (ParseException pe) { - log.warn("SYP: Error while parsing numbers in '" + line + "':", pe); + log.warn("SYP: unparseable number in data row '" + line + "':", pe); } } @@ -269,7 +269,7 @@ log.warn("SYP: Unknown time interval string: '" + column + "'"); } catch (ParseException pe) { - log.warn("SYP: Error while parsing years: " + column, pe); + log.warn("SYP: Could not parse years: " + column, pe); } return null; @@ -296,7 +296,7 @@ ); } catch (ParseException pe) { - log.warn("SYP: Error while parsing ranges of: '" + gfStr + "'"); + log.warn("SYP: Could not parse ranges of: '" + gfStr + "'"); } } @@ -318,7 +318,7 @@ ); } catch (ParseException pe) { - log.warn("SYP: Error while parsing ranges of: '" + gfStr + "'"); + log.warn("SYP: Could not parse ranges of: '" + gfStr + "'"); } } @@ -346,7 +346,7 @@ } } catch (ParseException pe) { - log.warn("SYP: Error while parsing ranges of: '" + gfStr + "'"); + log.warn("SYP: Could not parse ranges of: '" + gfStr + "'"); } } diff -r 6dbc111e9aec -r 33d735f5433e flys-backend/src/main/java/de/intevation/flys/importer/parsers/WaterlevelDifferencesParser.java --- a/flys-backend/src/main/java/de/intevation/flys/importer/parsers/WaterlevelDifferencesParser.java Thu Mar 28 12:11:13 2013 +0100 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/parsers/WaterlevelDifferencesParser.java Tue Apr 02 08:58:24 2013 +0200 @@ -185,12 +185,12 @@ new BigDecimal(nf.parse(value).doubleValue())); } catch (ParseException pe) { - log.warn("Error while parsing value: '" + value + "'"); + log.warn("Could not parse value: '" + value + "'"); } } } catch (ParseException pe) { - log.warn("Error while parsing station: '" + line + "'"); + log.warn("Could not parse station: '" + line + "'"); } } } diff -r 6dbc111e9aec -r 33d735f5433e flys-backend/src/main/java/de/intevation/flys/importer/parsers/WaterlevelParser.java --- a/flys-backend/src/main/java/de/intevation/flys/importer/parsers/WaterlevelParser.java Thu Mar 28 12:11:13 2013 +0100 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/parsers/WaterlevelParser.java Tue Apr 02 08:58:24 2013 +0200 @@ -154,7 +154,7 @@ return true; } catch (ParseException pe) { - log.warn("Error while parsing Q range: '" + line + "'"); + log.warn("Unparseable Q range: '" + line + "'"); } } @@ -184,7 +184,7 @@ } } catch (ParseException pe) { - log.warn("Error while parsing number values: '" + line + "'"); + log.warn("Unparseable number in data row: " + line); } } } diff -r 6dbc111e9aec -r 33d735f5433e flys-backend/src/main/java/de/intevation/flys/model/Floodplain.java --- a/flys-backend/src/main/java/de/intevation/flys/model/Floodplain.java Thu Mar 28 12:11:13 2013 +0100 +++ b/flys-backend/src/main/java/de/intevation/flys/model/Floodplain.java Tue Apr 02 08:58:24 2013 +0200 @@ -13,6 +13,7 @@ import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.annotations.Type; +import org.hibernate.HibernateException; import com.vividsolutions.jts.geom.Polygon; @@ -32,6 +33,8 @@ private Polygon geom; + private String name; + public Floodplain() { } @@ -77,6 +80,42 @@ this.geom = geom; } + @Column(name = "name") + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + public static List getFloodplains(String river, String name, int kind) + throws HibernateException { + Session session = SessionHolder.HOLDER.get(); + Query query = session.createQuery( + "from Floodplain as fp where river.name =:river" + + " and kind.id =:kind" + + " and fp.name=:name"); + query.setParameter("river", river); + query.setParameter("kind", kind); + query.setParameter("name", name); + + List list = query.list(); + return list.isEmpty() ? null : list; + } + + public static List getFloodplains(String river, int kind) + throws HibernateException { + Session session = SessionHolder.HOLDER.get(); + Query query = session.createQuery( + "from Floodplain where river.name =:river AND kind.id =:kind"); + query.setParameter("river", river); + query.setParameter("kind", kind); + + List list = query.list(); + return list.isEmpty() ? null : list; + } public static Floodplain getFloodplain(String river) { Session session = SessionHolder.HOLDER.get(); diff -r 6dbc111e9aec -r 33d735f5433e flys-backend/src/main/java/de/intevation/flys/model/HydrBoundary.java --- a/flys-backend/src/main/java/de/intevation/flys/model/HydrBoundary.java Thu Mar 28 12:11:13 2013 +0100 +++ b/flys-backend/src/main/java/de/intevation/flys/model/HydrBoundary.java Tue Apr 02 08:58:24 2013 +0200 @@ -91,6 +91,18 @@ this.geom = geom; } + public static List getHydrBoundaries(int riverId, String name, int kindId) { + Session session = SessionHolder.HOLDER.get(); + + Query query = session.createQuery( + "from HydrBoundary where river.id =:river_id and name=:name" + + " and kind.id=:kind_id"); + query.setParameter("river_id", riverId); + query.setParameter("name", name); + query.setParameter("kind_id", kindId); + + return query.list(); + } public static List getHydrBoundaries(int riverId, String name) { Session session = SessionHolder.HOLDER.get(); diff -r 6dbc111e9aec -r 33d735f5433e flys-backend/src/main/java/de/intevation/flys/model/HydrBoundaryPoly.java --- a/flys-backend/src/main/java/de/intevation/flys/model/HydrBoundaryPoly.java Thu Mar 28 12:11:13 2013 +0100 +++ b/flys-backend/src/main/java/de/intevation/flys/model/HydrBoundaryPoly.java Tue Apr 02 08:58:24 2013 +0200 @@ -104,6 +104,27 @@ return query.list(); } + public static List getHydrBoundaries(int riverId, + int kind, int sectie, int sobek) { + Session session = SessionHolder.HOLDER.get(); + + String filter = " where river.id =:river_id"; + + if (kind != -1) { + filter += " and kind = " + kind; + } + if (sectie != -1) { + filter += " and sectie = " + sectie; + } + if (sobek != -1){ + filter += " and sobek = " + sobek; + } + + Query query = session.createQuery("from HydrBoundaryPoly" + filter); + query.setParameter("river_id", riverId); + return query.list(); + } + /** * Get sectie. * diff -r 6dbc111e9aec -r 33d735f5433e flys-backend/src/main/java/de/intevation/flys/model/SedimentDensityValue.java --- a/flys-backend/src/main/java/de/intevation/flys/model/SedimentDensityValue.java Thu Mar 28 12:11:13 2013 +0100 +++ b/flys-backend/src/main/java/de/intevation/flys/model/SedimentDensityValue.java Tue Apr 02 08:58:24 2013 +0200 @@ -23,6 +23,7 @@ private SedimentDensity sedimentDensity; private BigDecimal station; + private BigDecimal shoreOffset; private BigDecimal density; private BigDecimal year; @@ -36,12 +37,14 @@ public SedimentDensityValue( SedimentDensity sedimentDensity, BigDecimal station, + BigDecimal shoreOffset, BigDecimal density, BigDecimal year, String desc ) { this.sedimentDensity = sedimentDensity; this.station = station; + this.shoreOffset = shoreOffset; this.density = density; this.year = year; this.description = desc; @@ -83,6 +86,15 @@ this.station = station; } + @Column(name = "shore_offset") + public BigDecimal getShoreOffset() { + return shoreOffset; + } + + public void setShoreOffset(BigDecimal shoreOffset) { + this.shoreOffset = shoreOffset; + } + @Column(name = "density") public BigDecimal getDensity() { return density; diff -r 6dbc111e9aec -r 33d735f5433e flys-client/src/main/java/de/intevation/flys/client/client/FLYS.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYS.java Thu Mar 28 12:11:13 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYS.java Tue Apr 02 08:58:24 2013 +0200 @@ -514,6 +514,60 @@ }); } + public void newSQRelation(String river, int measurementStation) { + Config config = Config.getInstance(); + + final String locale = config.getLocale(); + final String riv = river; + final int mStation = measurementStation; + final FLYS flys = this; + + User user = getCurrentUser(); + + if (user == null) { + SC.warn(MSG.error_not_logged_in()); + return; + } + + collectionService.create(locale, user.identifier(), + new AsyncCallback() { + @Override + public void onFailure(Throwable caught) { + GWT.log("Could not create new collection."); + SC.warn(getExceptionString(MSG, caught)); + } + + @Override + public void onSuccess(Collection collection) { + GWT.log("Successfully created a new collection."); + final Collection col = collection; + artifactService.createSQRelationArtifact( + col, locale, riv, mStation, + new AsyncCallback() { + @Override + public void onFailure(Throwable caught) { + GWT.log("Could not create the new artifact."); + SC.warn(getExceptionString(MSG, caught)); + } + + @Override + public void onSuccess(Artifact artifact) { + GWT.log("Successfully created a new artifact."); + CollectionView view = new CollectionView(flys, + col, artifact); + workspace.addView(col.identifier(), view); + + view.addCollectionChangeHandler(getProjectList()); + view.addCloseClickHandler( + new CloseCollectionViewHandler( + FLYS.this, col.identifier())); + projectList.updateUserCollections(); + } + }); + } + }); + } + @Override public void onCollectionChange(CollectionChangeEvent event) { Collection oldC = event.getOldValue(); diff -r 6dbc111e9aec -r 33d735f5433e flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java Thu Mar 28 12:11:13 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java Tue Apr 02 08:58:24 2013 +0200 @@ -8,6 +8,8 @@ */ public interface FLYSConstants extends ConstantsWithLookup { + String static_sqrelation(); + String add(); String unexpected_exception(); @@ -1172,5 +1174,15 @@ String axis(); + String bfg_model(); + + String federal(); + + String areas(); + + String sobek_areas(); + + String sobek_flooded(); + } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r 6dbc111e9aec -r 33d735f5433e flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties --- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties Thu Mar 28 12:11:13 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties Tue Apr 02 08:58:24 2013 +0200 @@ -207,6 +207,7 @@ askThemeRemove = Are you sure that you want to remove the selected theme / themes? add = Add +static_sqrelation = SQ relation discharge_curve = Discharge Curve at Gauge discharge_curve_gaugeless = Discharge Curve gauge_discharge_curve = Discharge Table at Gauge @@ -465,6 +466,11 @@ route_data = Route Data other = Other axis = Axis +bfg_model = BfG-Model +federal = Federal States +areas = Areas +sobek_flooded = SOBEK-Boundary flooded / not flooded +sobek_areas = SOBEK-Areas startcolor = Colorrange start color endcolor = Colorrange end color @@ -564,7 +570,7 @@ wsplgen_cat3 = Fill Color 2.0 <= DIFF < 3 wsplgen_cat4 = Fill Color 3.0 <= DIFF < 4 wsplgen_cat5 = Fill Color 4.0 <= DIFF -attribution = ©Intevation GmbH 2012
Data ©OpenStreetMap +attribution = ©Intevation GmbH 2013
Data ©OpenStreetMap # Manual Points Editor addpoints = Add points diff -r 6dbc111e9aec -r 33d735f5433e flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties --- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties Thu Mar 28 12:11:13 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties Tue Apr 02 08:58:24 2013 +0200 @@ -207,6 +207,7 @@ zoomboxTooltip = Ausschnitt vergr\u00f6\u00dfern chartPropertiesTooltip = Diagrammeigenschaften +static_sqrelation = Transport-Abfluss Beziehung discharge_curve = Abflusskurve am Pegel discharge_curve_gaugeless = Abflusskurve gauge_discharge_curve = Abflusstafel am Pegel @@ -409,7 +410,7 @@ requireDGM = Sie m\u00fcssen ein DGM ausw\u00e4hlen. upload_file = hochladen shape_file_upload = Shapedatei hochladen -attribution = ©Intevation GmbH 2012
Data ©OpenStreetMap +attribution = ©Intevation GmbH 2013
Data ©OpenStreetMap # data cage waterlevels = Wasserst\u00e4nde @@ -435,7 +436,7 @@ lines = Linien buildings = Bauwerke fixpoints = Festpunkte -uesk = \u00dcberschwemmungsfl\u00e4chen +uesk = \u00dcberschwemmungsfl\u00e4chen - DAMI unfertig calculations = Berechnungen current = Aktuell potentiel = Potenziell @@ -466,6 +467,11 @@ route_data = Streckendaten other = Sonstige axis = Achse +bfg_model = BfG-Modell +federal = Bundesländer +areas = Flächen +sobek_flooded = SOBEK-Grenzlinie durchflutet / nicht durchflutet +sobek_areas = SOBEK-Bereiche startcolor = Farbverlauf Startfarbe endcolor = Farbverlauf Endfarbe diff -r 6dbc111e9aec -r 33d735f5433e flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties --- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties Thu Mar 28 12:11:13 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties Tue Apr 02 08:58:24 2013 +0200 @@ -208,6 +208,7 @@ askThemeRemove = Are you sure that you want to remove the selected theme / themes? add = Add +static_sqrelation = SQ relation discharge_curve = Discharge Curve at Gauge discharge_curve_gaugeless = Discharge Curve gauge_discharge_curve = Discharge Table at Gauge diff -r 6dbc111e9aec -r 33d735f5433e flys-client/src/main/java/de/intevation/flys/client/client/services/ArtifactService.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/services/ArtifactService.java Thu Mar 28 12:11:13 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/services/ArtifactService.java Tue Apr 02 08:58:24 2013 +0200 @@ -46,5 +46,19 @@ String river, Long gaugeref ) throws ServerException; + + /** + * Create a new SQRelationArtifact + * + * @param collection the collection to add the artifact to + * @param river the river + * @param measurementStation the measurement station id + */ + public Artifact createSQRelationArtifact( + Collection collection, + String locale, + String river, + int measurementStation + ) throws ServerException; } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r 6dbc111e9aec -r 33d735f5433e flys-client/src/main/java/de/intevation/flys/client/client/services/ArtifactServiceAsync.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/services/ArtifactServiceAsync.java Thu Mar 28 12:11:13 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/services/ArtifactServiceAsync.java Tue Apr 02 08:58:24 2013 +0200 @@ -28,5 +28,13 @@ Long gaugeref, AsyncCallback callback ); + + public void createSQRelationArtifact( + Collection collection, + String locale, + String river, + int measurementStation, + AsyncCallback callback + ); } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r 6dbc111e9aec -r 33d735f5433e flys-client/src/main/java/de/intevation/flys/client/client/ui/GaugeDischargeCurvePanel.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/GaugeDischargeCurvePanel.java Thu Mar 28 12:11:13 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,68 +0,0 @@ -package de.intevation.flys.client.client.ui; - -import com.google.gwt.core.client.GWT; - -import com.smartgwt.client.widgets.Canvas; -import com.smartgwt.client.widgets.Label; -import com.smartgwt.client.widgets.form.DynamicForm; -import com.smartgwt.client.widgets.layout.HLayout; -import com.smartgwt.client.widgets.layout.VLayout; - -import de.intevation.flys.client.client.FLYSConstants; -import de.intevation.flys.client.shared.model.Data; -import de.intevation.flys.client.shared.model.DataItem; -import de.intevation.flys.client.shared.model.DataList; - - -/** - * This UIProvider displays the old DataItems of GaugeDischargeCurveArtifact - * - * @author Björn Ricks - */ -public class GaugeDischargeCurvePanel -extends AbstractUIProvider -{ - private static final long serialVersionUID = 7411866539525588336L; - - /** The message class that provides i18n strings.*/ - protected FLYSConstants messages = GWT.create(FLYSConstants.class); - - /** The combobox.*/ - protected DynamicForm form; - - @Override - public Canvas create(DataList data) { - VLayout layout = new VLayout(); - return layout; - } - - @Override - public Canvas createOld(DataList dataList) { - VLayout vLayout = new VLayout(); - vLayout.setWidth("400px"); - - int size = dataList.size(); - for (int i = 0; i < size; i++) { - Data data = dataList.get(i); - DataItem[] items = data.getItems(); - - for (DataItem item: items) { - HLayout hLayout = new HLayout(); - - hLayout.addMember(new Label(item.getLabel())); - hLayout.addMember(new Label(item.getStringValue())); - - vLayout.addMember(hLayout); - vLayout.setWidth("130px"); - } - } - - return vLayout; - } - - @Override - protected Data[] getData() { - return null; - } -} -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r 6dbc111e9aec -r 33d735f5433e flys-client/src/main/java/de/intevation/flys/client/client/ui/StaticDataPanel.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/StaticDataPanel.java Tue Apr 02 08:58:24 2013 +0200 @@ -0,0 +1,68 @@ +package de.intevation.flys.client.client.ui; + +import com.google.gwt.core.client.GWT; + +import com.smartgwt.client.widgets.Canvas; +import com.smartgwt.client.widgets.Label; +import com.smartgwt.client.widgets.form.DynamicForm; +import com.smartgwt.client.widgets.layout.HLayout; +import com.smartgwt.client.widgets.layout.VLayout; + +import de.intevation.flys.client.client.FLYSConstants; +import de.intevation.flys.client.shared.model.Data; +import de.intevation.flys.client.shared.model.DataItem; +import de.intevation.flys.client.shared.model.DataList; + + +/** + * This UIProvider displays the old DataItems of GaugeDischargeCurveArtifact + * + * @author Björn Ricks + */ +public class StaticDataPanel +extends AbstractUIProvider +{ + private static final long serialVersionUID = 7411866539525588336L; + + /** The message class that provides i18n strings.*/ + protected FLYSConstants messages = GWT.create(FLYSConstants.class); + + /** The combobox.*/ + protected DynamicForm form; + + @Override + public Canvas create(DataList data) { + VLayout layout = new VLayout(); + return layout; + } + + @Override + public Canvas createOld(DataList dataList) { + VLayout vLayout = new VLayout(); + vLayout.setWidth("400px"); + + int size = dataList.size(); + for (int i = 0; i < size; i++) { + Data data = dataList.get(i); + DataItem[] items = data.getItems(); + + for (DataItem item: items) { + HLayout hLayout = new HLayout(); + + hLayout.addMember(new Label(item.getLabel())); + hLayout.addMember(new Label(item.getStringValue())); + + vLayout.addMember(hLayout); + vLayout.setWidth("130px"); + } + } + + return vLayout; + } + + @Override + protected Data[] getData() { + return null; + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r 6dbc111e9aec -r 33d735f5433e flys-client/src/main/java/de/intevation/flys/client/client/ui/UIProviderFactory.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/UIProviderFactory.java Thu Mar 28 12:11:13 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/UIProviderFactory.java Tue Apr 02 08:58:24 2013 +0200 @@ -162,7 +162,7 @@ return new RadioPanel(); } else if (uiProvider.equals("gauge_discharge_curve")) { - return new GaugeDischargeCurvePanel(); + return new StaticDataPanel(); } else if (uiProvider.equals("minfo.sedimentload_distance_select")) { return new SedLoadDistancePanel(); @@ -182,6 +182,9 @@ else if (uiProvider.equals("user_rgd_panel")) { return new UserRGDProvider(); } + else if (uiProvider.equals("static_sqrelation")) { + return new StaticDataPanel(); + } else { //GWT.log("Picked default provider."); return new SelectProvider(); diff -r 6dbc111e9aec -r 33d735f5433e flys-client/src/main/java/de/intevation/flys/client/client/ui/stationinfo/MeasurementStationListGrid.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/stationinfo/MeasurementStationListGrid.java Thu Mar 28 12:11:13 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/stationinfo/MeasurementStationListGrid.java Tue Apr 02 08:58:24 2013 +0200 @@ -7,6 +7,8 @@ import com.smartgwt.client.widgets.WidgetCanvas; import com.smartgwt.client.widgets.grid.ListGridField; import com.smartgwt.client.widgets.grid.ListGridRecord; +import com.smartgwt.client.widgets.grid.events.RecordClickEvent; +import com.smartgwt.client.widgets.grid.events.RecordClickHandler; import de.intevation.flys.client.client.FLYS; import de.intevation.flys.client.shared.model.MeasurementStation; @@ -18,7 +20,9 @@ /** * @author Björn Ricks */ -public class MeasurementStationListGrid extends InfoListGrid { +public class MeasurementStationListGrid +extends InfoListGrid +implements RecordClickHandler { public MeasurementStationListGrid(FLYS flys) { super(flys); @@ -28,7 +32,9 @@ ListGridField stfield = new ListGridField("station", "Station [km]"); ListGridField lfield = new ListGridField("link", "Link"); lfield.setType(ListGridFieldType.LINK); - this.setFields(nfield, sfield, efield, stfield, lfield); + ListGridField cfield = new ListGridField("curvelink", "SQ"); + cfield.addRecordClickHandler(this); + this.setFields(nfield, sfield, efield, stfield, lfield, cfield); } /** @@ -88,4 +94,12 @@ MeasurementStationRecord station = (MeasurementStationRecord)record; return new WidgetCanvas(new MeasurementStationInfoPanel(station)); } + + @Override + public void onRecordClick(RecordClickEvent event) { + MeasurementStationRecord station = + (MeasurementStationRecord)event.getRecord(); + flys.newSQRelation(station.getRiverName(), station.getID()); + } + } diff -r 6dbc111e9aec -r 33d735f5433e flys-client/src/main/java/de/intevation/flys/client/client/ui/stationinfo/MeasurementStationRecord.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/stationinfo/MeasurementStationRecord.java Thu Mar 28 12:11:13 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/stationinfo/MeasurementStationRecord.java Tue Apr 02 08:58:24 2013 +0200 @@ -27,6 +27,7 @@ MSG.measurement_station_url(); this.setLink(link); this.setLinkText(MSG.measurement_station_info_link()); + this.setCurveLink(MSG.static_sqrelation()); this.setID(number); this.setName(station.getName()); if (station.isKmUp()) { @@ -172,4 +173,13 @@ public void setLink(String link) { this.setAttribute("link", link); } + + public void setCurveLink(String link) { + this.setAttribute("curvelink", link); + } + + public String getCurveLink() { + return this.getAttribute("curvelink"); + } + } diff -r 6dbc111e9aec -r 33d735f5433e flys-client/src/main/java/de/intevation/flys/client/server/ArtifactHelper.java --- a/flys-client/src/main/java/de/intevation/flys/client/server/ArtifactHelper.java Thu Mar 28 12:11:13 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/server/ArtifactHelper.java Tue Apr 02 08:58:24 2013 +0200 @@ -39,7 +39,7 @@ * Name of the factory to generate a GaugeDischargeCurveArtifact */ private static final String GAUGE_DISCHARGE_CURVE_ARTIFACT = "gaugedischargecurve"; - + private static final String SQ_RELATION_ARTIFACT = "staticsqrelation"; private ArtifactHelper() { } @@ -162,5 +162,35 @@ return cf; } + + + public static Artifact createSQRelationArtifact( + String serverUrl, + String locale, + String river, + int measurementStation) + throws ServerException + { + Document create = ClientProtocolUtils.newCreateDocument( + SQ_RELATION_ARTIFACT); + + XMLUtils.ElementCreator ec = new XMLUtils.ElementCreator( + create, + ArtifactNamespaceContext.NAMESPACE_URI, + ArtifactNamespaceContext.NAMESPACE_PREFIX); + + Element root = create.getDocumentElement(); + + Element eriver = ec.create("river"); + ec.addAttr(eriver, "name", river); + + Element estation = ec.create("measurement_station"); + ec.addAttr(estation, "number", String.valueOf(measurementStation)); + + root.appendChild(eriver); + root.appendChild(estation); + + return sendCreate(serverUrl, locale, create); + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r 6dbc111e9aec -r 33d735f5433e flys-client/src/main/java/de/intevation/flys/client/server/ArtifactServiceImpl.java --- a/flys-client/src/main/java/de/intevation/flys/client/server/ArtifactServiceImpl.java Thu Mar 28 12:11:13 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/server/ArtifactServiceImpl.java Tue Apr 02 08:58:24 2013 +0200 @@ -78,5 +78,28 @@ return artifact; } + @Override + public Artifact createSQRelationArtifact( + Collection collection, + String locale, + String river, + int measurementStation) + throws ServerException + { + logger.info("ArtifactServiceImpl.createSQRelationArtifact"); + String url = getServletContext().getInitParameter("server-url"); + + Artifact artifact = ArtifactHelper.createSQRelationArtifact(url, + locale, river, measurementStation); + if (artifact == null) { + return null; + } + logger.info("SQRelationArtifact created successfully"); + + CollectionHelper.addArtifact(collection, artifact, url, locale); + + return artifact; + } + } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r 6dbc111e9aec -r 33d735f5433e flys-client/src/main/java/de/intevation/flys/client/server/FLYSArtifactCreator.java --- a/flys-client/src/main/java/de/intevation/flys/client/server/FLYSArtifactCreator.java Thu Mar 28 12:11:13 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/server/FLYSArtifactCreator.java Tue Apr 02 08:58:24 2013 +0200 @@ -24,6 +24,7 @@ import de.intevation.flys.client.shared.model.GaugeDischargeCurveArtifact; import de.intevation.flys.client.shared.model.MapArtifact; import de.intevation.flys.client.shared.model.MINFOArtifact; +import de.intevation.flys.client.shared.model.StaticSQRelationArtifact; import de.intevation.flys.client.shared.model.WINFOArtifact; @@ -149,6 +150,10 @@ logger.debug("+++++ NEW GAUGEDISCHARGECURVE ARTIFACT."); return new GaugeDischargeCurveArtifact(uuid, hash, background, msg); } + else if (name.length() > 0 && name.equals("staticsqrelation")) { + logger.debug("+++++ STATICSQRELATION ARTIFACT."); + return new StaticSQRelationArtifact(uuid, hash, background, msg); + } return new DefaultArtifact(uuid, hash, background, msg); } diff -r 6dbc111e9aec -r 33d735f5433e flys-client/src/main/java/de/intevation/flys/client/shared/model/StaticSQRelationArtifact.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/StaticSQRelationArtifact.java Tue Apr 02 08:58:24 2013 +0200 @@ -0,0 +1,36 @@ +package de.intevation.flys.client.shared.model; + +import java.util.List; + + +public class StaticSQRelationArtifact +extends DefaultArtifact +{ + + /** The name of this artifact */ + public static final String NAME = "static_sqrelation"; + + + + public StaticSQRelationArtifact() { + } + + public StaticSQRelationArtifact(String uuid, String hash) { + super(uuid, hash); + } + + + public StaticSQRelationArtifact( + String uuid, + String hash, + boolean inBackground, + List messages + ) { + super(uuid, hash, inBackground, messages); + } + + + public String getName() { + return NAME; + } +}