summaryrefslogtreecommitdiffstats
path: root/catalog-model
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-model')
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/Component.java8
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacade.java21
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) {