Code Review
/
controller.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Finding data nodes in choices and cases.
[controller.git]
/
opendaylight
/
md-sal
/
sal-rest-connector
/
src
/
main
/
java
/
org
/
opendaylight
/
controller
/
sal
/
rest
/
impl
/
JsonMapper.java
diff --git
a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/JsonMapper.java
b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/JsonMapper.java
index 351ae6ebbee085614943d7608ec51669a204f1ff..9608d65e41ca82a13e2dada78b5ce5dfeb0728e7 100644
(file)
--- a/
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/JsonMapper.java
+++ b/
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/JsonMapper.java
@@
-49,6
+49,7
@@
class JsonMapper {
for (Node<?> child : parent.getChildren()) {
DataSchemaNode childSchema = findFirstSchemaForNode(child, parentSchema.getChildNodes());
for (Node<?> child : parent.getChildren()) {
DataSchemaNode childSchema = findFirstSchemaForNode(child, parentSchema.getChildNodes());
+
if (childSchema == null) {
throw new UnsupportedDataTypeException("Probably the data node \"" + child.getNodeType().getLocalName()
+ "\" is not conform to schema");
if (childSchema == null) {
throw new UnsupportedDataTypeException("Probably the data node \"" + child.getNodeType().getLocalName()
+ "\" is not conform to schema");
@@
-96,6
+97,13
@@
class JsonMapper {
for (DataSchemaNode dsn : dataSchemaNode) {
if (node.getNodeType().getLocalName().equals(dsn.getQName().getLocalName())) {
return dsn;
for (DataSchemaNode dsn : dataSchemaNode) {
if (node.getNodeType().getLocalName().equals(dsn.getQName().getLocalName())) {
return dsn;
+ } else if (dsn instanceof ChoiceNode) {
+ for (ChoiceCaseNode choiceCase : ((ChoiceNode) dsn).getCases()) {
+ DataSchemaNode foundDsn = findFirstSchemaForNode(node, choiceCase.getChildNodes());
+ if (foundDsn != null) {
+ return foundDsn;
+ }
+ }
}
}
return null;
}
}
return null;