Skip to content

Commit

Permalink
Merge pull request #45 from OP-TED/feature/TEDEFO-2578-expected-ntds
Browse files Browse the repository at this point in the history
notice-types: Check all expected NTDs are present (TEDEFO-2578)
  • Loading branch information
bertrand-lorentz authored Nov 29, 2023
2 parents dff4d35 + 1987359 commit ebf38c1
Show file tree
Hide file tree
Showing 93 changed files with 5,327 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import org.apache.commons.lang3.StringUtils;
import eu.europa.ted.eforms.sdk.analysis.domain.noticetype.DocumentType;
import eu.europa.ted.eforms.sdk.analysis.domain.noticetype.NoticeSubTypeForIndex;
Expand All @@ -17,6 +19,20 @@ public NoticeTypesIndexFact(NoticeTypesForIndex noticeTypesForIndex) {
this.noticeTypesForIndex = noticeTypesForIndex;
}

/**
* Return the set of notice subtypes for which we expect to have a notice type definition.
* This is hardcoded here because there is no other place that has this information.
*/
public Set<String> getExpectedNoticeSubtypes() {
return Stream.of("1", "2", "3", "4", "5", "6", "7", "8", "9",
"10", "11", "12", "13", "14", "15", "16", "17", "18", "19",
"20", "21", "22", "23", "24", "25", "26", "27", "28", "29",
"30", "31", "32", "33", "34", "35", "36", "37", "38", "39",
"40",
"CEI", "T01", "T02", "X01", "X02")
.collect(Collectors.toSet());
}

public String getSdkVersion() {
return noticeTypesForIndex.getSdkVersion();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,14 @@ then
results.add(new ValidationResult($nti, "Notice sub type " + $subTypeId + " references type " + $type + " which is not part of the \"notice-type\" codelist", ValidationStatusEnum.ERROR));
end

rule "All expected notice subtypes are present"
when
$expected : /noticeTypesIndex[ $nti: this ]/expectedNoticeSubtypes
not (exists /noticeTypes[ id == $expected ])
then
results.add(new ValidationResult($nti, "Notice subtype " + $expected + " does not have a notice type definition", ValidationStatusEnum.ERROR));
end

// TEDEFO-1845: Warning
// For every field in a notice type definition, all its repeatable ancestor should be in this notice type definition
rule "All repeatable ancestors of a field are in the notice type definition"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"ublVersion" : "2.3",
"sdkVersion" : "1.10.0",
"metadataDatabase" : {
"version" : "1.10.0",
"createdOn" : "2023-11-15T14:00:00"
},
"noticeId" : "1",
"metadata" : [ {
"id" : "BT-02-notice",
"contentType" : "field",
"displayType" : "COMBOBOX",
"description" : "Notice Type",
"_label" : "field|name|BT-02-notice",
"readOnly" : true
} ],
"content" : [ {
"id" : "GR-Buyer",
"contentType" : "group",
"displayType" : "SECTION",
"description" : "Contracting Party and Provider related Information",
"_label" : "group|name|GR-Buyer",
"content" : [ {
"id" : "GR-ContractingAuthority",
"contentType" : "group",
"nodeId" : "ND-ContractingParty",
"displayType" : "GROUP",
"description" : "Contracting Party related Information (URL, Legal Type, Contracting Type, Activity, …)",
"_label" : "group|name|ND-ContractingParty",
"_repeatable" : true,
"content" : [ {
"id" : "GR-ContractingAuthority-Buyer",
"contentType" : "group",
"displayType" : "GROUP",
"description" : "Contracting Party related Information (URL, Legal Type, Contracting Type, Activity, …)",
"_label" : "group|name|GR-ContractingAuthority-Buyer",
"content" : [ {
"id" : "OPT-300-Procedure-Buyer",
"contentType" : "field",
"displayType" : "COMBOBOX",
"description" : "Buyer Technical Identifier Reference",
"_label" : "field|name|OPT-300-Procedure-Buyer",
"_idSchemes" : [ "ORG" ]
} ]
} ]
} ]
} ]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"ublVersion" : "2.3",
"sdkVersion" : "1.10.0",
"metadataDatabase" : {
"version" : "1.10.0",
"createdOn" : "2023-11-15T14:00:00"
},
"noticeId" : "10",
"metadata" : [ {
"id" : "BT-02-notice",
"contentType" : "field",
"displayType" : "COMBOBOX",
"description" : "Notice Type",
"_label" : "field|name|BT-02-notice",
"readOnly" : true
} ],
"content" : [ {
"id" : "GR-Buyer",
"contentType" : "group",
"displayType" : "SECTION",
"description" : "Contracting Party and Provider related Information",
"_label" : "group|name|GR-Buyer",
"content" : [ {
"id" : "GR-ContractingAuthority",
"contentType" : "group",
"nodeId" : "ND-ContractingParty",
"displayType" : "GROUP",
"description" : "Contracting Party related Information (URL, Legal Type, Contracting Type, Activity, …)",
"_label" : "group|name|ND-ContractingParty",
"_repeatable" : true,
"content" : [ {
"id" : "GR-ContractingAuthority-Buyer",
"contentType" : "group",
"displayType" : "GROUP",
"description" : "Contracting Party related Information (URL, Legal Type, Contracting Type, Activity, …)",
"_label" : "group|name|GR-ContractingAuthority-Buyer",
"content" : [ {
"id" : "OPT-300-Procedure-Buyer",
"contentType" : "field",
"displayType" : "COMBOBOX",
"description" : "Buyer Technical Identifier Reference",
"_label" : "field|name|OPT-300-Procedure-Buyer",
"_idSchemes" : [ "ORG" ]
} ]
} ]
} ]
} ]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"ublVersion" : "2.3",
"sdkVersion" : "1.10.0",
"metadataDatabase" : {
"version" : "1.10.0",
"createdOn" : "2023-11-15T14:00:00"
},
"noticeId" : "11",
"metadata" : [ {
"id" : "BT-02-notice",
"contentType" : "field",
"displayType" : "COMBOBOX",
"description" : "Notice Type",
"_label" : "field|name|BT-02-notice",
"readOnly" : true
} ],
"content" : [ {
"id" : "GR-Buyer",
"contentType" : "group",
"displayType" : "SECTION",
"description" : "Contracting Party and Provider related Information",
"_label" : "group|name|GR-Buyer",
"content" : [ {
"id" : "GR-ContractingAuthority",
"contentType" : "group",
"nodeId" : "ND-ContractingParty",
"displayType" : "GROUP",
"description" : "Contracting Party related Information (URL, Legal Type, Contracting Type, Activity, …)",
"_label" : "group|name|ND-ContractingParty",
"_repeatable" : true,
"content" : [ {
"id" : "GR-ContractingAuthority-Buyer",
"contentType" : "group",
"displayType" : "GROUP",
"description" : "Contracting Party related Information (URL, Legal Type, Contracting Type, Activity, …)",
"_label" : "group|name|GR-ContractingAuthority-Buyer",
"content" : [ {
"id" : "OPT-300-Procedure-Buyer",
"contentType" : "field",
"displayType" : "COMBOBOX",
"description" : "Buyer Technical Identifier Reference",
"_label" : "field|name|OPT-300-Procedure-Buyer",
"_idSchemes" : [ "ORG" ]
} ]
} ]
} ]
} ]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"ublVersion" : "2.3",
"sdkVersion" : "1.10.0",
"metadataDatabase" : {
"version" : "1.10.0",
"createdOn" : "2023-11-15T14:00:00"
},
"noticeId" : "12",
"metadata" : [ {
"id" : "BT-02-notice",
"contentType" : "field",
"displayType" : "COMBOBOX",
"description" : "Notice Type",
"_label" : "field|name|BT-02-notice",
"readOnly" : true
} ],
"content" : [ {
"id" : "GR-Buyer",
"contentType" : "group",
"displayType" : "SECTION",
"description" : "Contracting Party and Provider related Information",
"_label" : "group|name|GR-Buyer",
"content" : [ {
"id" : "GR-ContractingAuthority",
"contentType" : "group",
"nodeId" : "ND-ContractingParty",
"displayType" : "GROUP",
"description" : "Contracting Party related Information (URL, Legal Type, Contracting Type, Activity, …)",
"_label" : "group|name|ND-ContractingParty",
"_repeatable" : true,
"content" : [ {
"id" : "GR-ContractingAuthority-Buyer",
"contentType" : "group",
"displayType" : "GROUP",
"description" : "Contracting Party related Information (URL, Legal Type, Contracting Type, Activity, …)",
"_label" : "group|name|GR-ContractingAuthority-Buyer",
"content" : [ {
"id" : "OPT-300-Procedure-Buyer",
"contentType" : "field",
"displayType" : "COMBOBOX",
"description" : "Buyer Technical Identifier Reference",
"_label" : "field|name|OPT-300-Procedure-Buyer",
"_idSchemes" : [ "ORG" ]
} ]
} ]
} ]
} ]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"ublVersion" : "2.3",
"sdkVersion" : "1.10.0",
"metadataDatabase" : {
"version" : "1.10.0",
"createdOn" : "2023-11-15T14:00:00"
},
"noticeId" : "13",
"metadata" : [ {
"id" : "BT-02-notice",
"contentType" : "field",
"displayType" : "COMBOBOX",
"description" : "Notice Type",
"_label" : "field|name|BT-02-notice",
"readOnly" : true
} ],
"content" : [ {
"id" : "GR-Buyer",
"contentType" : "group",
"displayType" : "SECTION",
"description" : "Contracting Party and Provider related Information",
"_label" : "group|name|GR-Buyer",
"content" : [ {
"id" : "GR-ContractingAuthority",
"contentType" : "group",
"nodeId" : "ND-ContractingParty",
"displayType" : "GROUP",
"description" : "Contracting Party related Information (URL, Legal Type, Contracting Type, Activity, …)",
"_label" : "group|name|ND-ContractingParty",
"_repeatable" : true,
"content" : [ {
"id" : "GR-ContractingAuthority-Buyer",
"contentType" : "group",
"displayType" : "GROUP",
"description" : "Contracting Party related Information (URL, Legal Type, Contracting Type, Activity, …)",
"_label" : "group|name|GR-ContractingAuthority-Buyer",
"content" : [ {
"id" : "OPT-300-Procedure-Buyer",
"contentType" : "field",
"displayType" : "COMBOBOX",
"description" : "Buyer Technical Identifier Reference",
"_label" : "field|name|OPT-300-Procedure-Buyer",
"_idSchemes" : [ "ORG" ]
} ]
} ]
} ]
} ]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"ublVersion" : "2.3",
"sdkVersion" : "1.10.0",
"metadataDatabase" : {
"version" : "1.10.0",
"createdOn" : "2023-11-15T14:00:00"
},
"noticeId" : "14",
"metadata" : [ {
"id" : "BT-02-notice",
"contentType" : "field",
"displayType" : "COMBOBOX",
"description" : "Notice Type",
"_label" : "field|name|BT-02-notice",
"readOnly" : true
} ],
"content" : [ {
"id" : "GR-Buyer",
"contentType" : "group",
"displayType" : "SECTION",
"description" : "Contracting Party and Provider related Information",
"_label" : "group|name|GR-Buyer",
"content" : [ {
"id" : "GR-ContractingAuthority",
"contentType" : "group",
"nodeId" : "ND-ContractingParty",
"displayType" : "GROUP",
"description" : "Contracting Party related Information (URL, Legal Type, Contracting Type, Activity, …)",
"_label" : "group|name|ND-ContractingParty",
"_repeatable" : true,
"content" : [ {
"id" : "GR-ContractingAuthority-Buyer",
"contentType" : "group",
"displayType" : "GROUP",
"description" : "Contracting Party related Information (URL, Legal Type, Contracting Type, Activity, …)",
"_label" : "group|name|GR-ContractingAuthority-Buyer",
"content" : [ {
"id" : "OPT-300-Procedure-Buyer",
"contentType" : "field",
"displayType" : "COMBOBOX",
"description" : "Buyer Technical Identifier Reference",
"_label" : "field|name|OPT-300-Procedure-Buyer",
"_idSchemes" : [ "ORG" ]
} ]
} ]
} ]
} ]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"ublVersion" : "2.3",
"sdkVersion" : "1.10.0",
"metadataDatabase" : {
"version" : "1.10.0",
"createdOn" : "2023-11-15T14:00:00"
},
"noticeId" : "15",
"metadata" : [ {
"id" : "BT-02-notice",
"contentType" : "field",
"displayType" : "COMBOBOX",
"description" : "Notice Type",
"_label" : "field|name|BT-02-notice",
"readOnly" : true
} ],
"content" : [ {
"id" : "GR-Buyer",
"contentType" : "group",
"displayType" : "SECTION",
"description" : "Contracting Party and Provider related Information",
"_label" : "group|name|GR-Buyer",
"content" : [ {
"id" : "GR-ContractingAuthority",
"contentType" : "group",
"nodeId" : "ND-ContractingParty",
"displayType" : "GROUP",
"description" : "Contracting Party related Information (URL, Legal Type, Contracting Type, Activity, …)",
"_label" : "group|name|ND-ContractingParty",
"_repeatable" : true,
"content" : [ {
"id" : "GR-ContractingAuthority-Buyer",
"contentType" : "group",
"displayType" : "GROUP",
"description" : "Contracting Party related Information (URL, Legal Type, Contracting Type, Activity, …)",
"_label" : "group|name|GR-ContractingAuthority-Buyer",
"content" : [ {
"id" : "OPT-300-Procedure-Buyer",
"contentType" : "field",
"displayType" : "COMBOBOX",
"description" : "Buyer Technical Identifier Reference",
"_label" : "field|name|OPT-300-Procedure-Buyer",
"_idSchemes" : [ "ORG" ]
} ]
} ]
} ]
} ]
}
Loading

0 comments on commit ebf38c1

Please sign in to comment.