branch develop updated (1083a949 -> 1dd70771)
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 1083a949 fixes #9778 : Les latitudes et longitudes des logs du fichier acoustic sont égales à zéro new 1dd70771 fixes #9685 : Les fichiers xml biotic et acoustic de thalassa PELGAS2015 ne s'importent plus dans le portail ICES 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 1dd70771b83ba5b56ec32c5e1f037f25eea0254b Author: Jean Couteau <jean.couteau@gmail.com> Date: Tue Mar 20 11:03:28 2018 +0100 fixes #9685 : Les fichiers xml biotic et acoustic de thalassa PELGAS2015 ne s'importent plus dans le portail ICES Summary of changes: .../service/atlantos/xml/XmlAccousticExport.java | 6 +- .../service/atlantos/xml/XmlBioticExport.java | 241 ++++++++++----------- 2 files changed, 122 insertions(+), 125 deletions(-) -- 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 1dd70771b83ba5b56ec32c5e1f037f25eea0254b Author: Jean Couteau <jean.couteau@gmail.com> Date: Tue Mar 20 11:03:28 2018 +0100 fixes #9685 : Les fichiers xml biotic et acoustic de thalassa PELGAS2015 ne s'importent plus dans le portail ICES --- .../service/atlantos/xml/XmlAccousticExport.java | 6 +- .../service/atlantos/xml/XmlBioticExport.java | 241 ++++++++++----------- 2 files changed, 122 insertions(+), 125 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 a6d63dbc..6eade348 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 @@ -324,9 +324,11 @@ public class XmlAccousticExport implements EchoBaseService { public void exportCruise(Voyage voyage, Vessel vessel, Transect transect, XmlWriter xml) throws IOException { xml.open("Cruise"); - - xml.create("Survey", + + xml.open("Survey"); + xml.create("Code", "IDREF", vocabulary.getVocabularyCode(voyage.getMission().getName(), "AC_Survey_PELGAS")); + xml.close("Survey"); xml.create("Country", "IDREF", vocabulary.getVocabularyCode(voyage.getMission().getCountry(), "ISO_3166_FR")); xml.create("Platform", 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 1b711e16..6450ce8e 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 @@ -73,15 +73,12 @@ public class XmlBioticExport implements EchoBaseService { //Export Haul only if it contains samples for (Sample sample : samples) { SpeciesCategory category = sample.getSpeciesCategory(); - //FIXME jcouteau : pour les tests. En prod, il faut que ça pète si null -> données non valides alors que export de données valides uniquement - //if (category != null) { - if (category.getSpecies().getIcesExport() != null && category.getSpecies().getIcesExport()) { - // EXPORT HAUL - exportHaul = true; - exportHaul(operation, index++, xmlCruise); - break; - } - //} + if (category.getSpecies().getIcesExport() != null && category.getSpecies().getIcesExport()) { + // EXPORT HAUL + exportHaul = true; + exportHaul(operation, index++, xmlCruise); + break; + } } //Map with all the totals with no subsamples - key : code#cat @@ -112,124 +109,120 @@ public class XmlBioticExport implements EchoBaseService { SpeciesCategory category = sample.getSpeciesCategory(); - //FIXME jcouteau : pour les tests. En prod, il faut que ça pète si null -> données non valides alors que export de données valides uniquement - //if (category != null) { + if (category.getSpecies().getIcesExport() != null && category.getSpecies().getIcesExport()) { + + //Compute code#cat key + Species species = category.getSpecies(); + String code = species.getBaracoudaCode(); + String categoryName = ""; + if (category.getSizeCategory() != null) { + categoryName = category.getSizeCategory().getName(); + } + 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); + } + + //Add sample weight to speciesCategoryWeight + Float weight = speciesCategoryWeights.get(codeCatKey); + if (weight == null) { + weight = 0f; + } - if (category.getSpecies().getIcesExport() != null && category.getSpecies().getIcesExport()) { + Float sampleWeight = sample.getSampleWeight(); + if (sampleWeight != null) { + weight += sampleWeight; + } + speciesCategoryWeights.put(codeCatKey, weight); - //Compute code#cat key - Species species = category.getSpecies(); - String code = species.getBaracoudaCode(); - String categoryName = ""; - if (category.getSizeCategory() != null) { - categoryName = category.getSizeCategory().getName(); + //Add sample number to speciesCategoryNumber + Integer number = speciesCategoryNumbers.get(codeCatKey); + if (number == null) { + number = 0; } - 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); - } - - //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; - } - 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); - } - - } else if ("Individual".equals(name)) { - - //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(".")); - - 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); + 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; + } + 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); + } + + } else if ("Individual".equals(name)) { + + //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(".")); + + 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); + } - //} + } } //Export totals @@ -315,9 +308,11 @@ public class XmlBioticExport implements EchoBaseService { public void exportCruise(Voyage voyage, Vessel vessel, XmlWriter xml) throws IOException { xml.open("Cruise"); - - xml.create("Survey", + + xml.open("Survey"); + xml.create("Code", "IDREF", vocabulary.getVocabularyCode(voyage.getMission().getName(), "AC_Survey_PELGAS")); + xml.close("Survey"); xml.create("Country", "IDREF", vocabulary.getVocabularyCode(voyage.getMission().getCountry(), "ISO_3166_FR")); xml.create("Platform", -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
participants (1)
-
codelutin.com scm