From adc29b887ccdfed63cd97e942ae6ac594d3bc44e Mon Sep 17 00:00:00 2001 From: Idan Amit Date: Sun, 16 Jul 2017 14:54:17 +0300 Subject: [sdc] - merged 1707_build into sdc LF Change-Id: Ia91f0206493d0cd8f158779ed1a94f55305c8a97 Signed-off-by: Idan Amit Signed-off-by: Michael Lando --- .../sdc/be/model/ComponentInstInputsMap.java | 6 +- .../sdc/be/model/ComponentInstanceProperty.java | 4 +- .../model/IComponentInstanceConnectedElement.java | 5 + .../operations/NodeTemplateOperation.java | 20 +--- .../be/model/operations/api/IInputsOperation.java | 2 - .../be/model/operations/impl/InputsOperation.java | 114 --------------------- 6 files changed, 11 insertions(+), 140 deletions(-) (limited to 'catalog-model/src') diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentInstInputsMap.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentInstInputsMap.java index 9d016c0799..e436548f60 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentInstInputsMap.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentInstInputsMap.java @@ -31,14 +31,14 @@ public class ComponentInstInputsMap implements Serializable{ */ private static final long serialVersionUID = 1136631343963488131L; - Map> componentInstanceInputsMap; + Map> componentInstanceInputsMap; Map> componentInstanceProperties; - public Map> getComponentInstanceInputsMap() { + public Map> getComponentInstanceInputsMap() { return componentInstanceInputsMap; } - public void setComponentInstanceInputsMap(Map> componentInstanceInputsMap) { + public void setComponentInstanceInputsMap(Map> componentInstanceInputsMap) { this.componentInstanceInputsMap = componentInstanceInputsMap; } diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentInstanceProperty.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentInstanceProperty.java index 8bd3a9c809..25bbb50da4 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentInstanceProperty.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentInstanceProperty.java @@ -23,11 +23,11 @@ package org.openecomp.sdc.be.model; import java.io.Serializable; import java.util.List; - import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.datatypes.elements.PropertyRule; -public class ComponentInstanceProperty extends PropertyDefinition implements IComponentInstanceConnectedElement, Serializable { + +public class ComponentInstanceProperty extends PropertyDefinition implements IComponentInstanceConnectedElement, Serializable{ /** * diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/IComponentInstanceConnectedElement.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/IComponentInstanceConnectedElement.java index 86de3a1584..80e898626e 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/IComponentInstanceConnectedElement.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/IComponentInstanceConnectedElement.java @@ -26,4 +26,9 @@ public interface IComponentInstanceConnectedElement { String getValueUniqueUid(); void setValueUniqueUid(String value); + + String getComponentInstanceName(); + void setComponentInstanceName(String componentInstanceName); + String getComponentInstanceId(); + void setComponentInstanceId(String componentInstanceId); } diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperation.java index 29247996a5..33db64234b 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperation.java @@ -598,26 +598,8 @@ public class NodeTemplateOperation extends BaseOperation { if (status != StorageOperationStatus.OK) { return status; } - status = addInstanceDeploymentArtifacts(originNodeType, componentInstance, updatedContainerVertex, user, envType); - if (status != StorageOperationStatus.OK) { - return status; - } + return addCalculatedCapReqFromNodeType(originNodeType, componentInstance, updatedContainerVertex); - - } - - private StorageOperationStatus addInstanceDeploymentArtifacts(ToscaElement originNodeType, ComponentInstanceDataDefinition componentInstance, GraphVertex updatedContainerVertex, User user, String envType) { - Map deploymentArtifacts = originNodeType.getDeploymentArtifacts(); - MapArtifactDataDefinition instArtifacts = prepareInstDeploymentArtifactPerInstance(deploymentArtifacts, componentInstance.getUniqueId(), user, envType); - if (instArtifacts != null) { - StorageOperationStatus calculatedResult = addToscaDataDeepElementsBlockToToscaElement(updatedContainerVertex, EdgeLabelEnum.INST_DEPLOYMENT_ARTIFACTS, VertexTypeEnum.INST_DEPLOYMENT_ARTIFACTS, instArtifacts, - componentInstance.getUniqueId()); - - if (calculatedResult != StorageOperationStatus.OK) { - return calculatedResult; - } - } - return StorageOperationStatus.OK; } public MapArtifactDataDefinition prepareInstDeploymentArtifactPerInstance(Map deploymentArtifacts, String componentInstanceId, User user, String envType) { diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/IInputsOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/IInputsOperation.java index 386864a8b0..8b44229df1 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/IInputsOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/IInputsOperation.java @@ -43,8 +43,6 @@ public interface IInputsOperation { Either, TitanOperationStatus> addInputsToGraph(String componentId, NodeTypeEnum nodeType, Map inputs, Map dataTypes); - Either, StorageOperationStatus> addInputsToComponent(String resourceId, NodeTypeEnum nodeType, ComponentInstInputsMap componentInsInputs, Map dataTypes); - TitanOperationStatus findNodeNonInheretedInputs(String uniqueId, List inputs); Either, StorageOperationStatus> getInputsOfComponent(String compId, String fromName, int amount); diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/InputsOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/InputsOperation.java index dba4ff9b75..d3db95df65 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/InputsOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/InputsOperation.java @@ -1210,121 +1210,7 @@ public class InputsOperation extends AbstractOperation implements IInputsOperati } - public Either, StorageOperationStatus> addInputsToComponent(String resourceId, NodeTypeEnum nodeType, ComponentInstInputsMap componentInsInputs, Map dataTypes) { - List resList = new ArrayList(); - Map> newInputsMap = componentInsInputs.getComponentInstanceInputsMap(); - if (newInputsMap != null && !newInputsMap.isEmpty()) { - for (Entry> entry : newInputsMap.entrySet()) { - String compInstId = entry.getKey(); - Either ciVertexEither = titanGenericDao.getVertexByProperty(GraphPropertiesDictionary.UNIQUE_ID.getProperty(), compInstId); - if (ciVertexEither.isRight()) { - log.debug("Failed to fetch vertex of resource instance for id {} error {}", compInstId, ciVertexEither.right().value()); - return Either.right( DaoStatusConverter.convertTitanStatusToStorageStatus(ciVertexEither.right().value())); - } - TitanVertex ciVertex = ciVertexEither.left().value(); - - - //String originType = (String) titanGenericDao.getProperty(originVertex, GraphPropertiesDictionary.LABEL.getProperty()); - String compInstname = (String) titanGenericDao.getProperty(ciVertex, GraphPropertiesDictionary.NORMALIZED_NAME.getProperty()); - - List inputs = entry.getValue(); - - if (inputs != null && !inputs.isEmpty()) { - for (InputDefinition input : inputs) { - - - Either counterRes = componentInstanceOperation.increaseAndGetResourceInstanceSpecificCounter(compInstId, GraphPropertiesDictionary.INPUT_COUNTER, true); - if (counterRes.isRight()) { - log.debug("increaseAndGetResourceInputCounter failed resource instance {}", compInstId); - StorageOperationStatus status = counterRes.right().value(); - return Either.right(status); - } - - Either oldInputEither = getInputFromGraph(input.getUniqueId(), true, true); - if (oldInputEither.isRight()) { - log.error("Failed to get input {} ", input.getUniqueId()); - - return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(oldInputEither.right().value())); - } - - InputDefinition oldInput = oldInputEither.left().value(); - String serviceInputName = compInstname + "_" + input.getName(); - input.setName(serviceInputName); - - JSONObject jobject = new JSONObject(); - jobject.put(GET_INPUT, input.getName()); - - ComponentInstanceInput inputValue = new ComponentInstanceInput(oldInput, jobject.toJSONString(), null); - Integer index = counterRes.left().value(); - - Either eitherStatus = componentInstanceOperation.addInputValueToResourceInstance(inputValue, compInstId, index, true); - - if (eitherStatus.isRight()) { - log.error("Failed to add input value {} to resource instance {} in Graph. status is {}", inputValue, compInstId, eitherStatus.right().value().name()); - - return Either.right(eitherStatus.right().value()); - } - ComponentInstanceInput inputValueData = eitherStatus.left().value(); - - input.setSchema(oldInputEither.left().value().getSchema()); - input.setDefaultValue(oldInput.getDefaultValue()); - input.setConstraints(oldInput.getConstraints()); - input.setDescription(oldInput.getDescription()); - input.setHidden(oldInput.isHidden()); - input.setImmutable(oldInput.isImmutable()); - input.setDefinition(oldInput.isDefinition()); - input.setRequired(oldInput.isRequired()); - - StorageOperationStatus validateAndUpdateProperty = validateAndUpdateProperty(input, dataTypes); - if (validateAndUpdateProperty != StorageOperationStatus.OK) { - log.error("Property {} is invalid. Status is {}", input, validateAndUpdateProperty); - return Either.right(validateAndUpdateProperty); - } - - Either addPropertyToGraph = addInputToGraph(serviceInputName, input, resourceId, nodeType); - if (addPropertyToGraph.isRight()) { - return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(addPropertyToGraph.right().value())); - } - InputDefinition createdInputyDefinition = convertInputDataToInputDefinition(addPropertyToGraph.left().value()); - createdInputyDefinition.setName(serviceInputName); - createdInputyDefinition.setParentUniqueId(resourceId); - - Map props = new HashMap(); - props.put(GraphEdgePropertiesDictionary.NAME.getProperty(), createdInputyDefinition.getName()); - props.put(GraphEdgePropertiesDictionary.OWNER_ID.getProperty(), compInstId); - - GraphNode propertyData = new UniqueIdData(NodeTypeEnum.InputValue, inputValueData.getValueUniqueUid()); - - Either addPropRefResult = titanGenericDao.createRelation(addPropertyToGraph.left().value(), propertyData, GraphEdgeLabels.GET_INPUT, props); - - if (addPropRefResult.isRight()) { - TitanOperationStatus status = addPropRefResult.right().value(); - String description = "Failed to associate input " + addPropertyToGraph.left().value().getUniqueId() + " to input value " + inputValueData.getUniqueId() + " in graph. Status is " + status; - BeEcompErrorManager.getInstance().logInternalFlowError(ASSOCIATING_INPUT_TO_PROP, description, ErrorSeverity.ERROR); - return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status)); - } - - resList.add(createdInputyDefinition); - - } - } - - } - } - Map> newInputsPropsMap = componentInsInputs.getComponentInstanceProperties(); - if (newInputsPropsMap != null && !newInputsPropsMap.isEmpty()) { - Either, StorageOperationStatus> result = createInputsFromProperty(resourceId, nodeType, dataTypes, resList, newInputsPropsMap); - - if (result.isRight()) { - log.debug("Failed to create inputs of resource for id {} error {}", resourceId, result.right().value()); - return result; - } - resList = result.left().value(); - - } - return Either.left(resList); - } private Either, StorageOperationStatus> createInputsFromProperty(String resourceId, NodeTypeEnum nodeType, Map dataTypes, List resList, Map> newInputsPropsMap) { for (Entry> entry : newInputsPropsMap.entrySet()) { -- cgit 1.2.3-korg