branch develop updated (fe76025 -> 66fc6f0)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository echobase. See https://gitlab.nuiton.org/codelutin/echobase.git from fe76025 Merge branch 'develop' of gitlab.nuiton.org:codelutin/echobase into develop new 66fc6f0 Fix function for spacial data for mooring The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 66fc6f0671e121098e9ab6f21809091ca7addee2 Author: Julien Ruchaud <julien.ruchaud@debux.org> Date: Wed Jul 13 11:00:39 2016 +0200 Fix function for spacial data for mooring Summary of changes: ...WorkingDbMigrationCallBackForVersion3_910.java} | 12 +- .../workingDb/pg/3.910-0-update-procedure.sql | 187 +++++++++++++++++++++ .../src/main/resources/postgis-structure.sql | 8 +- echobase-domain/src/main/xmi/echobase.properties | 2 +- .../echobase-catches-and-voyage-result.h2.db.gz | Bin 991130 -> 991130 bytes .../import-data/echobase-catches.h2.db.gz | Bin 924955 -> 924956 bytes .../import-data/echobase-commonData.h2.db.gz | Bin 370149 -> 370150 bytes .../import-data/echobase-mooring-results.h2.db.gz | Bin 930474 -> 930474 bytes .../import-data/echobase-mooring.h2.db.gz | Bin 925371 -> 925373 bytes .../resources/import-data/echobase-nodata.h2.db.gz | Bin 318631 -> 318632 bytes .../echobase-operation-total-samples.h2.db.gz | Bin 785190 -> 785188 bytes .../import-data/echobase-operation.h2.db.gz | Bin 508067 -> 508066 bytes 12 files changed, 201 insertions(+), 8 deletions(-) copy echobase-domain/src/main/java/fr/ifremer/echobase/persistence/migration/workingDb/{WorkingDbMigrationCallBackForVersion3_906.java => WorkingDbMigrationCallBackForVersion3_910.java} (84%) create mode 100644 echobase-domain/src/main/resources/migration/workingDb/pg/3.910-0-update-procedure.sql -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository echobase. See https://gitlab.nuiton.org/codelutin/echobase.git commit 66fc6f0671e121098e9ab6f21809091ca7addee2 Author: Julien Ruchaud <julien.ruchaud@debux.org> Date: Wed Jul 13 11:00:39 2016 +0200 Fix function for spacial data for mooring --- .../WorkingDbMigrationCallBackForVersion3_910.java | 56 ++++++ .../workingDb/pg/3.910-0-update-procedure.sql | 187 +++++++++++++++++++++ .../src/main/resources/postgis-structure.sql | 8 +- echobase-domain/src/main/xmi/echobase.properties | 2 +- .../echobase-catches-and-voyage-result.h2.db.gz | Bin 991130 -> 991130 bytes .../import-data/echobase-catches.h2.db.gz | Bin 924955 -> 924956 bytes .../import-data/echobase-commonData.h2.db.gz | Bin 370149 -> 370150 bytes .../import-data/echobase-mooring-results.h2.db.gz | Bin 930474 -> 930474 bytes .../import-data/echobase-mooring.h2.db.gz | Bin 925371 -> 925373 bytes .../resources/import-data/echobase-nodata.h2.db.gz | Bin 318631 -> 318632 bytes .../echobase-operation-total-samples.h2.db.gz | Bin 785190 -> 785188 bytes .../import-data/echobase-operation.h2.db.gz | Bin 508067 -> 508066 bytes 12 files changed, 250 insertions(+), 3 deletions(-) diff --git a/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/migration/workingDb/WorkingDbMigrationCallBackForVersion3_910.java b/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/migration/workingDb/WorkingDbMigrationCallBackForVersion3_910.java new file mode 100644 index 0000000..f7d12ab --- /dev/null +++ b/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/migration/workingDb/WorkingDbMigrationCallBackForVersion3_910.java @@ -0,0 +1,56 @@ +package fr.ifremer.echobase.persistence.migration.workingDb; + +/* + * #%L + * EchoBase :: Domain + * %% + * Copyright (C) 2011 - 2016 Ifremer, Codelutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 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 Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ + +import org.nuiton.topia.persistence.TopiaException; +import org.nuiton.topia.persistence.support.TopiaSqlSupport; +import org.nuiton.version.Version; +import org.nuiton.version.Versions; + +import java.util.List; + +/** + * Created on 26/04/16. + * + * @author Julien Ruchaud - ruchaud@codelutin.com + * @since 4.0 + */ +public class WorkingDbMigrationCallBackForVersion3_910 extends WorkingDbMigrationCallBackForVersionSupport { + + @Override + public Version getVersion() { + return Versions.valueOf("3.910"); + } + + @Override + protected void prepareMigrationScript(TopiaSqlSupport sqlSupport, + List<String> queries, + boolean showSql, + boolean showProgression) throws TopiaException { + + boolean spatialAware = isSpatialStructureFound(sqlSupport); + if (spatialAware) { + addSpecificScript("3.910-0-update-procedure.sql", queries); + } + } + +} diff --git a/echobase-domain/src/main/resources/migration/workingDb/pg/3.910-0-update-procedure.sql b/echobase-domain/src/main/resources/migration/workingDb/pg/3.910-0-update-procedure.sql new file mode 100644 index 0000000..7d65d43 --- /dev/null +++ b/echobase-domain/src/main/resources/migration/workingDb/pg/3.910-0-update-procedure.sql @@ -0,0 +1,187 @@ +--- +-- #%L +-- EchoBase :: Domain +-- %% +-- Copyright (C) 2011 - 2016 Ifremer, Codelutin +-- %% +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU Affero General Public License as published by +-- the Free Software Foundation, either version 3 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 Affero General Public License +-- along with this program. If not, see <http://www.gnu.org/licenses/>. +-- #L% +--- + +CREATE OR REPLACE FUNCTION echobase_create_echobase_cell_spatial_row( + cell_id VARCHAR, + coordinateText VARCHAR, + coordinate3dText VARCHAR, + shapeText VARCHAR) + RETURNS VOID AS $$ +DECLARE + cellSpatialRow RECORD; + voyageId VARCHAR; + voyageName VARCHAR; + transitId VARCHAR; + transitName VARCHAR; + transectId VARCHAR; + transectName VARCHAR; + dataAcquisitionId VARCHAR; + dataAcquisitionName VARCHAR; + dataProcessingId VARCHAR; + dataProcessingName VARCHAR; + cellName VARCHAR; + cellTypeId VARCHAR; + cellTypeName VARCHAR; + cellParentId VARCHAR; + cellRow RECORD; + coordinateData GEOMETRY; + coordinate3dData GEOMETRY; + shapeData GEOMETRY; +BEGIN + IF coordinateText IS NULL AND coordinate3dText IS NULL AND + shapeText IS NULL + THEN + RAISE DEBUG 'Could not find spatial data for cell %', cell_id; + RETURN; + END IF; + IF coordinateText IS NOT NULL + THEN + BEGIN + coordinateData = ST_GeomFromEWKT(coordinateText); + EXCEPTION WHEN internal_error + THEN + + RAISE LOG 'Could not create coordinate spatial data %', coordinateText; + RETURN; + END; + ELSEIF coordinate3dText IS NOT NULL + THEN + BEGIN + coordinate3dData = ST_GeomFromEWKT(coordinate3dText); + EXCEPTION WHEN internal_error + THEN + + RAISE LOG 'Could not create coordinate3D spatial data %', coordinate3dText; + RETURN; + END; + ELSEIF shapeText IS NOT NULL + THEN + BEGIN + shapeData = ST_GeomFromEWKT(shapeText); + EXCEPTION WHEN internal_error + THEN + + RAISE LOG 'Could not create shape spatial data %', shapeText; + RETURN; + END; + END IF; + + SELECT + * + INTO cellSpatialRow + FROM echobase_cell_spatial cs + WHERE cs.cellid = cell_id; + IF NOT FOUND + THEN +-- create row + RAISE DEBUG 'Will create spatial cell %', cell_id; + SELECT + cell_id + INTO cellParentId; + LOOP + IF dataProcessingId IS NULL + THEN +-- try to get dataprocessingId from this cell + SELECT + dp.topiaid, + dp.processingdescription + INTO dataProcessingId + FROM dataprocessing dp, cell c + WHERE c.topiaid = cellParentId AND dp.topiaid = c.dataprocessing; + END IF; + SELECT + topiaid, + cell + INTO cellRow + FROM cell + WHERE topiaid = cellParentId; + EXIT WHEN cellRow.cell IS NULL; + SELECT + cellRow.cell + INTO cellParentId; + END LOOP; + RAISE DEBUG 'use cell parentId %', cellParentId; +-- get cell infos + SELECT + c.name, + ct.name, + ct.topiaid + INTO cellName, cellTypeName, cellTypeId + FROM cell c, celltype ct + WHERE c.topiaid = cell_id AND c.celltype = ct.topiaid; + + IF dataProcessingId IS NULL + THEN +-- get voyage infos + SELECT + v.topiaid, + v.name + INTO voyageId, voyageName + FROM voyage v, cell c + WHERE c.topiaid = cellParentId AND v.topiaid = c.voyage; + ELSE + +-- get dataAcquisition infos + SELECT + da.topiaid, + da.acousticinstrument + INTO dataAcquisitionId, dataAcquisitionName + FROM dataacquisition da, dataprocessing dp + WHERE dp.topiaId = dataProcessingId AND da.topiaid = dp.dataacquisition; +-- get transect infos + SELECT + t.topiaid, + t.vessel + INTO transectId, transitName + FROM transect t, dataacquisition da + WHERE da.topiaid = dataAcquisitionId AND t.topiaid = da.transect; +-- get transit infos + SELECT + t.topiaid, + (t.starttime || ' - ' || t.endtime) + INTO transitId, transitName + FROM transit t, transect tt + WHERE tt.topiaid = transectId AND t.topiaid = tt.transit; +-- get voyage infos + SELECT + v.topiaid, + v.name + INTO voyageId, voyageName + FROM voyage v, transit t + WHERE t.topiaid = transitId AND v.topiaid = t.voyage; + END IF; + + IF voyageId IS NOT NULL + THEN + INSERT INTO echobase_cell_spatial (lastUpdateDate, voyageid, voyagename, transitid, transitname, transectid, transectname, dataacquisitionid, dataacquisitionname, dataprocessingid, dataprocessingname, celltypeid, celltypename, cellid, cellname, coordinate, coordinate3d, shape) + VALUES (now(), voyageId, voyageName, transitId, transitName, transectId, transectName, dataAcquisitionId, dataAcquisitionName, dataProcessingId, dataProcessingName, cellTypeId, cellTypeName, cell_id, cellName, coordinateData, coordinate3dData, shapeData); + END IF; + ELSE +-- update row + RAISE DEBUG 'Will update spatial cell % ', cell_id; + UPDATE echobase_cell_spatial + SET coordinate = coordinateData, + coordinate3d = coordinate3dData, + shape = shapeData + WHERE cellid = cell_id; + END IF; +END +$$ LANGUAGE plpgsql; diff --git a/echobase-domain/src/main/resources/postgis-structure.sql b/echobase-domain/src/main/resources/postgis-structure.sql index 87038d3..2ddf130 100644 --- a/echobase-domain/src/main/resources/postgis-structure.sql +++ b/echobase-domain/src/main/resources/postgis-structure.sql @@ -970,8 +970,12 @@ BEGIN FROM voyage v, transit t WHERE t.topiaid = transitId AND v.topiaid = t.voyage; END IF; - INSERT INTO echobase_cell_spatial (lastUpdateDate, voyageid, voyagename, transitid, transitname, transectid, transectname, dataacquisitionid, dataacquisitionname, dataprocessingid, dataprocessingname, celltypeid, celltypename, cellid, cellname, coordinate, coordinate3d, shape) - VALUES (now(), voyageId, voyageName, transitId, transitName, transectId, transectName, dataAcquisitionId, dataAcquisitionName, dataProcessingId, dataProcessingName, cellTypeId, cellTypeName, cell_id, cellName, coordinateData, coordinate3dData, shapeData); + + IF voyageId IS NOT NULL + THEN + INSERT INTO echobase_cell_spatial (lastUpdateDate, voyageid, voyagename, transitid, transitname, transectid, transectname, dataacquisitionid, dataacquisitionname, dataprocessingid, dataprocessingname, celltypeid, celltypename, cellid, cellname, coordinate, coordinate3d, shape) + VALUES (now(), voyageId, voyageName, transitId, transitName, transectId, transectName, dataAcquisitionId, dataAcquisitionName, dataProcessingId, dataProcessingName, cellTypeId, cellTypeName, cell_id, cellName, coordinateData, coordinate3dData, shapeData); + END IF; ELSE -- update row RAISE DEBUG 'Will update spatial cell % ', cell_id; diff --git a/echobase-domain/src/main/xmi/echobase.properties b/echobase-domain/src/main/xmi/echobase.properties index 843a83d..f03f910 100644 --- a/echobase-domain/src/main/xmi/echobase.properties +++ b/echobase-domain/src/main/xmi/echobase.properties @@ -23,7 +23,7 @@ model.tagValue.notGenerateToString=true model.tagValue.generateOperatorForDAOHelper=true -model.tagValue.version=3.909 +model.tagValue.version=3.910 model.tagValue.generatePropertyChangeSupport=false model.tagValue.generateBooleanGetMethods=false model.tagValue.indexForeignKeys=true diff --git a/echobase-services/src/test/resources/import-data/echobase-catches-and-voyage-result.h2.db.gz b/echobase-services/src/test/resources/import-data/echobase-catches-and-voyage-result.h2.db.gz index cb9a1fd..da8c28d 100644 Binary files a/echobase-services/src/test/resources/import-data/echobase-catches-and-voyage-result.h2.db.gz and b/echobase-services/src/test/resources/import-data/echobase-catches-and-voyage-result.h2.db.gz differ diff --git a/echobase-services/src/test/resources/import-data/echobase-catches.h2.db.gz b/echobase-services/src/test/resources/import-data/echobase-catches.h2.db.gz index 9b43b7a..710f949 100644 Binary files a/echobase-services/src/test/resources/import-data/echobase-catches.h2.db.gz and b/echobase-services/src/test/resources/import-data/echobase-catches.h2.db.gz differ diff --git a/echobase-services/src/test/resources/import-data/echobase-commonData.h2.db.gz b/echobase-services/src/test/resources/import-data/echobase-commonData.h2.db.gz index 5bf04c8..4b1c353 100644 Binary files a/echobase-services/src/test/resources/import-data/echobase-commonData.h2.db.gz and b/echobase-services/src/test/resources/import-data/echobase-commonData.h2.db.gz differ diff --git a/echobase-services/src/test/resources/import-data/echobase-mooring-results.h2.db.gz b/echobase-services/src/test/resources/import-data/echobase-mooring-results.h2.db.gz index 82504bd..3f912d0 100644 Binary files a/echobase-services/src/test/resources/import-data/echobase-mooring-results.h2.db.gz and b/echobase-services/src/test/resources/import-data/echobase-mooring-results.h2.db.gz differ diff --git a/echobase-services/src/test/resources/import-data/echobase-mooring.h2.db.gz b/echobase-services/src/test/resources/import-data/echobase-mooring.h2.db.gz index aa8a10d..7d5a159 100644 Binary files a/echobase-services/src/test/resources/import-data/echobase-mooring.h2.db.gz and b/echobase-services/src/test/resources/import-data/echobase-mooring.h2.db.gz differ diff --git a/echobase-services/src/test/resources/import-data/echobase-nodata.h2.db.gz b/echobase-services/src/test/resources/import-data/echobase-nodata.h2.db.gz index 085f054..ecc0c46 100644 Binary files a/echobase-services/src/test/resources/import-data/echobase-nodata.h2.db.gz and b/echobase-services/src/test/resources/import-data/echobase-nodata.h2.db.gz differ diff --git a/echobase-services/src/test/resources/import-data/echobase-operation-total-samples.h2.db.gz b/echobase-services/src/test/resources/import-data/echobase-operation-total-samples.h2.db.gz index 582eb6b..991e981 100644 Binary files a/echobase-services/src/test/resources/import-data/echobase-operation-total-samples.h2.db.gz and b/echobase-services/src/test/resources/import-data/echobase-operation-total-samples.h2.db.gz differ diff --git a/echobase-services/src/test/resources/import-data/echobase-operation.h2.db.gz b/echobase-services/src/test/resources/import-data/echobase-operation.h2.db.gz index 7a1758e..00c3ed0 100644 Binary files a/echobase-services/src/test/resources/import-data/echobase-operation.h2.db.gz and b/echobase-services/src/test/resources/import-data/echobase-operation.h2.db.gz differ -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
participants (1)
-
codelutin.com scm