X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-rest-docgen%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Frest%2Fdoc%2Fimpl%2FModelGenerator.java;h=755ca7501582e43651d51046de5a057d5adbe038;hb=0e7b83c0739ac579ca6dbf6a3f7992f70eb3000f;hp=0e929afc8461c5da04bafa6dc44e7c782f83417d;hpb=eda0ef295a7c6aac904da33132885cd86bfcb855;p=controller.git diff --git a/opendaylight/md-sal/sal-rest-docgen/src/main/java/org/opendaylight/controller/sal/rest/doc/impl/ModelGenerator.java b/opendaylight/md-sal/sal-rest-docgen/src/main/java/org/opendaylight/controller/sal/rest/doc/impl/ModelGenerator.java index 0e929afc84..755ca75015 100644 --- a/opendaylight/md-sal/sal-rest-docgen/src/main/java/org/opendaylight/controller/sal/rest/doc/impl/ModelGenerator.java +++ b/opendaylight/md-sal/sal-rest-docgen/src/main/java/org/opendaylight/controller/sal/rest/doc/impl/ModelGenerator.java @@ -15,6 +15,7 @@ import java.util.List; import java.util.Map; import java.util.Set; +import org.apache.commons.lang3.BooleanUtils; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; @@ -249,7 +250,7 @@ public class ModelGenerator { if (node instanceof LeafSchemaNode) { property = processLeafNode((LeafSchemaNode) node); } else if (node instanceof ListSchemaNode) { - property = processListSchemaNode((ListSchemaNode) node, moduleName, models); + property = processListSchemaNode((ListSchemaNode) node, moduleName, models, isConfig); } else if (node instanceof LeafListSchemaNode) { property = processLeafListNode((LeafListSchemaNode) node); @@ -354,15 +355,17 @@ public class ModelGenerator { * * @param listNode * @param moduleName + * @param isConfig * @return * @throws JSONException * @throws IOException */ private JSONObject processListSchemaNode(ListSchemaNode listNode, String moduleName, - JSONObject models) throws JSONException, IOException { + JSONObject models, Boolean isConfig) throws JSONException, IOException { Set listChildren = listNode.getChildNodes(); - String fileName = listNode.getQName().getLocalName(); + String fileName = (BooleanUtils.isNotFalse(isConfig)?OperationBuilder.CONFIG:OperationBuilder.OPERATIONAL) + + listNode.getQName().getLocalName(); JSONObject childSchemaProperties = processChildren(listChildren, moduleName, models); JSONObject childSchema = getSchemaTemplate(); @@ -541,12 +544,15 @@ public class ModelGenerator { private void processUnionType(UnionTypeDefinition unionType, JSONObject property) throws JSONException { - List> unionTypes = unionType.getTypes(); - JSONArray unionArray = new JSONArray(); - for (TypeDefinition typeDef : unionTypes) { - unionArray.put(YANG_TYPE_TO_JSON_TYPE_MAPPING.get(typeDef.getClass())); + StringBuilder type = new StringBuilder(); + for (TypeDefinition typeDef : unionType.getTypes() ) { + if( type.length() > 0 ){ + type.append( " or " ); + } + type.append(YANG_TYPE_TO_JSON_TYPE_MAPPING.get(typeDef.getClass())); } - property.put(TYPE_KEY, unionArray); + + property.put(TYPE_KEY, type ); } /**