Skip to content

Commit

Permalink
fix: comment as arrays processing
Browse files Browse the repository at this point in the history
  • Loading branch information
kshychko committed Jul 25, 2024
1 parent ed000c4 commit bdf75d2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion jsonld-utility/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>org.unece.uncefact</groupId>
<artifactId>vocab-jsonld-utility</artifactId>
<version>1.6.2</version>
<version>1.6.3</version>
<build>
<plugins>
<plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import org.unece.uncefact.vocab.FileGenerator;

import jakarta.json.*;
import jakarta.json.JsonValue.ValueType;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
Expand Down Expand Up @@ -760,7 +762,11 @@ else if (comment instanceof JsonArray){
JsonObjectBuilder mdCodeListValue = Json.createObjectBuilder();
mdCodeListValue.add("uri",jsonObject.getString(Constants.ID));
if(jsonObject.containsKey(Constants.RDFS_COMMENT)){
mdCodeListValue.add("comment",jsonObject.getString(Constants.RDFS_COMMENT));
if (jsonObject.getValueType() == ValueType.ARRAY) {
mdCodeListValue.add("comment",jsonObject.getJsonArray(Constants.RDFS_COMMENT));
} else if (jsonObject.getValueType() == ValueType.STRING) {
mdCodeListValue.add("comment",jsonObject.getString(Constants.RDFS_COMMENT));
}
} else{
mdCodeListValue.add("comment","");
}
Expand All @@ -773,7 +779,11 @@ else if (comment instanceof JsonArray){
batchFieldsObject = Json.createObjectBuilder();
batchFieldsObject.add("label", StringUtils.substringAfter(jsonObject.getString(Constants.ID), ":"));
if(jsonObject.containsKey(Constants.RDFS_COMMENT)){
batchFieldsObject.add("comment", jsonObject.getString(Constants.RDFS_COMMENT));
if (jsonObject.getValueType() == ValueType.ARRAY) {
batchFieldsObject.add("comment",jsonObject.getJsonArray(Constants.RDFS_COMMENT));
} else if (jsonObject.getValueType() == ValueType.STRING) {
batchFieldsObject.add("comment",jsonObject.getString(Constants.RDFS_COMMENT));
}
} else{
batchFieldsObject.add("comment", "");
}
Expand Down

0 comments on commit bdf75d2

Please sign in to comment.