[tutti] branch develop updated (1aefc79 -> 938dd4e)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository tutti. See http://git.codelutin.com/tutti.git from 1aefc79 [jgitflow-maven-plugin]Updating develop poms back to pre merge state new 938dd4e fixes #5715: [IMPORT] psion message d'erreur qui bloque l'import d'un fichier qui passait sans problème avant 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 938dd4eeedeafd6952b928905bc1df57a1138c73 Author: Tony CHEMIT <chemit@codelutin.com> Date: Mon Sep 1 14:54:14 2014 +0200 fixes #5715: [IMPORT] psion message d'erreur qui bloque l'import d'un fichier qui passait sans problème avant Summary of changes: .../service/psionimport/PsionImportModel.java | 42 +++++++++------------- .../resources/i18n/tutti-service_fr_FR.properties | 2 +- 2 files changed, 18 insertions(+), 26 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 tutti. See http://git.codelutin.com/tutti.git commit 938dd4eeedeafd6952b928905bc1df57a1138c73 Author: Tony CHEMIT <chemit@codelutin.com> Date: Mon Sep 1 14:54:14 2014 +0200 fixes #5715: [IMPORT] psion message d'erreur qui bloque l'import d'un fichier qui passait sans problème avant --- .../service/psionimport/PsionImportModel.java | 42 +++++++++------------- .../resources/i18n/tutti-service_fr_FR.properties | 2 +- 2 files changed, 18 insertions(+), 26 deletions(-) diff --git a/tutti-service/src/main/java/fr/ifremer/tutti/service/psionimport/PsionImportModel.java b/tutti-service/src/main/java/fr/ifremer/tutti/service/psionimport/PsionImportModel.java index 10608b7..3f3cbe5 100644 --- a/tutti-service/src/main/java/fr/ifremer/tutti/service/psionimport/PsionImportModel.java +++ b/tutti-service/src/main/java/fr/ifremer/tutti/service/psionimport/PsionImportModel.java @@ -42,6 +42,7 @@ import java.util.Collection; import java.util.Iterator; import java.util.LinkedHashSet; import java.util.List; +import java.util.Map; import java.util.Set; import static org.nuiton.i18n.I18n.t; @@ -247,6 +248,9 @@ public class PsionImportModel { void checkSortedBatches(SampleCategoryModel sampleCategoryModel) throws IOException { + Map<Integer, SampleCategoryModelEntry> categoriesById = + sampleCategoryModel.getCategoryMap(); + for (Species species : sortedBatchsBySpecies.keySet()) { Collection<PsionImportBatchModel> speciesBatchesWithDoubleWeight = new ArrayList<>(); @@ -254,6 +258,8 @@ public class PsionImportModel { for (PsionImportBatchModel batchModel : sortedBatchsBySpecies.get(species)) { + checkSampleCategoryModel(categoriesById, batchModel); + Float weight = batchModel.getWeight(); Float sampleWeight = batchModel.getSampleWeight(); @@ -275,8 +281,6 @@ public class PsionImportModel { } - checkSampleCategoryModel(sampleCategoryModel, batchModel); - } if (!speciesBatchesWithDoubleWeight.isEmpty()) { @@ -305,42 +309,30 @@ public class PsionImportModel { } - protected void checkSampleCategoryModel(SampleCategoryModel sampleCategoryModel, PsionImportBatchModel batchModel) throws IOException { + protected void checkSampleCategoryModel(Map<Integer, SampleCategoryModelEntry> categoriesById, + PsionImportBatchModel batchModel) throws IOException { + + SampleCategoryModelEntry lastSampleCategory = null; if (batchModel.withCategories()) { - Iterator<SampleCategoryModelEntry> samplingOrderIterator = sampleCategoryModel.getCategory().iterator(); Iterator<PsionImportBatchModel.SampleCategory> categoryIterator = batchModel.getCategoryIterator(); while (categoryIterator.hasNext()) { - PsionImportBatchModel.SampleCategory nextCategory = categoryIterator.next(); + PsionImportBatchModel.SampleCategory nextCat = categoryIterator.next(); + SampleCategoryModelEntry actualCategory = categoriesById.get(nextCat.getCategoryId()); - Integer nextCategoryCategoryId = nextCategory.getCategoryId(); - if (!samplingOrderIterator.hasNext()) { - - // not an existing category (should never happend) - throw new IOException(t("tutti.service.psionimport.error.unkonwSampleCategory.message", batchModel.getSpecies().getSurveyCode(), nextCategoryCategoryId)); - - } + if (lastSampleCategory!=null) { - if (!sampleCategoryModel.containsCategoryId(nextCategoryCategoryId)) { + if (actualCategory.getOrder() < lastSampleCategory.getOrder()) { - // not an existing category (should never happend) - throw new IOException(t("tutti.service.psionimport.error.unkonwSampleCategory.message", batchModel.getSpecies().getSurveyCode(), nextCategoryCategoryId)); + throw new IOException(t("tutti.service.psionimport.error.mismatchSampleCategory.message", batchModel.getSpecies().getSurveyCode(), actualCategory, lastSampleCategory)); + } } + lastSampleCategory = actualCategory; - SampleCategoryModelEntry nextSampleCategory = samplingOrderIterator.next(); - - if (!nextSampleCategory.getCategoryId().equals(nextCategoryCategoryId)) { - - // mismatch sample category - SampleCategoryModelEntry foundSampleCategory = sampleCategoryModel.getCategoryById(nextCategoryCategoryId); - throw new IOException(t("tutti.service.psionimport.error.mismatchSampleCategory.message", batchModel.getSpecies().getSurveyCode(), foundSampleCategory, nextSampleCategory)); - - } } - } } diff --git a/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties b/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties index c25fa3d..4c62499 100644 --- a/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties +++ b/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties @@ -170,7 +170,7 @@ tutti.service.psionimport.error.invalid.firstLine=La ligne <i>%s</i> (<strong>%s tutti.service.psionimport.error.invalid.line.syntax=Ligne <i>%s</i>, format incorrecte (<strong>%s</strong>) tutti.service.psionimport.error.invalid.operation=Code station ou date du trait incorrect tutti.service.psionimport.error.invalidSampleCategoryModel.message=<html><body>Le modèle de catégorisation n'est pas compatible pour un import psion.<br> Il manque les catégories suivantes \: <ul>%s</ul><hr/>Veuillez ajouter cette catégorie dans la configuration de catégorisation (menu administration).</body></html> -tutti.service.psionimport.error.mismatchSampleCategory.message=Pour l'espèce '<strong>%s</strong>', la catégorisation ne respecte pas le modèle des catégorisation, la catégorie '<strong>%s</strong>' a été trouvé à la place de '<i>%s</i>' +tutti.service.psionimport.error.mismatchSampleCategory.message=Pour l'espèce '<strong>%s</strong>', la catégorisation ne respecte pas le modèle des catégorisation, la catégorie '<strong>%s</strong>' a été trouvée, mais n'est pas possible après la catégorie '<i>%s</i>' tutti.service.psionimport.error.no.lengthClass.caracteristic=Ligne <i>%s</i> espèce '<strong>%s</strong>' ignorée car pas de caractéristique de classe de taille renseignée dans le protocole. tutti.service.psionimport.error.no.protocol=Impossible de faire un import Psion sans protocol. tutti.service.psionimport.error.species.already.used="Ligne <i>%s</i>, espèce '<strong>%s</strong>' déjà utilisée -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
participants (1)
-
codelutin.com scm