summaryrefslogtreecommitdiffstats
path: root/catalog-model
diff options
context:
space:
mode:
authorIdan Amit <ia096e@intl.att.com>2017-07-16 14:54:17 +0300
committerMichael Lando <ml636r@att.com>2017-07-16 19:03:37 +0300
commitadc29b887ccdfed63cd97e942ae6ac594d3bc44e (patch)
tree84b98426e164b30c96fd85fafa3b23faae0b1809 /catalog-model
parentdd60339b06d252fcb1382aa97ab3d65b37dad021 (diff)
[sdc] - merged 1707_build into sdc LF
Change-Id: Ia91f0206493d0cd8f158779ed1a94f55305c8a97 Signed-off-by: Idan Amit <ia096e@intl.att.com> Signed-off-by: Michael Lando <ml636r@att.com>
Diffstat (limited to 'catalog-model')
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentInstInputsMap.java6
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentInstanceProperty.java4
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/IComponentInstanceConnectedElement.java5
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperation.java20
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/IInputsOperation.java2
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/InputsOperation.java114
6 files changed, 11 insertions, 140 deletions
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<String, List<InputDefinition>> componentInstanceInputsMap;
+ Map<String, List<ComponentInstancePropInput>> componentInstanceInputsMap;
Map<String, List<ComponentInstancePropInput>> componentInstanceProperties;
- public Map<String, List<InputDefinition>> getComponentInstanceInputsMap() {
+ public Map<String, List<ComponentInstancePropInput>> getComponentInstanceInputsMap() {
return componentInstanceInputsMap;
}
- public void setComponentInstanceInputsMap(Map<String, List<InputDefinition>> componentInstanceInputsMap) {
+ public void setComponentInstanceInputsMap(Map<String, List<ComponentInstancePropInput>> 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<String, ArtifactDataDefinition> 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<String, ArtifactDataDefinition> 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<List<InputDefinition>, TitanOperationStatus> addInputsToGraph(String componentId, NodeTypeEnum nodeType, Map<String, InputDefinition> inputs, Map<String, DataTypeDefinition> dataTypes);
- Either<List<InputDefinition>, StorageOperationStatus> addInputsToComponent(String resourceId, NodeTypeEnum nodeType, ComponentInstInputsMap componentInsInputs, Map<String, DataTypeDefinition> dataTypes);
-
TitanOperationStatus findNodeNonInheretedInputs(String uniqueId, List<InputDefinition> inputs);
Either<List<InputDefinition>, 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<List<InputDefinition>, StorageOperationStatus> addInputsToComponent(String resourceId, NodeTypeEnum nodeType, ComponentInstInputsMap componentInsInputs, Map<String, DataTypeDefinition> dataTypes) {
- List<InputDefinition> resList = new ArrayList<InputDefinition>();
- Map<String, List<InputDefinition>> newInputsMap = componentInsInputs.getComponentInstanceInputsMap();
- if (newInputsMap != null && !newInputsMap.isEmpty()) {
- for (Entry<String, List<InputDefinition>> entry : newInputsMap.entrySet()) {
- String compInstId = entry.getKey();
- Either<TitanVertex, TitanOperationStatus> 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<InputDefinition> inputs = entry.getValue();
-
- if (inputs != null && !inputs.isEmpty()) {
- for (InputDefinition input : inputs) {
-
-
- Either<Integer, StorageOperationStatus> 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<InputDefinition, TitanOperationStatus> 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<ComponentInstanceInput, StorageOperationStatus> 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<InputsData, TitanOperationStatus> 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<String, Object> props = new HashMap<String, Object>();
- props.put(GraphEdgePropertiesDictionary.NAME.getProperty(), createdInputyDefinition.getName());
- props.put(GraphEdgePropertiesDictionary.OWNER_ID.getProperty(), compInstId);
-
- GraphNode propertyData = new UniqueIdData(NodeTypeEnum.InputValue, inputValueData.getValueUniqueUid());
-
- Either<GraphRelation, TitanOperationStatus> 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<String, List<ComponentInstancePropInput>> newInputsPropsMap = componentInsInputs.getComponentInstanceProperties();
- if (newInputsPropsMap != null && !newInputsPropsMap.isEmpty()) {
- Either<List<InputDefinition>, 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<List<InputDefinition>, StorageOperationStatus> createInputsFromProperty(String resourceId, NodeTypeEnum nodeType, Map<String, DataTypeDefinition> dataTypes, List<InputDefinition> resList, Map<String, List<ComponentInstancePropInput>> newInputsPropsMap) {
for (Entry<String, List<ComponentInstancePropInput>> entry : newInputsPropsMap.entrySet()) {