branch develop updated (9999f750 -> 134e610a)
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 9999f750 J'aime pas les gros commits comme ça, mais tout est imbriqué :( new 5b96a582 #refs 10217 : fix numbersAtLength new 391ecd01 refs #10217 : fix Stratum vocabulary new 1fe4581f Update doc new de09f794 Clean code new 80f2e5eb Fix pg migrations new 1cddf9e1 Fix dataAcquisition link during acoustic import new 134e610a refs #10216 : Fix Atlantos acoustic export (still issue on echotype vocabulary) The 7 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 134e610ab7f9fc7be1922cb1bab9250eded1a97b Author: jcouteau <couteau@codelutin.com> Date: Thu Jan 30 16:01:36 2020 +0100 refs #10216 : Fix Atlantos acoustic export (still issue on echotype vocabulary) commit 1cddf9e1bcf1bce60cd09a879038e1cbaf5fefb8 Author: jcouteau <couteau@codelutin.com> Date: Thu Jan 30 15:59:46 2020 +0100 Fix dataAcquisition link during acoustic import commit 80f2e5eb629d4bce6bd6dbda34d50a19520a6851 Author: jcouteau <couteau@codelutin.com> Date: Thu Jan 30 15:59:07 2020 +0100 Fix pg migrations commit de09f794d3dbbd7a283573a5e81dc42fcc4158fc Author: jcouteau <couteau@codelutin.com> Date: Thu Jan 30 15:58:37 2020 +0100 Clean code commit 1fe4581f7b306d9af96e6fa2e51ea63e0a95c449 Author: jcouteau <couteau@codelutin.com> Date: Thu Jan 30 15:53:49 2020 +0100 Update doc commit 391ecd01c6cd64b086bbc2af30de42d61ba92058 Author: jcouteau <couteau@codelutin.com> Date: Thu Jan 30 13:58:33 2020 +0100 refs #10217 : fix Stratum vocabulary commit 5b96a582c38d4be65d7b3cbbd2dac297ab5d7a65 Author: jcouteau <couteau@codelutin.com> Date: Thu Jan 30 13:56:46 2020 +0100 #refs 10217 : fix numbersAtLength Summary of changes: .../echobase/entities/data/TransitImpl.java | 10 +- .../ifremer/echobase/entities/data/VoyageImpl.java | 11 +- .../workingDb/pg/3.914-1-importlog-importtext.sql | 2 +- .../migration/workingDb/pg/3.915-1-echotypeId.sql | 2 +- .../echobase/services/csv/CellValueParser.java | 5 +- .../service/atlantos/ExportAtlantosService.java | 25 +- .../service/atlantos/xml/VocabularyExport.java | 16 +- .../service/atlantos/xml/XmlAccousticExport.java | 32 +-- .../service/atlantos/xml/XmlBioticExport.java | 201 ++++++++------- .../actions/ImportAcousticsActionSupport.java | 2 +- .../services/service/spatial/LizmapRepository.java | 28 +- .../fr/ifremer/echobase/services/FixCellsIT.java | 283 --------------------- .../atlantos/ExportAtlantosServiceTest.java | 40 ++- .../service/importdb/ImportDbServiceTest.java | 2 +- .../resources/echobase-importDb-referentiel.zip | Bin 51131 -> 50973 bytes .../echobase/ui/EchoBaseStaticContentLoader.java | 3 +- .../src/main/webapp/WEB-INF/includes/footer.jsp | 3 +- pom.xml | 24 ++ src/site/en/rst/importData.rst | 10 +- src/site/rst/importData.rst | 42 +-- 20 files changed, 248 insertions(+), 493 deletions(-) delete mode 100644 echobase-services/src/test/java/fr/ifremer/echobase/services/FixCellsIT.java -- 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 5b96a582c38d4be65d7b3cbbd2dac297ab5d7a65 Author: jcouteau <couteau@codelutin.com> Date: Thu Jan 30 13:56:46 2020 +0100 #refs 10217 : fix numbersAtLength --- .../service/atlantos/xml/XmlBioticExport.java | 199 +++++++++++---------- 1 file changed, 103 insertions(+), 96 deletions(-) diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/atlantos/xml/XmlBioticExport.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/atlantos/xml/XmlBioticExport.java index 58a7e26e..d61b010e 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/atlantos/xml/XmlBioticExport.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/atlantos/xml/XmlBioticExport.java @@ -68,7 +68,7 @@ public class XmlBioticExport implements EchoBaseService { for (Operation operation : operations) { Collection<Sample> samples = operation.getSample(); - Boolean exportHaul=false; + boolean exportHaul=false; //Export Haul only if it contains samples for (Sample sample : samples) { @@ -121,107 +121,114 @@ public class XmlBioticExport implements EchoBaseService { } String codeCatKey = code + "#" + categoryName; - if ("Total".equals(name)) { - //Add sample to totals list if no subsamples (yet) - if (subsamples.get(codeCatKey) == null) { - totals.put(codeCatKey, sample); + switch (name) { + case "Total": { + //Add sample to totals list if no subsamples (yet) + if (subsamples.get(codeCatKey) == null) { + totals.put(codeCatKey, sample); + } + + //Add sample weight to speciesCategoryWeight + Float weight = speciesCategoryWeights.get(codeCatKey); + if (weight == null) { + weight = 0f; + } + + Float sampleWeight = sample.getSampleWeight(); + if (sampleWeight != null) { + weight += sampleWeight; + } + speciesCategoryWeights.put(codeCatKey, weight); + + //Add sample number to speciesCategoryNumber + Integer number = speciesCategoryNumbers.get(codeCatKey); + if (number == null) { + number = 0; + } + + Integer numberSampled = sample.getNumberSampled(); + if (numberSampled != null) { + number += numberSampled; + } + speciesCategoryNumbers.put(codeCatKey, number); + + break; } - - //Add sample weight to speciesCategoryWeight - Float weight = speciesCategoryWeights.get(codeCatKey); - if (weight == null) { - weight = 0f; - } - - Float sampleWeight = sample.getSampleWeight(); - if (sampleWeight != null) { - weight += sampleWeight; - } - speciesCategoryWeights.put(codeCatKey, weight); - - //Add sample number to speciesCategoryNumber - Integer number = speciesCategoryNumbers.get(codeCatKey); - if (number == null) { - number = 0; - } - - Integer numberSampled = sample.getNumberSampled(); - if (numberSampled != null) { - number += numberSampled; - } - speciesCategoryNumbers.put(codeCatKey, number); - - } else if ("Subsample".equals(name)) { - - //Get back sample datas - Map<String, String> sampleDataValues = getSampleDataValues(sample); - - // get back weight at length for this subsample - String weightAtLength = sampleDataValues.get(SampleDataTypeImpl.WEIGHT_AT_LENGTHKG); - Float sampleWeight = null; - if (weightAtLength != null) { - sampleWeight = Float.parseFloat(weightAtLength); - } - - //add weightAtLength to the sum for this category - Float weightBySize = subsampledWeights.get(codeCatKey); - if (weightBySize == null) { - weightBySize = 0f; - } - if (sampleWeight != null) { - weightBySize += sampleWeight; - } - subsampledWeights.put(codeCatKey, weightBySize); - - //get back number at length for this subsample - String numberAtLength = sampleDataValues.get(SampleDataTypeImpl.NUMBER_AT_LENGTH); - Float sampleNumber = null; - if (numberAtLength != null) { - sampleNumber = Float.parseFloat(numberAtLength); - } - - //add numberAtLength to the sum for this category - Integer sumNumberAtLength = subsampledNumbers.get(codeCatKey); - if (sumNumberAtLength == null) { - sumNumberAtLength = 0; + case "Subsample": { + + //Get back sample datas + Map<String, String> sampleDataValues = getSampleDataValues(sample); + + // get back weight at length for this subsample + String weightAtLength = sampleDataValues.get(SampleDataTypeImpl.WEIGHT_AT_LENGTHKG); + Float sampleWeight = null; + if (weightAtLength != null) { + sampleWeight = Float.parseFloat(weightAtLength); + } + + //add weightAtLength to the sum for this category + Float weightBySize = subsampledWeights.get(codeCatKey); + if (weightBySize == null) { + weightBySize = 0f; + } + if (sampleWeight != null) { + weightBySize += sampleWeight; + } + subsampledWeights.put(codeCatKey, weightBySize); + + //get back number at length for this subsample + String numberAtLength = sampleDataValues.get(SampleDataTypeImpl.NUMBER_AT_LENGTH); + Float sampleNumber = null; + if (numberAtLength != null) { + sampleNumber = Float.parseFloat(numberAtLength); + } + + //add numberAtLength to the sum for this category + Integer sumNumberAtLength = subsampledNumbers.get(codeCatKey); + if (sumNumberAtLength == null) { + sumNumberAtLength = 0; + } + if (sampleNumber != null) { + sumNumberAtLength += sampleNumber.intValue(); + } + subsampledNumbers.put(codeCatKey, sumNumberAtLength); + + //Add subsample to the list + List<Sample> speciesCategorySubsamples = subsamples.get(codeCatKey); + if (speciesCategorySubsamples == null) { + speciesCategorySubsamples = new ArrayList<>(); + } + speciesCategorySubsamples.add(sample); + subsamples.put(codeCatKey, speciesCategorySubsamples); + + //check if total present, if so, removes it + if (subsamples.get(codeCatKey) != null) { + totals.remove(codeCatKey); + } + + break; } - if (sampleNumber != null) { - sumNumberAtLength += sampleNumber.intValue(); - } - subsampledNumbers.put(codeCatKey, sumNumberAtLength); - - //Add subsample to the list - List<Sample> speciesCategorySubsamples = subsamples.get(codeCatKey); - if (speciesCategorySubsamples == null) { - speciesCategorySubsamples = new ArrayList<>(); - } - speciesCategorySubsamples.add(sample); - subsamples.put(codeCatKey, speciesCategorySubsamples); + case "Individual": { - //check if total present, if so, removes it - if (subsamples.get(codeCatKey) != null) { - totals.remove(codeCatKey); - } - - } else if ("Individual".equals(name)) { + //Get back sample datas + Map<String, String> sampleDataValues = getSampleDataValues(sample); - //Get back sample datas - Map<String, String> sampleDataValues = getSampleDataValues(sample); + //Get back lengthclass for individual, remove trailing .0 + String lengthClass = sampleDataValues.get("LTmm1"); + lengthClass = lengthClass.substring(0, lengthClass.indexOf(".")); - //Get back lengthclass for individual, remove trailing .0 - String lengthClass = sampleDataValues.get("LTmm1"); - lengthClass = lengthClass.substring(0, lengthClass.indexOf(".")); + String codeCatLCkey = codeCatKey + "#" + lengthClass; - String codeCatLCkey = codeCatKey + "#" + lengthClass; + //add individual to the list + List<Sample> lengthClassIndividuals = individuals.get(codeCatLCkey); + if (lengthClassIndividuals == null) { + lengthClassIndividuals = new ArrayList<>(); + individuals.put(codeCatLCkey, lengthClassIndividuals); + } + lengthClassIndividuals.add(sample); - //add individual to the list - List<Sample> lengthClassIndividuals = individuals.get(codeCatLCkey); - if (lengthClassIndividuals == null) { - lengthClassIndividuals = new ArrayList<>(); - individuals.put(codeCatLCkey, lengthClassIndividuals); + break; } - lengthClassIndividuals.add(sample); - } } } @@ -571,8 +578,8 @@ public class XmlBioticExport implements EchoBaseService { String label = data.getDataLabel(); if (SampleDataTypeImpl.NUMBER_AT_LENGTH.equals(dataName)) { - sampleDataValues.put(SampleDataTypeImpl.NUMBER_AT_LENGTH, String.valueOf(value)); - sampleDataValues.put(dataName, label); + //We always have floats instead of Atlantos expected ints (so rounding will strip the .0) + sampleDataValues.put(SampleDataTypeImpl.NUMBER_AT_LENGTH, String.valueOf(Math.round(value))); sampleDataValues.put("LengthClass", label); } else { sampleDataValues.put(dataName, String.valueOf(value)); -- 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 391ecd01c6cd64b086bbc2af30de42d61ba92058 Author: jcouteau <couteau@codelutin.com> Date: Thu Jan 30 13:58:33 2020 +0100 refs #10217 : fix Stratum vocabulary --- .../ifremer/echobase/services/service/atlantos/xml/XmlBioticExport.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/atlantos/xml/XmlBioticExport.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/atlantos/xml/XmlBioticExport.java index d61b010e..3a7611ca 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/atlantos/xml/XmlBioticExport.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/atlantos/xml/XmlBioticExport.java @@ -422,7 +422,7 @@ public class XmlBioticExport implements EchoBaseService { xml.create("Netopening", netopening); xml.create("Stratum", - "IDREF", vocabulary.getVocabularyCode("AC_Stratum_" + depthStratum)); + "IDREF", vocabulary.getVocabularyCode(depthStratum, "AC_Stratum_CLAS")); } public void exportCatch(Sample subsample, Float subsampledWeight, Float speciesCategoryWeight, Integer subsampledNumber, Integer speciesCategoryNumber, XmlWriter xml) throws IOException { -- 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 1fe4581f7b306d9af96e6fa2e51ea63e0a95c449 Author: jcouteau <couteau@codelutin.com> Date: Thu Jan 30 15:53:49 2020 +0100 Update doc --- pom.xml | 24 ++++++++++++++++++++++++ src/site/en/rst/importData.rst | 10 ++++++---- src/site/rst/importData.rst | 42 +++++++++++++++++++++++------------------- 3 files changed, 53 insertions(+), 23 deletions(-) diff --git a/pom.xml b/pom.xml index b545b51c..8d18b826 100644 --- a/pom.xml +++ b/pom.xml @@ -539,6 +539,30 @@ </plugins> </pluginManagement> + <plugins> + <!--For sonar code coverage--> + <plugin> + <groupId>org.jacoco</groupId> + <artifactId>jacoco-maven-plugin</artifactId> + <version>0.8.5</version> + <executions> + <execution> + <id>default-prepare-agent</id> + <goals> + <goal>prepare-agent</goal> + </goals> + </execution> + <execution> + <id>default-report</id> + <phase>test</phase> + <goals> + <goal>report</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> <reporting> diff --git a/src/site/en/rst/importData.rst b/src/site/en/rst/importData.rst index f7ce6e9b..944b3899 100644 --- a/src/site/en/rst/importData.rst +++ b/src/site/en/rst/importData.rst @@ -491,7 +491,7 @@ Required columns :: - operationId;baracoudaCode;numFish;dataLabel;dataValue;name + operationId;baracoudaCode;numFish;dataLabel;dataValue;name;sizeCategory Columns formats --------------- @@ -511,14 +511,16 @@ Columns formats +----------------+--------------------------+ | dataValue |(Float-NA) | +----------------+--------------------------+ +| sizeCategory |FK(SizeCategory#name) | ++----------------+--------------------------+ Example ------- :: - operationId;baracoudaCode;numFish;dataLabel;dataValue;name - P5002;ENGR-ENC;9394;NA;-1;Age + operationId;baracoudaCode;numFish;dataLabel;dataValue;name;sizeCategory + P5002;ENGR-ENC;9394;NA;-1;Age;0 Acoustic (voyage or mooring) ============================ @@ -716,7 +718,7 @@ Required columns :: - voyage;echotypeName;depthStratumId;meaning;baracoudaCode + voyage;echotypeName;depthStratumId;meaning;baracoudaCode;id Columns formats --------------- diff --git a/src/site/rst/importData.rst b/src/site/rst/importData.rst index 1335aa92..b26b03e3 100644 --- a/src/site/rst/importData.rst +++ b/src/site/rst/importData.rst @@ -497,7 +497,7 @@ Colonnes requises :: - operationId;baracoudaCode;numFish;dataLabel;dataValue;name + operationId;baracoudaCode;numFish;dataLabel;dataValue;name;sizeCategory Format des colonnes ------------------- @@ -517,14 +517,16 @@ Format des colonnes +----------------+--------------------------+ | dataValue |(Float-NA) | +----------------+--------------------------+ +| sizeCategory |FK(SizeCategory#name) | ++----------------+--------------------------+ Exemple ------- :: - operationId;baracoudaCode;numFish;dataLabel;dataValue;name - P5002;ENGR-ENC;9394;NA;-1;Age + operationId;baracoudaCode;numFish;dataLabel;dataValue;name;sizeCategory + P5002;ENGR-ENC;9394;NA;-1;Age;1 Acoustic (voyage ou bouée) ========================== @@ -722,32 +724,34 @@ Colonnes requises :: - voyage;echotypeName;depthStratumId;meaning;baracoudaCode + voyage;echotypeName;depthStratumId;meaning;baracoudaCode;id Format des colonnes ------------------- -+-----------------+--------------------------+ -| Colonne | Type | -+=================+==========================+ -| echotypeName |text | -+-----------------+--------------------------+ -| meaning |text | -+-----------------+--------------------------+ -| voyage |FK(Voyage#name) | -+-----------------+--------------------------+ -| depthStratumId |FK(DepthStratum#id) | -+-----------------+--------------------------+ -| baracoudaCode |FK(Species#baracoudaCode) | -+-----------------+--------------------------+ ++-----------------+-------------------------------+ +| Colonne | Type | ++=================+===============================+ +| echotypeName |text | ++-----------------+-------------------------------+ +| meaning |text | ++-----------------+-------------------------------+ +| voyage |FK(Voyage#name) | ++-----------------+-------------------------------+ +| depthStratumId |FK(DepthStratum#id) | ++-----------------+-------------------------------+ +| baracoudaCode |FK(Species#baracoudaCode) | ++-----------------+-------------------------------+ +| id |integer (species category code | ++-----------------+-------------------------------+ Exemple ------- :: - voyage;echotypeName;depthStratumId;meaning;baracoudaCode - PELGAS2011;D1;CLAS;Maquereaux, Chinchards et gadidés présents dans les couches à proximité du fond;COMP-LEM + voyage;echotypeName;depthStratumId;meaning;baracoudaCode;id + PELGAS2011;D1;CLAS;Maquereaux, Chinchards et gadidés présents dans les couches à proximité du fond;COMP-LEM;& LengthWeightKey ~~~~~~~~~~~~~~~ -- 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 de09f794d3dbbd7a283573a5e81dc42fcc4158fc Author: jcouteau <couteau@codelutin.com> Date: Thu Jan 30 15:58:37 2020 +0100 Clean code --- .../echobase/entities/data/TransitImpl.java | 10 +- .../ifremer/echobase/entities/data/VoyageImpl.java | 11 +- .../echobase/services/csv/CellValueParser.java | 5 +- .../service/atlantos/ExportAtlantosService.java | 25 +- .../service/atlantos/xml/VocabularyExport.java | 16 +- .../services/service/spatial/LizmapRepository.java | 28 +- .../fr/ifremer/echobase/services/FixCellsIT.java | 283 --------------------- .../atlantos/ExportAtlantosServiceTest.java | 40 ++- .../service/importdb/ImportDbServiceTest.java | 2 +- .../resources/echobase-importDb-referentiel.zip | Bin 51131 -> 50973 bytes .../echobase/ui/EchoBaseStaticContentLoader.java | 3 +- .../src/main/webapp/WEB-INF/includes/footer.jsp | 3 +- 12 files changed, 71 insertions(+), 355 deletions(-) diff --git a/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/TransitImpl.java b/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/TransitImpl.java index 6e5a2e18..fb0893f3 100644 --- a/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/TransitImpl.java +++ b/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/TransitImpl.java @@ -21,21 +21,23 @@ package fr.ifremer.echobase.entities.data; import com.google.common.base.Preconditions; +import com.google.common.collect.Lists; import fr.ifremer.echobase.entities.references.Vessel; +import java.util.Collection; + public class TransitImpl extends TransitAbstract { private static final long serialVersionUID = 3775200869632533299L; @Override - public Transect getTransect(Vessel vessel) { + public Collection<Transect> getTransects(Vessel vessel) { Preconditions.checkNotNull(vessel); - Transect result = null; + Collection<Transect> result = Lists.newArrayList(); if (!isTransectEmpty()) { for (Transect t : transect) { if (vessel.equals(t.getVessel())) { - result = t; - break; + result.add(t); } } } diff --git a/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/VoyageImpl.java b/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/VoyageImpl.java index 4626ec32..f10193f7 100644 --- a/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/VoyageImpl.java +++ b/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/VoyageImpl.java @@ -30,6 +30,7 @@ import fr.ifremer.echobase.entities.references.Vessel; import java.util.Collection; import java.util.Date; +import java.util.List; import java.util.Set; /** @@ -136,10 +137,12 @@ public class VoyageImpl extends VoyageAbstract { if (!isTransitEmpty()) { for (Transit t : transit) { - Transect transect = t.getTransect(vessel); - if (transect != null) { - Collection<Operation> operations = transect.getOperation(); - result.addAll(operations); + Collection<Transect> transects = t.getTransects(vessel); + for (Transect transect:transects) { + if (transect != null) { + Collection<Operation> operations = transect.getOperation(); + result.addAll(operations); + } } } } diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/CellValueParser.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/CellValueParser.java index 577b197d..b0e808d0 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/CellValueParser.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/csv/CellValueParser.java @@ -28,7 +28,6 @@ import org.nuiton.csv.ImportRuntimeException; import org.nuiton.csv.ValueParser; import org.nuiton.topia.persistence.TopiaException; -import java.text.ParseException; import java.util.List; import java.util.Map; @@ -48,7 +47,7 @@ public class CellValueParser implements ValueParser<Cell> { } @Override - public Cell parse(String cellId) throws ParseException { + public Cell parse(String cellId) { // get esdu cell Cell result = getCell(cellId); @@ -59,7 +58,7 @@ public class CellValueParser implements ValueParser<Cell> { return result; } - protected Cell getCell(String cellId) throws ParseException { + protected Cell getCell(String cellId) { Cell result = esduCellMap.get(cellId); diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/atlantos/ExportAtlantosService.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/atlantos/ExportAtlantosService.java index 11224c22..2b79dd20 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/atlantos/ExportAtlantosService.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/atlantos/ExportAtlantosService.java @@ -102,15 +102,12 @@ public class ExportAtlantosService extends EchoBaseServiceSupport { fileAccousticVoca.close(); fileAccousticCruise.close(); - FileChannel outAccoustic = new FileOutputStream(outputAccousticHead.toFile(), true).getChannel(); - FileChannel inAccousticVoca = new FileInputStream(outputAccousticVoca.toFile()).getChannel(); - FileChannel inAccousticCruise = new FileInputStream(outputAccousticCruise.toFile()).getChannel(); - outAccoustic.transferFrom(inAccousticVoca, 0, inAccousticVoca.size()); - outAccoustic.transferFrom(inAccousticCruise, 0, inAccousticCruise.size()); - - outAccoustic.close(); - inAccousticVoca.close(); - inAccousticCruise.close(); + try (FileChannel outAccoustic = new FileOutputStream(outputAccousticHead.toFile(), true).getChannel(); + FileChannel inAccousticVoca = new FileInputStream(outputAccousticVoca.toFile()).getChannel(); + FileChannel inAccousticCruise = new FileInputStream(outputAccousticCruise.toFile()).getChannel()) { + outAccoustic.transferFrom(inAccousticVoca, 0, inAccousticVoca.size()); + outAccoustic.transferFrom(inAccousticCruise, 0, inAccousticCruise.size()); + } outputAccousticHead.toFile().deleteOnExit(); outputAccousticVoca.toFile().delete(); @@ -131,12 +128,10 @@ public class ExportAtlantosService extends EchoBaseServiceSupport { fileBioticVoca.close(); fileBioticCruise.close(); - FileChannel outBiotic = new FileOutputStream(outputBioticVoca.toFile(), true).getChannel(); - FileChannel inBioticCruise = new FileInputStream(outputBioticCruise.toFile()).getChannel(); - outBiotic.transferFrom(inBioticCruise, 0, inBioticCruise.size()); - - outBiotic.close(); - inBioticCruise.close(); + try (FileChannel outBiotic = new FileOutputStream(outputBioticVoca.toFile(), true).getChannel(); + FileChannel inBioticCruise = new FileInputStream(outputBioticCruise.toFile()).getChannel()) { + outBiotic.transferFrom(inBioticCruise, 0, inBioticCruise.size()); + } outputBioticVoca.toFile().deleteOnExit(); outputBioticCruise.toFile().delete(); diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/atlantos/xml/VocabularyExport.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/atlantos/xml/VocabularyExport.java index 9ed58ff9..0c050920 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/atlantos/xml/VocabularyExport.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/atlantos/xml/VocabularyExport.java @@ -23,12 +23,9 @@ package fr.ifremer.echobase.services.service.atlantos.xml; import fr.ifremer.echobase.entities.data.Category; import fr.ifremer.echobase.entities.data.Echotype; -import fr.ifremer.echobase.entities.references.SizeCategory; import fr.ifremer.echobase.entities.references.Species; -import fr.ifremer.echobase.entities.references.SpeciesCategory; import fr.ifremer.echobase.services.EchoBaseService; import fr.ifremer.echobase.services.service.UserDbPersistenceService; -import org.apache.commons.lang.StringUtils; import java.io.IOException; import java.util.HashMap; @@ -44,7 +41,9 @@ import javax.inject.Inject; * @author julien */ public class VocabularyExport implements EchoBaseService { - + + public static final String VOCABULARY_PATTERN = "^(((AC_)|(ISO_)|(ICES_)|(Gear))?[^_]+)_(.+)"; + @Inject private UserDbPersistenceService persistenceService; @@ -58,8 +57,8 @@ public class VocabularyExport implements EchoBaseService { protected XmlWriter writer; protected Pattern pattern; - public void init(XmlWriter writer) throws IOException { - this.pattern = Pattern.compile("^(((AC_)|(ISO_)|(ICES_))?[^_]+)_(.+)"); + public void init(XmlWriter writer) { + this.pattern = Pattern.compile(VOCABULARY_PATTERN); this.writer = writer; @@ -137,7 +136,7 @@ public class VocabularyExport implements EchoBaseService { Matcher matcher = this.pattern.matcher(code); matcher.find(); String prefix = matcher.group(1); - String value = matcher.group(6); + String value = matcher.group(7); this.writer.create("Code", "ID", code, @@ -223,7 +222,8 @@ public class VocabularyExport implements EchoBaseService { this.writer.open("Species"); this.writer.create("SpeciesCode", "IDREF", getVocabularyCode("SpecWoRMS_" + species.getWormsCode())); - this.writer.create("SpeciesCategory", speciesCategoryName); + //this.writer.create("SpeciesCategory", speciesCategoryName); + this.writer.create("SpeciesCategory", "IDREF", getVocabularyCode(speciesCategoryName,"AC_CatchCategory_1")); this.writer.close("Species"); } diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/spatial/LizmapRepository.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/spatial/LizmapRepository.java index b07733a0..4965cc1e 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/spatial/LizmapRepository.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/spatial/LizmapRepository.java @@ -255,10 +255,8 @@ public class LizmapRepository { protected void updateLizmapAuthorizations() { - Connection connection = null; + try (Connection connection = DriverManager.getConnection(configuration.getLizmapApplicationJdbcUrl())) { - try { - connection = DriverManager.getConnection(configuration.getLizmapApplicationJdbcUrl()); connection.setAutoCommit(false); String repoName = getRepositoryName(); @@ -279,19 +277,8 @@ public class LizmapRepository { connection.commit(); - connection.close(); - } catch (SQLException e) { throw new EchoBaseTechnicalException("Could not create rights in lizmap", e); - } finally { - try { - if (connection != null && !connection.isClosed()) { - connection.close(); - } - } catch (SQLException e) { - //FIXME We should never throw an exception in finally block - throw new EchoBaseTechnicalException("Could not create rights in lizmap", e); - } } } @@ -301,19 +288,8 @@ public class LizmapRepository { log.debug("Execute sql query to lizmap: " + query); } - Statement statement = connection.createStatement(); - - try { + try (Statement statement = connection.createStatement()){ statement.execute(query); - - statement.close(); - - } finally { - - if (statement != null) { - statement.close(); - } - } } diff --git a/echobase-services/src/test/java/fr/ifremer/echobase/services/FixCellsIT.java b/echobase-services/src/test/java/fr/ifremer/echobase/services/FixCellsIT.java deleted file mode 100644 index 304f35a6..00000000 --- a/echobase-services/src/test/java/fr/ifremer/echobase/services/FixCellsIT.java +++ /dev/null @@ -1,283 +0,0 @@ -package fr.ifremer.echobase.services; - -/* - * #%L - * EchoBase :: Services - * %% - * Copyright (C) 2011 - 2012 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 com.google.common.collect.Sets; -import fr.ifremer.echobase.services.csv.EchoBaseCsvUtil; -import fr.ifremer.echobase.entities.data.Cell; -import fr.ifremer.echobase.entities.data.Data; -import fr.ifremer.echobase.entities.data.Voyage; -import fr.ifremer.echobase.services.service.UserDbPersistenceService; -import fr.ifremer.echobase.services.service.importdata.configurations.VoyageAcousticsImportConfiguration; -import fr.ifremer.echobase.services.service.importdata.CellPositionReference; -import fr.ifremer.echobase.services.service.importdata.ImportDataService; -import fr.ifremer.echobase.services.service.importdata.ImportException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.junit.Test; -import org.nuiton.topia.persistence.TopiaDao; -import org.nuiton.topia.persistence.TopiaException; - -import java.io.IOException; -import java.text.DateFormat; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.Set; - -/** - * To fix cells and datas. - * - * see http://forge.codelutin.com/issues/1592 - * see http://forge.codelutin.com/issues/1593 - * - * @author Tony Chemit - chemit@codelutin.com - * @since 1.4 - */ -public class FixCellsIT extends EchoBaseTestServiceSupport { - - /** Logger. */ - private static final Log log = LogFactory.getLog(FixCellsIT.class); - - public static int[] YEARS = { - 1998, - 2000, - 2001, - 2002, - 2003, - 2004, - 2005, - 2006, - 2007, - 2008, - 2009, - 2010 - }; - /* - 1998 :: 10017 - 2000 :: 12075 - 2001 :: 18000 - 2002 :: 15303 - 2003 :: 27315 - 2004 :: 23955 - 2005 :: 14805 - 2006 :: 12825 - 2007 :: 16005 - 2008 :: 20595 - 2009 :: 24690 - 2010 :: 15150 - - */ - - @Override - protected FakeEchoBaseServiceContext initContext() { -// return new FakeEchoBaseServiceContext(null); - return new FakeEchoBaseServiceContext("/fixcells.h2.db.gz"); - } - - Set<String> positionDatas = Sets.newHashSet("LatitudeStart", "LongitudeStart"); - - Set<String> timeStartData = Sets.newHashSet("TimeStart"); - - DateFormat dateInstance = new SimpleDateFormat("EEE MMM d HH:mm:ss 'CEST' yyyy"); - - DateFormat dateInstance2 = new SimpleDateFormat("EEE MMM d HH:mm:ss 'CET' yyyy"); - - DateFormat isoDateFormat = new SimpleDateFormat(EchoBaseCsvUtil.CELLULE_DATE_FORMAT); - - @Test - public void lissage() throws Exception { - -// importdb(ImportDbMode.FREE, "/fixcells.echobase"); - -// importMissingEsduCells(); - -// fixCellDatas(); - - exportDatabase(); - } - - protected void importMissingEsduCells() throws IOException, ImportException { - - VoyageAcousticsImportConfiguration conf = new VoyageAcousticsImportConfiguration(getLocale()); - prepareInputFile(conf.getMoviesFile(), "/missingEsduCells.csv.gz"); - conf.setCellPositionReference(CellPositionReference.START); - -// doImport(conf, -// 1998, -// 2000, -// 2001, -// 2002, -// 2003, -// 2004); - /* -Seens years 1998 :: 10017 -Seens years 2000 :: 12075 -Seens years 2001 :: 18000 -Seens years 2002 :: 15303 -Seens years 2003 :: 26595 - - */ - - doImport(conf, - 2005, - 2006, - 2007, - 2008, - 2009, - 2010); - - /* -2005 :: 14805 -2006 :: 12825 -2007 :: 16005 -2008 :: 20595 -2009 :: 24690 -2010 :: 15150 - - */ - - } - - protected void doImport(VoyageAcousticsImportConfiguration conf, int... years) throws ImportException { - - System.gc(); - - ImportDataService service = newService(ImportDataService.class); - - service.doImportVoyageAcoustics(conf, createFakeUser()); - - System.gc(); - } - - protected void fixCellDatas() throws TopiaException, ParseException { - - int nb = 0; - TopiaDao<Cell> cellDAO = serviceContext.getEchoBaseUserPersistenceContext().getCellDao(); - - UserDbPersistenceService persistenceService = serviceContext.newService(UserDbPersistenceService.class); - - long nbCells = cellDAO.count(); - for (Cell cell : cellDAO) { - - if (log.isDebugEnabled()) { - log.debug("treat cell " + cell.getName() + " - " + - cell.getCellType().getName()); - } - - if (!cell.isDataEmpty()) { - for (Data data : cell.getData()) { - String name = data.getDataMetadata().getName(); - if (timeStartData.contains(name)) { - fixDateFormat(cell, data); - } else if (positionDatas.contains(name)) { - fixDataPosition(data); - } - } - } - - if (++nb % 10000 == 0) { - if (log.isInfoEnabled()) { - log.info("Flush at " + nb + "/" + nbCells); - } - persistenceService.flush(); - } - } - - persistenceService.commit(); - } - - private void exportDatabase() throws TopiaException, IOException { - - TopiaDao<Voyage> voyageDAO = serviceContext.getEchoBaseUserPersistenceContext().getVoyageDao(); - - UserDbPersistenceService persistenceService = serviceContext.newService(UserDbPersistenceService.class); - long nbVoyages = persistenceService.countVoyage(); - - Voyage voyage; - if (nbVoyages == 0) { - - // crate voyage - - - voyage = voyageDAO.create(Voyage.PROPERTY_MISSION, serviceContext.getEchoBaseUserPersistenceContext().getMissionDao().findAll().get(0), - Voyage.PROPERTY_NAME, "name", - Voyage.PROPERTY_START_DATE, newDate(), - Voyage.PROPERTY_END_DATE, newDate(), - Voyage.PROPERTY_START_PORT, "ici", - Voyage.PROPERTY_END_PORT, "labas", - Voyage.PROPERTY_DESCRIPTION, "description", - Voyage.PROPERTY_DATUM, "datum" - ); - - persistenceService.commit(); - } else { - voyage = voyageDAO.findAll().get(0); - } - - persistenceService.commit(); - - exportDb(voyage, "fixCells"); - - } - - private void fixDateFormat(Cell cell, Data data) throws ParseException { - - String dataValue = data.getDataValue(); - Date oldDate; - try { - oldDate = dateInstance.parse(dataValue); - } catch (ParseException e) { - oldDate = dateInstance2.parse(dataValue); - } - - String newDate = isoDateFormat.format(oldDate); - - if (log.isInfoEnabled()) { - log.info("Treat date " + dataValue + " - to " + newDate); - } - data.setDataValue(newDate); - cell.setName(newDate); - } - - - private void fixDataPosition(Data data) { - - String dataValue = data.getDataValue(); - - double sign = dataValue.endsWith("W") ? -1 : 1; - - double x = Float.valueOf(dataValue.substring(0, dataValue.length() - 1)); - - double x1 = Math.floor(x / 100); - double x2 = Math.floor(x - x1 * 100) / 60; - double x3 = ((x - x1 * 100) - x2 * 60) / 100; - double newValue = sign * (x1 + x2 + x3); - - if (log.isInfoEnabled()) { - log.info("Treat data position " + x + " to " + newValue); - } - - data.setDataValue(String.valueOf(newValue)); - } - -} diff --git a/echobase-services/src/test/java/fr/ifremer/echobase/services/service/atlantos/ExportAtlantosServiceTest.java b/echobase-services/src/test/java/fr/ifremer/echobase/services/service/atlantos/ExportAtlantosServiceTest.java index 398be502..727aa8da 100644 --- a/echobase-services/src/test/java/fr/ifremer/echobase/services/service/atlantos/ExportAtlantosServiceTest.java +++ b/echobase-services/src/test/java/fr/ifremer/echobase/services/service/atlantos/ExportAtlantosServiceTest.java @@ -24,11 +24,14 @@ package fr.ifremer.echobase.services.service.atlantos; import fr.ifremer.echobase.services.EchoBaseTestServiceSupport; import fr.ifremer.echobase.services.FakeEchoBaseServiceContext; import fr.ifremer.echobase.services.ImportDataFixtures; +import fr.ifremer.echobase.services.service.atlantos.xml.VocabularyExport; +import org.junit.Assert; import org.junit.Test; import org.nuiton.util.FileUtil; import javax.inject.Inject; import java.io.File; +import java.util.Arrays; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -47,8 +50,7 @@ public class ExportAtlantosServiceTest extends EchoBaseTestServiceSupport { @Inject private ExportAtlantosService exportService; -// @Test -//fixture data not valid for CIEM export + @Test public void testXmlExport() throws Exception { File workingDirectory = new File(getTestDir(), "testAtlantos"); @@ -60,19 +62,41 @@ public class ExportAtlantosServiceTest extends EchoBaseTestServiceSupport { model.setWorkingDirectory(workingDirectory); exportService.doXmlExport(model); + + Assert.assertEquals(3, workingDirectory.list().length); + + boolean oneZipFile = Arrays.stream(workingDirectory.list()) + .anyMatch(filename -> new File(workingDirectory, filename).isFile() && + filename.endsWith(".zip") && filename.startsWith("ICES_")); + + Assert.assertTrue(oneZipFile); + + boolean bioticFile = Arrays.stream(workingDirectory.list()) + .anyMatch(filename -> new File(workingDirectory, filename).isFile() && + filename.endsWith(".xml") && filename.startsWith("Biotic_") && + !filename.endsWith("-voca.xml") && !filename.endsWith("-cruise.xml")); + + Assert.assertTrue(bioticFile); + + boolean acousticFile = Arrays.stream(workingDirectory.list()) + .anyMatch(filename -> new File(workingDirectory, filename).isFile() && + filename.endsWith(".xml") && filename.startsWith("Acoustic_") && + !filename.endsWith("-voca.xml") && !filename.endsWith("-cruise.xml")); + + Assert.assertTrue(acousticFile); } -// @Test + @Test public void testPattern() { - Pattern pattern = Pattern.compile("^(((AC_)|(ISO_)|(ICES_))?[^_]+)_(.+)"); + Pattern pattern = Pattern.compile(VocabularyExport.VOCABULARY_PATTERN); + Matcher matcher = pattern.matcher("Gear_PMT_57x52"); - matcher.find(); + Assert.assertTrue(matcher.find()); matcher = pattern.matcher("SHIPC_35HT"); - matcher.find(); + Assert.assertTrue(matcher.find()); matcher = pattern.matcher("AC_SaCategory_D1-1"); - matcher.find(); + Assert.assertTrue(matcher.find()); } - } diff --git a/echobase-services/src/test/java/fr/ifremer/echobase/services/service/importdb/ImportDbServiceTest.java b/echobase-services/src/test/java/fr/ifremer/echobase/services/service/importdb/ImportDbServiceTest.java index 88bd70c9..58540145 100644 --- a/echobase-services/src/test/java/fr/ifremer/echobase/services/service/importdb/ImportDbServiceTest.java +++ b/echobase-services/src/test/java/fr/ifremer/echobase/services/service/importdb/ImportDbServiceTest.java @@ -51,7 +51,7 @@ public class ImportDbServiceTest extends EchoBaseTestServiceSupport { return new FakeEchoBaseServiceContext(null); } -// @Test + @Test //Fix import data public void importDb() throws IOException, ImportException { diff --git a/echobase-services/src/test/resources/echobase-importDb-referentiel.zip b/echobase-services/src/test/resources/echobase-importDb-referentiel.zip index 5139a33a..8f188b7e 100644 Binary files a/echobase-services/src/test/resources/echobase-importDb-referentiel.zip and b/echobase-services/src/test/resources/echobase-importDb-referentiel.zip differ diff --git a/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseStaticContentLoader.java b/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseStaticContentLoader.java index 9d752d5b..7250a648 100644 --- a/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseStaticContentLoader.java +++ b/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseStaticContentLoader.java @@ -32,6 +32,7 @@ import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.nio.charset.Charset; import java.util.Calendar; @@ -113,7 +114,7 @@ public class EchoBaseStaticContentLoader extends DefaultStaticContentLoader { String path) throws IOException { if (path.contains(".js")) { - String content = IOUtils.toString(input); + String content = IOUtils.toString(input, Charset.defaultCharset()); if (content.indexOf("/") == 1) { // fix nasty first strange caracter for ckeditor (only on firefox :() content = content.substring(1); diff --git a/echobase-ui/src/main/webapp/WEB-INF/includes/footer.jsp b/echobase-ui/src/main/webapp/WEB-INF/includes/footer.jsp index 03774334..6e08c01a 100644 --- a/echobase-ui/src/main/webapp/WEB-INF/includes/footer.jsp +++ b/echobase-ui/src/main/webapp/WEB-INF/includes/footer.jsp @@ -32,8 +32,7 @@ © 2011-2017 </span> <a href="http://www.ifremer.fr">Ifremer</a> - <a href="http://www.codelutin.com" title="Code Lutin" target="_blank">Code - Lutin</a> + <a href="http://www.codelutin.com" title="Code Lutin" target="_blank" rel="noopener noreferrer">Code Lutin</a> </li> <li> <s:a href="http://www.gnu.org/licenses/agpl.html" target='license'> -- 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 80f2e5eb629d4bce6bd6dbda34d50a19520a6851 Author: jcouteau <couteau@codelutin.com> Date: Thu Jan 30 15:59:07 2020 +0100 Fix pg migrations --- .../resources/migration/workingDb/pg/3.914-1-importlog-importtext.sql | 2 +- .../src/main/resources/migration/workingDb/pg/3.915-1-echotypeId.sql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/echobase-domain/src/main/resources/migration/workingDb/pg/3.914-1-importlog-importtext.sql b/echobase-domain/src/main/resources/migration/workingDb/pg/3.914-1-importlog-importtext.sql index 97f6bf20..5a40f503 100644 --- a/echobase-domain/src/main/resources/migration/workingDb/pg/3.914-1-importlog-importtext.sql +++ b/echobase-domain/src/main/resources/migration/workingDb/pg/3.914-1-importlog-importtext.sql @@ -1 +1 @@ -alter table importlog alter column importtext VARCHAR(2147483647); \ No newline at end of file +alter table importlog alter column importtext TYPE TEXT; \ No newline at end of file diff --git a/echobase-domain/src/main/resources/migration/workingDb/pg/3.915-1-echotypeId.sql b/echobase-domain/src/main/resources/migration/workingDb/pg/3.915-1-echotypeId.sql index fd66cc28..78f3c37e 100644 --- a/echobase-domain/src/main/resources/migration/workingDb/pg/3.915-1-echotypeId.sql +++ b/echobase-domain/src/main/resources/migration/workingDb/pg/3.915-1-echotypeId.sql @@ -1 +1 @@ -alter table echotype alter column id VARCHAR(255); +alter table echotype alter column id TYPE VARCHAR(255); -- 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 1cddf9e1bcf1bce60cd09a879038e1cbaf5fefb8 Author: jcouteau <couteau@codelutin.com> Date: Thu Jan 30 15:59:46 2020 +0100 Fix dataAcquisition link during acoustic import --- .../service/importdata/actions/ImportAcousticsActionSupport.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/actions/ImportAcousticsActionSupport.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/actions/ImportAcousticsActionSupport.java index e272f4d5..70b6dc4d 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/actions/ImportAcousticsActionSupport.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/actions/ImportAcousticsActionSupport.java @@ -177,7 +177,7 @@ public abstract class ImportAcousticsActionSupport<M extends ImportAcousticsConf createdDataAcquisitions.add(dataAcquisition.getTopiaId()); // add dataAcquisition to mooring - dataProvider.getDataAcquisition(); + dataProvider.addDataAcquisition(dataAcquisition); if (log.isDebugEnabled()) { log.debug("[row " + rowNumber + "] New dataAquisition to use (number: " + result.getNumberCreated(EchoBaseUserEntityEnum.DataAcquisition) + ")"); -- 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 134e610ab7f9fc7be1922cb1bab9250eded1a97b Author: jcouteau <couteau@codelutin.com> Date: Thu Jan 30 16:01:36 2020 +0100 refs #10216 : Fix Atlantos acoustic export (still issue on echotype vocabulary) --- .../service/atlantos/xml/XmlAccousticExport.java | 32 ++++++++++++---------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/atlantos/xml/XmlAccousticExport.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/atlantos/xml/XmlAccousticExport.java index 8e2d64b0..ccb74c0e 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/atlantos/xml/XmlAccousticExport.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/atlantos/xml/XmlAccousticExport.java @@ -97,7 +97,10 @@ public class XmlAccousticExport implements EchoBaseService { for (DataProcessing dataProcessing : dataProcessings) { // EXPORT DATA PROCESSING - exportDataProcessing(dataProcessing, xmlHead); + exportDataProcessing(dataProcessing, + dataAcquisition.getTransceiverAcquisitionPower(), + dataAcquisition.getTransceiverAcquisitionPulseLength(), + xmlHead); // EXPORT CRUISE if (!exportCruiseDone) { @@ -262,7 +265,7 @@ public class XmlAccousticExport implements EchoBaseService { xml.close("DataAcquisition"); } - public void exportDataProcessing(DataProcessing dataProcessing, XmlWriter xml) throws IOException { + public void exportDataProcessing(DataProcessing dataProcessing, float transceiverPower, float transmitPulseLength, XmlWriter xml) throws IOException { xml.open("DataProcessing", "ID", XmlAccousticExport.getFormatedTopiaId(dataProcessing)); @@ -278,6 +281,8 @@ public class XmlAccousticExport implements EchoBaseService { dataProcessing.getBandwidth()); xml.create("Frequency", dataProcessing.getFrequency()); + xml.create("TransceiverPower", transceiverPower); + xml.create("TransmitPulseLength", transmitPulseLength); xml.create("OnAxisGain", dataProcessing.getTransceiverProcessingGain()); xml.create("OnAxisGainUnit", "IDREF", @@ -444,20 +449,17 @@ public class XmlAccousticExport implements EchoBaseService { } public void exportData(Voyage voyage, Result result, XmlWriter xml) throws IOException { - if (!result.getResultValue().equals("NA")) { - xml.open("Data"); - xml.create("EchoType", - "IDREF", result.getCategory().getEchotype().getName()); - vocabulary.addCategory(result.getCategory()); - xml.create("Type", - "IDREF", vocabulary.getVocabularyCode("AC_AcousticDataType_C")); - xml.create("Unit", - "IDREF", vocabulary.getVocabularyCode("AC_DataUnit_m2nmi-2")); + xml.open("Data"); + xml.create("EchoType", + "IDREF", result.getCategory().getEchotype().getName()); + vocabulary.addCategory(result.getCategory()); + xml.create("Type", + "IDREF", vocabulary.getVocabularyCode("AC_AcousticDataType_C")); + xml.create("Unit", + "IDREF", vocabulary.getVocabularyCode("AC_DataUnit_m2nmi-2")); - xml.create("Value", - result.getResultValue()); + xml.create("Value", result.getResultValue().equals("NA")?0:result.getResultValue()); - xml.close("Data"); - } + xml.close("Data"); } } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
participants (1)
-
codelutin.com scm