diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcCsarHelperImpl.java | 10 | ||||
-rw-r--r-- | src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcTypes.java | 17 |
2 files changed, 19 insertions, 8 deletions
diff --git a/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcCsarHelperImpl.java b/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcCsarHelperImpl.java index c320f63..7b94000 100644 --- a/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcCsarHelperImpl.java +++ b/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcCsarHelperImpl.java @@ -634,13 +634,13 @@ public class SdcCsarHelperImpl implements ISdcCsarHelper { if (sdcType.equals(SdcTypes.VFC) && isVNF) { return nodeTemplates.stream() .filter(x -> (x.getMetaData() != null && - sdcType.toString().equals(x.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_TYPE))) && isVNFType(x)) + sdcType.getValue().equals(x.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_TYPE))) && isVNFType(x)) .collect(Collectors.toList()); } else { return nodeTemplates.stream() .filter(x -> (x.getMetaData() != null && - sdcType.toString().equals(x.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_TYPE))) && !isVNFType(x)) + sdcType.getValue().equals(x.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_TYPE))) && !isVNFType(x)) .collect(Collectors.toList()); } } @@ -706,9 +706,9 @@ public class SdcCsarHelperImpl implements ISdcCsarHelper { } if (nodeTemplate.getMetaData() != null) { - String type = nodeTemplate.getMetaData().getValue("type"); + String type = nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_TYPE); log.debug("hasTopology - node template {} is a {} type", nodeTemplate.getName(), type); - return SdcTypes.isComplex(SdcTypes.valueOf(type)); + return SdcTypes.isComplex(type); } return false; @@ -852,7 +852,7 @@ public class SdcCsarHelperImpl implements ISdcCsarHelper { List<NodeTemplate> nodeTemplates = topologyTemplate.getNodeTemplates(); if (nodeTemplates != null && nodeTemplates.size() > 0) - return nodeTemplates.stream().filter(x -> (x.getMetaData() != null && sdcType.toString().equals(x.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_TYPE)))).collect(Collectors.toList()); + return nodeTemplates.stream().filter(x -> (x.getMetaData() != null && sdcType.getValue().equals(x.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_TYPE)))).collect(Collectors.toList()); log.debug("getNodeTemplateBySdcType - topologyTemplate's nodeTemplates not exist"); return new ArrayList<>(); diff --git a/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcTypes.java b/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcTypes.java index 5dc9101..03d61a6 100644 --- a/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcTypes.java +++ b/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcTypes.java @@ -22,14 +22,25 @@ package org.openecomp.sdc.tosca.parser.impl; import java.util.Arrays; import java.util.List; +import java.util.stream.Collectors; public enum SdcTypes { - CP, VL, VF, VFC, PNF, SERVICE, CVFC, SERVICE_PROXY, CONFIGURATION; + CP("CP"), VL("VL"), VF("VF"), VFC("VFC"), PNF("PNF"), SERVICE("Service"), CVFC("CVFC"), SERVICE_PROXY("Service Proxy"), CONFIGURATION("Configuration"); - public static List<SdcTypes> complexTypes = Arrays.asList(VF, PNF, SERVICE, CVFC); + private String value; - public static boolean isComplex(SdcTypes sdcType) { + private static List<String> complexTypes = Arrays.asList(VF, PNF, SERVICE, CVFC).stream().map(SdcTypes::getValue).collect(Collectors.toList()); + + private SdcTypes(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static boolean isComplex(String sdcType) { return complexTypes.contains(sdcType); } } |