diff options
4 files changed, 46 insertions, 20 deletions
diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/service/base/BlueprintHelperService.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/service/base/BlueprintHelperService.java index c9759d0..0526f48 100644 --- a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/service/base/BlueprintHelperService.java +++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/service/base/BlueprintHelperService.java @@ -32,8 +32,8 @@ import java.util.LinkedHashMap; /** * @author : Ravi Mantena - * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAp - * and DCAE Blueprint Applications Service: An interface for Common Functions used across Blueprint + * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAp and DCAE Blueprint + * Applications Service: An interface for Common Functions used across Blueprint */ @Service public class BlueprintHelperService { @@ -41,8 +41,8 @@ public class BlueprintHelperService { /** * creates Input value by contatinating Type, Description and Default value * - * @param type Input Type - * @param description Description + * @param type Input Type + * @param description Description * @param defaultValue Default value of Type * @return */ @@ -58,7 +58,7 @@ public class BlueprintHelperService { /** * creates Input value by contatinating Type and Description * - * @param type Input Type + * @param type Input Type * @param description Description * @return */ @@ -72,7 +72,7 @@ public class BlueprintHelperService { /** * creates Input value by contatinating Type and Default value * - * @param type Input Type + * @param type Input Type * @param defaultValue Default value of Type * @return */ @@ -86,7 +86,7 @@ public class BlueprintHelperService { /** * creates Input value by contatinating Description and Default value * - * @param description Description + * @param description Description * @param defaultValue Default value of Type * @return */ @@ -118,7 +118,7 @@ public class BlueprintHelperService { /** * creates Integer Input value for given Description and Default value * - * @param description Description + * @param description Description * @param defaultValue Default value of Type * @return */ @@ -149,7 +149,8 @@ public class BlueprintHelperService { /** * creates String Input value for given Default value - * @param description Description + * + * @param description Description * @param defaultValue Default value of Type * @return */ @@ -173,9 +174,30 @@ public class BlueprintHelperService { } /** + * creates proper Input for given inputType and defaultValue. + * <p> + * Default input type: "string". + * + * @param inputType Input type, supported: "boolean", "integer" + * @param defaultValue Default value of Type + * @return + */ + public LinkedHashMap<String, Object> createInputByType(String inputType, Object defaultValue) { + switch (inputType) { + case "boolean": + return createBooleanInput(defaultValue); + case "integer": + return createIntegerInput(defaultValue); + default: + return createStringInput(defaultValue); + } + } + + + /** * Concatenates String Input values with Underscore * - * @param firstValue Value + * @param firstValue Value * @param secondValue Value * @return */ diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/AppConfigService.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/AppConfigService.java index da70511..b31fc49 100644 --- a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/AppConfigService.java +++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/AppConfigService.java @@ -43,8 +43,7 @@ import java.util.TreeMap; /** * @author : Ravi Mantena - * @date 10/16/2020 Application: ONAP - Blueprint Generator Common ONAP Service used to create App - * Config + * @date 10/16/2020 Application: ONAP - Blueprint Generator Common ONAP Service used to create App Config */ @Service("onapAppConfigService") public class AppConfigService { @@ -60,12 +59,12 @@ public class AppConfigService { /** - * Creates Inputs section under App Config with Publishes, Subscribes, Parameters sections by - * checking Datarouter/MessageRouter/override/Dmaap values + * Creates Inputs section under App Config with Publishes, Subscribes, Parameters sections by checking + * Datarouter/MessageRouter/override/Dmaap values * - * @param inputs Inputs + * @param inputs Inputs * @param onapComponentSpec Onap Component Specification - * @param isDmaap Dmaap Argument + * @param isDmaap Dmaap Argument * @return */ public Map<String, Object> createAppconfig( @@ -95,8 +94,7 @@ public class AppConfigService { paramInput.setBpInputName(pName); parameters.put(pName, paramInput); if (!"".equals(p.getValue())) { - LinkedHashMap<String, Object> pInputs = - blueprintHelperService.createStringInput(p.getValue()); + LinkedHashMap<String, Object> pInputs = createInputFromParameter(p); inputs.put(pName, pInputs); } else { LinkedHashMap<String, Object> pInputs = new LinkedHashMap<>(); @@ -124,4 +122,9 @@ public class AppConfigService { return response; } + private LinkedHashMap<String, Object> createInputFromParameter(Parameters parameter) { + String inputType = parameter.getType() == null ? "string" : parameter.getType(); + + return blueprintHelperService.createInputByType(inputType, parameter.getValue()); + } } diff --git a/mod/onboardingapi/dcae_cli/_version.py b/mod/onboardingapi/dcae_cli/_version.py index cc7b983..7081b3b 100644 --- a/mod/onboardingapi/dcae_cli/_version.py +++ b/mod/onboardingapi/dcae_cli/_version.py @@ -19,4 +19,4 @@ # ECOMP is a trademark and service mark of AT&T Intellectual Property. # -*- coding: utf-8 -*- -__version__ = "2.12.3" +__version__ = "2.12.4" diff --git a/mod/onboardingapi/pom.xml b/mod/onboardingapi/pom.xml index e8f97a0..796816f 100644 --- a/mod/onboardingapi/pom.xml +++ b/mod/onboardingapi/pom.xml @@ -3,6 +3,7 @@ ================================================================================ Copyright (c) 2017-2020 AT&T Intellectual Property. All rights reserved. Copyright 2020 Deutsche Telekom. All rights reserved. +Copyright 2021 Nokia All rights reserved. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -23,7 +24,7 @@ limitations under the License. <groupId>org.onap.dcaegen2.platform.mod</groupId> <artifactId>dcaegen2-platform-mod-onboardingapi</artifactId> <name>dcaegen2-platform-mod-onboardingapi</name> - <version>2.12.3-SNAPSHOT</version> + <version>2.12.4-SNAPSHOT</version> <url>http://maven.apache.org</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |