From d78b0766223ac78aa9285ab1a0f0158b98f3244e Mon Sep 17 00:00:00 2001 From: Ioannis Rousochatzakis Date: Fri, 10 May 2024 17:42:16 +0200 Subject: [PATCH] Fixed the order of variable declarations passed to the MarkupGenerator. --- .../eu/europa/ted/efx/model/templates/ContentBlock.java | 2 +- .../eu/europa/ted/efx/model/variables/VariableList.java | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/europa/ted/efx/model/templates/ContentBlock.java b/src/main/java/eu/europa/ted/efx/model/templates/ContentBlock.java index b019ad1..29cc3be 100644 --- a/src/main/java/eu/europa/ted/efx/model/templates/ContentBlock.java +++ b/src/main/java/eu/europa/ted/efx/model/templates/ContentBlock.java @@ -125,7 +125,7 @@ public Set getOwnVariables() { if (this.context != null && this.context.variable() != null) { variables.add(this.context.variable()); } - variables.addAll(this.variables); + variables.addAll(this.variables.declaredOrder()); return variables; } diff --git a/src/main/java/eu/europa/ted/efx/model/variables/VariableList.java b/src/main/java/eu/europa/ted/efx/model/variables/VariableList.java index 005a508..580f37f 100644 --- a/src/main/java/eu/europa/ted/efx/model/variables/VariableList.java +++ b/src/main/java/eu/europa/ted/efx/model/variables/VariableList.java @@ -1,5 +1,6 @@ package eu.europa.ted.efx.model.variables; +import java.util.Collections; import java.util.LinkedList; import eu.europa.ted.efx.model.ParsedEntity; @@ -8,4 +9,11 @@ public class VariableList extends LinkedList implements ParsedEntity { public VariableList() { } + + public VariableList declaredOrder() { + VariableList reversedList = new VariableList(); + reversedList.addAll(this); + Collections.reverse(reversedList); + return reversedList; + } }