# HG changeset patch # User Sascha L. Teichmann # Date 1363112165 -3600 # Node ID 7a11271f5593f7785f31b46e7595498453611929 # Parent da1e897c7224b465bee581e84123e25808037f06# Parent 0c45b8797baab2efcd5a41911f8ee2a081555145 Merged diff -r da1e897c7224 -r 7a11271f5593 .hgtags --- a/.hgtags Tue Mar 12 19:15:18 2013 +0100 +++ b/.hgtags Tue Mar 12 19:16:05 2013 +0100 @@ -30,3 +30,8 @@ f459911fdbfbe2b2d23e06faba4e338514dd7b54 2.9.10 8c65acf01adc7083c5936d0f8acf67374c97140b 2.9.10 42bb6ff78d1b734341732772ab24db2a913311b0 2.9.11 +3b86bf214d53da51d85cd8c8ecfeec71aa9da9e4 2.9.12 +3b86bf214d53da51d85cd8c8ecfeec71aa9da9e4 2.9.12 +0000000000000000000000000000000000000000 2.9.12 +0000000000000000000000000000000000000000 2.9.12 +88e3473a38467e8b5bb7d99e92c3f1a795515bf5 2.9.12 diff -r da1e897c7224 -r 7a11271f5593 contrib/make_flys_release/README --- a/contrib/make_flys_release/README Tue Mar 12 19:15:18 2013 +0100 +++ b/contrib/make_flys_release/README Tue Mar 12 19:16:05 2013 +0100 @@ -1,34 +1,41 @@ Konfiguration: ============== -Im `confs` Verzeichnis liegen Konfigurationsdateien, die für jede FLYS -Installation angepasst werden müssen (Ports, Hosts, Datenbank-Connection, etc). - -In der `make_flys_release.sh` kann über die Variable `RELEASE` ein TAG aus dem -HG Repository ausgewählt werden, welches für den Bau von FLYS verwendet werden -soll. +Zur konfiguration des make_release scripts können umgebungsvariablen +verwendet werden oder man ändert die entsprechenden Variablen im Script. -Außerdem muss in der `make_flys_release` eingestellt werden, ob man FLYS für -eine Oracle oder Postgresql Datenbank bauen will. Im Verzeichnis sind -spezifische Libraries im `libs_oracle` und `libs_postgresql` Verzeichnis -enthalten. In der `make_flys_release` muss zurzeit in Zeile 71-77 eingestellt -werden, welche Libs (Oracle / Postgresql) wieder aus dem Zielverzeichnis -entfernt werden sollen. +Wichtige variablen sind: +FLYS_SOURCE_DIR +TOMCAT_PORT +MAPSERVER_URL +WIKI_URL +DEVELOPER +DEFAULT_WD -TODOS: -====== -- auf return Codes der einzelnen Aufrufe (mvn package, etc) reagieren, und den - Bau ggf abbrechen -- Konfig-Option für den Bau für Oracle und Postgresql integrieren. -- Libs für Postgresql / Oracle besser in den Build-Prozess integrieren +# Seddb Configuration +SEDDBURL +SEDDBPORT +SEDDBBACK +SEDDBUSER +SEDDBPASS + +# Backend configuration +BACKENDURL +BACKENDPORT +BACKENDBACK +BACKENDUSER +BACKENDPASS Prozess: ======== Nachdem die Konfigurationen angepasst wurden, kann das Skript mittels - sh make_release.sh + sh make_release.sh VERSION von der Konsole gestartet werden. Anschließend werden die Quellen des dive4elements, des HTTP-Clients und von FLYS über SSH aus dem HG Repository -ausgecheckt. In der `make_flys_release.sh` ist dazu der Name des HG Users in der -zweiten Zeile anzupassen. Die Quellen werden anschließend mit Maven gebaut. +ausgecheckt und in FLYS_SOURCE_DIR abgelegt. + +Wenn mit der option -t zusätzlich ausgewählt wird diese version zu taggen +muss in der make_flys_release.sh der entsprechende accountname zum pushen +des tags als DEVELOPER angegeben werden. Für den Client wird OpenLayers-2.11 heruntergeladen und in den Client verschoben. Zurzeit wird das komplette OpenLayers-2.11 Verzeichnis in den Client diff -r da1e897c7224 -r 7a11271f5593 contrib/make_flys_release/confs/artifact-db.xml --- a/contrib/make_flys_release/confs/artifact-db.xml Tue Mar 12 19:15:18 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ - - - SA - - jdbc:h2:${artifacts.config.dir}/../artifactsdb/artifacts - diff -r da1e897c7224 -r 7a11271f5593 contrib/make_flys_release/confs/backend-db.xml --- a/contrib/make_flys_release/confs/backend-db.xml Tue Mar 12 19:15:18 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ - - - - flys293 - flys293 - org.hibernate.dialect.PostgreSQLDialect - org.postgresql.Driver - jdbc:postgresql://czech-republic.atlas.intevation.de:5432/flys293 - - - - diff -r da1e897c7224 -r 7a11271f5593 contrib/make_flys_release/confs/datacage-db.xml --- a/contrib/make_flys_release/confs/datacage-db.xml Tue Mar 12 19:15:18 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ - - - SA - - jdbc:h2:${artifacts.config.dir}/../datacagedb/datacage - diff -r da1e897c7224 -r 7a11271f5593 contrib/make_flys_release/confs/floodmap.xml --- a/contrib/make_flys_release/confs/floodmap.xml Tue Mar 12 19:15:18 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r da1e897c7224 -r 7a11271f5593 contrib/make_flys_release/confs/mapserver/fontset.txt --- a/contrib/make_flys_release/confs/mapserver/fontset.txt Tue Mar 12 19:15:18 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -FreeSans /usr/share/splashy/themes/default/FreeSans.ttf -DefaultFont /usr/share/splashy/themes/default/FreeSans.ttf diff -r da1e897c7224 -r 7a11271f5593 contrib/make_flys_release/confs/rest-server.xml --- a/contrib/make_flys_release/confs/rest-server.xml Tue Mar 12 19:15:18 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ - - - - 8999 - localhost - diff -r da1e897c7224 -r 7a11271f5593 contrib/make_flys_release/confs/rivermap.xml --- a/contrib/make_flys_release/confs/rivermap.xml Tue Mar 12 19:15:18 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r da1e897c7224 -r 7a11271f5593 contrib/make_flys_release/confs/seddb-db.xml --- a/contrib/make_flys_release/confs/seddb-db.xml Tue Mar 12 19:15:18 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ - - - - seddb - seddbpass - org.hibernate.dialect.Oracle9iDialect - oracle.jdbc.driver.OracleDriver - jdbc:oracle:thin:@//czech-republic.atlas.intevation.de:1521/XE - diff -r da1e897c7224 -r 7a11271f5593 contrib/make_flys_release/h2/artifacts-h2.sql --- a/contrib/make_flys_release/h2/artifacts-h2.sql Tue Mar 12 19:15:18 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ --- --- schema to store artifacts in H2 databases. --- - -BEGIN; - --- not using AUTO_INCREMENT to be more compatible with --- other dbms. -CREATE SEQUENCE ARTIFACTS_ID_SEQ; - -CREATE TABLE artifacts ( - id INT PRIMARY KEY NOT NULL, - gid UUID NOT NULL UNIQUE, - creation TIMESTAMP NOT NULL, - last_access TIMESTAMP NOT NULL, - ttl BIGINT, -- NULL means eternal - factory VARCHAR(256) NOT NULL, - data BINARY -); - -CREATE SEQUENCE USERS_ID_SEQ; - -CREATE TABLE users ( - id INT PRIMARY KEY NOT NULL, - gid UUID NOT NULL UNIQUE, - name VARCHAR(256) NOT NULL, - account VARCHAR(256) NOT NULL UNIQUE, - role BINARY -); - -CREATE SEQUENCE COLLECTIONS_ID_SEQ; - -CREATE TABLE collections ( - id INT PRIMARY KEY NOT NULL, - gid UUID NOT NULL UNIQUE, - name VARCHAR(256) NOT NULL, - owner_id INT NOT NULL REFERENCES users(id), - creation TIMESTAMP NOT NULL, - last_access TIMESTAMP NOT NULL, - ttl BIGINT, -- NULL means eternal - attribute BINARY -); - -CREATE SEQUENCE COLLECTION_ITEMS_ID_SEQ; - -CREATE TABLE collection_items ( - id INT PRIMARY KEY NOT NULL, - collection_id INT NOT NULL REFERENCES collections(id), - artifact_id INT NOT NULL REFERENCES artifacts(id), - attribute BINARY, - creation TIMESTAMP NOT NULL, - UNIQUE (collection_id, artifact_id) -); - -CREATE TRIGGER collections_access_update_trigger AFTER UPDATE - ON artifacts FOR EACH ROW - CALL "de.intevation.artifactdatabase.h2.CollectionAccessUpdateTrigger"; - -COMMIT; diff -r da1e897c7224 -r 7a11271f5593 contrib/make_flys_release/h2/createArtifacts.sh --- a/contrib/make_flys_release/h2/createArtifacts.sh Tue Mar 12 19:15:18 2013 +0100 +++ b/contrib/make_flys_release/h2/createArtifacts.sh Tue Mar 12 19:16:05 2013 +0100 @@ -1,6 +1,6 @@ #!/bin/bash -mkdir artifactsdb +mkdir -p artifactsdb DIR=`dirname $0` DIR=`readlink -f "$DIR"` @@ -12,6 +12,10 @@ export CLASSPATH +if [ $# != 1 ]; then + echo "Usage: $0 " +fi + java org.h2.tools.RunScript \ -url jdbc:h2:`readlink -f artifactsdb`/artifacts \ - -script $DIR/artifacts-h2.sql + -script "$1" diff -r da1e897c7224 -r 7a11271f5593 contrib/make_flys_release/h2/createDatacage.sh --- a/contrib/make_flys_release/h2/createDatacage.sh Tue Mar 12 19:15:18 2013 +0100 +++ b/contrib/make_flys_release/h2/createDatacage.sh Tue Mar 12 19:16:05 2013 +0100 @@ -1,6 +1,6 @@ #!/bin/bash -mkdir datacagedb +mkdir -p datacagedb DIR=`dirname $0` DIR=`readlink -f "$DIR"` @@ -11,7 +11,10 @@ done export CLASSPATH +if [ $# != 1 ]; then + echo "Usage: $0 " +fi java org.h2.tools.RunScript \ -url jdbc:h2:`readlink -f datacagedb`/datacage \ - -script $DIR/datacage.sql + -script "$1" diff -r da1e897c7224 -r 7a11271f5593 contrib/make_flys_release/h2/datacage.sql --- a/contrib/make_flys_release/h2/datacage.sql Tue Mar 12 19:15:18 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,104 +0,0 @@ -BEGIN; - -CREATE SEQUENCE USERS_ID_SEQ; - -CREATE TABLE users ( - id INT PRIMARY KEY NOT NULL, - gid UUID NOT NULL UNIQUE -); - -CREATE SEQUENCE COLLECTIONS_ID_SEQ; - -CREATE TABLE collections ( - id INT PRIMARY KEY NOT NULL, - gid UUID NOT NULL UNIQUE, - user_id INT NOT NULL REFERENCES users(id) ON DELETE CASCADE, - name VARCHAR(256) NOT NULL, - creation TIMESTAMP NOT NULL -); - -CREATE SEQUENCE ARTIFACTS_ID_SEQ; - -CREATE TABLE artifacts ( - id INT PRIMARY KEY NOT NULL, - gid UUID NOT NULL UNIQUE, - state VARCHAR(256) NOT NULL, - creation TIMESTAMP NOT NULL -); - -CREATE SEQUENCE COLLECTION_ITEMS_ID_SEQ; - -CREATE TABLE collection_items ( - id INT PRIMARY KEY NOT NULL, - collection_id INT NOT NULL REFERENCES collections(id) ON DELETE CASCADE, - artifact_id INT NOT NULL REFERENCES artifacts(id) ON DELETE CASCADE -); - -CREATE SEQUENCE ARTIFACT_DATA_ID_SEQ; - -CREATE TABLE artifact_data ( - id INT PRIMARY KEY NOT NULL, - artifact_id INT NOT NULL REFERENCES artifacts(id) ON DELETE CASCADE, - kind VARCHAR(256) NOT NULL, - k VARCHAR(256) NOT NULL, - v VARCHAR(256), -- Maybe too short - UNIQUE (artifact_id, k) -); - -CREATE SEQUENCE OUTS_ID_SEQ; - -CREATE TABLE outs ( - id INT PRIMARY KEY NOT NULL, - artifact_id INT NOT NULL REFERENCES artifacts(id) ON DELETE CASCADE, - name VARCHAR(256) NOT NULL, - description VARCHAR(256), - out_type VARCHAR(256) -); - -CREATE SEQUENCE FACETS_ID_SEQ; - -CREATE TABLE facets ( - id INT PRIMARY KEY NOT NULL, - out_id INT NOT NULL REFERENCES outs(id) ON DELETE CASCADE, - name VARCHAR(256) NOT NULL, - num INT NOT NULL, - state VARCHAR(256) NOT NULL, - description VARCHAR(256), - UNIQUE (out_id, num, name) -); - -CREATE VIEW master_artifacts AS - SELECT a2.id AS id, - a2.gid AS gid, - a2.state AS state, - a2.creation AS creation, - ci2.collection_id AS collection_id - FROM collection_items ci2 - JOIN artifacts a2 - ON ci2.artifact_id = a2.id - JOIN (SELECT ci.collection_id AS c_id, - MIN(a.creation) AS oldest_a - FROM collection_items ci - JOIN artifacts a - ON ci.artifact_id = a.id - GROUP BY ci.collection_id) o - ON o.c_id = ci2.collection_id - WHERE a2.creation = o.oldest_a; - --- DROP VIEW master_artifacts; --- DROP SEQUENCE USERS_ID_SEQ; --- DROP SEQUENCE COLLECTIONS_ID_SEQ; --- DROP SEQUENCE ARTIFACTS_ID_SEQ; --- DROP SEQUENCE COLLECTION_ITEMS_ID_SEQ; --- DROP SEQUENCE ARTIFACT_DATA_ID_SEQ; --- DROP SEQUENCE OUTS_ID_SEQ; --- DROP SEQUENCE FACETS_ID_SEQ; --- DROP TABLE facets; --- DROP TABLE outs; --- DROP TABLE artifact_data; --- DROP TABLE collection_items; --- DROP TABLE collections; --- DROP TABLE artifacts; --- DROP TABLE users; - -COMMIT; diff -r da1e897c7224 -r 7a11271f5593 contrib/make_flys_release/libs_oracle/ojdbc5.jar Binary file contrib/make_flys_release/libs_oracle/ojdbc5.jar has changed diff -r da1e897c7224 -r 7a11271f5593 contrib/make_flys_release/make_release.sh --- a/contrib/make_flys_release/make_release.sh Tue Mar 12 19:15:18 2013 +0100 +++ b/contrib/make_flys_release/make_release.sh Tue Mar 12 19:16:05 2013 +0100 @@ -1,147 +1,306 @@ #!/bin/bash +# Release script for Flys +# +# Authors: +# Andre Heinecke +# +# Copyright: +# Copyright (C) 2013 Intevation GmbH +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -echo "INFO: define required variables" +set -e +DEFAULT_WD=/tmp/flys-release +DEVELOPER=aheinecke + ARTIFACTS_HG_REPO="http://wald.intevation.org/hg/dive4elements/artifacts" HTTPCLIIENT_HG_REPO="http://wald.intevation.org/hg/dive4elements/http-client" FLYS_HG_REPO="http://wald.intevation.org/hg/dive4elements/flys" -ARTIFACTS_HG="hg.artifacts" -HTTPCLIENT_HG="hg.http-client" -FLYS_HG="hg.flys" +REPOS="artifacts http-client flys" +# Do not use spaces in path +FLYS_SOURCE_DIR=/local-vol1/aheinecke/flys-release -PREFIX="flys-" -RELEASE=${RELEASE:-default} -RELEASE_DATE=`date +'%Y-%m-%d'` -DIRECTORY=$PREFIX$RELEASE-$RELEASE_DATE +SCRIPT_DIR=$(readlink -f `dirname $0`) +usage(){ + cat << EOF -ARTIFACT_PORT=${ARTIFACT_PORT:-9002} -TOMCAT_PORT=${TOMCAT_PORT:-8005} +usage: $0 [options] VERSION +Create a flys package + +OPTIONS: + -?, --help Show this message + -w The working directory to use. (do not use spaces in path) + 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 +EOF +exit 0 +} +# --backend-db-url Url of database backend. Default: $BACKENDURL +# --backend-db-pass Backend db password. Default: $BACKENDPASS +# --backend-db-port Backend db port. Default: $BACKENDPORT +# --backend-db-user Backend db user. Default: $BACKENDUSER +# --backend-db-backend Backend db backend name. Default: $BACKENDBACK +# --seddb-url Sediment db url. Default: $SEDDBURL +# --seddb-port Sediment db port. Default: $SEDDBPORT +# --seddb-user Sediment db user. Default: $SEDDBUSER +# --seddb-pass Sediment db password. Default: $SEDDBPASS +# --seddb-back Sediment db backend. Default: $SEDDBBACK +TOMCAT_PORT=${TOMCAT_PORT:-8282} MAPSERVER_URL=${MAPSERVER_URL:-czech-republic.atlas.intevation.de} WIKI_URL=${WIKI_URL:-https://flys-intern.intevation.de/Flys-3.0} -echo "INFO: create server directories" -mkdir -p $DIRECTORY/server/bin/lib/own -mkdir $DIRECTORY/server/shapefiles -mkdir $DIRECTORY/client - -echo "INFO: checkout sources" -echo " ... checkout $ARTIFACTS_HG_REPO" - -rm -rf $ARTIFACTS_HG -hg clone $ARTIFACTS_HG_REPO $ARTIFACTS_HG -(cd $ARTIFACTS_HG && hg co $RELEASE) +# Seddb Configuration +SEDDBURL=${SEDDBURL:-czech-republic.atlas.intevation.de} +SEDDBPORT=${SEDDBPORT:-1521} +SEDDBBACK=${SEDDBBACK:-XE} +SEDDBUSER=${SEDDBUSER:-seddb} +SEDDBPASS=${SEDDBPASS:-seddbpass} -echo " ... checkout $HTTPCLIIENT_HG_REPO" -rm -rf $HTTPCLIENT_HG -hg clone $HTTPCLIIENT_HG_REPO $HTTPCLIENT_HG -(cd $HTTPCLIENT_HG && hg co $RELEASE) +# Backend configuration +BACKENDURL=${BACKENDURL:-czech-republic.atlas.intevation.de} +BACKENDPORT=${BACKENDPORT:-5432} +BACKENDBACK=${BACKENDBACK:-flys_2912} +BACKENDUSER=${BACKENDUSER:-flys_dami} +BACKENDPASS=${BACKENDPASS:-flys_dami} +INITSQLS=${INITSQLS:-} -echo " ... checkout $FLYS_HG_REPO" -rm -rf $FLYS_HG -hg clone $FLYS_HG_REPO $FLYS_HG -(cd $FLYS_HG && hg co $RELEASE) +OPTS=`getopt -o ?w:,t,o \ + -l help,oracle \ + -n $0 -- "$@"` -# adapt client configuration -echo "INFO: prepare configuration of web client" +if [ $? != 0 ] ; then usage; fi +eval set -- "$OPTS" +while true ; do + case "$1" in + "-?"|"--help") + usage;; + "--") + shift + break;; + "-w") + WORK_DIR=$2 + shift 2;; + "-o"|"--oracle") + BUILD_ORACLE="TRUE" + shift;; + "-t") + DO_TAG="TRUE" + shift;; + *) + echo "Unknown Option $1" + usage;; + esac +done +if [ $# != 1 ]; then + usage +fi + +VERSION=$1 +ARTIFACT_PORT=${ARTIFACT_PORT:-`echo 1$VERSION | sed 's/\.//g'`} + +if [ -z $WORK_DIR ]; then + WORK_DIR=$DEFAULT_WD +fi + +mkdir -p $WORK_DIR + +if [ ! -d $FLYS_SOURCE_DIR ]; then + mkdir -p $FLYS_SOURCE_DIR + echo "Cloning sources" + cd $FLYS_SOURCE_DIR + hg clone $ARTIFACTS_HG_REPO artifacts + hg clone $HTTPCLIIENT_HG_REPO http-client + hg clone $FLYS_HG_REPO flys +else + echo "Updating sources / Reverting changes" + cd $FLYS_SOURCE_DIR + for repo in $REPOS; do + cd $repo && hg pull && hg up && hg revert -a && cd $FLYS_SOURCE_DIR + done; +fi + +if [ "$DO_TAG" = "TRUE" ]; then + echo "Tagging version $VERSION" + for repo in $REPOS; do + cd $repo + CHANGESET=$(hg log -l1 |head -1 | awk -F: '{print $3}') + echo "" + echo "Do you really want to tag $repo rev: $CHANGESET as Version $VERSION?" + echo "press enter to continue or CTRL+C to abort." + echo "" + hg log -l1 + read + hg tag $VERSION -m "Added tag $VERSION for changeset $CHANGESET" + hg push ssh://$DEVELOPER@scm.wald.intevation.org/hg/dive4elements/$repo + cd $FLYS_SOURCE_DIR + done; +fi + +# Update to current version +for repo in $REPOS; do + cd $repo + hg up $VERSION + cd $FLYS_SOURCE_DIR +done + +rm -rf "$WORK_DIR/server" "$WORK_DIR/client" +cd $WORK_DIR +mkdir -p "$WORK_DIR/server/bin/lib/own" +mkdir "$WORK_DIR/server/shapefiles" +mkdir "$WORK_DIR/client" + +echo "[INFO]: Preparing configuration of web client" +echo "[INFO]: Tomcat Port: $TOMCAT_PORT" +echo "[INFO]: Artifact Port: $ARTIFACT_PORT" sed -i -e "s@http://localhost:8181@http://localhost:$ARTIFACT_PORT@g" \ -e "s@http://localhost:8888@http://localhost:$TOMCAT_PORT@g" \ - $FLYS_HG/flys-client/src/main/webapp/WEB-INF/web.xml - -sed -i -e "s@/tmp/flys-client.log@/var/log/flys/client-${RELEASE}.log@g" \ - $FLYS_HG/flys-client/src/main/webapp/WEB-INF/log4j.properties - -# Fix the Wiki URLs -find $FLYS_HG/flys-artifacts/src/main/resources/ -name messages_\*.properties \ - -exec sed -i "s@https://flys-intern.intevation.de/Flys-3.0@${WIKI_URL}@g" {} \; + $FLYS_SOURCE_DIR/flys/flys-client/src/main/webapp/WEB-INF/web.xml -echo "INFO: download OpenLayers-2.11 for client" -curl -O http://openlayers.org/download/OpenLayers-2.11.tar.gz -tar xvfz OpenLayers-2.11.tar.gz -# TODO: Remove more superfluous OpenLayers stuff. -rm -rf OpenLayers-2.11/doc -rm -rf OpenLayers-2.11/tests -rm -rf OpenLayers-2.11/examples -mv OpenLayers-2.11 $FLYS_HG/flys-client/src/main/webapp/ +sed -i -e "s@/tmp/flys-client.log@/var/log/flys/client-${VERSION}.log@g" \ + $FLYS_SOURCE_DIR/flys/flys-client/src/main/webapp/WEB-INF/log4j.properties -# compile and build our code stuff +find $FLYS_SOURCE_DIR/flys/flys-artifacts/src/main/resources/ -name messages_\*.properties \ + -exec sed -i "s@https://flys-intern.intevation.de/Flys-3.0@"'${WIKI_URL}'"@g" {} \; + +if [ ! -f $FLYS_SOURCE_DIR/OpenLayers-2.11.tar.gz ]; then + echo "INFO: download OpenLayers-2.11 for client" + cd $FLYS_SOURCE_DIR + curl -O http://openlayers.org/download/OpenLayers-2.11.tar.gz + tar xvfz OpenLayers-2.11.tar.gz + # TODO: Remove more superfluous OpenLayers stuff. + rm -rf OpenLayers-2.11/doc + rm -rf OpenLayers-2.11/tests + rm -rf OpenLayers-2.11/examples + cd $WORK_DIR +fi +cp -r $FLYS_SOURCE_DIR/OpenLayers-2.11 $FLYS_SOURCE_DIR/flys/flys-client/src/main/webapp/ + echo "INFO: compile and build sources" -mvn -f $ARTIFACTS_HG/pom.xml clean compile package install -mvn -f $FLYS_HG/flys-backend/pom.xml clean compile package install -mvn -f $FLYS_HG/flys-artifacts/pom.xml clean compile package dependency:copy-dependencies install -mvn -f $HTTPCLIENT_HG/pom.xml clean compile package install -mvn -f $FLYS_HG/flys-client/pom.xml clean compile package +mvn -f $FLYS_SOURCE_DIR/artifacts/pom.xml clean compile package install +mvn -f $FLYS_SOURCE_DIR/flys/flys-backend/pom.xml clean compile package install +mvn -f $FLYS_SOURCE_DIR/flys/flys-artifacts/pom.xml clean compile package dependency:copy-dependencies install +mvn -f $FLYS_SOURCE_DIR/http-client/pom.xml clean compile package install +mvn -f $FLYS_SOURCE_DIR/flys/flys-client/pom.xml clean compile package -## fetch the java stuff + echo "INFO: copy dependencies and libs" -cp $ARTIFACTS_HG/artifact-database/target/artifact-database-1.0-SNAPSHOT.jar $DIRECTORY/server/bin/lib/own/ -cp $ARTIFACTS_HG/artifacts/target/artifacts-1.0-SNAPSHOT.jar $DIRECTORY/server/bin/lib/own/ -cp $ARTIFACTS_HG/artifacts-common/target/artifacts-common-1.0-SNAPSHOT.jar $DIRECTORY/server/bin/lib/own/ -cp $FLYS_HG/flys-backend/target/flys-backend-1.0-SNAPSHOT.jar $DIRECTORY/server/bin/lib/own/ -cp $FLYS_HG/flys-artifacts/target/flys-artifacts-1.0-SNAPSHOT.jar $DIRECTORY/server/bin/lib/own/ -cp $FLYS_HG/flys-client/target/FLYS-1.0-SNAPSHOT.war $DIRECTORY/client/flys-${RELEASE}.war -cp $FLYS_HG/flys-artifacts/target/dependency/* $DIRECTORY/server/bin/lib/ +cp $FLYS_SOURCE_DIR/artifacts/artifact-database/target/artifact-database-1.0-SNAPSHOT.jar $WORK_DIR/server/bin/lib/own/ +cp $FLYS_SOURCE_DIR/artifacts/artifacts/target/artifacts-1.0-SNAPSHOT.jar $WORK_DIR/server/bin/lib/own/ +cp $FLYS_SOURCE_DIR/artifacts/artifacts-common/target/artifacts-common-1.0-SNAPSHOT.jar $WORK_DIR/server/bin/lib/own/ +cp $FLYS_SOURCE_DIR/flys/flys-backend/target/flys-backend-1.0-SNAPSHOT.jar $WORK_DIR/server/bin/lib/own/ +cp $FLYS_SOURCE_DIR/flys/flys-artifacts/target/flys-artifacts-1.0-SNAPSHOT.jar $WORK_DIR/server/bin/lib/own/ +cp $FLYS_SOURCE_DIR/flys/flys-client/target/FLYS-1.0-SNAPSHOT.war $WORK_DIR/client/flys-${VERSION}.war +cp $FLYS_SOURCE_DIR/flys/flys-artifacts/target/dependency/* $WORK_DIR/server/bin/lib/ echo "INFO: copy scripts and libraries to target destination" -cp bin/run.sh $DIRECTORY/server/bin/ -cp bin/wsplgen.exe $DIRECTORY/server/bin/ -cp libs/* $DIRECTORY/server/bin/lib/ +cp ${SCRIPT_DIR}/bin/run.sh $WORK_DIR/server/bin/ +cp ${SCRIPT_DIR}/bin/wsplgen.exe $WORK_DIR/server/bin/ +cp ${SCRIPT_DIR}/libs/* $WORK_DIR/server/bin/lib/ -#echo "INFO: remove PostgreSQL and PostGIS libraries" -#rm $DIRECTORY/server/bin/lib/postg* -#rm $DIRECTORY/server/bin/lib/hibernate-spatial-postgis* -echo "INFO: remove Oralce libraries" -rm -f $DIRECTORY/server/bin/lib/hibernate-spatial-oracle-1.1.jar -rm -f $DIRECTORY/server/bin/lib/ojdbc* +if [ "$BUILD_ORACLE" = "TRUE" ]; then + echo "INFO: remove PostgreSQL and PostGIS libraries" + rm $WORK_DIR/server/bin/lib/postg* + rm $WORK_DIR/server/bin/lib/hibernate-spatial-postgis* +else + echo "INFO: remove Oralce libraries" + rm -f $WORK_DIR/server/bin/lib/hibernate-spatial-oracle-1.1.jar + rm -f $WORK_DIR/server/bin/lib/ojdbc* +fi # fetch the configuration stuff echo "INFO: copy default configuration to target destination" -cp -R $FLYS_HG/flys-artifacts/doc/conf $DIRECTORY/server/ - -#cp confs/* $DIRECTORY/server/conf/ -mkdir -p $DIRECTORY/server/conf - -sed "s/8999/$ARTIFACT_PORT/g" \ - confs/rest-server.xml \ - > $DIRECTORY/server/conf/rest-server.xml - -sed -e "s@http://example.com/@http://${MAPSERVER_URL}/@g" \ - confs/floodmap.xml \ - > $DIRECTORY/server/conf/floodmap.xml +cp -R $FLYS_SOURCE_DIR/flys/flys-artifacts/doc/conf $WORK_DIR/server/ -sed -e "s@http://example.com/@http://${MAPSERVER_URL}/@g" \ - confs/rivermap.xml \ - > $DIRECTORY/server/conf/rivermap.xml - -sed "s@/tmp/flys-server-default.log@/var/log/flys/server-${RELEASE}.log@" \ - confs/log4j.properties \ - > $DIRECTORY/server/conf/log4j.properties +sed -i "s/8181/$ARTIFACT_PORT/g" \ + $WORK_DIR/server/conf/rest-server.xml -# TODO: Use templating here -cp confs/seddb-db.xml $DIRECTORY/server/conf/seddb-db.xml -cp confs/backend-db.xml $DIRECTORY/server/conf/backend-db.xml -cp confs/artifact-db.xml $DIRECTORY/server/conf/artifact-db.xml -cp confs/datacage-db.xml $DIRECTORY/server/conf/datacage-db.xml -cp confs/mapserver/fontset.txt $DIRECTORY/server/conf/mapserver/fontset.txt +sed -i -e "s@http://example.com/@http://${MAPSERVER_URL}/@g" \ + $WORK_DIR/server/conf/floodmap.xml -cp $ARTIFACTS_HG/artifact-database/doc/schema-h2.sql h2/artifacts-h2.sql -cp $FLYS_HG/flys-artifacts/doc/conf/datacage.sql h2/datacage.sql +sed -i -e "s@http://example.com/@http://${MAPSERVER_URL}/@g" \ + $WORK_DIR/server/conf/rivermap.xml + +sed "s@/tmp/flys-server-default.log@/var/log/flys/server-${VERSION}.log@" \ + $SCRIPT_DIR/confs/log4j.properties \ + > $WORK_DIR/server/conf/log4j.properties + +cat > $WORK_DIR/server/conf/seddb-db.xml << EOF + + + + $SEDDBUSER + $SEDDBPASS + org.hibernate.dialect.Oracle9iDialect + oracle.jdbc.driver.OracleDriver + jdbc:oracle:thin:@//$SEDDBURL:$SEDDBPORT/$SEDDBBACK + +EOF + +if [ "$BUILD_ORACLE" = "TRUE" ]; then + # Oracle backend configuration + cat > $WORK_DIR/server/conf/backend-db.xml << EOF + + + $BACKENDUSER + $BACKENDPASS + org.hibernatespatial.oracle.OracleSpatial10gDialect + oracle.jdbc.driver.OracleDriver + jdbc:oracle:thin:@//$BACKENDURL:$BACKENDPORT/$BACKENDBACK + $INITSQLS + +EOF +else + #Postgresql backend configuration + cat > $WORK_DIR/server/conf/backend-db.xml << EOF + + + $BACKENDUSER + $BACKENDPASS + org.hibernate.dialect.PostgreSQLDialect + org.postgresql.Driver + jdbc:postgresql://$BACKENDURL:$BACKENDPORT/$BACKENDBACK + $INITSQLS + +EOF +fi + +mkdir $WORK_DIR/artifactsdb +mkdir $WORK_DIR/datacagedb + +cp $FLYS_SOURCE_DIR/artifacts/artifact-database/doc/schema-h2.sql $WORK_DIR/artifactsdb/artifacts-h2.sql +cp $FLYS_SOURCE_DIR/flys/flys-artifacts/doc/conf/datacage.sql $WORK_DIR/datacagedb/datacage.sql echo "INFO: create h2 database for artifacts and datacage" -h2/createArtifacts.sh -h2/createDatacage.sh +$SCRIPT_DIR/h2/createArtifacts.sh $WORK_DIR/artifactsdb/artifacts-h2.sql +$SCRIPT_DIR/h2/createDatacage.sh $WORK_DIR/datacagedb/datacage.sql -mv artifactsdb $DIRECTORY/server/ -mv datacagedb $DIRECTORY/server/ +mv $WORK_DIR/artifactsdb $WORK_DIR/server/ +mv $WORK_DIR/datacagedb $WORK_DIR/server/ echo "INFO: create tarball" -tar cvfz $DIRECTORY.tar.gz $DIRECTORY +mkdir $WORK_DIR/flys-$VERSION +mv $WORK_DIR/server $WORK_DIR/client $WORK_DIR/flys-$VERSION +cd $WORK_DIR +tar cfz flys-$VERSION.tar.gz flys-$VERSION +echo "INFO: cleanup" +#rm -r $WORK_DIR/flys-$VERSION -echo "INFO: remove temporary files and directories" -rm -rf $ARTIFACTS_HG -rm -rf $HTTPCLIENT_HG -rm -rf $FLYS_HG -rm -rf $DIRECTORY -rm -rf OpenLayers.2.11.tar.gz +echo "DONE: $WORK_DIR/flys-$VERSION.tar.gz" diff -r da1e897c7224 -r 7a11271f5593 flys-artifacts/doc/conf/artifact-db.xml --- a/flys-artifacts/doc/conf/artifact-db.xml Tue Mar 12 19:15:18 2013 +0100 +++ b/flys-artifacts/doc/conf/artifact-db.xml Tue Mar 12 19:16:05 2013 +0100 @@ -6,5 +6,5 @@ - jdbc:h2:${artifacts.config.dir}/../artifactdb/artifacts.db + jdbc:h2:${artifacts.config.dir}/../artifactsdb/artifacts diff -r da1e897c7224 -r 7a11271f5593 flys-artifacts/doc/conf/datacage-db.xml --- a/flys-artifacts/doc/conf/datacage-db.xml Tue Mar 12 19:15:18 2013 +0100 +++ b/flys-artifacts/doc/conf/datacage-db.xml Tue Mar 12 19:16:05 2013 +0100 @@ -3,5 +3,5 @@ SA org.h2.Driver - jdbc:h2:${artifacts.config.dir}/../h2/datacage + jdbc:h2:${artifacts.config.dir}/../datacagedb/datacage diff -r da1e897c7224 -r 7a11271f5593 flys-artifacts/doc/conf/meta-data.xml --- a/flys-artifacts/doc/conf/meta-data.xml Tue Mar 12 19:15:18 2013 +0100 +++ b/flys-artifacts/doc/conf/meta-data.xml Tue Mar 12 19:16:05 2013 +0100 @@ -976,11 +976,11 @@ r.a AS dem_lower, r.b AS dem_upper, d.name AS name, - d.projection || ' | ' || t.start || ' - ' || t.stop AS info + 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 river_id = ${river_id} + 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} diff -r da1e897c7224 -r 7a11271f5593 flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DGMSelect.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DGMSelect.java Tue Mar 12 19:15:18 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DGMSelect.java Tue Mar 12 19:16:05 2013 +0100 @@ -89,8 +89,8 @@ throw new IllegalArgumentException(ERR_INVALID_DGM); } - double l = dgm.getLower().doubleValue(); - double u = dgm.getUpper().doubleValue(); + double l = dgm.getRange().getA().doubleValue(); + double u = dgm.getRange().getB().doubleValue(); double[] range = FLYSUtils.getKmFromTo(flys); diff -r da1e897c7224 -r 7a11271f5593 flys-backend/contrib/shpimporter/crosssectiontracks.py --- a/flys-backend/contrib/shpimporter/crosssectiontracks.py Tue Mar 12 19:15:18 2013 +0100 +++ b/flys-backend/contrib/shpimporter/crosssectiontracks.py Tue Mar 12 19:16:05 2013 +0100 @@ -37,6 +37,12 @@ newFeat.SetGeometry(feat.GetGeometryRef()) newFeat.SetField("name", args['name']) + if args['path'].lower().endswith("/qps.shp") and \ + not "sonstige" in args['path'].lower(): + newFeat.SetField("kind_id", 1) # offical + else: + newFeat.SetField("kind_id", 0) # misc + if self.IsFieldSet(feat, "river_id"): newFeat.SetField("river_id", feat.GetField("river_id")) else: diff -r da1e897c7224 -r 7a11271f5593 flys-backend/contrib/shpimporter/dgm.py --- a/flys-backend/contrib/shpimporter/dgm.py Tue Mar 12 19:15:18 2013 +0100 +++ b/flys-backend/contrib/shpimporter/dgm.py Tue Mar 12 19:16:05 2013 +0100 @@ -116,7 +116,8 @@ for line in csvfile: fields = line.split(";") if not fields: continue - if fields[namedict[latin("Gewässer")]] != river_name: + if fields[namedict[latin("Gewässer")]] != \ + unicode(utils.getUTF8(river_name),'UTF-8'): continue else: values=[] diff -r da1e897c7224 -r 7a11271f5593 flys-backend/contrib/shpimporter/floodplains.py --- a/flys-backend/contrib/shpimporter/floodplains.py Tue Mar 12 19:15:18 2013 +0100 +++ b/flys-backend/contrib/shpimporter/floodplains.py Tue Mar 12 19:16:05 2013 +0100 @@ -39,6 +39,12 @@ newFeat.SetGeometry(geometry) newFeat.SetField("name", args['name']) + if args['path'].lower().endswith("/talaue.shp") and \ + not "sonstige" in args['path'].lower(): + newFeat.SetField("kind_id", 1) # offical + else: + newFeat.SetField("kind_id", 0) # misc + if self.IsFieldSet(feat, "river_id"): newFeat.SetField("river_id", feat.GetField("river_id")) else: diff -r da1e897c7224 -r 7a11271f5593 flys-backend/contrib/shpimporter/hws.py --- a/flys-backend/contrib/shpimporter/hws.py Tue Mar 12 19:15:18 2013 +0100 +++ b/flys-backend/contrib/shpimporter/hws.py Tue Mar 12 19:16:05 2013 +0100 @@ -24,6 +24,8 @@ "hochufer" : 2, "graben" : 3, "rohr1" : 1, + "rohr 1" : 1, + "rohr 2" : 1, "hauptdeich" : 2, "sommerdeich" : 2 } diff -r da1e897c7224 -r 7a11271f5593 flys-backend/contrib/shpimporter/shpimporter.py --- a/flys-backend/contrib/shpimporter/shpimporter.py Tue Mar 12 19:15:18 2013 +0100 +++ b/flys-backend/contrib/shpimporter/shpimporter.py Tue Mar 12 19:16:05 2013 +0100 @@ -22,6 +22,8 @@ logger = logging.getLogger("shpimporter") +os.environ["NLS_LANG"] = ".AL32UTF8" + def initialize_logging(level): """Initializes the logging system""" root = logging.getLogger() @@ -196,11 +198,12 @@ river_id = utils.getRiverId(dbconn_raw, river_name, oracle) if not river_id: - logger.info("Could not find river in database. Skipping: %s" - % river_name) + logger.info(u"Could not find river in database. Skipping: %s" + % unicode(utils.getUTF8(river_name), "UTF-8")) continue else: - logger.info("Importing River: %s" % river_name) + logger.info(u"Importing River: %s" % unicode( + utils.getUTF8(river_name), "UTF-8")) for importer in getImporters(river_id, dbconn, config.dry_run): if skip_importer(config, importer): diff -r da1e897c7224 -r 7a11271f5593 flys-backend/contrib/shpimporter/utils.py --- a/flys-backend/contrib/shpimporter/utils.py Tue Mar 12 19:15:18 2013 +0100 +++ b/flys-backend/contrib/shpimporter/utils.py Tue Mar 12 19:16:05 2013 +0100 @@ -41,7 +41,7 @@ stmt = SQL_SELECT_RIVER_ID_ORA else: stmt = SQL_SELECT_RIVER_ID - cur.execute(stmt, (name,)) + cur.execute(stmt, (getUTF8(name),)) row = cur.fetchone() if row: return row[0] diff -r da1e897c7224 -r 7a11271f5593 flys-backend/doc/schema/oracle-minfo.sql --- a/flys-backend/doc/schema/oracle-minfo.sql Tue Mar 12 19:15:18 2013 +0100 +++ b/flys-backend/doc/schema/oracle-minfo.sql Tue Mar 12 19:16:05 2013 +0100 @@ -20,15 +20,17 @@ CONSTRAINT fk_unit FOREIGN KEY (unit_id) REFERENCES units(id) ); -CREATE SEQUENCE BED_HEIGHT_TYPE_SEQ; +-- lookup table for bedheight types CREATE TABLE bed_height_type ( id NUMBER(38,0) NOT NULL, - name VARCHAR(16) NOT NULL, - description VARCHAR(255), + type VARCHAR(65) NOT NULL, PRIMARY KEY(id) ); - +INSERT INTO bed_height_type VALUES (1, 'Querprofil') +INSERT INTO bed_height_type VALUES (2, 'Flächenpeilung') +INSERT INTO bed_height_type VALUES (3, 'Flächen- u. Querprofilpeilungen') +INSERT INTO bed_height_type VALUES (4, 'DGM') CREATE SEQUENCE BED_HEIGHT_SINGLE_ID_SEQ; @@ -281,78 +283,6 @@ ); -CREATE SEQUENCE WATERLEVEL_ID_SEQ; - -CREATE TABLE waterlevel ( - id NUMBER(38,0) NOT NULL, - river_id NUMBER(38,0) NOT NULL, - unit_id NUMBER(38,0) NOT NULL, - description VARCHAR(256), - PRIMARY KEY (id), - CONSTRAINT fk_w_river_id FOREIGN KEY (river_id) REFERENCES rivers(id), - CONSTRAINT fk_w_unit_id FOREIGN KEY (unit_id) REFERENCES units(id) -); - - -CREATE SEQUENCE WATERLEVEL_Q_RANGES_ID_SEQ; - -CREATE TABLE waterlevel_q_range ( - id NUMBER(38,0) NOT NULL, - waterlevel_id NUMBER(38,0) NOT NULL, - q NUMBER(38,2) NOT NULL, - PRIMARY KEY (id), - CONSTRAINT fk_wqr_waterlevel_id FOREIGN KEY (waterlevel_id) REFERENCES waterlevel(id) -); - - -CREATE SEQUENCE WATERLEVEL_VALUES_ID_SEQ; - -CREATE TABLE waterlevel_values ( - id NUMBER(38,0) NOT NULL, - waterlevel_q_range_id NUMBER(38,0) NOT NULL, - station NUMBER(38,3) NOT NULL, - w NUMBER(38,2) NOT NULL, - PRIMARY KEY (id), - CONSTRAINT fk_wv_waterlevel_q_range_id FOREIGN KEY (waterlevel_q_range_id) REFERENCES waterlevel_q_range(id) -); - - -CREATE SEQUENCE WATERLEVEL_DIFFERENCE_ID_SEQ; - -CREATE TABLE waterlevel_difference ( - id NUMBER(38,0) NOT NULL, - river_id NUMBER(38,0) NOT NULL, - unit_id NUMBER(38,0) NOT NULL, - description VARCHAR(256), - PRIMARY KEY (id), - CONSTRAINT fk_wd_river_id FOREIGN KEY (river_id) REFERENCES rivers (id), - CONSTRAINT fk_wd_unit_id FOREIGN KEY (unit_id) REFERENCES units(id) -); - - -CREATE SEQUENCE WATERLEVEL_DIFF_COLUMN_ID_SEQ; - -CREATE TABLE waterlevel_difference_column ( - id NUMBER(38,0) NOT NULL, - difference_id NUMBER(38,0) NOT NULL, - description VARCHAR(256), - PRIMARY KEY (id), - CONSTRAINT fk_wdc_difference_id FOREIGN KEY (difference_id) REFERENCES waterlevel_difference (id) -); - - -CREATE SEQUENCE WATERLEVEL_DIFF_VALUES_ID_SEQ; - -CREATE TABLE waterlevel_difference_values ( - id NUMBER(38,0) NOT NULL, - column_id NUMBER(38,0) NOT NULL, - station NUMBER(38,3) NOT NULL, - value NUMBER(38,2) NOT NULL, - PRIMARY KEY (id), - CONSTRAINT fk_wdv_column_id FOREIGN KEY (column_id) REFERENCES waterlevel_difference_column (id) -); - - CREATE SEQUENCE MEASUREMENT_STATION_ID_SEQ; CREATE TABLE measurement_station ( id NUMBER(38) NOT NULL, diff -r da1e897c7224 -r 7a11271f5593 flys-backend/doc/schema/oracle.sql --- a/flys-backend/doc/schema/oracle.sql Tue Mar 12 19:15:18 2013 +0100 +++ b/flys-backend/doc/schema/oracle.sql Tue Mar 12 19:16:05 2013 +0100 @@ -332,6 +332,21 @@ -- WSTS +--lookup table for wst kinds +CREATE TABLE wst_kinds ( + id NUMBER PRIMARY KEY NOT NULL, + kind VARCHAR(64) NOT NULL +); +INSERT INTO wst_kinds (id, kind) VALUES (0, 'basedata'); +INSERT INTO wst_kinds (id, kind) VALUES (1, 'basedata_additionals_marks'); +INSERT INTO wst_kinds (id, kind) VALUES (2, 'basedata_fixations_wst'); +INSERT INTO wst_kinds (id, kind) VALUES (3, 'basedata_officials'); +INSERT INTO wst_kinds (id, kind) VALUES (4, 'basedata_heightmarks-points-relative_points'); +INSERT INTO wst_kinds (id, kind) VALUES (5, 'basedata_flood-protections_relative_points'); +INSERT INTO wst_kinds (id, kind) VALUES (6, 'morpho_waterlevel-differences'); +INSERT INTO wst_kinds (id, kind) VALUES (7, 'morpho_waterlevels'); + + CREATE SEQUENCE WSTS_ID_SEQ; CREATE TABLE wsts ( @@ -378,6 +393,7 @@ ALTER TABLE wst_column_values ADD CONSTRAINT cWstColumnValuesWstColumns FOREIGN KEY (wst_column_id) REFERENCES wst_columns ON DELETE CASCADE; ALTER TABLE wst_q_ranges ADD CONSTRAINT cWstQRangesRanges FOREIGN KEY (range_id) REFERENCES RANGES ON DELETE CASCADE; ALTER TABLE wsts ADD CONSTRAINT cWstsRivers FOREIGN KEY (river_id) REFERENCES rivers ON DELETE CASCADE; +ALTER TABLE wsts ADD CONSTRAINT cWstsWstKinds FOREIGN KEY (kind) REFERENCES wst_kinds; -- VIEWS diff -r da1e897c7224 -r 7a11271f5593 flys-backend/src/main/java/de/intevation/flys/backend/FLYSCredentials.java --- a/flys-backend/src/main/java/de/intevation/flys/backend/FLYSCredentials.java Tue Mar 12 19:15:18 2013 +0100 +++ b/flys-backend/src/main/java/de/intevation/flys/backend/FLYSCredentials.java Tue Mar 12 19:16:05 2013 +0100 @@ -17,6 +17,7 @@ import de.intevation.flys.model.CrossSectionLine; import de.intevation.flys.model.CrossSectionPoint; import de.intevation.flys.model.CrossSectionTrack; +import de.intevation.flys.model.CrossSectionTrackKind; import de.intevation.flys.model.DGM; import de.intevation.flys.model.Depth; import de.intevation.flys.model.DischargeTable; @@ -28,6 +29,7 @@ import de.intevation.flys.model.Fixpoint; import de.intevation.flys.model.Floodmaps; import de.intevation.flys.model.Floodplain; +import de.intevation.flys.model.FloodplainKind; import de.intevation.flys.model.FlowVelocityMeasurement; import de.intevation.flys.model.FlowVelocityMeasurementValue; import de.intevation.flys.model.FlowVelocityModel; @@ -134,6 +136,7 @@ CrossSectionLine.class, CrossSectionPoint.class, CrossSectionTrack.class, + CrossSectionTrackKind.class, Depth.class, DGM.class, DischargeTable.class, @@ -144,6 +147,7 @@ FedState.class, Fixpoint.class, Floodplain.class, + FloodplainKind.class, Floodmaps.class, FlowVelocityMeasurement.class, FlowVelocityMeasurementValue.class, diff -r da1e897c7224 -r 7a11271f5593 flys-backend/src/main/java/de/intevation/flys/importer/ImportRiver.java --- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportRiver.java Tue Mar 12 19:15:18 2013 +0100 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportRiver.java Tue Mar 12 19:16:05 2013 +0100 @@ -130,6 +130,9 @@ protected List floodProtection; + /** Wst-structures from waterlevel-difference-csv files. */ + protected List waterlevelDifferences; + protected List bedHeightSingles; protected List bedHeightEpochs; @@ -144,10 +147,6 @@ protected List sedimentYields; - protected List waterlevels; - - protected List waterlevelDiffs; - protected List measurementStations; protected List sqRelations; @@ -204,14 +203,13 @@ fixations = new ArrayList(); officialLines = new ArrayList(); floodWater = new ArrayList(); + waterlevelDifferences = new ArrayList(); floodProtection = new ArrayList(); sedimentDensities = new ArrayList(); morphologicalWidths = new ArrayList(); flowVelocityModels = new ArrayList(); flowVelocityMeasurements = new ArrayList(); sedimentYields = new ArrayList(); - waterlevels = new ArrayList(); - waterlevelDiffs = new ArrayList(); measurementStations = new ArrayList(); sqRelations = new ArrayList(); } @@ -560,10 +558,12 @@ parser.parse(file); } + // TODO use own List for waterlevels // The parsed ImportWaterlevels are converted to // 'fixation'-wsts now. - for(ImportWst iw: parser.exportWsts()) { - //iw.setDescription("CSV" + iw.getDescription()); + for(ImportWst iw: parser.getWaterlevels()) { + iw.setDescription("CSV/" + iw.getDescription()); + iw.setKind(6); fixations.add(iw); } } @@ -624,7 +624,12 @@ parser.parse(file); } - waterlevelDiffs = parser.getDifferences(); + // WaterlevelDifferences become Wsts now. + for(ImportWst iw: parser.getDifferences()) { + iw.setDescription("CSV/" + iw.getDescription()); + iw.setKind(7); + waterlevelDifferences.add(iw); + } } @@ -1078,7 +1083,6 @@ storeMorphologicalWidth(); storeFlowVelocity(); storeSedimentYield(); - storeWaterlevels(); storeWaterlevelDifferences(); storeMeasurementStations(); storeSQRelations(); @@ -1125,13 +1129,27 @@ if (!Config.INSTANCE.skipFixations() || !Config.INSTANCE.skipWaterlevels()) { log.info("store fixation wsts and/or csvs"); River river = getPeer(); - for (ImportWst wst: fixations) { - log.debug("name: " + wst.getDescription()); - wst.storeDependencies(river); + for (ImportWst fwst: fixations) { + log.debug("name: " + fwst.getDescription()); + fwst.storeDependencies(river); } } } + + /** Store wsts from waterleveldifference-csv files. */ + public void storeWaterlevelDifferences() { + if (!Config.INSTANCE.skipWaterlevelDifferences()) + + log.info("store waterleveldifferences wsts from csv"); + River river = getPeer(); + for (ImportWst dWst: waterlevelDifferences) { + log.debug("water.diff.: name " + dWst.getDescription()); + dWst.storeDependencies(river); + } + } + + public void storeExtraWsts() { if (!Config.INSTANCE.skipExtraWsts()) { log.info("store extra wsts"); @@ -1343,40 +1361,6 @@ } - public void storeWaterlevels() { - if (!Config.INSTANCE.skipWaterlevels()) { - log.info("store waterlevels"); - - River river = getPeer(); - - for (ImportWaterlevel waterlevel: waterlevels) { - waterlevel.storeDependencies(river); - } - } - } - - - public void storeWaterlevelDifferences() { - if (!Config.INSTANCE.skipWaterlevelDifferences()) { - log.info("store waterlevel differences"); - - River river = getPeer(); - - for (ImportWaterlevelDifference diff: waterlevelDiffs) { - try { - diff.storeDependencies(river); - } - catch (SQLException sqle) { - log.error("Error while storing waterlevel diff.", sqle); - } - catch (ConstraintViolationException cve) { - log.error("Error while storing waterlevel diff.", cve); - } - } - } - } - - public void storeMeasurementStations() { if (!Config.INSTANCE.skipMeasurementStations()) { log.info("store measurement stations"); diff -r da1e897c7224 -r 7a11271f5593 flys-backend/src/main/java/de/intevation/flys/importer/ImportWaterlevel.java --- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportWaterlevel.java Tue Mar 12 19:15:18 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,102 +0,0 @@ -package de.intevation.flys.importer; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.log4j.Logger; - -import org.hibernate.Session; -import org.hibernate.Query; - -import de.intevation.flys.model.River; -import de.intevation.flys.model.Unit; -import de.intevation.flys.model.Waterlevel; - - -public class ImportWaterlevel { - - private static final Logger log = Logger.getLogger(ImportWaterlevel.class); - - private ImportUnit unit; - - private String description; - - private List qRanges; - - private Waterlevel peer; - - public ImportWaterlevel(String description) { - this.qRanges = new ArrayList(); - - this.description = description; - } - - public String getDescription() { - return this.description; - } - - public void setUnit(ImportUnit unit) { - this.unit = unit; - } - - public ImportUnit getUnit() { - return this.unit; - } - - public void addValue(ImportWaterlevelQRange qRange) { - this.qRanges.add(qRange); - } - - public List getQRanges() { - return this.qRanges; - } - - public void storeDependencies(River river) { - log.info("store dependencies"); - - Waterlevel peer = getPeer(river); - - if (peer != null) { - int i = 0; - - for (ImportWaterlevelQRange qRange : qRanges) { - qRange.storeDependencies(peer); - i++; - } - - log.info("stored " + i + " waterlevel q ranges"); - } - } - - public Waterlevel getPeer(River river) { - Unit u = unit != null ? unit.getPeer() : null; - if (u == null) { - log.warn("skip invalid waterlevel - no unit set!"); - return null; - } - - if (peer == null) { - Session session = ImporterSession.getInstance() - .getDatabaseSession(); - Query query = session.createQuery("from Waterlevel where " - + " river=:river and " + " unit=:unit and " - + " description=:description"); - - query.setParameter("river", river); - query.setParameter("unit", u); - query.setParameter("description", description); - - List wsts = query.list(); - if (wsts.isEmpty()) { - peer = new Waterlevel(river, u, description); - session.save(peer); - } - else { - peer = wsts.get(0); - } - } - - return peer; - } -} -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r da1e897c7224 -r 7a11271f5593 flys-backend/src/main/java/de/intevation/flys/importer/ImportWaterlevelDifference.java --- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportWaterlevelDifference.java Tue Mar 12 19:15:18 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +0,0 @@ -package de.intevation.flys.importer; - -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - -import org.apache.log4j.Logger; - -import org.hibernate.Session; -import org.hibernate.Query; -import org.hibernate.exception.ConstraintViolationException; - -import de.intevation.flys.model.River; -import de.intevation.flys.model.Unit; -import de.intevation.flys.model.WaterlevelDifference; - - -public class ImportWaterlevelDifference { - - private static final Logger log = Logger - .getLogger(ImportWaterlevelDifference.class); - - private ImportUnit unit; - - private String description; - - private List columns; - - private WaterlevelDifference peer; - - public ImportWaterlevelDifference(String description) { - this.columns = new ArrayList(); - - this.description = description; - } - - public void setUnit(ImportUnit unit) { - this.unit = unit; - } - - public void addValue(ImportWaterlevelDifferenceColumn column) { - this.columns.add(column); - } - - public void storeDependencies(River river) throws SQLException, - ConstraintViolationException { - log.info("store dependencies"); - - WaterlevelDifference peer = getPeer(river); - - if (peer != null) { - int i = 0; - - for (ImportWaterlevelDifferenceColumn column : columns) { - column.storeDependencies(peer); - i++; - } - - log.info("stored " + i + " waterlevel difference columns"); - } - } - - public WaterlevelDifference getPeer(River river) { - Unit u = unit != null ? unit.getPeer() : null; - if (u == null) { - log.warn("IWD: skip invalid waterlevel difference - no unit set!"); - return null; - } - - if (peer == null) { - Session session = ImporterSession.getInstance() - .getDatabaseSession(); - Query query = session - .createQuery("from WaterlevelDifference where " - + " river=:river and " + " unit=:unit and " - + " description=:description"); - - query.setParameter("river", river); - query.setParameter("unit", u); - query.setParameter("description", description); - - List diffs = query.list(); - if (diffs.isEmpty()) { - peer = new WaterlevelDifference(river, u, description); - session.save(peer); - } - else { - peer = diffs.get(0); - } - } - - return peer; - } -} -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r da1e897c7224 -r 7a11271f5593 flys-backend/src/main/java/de/intevation/flys/importer/ImportWaterlevelDifferenceColumn.java --- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportWaterlevelDifferenceColumn.java Tue Mar 12 19:15:18 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,81 +0,0 @@ -package de.intevation.flys.importer; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.log4j.Logger; - -import org.hibernate.Session; -import org.hibernate.Query; - -import de.intevation.flys.model.WaterlevelDifference; -import de.intevation.flys.model.WaterlevelDifferenceColumn; - - -public class ImportWaterlevelDifferenceColumn { - - private static final Logger log = - Logger.getLogger(ImportWaterlevelDifferenceColumn.class); - - - private String description; - - private List values; - - private WaterlevelDifferenceColumn peer; - - - public ImportWaterlevelDifferenceColumn(String description) { - this.values = new ArrayList(); - - this.description = description; - } - - - public void addValue(ImportWaterlevelDifferenceValue value) { - this.values.add(value); - } - - - public void storeDependencies(WaterlevelDifference difference) { - log.info("store dependencies"); - - WaterlevelDifferenceColumn peer = getPeer(difference); - - int i = 0; - - for (ImportWaterlevelDifferenceValue value: values) { - value.storeDependencies(peer); - i++; - } - - log.info("stored " + i + " waterlevel difference values"); - } - - - public WaterlevelDifferenceColumn getPeer(WaterlevelDifference diff) { - if (peer == null) { - Session session = ImporterSession.getInstance().getDatabaseSession(); - Query query = session.createQuery( - "from WaterlevelDifferenceColumn where " + - " difference=:difference and " + - " description=:description" - ); - - query.setParameter("difference", diff); - query.setParameter("description", description); - - List cols = query.list(); - if (cols.isEmpty()) { - peer = new WaterlevelDifferenceColumn(diff, description); - session.save(peer); - } - else { - peer = cols.get(0); - } - } - - return peer; - } -} -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r da1e897c7224 -r 7a11271f5593 flys-backend/src/main/java/de/intevation/flys/importer/ImportWaterlevelDifferenceValue.java --- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportWaterlevelDifferenceValue.java Tue Mar 12 19:15:18 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -package de.intevation.flys.importer; - -import java.util.List; - -import org.apache.log4j.Logger; - -import org.hibernate.Session; -import org.hibernate.Query; - -import de.intevation.flys.model.WaterlevelDifferenceColumn; -import de.intevation.flys.model.WaterlevelDifferenceValue; - - -public class ImportWaterlevelDifferenceValue { - - private static final Logger log = - Logger.getLogger(ImportWaterlevelDifferenceValue.class); - - - private Double station; - private Double value; - - private WaterlevelDifferenceValue peer; - - - public ImportWaterlevelDifferenceValue(Double station, Double value) { - this.station = station; - this.value = value; - } - - - public void storeDependencies(WaterlevelDifferenceColumn column) { - getPeer(column); - } - - - public WaterlevelDifferenceValue getPeer(WaterlevelDifferenceColumn column) { - if (peer == null) { - Session session = ImporterSession.getInstance().getDatabaseSession(); - Query query = session.createQuery( - "from WaterlevelDifferenceValue where " + - " column=:column and " + - " station=:station and " + - " value=:value" - ); - - query.setParameter("column", column); - query.setParameter("station", station); - query.setParameter("value", value); - - List values = query.list(); - if (values.isEmpty()) { - peer = new WaterlevelDifferenceValue(column, station, value); - session.save(peer); - } - else { - peer = values.get(0); - } - } - - return peer; - } -} -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r da1e897c7224 -r 7a11271f5593 flys-backend/src/main/java/de/intevation/flys/importer/ImportWaterlevelQRange.java --- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportWaterlevelQRange.java Tue Mar 12 19:15:18 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +0,0 @@ -package de.intevation.flys.importer; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.log4j.Logger; - -import org.hibernate.Session; -import org.hibernate.Query; - -import de.intevation.flys.model.Waterlevel; -import de.intevation.flys.model.WaterlevelQRange; - - -/** Has a Q and list of W,km values. */ -public class ImportWaterlevelQRange { - - private static final Logger log = - Logger.getLogger(ImportWaterlevelQRange.class); - - private Double q; - - private List values; - - private WaterlevelQRange peer; - - - public ImportWaterlevelQRange(Double q) { - this.values = new ArrayList(); - this.q = q; - } - - public void addValue(ImportWaterlevelValue value) { - this.values.add(value); - } - - public Double getQ() { - return this.q; - } - - public List getValues() { - return values; - } - - public void storeDependencies(Waterlevel waterlevel) { - log.info("store dependencies"); - - WaterlevelQRange peer = getPeer(waterlevel); - - int i = 0; - - for (ImportWaterlevelValue value: values) { - value.storeDependencies(peer); - i++; - } - - log.info("stored " + i + " waterlevel values"); - } - - - public WaterlevelQRange getPeer(Waterlevel waterlevel) { - if (peer == null) { - Session session = ImporterSession.getInstance().getDatabaseSession(); - Query query = session.createQuery( - "from WaterlevelQRange where " + - " waterlevel=:waterlevel and " + - " q=:q" - ); - - query.setParameter("waterlevel", waterlevel); - query.setParameter("q", q); - - List qRanges = query.list(); - if (qRanges.isEmpty()) { - peer = new WaterlevelQRange(waterlevel, q); - session.save(peer); - } - else { - peer = qRanges.get(0); - } - } - - return peer; - } -} -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r da1e897c7224 -r 7a11271f5593 flys-backend/src/main/java/de/intevation/flys/importer/ImportWaterlevelValue.java --- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportWaterlevelValue.java Tue Mar 12 19:15:18 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -package de.intevation.flys.importer; - -import java.util.List; - -import org.hibernate.Session; -import org.hibernate.Query; - -import de.intevation.flys.model.WaterlevelQRange; -import de.intevation.flys.model.WaterlevelValue; - - -/** W and a station. */ -public class ImportWaterlevelValue { - - private Double station; - private Double w; - - private WaterlevelValue peer; - - - public ImportWaterlevelValue(Double station, Double w) { - this.station = station; - this.w = w; - } - - - public void storeDependencies(WaterlevelQRange qRange) { - getPeer(qRange); - } - - - public Double getStation() { - return this.station; - } - - - public Double getW() { - return this.w; - } - - public WaterlevelValue getPeer(WaterlevelQRange qRange) { - if (peer == null) { - Session session = ImporterSession.getInstance().getDatabaseSession(); - Query query = session.createQuery( - "from WaterlevelValue where " + - " qrange=:qrange and " + - " station=:station and " + - " w=:w" - ); - - query.setParameter("qrange", qRange); - query.setParameter("station", station); - query.setParameter("w", w); - - List values = query.list(); - - if (values.isEmpty()) { - peer = new WaterlevelValue(qRange, station, w); - session.save(peer); - } - else { - peer = values.get(0); - } - } - - return peer; - } -} -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r da1e897c7224 -r 7a11271f5593 flys-backend/src/main/java/de/intevation/flys/importer/ImportWstColumn.java --- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportWstColumn.java Tue Mar 12 19:15:18 2013 +0100 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportWstColumn.java Tue Mar 12 19:16:05 2013 +0100 @@ -93,6 +93,13 @@ new ImportWstColumnQRange(this, columnQRange)); } + + /** Get the Column Values stored in this column. */ + public List getColumnValues() { + return columnValues; + } + + public void storeDependencies(River river) { log.info("store column '" + name + "'"); WstColumn column = getPeer(river); diff -r da1e897c7224 -r 7a11271f5593 flys-backend/src/main/java/de/intevation/flys/importer/Importer.java --- a/flys-backend/src/main/java/de/intevation/flys/importer/Importer.java Tue Mar 12 19:15:18 2013 +0100 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/Importer.java Tue Mar 12 19:16:05 2013 +0100 @@ -76,7 +76,7 @@ catch (HibernateException he) { Throwable t = he.getCause(); while (t instanceof SQLException) { - SQLException sqle = (SQLException)t; + SQLException sqle = (SQLException) t; log.error("SQL exeception chain:", sqle); t = sqle.getNextException(); } diff -r da1e897c7224 -r 7a11271f5593 flys-backend/src/main/java/de/intevation/flys/importer/parsers/AnnotationsParser.java --- a/flys-backend/src/main/java/de/intevation/flys/importer/parsers/AnnotationsParser.java Tue Mar 12 19:15:18 2013 +0100 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/parsers/AnnotationsParser.java Tue Mar 12 19:16:05 2013 +0100 @@ -156,7 +156,7 @@ attribute, position, range, edge, type); if (!annotations.add(annotation)) { - log.warn("ANN: duplicated annotation '" + parts[0] + + log.info("ANN: duplicated annotation '" + parts[0] + "' in line " + in.getLineNumber()); } } diff -r da1e897c7224 -r 7a11271f5593 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 Tue Mar 12 19:15:18 2013 +0100 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/parsers/WaterlevelDifferencesParser.java Tue Mar 12 19:16:05 2013 +0100 @@ -2,6 +2,7 @@ import java.io.File; import java.io.IOException; +import java.math.BigDecimal; import java.text.NumberFormat; import java.text.ParseException; import java.util.ArrayList; @@ -12,11 +13,14 @@ import org.apache.log4j.Logger; import de.intevation.flys.importer.ImportUnit; -import de.intevation.flys.importer.ImportWaterlevelDifference; -import de.intevation.flys.importer.ImportWaterlevelDifferenceColumn; -import de.intevation.flys.importer.ImportWaterlevelDifferenceValue; + +import de.intevation.flys.importer.ImportWst; +import de.intevation.flys.importer.ImportWstColumn; +/** + * Parse WaterlevelDifferences CSV file. + */ public class WaterlevelDifferencesParser extends LineParser { private static final Logger log = @@ -28,32 +32,40 @@ public static final Pattern META_UNIT = Pattern.compile("^Einheit: \\[(.*)\\].*"); - - private List differences; + /** List of parsed differences as ImportWst s. */ + private List differences; - private ImportWaterlevelDifferenceColumn[] columns; + private ImportWstColumn[] columns; - private ImportWaterlevelDifference current; + /** The currently processed dataset. */ + private ImportWst current; public WaterlevelDifferencesParser() { - differences = new ArrayList(); + differences = new ArrayList(); } - public List getDifferences() { + /** Get the differences as wst parsed so far. */ + public List getDifferences() { return differences; } + /** + * Parse a csv waterleveldifferenceparser and create a ImportWst object + * from it. + */ @Override public void parse(File file) throws IOException { - current = new ImportWaterlevelDifference(file.getName()); + current = new ImportWst(file.getName()); + current.setKind(7); super.parse(file); } + /** No rewind implemented. */ @Override protected void reset() { } @@ -62,8 +74,10 @@ @Override protected void finish() { if (columns != null && current != null) { - for (ImportWaterlevelDifferenceColumn col: columns) { - current.addValue(col); + // TODO figure out if its needed, as the columns + // are registered at their construction time. + for (ImportWstColumn col: columns) { + // TODO place a current.addColumn(col); here? } differences.add(current); @@ -73,6 +87,7 @@ columns = null; } + @Override protected void handleLine(int lineNum, String line) { if (line.startsWith(START_META_CHAR)) { @@ -130,13 +145,13 @@ private void initColumns(String[] cols) { - columns = new ImportWaterlevelDifferenceColumn[cols.length]; + columns = new ImportWstColumn[cols.length]; for (int i = 0; i < cols.length; i++) { String name = cols[i].replace("\"", ""); log.debug("Create new column '" + name + "'"); - columns[i] = new ImportWaterlevelDifferenceColumn(name); + columns[i] = new ImportWstColumn(current, name, name, i); } } @@ -145,7 +160,7 @@ String[] cols = line.split(SEPERATOR_CHAR); if (cols == null || cols.length < 2) { - log.warn("skip invalid waterlevel line: '" + line + "'"); + log.warn("skip invalid waterlevel-diff line: '" + line + "'"); return; } @@ -163,10 +178,9 @@ String value = cols[idx]; try { - columns[i].addValue(new ImportWaterlevelDifferenceValue( - station, - nf.parse(value).doubleValue() - )); + columns[i].addColumnValue( + new BigDecimal(station), + new BigDecimal(nf.parse(value).doubleValue())); } catch (ParseException pe) { log.warn("Error while parsing value: '" + value + "'"); diff -r da1e897c7224 -r 7a11271f5593 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 Tue Mar 12 19:15:18 2013 +0100 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/parsers/WaterlevelParser.java Tue Mar 12 19:16:05 2013 +0100 @@ -13,13 +13,11 @@ import org.apache.log4j.Logger; import de.intevation.flys.importer.ImportUnit; -import de.intevation.flys.importer.ImportWaterlevel; -import de.intevation.flys.importer.ImportWaterlevelQRange; -import de.intevation.flys.importer.ImportWaterlevelValue; -import de.intevation.flys.importer.ImportWstColumn; import de.intevation.flys.importer.ImportRange; import de.intevation.flys.importer.ImportWst; +import de.intevation.flys.importer.ImportWstColumn; +import de.intevation.flys.importer.ImportWstColumnValue; import de.intevation.flys.importer.ImportWstQRange; @@ -43,71 +41,28 @@ public static final Pattern META_UNIT = Pattern.compile("^Einheit: \\[(.*)\\].*"); - private List waterlevels; + private List waterlevels; - private ImportWaterlevel current; + private ImportWst current; - private ImportWaterlevelQRange currentQ; + /** The Waterlevel-Wst s will always have but one column. */ + private ImportWstColumn column; + + /** The current (incomplete) Q Range. */ + private ImportWstQRange currentQRange; + + /** The current (incomplete) km range for Q Range. */ + private ImportRange currentRange; private String currentDescription; public WaterlevelParser() { - waterlevels = new ArrayList(); + waterlevels = new ArrayList(); } - /** - * Create ImportWst objects from ImportWaterlevel - * objects. - */ - public List exportWsts() { - List wsts = new ArrayList(); - for(ImportWaterlevel waterlevel: getWaterlevels()) { - String description = waterlevel.getDescription(); - ImportWst wst = new ImportWst(); - wsts.add(wst); - wst.setDescription(description); - // Fixation kind. - wst.setKind(2); - wst.setUnit(waterlevel.getUnit()); - - // Fake WST has but 1 column. - wst.setNumberColumns(1); - ImportWstColumn column = wst.getColumn(0); - column.setDescription(description); - column.setName(description); - column.setPosition(0); - - // Build Q Range. - List qRanges = waterlevel.getQRanges(); - for(ImportWaterlevelQRange range: qRanges) { - List values = range.getValues(); - if (values.size() < 2) { - log.warn ("Not enough values to build valid QRange"); - continue; - } - ImportRange iRange = new ImportRange( - BigDecimal.valueOf(values.get(0).getStation()), - BigDecimal.valueOf(values.get(values.size() -1).getStation())); - column.addColumnQRange( - new ImportWstQRange(iRange, BigDecimal.valueOf(range.getQ()))); - } - - // The other W/KM values. - for(ImportWaterlevelQRange range: qRanges) { - for(ImportWaterlevelValue value: range.getValues()) { - column.addColumnValue(BigDecimal.valueOf(value.getStation()), - BigDecimal.valueOf(value.getW())); - } - } - // TODO Maybe set a timeinterval. - } - return wsts; - } - - - public List getWaterlevels() { + public List getWaterlevels() { return waterlevels; } @@ -122,16 +77,25 @@ @Override protected void reset() { - currentQ = null; - current = new ImportWaterlevel(currentDescription); + currentQRange = null; + current = new ImportWst(currentDescription); + column = new ImportWstColumn(current, + currentDescription, + currentDescription, + 0); + current.setKind(6); } @Override protected void finish() { if (current != null) { - if (currentQ != null) { - current.addValue(currentQ); + if (currentQRange != null) { + List cValues = column.getColumnValues(); + // Set end of range to last station. + currentRange.setB(cValues.get(cValues.size() -1).getPosition()); + currentQRange.setRange(currentRange); + column.addColumnQRange(currentQRange); } waterlevels.add(current); @@ -172,23 +136,21 @@ if (m.matches()) { String unitStr = m.group(1); String valueStr = m.group(2); - - if (currentQ != null) { - if (current != null) { - current.addValue(currentQ); + try { + if (currentQRange != null) { + // Finish off the last one. + List cValues = column.getColumnValues(); + // Set end of range to last station. + currentRange.setB(cValues.get(cValues.size() -1).getPosition()); + currentQRange.setRange(currentRange); + column.addColumnQRange(currentQRange); } - else { - // this should never happen - log.warn("Try to add Q range without waterlevel!"); - } - } + currentQRange = new ImportWstQRange(null, + new BigDecimal(nf.parse(valueStr).doubleValue())); + currentRange = new ImportRange(); - try { log.debug("Found new Q range: Q=" + valueStr); - currentQ = new ImportWaterlevelQRange( - nf.parse(valueStr).doubleValue()); - return true; } catch (ParseException pe) { @@ -209,10 +171,17 @@ } try { + // Store the value and remember the position for QRange, if needed. Double station = nf.parse(cols[0]).doubleValue(); Double value = nf.parse(cols[1]).doubleValue(); - currentQ.addValue(new ImportWaterlevelValue(station, value)); + BigDecimal stationBD = new BigDecimal(station); + + column.addColumnValue(stationBD, new BigDecimal(value)); + + if (currentRange.getA() == null) { + currentRange.setA(stationBD); + } } catch (ParseException pe) { log.warn("Error while parsing number values: '" + line + "'"); diff -r da1e897c7224 -r 7a11271f5593 flys-backend/src/main/java/de/intevation/flys/model/CrossSectionTrack.java --- a/flys-backend/src/main/java/de/intevation/flys/model/CrossSectionTrack.java Tue Mar 12 19:15:18 2013 +0100 +++ b/flys-backend/src/main/java/de/intevation/flys/model/CrossSectionTrack.java Tue Mar 12 19:16:05 2013 +0100 @@ -152,6 +152,7 @@ Query query = session.createQuery( "from CrossSectionTrack where river.name =:river " + + "and kind_id = 1 " + "order by abs( km - :mykm)"); query.setParameter("river", river); query.setParameter("mykm", new BigDecimal(km)); diff -r da1e897c7224 -r 7a11271f5593 flys-backend/src/main/java/de/intevation/flys/model/CrossSectionTrackKind.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/model/CrossSectionTrackKind.java Tue Mar 12 19:16:05 2013 +0100 @@ -0,0 +1,45 @@ +package de.intevation.flys.model; + +import java.io.Serializable; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; + +@Entity +@Table(name = "cross_section_track_kinds") +public class CrossSectionTrackKind implements Serializable { + private Integer id; + private String name; + + @Id + @Column(name = "id") + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + /** + * Get name. + * + * @return The name of the Cross section kind as String. + */ + @Column(name = "name") + public String getName() { + return name; + } + + /** + * Set name. + * + * @param name the value to set. + */ + public void setName(String name) { + this.name = name; + } +} + diff -r da1e897c7224 -r 7a11271f5593 flys-backend/src/main/java/de/intevation/flys/model/Floodplain.java --- a/flys-backend/src/main/java/de/intevation/flys/model/Floodplain.java Tue Mar 12 19:15:18 2013 +0100 +++ b/flys-backend/src/main/java/de/intevation/flys/model/Floodplain.java Tue Mar 12 19:16:05 2013 +0100 @@ -24,11 +24,13 @@ public class Floodplain implements Serializable { - private Integer id; + private Integer id; - private River river; + private FloodplainKind kind; - private Polygon geom; + private River river; + + private Polygon geom; public Floodplain() { @@ -55,6 +57,16 @@ this.river = river; } + @OneToOne + @JoinColumn(name = "kind_id") + public FloodplainKind getKind() { + return kind; + } + + public void setKind(FloodplainKind kind) { + this.kind = kind; + } + @Column(name = "geom") @Type(type = "org.hibernatespatial.GeometryUserType") public Polygon getGeom() { @@ -69,8 +81,10 @@ public static Floodplain getFloodplain(String river) { Session session = SessionHolder.HOLDER.get(); + // kind_id 0 -> Offical + // kind_id 1 -> Misc. Query query = session.createQuery( - "from Floodplain where river.name =:river"); + "from Floodplain where river.name =:river and kind_id=1"); query.setParameter("river", river); List result = query.list(); diff -r da1e897c7224 -r 7a11271f5593 flys-backend/src/main/java/de/intevation/flys/model/FloodplainKind.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/model/FloodplainKind.java Tue Mar 12 19:16:05 2013 +0100 @@ -0,0 +1,45 @@ +package de.intevation.flys.model; + +import java.io.Serializable; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; + +@Entity +@Table(name = "floodplain_kinds") +public class FloodplainKind implements Serializable { + private Integer id; + private String name; + + @Id + @Column(name = "id") + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + /** + * Get name. + * + * @return The name of the Floodplain Kind as String. + */ + @Column(name = "name") + public String getName() { + return name; + } + + /** + * Set name. + * + * @param name the value to set. + */ + public void setName(String name) { + this.name = name; + } +} + diff -r da1e897c7224 -r 7a11271f5593 flys-backend/src/main/java/de/intevation/flys/model/Waterlevel.java --- a/flys-backend/src/main/java/de/intevation/flys/model/Waterlevel.java Tue Mar 12 19:15:18 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,113 +0,0 @@ -package de.intevation.flys.model; - -import java.io.Serializable; -import java.util.List; - -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; -import javax.persistence.GeneratedValue; -import javax.persistence.Column; -import javax.persistence.SequenceGenerator; -import javax.persistence.GenerationType; -import javax.persistence.JoinColumn; -import javax.persistence.OneToOne; -import javax.persistence.OneToMany; - -import org.apache.log4j.Logger; - - - -/** Mapped Waterlevel. */ -@Entity -@Table(name = "waterlevel") -public class Waterlevel -implements Serializable -{ - private static Logger logger = Logger.getLogger(Waterlevel.class); - - private Integer id; - - private River river; - - private Unit unit; - - private String description; - - private List qRanges; - - - public Waterlevel() { - } - - public Waterlevel(River river, Unit unit) { - this.river = river; - this.unit = unit; - } - - public Waterlevel(River river, Unit unit, String description) { - this(river, unit); - this.description = description; - } - - @Id - @SequenceGenerator( - name = "SEQUENCE_WATERLEVEL_ID_SEQ", - sequenceName = "WATERLEVEL_ID_SEQ", - allocationSize = 1) - @GeneratedValue( - strategy = GenerationType.SEQUENCE, - generator = "SEQUENCE_WATERLEVEL_ID_SEQ") - @Column(name = "id") - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - @OneToOne - @JoinColumn(name = "river_id" ) - public River getRiver() { - return river; - } - - public void setRiver(River river) { - this.river = river; - } - - @OneToOne - @JoinColumn(name = "unit_id") - public Unit getUnit() { - return unit; - } - - public void setUnit(Unit unit) { - this.unit = unit; - } - - @Column(name = "description") - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - @OneToMany - @JoinColumn(name="waterlevel_id") - public List getQRanges() { - return qRanges; - } - - public void setQRanges(List qRanges) { - this.qRanges = qRanges; - } - - public void addQRange(WaterlevelQRange qRange) { - qRanges.add(qRange); - } -} -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r da1e897c7224 -r 7a11271f5593 flys-backend/src/main/java/de/intevation/flys/model/WaterlevelDifference.java --- a/flys-backend/src/main/java/de/intevation/flys/model/WaterlevelDifference.java Tue Mar 12 19:15:18 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,119 +0,0 @@ -package de.intevation.flys.model; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; -import javax.persistence.GeneratedValue; -import javax.persistence.Column; -import javax.persistence.SequenceGenerator; -import javax.persistence.GenerationType; -import javax.persistence.JoinColumn; -import javax.persistence.OneToOne; -import javax.persistence.OneToMany; - -import org.apache.log4j.Logger; - - -@Entity -@Table(name = "waterlevel_difference") -public class WaterlevelDifference -implements Serializable -{ - private static Logger logger = Logger.getLogger(WaterlevelDifference.class); - - private Integer id; - - private River river; - - private Unit unit; - - private List columns; - - private String description; - - - public WaterlevelDifference() { - columns = new ArrayList(); - } - - - public WaterlevelDifference(River river, Unit unit) { - this(); - - this.river = river; - this.unit = unit; - } - - - public WaterlevelDifference(River river, Unit unit, String description) { - this(river, unit); - - this.description = description; - } - - - @Id - @SequenceGenerator( - name = "SEQUENCE_WATERLEVEL_DIFFERENCE_ID_SEQ", - sequenceName = "WATERLEVEL_DIFFERENCE_ID_SEQ", - allocationSize = 1) - @GeneratedValue( - strategy = GenerationType.SEQUENCE, - generator = "SEQUENCE_WATERLEVEL_DIFFERENCE_ID_SEQ") - @Column(name = "id") - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - @OneToOne - @JoinColumn(name = "river_id" ) - public River getRiver() { - return river; - } - - public void setRiver(River river) { - this.river = river; - } - - @OneToOne - @JoinColumn(name = "unit_id") - public Unit getUnit() { - return unit; - } - - public void setUnit(Unit unit) { - this.unit = unit; - } - - @Column(name = "description") - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - @OneToMany - @JoinColumn(name = "difference_id") - public List getColumns() { - return columns; - } - - public void setColumns(List columns) { - this.columns = columns; - } - - public void addColumn(WaterlevelDifferenceColumn column) { - this.columns.add(column); - } -} -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r da1e897c7224 -r 7a11271f5593 flys-backend/src/main/java/de/intevation/flys/model/WaterlevelDifferenceColumn.java --- a/flys-backend/src/main/java/de/intevation/flys/model/WaterlevelDifferenceColumn.java Tue Mar 12 19:15:18 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,104 +0,0 @@ -package de.intevation.flys.model; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; -import javax.persistence.GeneratedValue; -import javax.persistence.Column; -import javax.persistence.SequenceGenerator; -import javax.persistence.GenerationType; -import javax.persistence.JoinColumn; -import javax.persistence.OneToOne; -import javax.persistence.OneToMany; - -import org.apache.log4j.Logger; - - -@Entity -@Table(name = "waterlevel_difference_column") -public class WaterlevelDifferenceColumn -implements Serializable -{ - private static Logger logger = - Logger.getLogger(WaterlevelDifferenceColumn.class); - - - private Integer id; - - private WaterlevelDifference difference; - - private List values; - - private String description; - - - public WaterlevelDifferenceColumn() { - values = new ArrayList(); - } - - public WaterlevelDifferenceColumn( - WaterlevelDifference difference, - String description - ) { - this(); - - this.difference = difference; - this.description = description; - } - - - @Id - @SequenceGenerator( - name = "SEQUENCE_WATERLEVEL_DIFF_COLUMN_ID_SEQ", - sequenceName = "WATERLEVEL_DIFF_COLUMN_ID_SEQ", - allocationSize = 1) - @GeneratedValue( - strategy = GenerationType.SEQUENCE, - generator = "SEQUENCE_WATERLEVEL_DIFF_COLUMN_ID_SEQ") - @Column(name = "id") - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - @OneToOne - @JoinColumn(name = "difference_id" ) - public WaterlevelDifference getDifference() { - return difference; - } - - public void setDifference(WaterlevelDifference difference) { - this.difference = difference; - } - - @Column(name = "description") - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - @OneToMany - @JoinColumn(name = "column_id") - public List getValues() { - return values; - } - - public void setValues(List values) { - this.values = values; - } - - public void addValue(WaterlevelDifferenceValue value) { - this.values.add(value); - } -} -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r da1e897c7224 -r 7a11271f5593 flys-backend/src/main/java/de/intevation/flys/model/WaterlevelDifferenceValue.java --- a/flys-backend/src/main/java/de/intevation/flys/model/WaterlevelDifferenceValue.java Tue Mar 12 19:15:18 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,94 +0,0 @@ -package de.intevation.flys.model; - -import java.io.Serializable; - -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; -import javax.persistence.GeneratedValue; -import javax.persistence.Column; -import javax.persistence.SequenceGenerator; -import javax.persistence.GenerationType; -import javax.persistence.JoinColumn; -import javax.persistence.OneToOne; - -import org.apache.log4j.Logger; - - -@Entity -@Table(name = "waterlevel_difference_values") -public class WaterlevelDifferenceValue -implements Serializable -{ - private static Logger logger = - Logger.getLogger(WaterlevelDifferenceValue.class); - - - private Integer id; - - private WaterlevelDifferenceColumn column; - - private Double station; - private Double value; - - - public WaterlevelDifferenceValue() { - } - - public WaterlevelDifferenceValue( - WaterlevelDifferenceColumn column, - Double station, - Double value - ) { - this.column = column; - this.station = station; - this.value = value; - } - - - @Id - @SequenceGenerator( - name = "SEQUENCE_WATERLEVEL_DIFF_VALUES_ID_SEQ", - sequenceName = "WATERLEVEL_DIFF_VALUES_ID_SEQ", - allocationSize = 1) - @GeneratedValue( - strategy = GenerationType.SEQUENCE, - generator = "SEQUENCE_WATERLEVEL_DIFF_VALUES_ID_SEQ") - @Column(name = "id") - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - @OneToOne - @JoinColumn(name = "column_id" ) - public WaterlevelDifferenceColumn getColumn() { - return column; - } - - public void setColumn(WaterlevelDifferenceColumn column) { - this.column = column; - } - - @Column(name = "station") - public Double getStation() { - return station; - } - - public void setStation(Double station) { - this.station = station; - } - - @Column(name = "value") - public Double getValue() { - return value; - } - - public void setValue(Double value) { - this.value = value; - } -} -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r da1e897c7224 -r 7a11271f5593 flys-backend/src/main/java/de/intevation/flys/model/WaterlevelQRange.java --- a/flys-backend/src/main/java/de/intevation/flys/model/WaterlevelQRange.java Tue Mar 12 19:15:18 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,100 +0,0 @@ -package de.intevation.flys.model; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; -import javax.persistence.GeneratedValue; -import javax.persistence.Column; -import javax.persistence.SequenceGenerator; -import javax.persistence.GenerationType; -import javax.persistence.JoinColumn; -import javax.persistence.OneToOne; -import javax.persistence.OneToMany; - -import org.apache.log4j.Logger; - - - - -@Entity -@Table(name = "waterlevel_q_range") -public class WaterlevelQRange -implements Serializable -{ - private static Logger logger = Logger.getLogger(WaterlevelQRange.class); - - private Integer id; - - private Waterlevel waterlevel; - - private Double q; - - private List values; - - - public WaterlevelQRange() { - this.values = new ArrayList(); - } - - public WaterlevelQRange(Waterlevel waterlevel, Double q) { - this(); - this.q = q; - this.waterlevel = waterlevel; - } - - - @Id - @SequenceGenerator( - name = "SEQUENCE_WATERLEVEL_Q_RANGE_ID_SEQ", - sequenceName = "WATERLEVEL_Q_RANGES_ID_SEQ", - allocationSize = 1) - @GeneratedValue( - strategy = GenerationType.SEQUENCE, - generator = "SEQUENCE_WATERLEVEL_Q_RANGE_ID_SEQ") - @Column(name = "id") - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - @OneToOne - @JoinColumn(name = "waterlevel_id" ) - public Waterlevel getWaterlevel() { - return waterlevel; - } - - public void setWaterlevel(Waterlevel waterlevel) { - this.waterlevel = waterlevel; - } - - @Column(name = "q") - public Double getQ() { - return q; - } - - public void setQ(Double q) { - this.q = q; - } - - @OneToMany - @Column(name = "waterlevel_q_range_id") - public List getValues() { - return values; - } - - public void setValues(List values) { - this.values = values; - } - - public void addValue(WaterlevelValue value) { - values.add(value); - } -} -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r da1e897c7224 -r 7a11271f5593 flys-backend/src/main/java/de/intevation/flys/model/WaterlevelValue.java --- a/flys-backend/src/main/java/de/intevation/flys/model/WaterlevelValue.java Tue Mar 12 19:15:18 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,90 +0,0 @@ -package de.intevation.flys.model; - -import java.io.Serializable; - -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; -import javax.persistence.GeneratedValue; -import javax.persistence.Column; -import javax.persistence.SequenceGenerator; -import javax.persistence.GenerationType; -import javax.persistence.JoinColumn; -import javax.persistence.OneToOne; - -import org.apache.log4j.Logger; - - - - -@Entity -@Table(name = "waterlevel_values") -public class WaterlevelValue -implements Serializable -{ - private static Logger logger = Logger.getLogger(WaterlevelValue.class); - - private Integer id; - - private WaterlevelQRange qrange; - - private Double station; - private Double w; - - - public WaterlevelValue() { - } - - public WaterlevelValue(WaterlevelQRange qrange, Double station, Double w) { - this.qrange = qrange; - this.station = station; - this.w = w; - } - - - @Id - @SequenceGenerator( - name = "SEQUENCE_WATERLEVEL_VALUES_ID_SEQ", - sequenceName = "WATERLEVEL_VALUES_ID_SEQ", - allocationSize = 1) - @GeneratedValue( - strategy = GenerationType.SEQUENCE, - generator = "SEQUENCE_WATERLEVEL_VALUES_ID_SEQ") - @Column(name = "id") - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - @OneToOne - @JoinColumn(name = "waterlevel_q_range_id" ) - public WaterlevelQRange getQrange() { - return qrange; - } - - public void setQrange(WaterlevelQRange qrange) { - this.qrange = qrange; - } - - @Column(name = "station") - public Double getStation() { - return station; - } - - public void setStation(Double station) { - this.station = station; - } - - @Column(name = "w") - public Double getW() { - return w; - } - - public void setW(Double w) { - this.w = w; - } -} -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r da1e897c7224 -r 7a11271f5593 flys-client/src/main/java/de/intevation/flys/client/client/ui/DoubleArrayPanel.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/DoubleArrayPanel.java Tue Mar 12 19:15:18 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/DoubleArrayPanel.java Tue Mar 12 19:16:05 2013 +0100 @@ -64,7 +64,9 @@ sti.setValue(title); ti.addBlurHandler(blurHandler); - ti.addFocusHandler(focusHandler); + if (focusHandler != null) { + ti.addFocusHandler(focusHandler); + } if (titleOrientation == TitleOrientation.RIGHT) { setFields(ti, sti);