branch develop updated (a3822b1 -> 44d2f2e)
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 a3822b1 #8744 DataQuality wasn't copy in export row new 44d2f2e #8743 Add export biology 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 44d2f2ee99abb83ebaec5af88cb41a65c1d44004 Author: Julien Ruchaud <julien.ruchaud@debux.org> Date: Mon Nov 7 17:25:30 2016 +0100 #8743 Add export biology Summary of changes: .../workingDb/h2/3.912-0-atlantos-operation.sql | 13 ++++ .../workingDb/pg/3.912-0-atlantos-operation.sql | 13 ++++ .../service/atlantos/ExportAtlantosService.java | 2 +- .../service/atlantos/xml/VocabularyExport.java | 30 +++++++-- .../service/atlantos/xml/XmlAccousticExport.java | 4 +- .../service/atlantos/xml/XmlBioticExport.java | 73 ++++++++++++++++------ 6 files changed, 106 insertions(+), 29 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 44d2f2ee99abb83ebaec5af88cb41a65c1d44004 Author: Julien Ruchaud <julien.ruchaud@debux.org> Date: Mon Nov 7 17:25:30 2016 +0100 #8743 Add export biology --- .../workingDb/h2/3.912-0-atlantos-operation.sql | 13 ++++ .../workingDb/pg/3.912-0-atlantos-operation.sql | 13 ++++ .../service/atlantos/ExportAtlantosService.java | 2 +- .../service/atlantos/xml/VocabularyExport.java | 30 +++++++-- .../service/atlantos/xml/XmlAccousticExport.java | 4 +- .../service/atlantos/xml/XmlBioticExport.java | 73 ++++++++++++++++------ 6 files changed, 106 insertions(+), 29 deletions(-) diff --git a/echobase-domain/src/main/resources/migration/workingDb/h2/3.912-0-atlantos-operation.sql b/echobase-domain/src/main/resources/migration/workingDb/h2/3.912-0-atlantos-operation.sql index ed51bc5..e7e6a81 100644 --- a/echobase-domain/src/main/resources/migration/workingDb/h2/3.912-0-atlantos-operation.sql +++ b/echobase-domain/src/main/resources/migration/workingDb/h2/3.912-0-atlantos-operation.sql @@ -29,3 +29,16 @@ update operation SET gearHaulingEndLongitude = gearShootingEndLongitude; alter table operation drop column gearShootingEndLatitude; alter table operation drop column gearShootingEndLongitude; + +insert into vocabularyciem (topiaId, topiaVersion, topiaCreateDate, label, code) values ('fr.ifremer.echobase.entities.references.VocabularyCIEM#5553610280597#0.93226150280', 0, '2016-04-29 00:00:00.000', 'Method_ER60', 'AC_ProcessingMethod_ER60'); +insert into vocabularyciem (topiaId, topiaVersion, topiaCreateDate, label, code) values ('fr.ifremer.echobase.entities.references.VocabularyCIEM#5553610280597#0.93226150281', 0, '2016-04-29 00:00:00.000', 'Software_ER60', 'AC_DataAcquisitionSoftwareName_ER60'); +insert into vocabularyciem (topiaId, topiaVersion, topiaCreateDate, label, code) values ('fr.ifremer.echobase.entities.references.VocabularyCIEM#5553610280597#0.93226150282', 0, '2016-04-29 00:00:00.000', 'Sex_1', 'AC_Sex_F'); +insert into vocabularyciem (topiaId, topiaVersion, topiaCreateDate, label, code) values ('fr.ifremer.echobase.entities.references.VocabularyCIEM#5553610280597#0.93226150283', 0, '2016-04-29 00:00:00.000', 'Sex_2', 'AC_Sex_M'); +insert into vocabularyciem (topiaId, topiaVersion, topiaCreateDate, label, code) values ('fr.ifremer.echobase.entities.references.VocabularyCIEM#5553610280597#0.93226150284', 0, '2016-04-29 00:00:00.000', 'Sex_3', 'AC_Sex_NA'); +insert into vocabularyciem (topiaId, topiaVersion, topiaCreateDate, label, code) values ('fr.ifremer.echobase.entities.references.VocabularyCIEM#5553610280597#0.93226150285', 0, '2016-04-29 00:00:00.000', 'Sex_4', 'AC_Sex_U'); +insert into vocabularyciem (topiaId, topiaVersion, topiaCreateDate, label, code) values ('fr.ifremer.echobase.entities.references.VocabularyCIEM#5553610280597#0.93226150286', 0, '2016-04-29 00:00:00.000', 'Maturity_1', 'AC_MaturityCode_61'); +insert into vocabularyciem (topiaId, topiaVersion, topiaCreateDate, label, code) values ('fr.ifremer.echobase.entities.references.VocabularyCIEM#5553610280597#0.93226150287', 0, '2016-04-29 00:00:00.000', 'Maturity_2', 'AC_MaturityCode_62'); +insert into vocabularyciem (topiaId, topiaVersion, topiaCreateDate, label, code) values ('fr.ifremer.echobase.entities.references.VocabularyCIEM#5553610280597#0.93226150288', 0, '2016-04-29 00:00:00.000', 'Maturity_3', 'AC_MaturityCode_62'); +insert into vocabularyciem (topiaId, topiaVersion, topiaCreateDate, label, code) values ('fr.ifremer.echobase.entities.references.VocabularyCIEM#5553610280597#0.93226150289', 0, '2016-04-29 00:00:00.000', 'Maturity_4', 'AC_MaturityCode_63'); +insert into vocabularyciem (topiaId, topiaVersion, topiaCreateDate, label, code) values ('fr.ifremer.echobase.entities.references.VocabularyCIEM#5553610280597#0.93226150290', 0, '2016-04-29 00:00:00.000', 'Maturity_5', 'AC_MaturityCode_64'); +insert into vocabularyciem (topiaId, topiaVersion, topiaCreateDate, label, code) values ('fr.ifremer.echobase.entities.references.VocabularyCIEM#5553610280597#0.93226150291', 0, '2016-04-29 00:00:00.000', 'Maturity_6', 'AC_MaturityCode_65'); diff --git a/echobase-domain/src/main/resources/migration/workingDb/pg/3.912-0-atlantos-operation.sql b/echobase-domain/src/main/resources/migration/workingDb/pg/3.912-0-atlantos-operation.sql index 1735ec2..e21a147 100644 --- a/echobase-domain/src/main/resources/migration/workingDb/pg/3.912-0-atlantos-operation.sql +++ b/echobase-domain/src/main/resources/migration/workingDb/pg/3.912-0-atlantos-operation.sql @@ -29,3 +29,16 @@ update operation SET gearHaulingEndLongitude = gearShootingEndLongitude; alter table operation drop column gearShootingEndLatitude; alter table operation drop column gearShootingEndLongitude; + +insert into vocabularyciem (topiaId, topiaVersion, topiaCreateDate, label, code) values ('fr.ifremer.echobase.entities.references.VocabularyCIEM#5553610280597#0.93226150280', 0, '2016-04-29 00:00:00.000', 'Method_ER60', 'AC_ProcessingMethod_ER60'); +insert into vocabularyciem (topiaId, topiaVersion, topiaCreateDate, label, code) values ('fr.ifremer.echobase.entities.references.VocabularyCIEM#5553610280597#0.93226150281', 0, '2016-04-29 00:00:00.000', 'Software_ER60', 'AC_DataAcquisitionSoftwareName_ER60'); +insert into vocabularyciem (topiaId, topiaVersion, topiaCreateDate, label, code) values ('fr.ifremer.echobase.entities.references.VocabularyCIEM#5553610280597#0.93226150282', 0, '2016-04-29 00:00:00.000', 'Sex_1', 'AC_Sex_F'); +insert into vocabularyciem (topiaId, topiaVersion, topiaCreateDate, label, code) values ('fr.ifremer.echobase.entities.references.VocabularyCIEM#5553610280597#0.93226150283', 0, '2016-04-29 00:00:00.000', 'Sex_2', 'AC_Sex_M'); +insert into vocabularyciem (topiaId, topiaVersion, topiaCreateDate, label, code) values ('fr.ifremer.echobase.entities.references.VocabularyCIEM#5553610280597#0.93226150284', 0, '2016-04-29 00:00:00.000', 'Sex_3', 'AC_Sex_NA'); +insert into vocabularyciem (topiaId, topiaVersion, topiaCreateDate, label, code) values ('fr.ifremer.echobase.entities.references.VocabularyCIEM#5553610280597#0.93226150285', 0, '2016-04-29 00:00:00.000', 'Sex_4', 'AC_Sex_U'); +insert into vocabularyciem (topiaId, topiaVersion, topiaCreateDate, label, code) values ('fr.ifremer.echobase.entities.references.VocabularyCIEM#5553610280597#0.93226150286', 0, '2016-04-29 00:00:00.000', 'Maturity_1', 'AC_MaturityCode_61'); +insert into vocabularyciem (topiaId, topiaVersion, topiaCreateDate, label, code) values ('fr.ifremer.echobase.entities.references.VocabularyCIEM#5553610280597#0.93226150287', 0, '2016-04-29 00:00:00.000', 'Maturity_2', 'AC_MaturityCode_62'); +insert into vocabularyciem (topiaId, topiaVersion, topiaCreateDate, label, code) values ('fr.ifremer.echobase.entities.references.VocabularyCIEM#5553610280597#0.93226150288', 0, '2016-04-29 00:00:00.000', 'Maturity_3', 'AC_MaturityCode_62'); +insert into vocabularyciem (topiaId, topiaVersion, topiaCreateDate, label, code) values ('fr.ifremer.echobase.entities.references.VocabularyCIEM#5553610280597#0.93226150289', 0, '2016-04-29 00:00:00.000', 'Maturity_4', 'AC_MaturityCode_63'); +insert into vocabularyciem (topiaId, topiaVersion, topiaCreateDate, label, code) values ('fr.ifremer.echobase.entities.references.VocabularyCIEM#5553610280597#0.93226150290', 0, '2016-04-29 00:00:00.000', 'Maturity_5', 'AC_MaturityCode_64'); +insert into vocabularyciem (topiaId, topiaVersion, topiaCreateDate, label, code) values ('fr.ifremer.echobase.entities.references.VocabularyCIEM#5553610280597#0.93226150291', 0, '2016-04-29 00:00:00.000', 'Maturity_6', 'AC_MaturityCode_65'); 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 672ecad..5788627 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 @@ -148,7 +148,7 @@ public class ExportAtlantosService extends EchoBaseServiceSupport { File zipFile = zipPath.toFile(); EchoBaseIOUtil.compressZipFile(zipFile, tempDirectory, false); - zipFile.deleteOnExit(); +// zipFile.deleteOnExit(); model.setExportFile(zipFile); model.incrementsProgress(); 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 59b115e..5396120 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 @@ -130,14 +130,32 @@ public class VocabularyExport implements EchoBaseService { String tag = this.vocabularyTags.remove(prefix); if (tag != null) { - this.writer.open(tag); + // Only AC_WeightUnit contains two values + if (tag.equals("AC_WeightUnit")) { + this.writer.open(tag); + + this.writer.create("Code", + "ID", "AC_WeightUnit_kg", + "CodeType", "http://acoustic.ices.dk/Services/Schema/XML/" + prefix + ".xml", + "kg"); + this.writer.create("Code", + "ID", "AC_WeightUnit_gr", + "CodeType", "http://acoustic.ices.dk/Services/Schema/XML/" + prefix + ".xml", + "gr"); + + this.writer.close(tag); + + } else { + + this.writer.open(tag); - this.writer.create("Code", - "ID", code, - "CodeType", "http://acoustic.ices.dk/Services/Schema/XML/" + prefix + ".xml", - value); + this.writer.create("Code", + "ID", code, + "CodeType", "http://acoustic.ices.dk/Services/Schema/XML/" + prefix + ".xml", + value); - this.writer.close(tag); + this.writer.close(tag); + } } } 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 8b982b1..1d73ab6 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 @@ -205,7 +205,7 @@ public class XmlAccousticExport implements EchoBaseService { xml.create("AcquisitionMethod", "IDREF", vocabulary.getVocabularyCode(calibration.getAquisitionMethod(), "AC_AcquisitionMethod_SS")); xml.create("ProcessingMethod", - "IDREF", vocabulary.getVocabularyCode(calibration.getProcessingMethod(), "AC_ProcessingMethod_pmethod1")); + "IDREF", vocabulary.getVocabularyCode("Method_" + calibration.getProcessingMethod(), "AC_ProcessingMethod_ER60")); xml.create("AccuracyEstimate", calibration.getAccuracyEstimate()); xml.create("Report", @@ -221,7 +221,7 @@ public class XmlAccousticExport implements EchoBaseService { "ID", dataAcquisition.getTopiaId()); xml.create("SoftwareName", - "IDREF", vocabulary.getVocabularyCode(dataAcquisition.getSoftwareName(), "AC_DataAcquisitionSoftwareName_test1")); + "IDREF", vocabulary.getVocabularyCode("Software_" + dataAcquisition.getSoftwareName(), "AC_DataAcquisitionSoftwareName_ER60")); xml.create("SoftwareVersion", dataAcquisition.getAcquisitionSoftwareVersion()); xml.create("StoredDataFormat", 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 74e96d5..f7f3dd6 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 @@ -17,6 +17,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; +import java.util.List; import java.util.Map; import javax.inject.Inject; @@ -72,6 +73,7 @@ public class XmlBioticExport implements EchoBaseService { Map<String, Float> totalWeight = new HashMap<String, Float>(); Map<String, Float> totalWeightBySize = new HashMap<String, Float>(); Map<String, Integer> totalNumber = new HashMap<String, Integer>(); + Map<String, List<Sample>> individuals = new HashMap<String, List<Sample>>(); Collection<Sample> subSamples = new ArrayList<Sample>(); Collection<Sample> samples = operation.getSample(); @@ -122,6 +124,20 @@ public class XmlBioticExport implements EchoBaseService { if ("Subsample".equals(name)) { subSamples.add(sample); } + + if ("Individual".equals(name)) { + SpeciesCategory category = sample.getSpeciesCategory(); + String code = category.getSpecies().getBaracoudaCode(); + String size = code + "#" + category.getSizeCategoryLabel(); + + List<Sample> individualSamples = individuals.get(size); + if (individualSamples == null) { + individualSamples = new ArrayList<Sample>(); + individuals.put(size, individualSamples); + } + + individualSamples.add(sample); + } } for (Sample sample : subSamples) { @@ -136,7 +152,13 @@ public class XmlBioticExport implements EchoBaseService { // EXPORT CATCH exportCatch(sample, weightBySize, weight, number, xmlCruise); - // EXPORT BIOLOGY: nothing we don't have the data for the moment + List<Sample> individualSamples = individuals.get(size); + if (individualSamples != null) { + for (Sample individualSample : individualSamples) { + // EXPORT BIOLOGY + exportBiology(individualSample, xmlCruise); + } + } xmlCruise.close("Catch"); } @@ -351,37 +373,48 @@ public class XmlBioticExport implements EchoBaseService { sampleDataValues.get(SampleDataTypeImpl.WEIGHT_AT_LENGTHKG)); } - public void exportBiology(SampleData data, XmlWriter xml) throws IOException { + public void exportBiology(Sample individualSample, XmlWriter xml) throws IOException { xml.open("Biology"); - xml.create("StockCode", - "IDREF", ""); - xml.create("FishID"); + Map<String, Float> dataValues = new HashMap<String, Float>(); + Collection<SampleData> datas = individualSample.getSampleData(); + for (SampleData data : datas) { + String name = data.getSampleDataType().getName(); + Float value = data.getDataValue(); + dataValues.put(name, value); + } + +// xml.create("StockCode", +// "IDREF", ""); + xml.create("FishID", + dataValues.get(SampleDataTypeImpl.SPECIMEN_INDEX)); xml.create("LengthCode", - "IDREF", ""); - xml.create("IndividualLength"); + "IDREF", vocabulary.getVocabularyCode("AC_LengthCode_mm")); + xml.create("IndividualLength", + dataValues.get("Lcm") != null ? dataValues.get("Lcm") * 10 : ""); xml.create("WeightUnit", - "IDREF", ""); - xml.create("IndividualWeight"); + "IDREF", vocabulary.getVocabularyCode("AC_WeightUnit_gr")); + xml.create("IndividualWeight", + dataValues.get("Weightg") != null ? dataValues.get("Weightg") : ""); xml.create("IndividualSex", - "IDREF", ""); + "IDREF", dataValues.get("Sex") != null ? vocabulary.getVocabularyCode("Sex_" + dataValues.get("Sex"), "AC_Sex_U") : vocabulary.getVocabularyCode("AC_Sex_U")); xml.create("IndividualMaturity", - "IDREF", ""); + "IDREF", dataValues.get("Maturity") != null ? vocabulary.getVocabularyCode("Maturity_" + dataValues.get("Maturity"), "AC_MaturityCode_62") : vocabulary.getVocabularyCode("AC_MaturityCode_62")); xml.create("MaturityScale", - "IDREF", ""); + "IDREF", vocabulary.getVocabularyCode("AC_MaturityScale_M6")); xml.create("IndividualAge", - "IDREF", ""); - xml.create("AgePlusGroup", - "IDREF", ""); + dataValues.get("Age") != null ? dataValues.get("Age") : ""); +// xml.create("AgePlusGroup", +// "IDREF", ""); xml.create("AgeSource", - "IDREF", ""); + "IDREF", vocabulary.getVocabularyCode("AC_AgeSource_Otolith")); xml.create("GeneticSamplingFlag", - "IDREF", ""); + "IDREF", vocabulary.getVocabularyCode("AC_SamplingFlag_no")); xml.create("StomachSamplingFlag", - "IDREF", ""); + "IDREF", vocabulary.getVocabularyCode("AC_SamplingFlag_no")); xml.create("ParasiteSamplingFlag", - "IDREF", ""); - xml.create("IndividualVertebraeCount"); + "IDREF", vocabulary.getVocabularyCode("AC_SamplingFlag_no")); +// xml.create("IndividualVertebraeCount"); xml.close("Biology"); } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
participants (1)
-
codelutin.com scm