/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
+* ============LICENSE_START=======================================================
+* SDC
+* ================================================================================
+* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+* ================================================================================
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
* http://www.apache.org/licenses/LICENSE-2.0
- *
+*
* Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+* ============LICENSE_END=========================================================
+*/
package org.openecomp.sdc.be.tosca;
+import static org.apache.commons.collections.CollectionUtils.isEmpty;
+import static org.apache.commons.collections.CollectionUtils.isNotEmpty;
+import static org.apache.commons.collections.MapUtils.isNotEmpty;
+import static org.openecomp.sdc.be.components.utils.PropertiesUtils.resolvePropertyValueFromInput;
+import static org.openecomp.sdc.be.tosca.InterfacesOperationsConverter.addInterfaceTypeElement;
+
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import fj.data.Either;
+import java.beans.IntrospectionException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Set;
+import java.util.function.Supplier;
+import java.util.stream.Collectors;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang.StringUtils;
import org.onap.sdc.tosca.services.YamlUtil;
import org.openecomp.sdc.be.components.impl.exceptions.SdcResourceNotFoundException;
import org.openecomp.sdc.be.config.ConfigurationManager;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.datatypes.components.ResourceMetadataDataDefinition;
-import org.openecomp.sdc.be.datatypes.elements.*;
+import org.openecomp.sdc.be.datatypes.elements.CINodeFilterDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.InterfaceDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.ListDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.RequirementNodeFilterCapabilityDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.RequirementNodeFilterPropertyDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.ToscaArtifactDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
-import org.openecomp.sdc.be.model.*;
+import org.openecomp.sdc.be.model.ArtifactDefinition;
+import org.openecomp.sdc.be.model.CapabilityDefinition;
+import org.openecomp.sdc.be.model.Component;
+import org.openecomp.sdc.be.model.ComponentInstance;
+import org.openecomp.sdc.be.model.ComponentInstanceInput;
+import org.openecomp.sdc.be.model.ComponentInstanceInterface;
+import org.openecomp.sdc.be.model.ComponentInstanceProperty;
+import org.openecomp.sdc.be.model.ComponentParametersView;
+import org.openecomp.sdc.be.model.DataTypeDefinition;
+import org.openecomp.sdc.be.model.GroupInstance;
+import org.openecomp.sdc.be.model.InputDefinition;
+import org.openecomp.sdc.be.model.InterfaceDefinition;
+import org.openecomp.sdc.be.model.PropertyDefinition;
+import org.openecomp.sdc.be.model.RelationshipInfo;
+import org.openecomp.sdc.be.model.RequirementCapabilityRelDef;
+import org.openecomp.sdc.be.model.RequirementDefinition;
+import org.openecomp.sdc.be.model.Resource;
+import org.openecomp.sdc.be.model.Service;
import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache;
import org.openecomp.sdc.be.model.category.CategoryDefinition;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
-import org.openecomp.sdc.be.model.jsontitan.utils.ModelConverter;
+import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade;
+import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
import org.openecomp.sdc.be.model.operations.impl.InterfaceLifecycleOperation;
-import org.openecomp.sdc.be.model.tosca.ToscaFunctions;
import org.openecomp.sdc.be.model.tosca.converters.ToscaValueBaseConverter;
-import org.openecomp.sdc.be.tosca.model.*;
+import org.openecomp.sdc.be.tosca.model.CapabilityFilter;
+import org.openecomp.sdc.be.tosca.model.NodeFilter;
+import org.openecomp.sdc.be.tosca.model.SubstitutionMapping;
+import org.openecomp.sdc.be.tosca.model.ToscaCapability;
+import org.openecomp.sdc.be.tosca.model.ToscaDataType;
+import org.openecomp.sdc.be.tosca.model.ToscaGroupTemplate;
+import org.openecomp.sdc.be.tosca.model.ToscaMetadata;
+import org.openecomp.sdc.be.tosca.model.ToscaNodeTemplate;
+import org.openecomp.sdc.be.tosca.model.ToscaNodeType;
+import org.openecomp.sdc.be.tosca.model.ToscaPolicyTemplate;
+import org.openecomp.sdc.be.tosca.model.ToscaProperty;
+import org.openecomp.sdc.be.tosca.model.ToscaRequirement;
+import org.openecomp.sdc.be.tosca.model.ToscaTemplate;
+import org.openecomp.sdc.be.tosca.model.ToscaTemplateArtifact;
+import org.openecomp.sdc.be.tosca.model.ToscaTemplateRequirement;
+import org.openecomp.sdc.be.tosca.model.ToscaTopolgyTemplate;
import org.openecomp.sdc.be.tosca.utils.ForwardingPathToscaUtil;
import org.openecomp.sdc.be.tosca.utils.InputConverter;
-import org.openecomp.sdc.be.tosca.utils.InterfacesOperationsToscaUtil;
import org.openecomp.sdc.common.log.wrappers.Logger;
import org.openecomp.sdc.externalupload.utils.ServiceUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.yaml.snakeyaml.representer.Represent;
import org.yaml.snakeyaml.representer.Representer;
-import java.beans.IntrospectionException;
-import java.util.*;
-import java.util.Map.Entry;
-import java.util.function.Supplier;
-import java.util.stream.Collectors;
-
-import static org.apache.commons.collections.CollectionUtils.isEmpty;
-import static org.apache.commons.collections.CollectionUtils.isNotEmpty;
-import static org.apache.commons.collections.MapUtils.isNotEmpty;
-import static org.openecomp.sdc.be.tosca.utils.InterfacesOperationsToscaUtil.addInterfaceDefinitionElement;
-import static org.openecomp.sdc.be.tosca.utils.InterfacesOperationsToscaUtil.addInterfaceTypeElement;
-
@org.springframework.stereotype.Component("tosca-export-handler")
public class ToscaExportHandler {
private PropertyConvertor propertyConvertor;
private InputConverter inputConverter;
private InterfaceLifecycleOperation interfaceLifecycleOperation;
+ private InterfacesOperationsConverter interfacesOperationsConverter;
@Autowired
public ToscaExportHandler(ApplicationDataTypeCache dataTypeCache, ToscaOperationFacade toscaOperationFacade,
CapabilityRequirementConverter capabilityRequirementConverter, PolicyExportParser policyExportParser,
- GroupExportParser groupExportParser, InputConverter inputConverter, InterfaceLifecycleOperation interfaceLifecycleOperation) {
- this.dataTypeCache = dataTypeCache;
- this.toscaOperationFacade = toscaOperationFacade;
- this.capabilityRequirementConverter = capabilityRequirementConverter;
- this.policyExportParser = policyExportParser;
- this.groupExportParser = groupExportParser;
- this.propertyConvertor = PropertyConvertor.getInstance();
- this.inputConverter = inputConverter;
- this.interfaceLifecycleOperation = interfaceLifecycleOperation;
- }
+ GroupExportParser groupExportParser, PropertyConvertor propertyConvertor, InputConverter inputConverter,
+ InterfaceLifecycleOperation interfaceLifecycleOperation,
+ InterfacesOperationsConverter interfacesOperationsConverter) {
+ this.dataTypeCache = dataTypeCache;
+ this.toscaOperationFacade = toscaOperationFacade;
+ this.capabilityRequirementConverter = capabilityRequirementConverter;
+ this.policyExportParser = policyExportParser;
+ this.groupExportParser = groupExportParser;
+ this.propertyConvertor = propertyConvertor;
+ this.inputConverter = inputConverter;
+ this.interfaceLifecycleOperation = interfaceLifecycleOperation;
+ this.interfacesOperationsConverter = interfacesOperationsConverter;
+ }
private static final Logger log = Logger.getLogger(ToscaExportHandler.class);
}
toscaNode = importsRes.left().value().left;
Map<String, Component> componentCache = importsRes.left().value().right;
- Either<Map<String, ToscaNodeType>, ToscaError> nodeTypesMapEither = createProxyNodeTypes(componentCache , component );
+ Either<Map<String, ToscaNodeType>, ToscaError> nodeTypesMapEither = createProxyNodeTypes(componentCache,
+ component);
if (nodeTypesMapEither.isRight()) {
log.debug("Failed to fetch normative service proxy resource by tosca name, error {}",
nodeTypesMapEither.right().value());
toscaNode.setNode_types(nodeTypesMap);
}
+ Either<Map<String, Object>, ToscaError> proxyInterfaceTypesEither = createProxyInterfaceTypes(component);
+ if (proxyInterfaceTypesEither.isRight()) {
+ log.debug("Failed to populate service proxy local interface types in tosca, error {}",
+ nodeTypesMapEither.right().value());
+ return Either.right(proxyInterfaceTypesEither.right().value());
+ }
+ Map<String, Object> proxyInterfaceTypes = proxyInterfaceTypesEither.left().value();
+ if (MapUtils.isNotEmpty(proxyInterfaceTypes)) {
+ toscaNode.setInterface_types(proxyInterfaceTypes);
+ }
- Either<Map<String, DataTypeDefinition>, TitanOperationStatus> dataTypesEither = dataTypeCache.getAll();
+ Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> dataTypesEither = dataTypeCache.getAll();
if (dataTypesEither.isRight()) {
log.debug("Failed to retrieve all data types {}", dataTypesEither.right().value());
return Either.right(ToscaError.GENERAL_ERROR);
SubstitutionMapping substitutionMapping = new SubstitutionMapping();
String toscaResourceName;
switch (component.getComponentType()) {
- case RESOURCE:
- toscaResourceName = ((ResourceMetadataDataDefinition) component.getComponentMetadataDefinition()
- .getMetadataDataDefinition()).getToscaResourceName();
- break;
- case SERVICE:
- toscaResourceName = SERVICE_NODE_TYPE_PREFIX
- + component.getComponentMetadataDefinition().getMetadataDataDefinition().getSystemName();
- break;
- default:
- log.debug(NOT_SUPPORTED_COMPONENT_TYPE, component.getComponentType());
- return Either.right(ToscaError.NOT_SUPPORTED_TOSCA_TYPE);
+ case RESOURCE:
+ toscaResourceName = ((ResourceMetadataDataDefinition) component.getComponentMetadataDefinition()
+ .getMetadataDataDefinition()).getToscaResourceName();
+ break;
+ case SERVICE:
+ toscaResourceName = SERVICE_NODE_TYPE_PREFIX
+ + component.getComponentMetadataDefinition().getMetadataDataDefinition().getSystemName();
+ break;
+ default:
+ log.debug(NOT_SUPPORTED_COMPONENT_TYPE, component.getComponentType());
+ return Either.right(ToscaError.NOT_SUPPORTED_TOSCA_TYPE);
}
substitutionMapping.setNode_type(toscaResourceName);
substitutionMapping = capabilities.left().value();
Either<SubstitutionMapping, ToscaError> requirements = capabilityRequirementConverter
- .convertSubstitutionMappingRequirements(componentCache, component, substitutionMapping);
+ .convertSubstitutionMappingRequirements(componentCache, component, substitutionMapping);
if (requirements.isRight()) {
return Either.right(requirements.right().value());
}
}
private void addGroupsToTopologyTemplate(Component component, ToscaTopolgyTemplate topologyTemplate) {
-
-
Map<String, ToscaGroupTemplate> groups = groupExportParser.getGroups(component);
if(groups!= null) {
topologyTemplate.addGroups(groups);
}
}
- private void addPoliciesToTopologyTemplate(Component component, ToscaTopolgyTemplate topologyTemplate)
- throws SdcResourceNotFoundException {
- Map<String, ToscaPolicyTemplate> policies = policyExportParser.getPolicies(component);
- if(policies!= null) {
- topologyTemplate.addPolicies(policies);
- }
- }
+ private void addPoliciesToTopologyTemplate(Component component, ToscaTopolgyTemplate topologyTemplate)
+ throws SdcResourceNotFoundException {
+ Map<String, ToscaPolicyTemplate> policies = policyExportParser.getPolicies(component);
+ if(policies!= null) {
+ topologyTemplate.addPolicies(policies);
+ }
+ }
private ToscaMetadata convertMetadata(Component component) {
return convertMetadata(component, false, null);
toscaMetadata.setVersion(component.getVersion());
toscaMetadata.setCustomizationUUID(componentInstance.getCustomizationUUID());
if (componentInstance.getSourceModelInvariant() != null
- && !componentInstance.getSourceModelInvariant().isEmpty()) {
+ && !componentInstance.getSourceModelInvariant().isEmpty()) {
toscaMetadata.setVersion(componentInstance.getComponentVersion());
toscaMetadata.setSourceModelInvariant(componentInstance.getSourceModelInvariant());
toscaMetadata.setSourceModelUuid(componentInstance.getSourceModelUuid());
}
switch (component.getComponentType()) {
- case RESOURCE:
- Resource resource = (Resource) component;
+ case RESOURCE:
+ Resource resource = (Resource) component;
- if (isInstance && componentInstance.getOriginType() == OriginTypeEnum.ServiceProxy) {
- toscaMetadata.setType(componentInstance.getOriginType().getDisplayValue());
- } else {
- toscaMetadata.setType(resource.getResourceType().name());
- }
- toscaMetadata.setSubcategory(categoryDefinition.getSubcategories().get(0).getName());
- toscaMetadata.setResourceVendor(resource.getVendorName());
- toscaMetadata.setResourceVendorRelease(resource.getVendorRelease());
- toscaMetadata.setResourceVendorModelNumber(resource.getResourceVendorModelNumber());
- break;
- case SERVICE:
- Service service = (Service) component;
- toscaMetadata.setType(component.getComponentType().getValue());
- toscaMetadata.setServiceType(service.getServiceType());
- toscaMetadata.setServiceRole(service.getServiceRole());
- toscaMetadata.setEnvironmentContext(service.getEnvironmentContext());
- resolveInstantiationTypeAndSetItToToscaMetaData(toscaMetadata, service);
- if (!isInstance) {
- // DE268546
- toscaMetadata.setServiceEcompNaming(((Service) component).isEcompGeneratedNaming());
- toscaMetadata.setEcompGeneratedNaming(((Service) component).isEcompGeneratedNaming());
- toscaMetadata.setNamingPolicy(((Service) component).getNamingPolicy());
- }
- break;
- default:
- log.debug(NOT_SUPPORTED_COMPONENT_TYPE, component.getComponentType());
+ if (isInstance && componentInstance.getOriginType() == OriginTypeEnum.ServiceProxy) {
+ toscaMetadata.setType(componentInstance.getOriginType().getDisplayValue());
+ } else {
+ toscaMetadata.setType(resource.getResourceType().name());
+ }
+ toscaMetadata.setSubcategory(categoryDefinition.getSubcategories().get(0).getName());
+ toscaMetadata.setResourceVendor(resource.getVendorName());
+ toscaMetadata.setResourceVendorRelease(resource.getVendorRelease());
+ toscaMetadata.setResourceVendorModelNumber(resource.getResourceVendorModelNumber());
+ break;
+ case SERVICE:
+ Service service = (Service) component;
+ toscaMetadata.setType(component.getComponentType().getValue());
+ toscaMetadata.setServiceType(service.getServiceType());
+ toscaMetadata.setServiceRole(service.getServiceRole());
+ toscaMetadata.setServiceFunction(service.getServiceFunction());
+ toscaMetadata.setEnvironmentContext(service.getEnvironmentContext());
+ resolveInstantiationTypeAndSetItToToscaMetaData(toscaMetadata, service);
+ if (!isInstance) {
+ // DE268546
+ toscaMetadata.setServiceEcompNaming(((Service) component).isEcompGeneratedNaming());
+ toscaMetadata.setEcompGeneratedNaming(((Service) component).isEcompGeneratedNaming());
+ toscaMetadata.setNamingPolicy(((Service) component).getNamingPolicy());
+ }
+ break;
+ default:
+ log.debug(NOT_SUPPORTED_COMPONENT_TYPE, component.getComponentType());
}
return toscaMetadata;
}
if (componentRI == null) {
// all resource must be only once!
Either<Component, StorageOperationStatus> resource = toscaOperationFacade
- .getToscaFullElement(ci.getComponentUid());
+ .getToscaFullElement(ci.getComponentUid());
if ((resource.isRight()) && (log.isDebugEnabled())) {
log.debug("Failed to fetch resource with id {} for instance {}",ci.getComponentUid() ,ci.getUniqueId());
return ;
if (ci.getOriginType() == OriginTypeEnum.ServiceProxy){
Either<Component, StorageOperationStatus> sourceService = toscaOperationFacade
- .getToscaFullElement(ci.getSourceModelUid());
+ .getToscaFullElement(ci.getSourceModelUid());
if (sourceService.isRight() && (log.isDebugEnabled())) {
log.debug("Failed to fetch source service with id {} for proxy {}", ci.getSourceModelUid(), ci.getUniqueId());
}
}
private Either<ToscaTemplate, ToscaError> convertInterfaceNodeType(Map<String, Component> componentsCache,
- Component component, ToscaTemplate toscaNode,
- Map<String, ToscaNodeType> nodeTypes,
+ Component component, ToscaTemplate toscaNode,
+ Map<String, ToscaNodeType> nodeTypes,
boolean isAssociatedComponent) {
log.debug("start convert node type for {}", component.getUniqueId());
ToscaNodeType toscaNodeType = createNodeType(component);
return Either.right(ToscaError.GENERAL_ERROR);
}
List<String> allGlobalInterfaceTypes = lifecycleTypeEither.left().value()
- .values()
- .stream()
+ .values()
+ .stream()
.map(InterfaceDataDefinition::getType)
- .collect(Collectors.toList());
+ .collect(Collectors.toList());
toscaNode.setInterface_types(addInterfaceTypeElement(component, allGlobalInterfaceTypes));
- Either<Map<String, DataTypeDefinition>, TitanOperationStatus> dataTypesEither = dataTypeCache.getAll();
+ Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> dataTypesEither = dataTypeCache.getAll();
if (dataTypesEither.isRight()) {
log.debug("Failed to fetch all data types :", dataTypesEither.right().value());
return Either.right(ToscaError.GENERAL_ERROR);
List<InputDefinition> inputDef = component.getInputs();
Map<String, ToscaProperty> mergedProperties = new HashMap<>();
- addInterfaceDefinitionElement(component, toscaNodeType, dataTypes, isAssociatedComponent);
- if (inputDef != null) {
- addInputsToProperties(dataTypes, inputDef, mergedProperties);
- }
+ interfacesOperationsConverter.addInterfaceDefinitionElement(component, toscaNodeType, dataTypes, isAssociatedComponent);
+ addInputsToProperties(dataTypes, inputDef, mergedProperties);
if(CollectionUtils.isNotEmpty(component.getProperties())) {
List<PropertyDefinition> properties = component.getProperties();
- Map<String, ToscaProperty> convertedProperties;
- convertedProperties = properties.stream().collect(Collectors.toMap(
- PropertyDataDefinition::getName,
- property -> propertyConvertor.convertProperty(dataTypes, property,
- PropertyConvertor.PropertyType.PROPERTY)));
+ Map<String, ToscaProperty> convertedProperties = properties.stream()
+ .map(propertyDefinition -> resolvePropertyValueFromInput(propertyDefinition, component.getInputs()))
+ .collect(Collectors.toMap(PropertyDataDefinition::getName,
+ property -> propertyConvertor.convertProperty(dataTypes, property,
+ PropertyConvertor.PropertyType.PROPERTY)));
// merge component properties and inputs properties
mergedProperties.putAll(convertedProperties);
}
- if (MapUtils.isNotEmpty(mergedProperties) && Objects.nonNull(inputDef)) {
- resolveDefaultPropertyValue(inputDef, mergedProperties, dataTypes);
+ if (MapUtils.isNotEmpty(mergedProperties)) {
toscaNodeType.setProperties(mergedProperties);
}
return convertReqCapAndTypeName(componentsCache, component, toscaNode, nodeTypes, toscaNodeType, dataTypes);
}
- private void resolveDefaultPropertyValue(List<InputDefinition> inputDef,
- Map<String, ToscaProperty> mergedProperties,
- Map<String, DataTypeDefinition> dataTypes) {
- for (Map.Entry<String, ToscaProperty> mergedPropertyEntry : mergedProperties.entrySet()) {
- ToscaProperty value = mergedPropertyEntry.getValue();
- if (Objects.nonNull(value) && value.getDefaultp() instanceof Map) {
- Map<String, Object> valueAsMap = (Map<String, Object>) value.getDefaultp();
- Object getInputValue = valueAsMap.get(ToscaFunctions.GET_INPUT.getFunctionName());
- if (getInputValue instanceof String) {
- String inputName = (String)getInputValue;
- Optional<InputDefinition> matchedInputDefinition = inputDef.stream()
- .filter(componentInput -> componentInput.getName().equals(inputName))
- .findFirst();
- if (matchedInputDefinition.isPresent()) {
- InputDefinition matchedInput = matchedInputDefinition.get();
- Object resolvedDefaultValue = new PropertyConvertor().convertToToscaObject(matchedInput.getType(),
- matchedInput.getDefaultValue(), matchedInput.getSchemaType(), dataTypes, false);
- value.setDefaultp(resolvedDefaultValue);
- mergedProperties.put(mergedPropertyEntry.getKey(), value);
- }
- } else if (getInputValue instanceof List) {
- // new get_input syntax to refer to sub-element (introduced from TOSCA v1.3)
- // e.g. get_input: [input_name, INDEX, inner_property]
- // currently resolving default value for the syntax is not supported
- log.debug("#resolveDefaultPropertyValue: ignore get_input list syntax. propname={}, val={}",
- mergedPropertyEntry.getKey(), getInputValue);
- } else {
- // Ignore unknown get_input syntax
- log.debug("#resolveDefaultPropertyValue: ignore unknown get_input syntax. propname={}, val={}",
- mergedPropertyEntry.getKey(), getInputValue);
- }
- }
- }
- }
-
- private void addInputsToProperties(Map<String, DataTypeDefinition> dataTypes,
- List<InputDefinition> inputDef,
- Map<String, ToscaProperty> mergedProperties) {
- for(InputDefinition input : inputDef) {
- ToscaProperty property = propertyConvertor.convertProperty(dataTypes, input, PropertyConvertor.PropertyType.INPUT);
- mergedProperties.put(input.getName(), property);
- }
- }
-
private Either<ToscaTemplate, ToscaError> convertReqCapAndTypeName(Map<String, Component> componentsCache, Component component, ToscaTemplate toscaNode,
Map<String, ToscaNodeType> nodeTypes, ToscaNodeType toscaNodeType,
Map<String, DataTypeDefinition> dataTypes) {
String toscaResourceName;
switch (component.getComponentType()) {
- case RESOURCE:
- toscaResourceName = ((ResourceMetadataDataDefinition) component.getComponentMetadataDefinition()
- .getMetadataDataDefinition()).getToscaResourceName();
- break;
- case SERVICE:
- toscaResourceName = SERVICE_NODE_TYPE_PREFIX
- + component.getComponentMetadataDefinition().getMetadataDataDefinition().getSystemName();
- break;
- default:
- log.debug(NOT_SUPPORTED_COMPONENT_TYPE, component.getComponentType());
- return Either.right(ToscaError.NOT_SUPPORTED_TOSCA_TYPE);
+ case RESOURCE:
+ toscaResourceName = ((ResourceMetadataDataDefinition) component.getComponentMetadataDefinition()
+ .getMetadataDataDefinition()).getToscaResourceName();
+ break;
+ case SERVICE:
+ toscaResourceName = SERVICE_NODE_TYPE_PREFIX
+ + component.getComponentMetadataDefinition().getMetadataDataDefinition().getSystemName();
+ break;
+ default:
+ log.debug(NOT_SUPPORTED_COMPONENT_TYPE, component.getComponentType());
+ return Either.right(ToscaError.NOT_SUPPORTED_TOSCA_TYPE);
}
nodeTypes.put(toscaResourceName, toscaNodeType);
Map<String, ToscaGroupTemplate> groupsMap = null;
for (ComponentInstance componentInstance : componentInstances) {
ToscaNodeTemplate nodeTemplate = new ToscaNodeTemplate();
+ if (MapUtils.isNotEmpty(componentInstance.getToscaArtifacts())) {
+ nodeTemplate.setArtifacts(convertToNodeTemplateArtifacts(componentInstance.getToscaArtifacts()));
+ }
nodeTemplate.setType(componentInstance.getToscaComponentName());
nodeTemplate.setDirectives(componentInstance.getDirectives());
nodeTemplate.setNode_filter(convertToNodeTemplateNodeFilterComponent(componentInstance.getNodeFilter()));
Either<Component, Boolean> originComponentRes = capabilityRequirementConverter
- .getOriginComponent(componentCache, componentInstance);
+ .getOriginComponent(componentCache, componentInstance);
if (originComponentRes.isRight()) {
convertNodeTemplatesRes = Either.right(ToscaError.NODE_TYPE_REQUIREMENT_ERROR);
break;
}
Either<ToscaNodeTemplate, ToscaError> capabilities = capabilityRequirementConverter
- .convertComponentInstanceCapabilities(componentInstance, dataTypes, nodeTemplate);
+ .convertComponentInstanceCapabilities(componentInstance, dataTypes, nodeTemplate);
if (capabilities.isRight()) {
convertNodeTemplatesRes = Either.right(capabilities.right().value());
break;
addPropertiesOfParentComponent(dataTypes, originalComponent, props);
}
- if (null != componentInstancesProperties && componentInstancesProperties.containsKey(instanceUniqueId)
- && !isComponentOfTypeServiceProxy(componentInstance)) {
- addPropertiesOfComponentInstance(componentInstancesProperties, dataTypes,
- instanceUniqueId, props);
+ if (null != componentInstancesProperties && componentInstancesProperties.containsKey(instanceUniqueId)) {
+ addPropertiesOfComponentInstance(componentInstancesProperties, dataTypes, instanceUniqueId,
+ props);
}
if (componentInstancesInputs != null && componentInstancesInputs.containsKey(instanceUniqueId)
&& !isComponentOfTypeServiceProxy(componentInstance)) {
+ //For service proxy the inputs are already handled under instance properties above
addComponentInstanceInputs(dataTypes, componentInstancesInputs, instanceUniqueId,
props);
}
currServiceInterfaces.forEach(instInterface -> tmpInterfaces.put(instInterface
.getUniqueId(), instInterface));
- interfaces = InterfacesOperationsToscaUtil
+ interfaces = interfacesOperationsConverter
.getInterfacesMap(parentComponent, componentInstance, tmpInterfaces, dataTypes, true, true);
}
} else {
}
private void addComponentInstanceInputs(Map<String, DataTypeDefinition> dataTypes,
- Map<String, List<ComponentInstanceInput>> componentInstancesInputs,
- String instanceUniqueId, Map<String, Object> props) {
+ Map<String, List<ComponentInstanceInput>> componentInstancesInputs,
+ String instanceUniqueId, Map<String, Object> props) {
List<ComponentInstanceInput> instanceInputsList = componentInstancesInputs.get(instanceUniqueId);
if (instanceInputsList != null) {
Supplier<String> supplier = () -> input.getValue() != null && !Objects.isNull(input.getValue())
? input.getValue() : input.getDefaultValue();
- propertyConvertor.convertAndAddValue(dataTypes, props, input, supplier);
+ propertyConvertor.convertAndAddValue(dataTypes, props, input, supplier);
});
}
}
if (isNotEmpty(componentInstancesProperties)) {
componentInstancesProperties.get(instanceUniqueId)
- // Converts and adds each value to property map
- .forEach(prop -> propertyConvertor.convertAndAddValue(dataTypes, props, prop,
- prop::getValue));
+ // Converts and adds each value to property map
+ .forEach(prop -> propertyConvertor.convertAndAddValue(dataTypes, props, prop,
+ prop::getValue));
}
}
private void addPropertiesOfParentComponent(Map<String, DataTypeDefinition> dataTypes,
- Component componentOfInstance, Map<String, Object> props) {
+ Component componentOfInstance, Map<String, Object> props) {
List<PropertyDefinition> componentProperties = componentOfInstance.getProperties();
if (isNotEmpty(componentProperties)) {
.filter(prop -> StringUtils.isNotEmpty(prop.getDefaultValue()))
// Converts and adds each value to property map
.forEach(prop -> propertyConvertor.convertAndAddValue(dataTypes, props, prop,
- prop::getDefaultValue));
+ prop::getDefaultValue));
}
}
if (input.getSchema() != null && input.getSchema().getProperty() != null) {
innerType = input.getSchema().getProperty().getType();
}
- return propertyConvertor.convertToToscaObject(propertyType, supplier.get(), innerType,
- dataTypes, true);
+ return propertyConvertor.convertToToscaObject(input, supplier.get(), dataTypes, true);
}
private ToscaNodeType createNodeType(Component component) {
toscaNodeType.setDescription(component.getDescription());
} else {
String derivedFrom = null != component.getDerivedFromGenericType() ? component.getDerivedFromGenericType()
- : "tosca.nodes.Root";
+ : "tosca.nodes.Root";
toscaNodeType.setDerived_from(derivedFrom);
}
return toscaNodeType;
}
- private Either<Map<String, ToscaNodeType>, ToscaError> createProxyNodeTypes(Map<String, Component> componentCache ,Component container ) {
+ private Either<Map<String, Object>, ToscaError> createProxyInterfaceTypes(Component container) {
+
+ Map<String, Object> proxyInterfaceTypes = new HashMap<>();
+ Either<Map<String, Object>, ToscaError> res = Either.left(proxyInterfaceTypes);
+ List<ComponentInstance> componentInstances = container.getComponentInstances();
+ if (CollectionUtils.isEmpty(componentInstances)) {
+ return res;
+ }
+ Map<String, ComponentInstance> serviceProxyInstanceList = new HashMap<>();
+ componentInstances.stream()
+ .filter(this::isComponentOfTypeServiceProxy)
+ .forEach(inst -> serviceProxyInstanceList.put(inst.getToscaComponentName(), inst));
+ if (MapUtils.isEmpty(serviceProxyInstanceList)) {
+ return res;
+ }
+ for (Entry<String, ComponentInstance> entryProxy : serviceProxyInstanceList.entrySet()) {
+ Component serviceComponent;
+ ComponentParametersView componentParametersView = new ComponentParametersView();
+ componentParametersView.disableAll();
+ componentParametersView.setIgnoreInterfaces(false);
+ Either<Component, StorageOperationStatus> service = toscaOperationFacade
+ .getToscaElement(entryProxy.getValue().getSourceModelUid(), componentParametersView);
+ if (service.isRight()) {
+ log.debug("Failed to fetch original service component with id {} for instance {}",
+ entryProxy.getValue().getSourceModelUid(), entryProxy.getValue().getName());
+ return Either.right(ToscaError.GENERAL_ERROR);
+ } else {
+ serviceComponent = service.left().value();
+ }
+
+ Either<Map<String, InterfaceDefinition>, StorageOperationStatus> lifecycleTypeEither =
+ interfaceLifecycleOperation.getAllInterfaceLifecycleTypes();
+ if(lifecycleTypeEither.isRight()){
+ log.debug("Failed to retrieve global interface types :", lifecycleTypeEither.right().value());
+ return Either.right(ToscaError.GENERAL_ERROR);
+ }
+
+ List<String> allGlobalInterfaceTypes = lifecycleTypeEither.left().value().values().stream()
+ .map(InterfaceDataDefinition::getType)
+ .collect(Collectors.toList());
+ //Add interface types for local interfaces in the original service component for proxy
+ Map<String, Object> localInterfaceTypes = addInterfaceTypeElement(serviceComponent,
+ allGlobalInterfaceTypes);
+ if (MapUtils.isNotEmpty(localInterfaceTypes)) {
+ proxyInterfaceTypes.putAll(localInterfaceTypes);
+ }
+
+ }
+ return Either.left(proxyInterfaceTypes);
+ }
+
+ private Either<Map<String, ToscaNodeType>, ToscaError> createProxyNodeTypes(Map<String, Component> componentCache,
+ Component container) {
Map<String, ToscaNodeType> nodeTypesMap = new HashMap<>();
Either<Map<String, ToscaNodeType>, ToscaError> res = Either.left(nodeTypesMap);
}
Map<String, ComponentInstance> serviceProxyInstanceList = new HashMap<>();
List<ComponentInstance> proxyInst = componentInstances.stream()
- .filter(p -> p.getOriginType().name().equals(OriginTypeEnum.ServiceProxy.name()))
- .collect(Collectors.toList());
+ .filter(p -> p.getOriginType().name().equals(OriginTypeEnum.ServiceProxy.name()))
+ .collect(Collectors.toList());
if (proxyInst != null && !proxyInst.isEmpty()) {
for (ComponentInstance inst : proxyInst) {
serviceProxyInstanceList.put(inst.getToscaComponentName(), inst);
if (serviceProxyInstanceList.isEmpty()) {
return res;
}
- ComponentParametersView filter = new ComponentParametersView(true);
- filter.setIgnoreCapabilities(false);
- filter.setIgnoreComponentInstances(false);
Either<Resource, StorageOperationStatus> serviceProxyOrigin = toscaOperationFacade
- .getLatestByName("serviceProxy");
+ .getLatestByName("serviceProxy");
if (serviceProxyOrigin.isRight()) {
log.debug("Failed to fetch normative service proxy resource by tosca name, error {}",
serviceProxyOrigin.right().value());
ComponentParametersView componentParametersView = new ComponentParametersView();
componentParametersView.disableAll();
componentParametersView.setIgnoreCategories(false);
+ componentParametersView.setIgnoreProperties(false);
+ componentParametersView.setIgnoreInputs(false);
+ componentParametersView.setIgnoreInterfaces(false);
+ componentParametersView.setIgnoreRequirements(false);
Either<Component, StorageOperationStatus> service = toscaOperationFacade
- .getToscaElement(entryProxy.getValue().getSourceModelUid(), componentParametersView);
+ .getToscaElement(entryProxy.getValue().getSourceModelUid(), componentParametersView);
if (service.isRight()) {
log.debug("Failed to fetch resource with id {} for instance {}", entryProxy.getValue().getSourceModelUid(), entryProxy.getValue().getName());
} else {
serviceComponent = service.left().value();
}
- ToscaNodeType toscaNodeType = createProxyNodeType(componentCache , origComponent, serviceComponent, entryProxy.getValue());
+ ToscaNodeType toscaNodeType = createProxyNodeType(componentCache, origComponent, serviceComponent,
+ entryProxy.getValue());
nodeTypesMap.put(entryProxy.getKey(), toscaNodeType);
}
return Either.left(nodeTypesMap);
}
- private ToscaNodeType createProxyNodeType(Map<String, Component> componentCache , Component origComponent, Component proxyComponent,
- ComponentInstance instance) {
+ private ToscaNodeType createProxyNodeType(Map<String, Component> componentCache , Component origComponent,
+ Component proxyComponent, ComponentInstance instance) {
ToscaNodeType toscaNodeType = new ToscaNodeType();
String derivedFrom = ((Resource) origComponent).getToscaResourceName();
toscaNodeType.setDerived_from(derivedFrom);
- Either<Map<String, DataTypeDefinition>, TitanOperationStatus> dataTypesEither = dataTypeCache.getAll();
+ Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> dataTypesEither = dataTypeCache.getAll();
if (dataTypesEither.isRight()) {
log.debug("Failed to retrieve all data types {}", dataTypesEither.right().value());
}
Map<String, DataTypeDefinition> dataTypes = dataTypesEither.left().value();
Map<String, ToscaCapability> capabilities = this.capabilityRequirementConverter
- .convertProxyCapabilities( componentCache ,origComponent, proxyComponent, instance, dataTypes);
+ .convertProxyCapabilities(componentCache, instance, dataTypes);
- toscaNodeType.setCapabilities(capabilities);
+ if (MapUtils.isNotEmpty(capabilities)) {
+ toscaNodeType.setCapabilities(capabilities);
+ }
+ List<Map<String, ToscaRequirement>> proxyNodeTypeRequirements = this.capabilityRequirementConverter
+ .convertProxyRequirements(componentCache, instance);
+ if (CollectionUtils.isNotEmpty(proxyNodeTypeRequirements)) {
+ toscaNodeType.setRequirements(proxyNodeTypeRequirements);
+ }
+ Optional<Map<String, ToscaProperty>> proxyProperties = getProxyNodeTypeProperties(proxyComponent, dataTypes);
+ proxyProperties.ifPresent(toscaNodeType::setProperties);
+
+ Optional<Map<String, Object>> proxyInterfaces = getProxyNodeTypeInterfaces(proxyComponent, dataTypes);
+ proxyInterfaces.ifPresent(toscaNodeType::setInterfaces);
return toscaNodeType;
}
List<RequirementCapabilityRelDef> relations, Component originComponent,
List<Map<String, ToscaTemplateRequirement>> toscaRequirements, Map<String, Component> componentCache) {
List<RequirementCapabilityRelDef> filteredRelations = relations.stream()
- .filter(p -> componentInstance.getUniqueId().equals(p.getFromNode())).collect(Collectors.toList());
+ .filter(p -> componentInstance.getUniqueId().equals(p.getFromNode())).collect(Collectors.toList());
return isEmpty(filteredRelations) ||
- filteredRelations.stream()
- .allMatch(rel -> addRequirement(componentInstance, originComponent, component.getComponentInstances(), rel, toscaRequirements, componentCache));
+ filteredRelations.stream()
+ .allMatch(rel -> addRequirement(componentInstance, originComponent, component.getComponentInstances(), rel, toscaRequirements, componentCache));
}
private boolean addRequirement(ComponentInstance fromInstance, Component fromOriginComponent,
Optional<CapabilityDefinition> capOpt = Optional.empty();
ComponentInstance toInstance = instancesList.stream().filter(i -> rel.getToNode().equals(i.getUniqueId()))
- .findFirst().orElse(null);
+ .findFirst().orElse(null);
if (toInstance == null) {
log.debug("Failed to find a relation from the node {} to the node {}", fromInstance.getName(),
rel.getToNode());
if (result) {
toOriginComponent = getOriginRes.left().value();
capOpt = toOriginComponent.getCapabilities().get(reqOpt.get().getCapability()).stream()
- .filter(c -> isCapabilityBelongToRelation(reqAndRelationshipPair, c)).findFirst();
+ .filter(c -> isCapabilityBelongToRelation(reqAndRelationshipPair, c)).findFirst();
if (!capOpt.isPresent()) {
capOpt = findCapability(reqAndRelationshipPair, toOriginComponent, fromOriginComponent, reqOpt.get());
if(!capOpt.isPresent()){
- result = false;
- log.debug("Failed to find a capability with name {} on a component with uniqueId {}",
- reqAndRelationshipPair.getCapability(), fromOriginComponent.getUniqueId());
+ result = false;
+ log.debug("Failed to find a capability with name {} on a component with uniqueId {}",
+ reqAndRelationshipPair.getCapability(), fromOriginComponent.getUniqueId());
}
}
}
return false;
}
return ModelConverter.isAtomicComponent(originComponent) ||
- isRequirementBelongToOwner(reqAndRelationshipPair, requirement, fromInstanceId, originComponent);
+ isRequirementBelongToOwner(reqAndRelationshipPair, requirement, fromInstanceId, originComponent);
}
private boolean isRequirementBelongToOwner(RelationshipInfo reqAndRelationshipPair, RequirementDefinition requirement, String fromInstanceId, Component originComponent) {
- return StringUtils.equals(requirement.getOwnerId(), reqAndRelationshipPair.getRequirementOwnerId()) || (isCvfc(originComponent) && StringUtils.equals(fromInstanceId, reqAndRelationshipPair.getRequirementOwnerId()));
+ return StringUtils.equals(requirement.getOwnerId(), reqAndRelationshipPair.getRequirementOwnerId())
+ || (isCvfc(originComponent) && StringUtils.equals(fromInstanceId, reqAndRelationshipPair.getRequirementOwnerId())
+ || StringUtils.equals(requirement.getOwnerId(), originComponent.getUniqueId()));
}
private boolean isCvfc(Component component) {
return component.getComponentType() == ComponentTypeEnum.RESOURCE &&
- ((Resource) component).getResourceType() == ResourceTypeEnum.CVFC;
+ ((Resource) component).getResourceType() == ResourceTypeEnum.CVFC;
}
private Either<SubstitutionMapping, ToscaError> convertCapabilities(Component component,
Either<SubstitutionMapping, ToscaError> result = Either.left(substitutionMappings);
Either<Map<String, String[]>, ToscaError> toscaCapabilitiesRes = capabilityRequirementConverter
- .convertSubstitutionMappingCapabilities(componentCache, component);
+ .convertSubstitutionMappingCapabilities(componentCache, component);
if (toscaCapabilitiesRes.isRight()) {
result = Either.right(toscaCapabilitiesRes.right().value());
log.debug("Failed convert capabilities for the component {}. ", component.getName());
return Either.left(nodeType);
}
+ private Map<String, ToscaTemplateArtifact> convertToNodeTemplateArtifacts(Map<String, ToscaArtifactDataDefinition> artifacts) {
+ if (artifacts == null) {
+ return null;
+ }
+ Map<String, ToscaTemplateArtifact> arts = new HashMap<>();
+ for (Map.Entry<String, ToscaArtifactDataDefinition> entry : artifacts.entrySet()) {
+ ToscaTemplateArtifact artifact = new ToscaTemplateArtifact();
+ artifact.setFile(entry.getValue().getFile());
+ artifact.setType(entry.getValue().getType());
+ arts.put(entry.getKey(), artifact);
+ }
+ return arts;
+ }
protected NodeFilter convertToNodeTemplateNodeFilterComponent(CINodeFilterDataDefinition inNodeFilter) {
if (inNodeFilter == null){
origProperties.isEmpty()) {
return;
}
+ Map<String, List<Object>> propertyMapCopy = new HashMap<>();
for(RequirementNodeFilterPropertyDataDefinition propertyDataDefinition : origProperties.getListToscaDataDefinition()) {
- Map<String, List<Object>> propertyMapCopy = new HashMap<>();
for(String propertyInfoEntry : propertyDataDefinition.getConstraints()) {
Map propertyValObj = new YamlUtil().yamlToObject(propertyInfoEntry, Map.class);
- if (propertyMapCopy.containsKey(propertyDataDefinition.getName())){
- propertyMapCopy.get(propertyDataDefinition.getName()).add(propertyValObj);
+ String propertyName = propertyDataDefinition.getName();
+ if (propertyMapCopy.containsKey(propertyName)){
+ addPropertyConstraintValueToList(propertyName, propertyValObj, propertyMapCopy.get(propertyName));
} else {
- if (propertyDataDefinition.getName() != null) {
- List propsList =new ArrayList();
- propsList.add(propertyValObj);
- propertyMapCopy.put(propertyDataDefinition.getName(), propsList);
+ if (propertyName != null) {
+ List propsList = new ArrayList();
+ addPropertyConstraintValueToList(propertyName, propertyValObj, propsList);
+ propertyMapCopy.put(propertyName, propsList);
} else {
propertyMapCopy.putAll(propertyValObj);
}
}
}
- propertiesCopy.add(propertyMapCopy);
}
+ propertyMapCopy.entrySet().stream().forEach(entry ->
+ addCalculatedConstraintsIntoPropertiesList(propertiesCopy, entry));
+ }
+
+ private void addPropertyConstraintValueToList(String propertyName, Map propertyValObj, List propsList) {
+ if(propertyValObj.containsKey(propertyName)) {
+ propsList.add(propertyValObj.get(propertyName));
+ } else {
+ propsList.add(propertyValObj);
+ }
+ }
+
+
+ private void addCalculatedConstraintsIntoPropertiesList(List<Map<String, List<Object>>> propertiesCopy,
+ Entry<String, List<Object>> entry) {
+ Map<String, List<Object>> tempMap = new HashMap<>();
+ tempMap.put(entry.getKey(), entry.getValue());
+ propertiesCopy.add(tempMap);
}
private static class CustomRepresenter extends Representer {
- public CustomRepresenter() {
+ CustomRepresenter() {
super();
// null representer is exceptional and it is stored as an instance
// variable.
Tag customTag) {
if (propertyValue == null) {
return null;
- } else {
- // skip not relevant for Tosca property
- if ("dependencies".equals(property.getName())) {
- return null;
- }
- NodeTuple defaultNode = super.representJavaBeanProperty(javaBean, property, propertyValue, customTag);
-
- return "_defaultp_".equals(property.getName())
- ? new NodeTuple(representData("default"), defaultNode.getValueNode()) : defaultNode;
}
+ // skip not relevant for Tosca property
+ if ("dependencies".equals(property.getName())) {
+ return null;
+ }
+ NodeTuple defaultNode = super.representJavaBeanProperty(javaBean, property, propertyValue, customTag);
+
+ return "_defaultp_".equals(property.getName())
+ ? new NodeTuple(representData("default"), defaultNode.getValueNode()) : defaultNode;
}
@Override
return interfaceObject;
}
+
+ Optional<Map<String, ToscaProperty>> getProxyNodeTypeProperties(Component proxyComponent,
+ Map<String, DataTypeDefinition>
+ dataTypes) {
+ if (Objects.isNull(proxyComponent)) {
+ return Optional.empty();
+ }
+ Map<String, ToscaProperty> proxyProperties = new HashMap<>();
+ addInputsToProperties(dataTypes, proxyComponent.getInputs(), proxyProperties);
+ if (CollectionUtils.isNotEmpty(proxyComponent.getProperties())) {
+ proxyProperties.putAll(proxyComponent.getProperties().stream()
+ .map(propertyDefinition -> resolvePropertyValueFromInput(propertyDefinition,
+ proxyComponent.getInputs()))
+ .collect(Collectors.toMap(PropertyDataDefinition::getName,
+ property -> propertyConvertor.convertProperty(dataTypes, property,
+ PropertyConvertor.PropertyType.PROPERTY))));
+ }
+ return MapUtils.isNotEmpty(proxyProperties) ? Optional.of(proxyProperties) : Optional.empty();
+ }
+
+ void addInputsToProperties(Map<String, DataTypeDefinition> dataTypes,
+ List<InputDefinition> componentInputs,
+ Map<String, ToscaProperty> mergedProperties) {
+ if (CollectionUtils.isEmpty(componentInputs)) {
+ return;
+ }
+ for(InputDefinition input : componentInputs) {
+ ToscaProperty property = propertyConvertor.convertProperty(dataTypes, input,
+ PropertyConvertor.PropertyType.INPUT);
+ mergedProperties.put(input.getName(), property);
+ }
+ }
+
+ Optional<Map<String, Object>> getProxyNodeTypeInterfaces(Component proxyComponent,
+ Map<String, DataTypeDefinition> dataTypes) {
+ if (Objects.isNull(proxyComponent) || MapUtils.isEmpty(proxyComponent.getInterfaces())) {
+ return Optional.empty();
+ }
+ Map<String, InterfaceDefinition> proxyComponentInterfaces = proxyComponent.getInterfaces();
+ //Unset artifact path for operation implementation for proxy node types as for operations with artifacts it is
+ // always available in the proxy node template
+ removeOperationImplementationForProxyNodeType(proxyComponentInterfaces);
+ return Optional.ofNullable(interfacesOperationsConverter
+ .getInterfacesMap(proxyComponent, null, proxyComponentInterfaces, dataTypes,
+ false, false));
+ }
+
+ private static void removeOperationImplementationForProxyNodeType(
+ Map<String, InterfaceDefinition> proxyComponentInterfaces) {
+ if (MapUtils.isEmpty(proxyComponentInterfaces)) {
+ return;
+ }
+ proxyComponentInterfaces.values().stream().map(InterfaceDataDefinition::getOperations)
+ .filter(MapUtils::isNotEmpty)
+ .forEach(operations -> operations.values().forEach(operation -> operation.setImplementation(null)));
+ }
}