package org.opendaylight.controller.sal.rest.doc.impl;
import static org.opendaylight.controller.sal.rest.doc.util.RestDocgenUtil.resolvePathArgumentsName;
package org.opendaylight.controller.sal.rest.doc.impl;
import static org.opendaylight.controller.sal.rest.doc.util.RestDocgenUtil.resolvePathArgumentsName;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.jsonorg.JsonOrgModule;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.jsonorg.JsonOrgModule;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
protected static final String API_VERSION = "1.0.0";
protected static final String SWAGGER_VERSION = "1.2";
protected static final String API_VERSION = "1.0.0";
protected static final String SWAGGER_VERSION = "1.2";
for (Module module : modules) {
String revisionString = SIMPLE_DATE_FORMAT.format(module.getRevision());
Resource resource = new Resource();
for (Module module : modules) {
String revisionString = SIMPLE_DATE_FORMAT.format(module.getRevision());
Resource resource = new Resource();
- _logger.debug("Working on [{},{}]...", module.getName(), revisionString);
+ LOG.debug("Working on [{},{}]...", module.getName(), revisionString);
ApiDeclaration doc = getApiDeclaration(module.getName(), revisionString, uriInfo, schemaContext, context);
if (doc != null) {
resource.setPath(generatePath(uriInfo, module.getName(), revisionString));
resources.add(resource);
} else {
ApiDeclaration doc = getApiDeclaration(module.getName(), revisionString, uriInfo, schemaContext, context);
if (doc != null) {
resource.setPath(generatePath(uriInfo, module.getName(), revisionString));
resources.add(resource);
} else {
- _logger.debug("Could not generate doc for {},{}", module.getName(), revisionString);
+ LOG.debug("Could not generate doc for {},{}", module.getName(), revisionString);
public ApiDeclaration getApiDeclaration(String module, String revision, UriInfo uriInfo, SchemaContext schemaContext, String context) {
Date rev = null;
public ApiDeclaration getApiDeclaration(String module, String revision, UriInfo uriInfo, SchemaContext schemaContext, String context) {
Date rev = null;
Module m = schemaContext.findModuleByName(module, rev);
Preconditions.checkArgument(m != null, "Could not find module by name,revision: " + module + "," + revision);
Module m = schemaContext.findModuleByName(module, rev);
Preconditions.checkArgument(m != null, "Could not find module by name,revision: " + module + "," + revision);
List<Api> apis = new ArrayList<Api>();
Collection<DataSchemaNode> dataSchemaNodes = m.getChildNodes();
List<Api> apis = new ArrayList<Api>();
Collection<DataSchemaNode> dataSchemaNodes = m.getChildNodes();
for (DataSchemaNode node : dataSchemaNodes) {
if ((node instanceof ListSchemaNode) || (node instanceof ContainerSchemaNode)) {
for (DataSchemaNode node : dataSchemaNodes) {
if ((node instanceof ListSchemaNode) || (node instanceof ContainerSchemaNode)) {
- _logger.debug("Is Configuration node [{}] [{}]", node.isConfiguration(), node.getQName().getLocalName());
+ LOG.debug("Is Configuration node [{}] [{}]", node.isConfiguration(), node.getQName().getLocalName());
List<Parameter> pathParams = new ArrayList<Parameter>();
String resourcePath = getDataStorePath("/config/", context);
List<Parameter> pathParams = new ArrayList<Parameter>();
String resourcePath = getDataStorePath("/config/", context);
addRpcs(rpcDefinition, apis, resourcePath, schemaContext);
}
addRpcs(rpcDefinition, apis, resourcePath, schemaContext);
}
List<Parameter> pathParams = new ArrayList<Parameter>(parentPathParams);
String resourcePath = parentPath + createPath(node, pathParams, schemaContext) + "/";
List<Parameter> pathParams = new ArrayList<Parameter>(parentPathParams);
String resourcePath = parentPath + createPath(node, pathParams, schemaContext) + "/";
api.setPath(resourcePath);
Iterable<DataSchemaNode> childSchemaNodes = Collections.<DataSchemaNode> emptySet();
api.setPath(resourcePath);
Iterable<DataSchemaNode> childSchemaNodes = Collections.<DataSchemaNode> emptySet();
- public int compare(Module o1, Module o2) {
- int result = o1.getName().compareTo(o2.getName());
+ public int compare(Module module1, Module module2) {
+ int result = module1.getName().compareTo(module2.getName());
- result = o1.getRevision().compareTo(o2.getRevision());
+ Date module1Revision = module1.getRevision() != null ? module1.getRevision() : new Date(0);
+ Date module2Revision = module2.getRevision() != null ? module2.getRevision() : new Date(0);
+ result = module1Revision.compareTo(module2Revision);