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 d3f35f41b01e58fada1eba9450459dab22accb0e Author: Jean Couteau <jean.couteau@gmail.com> Date: Thu Feb 8 14:09:54 2018 +0100 refs #9685 : - Add species check for biotic atlantos export icesExport muste be true to export data for this species - do not export data for NA values --- .../WorkingDbMigrationCallBackForVersion3_913.java | 26 ++++++++++++ .../workingDb/3.913-0-atlantos-species.sql | 2 + .../workingDb/h2/3.913-0-atlantos-species.sql | 2 + .../workingDb/pg/3.913-0-atlantos-species.sql | 2 + echobase-domain/src/main/xmi/echobase.properties | 2 +- echobase-domain/src/main/xmi/echobase.zargo | Bin 100351 -> 100538 bytes .../service/atlantos/xml/XmlAccousticExport.java | 27 ++++++------- .../service/atlantos/xml/XmlBioticExport.java | 45 ++++++++++++--------- 8 files changed, 72 insertions(+), 34 deletions(-) diff --git a/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/migration/workingDb/WorkingDbMigrationCallBackForVersion3_913.java b/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/migration/workingDb/WorkingDbMigrationCallBackForVersion3_913.java new file mode 100644 index 00000000..f1f15600 --- /dev/null +++ b/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/migration/workingDb/WorkingDbMigrationCallBackForVersion3_913.java @@ -0,0 +1,26 @@ +package fr.ifremer.echobase.persistence.migration.workingDb; + +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; + +public class WorkingDbMigrationCallBackForVersion3_913 extends WorkingDbMigrationCallBackForVersionSupport { + + @Override + public Version getVersion() { + return Versions.valueOf("3.913"); + } + + @Override + protected void prepareMigrationScript(TopiaSqlSupport sqlSupport, + List<String> queries, + boolean showSql, + boolean showProgression) throws TopiaException { + + addSpecificScript("3.913-0-atlantos-species.sql", queries); + } + +} \ No newline at end of file diff --git a/echobase-domain/src/main/resources/migration/workingDb/3.913-0-atlantos-species.sql b/echobase-domain/src/main/resources/migration/workingDb/3.913-0-atlantos-species.sql new file mode 100644 index 00000000..3661f6ae --- /dev/null +++ b/echobase-domain/src/main/resources/migration/workingDb/3.913-0-atlantos-species.sql @@ -0,0 +1,2 @@ + +alter table species add column icesExport boolean; \ No newline at end of file diff --git a/echobase-domain/src/main/resources/migration/workingDb/h2/3.913-0-atlantos-species.sql b/echobase-domain/src/main/resources/migration/workingDb/h2/3.913-0-atlantos-species.sql new file mode 100644 index 00000000..3661f6ae --- /dev/null +++ b/echobase-domain/src/main/resources/migration/workingDb/h2/3.913-0-atlantos-species.sql @@ -0,0 +1,2 @@ + +alter table species add column icesExport boolean; \ No newline at end of file diff --git a/echobase-domain/src/main/resources/migration/workingDb/pg/3.913-0-atlantos-species.sql b/echobase-domain/src/main/resources/migration/workingDb/pg/3.913-0-atlantos-species.sql new file mode 100644 index 00000000..3661f6ae --- /dev/null +++ b/echobase-domain/src/main/resources/migration/workingDb/pg/3.913-0-atlantos-species.sql @@ -0,0 +1,2 @@ + +alter table species add column icesExport boolean; \ No newline at end of file diff --git a/echobase-domain/src/main/xmi/echobase.properties b/echobase-domain/src/main/xmi/echobase.properties index 3dff6fdc..8b737e71 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.912 +model.tagValue.version=3.913 model.tagValue.generatePropertyChangeSupport=false model.tagValue.generateBooleanGetMethods=false model.tagValue.indexForeignKeys=true diff --git a/echobase-domain/src/main/xmi/echobase.zargo b/echobase-domain/src/main/xmi/echobase.zargo index ffaaeb1d..c9fa90dd 100644 Binary files a/echobase-domain/src/main/xmi/echobase.zargo and b/echobase-domain/src/main/xmi/echobase.zargo differ 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 bef99d5c..4d8c240b 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 @@ -455,23 +455,20 @@ public class XmlAccousticExport implements EchoBaseService { } public void exportData(Voyage voyage, Result result, XmlWriter xml) throws IOException { - xml.open("Data"); - - xml.create("SaCategory", - "IDREF", vocabulary.getVocabularyCode(voyage.getCode() + ":" + result.getCategory().getEchotype().getName(), "AC_SaCategory_D4")); - xml.create("Type", - "IDREF", vocabulary.getVocabularyCode("AC_AcousticDataType_C")); - xml.create("Unit", - "IDREF", vocabulary.getVocabularyCode("AC_DataUnit_m2nmi-2")); + if (!result.getResultValue().equals("NA")) { + xml.open("Data"); + + xml.create("SaCategory", + "IDREF", vocabulary.getVocabularyCode(voyage.getCode() + ":" + result.getCategory().getEchotype().getName(),"AC_SaCategory_D4")); + xml.create("Type", + "IDREF", vocabulary.getVocabularyCode("AC_AcousticDataType_C")); + xml.create("Unit", + "IDREF", vocabulary.getVocabularyCode("AC_DataUnit_m2nmi-2")); - if (result.getResultValue().equals("NA")){ - xml.create("Value", - "0"); - } else { xml.create("Value", - result.getResultValue()); - } + result.getResultValue()); - xml.close("Data"); + xml.close("Data"); + } } } 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 abf44ca5..cbc2c34d 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 @@ -140,25 +140,28 @@ public class XmlBioticExport implements EchoBaseService { for (Sample sample : subSamples) { SpeciesCategory category = sample.getSpeciesCategory(); - String code = category.getSpecies().getBaracoudaCode(); - String size = code + "#" + category.getSizeCategoryLabel(); - - Float weight = totalWeight.get(code); - Float weightBySize = totalWeightBySize.get(size); - Integer number = totalNumber.get(code); - - // EXPORT CATCH - exportCatch(sample, weightBySize, weight, number, xmlCruise); + //export only ICES allowed species + if (category.getSpecies().getIcesExport() != null && category.getSpecies().getIcesExport()) { + String code = category.getSpecies().getBaracoudaCode(); + String size = code + "#" + category.getSizeCategoryLabel(); - List<Sample> individualSamples = individuals.remove(code); - if (individualSamples != null) { - for (Sample individualSample : individualSamples) { - // EXPORT BIOLOGY - exportBiology(individualSample, xmlCruise); + Float weight = totalWeight.get(code); + Float weightBySize = totalWeightBySize.get(size); + Integer number = totalNumber.get(code); + + // EXPORT CATCH + exportCatch(sample, weightBySize, weight, number, xmlCruise); + + List<Sample> individualSamples = individuals.remove(code); + if (individualSamples != null) { + for (Sample individualSample : individualSamples) { + // EXPORT BIOLOGY + exportBiology(individualSample, xmlCruise); + } } - } - xmlCruise.close("Catch"); + xmlCruise.close("Catch"); + } } xmlCruise.close("Haul"); @@ -344,8 +347,14 @@ public class XmlBioticExport implements EchoBaseService { "IDREF", vocabulary.getVocabularyCode("SpecWoRMS_" + category.getSpecies().getWormsCode())); xml.create("SpeciesValidity", "IDREF", vocabulary.getVocabularyCode("AC_SpeciesValidity_1")); - xml.create("SpeciesCategory", - 1); + if (category.getSizeCategory().getName().equals("0")) { + xml.create("SpeciesCategory", + 1); + } + if (category.getSizeCategory().getName().equals("G")){ + xml.create("SpeciesCategory", + 2); + } xml.create("SpeciesCategoryNumber", number); xml.create("WeightUnit", -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.