+ public Either<Map<String, MapInterfaceDataDefinition>, StorageOperationStatus> associateComponentInstanceInterfacesToComponent(
+ Map<String, Map<String, InterfaceDefinition>> instInterfaces,
+ 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();
+ Map<String, MapInterfaceDataDefinition> instInterfacesMap = new HashMap<>();
+ if (instInterfaces != null) {
+
+ for (Map.Entry<String, Map<String, InterfaceDefinition>> entryInstances : instInterfaces.entrySet()) {
+ Map<String, InterfaceDataDefinition> incomingInterfacesMap = entryInstances.getValue().entrySet().stream()
+ .collect(Collectors.toMap(e -> e.getKey(), e -> e.getValue()));
+ MapInterfaceDataDefinition interfacesMap = new MapInterfaceDataDefinition();
+ interfacesMap.setMapToscaDataDefinition(incomingInterfacesMap);
+ instInterfacesMap.put(entryInstances.getKey(), interfacesMap);
+ }
+ }
+ StorageOperationStatus status = topologyTemplateOperation.associateInstInterfacesToComponent(
+ vertex,
+ instInterfacesMap
+ );
+ if (StorageOperationStatus.OK == status) {
+ log.debug(COMPONENT_CREATED_SUCCESSFULLY);
+ return Either.left(instInterfacesMap);
+ }
+ return Either.right(status);
+ }
+