private DataSchemaNode findFirstSchemaForNode(Node<?> node, Set<DataSchemaNode> dataSchemaNode) {
for (DataSchemaNode dsn : dataSchemaNode) {
- if (node.getNodeType().getLocalName().equals(dsn.getQName().getLocalName())) {
+ if (node.getNodeType().equals(dsn.getQName())) {
return dsn;
} else if (dsn instanceof ChoiceNode) {
for (ChoiceCaseNode choiceCase : ((ChoiceNode) dsn).getCases()) {
+ baseType.getClass().getSimpleName() + ".");
}
- // TODO check InstanceIdentifierTypeDefinition
if (baseType instanceof IdentityrefTypeDefinition) {
if (node.getValue() instanceof QName) {
IdentityValuesDTO valueDTO = (IdentityValuesDTO) RestCodec.from(baseType, mountPoint).serialize(
result.append("/");
writeModuleNameAndIdentifier(result, identityValue);
- if (identityValue.getPredicates() != null) {
+ if (identityValue.getPredicates() != null && !identityValue.getPredicates().isEmpty()) {
for (Predicate predicate : identityValue.getPredicates()) {
IdentityValue identityValuePredicate = predicate.getName();
result.append("[");
- writeModuleNameAndIdentifier(result, identityValuePredicate);
- result.append("=\"");
+ if (identityValuePredicate == null) {
+ result.append(".");
+ } else {
+ writeModuleNameAndIdentifier(result, identityValuePredicate);
+ }
+ result.append("='");
result.append(predicate.getValue());
- result.append("\"");
+ result.append("'");
result.append("]");
}
}
String nameForOutput = node.getNodeType().getLocalName();
if (schema.isAugmenting()) {
ControllerContext contContext = ControllerContext.getInstance();
- CharSequence moduleName;
- moduleName = contContext.toRestconfIdentifier(schema.getQName());
+ CharSequence moduleName = null;
+ if (mountPoint == null) {
+ moduleName = contContext.toRestconfIdentifier(schema.getQName());
+ } else {
+ moduleName = contContext.toRestconfIdentifier(mountPoint, schema.getQName());
+ }
if (moduleName != null) {
nameForOutput = moduleName.toString();
+ } else {
+ logger.info("Module '{}' was not found in schema from mount point", schema.getQName());
}
}
writer.name(nameForOutput);