branch develop updated (de50ff6 -> 8dfd865)
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 de50ff6 From scmwebeditor -- df new 8dfd865 #8870 Get only accoustic data for the current vessel 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 8dfd865d69316718f4e6c4446892c10a27094a5c Author: Julien Ruchaud <julien.ruchaud@debux.org> Date: Wed Dec 14 09:51:22 2016 +0100 #8870 Get only accoustic data for the current vessel Summary of changes: .../service/atlantos/ExportAtlantosService.java | 2 +- .../service/atlantos/xml/XmlAccousticExport.java | 164 +++++++++++---------- 2 files changed, 84 insertions(+), 82 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 8dfd865d69316718f4e6c4446892c10a27094a5c Author: Julien Ruchaud <julien.ruchaud@debux.org> Date: Wed Dec 14 09:51:22 2016 +0100 #8870 Get only accoustic data for the current vessel --- .../service/atlantos/ExportAtlantosService.java | 2 +- .../service/atlantos/xml/XmlAccousticExport.java | 164 +++++++++++---------- 2 files changed, 84 insertions(+), 82 deletions(-) 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 089cfb1..11224c2 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 @@ -97,7 +97,7 @@ public class ExportAtlantosService extends EchoBaseServiceSupport { FileWriter fileAccousticCruise = new FileWriter(outputAccousticCruise.toFile()); XmlWriter xmlAccousticCruise = new XmlWriter(fileAccousticCruise); - xmlAccousticExport.doExport(voyage, xmlAccousticHead, xmlAccousticVoca, xmlAccousticCruise); + xmlAccousticExport.doExport(voyage, vessel, xmlAccousticHead, xmlAccousticVoca, xmlAccousticCruise); fileAccousticHead.close(); fileAccousticVoca.close(); fileAccousticCruise.close(); 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 1b717b1..93ca5b7 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 @@ -13,6 +13,7 @@ import fr.ifremer.echobase.entities.data.Transit; import fr.ifremer.echobase.entities.data.Voyage; import fr.ifremer.echobase.entities.references.AcousticInstrument; import fr.ifremer.echobase.entities.references.Calibration; +import fr.ifremer.echobase.entities.references.Vessel; import fr.ifremer.echobase.services.EchoBaseService; import fr.ifremer.echobase.services.csv.EchoBaseCsvUtil; import java.io.IOException; @@ -60,7 +61,7 @@ public class XmlAccousticExport implements EchoBaseService { return entity.getTopiaId().replaceAll("#", "_"); } - public void doExport(Voyage voyage, XmlWriter xmlHead, XmlWriter xmlVoca, XmlWriter xmlCruise) throws IOException { + public void doExport(Voyage voyage, Vessel vessel, XmlWriter xmlHead, XmlWriter xmlVoca, XmlWriter xmlCruise) throws IOException { boolean exportCruiseDone = false; vocabulary.init(xmlVoca); @@ -75,91 +76,92 @@ public class XmlAccousticExport implements EchoBaseService { Collection<Transect> transects = transit.getTransect(); for (Transect transect : transects) { - - Collection<DataAcquisition> dataAcquisitions = transect.getDataAcquisition(); - for (DataAcquisition dataAcquisition : dataAcquisitions) { + if (vessel.equals(transect.getVessel())) { - // EXPORT INSTRUMENT - AcousticInstrument acousticInstrument = dataAcquisition.getAcousticInstrument(); - this.exportInstrument(acousticInstrument, xmlHead); - - // EXPORT CALIBRATION - Collection<Calibration> calibrations = acousticInstrument.getCalibration(); - for (Calibration calibration : calibrations) { - this.exportCalibration(calibration, xmlHead); - } - - // EXPORT DATA ACQUISITION - exportDataAcquisition(dataAcquisition, xmlHead); - - Collection<DataProcessing> dataProcessings = dataAcquisition.getDataProcessing(); - for (DataProcessing dataProcessing : dataProcessings) { - - // EXPORT DATA PROCESSING - exportDataProcessing(dataProcessing, xmlHead); - - // EXPORT CRUISE - if (!exportCruiseDone) { - exportCruise(voyage, transect, xmlCruise); - exportCruiseDone = true; + Collection<DataAcquisition> dataAcquisitions = transect.getDataAcquisition(); + for (DataAcquisition dataAcquisition : dataAcquisitions) { + + // EXPORT INSTRUMENT + AcousticInstrument acousticInstrument = dataAcquisition.getAcousticInstrument(); + this.exportInstrument(acousticInstrument, xmlHead); + + // EXPORT CALIBRATION + Collection<Calibration> calibrations = acousticInstrument.getCalibration(); + for (Calibration calibration : calibrations) { + this.exportCalibration(calibration, xmlHead); } - - Collection<Cell> cells = dataProcessing.getCell(); - List<Cell> orderingCells = new ArrayList<Cell>(cells); - orderingCells.removeIf(new Predicate<Cell>() { - @Override - public boolean test(Cell cell) { - return !cell.getCellType().getId().equals("Esdu"); - } - }); - - orderingCells.sort(new Comparator<Cell>() { - @Override - public int compare(Cell o1, Cell o2) { - return o1.getName().compareTo(o2.getName()); + + // EXPORT DATA ACQUISITION + exportDataAcquisition(dataAcquisition, xmlHead); + + Collection<DataProcessing> dataProcessings = dataAcquisition.getDataProcessing(); + for (DataProcessing dataProcessing : dataProcessings) { + + // EXPORT DATA PROCESSING + exportDataProcessing(dataProcessing, xmlHead); + + // EXPORT CRUISE + if (!exportCruiseDone) { + exportCruise(voyage, vessel, transect, xmlCruise); + exportCruiseDone = true; } - }); - int position = 0; - for (Cell cell : orderingCells) { - - // EXPORT LOG - exportLog(cell, position++, xmlCruise); + Collection<Cell> cells = dataProcessing.getCell(); + List<Cell> orderingCells = new ArrayList<Cell>(cells); + orderingCells.removeIf(new Predicate<Cell>() { + @Override + public boolean test(Cell cell) { + return !cell.getCellType().getId().equals("Esdu"); + } + }); + + orderingCells.sort(new Comparator<Cell>() { + @Override + public int compare(Cell o1, Cell o2) { + return o1.getName().compareTo(o2.getName()); + } + }); + + int position = 0; + for (Cell cell : orderingCells) { + + // EXPORT LOG + exportLog(cell, position++, xmlCruise); - List<Result> resultsWithoutD4 = new ArrayList<Result>(); - Result resultForD4 = null; - - Collection<Result> results = cell.getResult(); - for (Result result : results) { - if ("NASC".equals(result.getDataMetadata().getName())) { - - if (result.getCategory().getEchotype().getName().equals("D4")) { - resultForD4 = result; - } else { - resultsWithoutD4.add(result); + List<Result> resultsWithoutD4 = new ArrayList<Result>(); + Result resultForD4 = null; + + Collection<Result> results = cell.getResult(); + for (Result result : results) { + if ("NASC".equals(result.getDataMetadata().getName())) { + + if (result.getCategory().getEchotype().getName().equals("D4")) { + resultForD4 = result; + } else { + resultsWithoutD4.add(result); + } } } - } - - // EXPORT SAMPLE - if (resultForD4 != null && exportSample(voyage, cell, resultForD4, xmlCruise)) { - // EXPORT DATA - exportData(resultForD4, xmlCruise); - xmlCruise.close("Sample"); - } - - if (!resultsWithoutD4.isEmpty()) { - // EXPORT SAMPLE - exportSample(voyage, cell, null, xmlCruise); - for (Result result : resultsWithoutD4) { + // EXPORT SAMPLE + if (resultForD4 != null && exportSample(voyage, cell, resultForD4, xmlCruise)) { // EXPORT DATA - exportData(result, xmlCruise); + exportData(resultForD4, xmlCruise); + xmlCruise.close("Sample"); } - - xmlCruise.close("Sample"); - } - + + if (!resultsWithoutD4.isEmpty()) { + // EXPORT SAMPLE + exportSample(voyage, cell, null, xmlCruise); + + for (Result result : resultsWithoutD4) { + // EXPORT DATA + exportData(result, xmlCruise); + } + + xmlCruise.close("Sample"); + } + // // EXPORT SAMPLE // exportSample(voyage, cell, null, xmlCruise); // @@ -171,10 +173,10 @@ public class XmlAccousticExport implements EchoBaseService { // } // } // xmlCruise.close("Sample"); - - xmlCruise.close("Log"); + xmlCruise.close("Log"); + } } - } + } } } } @@ -313,7 +315,7 @@ public class XmlAccousticExport implements EchoBaseService { xml.close("DataProcessing"); } - public void exportCruise(Voyage voyage, Transect transect, XmlWriter xml) throws IOException { + public void exportCruise(Voyage voyage, Vessel vessel, Transect transect, XmlWriter xml) throws IOException { xml.open("Cruise"); xml.create("Survey", @@ -321,7 +323,7 @@ public class XmlAccousticExport implements EchoBaseService { xml.create("Country", "IDREF", vocabulary.getVocabularyCode(voyage.getMission().getCountry(), "ISO_3166_FR")); xml.create("Platform", - "IDREF", vocabulary.getVocabularyCode(transect.getVessel().getCode(), "SHIPC_35HT")); + "IDREF", vocabulary.getVocabularyCode(vessel.getCode(), "SHIPC_35HT")); xml.create("StartDate", EchoBaseCsvUtil.ISO8611_DATE_FORMATTER.format(voyage.getStartDate())); xml.create("EndDate", -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
participants (1)
-
codelutin.com scm