Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions aom/src/main/java/com/nedap/archie/aom/utils/AOMUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ public static String stripPrefix(String nodeId) {
public static String pathAtSpecializationLevel(List<PathSegment> pathSegments, int level) {
//todo: this doesn't clone the original
for(PathSegment segment:pathSegments) {
if(segment.getNodeId() != null && AOMUtils.isValidCode(segment.getNodeId()) && AOMUtils.getSpecializationDepthFromCode(segment.getNodeId()) > level) {
// isValidADL14Code (a superset of isValidCode) is used so zero-padded at-coded node ids are handled too
if(segment.getNodeId() != null && AOMUtils.isValidADL14Code(segment.getNodeId()) && AOMUtils.getSpecializationDepthFromCode(segment.getNodeId()) > level) {
segment.setNodeId(codeAtLevel(segment.getNodeId(), level));
}
}
Expand Down Expand Up @@ -273,7 +274,9 @@ private static Boolean matchesExpression(Expression expression, String archetype
}

public static boolean codesConformant(String childNodeId, String parentNodeId) {
return isValidCode(childNodeId) && childNodeId.startsWith(parentNodeId) &&
// isValidADL14Code (a superset of isValidCode) is used so zero-padded at-coded node ids (e.g. at0000.1)
// are accepted as well; id-coded codes are never zero-padded so this does not change their behaviour.
return isValidADL14Code(childNodeId) && childNodeId.startsWith(parentNodeId) &&
(childNodeId.length() == parentNodeId.length() || (childNodeId.length() > parentNodeId.length() && childNodeId.charAt(parentNodeId.length()) == AdlCodeDefinitions.SPECIALIZATION_SEPARATOR));

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ public enum ErrorType implements MessageCode {
OVERLAY_VALIDATION_FAILED(I18n.register("The validation of a template overlay failed")),
PARENT_VALIDATION_FAILED(I18n.register("The validation of the parent archetype failed")),
ADL14_INCOMPATIBLE_NODE_IDS(I18n.register("Node id numbers should be unique without their ac, at or id-prefix, to ensure the possibility of converting the archetype to ADL 1.4")),
DEFAULT_OBJECT_TYPE_VALIDITY(I18n.register("object constraint default value type validity: the type of the default value of an object constraint must conform to the type of the constraint"));
DEFAULT_OBJECT_TYPE_VALIDITY(I18n.register("object constraint default value type validity: the type of the default value of an object constraint must conform to the type of the constraint")),
INVALID_NODE_ID_CODE_SYSTEM(I18n.register("node identifier code system validity: an archetype must consistently use a single node identifier code system, either id-coded (id1, id1.1, ...) or, since ADL 2.4, at-coded (at0000, at0000.1, ...), and that code system must match the one the validator is configured to accept."));

private final String description;

Expand Down
19 changes: 19 additions & 0 deletions aom/src/test/java/com/nedap/archie/aom/utils/AOMUtilsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,28 @@
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

public class AOMUtilsTest {

@Test
public void codesConformant() {
// id-coded
assertTrue(AOMUtils.codesConformant("id1", "id1"));
assertTrue(AOMUtils.codesConformant("id1.1", "id1"));
assertTrue(AOMUtils.codesConformant("id1.1.1", "id1.1"));
assertFalse(AOMUtils.codesConformant("id2", "id1"));

// at-coded, zero-padded (ADL 2.4) - the case enabled by using isValidADL14Code instead of isValidCode
assertTrue(AOMUtils.codesConformant("at0000", "at0000"));
assertTrue(AOMUtils.codesConformant("at0000.1", "at0000"));
assertTrue(AOMUtils.codesConformant("at0001.0.1", "at0001"));
assertFalse(AOMUtils.codesConformant("at0001", "at0000"));
// shares the parent string as a prefix but is not a specialisation child (no '.' separator)
assertFalse(AOMUtils.codesConformant("at00001", "at0000"));
}

@Test
public void codeAtLevel() {
assertEquals("id1", AOMUtils.codeAtLevel("id1", 0));
Expand Down
75 changes: 48 additions & 27 deletions i18n/po/i18n_en.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-03-30 14:54+0200\n"
"POT-Creation-Date: 2026-06-18 16:16+0200\n"
"PO-Revision-Date: \n"
"Last-Translator: Pieter Bos <pieter.bos@nedap.com>\n"
"Language-Team: \n"
Expand Down Expand Up @@ -56,6 +56,10 @@ msgstr ""
msgid "ADL version {0} is an invalid format for a version, should be x.x.x-(rc|alpha(x)?)?"
msgstr ""

#: ../tools/src/main/java/com/nedap/archie/archetypevalidator/validations/CodeSystemValidation.java:60
msgid "An archetype must use a single node identifier code system, but both id-coded and at-coded node ids are used"
msgstr ""

#: ../tools/src/main/java/com/nedap/archie/rmobjectvalidator/RMObjectValidationMessageIds.java:18
msgid "An archetype slot was used in the archetype, but no archetype id was present in the data."
msgstr ""
Expand Down Expand Up @@ -96,7 +100,7 @@ msgstr ""
msgid "Assertion violation processing RM schemas; original recipient: {0}"
msgstr ""

#: ../tools/src/main/java/com/nedap/archie/archetypevalidator/validations/CodeValidation.java:60
#: ../tools/src/main/java/com/nedap/archie/archetypevalidator/validations/CodeValidation.java:70
#, java-format
msgid "Assumed value {0} from the C_TERMINOLOGY_CODE is not part of value set {1}. Expected one of {2}"
msgstr ""
Expand Down Expand Up @@ -174,23 +178,23 @@ msgstr ""
msgid "Cardinality must have an interval present, but it was null"
msgstr ""

#: ../tools/src/main/java/com/nedap/archie/archetypevalidator/validations/CodeValidation.java:76
#: ../tools/src/main/java/com/nedap/archie/archetypevalidator/validations/CodeValidation.java:86
#, java-format
msgid "Code {0} from C_TERMINOLOGY_CODE constraint is not defined in the terminology"
msgstr ""

#: ../tools/src/main/java/com/nedap/archie/archetypevalidator/validations/CodeValidation.java:49
#: ../tools/src/main/java/com/nedap/archie/archetypevalidator/validations/CodeValidation.java:72
#: ../tools/src/main/java/com/nedap/archie/archetypevalidator/validations/CodeValidation.java:59
#: ../tools/src/main/java/com/nedap/archie/archetypevalidator/validations/CodeValidation.java:82
#, java-format
msgid "Code {0} from the C_TERMINOLOGY_CODE constraint has specialization depth {1}, but this must be no greater than {2}"
msgstr ""

#: ../tools/src/main/java/com/nedap/archie/archetypevalidator/validations/CodeValidation.java:54
#: ../tools/src/main/java/com/nedap/archie/archetypevalidator/validations/CodeValidation.java:64
#, java-format
msgid "Code {0} from the C_TERMINOLOGY_CODE constraint is not defined in the terminology"
msgstr ""

#: ../tools/src/main/java/com/nedap/archie/archetypevalidator/validations/BasicTerminologyValidation.java:168
#: ../tools/src/main/java/com/nedap/archie/archetypevalidator/validations/BasicTerminologyValidation.java:169
#, java-format
msgid "Code {0} is in the terminology, but not used in the archetype"
msgstr ""
Expand Down Expand Up @@ -247,18 +251,18 @@ msgstr ""
msgid "Error"
msgstr ""

#: ../tools/src/main/java/com/nedap/archie/archetypevalidator/ArchetypeValidator.java:156
#: ../tools/src/main/java/com/nedap/archie/archetypevalidator/ArchetypeValidator.java:157
#, java-format
msgid "Error in parent archetype. Fix those errors before continuing with this archetype: {0}"
msgstr ""

#: ../tools/src/main/java/com/nedap/archie/archetypevalidator/validations/BasicTerminologyValidation.java:42
#: ../tools/src/main/java/com/nedap/archie/archetypevalidator/validations/BasicTerminologyValidation.java:43
#, java-format
msgid "Id code {0} in terminology is not a valid term code, should be id, ac or at, followed by digits"
msgstr ""

#: ../tools/src/main/java/com/nedap/archie/archetypevalidator/validations/BasicTerminologyValidation.java:46
#: ../tools/src/main/java/com/nedap/archie/archetypevalidator/validations/BasicTerminologyValidation.java:50
#: ../tools/src/main/java/com/nedap/archie/archetypevalidator/validations/BasicTerminologyValidation.java:47
#: ../tools/src/main/java/com/nedap/archie/archetypevalidator/validations/BasicTerminologyValidation.java:51
#, java-format
msgid "Id code {0} in terminology is of a different specialization depth than the archetype"
msgstr ""
Expand Down Expand Up @@ -326,7 +330,7 @@ msgstr ""
msgid "Node id numbers should be unique without their ac, at or id-prefix, to ensure the possibility of converting the archetype to ADL 1.4"
msgstr ""

#: ../tools/src/main/java/com/nedap/archie/archetypevalidator/validations/BasicTerminologyValidation.java:182
#: ../tools/src/main/java/com/nedap/archie/archetypevalidator/validations/BasicTerminologyValidation.java:183
#, java-format
msgid "Node id {0} already used in archetype as {1} with a different at, id or ac prefix. The archetype will not be convertible to ADL 1.4"
msgstr ""
Expand All @@ -351,7 +355,7 @@ msgstr ""
msgid "Node id {0} is not valid here because it redefines an object illegally"
msgstr ""

#: ../tools/src/main/java/com/nedap/archie/archetypevalidator/validations/CodeValidation.java:36
#: ../tools/src/main/java/com/nedap/archie/archetypevalidator/validations/CodeValidation.java:37
#, java-format
msgid "Node id {0} is used in the archetype, but missing in the terminology"
msgstr ""
Expand Down Expand Up @@ -413,7 +417,7 @@ msgstr ""
msgid "RM Release version {0} is an invalid format for a version, should be x.x.x-(rc|alpha(x)?)?"
msgstr ""

#: ../tools/src/main/java/com/nedap/archie/archetypevalidator/validations/BasicChecks.java:69
#: ../tools/src/main/java/com/nedap/archie/archetypevalidator/validations/BasicChecks.java:76
#, java-format
msgid "RM type in id {0} does not match RM type in definition {1}"
msgstr ""
Expand Down Expand Up @@ -713,17 +717,17 @@ msgstr ""
msgid "Syntax error: terminology not specified"
msgstr ""

#: ../tools/src/main/java/com/nedap/archie/archetypevalidator/ArchetypeValidator.java:202
#: ../tools/src/main/java/com/nedap/archie/archetypevalidator/ArchetypeValidator.java:203
#, java-format
msgid "Template overlay {0} had validation errors"
msgstr ""

#: ../tools/src/main/java/com/nedap/archie/archetypevalidator/validations/BasicTerminologyValidation.java:86
#: ../tools/src/main/java/com/nedap/archie/archetypevalidator/validations/BasicTerminologyValidation.java:87
#, java-format
msgid "Term binding key {0} in path format is not present in archetype"
msgstr ""

#: ../tools/src/main/java/com/nedap/archie/archetypevalidator/validations/BasicTerminologyValidation.java:91
#: ../tools/src/main/java/com/nedap/archie/archetypevalidator/validations/BasicTerminologyValidation.java:92
#, java-format
msgid "Term binding key {0} is not present in terminology"
msgstr ""
Expand Down Expand Up @@ -776,7 +780,7 @@ msgstr ""
msgid "The cardinality {0} of attribute {2}.{3} does not match cardinality {1} of the reference model"
msgstr ""

#: ../tools/src/main/java/com/nedap/archie/archetypevalidator/validations/CodeValidation.java:30
#: ../tools/src/main/java/com/nedap/archie/archetypevalidator/validations/CodeValidation.java:31
#, java-format
msgid "The code specialization depth of code {0} is {1}, which is greater than archetype specialization depth {2}"
msgstr ""
Expand All @@ -801,7 +805,12 @@ msgstr ""
msgid "The existence {0} of attribute {2}.{3} does not match existence {1} of the reference model"
msgstr ""

#: ../tools/src/main/java/com/nedap/archie/archetypevalidator/validations/BasicChecks.java:60
#: ../tools/src/main/java/com/nedap/archie/archetypevalidator/validations/BasicChecks.java:61
#, java-format
msgid "The node id is not in the form at0000.1....1: {0}"
msgstr ""

#: ../tools/src/main/java/com/nedap/archie/archetypevalidator/validations/BasicChecks.java:67
#, java-format
msgid "The node id is not in the form id1.1....1: {0}"
msgstr ""
Expand Down Expand Up @@ -870,6 +879,14 @@ msgstr ""
msgid "The validation of the parent archetype failed"
msgstr ""

#: ../tools/src/main/java/com/nedap/archie/archetypevalidator/validations/CodeSystemValidation.java:63
msgid "The validator is configured to accept at-coded archetypes, but the archetype uses id-coded node ids"
msgstr ""

#: ../tools/src/main/java/com/nedap/archie/archetypevalidator/validations/CodeSystemValidation.java:66
msgid "The validator is configured to accept id-coded archetypes, but the archetype uses at-coded node ids"
msgstr ""

#: ../tools/src/main/java/com/nedap/archie/rmobjectvalidator/RMObjectValidationMessageIds.java:13
#, java-format
msgid "The value {0} must be one of:"
Expand Down Expand Up @@ -1120,6 +1137,10 @@ msgstr ""
msgid "node id must be defined in flat terminology"
msgstr ""

#: ../aom/src/main/java/com/nedap/archie/archetypevalidator/ErrorType.java:90
msgid "node identifier code system validity: an archetype must consistently use a single node identifier code system, either id-coded (id1, id1.1, ...) or, since ADL 2.4, at-coded (at0000, at0000.1, ...), and that code system must match the one the validator is configured to accept."
msgstr ""

#: ../aom/src/main/java/com/nedap/archie/archetypevalidator/ErrorType.java:89
msgid "object constraint default value type validity: the type of the default value of an object constraint must conform to the type of the constraint"
msgstr ""
Expand Down Expand Up @@ -1268,13 +1289,13 @@ msgstr ""
msgid "value code validity. Each value code (at-code) used in a term constraint in the archetype definition must be defined in the term_definitions part of the terminology of the flattened form of the current archetype."
msgstr ""

#: ../tools/src/main/java/com/nedap/archie/archetypevalidator/validations/BasicTerminologyValidation.java:147
#: ../tools/src/main/java/com/nedap/archie/archetypevalidator/validations/BasicTerminologyValidation.java:148
#, java-format
msgid "value code {0} is used in redefined value set {1}, but not present in its parent value set with members {2}"
msgstr ""

#: ../tools/src/main/java/com/nedap/archie/archetypevalidator/validations/BasicTerminologyValidation.java:125
#: ../tools/src/main/java/com/nedap/archie/archetypevalidator/validations/BasicTerminologyValidation.java:129
#: ../tools/src/main/java/com/nedap/archie/archetypevalidator/validations/BasicTerminologyValidation.java:126
#: ../tools/src/main/java/com/nedap/archie/archetypevalidator/validations/BasicTerminologyValidation.java:130
#, java-format
msgid "value code {0} is used in value set {1}, but not present in terminology"
msgstr ""
Expand All @@ -1283,22 +1304,22 @@ msgstr ""
msgid "value set assumed value code validity. Each value code (at-code) used as an assumed_value for a value set in a term constraint in the archetype definition must exist in the value set definition in the terminology for the identified value set."
msgstr ""

#: ../tools/src/main/java/com/nedap/archie/archetypevalidator/validations/BasicTerminologyValidation.java:110
#: ../tools/src/main/java/com/nedap/archie/archetypevalidator/validations/BasicTerminologyValidation.java:111
#, java-format
msgid "value set code {0} is not present in terminology"
msgstr ""

#: ../tools/src/main/java/com/nedap/archie/archetypevalidator/validations/BasicTerminologyValidation.java:116
#: ../tools/src/main/java/com/nedap/archie/archetypevalidator/validations/BasicTerminologyValidation.java:120
#: ../tools/src/main/java/com/nedap/archie/archetypevalidator/validations/BasicTerminologyValidation.java:117
#: ../tools/src/main/java/com/nedap/archie/archetypevalidator/validations/BasicTerminologyValidation.java:121
#, java-format
msgid "value set code {0} is used in value set {1}, but not present in terminology"
msgstr ""

#: ../tools/src/main/java/com/nedap/archie/archetypevalidator/validations/BasicTerminologyValidation.java:106
#: ../tools/src/main/java/com/nedap/archie/archetypevalidator/validations/BasicTerminologyValidation.java:107
msgid "value set does not contain a set Id value"
msgstr ""

#: ../tools/src/main/java/com/nedap/archie/archetypevalidator/validations/BasicTerminologyValidation.java:142
#: ../tools/src/main/java/com/nedap/archie/archetypevalidator/validations/BasicTerminologyValidation.java:143
#, java-format
msgid "value set {0} has a specialized code, but the valueset it specialized cannot be found in the flat parent"
msgstr ""
Expand Down
Loading