diff options
author | Liang.Ding <liang.ding@intel.com> | 2019-03-15 08:16:42 +0000 |
---|---|---|
committer | Liang Ding <liang.ding@intel.com> | 2019-04-08 09:22:25 -0700 |
commit | ef6ec63b05fb93adef0edb392b0a33de97203876 (patch) | |
tree | 0d5b69950f8fd5e8a023b557c07a862b581da539 /catalog-be/src/main/java | |
parent | 06e8b70cb9cdbcc131a183f3a85a95b513d2b2f1 (diff) |
show cloud specific artifacts IDs in vf module meta
Change-Id: I42c54b2b94513c1dd69c3ec662a05a71a89fd3d0
Issue-ID: SDC-2041
Signed-off-by: Liang.Ding <liang.ding@intel.com>
Diffstat (limited to 'catalog-be/src/main/java')
-rw-r--r-- | catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java index d9a0c46fa9..1eb50e846a 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java @@ -95,6 +95,7 @@ import org.openecomp.sdc.common.util.ValidationUtils; import org.openecomp.sdc.exception.ResponseFormat; import org.springframework.beans.factory.annotation.Autowired; +import java.util.Arrays; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -118,6 +119,9 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { private static final Logger log = Logger.getLogger(ComponentInstanceBusinessLogic.class.getName()); private static final String VF_MODULE = "org.openecomp.groups.VfModule"; public static final String TRY_TO_CREATE_ENTRY_ON_GRAPH = "Try to create entry on graph"; + private static final String CLOUD_SPECIFIC_FIXED_KEY_WORD = "cloudtech"; + private static final String[][] CLOUD_SPECIFIC_KEY_WORDS = {{"k8s", "azure", "aws"}, /* cloud specific technology */ + {"charts", "day0", "configtemplate"} /*cloud specific sub type*/}; public static final String FAILED_TO_CREATE_ENTRY_ON_GRAPH_FOR_COMPONENT_INSTANCE = "Failed to create entry on graph for component instance {}"; public static final String ENTITY_ON_GRAPH_IS_CREATED = "Entity on graph is created."; public static final String INVALID_COMPONENT_TYPE = "invalid component type"; @@ -489,6 +493,20 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { return resultOp; } + public boolean isCloudSpecificArtifact(String artifact) { + if (artifact.contains(CLOUD_SPECIFIC_FIXED_KEY_WORD)) { + for (int i = 0; i < CLOUD_SPECIFIC_KEY_WORDS.length; i++) { + if (Arrays.stream(CLOUD_SPECIFIC_KEY_WORDS[i]).noneMatch(str -> artifact.contains(str))) { + return false; + } + } + return true; + } else { + return false; + } + } + + /** * addResourceInstanceArtifacts - add artifacts (HEAT_ENV) to resource instance The instance artifacts are generated from the resource's artifacts * @param containerComponent @@ -520,7 +538,7 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { if (!type.equalsIgnoreCase(ArtifactTypeEnum.HEAT_ENV.getType())) { finalDeploymentArtifacts.put(artifact.getArtifactLabel(), artifact); } - if (!(type.equalsIgnoreCase(ArtifactTypeEnum.HEAT.getType()) || type.equalsIgnoreCase(ArtifactTypeEnum.HEAT_NET.getType()) || type.equalsIgnoreCase(ArtifactTypeEnum.HEAT_VOL.getType()))) { + if (!(type.equalsIgnoreCase(ArtifactTypeEnum.HEAT.getType()) || type.equalsIgnoreCase(ArtifactTypeEnum.HEAT_NET.getType()) || type.equalsIgnoreCase(ArtifactTypeEnum.HEAT_VOL.getType()) || type.equalsIgnoreCase(ArtifactTypeEnum.CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT.getType()))) { continue; } if (artifact.checkEsIdExist()) { @@ -550,6 +568,10 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { groupInstancesArtifacts.put(groupInstance.getUniqueId(), artifactsUid); break; } + + if (isCloudSpecificArtifact(artifactDefinition.getArtifactName())) { + groupInstance.getArtifacts().add(artifactDefinition.getGeneratedFromId()); + } } } } |