X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-rest-connector%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Frestconf%2Fimpl%2FRestCodec.java;h=265cc5db4536c96ecbf51bf4005ff4ced54e8c14;hb=83e1c610eeefba667a19c243fbc1098072a8079d;hp=d6b530039eb681cf831956b9e61a83aad106ac64;hpb=50ba46d50cbe1a040e67aa38da1903c81089facb;p=controller.git diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/RestCodec.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/RestCodec.java index d6b530039e..265cc5db45 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/RestCodec.java +++ b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/RestCodec.java @@ -41,7 +41,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class RestCodec { - + private static final Logger logger = LoggerFactory.getLogger(RestCodec.class); private RestCodec() { @@ -89,6 +89,9 @@ public class RestCodec { input == null ? "null" : input.getClass(), String.valueOf(input)); return null; } else if (type instanceof LeafrefTypeDefinition) { + if (input instanceof IdentityValuesDTO) { + return LEAFREF_DEFAULT_CODEC.deserialize(((IdentityValuesDTO)input).getOriginValue()); + } return LEAFREF_DEFAULT_CODEC.deserialize(input); } else if (type instanceof InstanceIdentifierTypeDefinition) { if (input instanceof IdentityValuesDTO) { @@ -102,6 +105,9 @@ public class RestCodec { TypeDefinitionAwareCodec> typeAwarecodec = TypeDefinitionAwareCodec .from(type); if (typeAwarecodec != null) { + if (input instanceof IdentityValuesDTO) { + return typeAwarecodec.deserialize(((IdentityValuesDTO)input).getOriginValue()); + } return typeAwarecodec.deserialize(String.valueOf(input)); } else { logger.debug("Codec for type \"" + type.getQName().getLocalName() @@ -162,7 +168,7 @@ public class RestCodec { @Override public IdentityValuesDTO serialize(QName data) { - return new IdentityValuesDTO(data.getNamespace().toString(), data.getLocalName(), data.getPrefix()); + return new IdentityValuesDTO(data.getNamespace().toString(), data.getLocalName(), data.getPrefix(),null); } @Override @@ -174,7 +180,7 @@ public class RestCodec { logger.info("Idenetityref will be translated as NULL for data - {}", String.valueOf(valueWithNamespace)); return null; } - + return QName.create(module.getNamespace(), module.getRevision(), valueWithNamespace.getValue()); } @@ -286,7 +292,7 @@ public class RestCodec { } } } - + return result.isEmpty() ? null : new InstanceIdentifier(result); } @@ -306,7 +312,7 @@ public class RestCodec { return null; } } - + private static Module getModuleByNamespace(String namespace, MountInstance mountPoint) { URI validNamespace = resolveValidNamespace(namespace, mountPoint); @@ -322,7 +328,7 @@ public class RestCodec { } return module; } - + private static URI resolveValidNamespace(String namespace, MountInstance mountPoint) { URI validNamespace; if (mountPoint != null) {