From 1a5cc6ecb2e1a59c024b1bcd4b86d442e24dc300 Mon Sep 17 00:00:00 2001 From: Michael Lando Date: Thu, 26 Apr 2018 20:08:28 +0300 Subject: Revert "Delete workflow artifact and add artifact to CSAR" This reverts commit d71a8de8c7b688eabb250e524dc4f6000b3233b6. Issue-ID: SDC-1060 Change-Id: I332a6afb8090491b011e3040e94ca2dc47bcc164 Signed-off-by: Michael Lando --- .../jsontitan/operations/ArtifactsOperations.java | 55 ++-------------------- 1 file changed, 3 insertions(+), 52 deletions(-) (limited to 'catalog-model/src/main') diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ArtifactsOperations.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ArtifactsOperations.java index 4782851e26..cbd612d024 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ArtifactsOperations.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ArtifactsOperations.java @@ -21,7 +21,6 @@ package org.openecomp.sdc.be.model.jsontitan.operations; import java.util.ArrayList; -import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -41,16 +40,13 @@ import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition; -import org.openecomp.sdc.be.datatypes.elements.InterfaceDataDefinition; import org.openecomp.sdc.be.datatypes.elements.MapArtifactDataDefinition; -import org.openecomp.sdc.be.datatypes.elements.OperationDataDefinition; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; import org.openecomp.sdc.be.model.ArtifactDefinition; import org.openecomp.sdc.be.model.HeatParameterDefinition; -import org.openecomp.sdc.be.model.InterfaceDefinition; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.DaoStatusConverter; import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder; @@ -92,7 +88,7 @@ public class ArtifactsOperations extends BaseOperation { } - public Either updateArtifactOnResource(ArtifactDefinition artifactInfo, String id, String artifactId, NodeTypeEnum type, String instanceId) { + public Either updateArifactOnResource(ArtifactDefinition artifactInfo, String id, String artifactId, NodeTypeEnum type, String instanceId) { Either status = updateArtifactOnGraph(id, artifactInfo, type, artifactId, instanceId, true, false); if (status.isRight()) { @@ -145,10 +141,6 @@ public class ArtifactsOperations extends BaseOperation { if (foundArtifact == null) { foundArtifact = getArtifactByLabelAndId(parentId, id, EdgeLabelEnum.SERVICE_API_ARTIFACTS); } - if (foundArtifact == null) { - foundArtifact = findInterfaceArtifact(parentId, id); - - } if (foundArtifact == null) { result = Either.right(StorageOperationStatus.NOT_FOUND); @@ -159,47 +151,6 @@ public class ArtifactsOperations extends BaseOperation { return Either.left(artifactDefResult); } - private ArtifactDataDefinition findInterfaceArtifact(String parentId, String id) { - Either, TitanOperationStatus> dataFromGraph = getDataFromGraph(parentId, EdgeLabelEnum.INTERFACE_ARTIFACTS); - if (dataFromGraph.isRight()){ - log.debug("failed to fetch interfaces {} for tosca element with id {}, error {}", id, parentId ,dataFromGraph.right().value()); - return null; - } - - Map interfaceDefinitionMap = dataFromGraph.left().value(); - if(interfaceDefinitionMap == null) { - return null; - } - Collection interfaces = interfaceDefinitionMap.values(); - if (interfaces == null){ - return null; - } - for (InterfaceDataDefinition interfaceDataDefinition : interfaces){ - Map operationsMap = interfaceDataDefinition.getOperations(); - if (operationsMap == null) { - return null; - } - ArtifactDataDefinition implementationArtifact = getArtifactDataDefinition(id, operationsMap); - if (implementationArtifact != null) - return implementationArtifact; - } - return null; - } - - private ArtifactDataDefinition getArtifactDataDefinition(String id, - Map operationsMap) { - for(OperationDataDefinition operationDataDefinition : operationsMap.values()){ - ArtifactDataDefinition implementationArtifact = operationDataDefinition.getImplementation(); - if(implementationArtifact != null){ - String uniqueId = implementationArtifact.getUniqueId(); - if (id.equals(uniqueId)) { - return implementationArtifact; - } - } - } - return null; - } - public Either removeArifactFromResource(String id, String artifactId, NodeTypeEnum type, boolean deleteMandatoryArtifact) { Either status = removeArtifactOnGraph(id, artifactId, type, deleteMandatoryArtifact); @@ -385,7 +336,7 @@ public class ArtifactsOperations extends BaseOperation { if (envList != null && !envList.isEmpty()) { envList.forEach(a -> { a.setGeneratedFromId(newArtifactId); - updateArtifactOnResource(a, id, a.getUniqueId(), type, instanceId); + updateArifactOnResource(a, id, a.getUniqueId(), type, instanceId); }); @@ -394,7 +345,7 @@ public class ArtifactsOperations extends BaseOperation { } public Either updateHeatEnvPlaceholder(ArtifactDefinition artifactInfo, String parentId, NodeTypeEnum type) { - return updateArtifactOnResource(artifactInfo, parentId, artifactInfo.getUniqueId(), type, null); + return updateArifactOnResource(artifactInfo, parentId, artifactInfo.getUniqueId(), type, null); } // public Either, StorageOperationStatus> getHeatParamsForEnv(ArtifactDefinition heatEnvArtifact, String parentId) { -- cgit 1.2.3-korg