summaryrefslogtreecommitdiffstats
path: root/catalog-be/src/main/java
diff options
context:
space:
mode:
authorMichaelMorris <michael.morris@est.tech>2023-05-18 15:15:27 +0100
committerMichaelMorris <michael.morris@est.tech>2023-05-18 15:15:31 +0100
commit89b4860dbd57fb1a11fc30397a08e316e793572d (patch)
tree947f2898b247eae74864ff86bdf3ae0fa75dfa38 /catalog-be/src/main/java
parentbc7dd3ad94acace55a2910abc22cc5cb64e0862d (diff)
Fix error importimg service with custom fns
Signed-off-by: MichaelMorris <michael.morris@est.tech> Issue-ID: SDC-4507 Change-Id: I412e411a6d19cfb83d92c0d1184de8a69f75b42f
Diffstat (limited to 'catalog-be/src/main/java')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/ToscaFunctionYamlParsingHandler.java9
1 files changed, 5 insertions, 4 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/ToscaFunctionYamlParsingHandler.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/ToscaFunctionYamlParsingHandler.java
index 0651e3504e..80608a82db 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/ToscaFunctionYamlParsingHandler.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/ToscaFunctionYamlParsingHandler.java
@@ -28,6 +28,8 @@ import java.util.Objects;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;
+
+import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.openecomp.sdc.be.config.Configuration;
import org.openecomp.sdc.be.config.ConfigurationManager;
@@ -193,12 +195,11 @@ public class ToscaFunctionYamlParsingHandler {
}
private Optional<ToscaFunction> handelCustomFunctionGetInputType(ToscaCustomFunction toscaCustomFunction, Object functionValueObj) {
- if (!(functionValueObj instanceof String)) {
+ if (!(functionValueObj instanceof String) && !(functionValueObj instanceof List)) {
return Optional.empty();
}
- final String parameter = (String) functionValueObj;
Map<String, Object> parameterMap = new HashMap<>();
- parameterMap.put(ToscaFunctionType.GET_INPUT.getName(), parameter);
+ parameterMap.put(ToscaFunctionType.GET_INPUT.getName(), functionValueObj);
buildToscaFunctionBasedOnPropertyValue(parameterMap).ifPresent(toscaFunction -> {
if (toscaFunction instanceof ToscaFunctionParameter) {
toscaCustomFunction.addParameter((ToscaFunctionParameter) toscaFunction);
@@ -210,7 +211,7 @@ public class ToscaFunctionYamlParsingHandler {
private ToscaFunctionType getCustomFunctionType(String name) {
List<Configuration.CustomToscaFunction> customFunctions =
ConfigurationManager.getConfigurationManager().getConfiguration().getDefaultCustomToscaFunctions();
- if (customFunctions.isEmpty()) {
+ if (CollectionUtils.isEmpty(customFunctions)) {
return ToscaFunctionType.CUSTOM;
}
Optional<Configuration.CustomToscaFunction> optionalFunc = customFunctions.stream().filter(func -> func.getName().equals(name)).findFirst();