From 62a2e1dc1c376895ee6fcbc819a1a0010199e58d Mon Sep 17 00:00:00 2001 From: Sandeep J Date: Fri, 30 Nov 2018 17:57:02 +0530 Subject: fixed sonar issues in SwaggerGenerator.java fixed sonar issues Issue-ID: CCSDK-525 Change-Id: I50b6b8ac8676294f70be1a98755e0069dd489b5a Signed-off-by: Sandeep J --- .../service/common/SwaggerGenerator.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/common/SwaggerGenerator.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/common/SwaggerGenerator.java index 81f7d701..77de8e7c 100644 --- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/common/SwaggerGenerator.java +++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/common/SwaggerGenerator.java @@ -1,5 +1,6 @@ /* * Copyright © 2017-2018 AT&T Intellectual Property. + * Modifications Copyright © 2018 IBM. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,6 +41,7 @@ import java.util.*; public class SwaggerGenerator { private ServiceTemplate serviceTemplate; + public static final String INPUTS="inputs"; /** * This is a SwaggerGenerator constructor @@ -54,8 +56,7 @@ public class SwaggerGenerator { * @return String */ public String generateSwagger() { - String swaggerContent = null; - + Swagger swagger = new Swagger().info(getInfo()); swagger.setPaths(getPaths()); @@ -86,7 +87,7 @@ public class SwaggerGenerator { List parameters = new ArrayList<>(); Parameter in = new BodyParameter().schema(new RefModel("#/definitions/inputs")); in.setRequired(true); - in.setName("inputs"); + in.setName(INPUTS); parameters.add(in); post.setParameters(parameters); @@ -107,18 +108,17 @@ public class SwaggerGenerator { Map models = new HashMap<>(); ModelImpl inputmodel = new ModelImpl(); - inputmodel.setTitle("inputs"); + inputmodel.setTitle(INPUTS); serviceTemplate.getTopologyTemplate().getInputs().forEach((propertyName, property) -> { Property defProperty = getPropery(propertyName, property); inputmodel.property(propertyName, defProperty); }); - models.put("inputs", inputmodel); + models.put(INPUTS, inputmodel); if (MapUtils.isNotEmpty(serviceTemplate.getDataTypes())) { serviceTemplate.getDataTypes().forEach((name, dataType) -> { ModelImpl model = new ModelImpl(); model.setDescription(dataType.getDescription()); - // model.setType("object"); if (dataType != null && MapUtils.isNotEmpty(dataType.getProperties())) { dataType.getProperties().forEach((propertyName, property) -> { -- cgit 1.2.3-korg