Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,11 @@ private void processDatastructures(JsonNode dataStructures, SdmxBeansImpl beans)
for (DataStructureDTO.Group groupDto : dataStructureDto.dataStructureComponents.groups) {
GroupMutableBean group = new GroupMutableBeanImpl();
group.setId(groupDto.id);
group.setDimensionRef(new ArrayList<>(groupDto.groupDimensions.length));

for (String groupDimension : groupDto.groupDimensions)
for (String groupDimension : groupDto.groupDimensions) {
group.getDimensionRef().add(groupDimension);
}
structureMutableObject.addGroup(group);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,21 @@ public void shouldBuildSdmxBeans() {
assertThat(contentConstraint.getAnnotations().size()).isEqualTo(1);
}

@Test
public void shouldBuildSdmxBeans_dataStructure() {
ReadableDataLocation fileReadableDataLocation = new ReadableDataLocationTmp("src/test/resources/json/datastructure.json");
SdmxBeans beans;

try (InputStream stream = fileReadableDataLocation.getInputStream()) {
ObjectMapper mapper = new ObjectMapper();
JsonNode node = mapper.readTree(stream);
beans = sdmxObjectsJsonV1Builder.build(node);
beans.getDataflows();
} catch (IOException e) {
throw new RuntimeException(e);
}

assertThat(beans.getDataStructures()).isNotEmpty();
assertThat(beans.getDataStructures().size()).isEqualTo(1);
}
}
118 changes: 118 additions & 0 deletions SdmxStructureParser/src/test/resources/json/datastructure.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
{
"meta": {},
"data": {
"dataStructures": [
{
"annotations": [
{
"texts": {
"en": "text"
},
"id": "1",
"text": "text",
"type": "type1"
}
],
"description": "Some artefact",
"agencyID": "QH",
"descriptions": {
"en": "Some artefact"
},
"version": "1.2",
"names": {
"en": "Maintanable artefact",
"fr-CA": "artefact"
},
"dataStructureComponents": {
"groups": [
{
"id": "GROUP1",
"groupDimensions": [
"DIM1"
]
}
],
"attributeList": {
"attributes": [
{
"assignmentStatus": "Conditional",
"conceptIdentity": "urn:sdmx:org.sdmx.infomodel.conceptscheme.Concept=QH:ADVANCED_RELEASE_CALANDER_DIAGNOSTICS_COLLECTION_SCHEME(1.5.1).DATE_VALUE",
"attributeRelationship": {
"dimensions": [
"DIM1"
],
"attachmentGroups": [
"GROUP1"
]
},
"localRepresentation": {
"textFormat": {
"textType": "AlphaNumeric"
}
},
"conceptRoles": [
"urn:sdmx:org.sdmx.infomodel.conceptscheme.Concept=QH:ADVANCED_RELEASE_CALANDER(1.5.1).DATE_VALUE",
"urn:sdmx:org.sdmx.infomodel.conceptscheme.Concept=QH:ADVANCED_RELEASE_CALANDER_DIAGNOSTICS(1.5.2).DATE_VALUE"
],
"id": "DA1"
}
],
"id": "AttributeDescriptor"
},
"dimensionList": {
"timeDimensions": [
{
"conceptIdentity": "urn:sdmx:org.sdmx.infomodel.conceptscheme.Concept=QH:TIME_DIMENSION(1.6.1).DATE_VALUE",
"localRepresentation": {
"textFormat": {
"textType": "BasicTimePeriod"
}
},
"id": "TIME_PERIOD",
"position": 2,
"type": "TimeDimension"
}
],
"id": "DimensionDescriptor",
"dimensions": [
{
"conceptIdentity": "urn:sdmx:org.sdmx.infomodel.conceptscheme.Concept=QH:DIMENSION(1.6.1).DATE_VALUE",
"localRepresentation": {
"enumeration": "urn:sdmx:org.sdmx.infomodel.codelist.Codelist=QH:CODELIST(1.0)"
},
"conceptRoles": [
"urn:sdmx:org.sdmx.infomodel.conceptscheme.Concept=QH:ADVANCED_RELEASE_CALANDER(1.5.1).DATE_VALUE"
],
"id": "DIM1",
"position": 1,
"type": "Dimension"
}
]
},
"measureList": {
"primaryMeasure": {
"conceptIdentity": "urn:sdmx:org.sdmx.infomodel.conceptscheme.Concept=QH:MEASURE(1.5.2).DATE_VALUE",
"localRepresentation": {
"textFormat": {
"textType": "BasicTimePeriod"
}
},
"id": "MES1"
},
"id": "MeasureDescriptor"
}
},
"name": "Maintanable artefact",
"links": [
{
"urn": "urn:sdmx:org.sdmx.infomodel.datastructure.DataStructure=QH:ARTEFACT(1.2)",
"rel": "self",
"type": "datastructure"
}
],
"id": "ARTEFACT",
"isFinal": true
}
]
}
}