- String value = childPrimitive.getAsString();
- SimpleNodeWrapper child = null;
- if (value.equals("[null]")) {
- child = new SimpleNodeWrapper(childName, null);
- } else {
- child = new SimpleNodeWrapper(childName, value);
+ String value = childPrimitive.getAsString().trim();
+ parent.addValue(new SimpleNodeWrapper(getNamespaceFor(childName), getLocalNameFor(childName),
+ resolveValueOfElement(value)));
+ }
+ }
+
+ private URI getNamespaceFor(String jsonElementName) {
+ String[] moduleNameAndLocalName = jsonElementName.split(":");
+ // it is not "moduleName:localName"
+ if (moduleNameAndLocalName.length != 2) {
+ return null;
+ }
+ return URI.create(moduleNameAndLocalName[0]);
+ }
+
+ private String getLocalNameFor(String jsonElementName) {
+ String[] moduleNameAndLocalName = jsonElementName.split(":");
+ // it is not "moduleName:localName"
+ if (moduleNameAndLocalName.length != 2) {
+ return jsonElementName;
+ }
+ return moduleNameAndLocalName[1];
+ }
+
+ private Object resolveValueOfElement(String value) {
+ // it could be instance-identifier Built-In Type
+ if (value.startsWith("/")) {
+ IdentityValuesDTO resolvedValue = RestUtil.asInstanceIdentifier(value, new PrefixMapingFromJson());
+ if (resolvedValue != null) {
+ return resolvedValue;