Skip to content

Commit

Permalink
Merge pull request #67 from aodn/fix-ardc-bug
Browse files Browse the repository at this point in the history
Fix ARDC bug
  • Loading branch information
utas-raymondng authored Apr 29, 2024
2 parents 6273eaa + e2615f3 commit f912355
Showing 1 changed file with 16 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import au.org.aodn.ardcvocabs.model.CategoryVocabModel;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.fasterxml.jackson.databind.node.TextNode;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.client.RestClientException;
Expand Down Expand Up @@ -125,14 +126,22 @@ public List<CategoryVocabModel> getParameterCategory(String vocabApiBase) {
log.debug("Processing label {}", label.apply(j));
if (j.has("broader")) {
for (JsonNode b : j.get("broader")) {
if (b.has("prefLabel") && b.has("_about")) {
CategoryVocabModel c = CategoryVocabModel
.builder()
.about(about.apply(b))
.label(label.apply(b))
CategoryVocabModel c = null;
if (b instanceof ObjectNode objectNode) {
if (objectNode.has("prefLabel") && objectNode.has("_about")) {
c = CategoryVocabModel
.builder()
.about(about.apply(b))
.label(label.apply(b))
.build();
}
}
if (b instanceof TextNode textNode && textNode.asText().contains("parameter_classes")) {
c = CategoryVocabModel.builder()
.about(textNode.asText())
.build();
broader.add(c);
}
broader.add(c);
}
}

Expand Down Expand Up @@ -185,6 +194,7 @@ public List<CategoryVocabModel> getParameterCategory(String vocabApiBase) {
url = null;
}
}

return result;
}
}

0 comments on commit f912355

Please sign in to comment.