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 9963a9e2760f1732965889164bb256a15f96994b Author: Julien Ruchaud <julien.ruchaud@debux.org> Date: Thu Nov 24 12:35:04 2016 +0100 Separate D4 --- .../service/atlantos/xml/XmlAccousticExport.java | 115 +++++++++++---------- 1 file changed, 60 insertions(+), 55 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 56687be..2d5236d 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 @@ -126,53 +126,51 @@ public class XmlAccousticExport implements EchoBaseService { // 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); -// } -// } -// } -// -// if (resultForD4 != null) { -// // EXPORT SAMPLE -// 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 DATA -// exportData(result, xmlCruise); -// } -// -// xmlCruise.close("Sample"); -// } + List<Result> resultsWithoutD4 = new ArrayList<Result>(); + Result resultForD4 = null; - // EXPORT SAMPLE - exportSample(voyage, cell, null, xmlCruise); - 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 DATA - exportData(result, xmlCruise); + exportData(result, xmlCruise); } + + xmlCruise.close("Sample"); } - xmlCruise.close("Sample"); + +// // EXPORT SAMPLE +// exportSample(voyage, cell, null, xmlCruise); +// +// Collection<Result> results = cell.getResult(); +// for (Result result : results) { +// if ("NASC".equals(result.getDataMetadata().getName())) { +// // EXPORT DATA +// exportData(result, xmlCruise); +// } +// } +// xmlCruise.close("Sample"); xmlCruise.close("Log"); } @@ -365,8 +363,7 @@ public class XmlAccousticExport implements EchoBaseService { "IDREF", vocabulary.getVocabularyCode("AC_LogOrigin_" + prefix)); } - public void exportSample(Voyage voyage, Cell cell, Result result, XmlWriter xml) throws IOException { - xml.open("Sample"); + public boolean exportSample(Voyage voyage, Cell cell, Result result, XmlWriter xml) throws IOException { // Utiliser la date de début du voyage Collection<Calibration> calibrations = cell.getDataProcessing().getDataAcquisition().getAcousticInstrument().getCalibration(); @@ -393,26 +390,32 @@ public class XmlAccousticExport implements EchoBaseService { prefix = "end"; } -// Float upperDepth = 10f; -// Float lowerDepth = 30f; -// -// if (result == null) { -// Data depthData = dataValues.get("ESDUstartDepth"); -// lowerDepth = depthData != null ? Float.parseFloat(depthData.getDataValue()) : 0f; -// -// if (lowerDepth >= 50) { -// upperDepth = 30f; -// } -// } - Float upperDepth = 10f; + Float lowerDepth = 30f; + Data depthData = dataValues.get("ESDUstartDepth"); - Float lowerDepth = depthData != null ? Float.parseFloat(depthData.getDataValue()) : 0f; + Float depth = depthData != null ? Float.parseFloat(depthData.getDataValue()) : 0f; + + if (result == null) { + lowerDepth = depth; + + if (depth >= 50) { + upperDepth = 30f; + } + } else if (depth <= 50) { + return false; + } + +// Float upperDepth = 10f; +// Data depthData = dataValues.get("ESDUstartDepth"); +// Float lowerDepth = depthData != null ? Float.parseFloat(depthData.getDataValue()) : 0f; if (upperDepth >= lowerDepth) { upperDepth = 0f; } + xml.open("Sample"); + xml.create("ChannelDepthUpper", upperDepth.intValue()); xml.create("ChannelDepthLower", @@ -437,6 +440,8 @@ public class XmlAccousticExport implements EchoBaseService { "IDREF", XmlAccousticExport.getFormatedTopiaId(cell.getDataProcessing())); xml.create("PingAxisIntervalOrigin", "IDREF", vocabulary.getVocabularyCode("AC_PingAxisIntervalOrigin_" + prefix)); + + return true; } public void exportData(Result result, XmlWriter xml) throws IOException { -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.