- private String getLocalNameFrom(String jsonElementName) {
- int indexOfDelimeter = jsonElementName.lastIndexOf(':');
- if (indexOfDelimeter == -1) {
- return jsonElementName;
+ private static String getLocalNameFor(final String jsonElementName) {
+ final Iterator<String> it = COLON_SPLITTER.split(jsonElementName).iterator();
+
+ // The string needs to me in form "moduleName:localName"
+ final String ret = Iterators.get(it, 1, null);
+ return ret != null && !it.hasNext() ? ret : jsonElementName;
+ }
+
+ private static Object resolveValueOfElement(final String value) {
+ // it could be instance-identifier Built-In Type
+ if (!value.isEmpty() && value.charAt(0) == '/') {
+ IdentityValuesDTO resolvedValue = RestUtil.asInstanceIdentifier(value, new PrefixMapingFromJson());
+ if (resolvedValue != null) {
+ return resolvedValue;
+ }
+ }
+
+ // it could be identityref Built-In Type
+ URI namespace = getNamespaceFor(value);
+ if (namespace != null) {
+ return new IdentityValuesDTO(namespace.toString(), getLocalNameFor(value), null,value);