diff --git a/build.gradle.kts b/build.gradle.kts index c90a3c77d..54d21f454 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -16,7 +16,7 @@ java { allprojects { group = "fr.insee.eno" - version = "3.29.0" + version = "3.29.1-SNAPSHOT" } subprojects { diff --git a/eno-core/src/main/java/fr/insee/eno/core/model/question/DynamicTableQuestion.java b/eno-core/src/main/java/fr/insee/eno/core/model/question/DynamicTableQuestion.java index 6688a126b..d7beef5f3 100644 --- a/eno-core/src/main/java/fr/insee/eno/core/model/question/DynamicTableQuestion.java +++ b/eno-core/src/main/java/fr/insee/eno/core/model/question/DynamicTableQuestion.java @@ -1,5 +1,6 @@ package fr.insee.eno.core.model.question; +import fr.insee.ddi.lifecycle33.datacollection.GridDimensionType; import fr.insee.ddi.lifecycle33.datacollection.QuestionGridType; import fr.insee.ddi.lifecycle33.reusable.CommandCodeType; import fr.insee.ddi.lifecycle33.reusable.CommandType; @@ -92,22 +93,20 @@ public class DynamicTableQuestion extends MultipleResponseQuestion implements En List cellLabels = new ArrayList<>(); public static CommandType mapDDISizeExpression(QuestionGridType ddiDynamicTableQuestion) { - checkRank1Dimension(ddiDynamicTableQuestion); - CommandCodeType conditionForContinuation = ddiDynamicTableQuestion.getGridDimensionArray(0).getRoster() - .getConditionForContinuation(); + GridDimensionType rank1Dimension = checkRank1Dimension(ddiDynamicTableQuestion); + CommandCodeType conditionForContinuation = rank1Dimension.getRoster().getConditionForContinuation(); if (conditionForContinuation == null) return null; return conditionForContinuation.getCommandArray(0); } - private static void checkRank1Dimension(QuestionGridType ddiDynamicTableQuestion) { - boolean hasRank1Dimension = ddiDynamicTableQuestion.getGridDimensionList().stream() - .filter(gridDimensionType -> gridDimensionType.getRank() != null) - .anyMatch(gridDimensionType -> 1 == gridDimensionType.getRank().intValue()); - if (! hasRank1Dimension) - throw new IllegalDDIElementException( - "DDI dynamic table question '" + ddiDynamicTableQuestion.getIDArray(0).getStringValue() + - "' has no rank 1 dimension."); + private static GridDimensionType checkRank1Dimension(QuestionGridType ddiDynamicTableQuestion) { + return ddiDynamicTableQuestion.getGridDimensionList().stream() + .filter(gridDimensionType -> BigInteger.ONE.equals(gridDimensionType.getRank())) + .findAny() + .orElseThrow(() -> new IllegalDDIElementException( + "DDI dynamic table question '" + ddiDynamicTableQuestion.getIDArray(0).getStringValue() + + "' has no rank 1 dimension.")); } } diff --git a/eno-core/src/main/java/fr/insee/eno/core/processing/out/steps/lunatic/table/DynamicTableQuestionProcessing.java b/eno-core/src/main/java/fr/insee/eno/core/processing/out/steps/lunatic/table/DynamicTableQuestionProcessing.java index a81f36fcd..9f07c2219 100644 --- a/eno-core/src/main/java/fr/insee/eno/core/processing/out/steps/lunatic/table/DynamicTableQuestionProcessing.java +++ b/eno-core/src/main/java/fr/insee/eno/core/processing/out/steps/lunatic/table/DynamicTableQuestionProcessing.java @@ -52,12 +52,12 @@ else if (enoTable.getSizeExpression() != null) private static void setMinMaxProperties(DynamicTableQuestion enoTable, LinesRoster lines) { LabelType minLabel = new LabelType(); minLabel.setType(LabelTypeEnum.VTL); - minLabel.setValue(Integer.toString(enoTable.getMinLines().intValue())); + minLabel.setValue(enoTable.getMinLines().toString()); lines.setMin(minLabel); LabelType maxLabel = new LabelType(); maxLabel.setType(LabelTypeEnum.VTL); - maxLabel.setValue(Integer.toString(enoTable.getMaxLines().intValue())); + maxLabel.setValue(enoTable.getMaxLines().toString()); lines.setMax(maxLabel); }