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 5e22537877e1a9af343f0b98e0df20761dd05b96 Author: Julien Ruchaud <julien.ruchaud@debux.org> Date: Thu Nov 10 14:04:44 2016 +0100 #8768 Fix data quality and cellule duplication --- .../VoyageResultsMapOtherCellImportAction.java | 22 +++++++++------------- .../csv/VoyageResultsMapOtherCellImportRow.java | 7 ++++++- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/actions/VoyageResultsMapOtherCellImportAction.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/actions/VoyageResultsMapOtherCellImportAction.java index 8ec06e9..f207dcb 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/actions/VoyageResultsMapOtherCellImportAction.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/actions/VoyageResultsMapOtherCellImportAction.java @@ -27,6 +27,7 @@ import fr.ifremer.echobase.entities.ImportFileId; import fr.ifremer.echobase.entities.data.Cell; import fr.ifremer.echobase.entities.data.Data; import fr.ifremer.echobase.entities.data.Voyage; +import fr.ifremer.echobase.entities.references.CellType; import fr.ifremer.echobase.entities.references.DataMetadata; import fr.ifremer.echobase.entities.references.DataQuality; import fr.ifremer.echobase.io.InputFile; @@ -107,15 +108,16 @@ public class VoyageResultsMapOtherCellImportAction extends VoyageResultsImportDa throw new MismatchProviderException(getLocale(), rowNumber, voyage.getName()); } - String cellName = row.getCell().getName(); - boolean exists = persistenceService.containsPostVoyageCellByName(expectedVoyage, cellName); - if (exists) { - throw new DuplicatedMapCellException(getLocale(), rowNumber, cellName, voyage.getName()); + Cell rowCell = row.getCell(); + String cellName = rowCell.getName(); + CellType cellType = rowCell.getCellType(); + + Cell cell = persistenceService.getCellByNameAndType(cellName, cellType); + if (cell == null) { + cell = persistenceService.createCell(rowCell); + voyage.addPostCell(cell); } - Cell cell = persistenceService.createCell(row.getCell()); - voyage.addPostCell(cell); - // collect ids addId(result, EchoBaseUserEntityEnum.Cell, cell, rowNumber); addProcessedRow(result, row); @@ -202,22 +204,16 @@ public class VoyageResultsMapOtherCellImportAction extends VoyageResultsImportDa if (dataLatitudeMeta.equals(dataMetadata)) { row.setGridCellLatitude(dataValue); - row.setDataQuality(data.getDataQuality()); } else if (dataLongitudeMeta.equals(dataMetadata)) { row.setGridCellLongitude(dataValue); - row.setDataQuality(data.getDataQuality()); } else if (dataDepthMeta.equals(dataMetadata)) { row.setGridCellDepth(dataValue); - row.setDataQuality(data.getDataQuality()); } else if (dataLatitudeLagMeta.equals(dataMetadata)) { row.setGridLatitudeLag(dataValue); - row.setDataQuality(data.getDataQuality()); } else if (dataLongitudeLagMeta.equals(dataMetadata)) { row.setGridLongitudeLag(dataValue); - row.setDataQuality(data.getDataQuality()); } else if (dataDepthLagMeta.equals(dataMetadata)) { row.setGridDepthLag(dataValue); - row.setDataQuality(data.getDataQuality()); } else { throw new IllegalStateException("Cant deal with data of metadata: " + dataMetadata); } diff --git a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/csv/VoyageResultsMapOtherCellImportRow.java b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/csv/VoyageResultsMapOtherCellImportRow.java index a741316..40ec35d 100644 --- a/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/csv/VoyageResultsMapOtherCellImportRow.java +++ b/echobase-services/src/main/java/fr/ifremer/echobase/services/service/importdata/csv/VoyageResultsMapOtherCellImportRow.java @@ -27,6 +27,7 @@ import fr.ifremer.echobase.entities.data.Voyage; import fr.ifremer.echobase.entities.references.CellType; import fr.ifremer.echobase.entities.references.DataQuality; import fr.ifremer.echobase.services.csv.ResultAble; +import java.util.Collection; import java.util.LinkedList; import java.util.List; @@ -82,7 +83,11 @@ public class VoyageResultsMapOtherCellImportRow implements ResultAble { public static VoyageResultsMapOtherCellImportRow of(Voyage voyage, Cell cell) { VoyageResultsMapOtherCellImportRow row = new VoyageResultsMapOtherCellImportRow(cell); row.setVoyage(voyage); - row.result.addAll(cell.getResult()); + + Collection<Result> results = cell.getResult(); + row.result.addAll(results); + row.setDataQuality(results.iterator().next().getDataQuality()); + return row; } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.