diff options
author | JvD_Ericsson <jeff.van.dam@est.tech> | 2022-05-23 08:26:40 +0100 |
---|---|---|
committer | Michael Morris <michael.morris@est.tech> | 2022-06-03 12:20:16 +0000 |
commit | a80da69b9e95a6cbdbe50251c37c9dcc50650e4c (patch) | |
tree | f21a6acc25dab04f42b2891e5d1ec2b099c36dd6 /catalog-model/src | |
parent | ff317808f308af03321de0f0b0849cd9f6f8ccad (diff) |
Maintain VFC instance attribute outputs on instance version change
Issue-ID: SDC-4025
Signed-off-by: JvD_Ericsson <jeff.van.dam@est.tech>
Change-Id: Ia44a6ac73d9a52042caaacf0c5f790e1e2fc73f1
Diffstat (limited to 'catalog-model/src')
-rw-r--r-- | catalog-model/src/main/java/org/openecomp/sdc/be/model/Component.java | 8 | ||||
-rw-r--r-- | catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacade.java | 21 |
2 files changed, 29 insertions, 0 deletions
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/Component.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/Component.java index 1c0cfc4c5d..3252d79281 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/Component.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/Component.java @@ -387,10 +387,18 @@ public abstract class Component implements PropertiesOwner { return this.safeGetComponentInstanceEntity(cmptInstacneId, this.componentInstancesProperties); } + public List<ComponentInstanceAttribute> safeGetComponentInstanceAttributes(String cmptInstacneId) { + return this.safeGetComponentInstanceEntity(cmptInstacneId, this.componentInstancesAttributes); + } + public List<ComponentInstanceInput> safeGetComponentInstanceInput(String comptInstanceId) { return this.safeGetComponentInstanceEntity(comptInstanceId, this.componentInstancesInputs); } + public List<ComponentInstanceOutput> safeGetComponentInstanceOutput(String comptInstanceId) { + return this.safeGetComponentInstanceEntity(comptInstanceId, this.componentInstancesOutputs); + } + public List<ComponentInstanceInterface> safeGetComponentInstanceInterfaces(String cmptInstacneId) { return this.safeGetComponentInstanceEntity(cmptInstacneId, this.componentInstancesInterfaces); } diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacade.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacade.java index 09e02337a1..cf1b23ec88 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacade.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacade.java @@ -1517,6 +1517,27 @@ public class ToscaOperationFacade { return Either.right(status); } + public Either<List<OutputDefinition>, StorageOperationStatus> updateOutputsToComponent(List<OutputDefinition> outputs, String componentId) { + Either<GraphVertex, JanusGraphOperationStatus> getVertexEither = janusGraphDao.getVertexById(componentId, JsonParseFlagEnum.NoParse); + if (getVertexEither.isRight()) { + log.debug(COULDNT_FETCH_COMPONENT_WITH_AND_UNIQUE_ID_ERROR, componentId, getVertexEither.right().value()); + return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getVertexEither.right().value())); + } + GraphVertex vertex = getVertexEither.left().value(); + List<AttributeDataDefinition> outputsAsDataDef = outputs.stream().map(AttributeDataDefinition::new).collect(Collectors.toList()); + StorageOperationStatus status = topologyTemplateOperation + .updateToscaDataOfToscaElement(vertex, EdgeLabelEnum.OUTPUTS, VertexTypeEnum.OUTPUTS, outputsAsDataDef, JsonPresentationFields.NAME); + if (StorageOperationStatus.OK == status) { + log.debug(COMPONENT_CREATED_SUCCESSFULLY); + List<OutputDefinition> outputsResList = null; + if (!outputsAsDataDef.isEmpty()) { + outputsResList = outputsAsDataDef.stream().map(OutputDefinition::new).collect(Collectors.toList()); + } + return Either.left(outputsResList); + } + return Either.right(status); + } + // region - ComponentInstance public Either<Map<String, List<ComponentInstanceProperty>>, StorageOperationStatus> associateComponentInstancePropertiesToComponent( Map<String, List<ComponentInstanceProperty>> instProperties, String componentId) { |