summaryrefslogtreecommitdiffstats
path: root/catalog-model/src
diff options
context:
space:
mode:
authorvasraz <vasyl.razinkov@est.tech>2021-02-18 13:13:50 +0000
committervasraz <vasyl.razinkov@est.tech>2021-02-18 13:13:50 +0000
commitfee0f29212b10c940ec4b19fc8f4794d06964eee (patch)
tree794d90ad0c299e85143e1ffee55916078285c4ef /catalog-model/src
parent26e5029d922779fd7e786c1a31b6b37492132388 (diff)
Implement Attributes/Outputs BE (part 1)
This commit includes support for: - import VFC with attributes - add VFC to VF/Service - show attributes in VF/Service Change-Id: I2cda966ab878ae7aee4bcfecf266c5c251c91164 Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech> Issue-ID: SDC-3448 Signed-off-by: JulienBe <julien.bertozzi@intl.att.com>
Diffstat (limited to 'catalog-model/src')
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/AttributeDefinition.java6
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/Component.java34
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentInstance.java2
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentInstanceAttribute.java3
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentInstanceOutput.java73
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentParametersView.java250
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/IAttributeOutputCommon.java (renamed from catalog-model/src/main/java/org/openecomp/sdc/be/model/IAttributeInputCommon.java)2
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/OutputDefinition.java8
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/Resource.java55
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/datamodel/NodeType.java2
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/datamodel/ToscaElement.java6
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTypeOperation.java2
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/TopologyTemplateOperation.java23
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperation.java2
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacade.java71
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/ModelConverter.java1055
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/ui/model/UiComponentDataTransfer.java2
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/ui/model/UiResourceDataTransfer.java3
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentParametersViewTest.java420
19 files changed, 796 insertions, 1223 deletions
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/AttributeDefinition.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/AttributeDefinition.java
index 20ad0ad01f..f9e0d646b3 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/AttributeDefinition.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/AttributeDefinition.java
@@ -42,6 +42,10 @@ public class AttributeDefinition extends AttributeDataDefinition implements IOpe
toscaPresentation = null;
}
+ public AttributeDefinition(final AttributeDataDefinition attributeDataDefinition) {
+ super(attributeDataDefinition);
+ }
+
public AttributeDefinition(final AttributeDefinition attributeDefinition) {
this.type = attributeDefinition.getType();
this.description = attributeDefinition.getDescription();
@@ -52,7 +56,7 @@ public class AttributeDefinition extends AttributeDataDefinition implements IOpe
@Override
public String getDefaultValue() {
- return String.valueOf(_default);
+ return _default == null ? null : String.valueOf(_default);
}
@Override
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 64660ec15f..600451d193 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
@@ -64,6 +64,7 @@ public abstract class Component implements PropertiesOwner {
protected List<AdditionalInformationDefinition> additionalInformation;
protected List<PropertyDefinition> properties;
+ protected List<AttributeDefinition> attributes;
private ComponentMetadataDefinition componentMetadataDefinition;
private Map<String, ArtifactDefinition> artifacts;
private Map<String, ArtifactDefinition> deploymentArtifacts;
@@ -73,6 +74,7 @@ public abstract class Component implements PropertiesOwner {
private List<ComponentInstance> componentInstances;
private List<RequirementCapabilityRelDef> componentInstancesRelations;
private Map<String, List<ComponentInstanceInput>> componentInstancesInputs;
+ private Map<String, List<ComponentInstanceOutput>> componentInstancesOutputs;
private Map<String, List<ComponentInstanceProperty>> componentInstancesProperties;
private Map<String, List<ComponentInstanceAttribute>> componentInstancesAttributes;
private Map<String, List<CapabilityDefinition>> capabilities;
@@ -100,7 +102,7 @@ public abstract class Component implements PropertiesOwner {
return categorySpecificMetadata == null ? Collections.emptyMap() : categorySpecificMetadata;
}
- public Component(ComponentMetadataDefinition componentMetadataDefinition) {
+ protected Component(ComponentMetadataDefinition componentMetadataDefinition) {
this.componentMetadataDefinition = componentMetadataDefinition;
}
@@ -329,18 +331,18 @@ public abstract class Component implements PropertiesOwner {
public Map<String, ArtifactDefinition> safeGetComponentInstanceDeploymentArtifacts(String componentInstanceId) {
return getComponentInstanceById(componentInstanceId).map(ComponentInstance::safeGetDeploymentArtifacts)
- .orElse(emptyMap());
+ .orElse(emptyMap());
}
public Map<String, ArtifactDefinition> safeGetComponentInstanceInformationalArtifacts(String componentInstanceId) {
return getComponentInstanceById(componentInstanceId).map(ComponentInstance::safeGetInformationalArtifacts)
- .orElse(emptyMap());
+ .orElse(emptyMap());
}
public List<ArtifactDefinition> safeGetComponentInstanceHeatArtifacts(String componentInstanceId) {
return safeGetComponentInstanceDeploymentArtifacts(componentInstanceId).values().stream()
- .filter(artifact -> ArtifactTypeEnum.HEAT_ENV.getType().equals(artifact.getArtifactType()))
- .collect(Collectors.toList());
+ .filter(artifact -> ArtifactTypeEnum.HEAT_ENV.getType().equals(artifact.getArtifactType()))
+ .collect(Collectors.toList());
}
public Map<String, List<ComponentInstanceProperty>> safeGetComponentInstancesProperties() {
@@ -353,9 +355,9 @@ public abstract class Component implements PropertiesOwner {
private Map<String, List<ComponentInstanceProperty>> findUiComponentInstancesProperties() {
List<String> instancesFromUi = componentInstances.stream().filter(i -> !i.isCreatedFromCsar())
- .map(ComponentInstance::getUniqueId).collect(Collectors.toList());
+ .map(ComponentInstance::getUniqueId).collect(Collectors.toList());
return componentInstancesProperties.entrySet().stream().filter(e -> instancesFromUi.contains(e.getKey()))
- .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
+ .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
}
public Map<String, List<ComponentInstanceInput>> safeGetComponentInstancesInputs() {
@@ -368,9 +370,9 @@ public abstract class Component implements PropertiesOwner {
private Map<String, List<ComponentInstanceInput>> findUiComponentInstancesInputs() {
List<String> instancesFromUi = componentInstances.stream().filter(i -> !i.isCreatedFromCsar())
- .map(ComponentInstance::getUniqueId).collect(Collectors.toList());
+ .map(ComponentInstance::getUniqueId).collect(Collectors.toList());
return componentInstancesInputs.entrySet().stream().filter(e -> instancesFromUi.contains(e.getKey()))
- .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
+ .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
}
public List<ComponentInstanceProperty> safeGetComponentInstanceProperties(String cmptInstacneId) {
@@ -491,7 +493,7 @@ public abstract class Component implements PropertiesOwner {
this.properties = new ArrayList<>();
}
- this.properties.add(propertyDefinition);;
+ this.properties.add(propertyDefinition);
}
public void addCategory(String category, String subCategory) {
@@ -573,7 +575,7 @@ public abstract class Component implements PropertiesOwner {
return emptyMap();
}
return groups.stream().filter(gr -> Objects.nonNull(gr.getProperties()))
- .collect(toMap(GroupDataDefinition::getUniqueId, GroupDataDefinition::getProperties));
+ .collect(toMap(GroupDataDefinition::getUniqueId, GroupDataDefinition::getProperties));
}
public Map<String, List<PropertyDataDefinition>> safeGetPolicyProperties() {
@@ -581,7 +583,7 @@ public abstract class Component implements PropertiesOwner {
return emptyMap();
}
return policies.values().stream().filter(policy -> Objects.nonNull(policy.getProperties()))
- .collect(toMap(PolicyDataDefinition::getUniqueId, PolicyDataDefinition::getProperties));
+ .collect(toMap(PolicyDataDefinition::getUniqueId, PolicyDataDefinition::getProperties));
}
public List<ComponentInstanceInput> safeGetComponentInstanceInputsByName(String cmptInstanceName) {
@@ -590,9 +592,9 @@ public abstract class Component implements PropertiesOwner {
return emptyPropsList;
}
return this.componentInstances.stream().filter(ci -> ci.getName().equals(cmptInstanceName))
- .map(ComponentInstance::getUniqueId)
- .map(instanceId -> safeGetComponentInstanceEntity(instanceId, this.componentInstancesInputs)).findAny()
- .orElse(emptyPropsList);
+ .map(ComponentInstance::getUniqueId)
+ .map(instanceId -> safeGetComponentInstanceEntity(instanceId, this.componentInstancesInputs)).findAny()
+ .orElse(emptyPropsList);
}
private <T> List<T> safeGetComponentInstanceEntity(String cmptInstanceId, Map<String, List<T>> instanceEntities) {
@@ -610,7 +612,7 @@ public abstract class Component implements PropertiesOwner {
public String fetchGenericTypeToscaNameFromConfig() {
return ConfigurationManager.getConfigurationManager().getConfiguration().getGenericAssetNodeTypes()
- .get(this.assetType());
+ .get(this.assetType());
}
protected <A> Optional<A> getHeadOption(List<A> list) {
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentInstance.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentInstance.java
index 0057b71a27..dd8296e8f7 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentInstance.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentInstance.java
@@ -30,7 +30,6 @@ import org.apache.commons.collections.MapUtils;
import org.openecomp.sdc.be.datatypes.elements.CINodeFilterDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.ComponentInstanceDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.PropertiesOwner;
-import org.openecomp.sdc.be.datatypes.elements.SubstitutionFilterDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.CreatedFrom;
import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum;
import org.openecomp.sdc.common.log.api.ILogConfiguration;
@@ -46,6 +45,7 @@ public class ComponentInstance extends ComponentInstanceDataDefinition implement
private List<GroupInstance> groupInstances;
private Map<String, Object> interfaces;
private List<PropertyDefinition> properties;
+ private List<AttributeDefinition> attributes;
private CINodeFilterDataDefinition nodeFilter;
private List<InputDefinition> inputs;
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentInstanceAttribute.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentInstanceAttribute.java
index 6583bf46c4..af2964ff40 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentInstanceAttribute.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentInstanceAttribute.java
@@ -28,9 +28,10 @@ import org.openecomp.sdc.be.datatypes.elements.PropertyRule;
@Getter
@Setter
-public class ComponentInstanceAttribute extends AttributeDefinition implements IComponentInstanceConnectedElement, IAttributeInputCommon {
+public class ComponentInstanceAttribute extends AttributeDefinition implements IComponentInstanceConnectedElement, IAttributeOutputCommon {
public ComponentInstanceAttribute(final AttributeDataDefinition value) {
+ super(value);
}
public ComponentInstanceAttribute() {
super();
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentInstanceOutput.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentInstanceOutput.java
new file mode 100644
index 0000000000..db79511a67
--- /dev/null
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentInstanceOutput.java
@@ -0,0 +1,73 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2021, Nordix Foundation. 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=========================================================
+ */
+
+package org.openecomp.sdc.be.model;
+
+import java.util.List;
+import lombok.Getter;
+import lombok.Setter;
+import org.openecomp.sdc.be.datatypes.elements.AttributeDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.PropertyRule;
+
+@Getter
+@Setter
+public class ComponentInstanceOutput extends OutputDefinition implements IComponentInstanceConnectedElement, IAttributeOutputCommon {
+
+ /**
+ * The unique id of the attribute value on graph
+ */
+ private String valueUniqueUid;
+
+ private List<String> path = null;
+
+ private List<PropertyRule> rules = null;
+ private String componentInstanceName;
+ private String componentInstanceId;
+
+ public ComponentInstanceOutput(AttributeDataDefinition curPropertyDef, String outputId, String value,
+ String valueUniqueUid) {
+ super(curPropertyDef);
+ setOutputId(outputId);
+ setValue(value);
+ this.valueUniqueUid = valueUniqueUid;
+ }
+
+ public ComponentInstanceOutput(OutputDefinition pd, String value, String valueUniqueUid) {
+ super(pd);
+
+ setValue(value);
+ this.valueUniqueUid = valueUniqueUid;
+ }
+
+ public ComponentInstanceOutput(AttributeDataDefinition attributeDataDefinition) {
+ super(attributeDataDefinition);
+ if (attributeDataDefinition.getGetOutputValues() != null && !attributeDataDefinition.getGetOutputValues()
+ .isEmpty()) {
+ setOutputId(attributeDataDefinition.getGetOutputValues().get(0).getInputId());
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "ComponentInstanceOutput [ " + super.toString() + " , value=" + getValue() + ", valueUniqueUid = "
+ + valueUniqueUid + " , rules=" + rules + " , path=" + path + " ]";
+ }
+
+}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentParametersView.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentParametersView.java
index 6488d41f25..87917d7861 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentParametersView.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentParametersView.java
@@ -21,17 +21,25 @@
package org.openecomp.sdc.be.model;
import java.util.List;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum;
import org.openecomp.sdc.be.datatypes.enums.ComponentFieldsEnum;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
+@Getter
+@Setter
+@NoArgsConstructor
public class ComponentParametersView {
private boolean ignoreUsers = false;
private boolean ignoreGroups = false;
private boolean ignoreComponentInstances = false;
private boolean ignoreComponentInstancesProperties = false;
+ private boolean ignoreComponentInstancesAttributes = false;
private boolean ignoreProperties = false;
+ private boolean ignoreAttributes = false;
private boolean ignoreCapabilities = false;
private boolean ignoreRequirements = false;
private boolean ignoreCategories = false;
@@ -42,10 +50,10 @@ public class ComponentParametersView {
private boolean ignoreInterfaceInstances = false;
private boolean ignoreComponentInstancesInterfaces = false;
private boolean ignoreDerivedFrom = false;
- private boolean ignoreAttributesFrom = false;
- private boolean ignoreComponentInstancesAttributesFrom = false;
private boolean ignoreInputs = false;
+ private boolean ignoreOutputs = false;
private boolean ignoreComponentInstancesInputs = false;
+ private boolean ignoreComponentInstancesOutputs = false;
private boolean ignoreCapabiltyProperties = false;
private boolean ignoreServicePath = true;
private boolean ignorePolicies = false;
@@ -54,9 +62,6 @@ public class ComponentParametersView {
private boolean ignoreSubstitutionFilter = false;
private boolean ignoreDataType = false;
- public ComponentParametersView() {
- }
-
public ComponentParametersView(boolean setAllToIgnore) {
this();
if (setAllToIgnore) {
@@ -75,6 +80,9 @@ public class ComponentParametersView {
case INPUTS:
this.setIgnoreInputs(false);
break;
+ case OUTPUTS:
+ this.setIgnoreOutputs(false);
+ break;
case USERS:
this.setIgnoreUsers(false);
break;
@@ -133,11 +141,11 @@ public class ComponentParametersView {
this.setIgnoreDerivedFrom(false);
break;
case ATTRIBUTES:
- this.setIgnoreAttributesFrom(false);
+ this.setIgnoreAttributes(false);
break;
case COMPONENT_INSTANCES_ATTRIBUTES:
this.setIgnoreComponentInstances(false);
- this.setIgnoreComponentInstancesAttributesFrom(false);
+ this.setIgnoreComponentInstancesAttributes(false);
break;
case COMPONENT_INSTANCE_INPUTS:
this.setIgnoreComponentInstances(false);
@@ -147,7 +155,7 @@ public class ComponentParametersView {
this.setIgnoreCapabiltyProperties(false);
break;
case FORWARDING_PATHS:
- this.setIgnoreForwardingPath(false);
+ this.setIgnoreServicePath(false);
break;
case POLICIES:
case NON_EXCLUDED_POLICIES:
@@ -178,7 +186,6 @@ public class ComponentParametersView {
///////////////////////////////////////////////////////////////
// When adding new member, please update the filter method.
///////////////////////////////////////////////////////////////
-
public Component filter(Component component, ComponentTypeEnum componentType) {
if (ignoreUsers) {
@@ -200,6 +207,9 @@ public class ComponentParametersView {
if (ignoreProperties && componentType == ComponentTypeEnum.RESOURCE) {
((Resource) component).setProperties(null);
}
+ if (ignoreAttributes) {
+ component.setAttributes(null);
+ }
if (ignoreCapabilities) {
component.setCapabilities(null);
}
@@ -221,8 +231,8 @@ public class ComponentParametersView {
component.setDeploymentArtifacts(null);
component.setToscaArtifacts(null);
}
- if (ignoreNodeFilterRequirements){
- component.setNodeFilterComponents(null);
+ if (ignoreNodeFilterRequirements) {
+ component.setNodeFilterComponents(null);
}
if (ignoreInterfaces && ignoreInterfaceInstances &&
componentType == ComponentTypeEnum.RESOURCE) {
@@ -231,25 +241,28 @@ public class ComponentParametersView {
if (ignoreDerivedFrom && componentType == ComponentTypeEnum.RESOURCE) {
((Resource) component).setDerivedFrom(null);
}
- if (ignoreAttributesFrom && componentType == ComponentTypeEnum.RESOURCE) {
- ((Resource) component).setAttributes(null);
- }
- if (ignoreComponentInstancesAttributesFrom) {
+ if (ignoreComponentInstancesAttributes) {
component.setComponentInstancesAttributes(null);
}
if (ignoreInputs) {
component.setInputs(null);
}
+ if (ignoreOutputs) {
+ component.setOutputs(null);
+ }
if (ignoreComponentInstancesInputs) {
component.setComponentInstancesInputs(null);
}
+ if (ignoreComponentInstancesOutputs) {
+ component.setComponentInstancesOutputs(null);
+ }
if (ignoreServicePath && componentType == ComponentTypeEnum.SERVICE) {
((Service) component).setForwardingPaths(null);
}
- if (ignoreNodeFilter){
+ if (ignoreNodeFilter) {
component.setNodeFilterComponents(null);
}
- if (ignoreSubstitutionFilter){
+ if (ignoreSubstitutionFilter) {
component.setSubstitutionFilterComponents(null);
}
if (ignoreDataType) {
@@ -258,14 +271,6 @@ public class ComponentParametersView {
return component;
}
- public boolean isIgnoreNodeFilterRequirements() {
- return ignoreNodeFilterRequirements;
- }
-
- public void setIgnoreNodeFilterRequirements(boolean ignoreNodeFilter) {
- this.ignoreNodeFilterRequirements = ignoreNodeFilter;
- }
-
public void disableAll() {
ignoreUsers = true;
ignoreGroups = true;
@@ -273,6 +278,7 @@ public class ComponentParametersView {
ignoreComponentInstances = true;
ignoreComponentInstancesProperties = true;
ignoreProperties = true;
+ ignoreAttributes = true;
ignoreCapabilities = true;
ignoreRequirements = true;
ignoreCategories = true;
@@ -282,10 +288,11 @@ public class ComponentParametersView {
ignoreInterfaces = true;
ignoreInterfaceInstances = true;
ignoreDerivedFrom = true;
- ignoreAttributesFrom = true;
ignoreInputs = true;
- ignoreComponentInstancesAttributesFrom = true;
+ ignoreOutputs = true;
+ ignoreComponentInstancesAttributes = true;
ignoreComponentInstancesInputs = true;
+ ignoreComponentInstancesOutputs = true;
ignoreCapabiltyProperties = true;
ignoreServicePath = true;
ignoreNodeFilterRequirements = true;
@@ -294,10 +301,6 @@ public class ComponentParametersView {
ignoreDataType = true;
}
- public boolean isIgnoreGroups() {
- return ignoreGroups;
- }
-
public void setIgnoreGroups(boolean ignoreGroups) {
this.ignoreGroups = ignoreGroups;
if (!ignoreGroups) {
@@ -306,190 +309,6 @@ public class ComponentParametersView {
}
}
- public boolean isIgnoreComponentInstances() {
- return ignoreComponentInstances;
- }
-
- public void setIgnoreComponentInstances(boolean ignoreComponentInstances) {
- this.ignoreComponentInstances = ignoreComponentInstances;
- }
-
- public boolean isIgnoreProperties() {
- return ignoreProperties;
- }
-
- public void setIgnoreProperties(boolean ignoreProperties) {
- this.ignoreProperties = ignoreProperties;
- }
-
- public boolean isIgnoreCapabilities() {
- return ignoreCapabilities;
- }
-
- public void setIgnoreCapabilities(boolean ignoreCapabilities) {
- this.ignoreCapabilities = ignoreCapabilities;
- }
-
- public boolean isIgnoreRequirements() {
- return ignoreRequirements;
- }
-
- public void setIgnoreRequirements(boolean ignoreRequirements) {
- this.ignoreRequirements = ignoreRequirements;
- }
-
- public boolean isIgnoreCategories() {
- return ignoreCategories;
- }
-
- public void setIgnoreCategories(boolean ignoreCategories) {
- this.ignoreCategories = ignoreCategories;
- }
-
- public boolean isIgnoreAllVersions() {
- return ignoreAllVersions;
- }
-
- public void setIgnoreAllVersions(boolean ignoreAllVersions) {
- this.ignoreAllVersions = ignoreAllVersions;
- }
-
- public boolean isIgnoreAdditionalInformation() {
- return ignoreAdditionalInformation;
- }
-
- private void setIgnoreAdditionalInformation(boolean ignoreAdditionalInformation) {
- this.ignoreAdditionalInformation = ignoreAdditionalInformation;
- }
-
- public boolean isIgnoreArtifacts() {
- return ignoreArtifacts;
- }
-
- public void setIgnoreArtifacts(boolean ignoreArtifacts) {
- this.ignoreArtifacts = ignoreArtifacts;
- }
-
- public boolean isIgnoreComponentInstancesProperties() {
- return ignoreComponentInstancesProperties;
- }
-
- public void setIgnoreComponentInstancesProperties(boolean ignoreComponentInstancesProperties) {
- this.ignoreComponentInstancesProperties = ignoreComponentInstancesProperties;
- }
-
- public boolean isIgnoreComponentInstancesInputs() {
- return ignoreComponentInstancesInputs;
- }
-
- public void setIgnoreComponentInstancesInputs(boolean ignoreComponentInstancesInputs) {
- this.ignoreComponentInstancesInputs = ignoreComponentInstancesInputs;
- }
-
- public boolean isIgnoreInterfaces() {
- return ignoreInterfaces;
- }
-
- public void setIgnoreInterfaces(boolean ignoreInterfaces) {
- this.ignoreInterfaces = ignoreInterfaces;
- }
-
- public boolean isIgnoreComponentInstancesInterfaces() {
- return ignoreComponentInstancesInterfaces;
- }
-
- public void setIgnoreComponentInstancesInterfaces(boolean ignoreComponentInstancesInterfaces) {
- this.ignoreComponentInstancesInterfaces = ignoreComponentInstancesInterfaces;
- }
-
- public boolean isIgnoreAttributesFrom() {
- return ignoreAttributesFrom;
- }
-
- public void setIgnoreAttributesFrom(boolean ignoreAttributesFrom) {
- this.ignoreAttributesFrom = ignoreAttributesFrom;
- }
-
- public boolean isIgnoreComponentInstancesAttributesFrom() {
- return ignoreComponentInstancesAttributesFrom;
- }
-
- private void setIgnoreComponentInstancesAttributesFrom(boolean ignoreComponentInstancesAttributesFrom) {
- this.ignoreComponentInstancesAttributesFrom = ignoreComponentInstancesAttributesFrom;
- }
-
- public boolean isIgnoreDerivedFrom() {
- return ignoreDerivedFrom;
- }
-
- private void setIgnoreDerivedFrom(boolean ignoreDerivedFrom) {
- this.ignoreDerivedFrom = ignoreDerivedFrom;
- }
-
- public boolean isIgnoreUsers() {
- return ignoreUsers;
- }
-
- public void setIgnoreUsers(boolean ignoreUsers) {
- this.ignoreUsers = ignoreUsers;
- }
-
- public boolean isIgnoreInputs() {
- return ignoreInputs;
- }
-
- public void setIgnoreInputs(boolean ignoreInputs) {
- this.ignoreInputs = ignoreInputs;
- }
-
- public boolean isIgnoreCapabiltyProperties() {
- return ignoreCapabiltyProperties;
- }
-
- public void setIgnoreCapabiltyProperties(boolean ignoreCapabiltyProperties) {
- this.ignoreCapabiltyProperties = ignoreCapabiltyProperties;
- }
-
- public boolean isIgnoreForwardingPath() {
- return ignoreServicePath;
- }
-
- public void setIgnoreForwardingPath(boolean ignoreServicePath) {
- this.ignoreServicePath = ignoreServicePath;
- }
-
- public boolean isIgnorePolicies() {
- return ignorePolicies;
- }
-
- public void setIgnorePolicies(boolean ignorePolicies) {
- this.ignorePolicies = ignorePolicies;
- }
-
- public boolean isIgnoreNodeFilter() {
- return ignoreNodeFilter;
- }
-
- public void setIgnoreNodeFilter(boolean ignoreNodeFilter) {
- this.ignoreNodeFilter = ignoreNodeFilter;
- }
-
- public boolean isIgnoreSubstitutionFilter() {
- return ignoreSubstitutionFilter;
- }
-
- public void setIgnoreSubstitutionFilter(boolean ignoreSubstitutionFilter) {
- this.ignoreSubstitutionFilter = ignoreSubstitutionFilter;
- }
-
- public boolean isIgnoreDataType() {
- return ignoreDataType;
- }
-
- public void setIgnoreDataType(boolean ignoreDataType) {
- this.ignoreDataType = ignoreDataType;
- }
-
public JsonParseFlagEnum detectParseFlag() {
JsonParseFlagEnum parseFlag;
if (isIgnoreComponentInstances()) {
@@ -499,4 +318,5 @@ public class ComponentParametersView {
}
return parseFlag;
}
+
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/IAttributeInputCommon.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/IAttributeOutputCommon.java
index fa8c162485..b2241ca905 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/IAttributeInputCommon.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/IAttributeOutputCommon.java
@@ -24,7 +24,7 @@ import java.util.List;
import org.openecomp.sdc.be.datatypes.elements.PropertyRule;
import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
-public interface IAttributeInputCommon {
+public interface IAttributeOutputCommon {
String getType();
ToscaDataDefinition getSchema();
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/OutputDefinition.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/OutputDefinition.java
index fc8cd0f590..cbff8fa3af 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/OutputDefinition.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/OutputDefinition.java
@@ -19,15 +19,15 @@
package org.openecomp.sdc.be.model;
-import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.AttributeDataDefinition;
-public class OutputDefinition extends PropertyDefinition {
+public class OutputDefinition extends AttributeDefinition {
- public OutputDefinition(final PropertyDataDefinition propertyDataDefinition) {
+ public OutputDefinition(final AttributeDataDefinition propertyDataDefinition) {
super(propertyDataDefinition);
}
- public OutputDefinition(PropertyDefinition propertyDefinition) {
+ public OutputDefinition(AttributeDefinition propertyDefinition) {
super(propertyDefinition);
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/Resource.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/Resource.java
index 6f120dc4ca..0e4753c3f7 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/Resource.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/Resource.java
@@ -31,7 +31,6 @@ import lombok.ToString;
import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.utils.MapUtil;
import org.openecomp.sdc.be.datatypes.components.ResourceMetadataDataDefinition;
-import org.openecomp.sdc.be.datatypes.elements.AttributeDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
@@ -55,8 +54,6 @@ public class Resource extends Component {
private Map<String, String> derivedFromMapOfIdToName;
- private List<AttributeDataDefinition> attributes;
-
private String toscaVersion;
public Resource() {
@@ -68,24 +65,24 @@ public class Resource extends Component {
super(componentMetadataDefinition);
if (this.getComponentMetadataDefinition().getMetadataDataDefinition() == null) {
this.getComponentMetadataDefinition().componentMetadataDataDefinition =
- new ResourceMetadataDataDefinition();
+ new ResourceMetadataDataDefinition();
}
this.getComponentMetadataDefinition().getMetadataDataDefinition().setComponentType(ComponentTypeEnum.RESOURCE);
}
public Boolean isAbstract() {
return ((ResourceMetadataDataDefinition) getComponentMetadataDefinition().getMetadataDataDefinition())
- .isAbstract();
+ .isAbstract();
}
public void setAbstract(Boolean isAbstract) {
((ResourceMetadataDataDefinition) getComponentMetadataDefinition().getMetadataDataDefinition())
- .setAbstract(isAbstract);
+ .setAbstract(isAbstract);
}
public String getCost() {
return ((ResourceMetadataDataDefinition) getComponentMetadataDefinition().getMetadataDataDefinition())
- .getCost();
+ .getCost();
}
public void setCost(String cost) {
@@ -94,62 +91,62 @@ public class Resource extends Component {
public String getLicenseType() {
return ((ResourceMetadataDataDefinition) getComponentMetadataDefinition().getMetadataDataDefinition())
- .getLicenseType();
+ .getLicenseType();
}
public void setLicenseType(String licenseType) {
((ResourceMetadataDataDefinition) getComponentMetadataDefinition().getMetadataDataDefinition())
- .setLicenseType(licenseType);
+ .setLicenseType(licenseType);
}
public String getToscaResourceName() {
return ((ResourceMetadataDataDefinition) getComponentMetadataDefinition().getMetadataDataDefinition())
- .getToscaResourceName();
+ .getToscaResourceName();
}
public void setToscaResourceName(String toscaResourceName) {
((ResourceMetadataDataDefinition) getComponentMetadataDefinition().getMetadataDataDefinition())
- .setToscaResourceName(toscaResourceName);
+ .setToscaResourceName(toscaResourceName);
}
public ResourceTypeEnum getResourceType() {
return ((ResourceMetadataDataDefinition) getComponentMetadataDefinition().getMetadataDataDefinition())
- .getResourceType();
+ .getResourceType();
}
public void setResourceType(ResourceTypeEnum resourceType) {
((ResourceMetadataDataDefinition) getComponentMetadataDefinition().getMetadataDataDefinition())
- .setResourceType(resourceType);
+ .setResourceType(resourceType);
}
public String getVendorName() {
return ((ResourceMetadataDataDefinition) getComponentMetadataDefinition().getMetadataDataDefinition())
- .getVendorName();
+ .getVendorName();
}
public void setVendorName(String vendorName) {
((ResourceMetadataDataDefinition) getComponentMetadataDefinition().getMetadataDataDefinition())
- .setVendorName(vendorName);
+ .setVendorName(vendorName);
}
public String getVendorRelease() {
return ((ResourceMetadataDataDefinition) getComponentMetadataDefinition().getMetadataDataDefinition())
- .getVendorRelease();
+ .getVendorRelease();
}
public void setVendorRelease(String vendorRelease) {
((ResourceMetadataDataDefinition) getComponentMetadataDefinition().getMetadataDataDefinition())
- .setVendorRelease(vendorRelease);
+ .setVendorRelease(vendorRelease);
}
public String getResourceVendorModelNumber() {
return ((ResourceMetadataDataDefinition) getComponentMetadataDefinition().getMetadataDataDefinition())
- .getResourceVendorModelNumber();
+ .getResourceVendorModelNumber();
}
public void setResourceVendorModelNumber(String resourceVendorModelNumber) {
((ResourceMetadataDataDefinition) getComponentMetadataDefinition().getMetadataDataDefinition())
- .setResourceVendorModelNumber(resourceVendorModelNumber);
+ .setResourceVendorModelNumber(resourceVendorModelNumber);
}
@Override
@@ -161,22 +158,22 @@ public class Resource extends Component {
String result = super.fetchGenericTypeToscaNameFromConfig();
if (null == result) {
result = ConfigurationManager.getConfigurationManager().getConfiguration().getGenericAssetNodeTypes()
- .get(ResourceTypeEnum.VFC.getValue());
+ .get(ResourceTypeEnum.VFC.getValue());
}
return result;
}
private Optional<String> fetchToscaNameFromConfigBasedOnCategory() {
return getHeadOption(this.getCategories()).flatMap(category -> getHeadOption(category.getSubcategories()).map(
- subCategory -> fetchToscaNameFromConfigBasedOnCategory(category.getName(), subCategory.getName())));
+ subCategory -> fetchToscaNameFromConfigBasedOnCategory(category.getName(), subCategory.getName())));
}
private String fetchToscaNameFromConfigBasedOnCategory(final String resourceCategory,
- final String resourceSubCategory) {
+ final String resourceSubCategory) {
return Optional
- .ofNullable(ConfigurationManager.getConfigurationManager().getConfiguration().getResourceNodeTypes())
- .map(categoryNames -> categoryNames.get(resourceCategory))
- .map(subCategoryNames -> subCategoryNames.get(resourceSubCategory)).orElse(null);
+ .ofNullable(ConfigurationManager.getConfigurationManager().getConfiguration().getResourceNodeTypes())
+ .map(categoryNames -> categoryNames.get(resourceCategory))
+ .map(subCategoryNames -> subCategoryNames.get(resourceSubCategory)).orElse(null);
}
@Override
@@ -192,16 +189,16 @@ public class Resource extends Component {
@Override
public boolean deriveFromGeneric() {
return this.shouldGenerateInputs()
- || (derivedFrom != null && derivedFrom.contains(fetchGenericTypeToscaNameFromConfig()));
+ || (derivedFrom != null && derivedFrom.contains(fetchGenericTypeToscaNameFromConfig()));
}
public Map<String, List<RequirementCapabilityRelDef>> groupRelationsFromCsarByInstanceName(Resource resource) {
List<RequirementCapabilityRelDef> componentInstanceRelationsFromCsar = resource.getComponentInstancesRelations()
- .stream().filter(r -> !r.isOriginUI()).collect(Collectors.toList());
+ .stream().filter(r -> !r.isOriginUI()).collect(Collectors.toList());
Map<String, List<RequirementCapabilityRelDef>> relationsByInstanceId =
- MapUtil.groupListBy(componentInstanceRelationsFromCsar, RequirementCapabilityRelDef::getFromNode);
+ MapUtil.groupListBy(componentInstanceRelationsFromCsar, RequirementCapabilityRelDef::getFromNode);
return MapUtil.convertMapKeys(relationsByInstanceId,
- instId -> getInstanceInvariantNameFromInstanceId(resource, instId));
+ instId -> getInstanceInvariantNameFromInstanceId(resource, instId));
}
private String getInstanceInvariantNameFromInstanceId(Resource resource, String instId) {
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/datamodel/NodeType.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/datamodel/NodeType.java
index a1b07bc58d..2153e22c1d 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/datamodel/NodeType.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/datamodel/NodeType.java
@@ -24,7 +24,6 @@ import java.util.List;
import java.util.Map;
import lombok.Getter;
import lombok.Setter;
-import org.openecomp.sdc.be.datatypes.elements.AttributeDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.InterfaceDataDefinition;
@Getter
@@ -38,6 +37,5 @@ public class NodeType extends ToscaElement {
private List<String> derivedFrom;
private List<String> derivedList;
private Map<String, String> derivedFromMapOfIdToName;
- private Map<String, AttributeDataDefinition> attributes;
private Map<String, InterfaceDataDefinition> interfaceArtifacts;
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/datamodel/ToscaElement.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/datamodel/ToscaElement.java
index baea051538..78d4763245 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/datamodel/ToscaElement.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/datamodel/ToscaElement.java
@@ -28,6 +28,7 @@ import lombok.Getter;
import lombok.Setter;
import org.openecomp.sdc.be.datatypes.elements.AdditionalInfoParameterDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.AttributeDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.DataTypeDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.ListCapabilityDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.ListRequirementDataDefinition;
@@ -54,6 +55,7 @@ public abstract class ToscaElement {
private Map<String, ArtifactDataDefinition> deploymentArtifacts;
private Map<String, AdditionalInfoParameterDataDefinition> additionalInformation;
private Map<String, PropertyDataDefinition> properties;
+ private Map<String, AttributeDataDefinition> attributes;
private Map<String, ListCapabilityDataDefinition> capabilities;
private Map<String, MapPropertiesDataDefinition> capabilitiesProperties;
private Map<String, ListRequirementDataDefinition> requirements;
@@ -67,7 +69,7 @@ public abstract class ToscaElement {
private Map<String, String> allVersions;
private String toscaVersion;
- public ToscaElement(ToscaElementTypeEnum toscaType){
+ protected ToscaElement(ToscaElementTypeEnum toscaType){
this.toscaType = toscaType;
}
@@ -207,7 +209,7 @@ public abstract class ToscaElement {
public Long getArchiveTime() {
Object archiveTime = getMetadataValue(JsonPresentationFields.ARCHIVE_TIME);
if (archiveTime instanceof Integer){
- return new Long((Integer)getMetadataValue(JsonPresentationFields.ARCHIVE_TIME));
+ return Long.valueOf((Integer)getMetadataValue(JsonPresentationFields.ARCHIVE_TIME));
}
return (Long)archiveTime;
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTypeOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTypeOperation.java
index 80570e0869..a67f92fff2 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTypeOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTypeOperation.java
@@ -210,7 +210,7 @@ public class NodeTypeOperation extends ToscaElementOperation {
}
}
- if (!componentParametersView.isIgnoreAttributesFrom()) {
+ if (!componentParametersView.isIgnoreAttributes()) {
status = setResourceAttributesFromGraph(componentV, toscaElement);
if (status != JanusGraphOperationStatus.OK) {
return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/TopologyTemplateOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/TopologyTemplateOperation.java
index 92e10a955f..ed9196098e 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/TopologyTemplateOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/TopologyTemplateOperation.java
@@ -25,7 +25,6 @@ import fj.data.Either;
import java.lang.reflect.Type;
import java.util.*;
import java.util.Map.Entry;
-import java.util.function.BiFunction;
import java.util.stream.Collectors;
import org.apache.commons.collections.MapUtils;
import org.apache.tinkerpop.gremlin.structure.Direction;
@@ -51,11 +50,9 @@ import org.openecomp.sdc.be.datatypes.elements.InterfaceDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.ListCapabilityDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.ListRequirementDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.MapArtifactDataDefinition;
-import org.openecomp.sdc.be.datatypes.elements.MapCapabilityProperty;
import org.openecomp.sdc.be.datatypes.elements.MapDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.MapGroupsDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.MapInterfaceDataDefinition;
-import org.openecomp.sdc.be.datatypes.elements.MapListCapabilityDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.MapListRequirementDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.MapPropertiesDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.PolicyDataDefinition;
@@ -661,6 +658,12 @@ public class TopologyTemplateOperation extends ToscaElementOperation {
return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
}
}
+ if (!componentParametersView.isIgnoreComponentInstancesAttributes()) {
+ status = setComponentInstancesAttributesFromGraph(componentV, toscaElement);
+ if (status != JanusGraphOperationStatus.OK) {
+ return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
+ }
+ }
if (!componentParametersView.isIgnoreCapabilities()) {
status = setCapabilitiesFromGraph(componentV, toscaElement);
if (status != JanusGraphOperationStatus.OK) {
@@ -742,7 +745,7 @@ public class TopologyTemplateOperation extends ToscaElementOperation {
}
}
- if (!componentParametersView.isIgnoreForwardingPath()) {
+ if (!componentParametersView.isIgnoreServicePath()) {
status = setForwardingGraphPropertiesFromGraph(componentV, toscaElement);
if (status != JanusGraphOperationStatus.OK) {
return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status));
@@ -959,6 +962,18 @@ public class TopologyTemplateOperation extends ToscaElementOperation {
return JanusGraphOperationStatus.OK;
}
+ private JanusGraphOperationStatus setComponentInstancesAttributesFromGraph(final GraphVertex componentV,
+ final TopologyTemplate topologyTemplate) {
+ final Either<Map<String, MapAttributesDataDefinition>, JanusGraphOperationStatus> result =
+ getDataFromGraph(componentV, EdgeLabelEnum.INST_ATTRIBUTES);
+ if (result.isLeft()) {
+ topologyTemplate.setInstAttributes(result.left().value());
+ } else if (result.right().value() != JanusGraphOperationStatus.NOT_FOUND) {
+ return result.right().value();
+ }
+ return JanusGraphOperationStatus.OK;
+ }
+
private JanusGraphOperationStatus setComponentInstancesInputsFromGraph(GraphVertex componentV, TopologyTemplate topologyTemplate) {
Either<Map<String, MapPropertiesDataDefinition>, JanusGraphOperationStatus> result = getDataFromGraph(componentV, EdgeLabelEnum.INST_INPUTS);
if (result.isLeft()) {
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperation.java
index 637c91324e..5dbce38ee2 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaElementOperation.java
@@ -921,7 +921,7 @@ public abstract class ToscaElementOperation extends BaseOperation {
switch (label) {
case NODE_TYPE:
toscaElement = new NodeType();
- ((NodeType) toscaElement).setAttributes(getAttributesFromComponentV(componentV));
+ toscaElement.setAttributes(getAttributesFromComponentV(componentV));
break;
case TOPOLOGY_TEMPLATE:
toscaElement = new TopologyTemplate();
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 532a641e2f..b16e129d2e 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
@@ -56,7 +56,6 @@ import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition;
-import org.openecomp.sdc.be.datatypes.elements.AttributeDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.CapabilityDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.ComponentInstanceDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.DataTypeDataDefinition;
@@ -79,6 +78,7 @@ import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.PromoteVersionEnum;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.be.model.ArtifactDefinition;
+import org.openecomp.sdc.be.model.AttributeDefinition;
import org.openecomp.sdc.be.model.CapabilityDefinition;
import org.openecomp.sdc.be.model.CatalogUpdateTimestamp;
import org.openecomp.sdc.be.model.Component;
@@ -155,7 +155,7 @@ public class ToscaOperationFacade {
public <T extends Component> Either<T, StorageOperationStatus> getToscaFullElement(String componentId) {
ComponentParametersView filters = new ComponentParametersView();
filters.setIgnoreCapabiltyProperties(false);
- filters.setIgnoreForwardingPath(false);
+ filters.setIgnoreServicePath(false);
return getToscaElement(componentId, filters);
}
@@ -286,7 +286,8 @@ public class ToscaOperationFacade {
// region - ToscaElement Delete
public StorageOperationStatus markComponentToDelete(Component componentToDelete) {
- if ((componentToDelete.getIsDeleted() != null) && componentToDelete.getIsDeleted() && !componentToDelete.isHighestVersion()) {
+ if (Boolean.TRUE.equals(componentToDelete.getIsDeleted())
+ && Boolean.FALSE.equals(componentToDelete.isHighestVersion())) {
// component already marked for delete
return StorageOperationStatus.OK;
} else {
@@ -294,7 +295,8 @@ public class ToscaOperationFacade {
Either<GraphVertex, JanusGraphOperationStatus> getResponse = janusGraphDao
.getVertexById(componentToDelete.getUniqueId(), JsonParseFlagEnum.ParseAll);
if (getResponse.isRight()) {
- log.debug(COULDNT_FETCH_COMPONENT_WITH_AND_UNIQUE_ID_ERROR, componentToDelete.getUniqueId(), getResponse.right().value());
+ log.debug(COULDNT_FETCH_COMPONENT_WITH_AND_UNIQUE_ID_ERROR, componentToDelete.getUniqueId(),
+ getResponse.right().value());
return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getResponse.right().value());
}
@@ -360,7 +362,7 @@ public class ToscaOperationFacade {
public <T extends Component> Either<T, StorageOperationStatus> getFullLatestComponentByToscaResourceName(String toscaResourceName) {
ComponentParametersView fetchAllFilter = new ComponentParametersView();
- fetchAllFilter.setIgnoreForwardingPath(true);
+ fetchAllFilter.setIgnoreServicePath(true);
fetchAllFilter.setIgnoreCapabiltyProperties(false);
return getLatestByName(GraphPropertyEnum.TOSCA_RESOURCE_NAME, toscaResourceName, JsonParseFlagEnum.ParseAll, fetchAllFilter);
}
@@ -1203,10 +1205,11 @@ public class ToscaOperationFacade {
Either<GraphVertex, JanusGraphOperationStatus> getVertexEither = janusGraphDao
.getVertexById(componentId, JsonParseFlagEnum.NoParse);
if (getVertexEither.isRight()) {
- log.debug("Couldn't fetch component with and unique id {}, error: {}", componentId, getVertexEither.right().value());
- return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getVertexEither.right().value()));
+ log.debug(COULDNT_FETCH_COMPONENT_WITH_AND_UNIQUE_ID_ERROR, componentId, getVertexEither.right().value());
+ return Either
+ .right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(getVertexEither.right().value()));
- }
+ }
Either<ToscaElement, StorageOperationStatus> toscaElement =
topologyTemplateOperation.getToscaElement(componentId);
@@ -1626,7 +1629,7 @@ public class ToscaOperationFacade {
}
- public StorageOperationStatus associateInstAttributeToComponentToInstances(Map<String, List<AttributeDataDefinition>> instArttributes, Component component) {
+ public StorageOperationStatus associateInstAttributeToComponentToInstances(Map<String, List<AttributeDefinition>> instArttributes, Component component) {
Either<GraphVertex, JanusGraphOperationStatus> getVertexEither = janusGraphDao.getVertexById(component.getUniqueId(), JsonParseFlagEnum.NoParse);
if (getVertexEither.isRight()) {
@@ -1640,11 +1643,11 @@ public class ToscaOperationFacade {
if (instArttributes != null) {
MapAttributesDataDefinition attributesMap;
- for (Entry<String, List<AttributeDataDefinition>> entry : instArttributes.entrySet()) {
- final List<AttributeDataDefinition> value = entry.getValue();
+ for (Entry<String, List<AttributeDefinition>> entry : instArttributes.entrySet()) {
+ final List<AttributeDefinition> value = entry.getValue();
attributesMap = new MapAttributesDataDefinition();
- attributesMap.setMapToscaDataDefinition(value.stream().map(AttributeDataDefinition::new)
- .collect(Collectors.toMap(AttributeDataDefinition::getName, e -> e)));
+ attributesMap.setMapToscaDataDefinition(value.stream().map(AttributeDefinition::new)
+ .collect(Collectors.toMap(AttributeDefinition::getName, e -> e)));
instAttr.put(entry.getKey(), attributesMap);
}
}
@@ -2081,7 +2084,7 @@ public class ToscaOperationFacade {
if (latestComponents.size() > 1) {
for (Component component : latestComponents) {
- if (component.isHighestVersion()) {
+ if (Boolean.TRUE.equals(component.isHighestVersion())) {
LinkedList<Component> highestComponent = new LinkedList<>();
highestComponent.add(component);
return Either.left(highestComponent);
@@ -2235,7 +2238,7 @@ public class ToscaOperationFacade {
// correct audit records!!!!!
return Either.right(StorageOperationStatus.NOT_FOUND);
}
- return getToscaElement((String) resourceMetadataData.getUniqueId());
+ return getToscaElement(resourceMetadataData.getUniqueId());
}
} else {
resourceMetadataDataList = byCsar.left().value();
@@ -2551,17 +2554,19 @@ public class ToscaOperationFacade {
Either<PropertyDefinition, StorageOperationStatus> result = null;
StorageOperationStatus status = getToscaElementOperation(component).updateToscaDataOfToscaElement(component.getUniqueId(), EdgeLabelEnum.PROPERTIES, VertexTypeEnum.PROPERTIES, newPropertyDefinition, JsonPresentationFields.NAME);
if (status != StorageOperationStatus.OK) {
- CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to add the property {} to the resource {}. Status is {}. ", newPropertyDefinition.getName(), component.getName(), status);
- result = Either.right(status);
- }
+ CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, FAILED_TO_ADD_THE_PROPERTY_TO_THE_RESOURCE_STATUS_IS,
+ newPropertyDefinition.getName(), component.getName(), status);
+ result = Either.right(status);
+ }
if (result == null) {
ComponentParametersView filter = new ComponentParametersView(true);
filter.setIgnoreProperties(false);
getUpdatedComponentRes = getToscaElement(component.getUniqueId(), filter);
if (getUpdatedComponentRes.isRight()) {
- CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to get updated resource {}. Status is {}. ", component.getUniqueId(), getUpdatedComponentRes.right().value());
- result = Either.right(status);
- }
+ CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, FAILED_TO_GET_UPDATED_RESOURCE_STATUS_IS,
+ component.getUniqueId(), getUpdatedComponentRes.right().value());
+ result = Either.right(status);
+ }
}
if (result == null) {
Optional<PropertyDefinition> newProperty = (getUpdatedComponentRes.left().value())
@@ -2569,17 +2574,19 @@ public class ToscaOperationFacade {
if (newProperty.isPresent()) {
result = Either.left(newProperty.get());
} else {
- CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to find recently added property {} on the resource {}. Status is {}. ", newPropertyDefinition.getName(), component.getUniqueId(), StorageOperationStatus.NOT_FOUND);
- result = Either.right(StorageOperationStatus.NOT_FOUND);
- }
+ CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG,
+ FAILED_TO_FIND_RECENTLY_ADDED_PROPERTY_ON_THE_RESOURCE_STATUS_IS, newPropertyDefinition.getName(),
+ component.getUniqueId(), StorageOperationStatus.NOT_FOUND);
+ result = Either.right(StorageOperationStatus.NOT_FOUND);
+ }
}
return result;
}
- public Either<AttributeDataDefinition, StorageOperationStatus> addAttributeOfResource(Component component, AttributeDataDefinition newAttributeDef) {
+ public Either<AttributeDefinition, StorageOperationStatus> addAttributeOfResource(Component component, AttributeDefinition newAttributeDef) {
Either<Component, StorageOperationStatus> getUpdatedComponentRes = null;
- Either<AttributeDataDefinition, StorageOperationStatus> result = null;
+ Either<AttributeDefinition, StorageOperationStatus> result = null;
if (newAttributeDef.getUniqueId() == null || newAttributeDef.getUniqueId().isEmpty()) {
String attUniqueId = UniqueIdBuilder.buildAttributeUid(component.getUniqueId(), newAttributeDef.getName());
newAttributeDef.setUniqueId(attUniqueId);
@@ -2593,7 +2600,7 @@ public class ToscaOperationFacade {
}
if (result == null) {
ComponentParametersView filter = new ComponentParametersView(true);
- filter.setIgnoreAttributesFrom(false);
+ filter.setIgnoreAttributes(false);
getUpdatedComponentRes = getToscaElement(component.getUniqueId(), filter);
if (getUpdatedComponentRes.isRight()) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, FAILED_TO_GET_UPDATED_RESOURCE_STATUS_IS, component.getUniqueId(), getUpdatedComponentRes.right().value());
@@ -2601,7 +2608,7 @@ public class ToscaOperationFacade {
}
}
if (result == null) {
- Optional<AttributeDataDefinition> newAttribute = ((Resource) getUpdatedComponentRes.left().value())
+ Optional<AttributeDefinition> newAttribute = ((Resource) getUpdatedComponentRes.left().value())
.getAttributes().stream().filter(p -> p.getName().equals(newAttributeDef.getName())).findAny();
if (newAttribute.isPresent()) {
result = Either.left(newAttribute.get());
@@ -2613,10 +2620,10 @@ public class ToscaOperationFacade {
return result;
}
- public Either<AttributeDataDefinition, StorageOperationStatus> updateAttributeOfResource(Component component, AttributeDataDefinition newAttributeDef) {
+ public Either<AttributeDefinition, StorageOperationStatus> updateAttributeOfResource(Component component, AttributeDefinition newAttributeDef) {
Either<Component, StorageOperationStatus> getUpdatedComponentRes = null;
- Either<AttributeDataDefinition, StorageOperationStatus> result = null;
+ Either<AttributeDefinition, StorageOperationStatus> result = null;
StorageOperationStatus status = getToscaElementOperation(component).updateToscaDataOfToscaElement(component.getUniqueId(), EdgeLabelEnum.ATTRIBUTES, VertexTypeEnum.ATTRIBUTES, newAttributeDef, JsonPresentationFields.NAME);
if (status != StorageOperationStatus.OK) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, FAILED_TO_ADD_THE_PROPERTY_TO_THE_RESOURCE_STATUS_IS, newAttributeDef.getName(), component.getName(), status);
@@ -2624,7 +2631,7 @@ public class ToscaOperationFacade {
}
if (result == null) {
ComponentParametersView filter = new ComponentParametersView(true);
- filter.setIgnoreAttributesFrom(false);
+ filter.setIgnoreAttributes(false);
getUpdatedComponentRes = getToscaElement(component.getUniqueId(), filter);
if (getUpdatedComponentRes.isRight()) {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, FAILED_TO_GET_UPDATED_RESOURCE_STATUS_IS, component.getUniqueId(), getUpdatedComponentRes.right().value());
@@ -2632,7 +2639,7 @@ public class ToscaOperationFacade {
}
}
if (result == null) {
- Optional<AttributeDataDefinition> newProperty = ((Resource) getUpdatedComponentRes.left().value())
+ Optional<AttributeDefinition> newProperty = ((Resource) getUpdatedComponentRes.left().value())
.getAttributes().stream().filter(p -> p.getName().equals(newAttributeDef.getName())).findAny();
if (newProperty.isPresent()) {
result = Either.left(newProperty.get());
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/ModelConverter.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/ModelConverter.java
index 2c51ff472c..db6a8e100f 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/ModelConverter.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/ModelConverter.java
@@ -7,9 +7,9 @@
* 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.
@@ -40,7 +40,6 @@ import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
-import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
@@ -128,6 +127,10 @@ import org.openecomp.sdc.be.ui.model.PropertyAssignmentUi;
import org.openecomp.sdc.common.log.wrappers.Logger;
public class ModelConverter {
+
+ private ModelConverter() {
+ }
+
public static final String CAP_PROP_DELIM = "#";
private static final Logger log = Logger.getLogger(ModelConverter.class);
@@ -142,13 +145,13 @@ public class ModelConverter {
@SuppressWarnings("unchecked")
public static <T extends Component> T convertFromToscaElement(ToscaElement toscaElement) {
switch (toscaElement.getComponentType()) {
- case RESOURCE:
- return (T) convertToResource(toscaElement);
- case SERVICE:
- case PRODUCT:
- return (T) convertToService(toscaElement);
- default:
- return null;
+ case RESOURCE:
+ return (T) convertToResource(toscaElement);
+ case SERVICE:
+ case PRODUCT:
+ return (T) convertToService(toscaElement);
+ default:
+ return null;
}
}
@@ -189,9 +192,9 @@ public class ModelConverter {
}
}
- private static Service convertToService(ToscaElement toscaElement) {
- Service service = new Service();
- convertComponentFields(service, toscaElement);
+ private static Service convertToService(ToscaElement toscaElement) {
+ Service service = new Service();
+ convertComponentFields(service, toscaElement);
convertServiceSpecificFields(toscaElement, service);
@@ -199,19 +202,17 @@ public class ModelConverter {
convertComponentInstances(topologyTemplate, service);
- convertInputs(topologyTemplate, service);
+ convertInputs(topologyTemplate, service);
- convertProperties(topologyTemplate, service);
+ convertProperties(topologyTemplate, service);
- convertPolicies(topologyTemplate, service);
-
- convertProperties(topologyTemplate, service);
+ convertPolicies(topologyTemplate, service);
- convertPolicies(topologyTemplate, service);
+ convertAttributesToComponent(topologyTemplate, service);
convertGroups(topologyTemplate, service);
- setCapabilitiesToComponentAndGroups(topologyTemplate, service);
+ setCapabilitiesToComponentAndGroups(topologyTemplate, service);
convertPolicies(topologyTemplate, service);
@@ -236,18 +237,18 @@ public class ModelConverter {
return service;
}
- private static void convertServiceSpecificFields(ToscaElement toscaElement, Service service) {
- service.setProjectCode((String) toscaElement.getMetadataValue(JsonPresentationFields.PROJECT_CODE));
- service.setDistributionStatus(DistributionStatusEnum
- .findState((String) toscaElement.getMetadataValue(JsonPresentationFields.DISTRIBUTION_STATUS)));
- service.setEcompGeneratedNaming(
- (Boolean) toscaElement.getMetadataValueOrDefault(JsonPresentationFields.ECOMP_GENERATED_NAMING, true));
- service.setNamingPolicy((String) toscaElement.getMetadataValueOrDefault(JsonPresentationFields.NAMING_POLICY,
- StringUtils.EMPTY));
- service.setEnvironmentContext(
- (String) toscaElement.getMetadataValue(JsonPresentationFields.ENVIRONMENT_CONTEXT));
- service.setInstantiationType((String) toscaElement.getMetadataValueOrDefault(JsonPresentationFields.INSTANTIATION_TYPE, StringUtils.EMPTY));
- }
+ private static void convertServiceSpecificFields(ToscaElement toscaElement, Service service) {
+ service.setProjectCode((String) toscaElement.getMetadataValue(JsonPresentationFields.PROJECT_CODE));
+ service.setDistributionStatus(DistributionStatusEnum
+ .findState((String) toscaElement.getMetadataValue(JsonPresentationFields.DISTRIBUTION_STATUS)));
+ service.setEcompGeneratedNaming(
+ (Boolean) toscaElement.getMetadataValueOrDefault(JsonPresentationFields.ECOMP_GENERATED_NAMING, true));
+ service.setNamingPolicy((String) toscaElement.getMetadataValueOrDefault(JsonPresentationFields.NAMING_POLICY,
+ StringUtils.EMPTY));
+ service.setEnvironmentContext(
+ (String) toscaElement.getMetadataValue(JsonPresentationFields.ENVIRONMENT_CONTEXT));
+ service.setInstantiationType((String) toscaElement.getMetadataValueOrDefault(JsonPresentationFields.INSTANTIATION_TYPE, StringUtils.EMPTY));
+ }
private static Resource convertToResource(ToscaElement toscaElement) {
Resource resource = new Resource();
@@ -264,29 +265,30 @@ public class ModelConverter {
if (toscaVersion != null) {
resource.setToscaVersion(toscaVersion);
}
- convertAttributes(nodeType, resource);
+ convertAttributesToResource(nodeType, resource);
convertCapabilities(nodeType, resource);
convertRequirements(nodeType, resource);
convertInterfaces(nodeType, resource);
convertDataTypes(nodeType, resource);
- } else {
- TopologyTemplate topologyTemplate = (TopologyTemplate) toscaElement;
- if (resource.getResourceType() == ResourceTypeEnum.VF || resource.getResourceType() == ResourceTypeEnum.PNF) {
- resource.setCsarUUID((String) topologyTemplate.getMetadataValue(JsonPresentationFields.CSAR_UUID));
- resource.setCsarVersion((String) topologyTemplate.getMetadataValue(JsonPresentationFields.CSAR_VERSION));
- resource.setImportedToscaChecksum((String) topologyTemplate.getMetadataValue(JsonPresentationFields.IMPORTED_TOSCA_CHECKSUM));
+ } else {
+ TopologyTemplate topologyTemplate = (TopologyTemplate) toscaElement;
+ if (resource.getResourceType() == ResourceTypeEnum.VF || resource.getResourceType() == ResourceTypeEnum.PNF) {
+ resource.setCsarUUID((String) topologyTemplate.getMetadataValue(JsonPresentationFields.CSAR_UUID));
+ resource.setCsarVersion((String) topologyTemplate.getMetadataValue(JsonPresentationFields.CSAR_VERSION));
+ resource.setImportedToscaChecksum((String) topologyTemplate.getMetadataValue(JsonPresentationFields.IMPORTED_TOSCA_CHECKSUM));
convertInterfaces(topologyTemplate, resource);
}
convertComponentInstances(topologyTemplate, resource);
convertRelations(topologyTemplate, resource);
convertInputs(topologyTemplate, resource);
convertGroups(topologyTemplate, resource);
- setCapabilitiesToComponentAndGroups(topologyTemplate, resource);
+ setCapabilitiesToComponentAndGroups(topologyTemplate, resource);
convertPolicies(topologyTemplate, resource);
convertNodeFiltersComponents(topologyTemplate, resource);
convertSubstitutionFiltersComponents(topologyTemplate, resource);
convertProperties(topologyTemplate, resource);
+ convertAttributesToComponent(topologyTemplate, resource);
setCapabilitiesToComponent(topologyTemplate, resource);
setRequirementsToComponent(topologyTemplate, resource);
convertDataTypes(topologyTemplate, resource);
@@ -295,7 +297,7 @@ public class ModelConverter {
convertAdditionalInformation(toscaElement, resource);
return resource;
- }
+ }
private static void convertInterfaces(TopologyTemplate toscaElement, Resource resource) {
Map<String, InterfaceDataDefinition> interfaces = toscaElement.getInterfaces();
@@ -319,25 +321,20 @@ public class ModelConverter {
service.setInterfaces(copy);
}
- private static void convertAttributes(NodeType nodeType, Resource resource) {
+ private static void convertAttributesToResource(NodeType nodeType, Resource resource) {
Map<String, AttributeDataDefinition> attributes = nodeType.getAttributes();
if (attributes != null) {
- final List<AttributeDataDefinition> attrs = attributes.values().stream()
- .collect(Collectors.toList());
- resource.setAttributes(attrs);
+ final Map<String, AttributeDefinition> attributeDefinitionMap = attributes.entrySet().stream()
+ .collect(Collectors.toMap(Entry::getKey, o -> new AttributeDefinition(o.getValue())));
+ resource.setAttributes(new ArrayList<>(attributeDefinitionMap.values()));
}
}
- private static PropertyDefinition fromDataDefinition(String resourceId, PropertyDataDefinition dataDefinition) {
- PropertyDefinition attributeDefinition = new PropertyDefinition(dataDefinition);
- attributeDefinition.setParentUniqueId(resourceId);
- return attributeDefinition;
- }
-
private static void convertInterfaces(NodeType nodeType, Resource resource) {
Map<String, InterfaceDataDefinition> interfaceArtifacts = nodeType.getInterfaceArtifacts();
if (interfaceArtifacts != null) {
- Map<String, InterfaceDefinition> interfaces = interfaceArtifacts.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, en -> new InterfaceDefinition(en.getValue())));
+ Map<String, InterfaceDefinition> interfaces = interfaceArtifacts.entrySet().stream()
+ .collect(Collectors.toMap(Map.Entry::getKey, en -> new InterfaceDefinition(en.getValue())));
resource.setInterfaces(interfaces);
}
}
@@ -380,14 +377,16 @@ public class ModelConverter {
}
- public static void setComponentInstancesInformationalArtifactsToComponent(Map<String, MapArtifactDataDefinition> instanceArtifacts, Component component) {
+ public static void setComponentInstancesInformationalArtifactsToComponent(Map<String, MapArtifactDataDefinition> instanceArtifacts,
+ Component component) {
List<ComponentInstance> instances = component.getComponentInstances();
if (instanceArtifacts != null && instances != null) {
instanceArtifacts.entrySet().forEach(e -> {
Optional<ComponentInstance> ci = instances.stream().filter(i -> i.getUniqueId().equals(e.getKey())).findFirst();
if (ci.isPresent()) {
Map<String, ArtifactDataDefinition> mapToscaDataDefinition = e.getValue().getMapToscaDataDefinition();
- Map<String, ArtifactDefinition> deplArt = mapToscaDataDefinition.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, en -> new ArtifactDefinition(en.getValue())));
+ Map<String, ArtifactDefinition> deplArt = mapToscaDataDefinition.entrySet().stream()
+ .collect(Collectors.toMap(Map.Entry::getKey, en -> new ArtifactDefinition(en.getValue())));
ci.get().setArtifacts(deplArt);
}
@@ -395,14 +394,16 @@ public class ModelConverter {
}
}
- public static void setComponentInstancesDeploymentArtifactsToComponent(Map<String, MapArtifactDataDefinition> instDeploymentArtifacts, Component component) {
+ public static void setComponentInstancesDeploymentArtifactsToComponent(Map<String, MapArtifactDataDefinition> instDeploymentArtifacts,
+ Component component) {
List<ComponentInstance> instances = component.getComponentInstances();
if (instDeploymentArtifacts != null && instances != null) {
instDeploymentArtifacts.entrySet().forEach(e -> {
Optional<ComponentInstance> ci = instances.stream().filter(i -> i.getUniqueId().equals(e.getKey())).findFirst();
if (ci.isPresent()) {
Map<String, ArtifactDataDefinition> mapToscaDataDefinition = e.getValue().getMapToscaDataDefinition();
- Map<String, ArtifactDefinition> deplArt = mapToscaDataDefinition.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, en -> new ArtifactDefinition(en.getValue())));
+ Map<String, ArtifactDefinition> deplArt = mapToscaDataDefinition.entrySet().stream()
+ .collect(Collectors.toMap(Map.Entry::getKey, en -> new ArtifactDefinition(en.getValue())));
ci.get().setDeploymentArtifacts(deplArt);
}
@@ -543,7 +544,7 @@ public class ModelConverter {
private static void convertCapabilities(Component component, TopologyTemplate topologyTemplate) {
convertTopologyTemplateCapabilities(component, topologyTemplate);
- if(componentInstancesCapabilitiesExist(component) || groupsCapabilitiesExist(component)){
+ if (componentInstancesCapabilitiesExist(component) || groupsCapabilitiesExist(component)) {
topologyTemplate.setCalculatedCapabilities(new HashMap<>());
topologyTemplate.setCalculatedCapabilitiesProperties(new HashMap<>());
}
@@ -552,11 +553,11 @@ public class ModelConverter {
}
private static void convertGroupsCapabilities(Component component, TopologyTemplate topologyTemplate) {
- if(groupsCapabilitiesExist(component)){
+ if (groupsCapabilitiesExist(component)) {
component.getGroups()
- .stream()
- .filter(g -> MapUtils.isNotEmpty(g.getCapabilities()))
- .forEach(g -> addCapabilities(topologyTemplate, g.getCapabilities(), g.getUniqueId()));
+ .stream()
+ .filter(g -> MapUtils.isNotEmpty(g.getCapabilities()))
+ .forEach(g -> addCapabilities(topologyTemplate, g.getCapabilities(), g.getUniqueId()));
}
}
@@ -566,21 +567,22 @@ public class ModelConverter {
Map<String, ListCapabilityDataDefinition> toscaCapMap = new HashMap<>();
Map<String, MapPropertiesDataDefinition> toscaCapPropMap = new HashMap<>();
- if (MapUtils.isNotEmpty(capabilities )) {
+ if (MapUtils.isNotEmpty(capabilities)) {
capabilities.forEach((s, caps) -> {
- if (CollectionUtils.isNotEmpty(caps)) {
- List<CapabilityDataDefinition> capList = caps.stream().filter(capabilityDefinition -> capabilityDefinition.getOwnerId()
- .equals(component.getUniqueId())).map(CapabilityDataDefinition::new).collect(Collectors.toList());
+ if (CollectionUtils.isNotEmpty(caps)) {
+ List<CapabilityDataDefinition> capList = caps.stream().filter(capabilityDefinition -> capabilityDefinition.getOwnerId()
+ .equals(component.getUniqueId())).map(CapabilityDataDefinition::new).collect(Collectors.toList());
- populateCapabilityMap(toscaCapMap, toscaCapPropMap, s, caps, capList);
- }
+ populateCapabilityMap(toscaCapMap, toscaCapPropMap, s, caps, capList);
}
+ }
);
toscaElement.setCapabilities(toscaCapMap);
toscaElement.setCapabilitiesProperties(toscaCapPropMap);
}
}
+
private static void populateCapabilityMap(Map<String, ListCapabilityDataDefinition> toscaCapMap,
Map<String, MapPropertiesDataDefinition> toscaCapPropMap,
String s, List<CapabilityDefinition> caps,
@@ -607,26 +609,27 @@ public class ModelConverter {
Map<String, ListRequirementDataDefinition> toscaReqMap = new HashMap<>();
- if (MapUtils.isNotEmpty(requirements )) {
- requirements.forEach((s, reqs)-> {
- if (CollectionUtils.isNotEmpty(reqs)) {
- List<RequirementDataDefinition> reqList = reqs.stream().filter(requirementDefinition -> requirementDefinition.getOwnerId()
- .equals(component.getUniqueId())).map(RequirementDataDefinition::new).collect(Collectors.toList());
+ if (MapUtils.isNotEmpty(requirements)) {
+ requirements.forEach((s, reqs) -> {
+ if (CollectionUtils.isNotEmpty(reqs)) {
+ List<RequirementDataDefinition> reqList = reqs.stream().filter(requirementDefinition -> requirementDefinition.getOwnerId()
+ .equals(component.getUniqueId())).map(RequirementDataDefinition::new).collect(Collectors.toList());
- ListRequirementDataDefinition listRequirementDataDefinition = new ListRequirementDataDefinition(reqList);
- toscaReqMap.put(s, listRequirementDataDefinition);
- }
+ ListRequirementDataDefinition listRequirementDataDefinition = new ListRequirementDataDefinition(reqList);
+ toscaReqMap.put(s, listRequirementDataDefinition);
}
+ }
);
toscaElement.setRequirements(toscaReqMap);
}
}
+
private static void convertComponentInstancesCapabilities(Component component, TopologyTemplate topologyTemplate) {
if (componentInstancesCapabilitiesExist(component)) {
component.getComponentInstances()
- .stream()
- .filter(i -> MapUtils.isNotEmpty(i.getCapabilities()))
- .forEach(i -> addCapabilities(topologyTemplate, i.getCapabilities(), i.getUniqueId()));
+ .stream()
+ .filter(i -> MapUtils.isNotEmpty(i.getCapabilities()))
+ .forEach(i -> addCapabilities(topologyTemplate, i.getCapabilities(), i.getUniqueId()));
}
}
@@ -645,104 +648,113 @@ public class ModelConverter {
private static boolean componentInstancesCapabilitiesExist(Component component) {
return component.getCapabilities() != null && component.getComponentInstances() != null
- && component.getComponentInstances()
- .stream()
- .anyMatch(ci->MapUtils.isNotEmpty(ci.getCapabilities()));
+ && component.getComponentInstances()
+ .stream()
+ .anyMatch(ci -> MapUtils.isNotEmpty(ci.getCapabilities()));
}
+
private static boolean groupsCapabilitiesExist(Component component) {
return component.getCapabilities() != null && component.getGroups() != null
- && component.getGroups()
- .stream()
- .anyMatch(g->MapUtils.isNotEmpty(g.getCapabilities()));
+ && component.getGroups()
+ .stream()
+ .anyMatch(g -> MapUtils.isNotEmpty(g.getCapabilities()));
}
- public static MapCapabilityProperty convertToMapOfMapCapabilityProperties(Map<String, List<CapabilityDefinition>> capabilities, String ownerId, boolean isAtomicType) {
+ public static MapCapabilityProperty convertToMapOfMapCapabilityProperties(Map<String, List<CapabilityDefinition>> capabilities, String ownerId,
+ boolean isAtomicType) {
Map<String, MapPropertiesDataDefinition> toscaCapPropMap = new HashMap<>();
- if(MapUtils.isNotEmpty(capabilities)){
- capabilities.forEach((s, caps)-> addCapsProperties(ownerId, isAtomicType, toscaCapPropMap, caps));
+ if (MapUtils.isNotEmpty(capabilities)) {
+ capabilities.forEach((s, caps) -> addCapsProperties(ownerId, isAtomicType, toscaCapPropMap, caps));
}
return new MapCapabilityProperty(toscaCapPropMap);
}
- private static void addCapsProperties(String ownerId, boolean isAtomicType, Map<String, MapPropertiesDataDefinition> toscaCapPropMap, List<CapabilityDefinition> caps) {
+ private static void addCapsProperties(String ownerId, boolean isAtomicType, Map<String, MapPropertiesDataDefinition> toscaCapPropMap,
+ List<CapabilityDefinition> caps) {
if (CollectionUtils.isNotEmpty(caps)) {
caps.forEach(cap -> addCapProperties(ownerId, isAtomicType, toscaCapPropMap, cap));
}
}
- private static void addCapProperties(String ownerId, boolean isAtomicType, Map<String, MapPropertiesDataDefinition> toscaCapPropMap, CapabilityDefinition cap) {
+ private static void addCapProperties(String ownerId, boolean isAtomicType, Map<String, MapPropertiesDataDefinition> toscaCapPropMap,
+ CapabilityDefinition cap) {
if (CollectionUtils.isNotEmpty(cap.getProperties())) {
MapPropertiesDataDefinition dataToCreate = new MapPropertiesDataDefinition(cap.getProperties()
- .stream()
- .map(PropertyDataDefinition::new)
- .collect(Collectors.toMap(PropertyDataDefinition::getName, p -> p)));
- toscaCapPropMap.put(buildCapabilityPropertyKey(isAtomicType, cap.getType(),cap.getName(),ownerId, cap),
- new MapPropertiesDataDefinition(dataToCreate));
+ .stream()
+ .map(PropertyDataDefinition::new)
+ .collect(Collectors.toMap(PropertyDataDefinition::getName, p -> p)));
+ toscaCapPropMap.put(buildCapabilityPropertyKey(isAtomicType, cap.getType(), cap.getName(), ownerId, cap),
+ new MapPropertiesDataDefinition(dataToCreate));
}
}
- public static String buildCapabilityPropertyKey(boolean isAtomicType, String capabilityType, String capabilityName, String componentInstanceUniqueId, CapabilityDefinition cap) {
+ public static String buildCapabilityPropertyKey(boolean isAtomicType, String capabilityType, String capabilityName,
+ String componentInstanceUniqueId, CapabilityDefinition cap) {
StringBuilder sb = new StringBuilder(componentInstanceUniqueId);
sb.append(CAP_PROP_DELIM)
- .append(cap.getOwnerId())
- .append(CAP_PROP_DELIM);
- if(!isAtomicType && !componentInstanceUniqueId.equals(cap.getOwnerId())){
+ .append(cap.getOwnerId())
+ .append(CAP_PROP_DELIM);
+ if (!isAtomicType && !componentInstanceUniqueId.equals(cap.getOwnerId())) {
sb.append(cap.getOwnerId())
- .append(CAP_PROP_DELIM);
+ .append(CAP_PROP_DELIM);
}
return sb.append(capabilityType)
- .append(CAP_PROP_DELIM)
- .append(capabilityName).toString();
+ .append(CAP_PROP_DELIM)
+ .append(capabilityName).toString();
}
- public static MapCapabilityProperty convertToMapOfMapCapabiltyProperties(Map<String, List<CapabilityDefinition>> instCapabilities, String ownerId) {
+ public static MapCapabilityProperty convertToMapOfMapCapabiltyProperties(Map<String, List<CapabilityDefinition>> instCapabilities,
+ String ownerId) {
return convertToMapOfMapCapabiltyProperties(instCapabilities, ownerId, false);
}
- public static MapCapabilityProperty convertToMapOfMapCapabiltyProperties(Map<String, List<CapabilityDefinition>> capabilities, String ownerId, boolean fromCsar) {
+ public static MapCapabilityProperty convertToMapOfMapCapabiltyProperties(Map<String, List<CapabilityDefinition>> capabilities, String ownerId,
+ boolean fromCsar) {
Map<String, MapPropertiesDataDefinition> toscaCapPropMap = new HashMap<>();
- if(MapUtils.isNotEmpty(capabilities))
- capabilities.forEach((s, caps)-> {
-
- if (caps != null && !caps.isEmpty()) {
-
- MapPropertiesDataDefinition dataToCreate = new MapPropertiesDataDefinition();
-
- for (CapabilityDefinition cap : caps) {
- List<ComponentInstanceProperty> capPrps = cap.getProperties();
- if (capPrps != null) {
-
- for (ComponentInstanceProperty cip : capPrps) {
- dataToCreate.put(cip.getName(), new PropertyDataDefinition(cip));
- }
- // format key of capability properties :
- // VF instance in service : instanceId#ownerId#type#capName
- // VFC instance ion VF : instanceId#ownerId#type#capName -> instanceId=ownerId
-
- StringBuilder sb = new StringBuilder(ownerId);
- sb.append(CAP_PROP_DELIM);
- if (fromCsar) {
- sb.append(ownerId);
- } else {
- sb.append(cap.getOwnerId());
- }
- sb.append(CAP_PROP_DELIM).append(s).append(CAP_PROP_DELIM).append(cap.getName());
- toscaCapPropMap.put(sb.toString(), new MapPropertiesDataDefinition(dataToCreate));
- }
- }
- }
- }
- );
+ if (MapUtils.isNotEmpty(capabilities)) {
+ capabilities.forEach((s, caps) -> {
+
+ if (caps != null && !caps.isEmpty()) {
+
+ MapPropertiesDataDefinition dataToCreate = new MapPropertiesDataDefinition();
+
+ for (CapabilityDefinition cap : caps) {
+ List<ComponentInstanceProperty> capPrps = cap.getProperties();
+ if (capPrps != null) {
+
+ for (ComponentInstanceProperty cip : capPrps) {
+ dataToCreate.put(cip.getName(), new PropertyDataDefinition(cip));
+ }
+ // format key of capability properties :
+ // VF instance in service : instanceId#ownerId#type#capName
+ // VFC instance ion VF : instanceId#ownerId#type#capName -> instanceId=ownerId
+
+ StringBuilder sb = new StringBuilder(ownerId);
+ sb.append(CAP_PROP_DELIM);
+ if (fromCsar) {
+ sb.append(ownerId);
+ } else {
+ sb.append(cap.getOwnerId());
+ }
+ sb.append(CAP_PROP_DELIM).append(s).append(CAP_PROP_DELIM).append(cap.getName());
+ toscaCapPropMap.put(sb.toString(), new MapPropertiesDataDefinition(dataToCreate));
+ }
+ }
+ }
+ }
+ );
+ }
return new MapCapabilityProperty(toscaCapPropMap);
}
- private static MapListCapabilityDataDefinition convertToMapListCapabiltyDataDefinition(Map<String, List<CapabilityDefinition>> instCapabilities) {
+ private static MapListCapabilityDataDefinition convertToMapListCapabiltyDataDefinition(Map<String, List<CapabilityDefinition>> instCapabilities) {
Map<String, ListCapabilityDataDefinition> mapToscaDataDefinition = new HashMap<>();
for (Entry<String, List<CapabilityDefinition>> instCapability : instCapabilities.entrySet()) {
- mapToscaDataDefinition.put(instCapability.getKey(), new ListCapabilityDataDefinition(instCapability.getValue().stream().map(CapabilityDataDefinition::new).collect(Collectors.toList())));
+ mapToscaDataDefinition.put(instCapability.getKey(),
+ new ListCapabilityDataDefinition(instCapability.getValue().stream().map(CapabilityDataDefinition::new).collect(Collectors.toList())));
}
return new MapListCapabilityDataDefinition(mapToscaDataDefinition);
@@ -759,17 +771,20 @@ public class ModelConverter {
if (topologyTemplate.getCalculatedRequirements() == null) {
topologyTemplate.setCalculatedRequirements(new HashMap<>());
}
- topologyTemplate.getCalculatedRequirements().put(instance.getUniqueId(), convertToMapListRequirementDataDefinition(instRequirements));
+ topologyTemplate.getCalculatedRequirements()
+ .put(instance.getUniqueId(), convertToMapListRequirementDataDefinition(instRequirements));
}
}
}
}
- private static MapListRequirementDataDefinition convertToMapListRequirementDataDefinition(Map<String, List<RequirementDefinition>> instRequirements) {
+ private static MapListRequirementDataDefinition convertToMapListRequirementDataDefinition(
+ Map<String, List<RequirementDefinition>> instRequirements) {
Map<String, ListRequirementDataDefinition> mapToscaDataDefinition = new HashMap<>();
for (Entry<String, List<RequirementDefinition>> instRequirement : instRequirements.entrySet()) {
- mapToscaDataDefinition.put(instRequirement.getKey(), new ListRequirementDataDefinition(instRequirement.getValue().stream().map(RequirementDataDefinition::new).collect(Collectors.toList())));
+ mapToscaDataDefinition.put(instRequirement.getKey(), new ListRequirementDataDefinition(
+ instRequirement.getValue().stream().map(RequirementDataDefinition::new).collect(Collectors.toList())));
}
return new MapListRequirementDataDefinition(mapToscaDataDefinition);
@@ -797,17 +812,15 @@ public class ModelConverter {
component.setDerivedFromGenericType(toscaElement.getDerivedFromGenericType());
component.setDerivedFromGenericVersion(toscaElement.getDerivedFromGenericVersion());
- Map<String, PropertyDataDefinition> properties = toscaElement.getProperties();
- if(MapUtils.isNotEmpty(properties)) {
- List<PropertyDefinition> propertiesMap = properties.values().stream().map(x -> new PropertyDefinition(x)).collect(Collectors.toList());
- component.setProperties(propertiesMap);
- }
-
- //archive
- component.setArchived(toscaElement.isArchived() == null ? false : toscaElement.isArchived());
+ Map<String, PropertyDataDefinition> properties = toscaElement.getProperties();
+ if (MapUtils.isNotEmpty(properties)) {
+ List<PropertyDefinition> propertiesMap = properties.values().stream().map(x -> new PropertyDefinition(x)).collect(Collectors.toList());
+ component.setProperties(propertiesMap);
+ }
+ //archive
+ component.setArchived(toscaElement.isArchived() == null ? false : toscaElement.isArchived());
- //component.setArchiveTime(toscaElement.getArchiveTime() == null ? 0L : toscaElement.getArchiveTime());
component.setArchiveTime(toscaElement.getArchiveTime());
component.setVspArchived(toscaElement.isVspArchived() == null ? false : toscaElement.isVspArchived());
@@ -818,25 +831,25 @@ public class ModelConverter {
resource.setVendorName((String) toscaElement.getMetadataValue(JsonPresentationFields.VENDOR_NAME));
resource.setVendorRelease((String) toscaElement.getMetadataValue(JsonPresentationFields.VENDOR_RELEASE));
// field isn't mandatory , but shouldn't be null(should be an empty string instead)
- if (((String) toscaElement.getMetadataValue(JsonPresentationFields.RESOURCE_VENDOR_MODEL_NUMBER)) != null){
+ if (((String) toscaElement.getMetadataValue(JsonPresentationFields.RESOURCE_VENDOR_MODEL_NUMBER)) != null) {
resource.setResourceVendorModelNumber((String) toscaElement.getMetadataValue(JsonPresentationFields.RESOURCE_VENDOR_MODEL_NUMBER));
} else {
resource.setResourceVendorModelNumber("");
}
-
+
} else if (component.getComponentType() == ComponentTypeEnum.SERVICE) {
Service service = (Service) component;
- if (((String) toscaElement.getMetadataValue(JsonPresentationFields.SERVICE_TYPE)) != null){
+ if (((String) toscaElement.getMetadataValue(JsonPresentationFields.SERVICE_TYPE)) != null) {
service.setServiceType((String) toscaElement.getMetadataValue(JsonPresentationFields.SERVICE_TYPE));
} else {
service.setServiceType("");
}
- if (((String) toscaElement.getMetadataValue(JsonPresentationFields.SERVICE_ROLE)) != null){
+ if (((String) toscaElement.getMetadataValue(JsonPresentationFields.SERVICE_ROLE)) != null) {
service.setServiceRole((String) toscaElement.getMetadataValue(JsonPresentationFields.SERVICE_ROLE));
} else {
service.setServiceRole("");
}
- if (((String) toscaElement.getMetadataValue(JsonPresentationFields.SERVICE_FUNCTION)) != null){
+ if (((String) toscaElement.getMetadataValue(JsonPresentationFields.SERVICE_FUNCTION)) != null) {
service.setServiceFunction((String) toscaElement.getMetadataValue(JsonPresentationFields.SERVICE_FUNCTION));
} else {
service.setServiceFunction("");
@@ -854,36 +867,36 @@ public class ModelConverter {
final List<String> metadataKeys = getCategorySpecificMetadataKeys(toscaElement);
if (CollectionUtils.isNotEmpty(metadataKeys)) {
final Map<String, String> categorySpecificMetadata = new HashMap<>();
- for (final String metadataKey: metadataKeys) {
+ for (final String metadataKey : metadataKeys) {
categorySpecificMetadata.put(metadataKey, (String) toscaElement.getMetadata().get(metadataKey));
}
- component.setCategorySpecificMetadata(categorySpecificMetadata );
+ component.setCategorySpecificMetadata(categorySpecificMetadata);
}
}
-
- private static List<String> getCategorySpecificMetadataKeys(final ToscaElement toscaElement){
+
+ private static List<String> getCategorySpecificMetadataKeys(final ToscaElement toscaElement) {
final List<String> metadataKeys = new ArrayList<>();
final Optional<CategoryDefinition> category = getCategory(toscaElement);
if (category.isPresent()) {
if (CollectionUtils.isNotEmpty(category.get().getMetadataKeys())) {
- for (final MetadataKeyDataDefinition metadataKey: category.get().getMetadataKeys()) {
+ for (final MetadataKeyDataDefinition metadataKey : category.get().getMetadataKeys()) {
metadataKeys.add(metadataKey.getName());
}
}
final Optional<SubCategoryDefinition> subCategory = getSubCategory(category.get());
if (subCategory.isPresent() && CollectionUtils.isNotEmpty(subCategory.get().getMetadataKeys())) {
- for (final MetadataKeyDataDefinition metadataKey: subCategory.get().getMetadataKeys()) {
+ for (final MetadataKeyDataDefinition metadataKey : subCategory.get().getMetadataKeys()) {
metadataKeys.add(metadataKey.getName());
}
}
}
return metadataKeys;
}
-
+
private static Optional<CategoryDefinition> getCategory(ToscaElement toscaElement) {
return CollectionUtils.isEmpty(toscaElement.getCategories()) ? Optional.empty() : Optional.of(toscaElement.getCategories().get(0));
}
-
+
private static Optional<SubCategoryDefinition> getSubCategory(CategoryDefinition category) {
return CollectionUtils.isEmpty(category.getSubcategories()) ? Optional.empty() : Optional.of(category.getSubcategories().get(0));
}
@@ -908,7 +921,7 @@ public class ModelConverter {
convertArtifacts(resource, nodeType);
convertCapabilities(resource, nodeType);
convertRequirements(resource, nodeType);
- convertAttributes(resource, nodeType);
+ convertAttributesToNodeType(resource, nodeType);
convertProperties(resource, nodeType);
convertInterfaces(resource, nodeType);
return nodeType;
@@ -917,7 +930,8 @@ public class ModelConverter {
private static void convertProperties(Resource resource, NodeType nodeType) {
List<PropertyDefinition> properties = resource.getProperties();
if (properties != null && !properties.isEmpty()) {
- Map<String, PropertyDataDefinition> propertiesMap = properties.stream().collect(Collectors.toMap(PropertyDefinition::getName, PropertyDataDefinition::new));
+ Map<String, PropertyDataDefinition> propertiesMap = properties.stream()
+ .collect(Collectors.toMap(PropertyDefinition::getName, PropertyDataDefinition::new));
nodeType.setProperties(propertiesMap);
}
}
@@ -925,7 +939,8 @@ public class ModelConverter {
private static void convertInterfaces(Resource resource, NodeType nodeType) {
Map<String, InterfaceDefinition> interfaces = resource.getInterfaces();
if (interfaces != null) {
- Map<String, InterfaceDataDefinition> interfaceArtifacts = interfaces.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, x -> new InterfaceDataDefinition(x.getValue())));
+ Map<String, InterfaceDataDefinition> interfaceArtifacts = interfaces.entrySet().stream()
+ .collect(Collectors.toMap(Map.Entry::getKey, x -> new InterfaceDataDefinition(x.getValue())));
nodeType.setInterfaceArtifacts(interfaceArtifacts);
}
}
@@ -933,7 +948,8 @@ public class ModelConverter {
private static void convertAdditionalInformation(Component component, ToscaElement toscaElement) {
List<AdditionalInformationDefinition> additionalInformation = component.getAdditionalInformation();
if (additionalInformation != null) {
- Map<String, AdditionalInfoParameterDataDefinition> addInfo = additionalInformation.stream().collect(Collectors.toMap(AdditionalInformationDefinition::getUniqueId, AdditionalInfoParameterDataDefinition::new));
+ Map<String, AdditionalInfoParameterDataDefinition> addInfo = additionalInformation.stream()
+ .collect(Collectors.toMap(AdditionalInformationDefinition::getUniqueId, AdditionalInfoParameterDataDefinition::new));
toscaElement.setAdditionalInformation(addInfo);
}
}
@@ -941,7 +957,8 @@ public class ModelConverter {
private static void convertAdditionalInformation(ToscaElement toscaElement, Component resource) {
Map<String, AdditionalInfoParameterDataDefinition> additionalInformation = toscaElement.getAdditionalInformation();
if (additionalInformation != null) {
- List<AdditionalInformationDefinition> addInfo = additionalInformation.values().stream().map(AdditionalInformationDefinition::new).collect(Collectors.toList());
+ List<AdditionalInformationDefinition> addInfo = additionalInformation.values().stream().map(AdditionalInformationDefinition::new)
+ .collect(Collectors.toList());
resource.setAdditionalInformation(addInfo);
}
}
@@ -1009,6 +1026,7 @@ public class ModelConverter {
}
service.setServiceApiArtifacts(copy);
}
+
private static void convertServicePaths(TopologyTemplate topologyTemplate, Service service) {
Map<String, ForwardingPathDataDefinition> servicePaths = topologyTemplate.getForwardingPaths();
Map<String, ForwardingPathDataDefinition> copy;
@@ -1024,19 +1042,22 @@ public class ModelConverter {
private static void convertArtifacts(Component component, ToscaElement toscaElement) {
Map<String, ArtifactDefinition> artifacts = component.getArtifacts();
if (artifacts != null) {
- Map<String, ArtifactDataDefinition> copy = artifacts.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, e -> new ArtifactDataDefinition(e.getValue())));
+ Map<String, ArtifactDataDefinition> copy = artifacts.entrySet().stream()
+ .collect(Collectors.toMap(Map.Entry::getKey, e -> new ArtifactDataDefinition(e.getValue())));
toscaElement.setArtifacts(copy);
}
Map<String, ArtifactDefinition> toscaArtifacts = component.getToscaArtifacts();
if (toscaArtifacts != null) {
- Map<String, ArtifactDataDefinition> copy = toscaArtifacts.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, e -> new ArtifactDataDefinition(e.getValue())));
+ Map<String, ArtifactDataDefinition> copy = toscaArtifacts.entrySet().stream()
+ .collect(Collectors.toMap(Map.Entry::getKey, e -> new ArtifactDataDefinition(e.getValue())));
toscaElement.setToscaArtifacts(copy);
}
Map<String, ArtifactDefinition> deploymentArtifacts = component.getDeploymentArtifacts();
if (deploymentArtifacts != null) {
- Map<String, ArtifactDataDefinition> copy = deploymentArtifacts.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, e -> new ArtifactDataDefinition(e.getValue())));
+ Map<String, ArtifactDataDefinition> copy = deploymentArtifacts.entrySet().stream()
+ .collect(Collectors.toMap(Map.Entry::getKey, e -> new ArtifactDataDefinition(e.getValue())));
toscaElement.setDeploymentArtifacts(copy);
}
}
@@ -1044,7 +1065,8 @@ public class ModelConverter {
private static void convertServiceApiArtifacts(Service service, TopologyTemplate topologyTemplate) {
Map<String, ArtifactDefinition> serviceApiArtifacts = service.getServiceApiArtifacts();
if (serviceApiArtifacts != null) {
- Map<String, ArtifactDataDefinition> copy = serviceApiArtifacts.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, e -> new ArtifactDataDefinition(e.getValue())));
+ Map<String, ArtifactDataDefinition> copy = serviceApiArtifacts.entrySet().stream()
+ .collect(Collectors.toMap(Map.Entry::getKey, e -> new ArtifactDataDefinition(e.getValue())));
topologyTemplate.setServiceApiArtifacts(copy);
}
}
@@ -1056,26 +1078,26 @@ public class ModelConverter {
Map<String, MapPropertiesDataDefinition> toscaCapPropMap = new HashMap<>();
if (capabilities != null && !capabilities.isEmpty()) {
- capabilities.forEach((s, caps) -> {
+ capabilities.forEach((s, caps) -> {
if (caps != null && !caps.isEmpty()) {
- List<CapabilityDataDefinition> capList = caps.stream().map(CapabilityDataDefinition::new).collect(Collectors.toList());
+ List<CapabilityDataDefinition> capList = caps.stream().map(CapabilityDataDefinition::new).collect(Collectors.toList());
populateCapabilityMap(toscaCapMap, toscaCapPropMap, s, caps, capList);
}
}
- );
+ );
toscaElement.setCapabilities(toscaCapMap);
toscaElement.setCapabilitiesProperties(toscaCapPropMap);
}
}
- private static void convertAttributes(Resource component, NodeType nodeType) {
- List<AttributeDataDefinition> attributes = component.getAttributes();
- if (attributes != null) {
+ private static void convertAttributesToNodeType(Resource component, NodeType nodeType) {
+ List<AttributeDefinition> attributes = component.getAttributes();
+ if (CollectionUtils.isNotEmpty(attributes)) {
Map<String, AttributeDataDefinition> attrsByName = attributes.stream()
- .collect(Collectors.toMap(AttributeDataDefinition::getName, Function.identity()));
+ .collect(Collectors.toMap(AttributeDefinition::getName, Function.identity()));
nodeType.setAttributes(attrsByName);
}
}
@@ -1086,16 +1108,16 @@ public class ModelConverter {
Map<String, ListRequirementDataDefinition> toscaReqMap = new HashMap<>();
if (requirements != null && !requirements.isEmpty()) {
- requirements.forEach((s, reqs)-> {
+ requirements.forEach((s, reqs) -> {
if (reqs != null && !reqs.isEmpty()) {
- List<RequirementDataDefinition> reqList = reqs.stream().map(RequirementDataDefinition::new).collect(Collectors.toList());
+ List<RequirementDataDefinition> reqList = reqs.stream().map(RequirementDataDefinition::new).collect(Collectors.toList());
ListRequirementDataDefinition listRequirementDataDefinition = new ListRequirementDataDefinition(reqList);
toscaReqMap.put(s, listRequirementDataDefinition);
}
}
- );
+ );
nodeType.setRequirements(toscaReqMap);
}
}
@@ -1110,38 +1132,41 @@ public class ModelConverter {
}
}
- public static Map<String, List<CapabilityDefinition>> getCapabilitiesMapFromMapObject(Map<String, ListCapabilityDataDefinition> toscaCapabilities, Map<String, MapPropertiesDataDefinition> toscaCapPropMap) {
+ public static Map<String, List<CapabilityDefinition>> getCapabilitiesMapFromMapObject(Map<String, ListCapabilityDataDefinition> toscaCapabilities,
+ Map<String, MapPropertiesDataDefinition> toscaCapPropMap) {
Map<String, List<CapabilityDefinition>> compCap = new HashMap<>();
- if (toscaCapabilities == null || toscaCapabilities.isEmpty())
+ if (toscaCapabilities == null || toscaCapabilities.isEmpty()) {
return null;
- toscaCapabilities.forEach((s, cap)-> {
+ }
+ toscaCapabilities.forEach((s, cap) -> {
- if (cap != null) {
- List<CapabilityDataDefinition> capDataList = cap.getListToscaDataDefinition();
+ if (cap != null) {
+ List<CapabilityDataDefinition> capDataList = cap.getListToscaDataDefinition();
- if (capDataList != null && !capDataList.isEmpty()) {
- List<CapabilityDefinition> capList = capDataList.stream().map(CapabilityDefinition::new).collect(Collectors.toList());
- compCap.put(s, capList);
- }
+ if (capDataList != null && !capDataList.isEmpty()) {
+ List<CapabilityDefinition> capList = capDataList.stream().map(CapabilityDefinition::new).collect(Collectors.toList());
+ compCap.put(s, capList);
}
-
}
+
+ }
);
if (toscaCapPropMap != null && !toscaCapPropMap.isEmpty()) {
- toscaCapPropMap.forEach((s, capProp)-> {
- String[] result = s.split(CAP_PROP_DELIM);
- if (capProp != null) {
- Map<String, PropertyDataDefinition> capMap = capProp.getMapToscaDataDefinition();
-
- if (capMap != null && !capMap.isEmpty()) {
- List<ComponentInstanceProperty> capPropsList = capMap.values().stream().map(ComponentInstanceProperty::new).collect(Collectors.toList());
-
- List<CapabilityDefinition> cap = compCap.get(result[0]);
- Optional<CapabilityDefinition> op = cap.stream().filter(c -> c.getName().equals(result[1])).findFirst();
- op.ifPresent(capabilityDefinition -> capabilityDefinition.setProperties(capPropsList));
- }
+ toscaCapPropMap.forEach((s, capProp) -> {
+ String[] result = s.split(CAP_PROP_DELIM);
+ if (capProp != null) {
+ Map<String, PropertyDataDefinition> capMap = capProp.getMapToscaDataDefinition();
+
+ if (capMap != null && !capMap.isEmpty()) {
+ List<ComponentInstanceProperty> capPropsList = capMap.values().stream().map(ComponentInstanceProperty::new)
+ .collect(Collectors.toList());
+
+ List<CapabilityDefinition> cap = compCap.get(result[0]);
+ Optional<CapabilityDefinition> op = cap.stream().filter(c -> c.getName().equals(result[1])).findFirst();
+ op.ifPresent(capabilityDefinition -> capabilityDefinition.setProperties(capPropsList));
}
}
+ }
);
}
return compCap;
@@ -1151,7 +1176,7 @@ public class ModelConverter {
Map<String, GroupDataDefinition> toscaGroups = toscaElement.getGroups();
List<GroupDefinition> groupDefinitions = null;
if (MapUtils.isNotEmpty(toscaGroups)) {
- groupDefinitions = toscaGroups.values().stream().map(GroupDefinition::new).collect(Collectors.toList());
+ groupDefinitions = toscaGroups.values().stream().map(GroupDefinition::new).collect(Collectors.toList());
}
component.setGroups(groupDefinitions);
}
@@ -1160,7 +1185,8 @@ public class ModelConverter {
Map<String, PolicyDataDefinition> policies = toscaElement.getPolicies();
Map<String, PolicyDefinition> policyDefinitions = null;
if (MapUtils.isNotEmpty(policies)) {
- policyDefinitions = policies.values().stream().map(PolicyDefinition::new).collect(Collectors.toMap(PolicyDefinition::getUniqueId, Function.identity()));
+ policyDefinitions = policies.values().stream().map(PolicyDefinition::new)
+ .collect(Collectors.toMap(PolicyDefinition::getUniqueId, Function.identity()));
}
component.setPolicies(policyDefinitions);
}
@@ -1170,7 +1196,7 @@ public class ModelConverter {
Map<String, GroupDataDefinition> groups = new HashMap<>();
if (groupDefinitions != null && groups.isEmpty()) {
- groups = groupDefinitions.stream().collect(Collectors.toMap(GroupDefinition::getInvariantName, GroupDefinition::new));
+ groups = groupDefinitions.stream().collect(Collectors.toMap(GroupDefinition::getInvariantName, GroupDefinition::new));
}
toscaElement.setGroups(groups);
}
@@ -1179,7 +1205,7 @@ public class ModelConverter {
Map<String, PolicyDefinition> policyDefinitions = component.getPolicies();
Map<String, PolicyDataDefinition> policies = new HashMap<>();
if (MapUtils.isNotEmpty(policyDefinitions)) {
- policies = policyDefinitions.values().stream().collect((Collectors.toMap(PolicyDefinition::getUniqueId, PolicyDataDefinition::new)));
+ policies = policyDefinitions.values().stream().collect((Collectors.toMap(PolicyDefinition::getUniqueId, PolicyDataDefinition::new)));
}
toscaElement.setPolicies(policies);
}
@@ -1188,20 +1214,21 @@ public class ModelConverter {
Map<String, ListRequirementDataDefinition> toscaRequirements = toscaElement.getRequirements();
Map<String, List<RequirementDefinition>> compReqs = new HashMap<>();
- if (toscaRequirements == null || toscaRequirements.isEmpty())
+ if (toscaRequirements == null || toscaRequirements.isEmpty()) {
return;
- toscaRequirements.forEach((s, req) -> {
+ }
+ toscaRequirements.forEach((s, req) -> {
if (req != null) {
List<RequirementDataDefinition> reqDataList = req.getListToscaDataDefinition();
if (reqDataList != null && !reqDataList.isEmpty()) {
- List<RequirementDefinition> reqList = reqDataList.stream().map(RequirementDefinition::new).collect(Collectors.toList());
+ List<RequirementDefinition> reqList = reqDataList.stream().map(RequirementDefinition::new).collect(Collectors.toList());
compReqs.put(s, reqList);
}
}
}
- );
+ );
component.setRequirements(compReqs);
}
@@ -1210,48 +1237,40 @@ public class ModelConverter {
ComponentTypeEnum componentType = component.getComponentType();
topologyTemplate = new TopologyTemplate();
- if (componentType == ComponentTypeEnum.RESOURCE) {
- Resource resource = (Resource) component;
- topologyTemplate.setResourceType(resource.getResourceType());
- topologyTemplate.setMetadataValue(JsonPresentationFields.CSAR_UUID, resource.getCsarUUID());
- topologyTemplate.setMetadataValue(JsonPresentationFields.CSAR_VERSION, resource.getCsarVersion());
- topologyTemplate.setMetadataValue(JsonPresentationFields.IMPORTED_TOSCA_CHECKSUM, resource.getImportedToscaChecksum());
- convertTopologyTemplateInterfaces(resource, topologyTemplate);
- }
- if (componentType == ComponentTypeEnum.SERVICE) {
- convertServiceSpecificEntities((Service) component, topologyTemplate);
- }
- convertCommonToscaData(component, topologyTemplate);
- convertArtifacts(component, topologyTemplate);
+ if (componentType == ComponentTypeEnum.RESOURCE) {
+ Resource resource = (Resource) component;
+ topologyTemplate.setResourceType(resource.getResourceType());
+ topologyTemplate.setMetadataValue(JsonPresentationFields.CSAR_UUID, resource.getCsarUUID());
+ topologyTemplate.setMetadataValue(JsonPresentationFields.CSAR_VERSION, resource.getCsarVersion());
+ topologyTemplate.setMetadataValue(JsonPresentationFields.IMPORTED_TOSCA_CHECKSUM, resource.getImportedToscaChecksum());
+ convertTopologyTemplateInterfaces(resource, topologyTemplate);
+ }
+ if (componentType == ComponentTypeEnum.SERVICE) {
+ convertServiceSpecificEntities((Service) component, topologyTemplate);
+ }
+ convertCommonToscaData(component, topologyTemplate);
+ convertArtifacts(component, topologyTemplate);
convertAdditionalInformation(component, topologyTemplate);
convertComponentInstances(component, topologyTemplate);
- convertInputs(component, topologyTemplate);
- convertProperties(component, topologyTemplate);
- convertCapabilities(component, topologyTemplate);
- convertGroups(component, topologyTemplate);
- convertPolicies(component, topologyTemplate);
- convertRequirements(component, topologyTemplate);
- convertRelationsToComposition(component, topologyTemplate);
+ convertInputs(component, topologyTemplate);
+ convertProperties(component, topologyTemplate);
+ convertAttributesToTopologyTemplate(component, topologyTemplate);
+ convertCapabilities(component, topologyTemplate);
+ convertGroups(component, topologyTemplate);
+ convertPolicies(component, topologyTemplate);
+ convertRequirements(component, topologyTemplate);
+ convertRelationsToComposition(component, topologyTemplate);
return topologyTemplate;
}
- private static void convertTopologyTemplateInterfaces(Resource resource, TopologyTemplate topologyTemplate) {
- Map<String, InterfaceDefinition> interfaces = resource.getInterfaces();
- if (interfaces != null && !interfaces.isEmpty()) {
- Map<String, InterfaceDataDefinition> copy = interfaces.entrySet().stream()
- .collect(Collectors.toMap(Map.Entry::getKey, e -> new InterfaceDataDefinition(e.getValue())));
- topologyTemplate.setInterfaces(copy);
- }
- }
-
- private static void convertServiceInterfaces(Service service, TopologyTemplate topologyTemplate) {
- Map<String, InterfaceDefinition> interfaces = service.getInterfaces();
+ private static void convertTopologyTemplateInterfaces(Resource resource, TopologyTemplate topologyTemplate) {
+ Map<String, InterfaceDefinition> interfaces = resource.getInterfaces();
if (interfaces != null && !interfaces.isEmpty()) {
Map<String, InterfaceDataDefinition> copy = interfaces.entrySet().stream()
- .collect(Collectors.toMap(Map.Entry::getKey, e -> new InterfaceDataDefinition(e.getValue())));
+ .collect(Collectors.toMap(Map.Entry::getKey, e -> new InterfaceDataDefinition(e.getValue())));
topologyTemplate.setInterfaces(copy);
}
}
@@ -1259,29 +1278,30 @@ public class ModelConverter {
private static void convertServiceSpecificEntities(Service service, TopologyTemplate topologyTemplate) {
convertServiceMetaData(service, topologyTemplate);
convertServiceApiArtifacts(service, topologyTemplate);
- convertServicePaths(service,topologyTemplate);
- convertServiceInterfaces(topologyTemplate,service);
+ convertServicePaths(service, topologyTemplate);
+ convertServiceInterfaces(topologyTemplate, service);
}
private static void convertServicePaths(Service service, TopologyTemplate topologyTemplate) {
Map<String, ForwardingPathDataDefinition> servicePaths = service.getForwardingPaths();
if (servicePaths != null && !servicePaths.isEmpty()) {
- Map<String, ForwardingPathDataDefinition> copy = servicePaths.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, e -> new ForwardingPathDataDefinition(e.getValue())));
+ Map<String, ForwardingPathDataDefinition> copy = servicePaths.entrySet().stream()
+ .collect(Collectors.toMap(Map.Entry::getKey, e -> new ForwardingPathDataDefinition(e.getValue())));
topologyTemplate.setForwardingPaths(copy);
}
}
- private static void convertServiceMetaData(Service service, TopologyTemplate topologyTemplate) {
- if (service.getDistributionStatus() != null) {
- topologyTemplate.setMetadataValue(JsonPresentationFields.DISTRIBUTION_STATUS,
- service.getDistributionStatus().name());
- }
- topologyTemplate.setMetadataValue(JsonPresentationFields.PROJECT_CODE, service.getProjectCode());
- topologyTemplate.setMetadataValue(JsonPresentationFields.ECOMP_GENERATED_NAMING,
- service.isEcompGeneratedNaming());
- topologyTemplate.setMetadataValue(JsonPresentationFields.NAMING_POLICY, service.getNamingPolicy());
- topologyTemplate.setMetadataValue(JsonPresentationFields.ENVIRONMENT_CONTEXT, service.getEnvironmentContext());
- topologyTemplate.setMetadataValue(JsonPresentationFields.INSTANTIATION_TYPE, service.getInstantiationType());
+ private static void convertServiceMetaData(Service service, TopologyTemplate topologyTemplate) {
+ if (service.getDistributionStatus() != null) {
+ topologyTemplate.setMetadataValue(JsonPresentationFields.DISTRIBUTION_STATUS,
+ service.getDistributionStatus().name());
+ }
+ topologyTemplate.setMetadataValue(JsonPresentationFields.PROJECT_CODE, service.getProjectCode());
+ topologyTemplate.setMetadataValue(JsonPresentationFields.ECOMP_GENERATED_NAMING,
+ service.isEcompGeneratedNaming());
+ topologyTemplate.setMetadataValue(JsonPresentationFields.NAMING_POLICY, service.getNamingPolicy());
+ topologyTemplate.setMetadataValue(JsonPresentationFields.ENVIRONMENT_CONTEXT, service.getEnvironmentContext());
+ topologyTemplate.setMetadataValue(JsonPresentationFields.INSTANTIATION_TYPE, service.getInstantiationType());
}
@@ -1298,8 +1318,9 @@ public class ModelConverter {
compositions.put(JsonConstantKeysEnum.COMPOSITION.getValue(), compositionDataDefinition);
}
- Map<String, RelationshipInstDataDefinition> relations = componentInstancesRelations.stream().flatMap(x -> convertRelationToToscaRelation(x).stream()).filter(i -> i.getUniqueId() != null)
- .collect(Collectors.toMap(RelationshipInstDataDefinition::getUniqueId, Function.identity()));
+ Map<String, RelationshipInstDataDefinition> relations = componentInstancesRelations.stream()
+ .flatMap(x -> convertRelationToToscaRelation(x).stream()).filter(i -> i.getUniqueId() != null)
+ .collect(Collectors.toMap(RelationshipInstDataDefinition::getUniqueId, Function.identity()));
compositionDataDefinition.setRelations(relations);
}
}
@@ -1308,41 +1329,60 @@ public class ModelConverter {
List<InputDefinition> inputsList = component.getInputs();
if (inputsList != null && !inputsList.isEmpty()) {
- Map<String, PropertyDataDefinition> inputsMap = inputsList.stream().map(PropertyDataDefinition::new).collect(Collectors.toMap(PropertyDataDefinition::getName, Function.identity()));
+ Map<String, PropertyDataDefinition> inputsMap = inputsList.stream().map(PropertyDataDefinition::new)
+ .collect(Collectors.toMap(PropertyDataDefinition::getName, Function.identity()));
topologyTemplate.setInputs(inputsMap);
}
}
- private static void convertInputs(TopologyTemplate topologyTemplate, Component component) {
- Map<String, PropertyDataDefinition> inputsMap = topologyTemplate.getInputs();
- if (inputsMap != null && !inputsMap.isEmpty()) {
- List<InputDefinition> inputsList = inputsMap.values()
- .stream()
- .map(InputDefinition::new)
- .collect(Collectors.toList());
- component.setInputs(inputsList);
- }
- }
+ private static void convertInputs(TopologyTemplate topologyTemplate, Component component) {
+ Map<String, PropertyDataDefinition> inputsMap = topologyTemplate.getInputs();
+ if (inputsMap != null && !inputsMap.isEmpty()) {
+ List<InputDefinition> inputsList = inputsMap.values()
+ .stream()
+ .map(InputDefinition::new)
+ .collect(Collectors.toList());
+ component.setInputs(inputsList);
+ }
+ }
+
+ private static void convertProperties(Component component, TopologyTemplate topologyTemplate) {
+ List<PropertyDefinition> propertiesList = component.getProperties();
+ if (propertiesList != null && !propertiesList.isEmpty()) {
+ Map<String, PropertyDataDefinition> propertiesMap = propertiesList.stream()
+ .map(i -> new PropertyDataDefinition(i)).collect(Collectors.toMap(i -> i.getName(), i -> i));
+ topologyTemplate.setProperties(propertiesMap);
+ }
+ }
- private static void convertProperties(Component component, TopologyTemplate topologyTemplate) {
- List<PropertyDefinition> propertiesList = component.getProperties();
- if (propertiesList != null && !propertiesList.isEmpty()) {
- Map<String, PropertyDataDefinition> propertiesMap = propertiesList.stream().map(i -> new PropertyDataDefinition(i)).collect(Collectors.toMap(i -> i.getName(), i -> i));
- topologyTemplate.setProperties(propertiesMap);
- }
+ private static void convertAttributesToTopologyTemplate(final Component component, final TopologyTemplate topologyTemplate) {
+ final List<AttributeDefinition> attributes = component.getAttributes();
+ if (CollectionUtils.isNotEmpty(attributes)) {
+ final Map<String, AttributeDataDefinition> attributeDataDefinitionMap = attributes.stream()
+ .map(AttributeDataDefinition::new).collect(Collectors.toMap(AttributeDataDefinition::getName, i -> i));
+ topologyTemplate.setAttributes(attributeDataDefinitionMap);
+ }
+ }
- }
+ private static void convertProperties(TopologyTemplate topologyTemplate, Component component) {
+ Map<String, PropertyDataDefinition> propertiesMap = topologyTemplate.getProperties();
+ if (propertiesMap != null && !propertiesMap.isEmpty()) {
+ Map<String, PropertyDefinition> copy = propertiesMap.entrySet().stream()
+ .collect(Collectors.toMap(entry -> entry.getKey(), entry -> new PropertyDefinition
+ (entry.getValue())));
+ component.setProperties(new ArrayList<>(copy.values()));
+ }
+ }
- private static void convertProperties(TopologyTemplate topologyTemplate, Component component) {
- Map<String, PropertyDataDefinition> proeprtiesMap = topologyTemplate.getProperties();
- if (proeprtiesMap != null && !proeprtiesMap.isEmpty()) {
- Map<String, PropertyDefinition> copy = proeprtiesMap.entrySet().stream()
- .collect(Collectors.toMap(entry -> entry.getKey(), entry -> new PropertyDefinition
- (entry.getValue())));
- component.setProperties(new ArrayList<>(copy.values()));
- }
- }
+ private static void convertAttributesToComponent(final TopologyTemplate topologyTemplate, final Component component) {
+ final Map<String, AttributeDataDefinition> attributes = topologyTemplate.getAttributes();
+ if (MapUtils.isNotEmpty(attributes)) {
+ Map<String, AttributeDefinition> copy = attributes.entrySet().stream()
+ .collect(Collectors.toMap(entry -> entry.getKey(), entry -> new AttributeDefinition(entry.getValue())));
+ component.setAttributes(new ArrayList<>(copy.values()));
+ }
+ }
private static void convertDataTypes(final ToscaElement toscaElement, final Component component) {
final Map<String, DataTypeDataDefinition> dataTypeDataMap = toscaElement.getDataTypes();
@@ -1365,7 +1405,6 @@ public class ModelConverter {
}
}
-
private static void convertCommonToscaData(Component component, ToscaElement toscaElement) {
toscaElement.setUUID(component.getUUID());
toscaElement.setUniqueId(component.getUniqueId());
@@ -1398,24 +1437,25 @@ public class ModelConverter {
toscaElement.setMetadataValue(JsonPresentationFields.VENDOR_NAME, ((Resource) component).getVendorName());
toscaElement.setMetadataValue(JsonPresentationFields.VENDOR_RELEASE, ((Resource) component).getVendorRelease());
// field isn't mandatory , but shouldn't be null(should be an empty string instead)
- if (((Resource) component).getResourceVendorModelNumber() != null){
- toscaElement.setMetadataValue(JsonPresentationFields.RESOURCE_VENDOR_MODEL_NUMBER, ((Resource) component).getResourceVendorModelNumber());
+ if (((Resource) component).getResourceVendorModelNumber() != null) {
+ toscaElement
+ .setMetadataValue(JsonPresentationFields.RESOURCE_VENDOR_MODEL_NUMBER, ((Resource) component).getResourceVendorModelNumber());
} else {
toscaElement.setMetadataValue(JsonPresentationFields.RESOURCE_VENDOR_MODEL_NUMBER, "");
}
} else if (component.getComponentType() == ComponentTypeEnum.SERVICE) {
// field isn't mandatory , but shouldn't be null(should be an empty string instead)
- if (((Service) component).getServiceType() != null){
+ if (((Service) component).getServiceType() != null) {
toscaElement.setMetadataValue(JsonPresentationFields.SERVICE_TYPE, ((Service) component).getServiceType());
} else {
toscaElement.setMetadataValue(JsonPresentationFields.SERVICE_TYPE, "");
}
- if (((Service) component).getServiceRole() != null){
+ if (((Service) component).getServiceRole() != null) {
toscaElement.setMetadataValue(JsonPresentationFields.SERVICE_ROLE, ((Service) component).getServiceRole());
} else {
toscaElement.setMetadataValue(JsonPresentationFields.SERVICE_ROLE, "");
}
- if (((Service) component).getServiceFunction() != null){
+ if (((Service) component).getServiceFunction() != null) {
toscaElement.setMetadataValue(JsonPresentationFields.SERVICE_FUNCTION, ((Service) component).getServiceFunction());
} else {
toscaElement.setMetadataValue(JsonPresentationFields.SERVICE_FUNCTION, "");
@@ -1428,8 +1468,8 @@ public class ModelConverter {
toscaElement.setMetadataValue(JsonPresentationFields.TAGS, component.getTags());
toscaElement.setMetadataValue(JsonPresentationFields.INVARIANT_UUID, component.getInvariantUUID());
toscaElement.setMetadataValue(JsonPresentationFields.CONTACT_ID, component.getContactId());
- for (final String key: component.getCategorySpecificMetadata().keySet()) {
- toscaElement.setMetadataValue(key, component.getCategorySpecificMetadata().get(key));
+ for (final String key : component.getCategorySpecificMetadata().keySet()) {
+ toscaElement.setMetadataValue(key, component.getCategorySpecificMetadata().get(key));
}
final List<DataTypeDefinition> dataTypes = component.getDataTypes();
@@ -1449,23 +1489,36 @@ public class ModelConverter {
String key = entry.getKey();
currComponentInstance = new ComponentInstance(topologyTemplate.getComponentInstances().get(key));
if (topologyTemplate.getInstGroups() != null && topologyTemplate.getInstGroups().containsKey(key)) {
- List<GroupInstance> groupInstances = topologyTemplate.getInstGroups().get(key).getMapToscaDataDefinition().entrySet().stream().map(e -> new GroupInstance(e.getValue())).collect(Collectors.toList());
+ List<GroupInstance> groupInstances = topologyTemplate.getInstGroups().get(key).getMapToscaDataDefinition().entrySet().stream()
+ .map(e -> new GroupInstance(e.getValue())).collect(Collectors.toList());
currComponentInstance.setGroupInstances(groupInstances);
}
setComponentInstanceSource(currComponentInstance, component);
- if(MapUtils.isNotEmpty(nodeFilterComponents) && nodeFilterComponents.containsKey(key)){
+ if (MapUtils.isNotEmpty(nodeFilterComponents) && nodeFilterComponents.containsKey(key)) {
currComponentInstance.setNodeFilter(nodeFilterComponents.get(key));
}
- if(topologyTemplate.getInstProperties() != null && topologyTemplate.getInstProperties().containsKey(key) && topologyTemplate.getInstProperties().get(key) != null ){
- List<PropertyDefinition> instanceProps = topologyTemplate.getInstProperties().get(key).getMapToscaDataDefinition().entrySet().stream().map(e -> new PropertyDefinition(e.getValue())).collect(Collectors.toList());
+ if (topologyTemplate.getInstProperties() != null && topologyTemplate.getInstProperties().containsKey(key)
+ && topologyTemplate.getInstProperties().get(key) != null) {
+ List<PropertyDefinition> instanceProps = topologyTemplate.getInstProperties().get(key).getMapToscaDataDefinition().entrySet().stream()
+ .map(e -> new PropertyDefinition(e.getValue())).collect(Collectors.toList());
currComponentInstance.setProperties(instanceProps);
}
- if(topologyTemplate.getInstInputs() != null && topologyTemplate.getInstInputs().containsKey(key) && topologyTemplate.getInstInputs().get(key) != null ){
- List<InputDefinition> instanceInputs = topologyTemplate.getInstInputs().get(key).getMapToscaDataDefinition().entrySet().stream().map(e -> new InputDefinition(e.getValue())).collect(Collectors.toList());
+ if (topologyTemplate.getInstInputs() != null && topologyTemplate.getInstInputs().containsKey(key)
+ && topologyTemplate.getInstInputs().get(key) != null) {
+ List<InputDefinition> instanceInputs = topologyTemplate.getInstInputs().get(key).getMapToscaDataDefinition().entrySet().stream()
+ .map(e -> new InputDefinition(e.getValue())).collect(Collectors.toList());
currComponentInstance.setInputs(instanceInputs);
}
- if(topologyTemplate.getComponentInstInterfaces() != null && topologyTemplate.getComponentInstInterfaces().containsKey(key) && topologyTemplate.getComponentInstInterfaces().get(key) != null ){
- Map<String, Object> interfacesMap = topologyTemplate.getComponentInstInterfaces().get(key).getMapToscaDataDefinition().entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
+ final Map<String, MapAttributesDataDefinition> instAttributes = topologyTemplate.getInstAttributes();
+ if (instAttributes != null && instAttributes.containsKey(key) && instAttributes.get(key) != null) {
+ currComponentInstance.setAttributes(
+ instAttributes.get(key).getMapToscaDataDefinition().values().stream().map(AttributeDefinition::new)
+ .collect(Collectors.toList()));
+ }
+ if (topologyTemplate.getComponentInstInterfaces() != null && topologyTemplate.getComponentInstInterfaces().containsKey(key)
+ && topologyTemplate.getComponentInstInterfaces().get(key) != null) {
+ Map<String, Object> interfacesMap = topologyTemplate.getComponentInstInterfaces().get(key).getMapToscaDataDefinition().entrySet()
+ .stream().collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
currComponentInstance.setInterfaces(interfacesMap);
}
componentInstances.add(currComponentInstance);
@@ -1474,7 +1527,8 @@ public class ModelConverter {
component.setComponentInstances(componentInstances);
}
- public static List<ComponentInstance> getComponentInstancesFromMapObject(Map<String, ComponentInstanceDataDefinition> componentInstancesDefinitionMap, Component component) {
+ public static List<ComponentInstance> getComponentInstancesFromMapObject(
+ Map<String, ComponentInstanceDataDefinition> componentInstancesDefinitionMap, Component component) {
List<ComponentInstance> componentInstances = new ArrayList<>();
ComponentInstance currComponentInstance;
for (Map.Entry<String, ComponentInstanceDataDefinition> entry : componentInstancesDefinitionMap.entrySet()) {
@@ -1487,13 +1541,12 @@ public class ModelConverter {
}
private static void setComponentInstanceSource(ComponentInstance currComponentInstance, Component component) {
- if (Objects.isNull(currComponentInstance.getCreatedFrom())){
- if (ComponentTypeEnum.RESOURCE.equals(component.getComponentType())){
+ if (Objects.isNull(currComponentInstance.getCreatedFrom())) {
+ if (ComponentTypeEnum.RESOURCE.equals(component.getComponentType())) {
Resource resource = (Resource) component;
- if (isFromCsar(resource)){
+ if (isFromCsar(resource)) {
currComponentInstance.setCreatedFrom(CreatedFrom.CSAR);
- }
- else {
+ } else {
currComponentInstance.setCreatedFrom(CreatedFrom.UI);
}
}
@@ -1511,7 +1564,8 @@ public class ModelConverter {
for (Entry<String, MapPropertiesDataDefinition> entry : topologyTemplate.getInstInputs().entrySet()) {
if (entry.getValue() != null && entry.getValue().getMapToscaDataDefinition() != null) {
String key = entry.getKey();
- List<ComponentInstanceInput> componentInstanceAttributes = entry.getValue().getMapToscaDataDefinition().entrySet().stream().map(e -> new ComponentInstanceInput(e.getValue())).collect(Collectors.toList());
+ List<ComponentInstanceInput> componentInstanceAttributes = entry.getValue().getMapToscaDataDefinition().entrySet().stream()
+ .map(e -> new ComponentInstanceInput(e.getValue())).collect(Collectors.toList());
inputs.put(key, componentInstanceAttributes);
}
}
@@ -1544,7 +1598,7 @@ public class ModelConverter {
String key = entry.getKey();
List<ComponentInstanceAttribute> componentInstanceAttributes = entry.getValue()
.getMapToscaDataDefinition().entrySet().stream()
- .map(e -> new ComponentInstanceAttribute(new ComponentInstanceAttribute(e.getValue())))
+ .map(e -> new ComponentInstanceAttribute(new AttributeDefinition(e.getValue())))
.collect(Collectors.toList());
attributes.put(key, componentInstanceAttributes);
}
@@ -1559,23 +1613,22 @@ public class ModelConverter {
if (entry.getValue() != null && entry.getValue().getMapToscaDataDefinition() != null) {
String key = entry.getKey();
List<ComponentInstanceInterface> componentInstanceInterfaces = entry.getValue()
- .getMapToscaDataDefinition().entrySet().stream().map(e -> new
- ComponentInstanceInterface(e.getKey(), e.getValue()))
- .collect(Collectors.toList());
+ .getMapToscaDataDefinition().entrySet().stream().map(e -> new
+ ComponentInstanceInterface(e.getKey(), e.getValue()))
+ .collect(Collectors.toList());
interfaces.put(key, componentInstanceInterfaces);
}
}
component.setComponentInstancesInterfaces(interfaces);
- }
- else if (topologyTemplate.getComponentInstInterfaces() != null) {
+ } else if (topologyTemplate.getComponentInstInterfaces() != null) {
Map<String, List<ComponentInstanceInterface>> interfaces = new HashMap<>();
for (Map.Entry<String, MapInterfaceDataDefinition> entry : topologyTemplate.getComponentInstInterfaces().entrySet()) {
if (entry.getValue() != null && entry.getValue().getMapToscaDataDefinition() != null) {
String key = entry.getKey();
List<ComponentInstanceInterface> componentInstanceInterfaces = entry.getValue()
- .getMapToscaDataDefinition().entrySet().stream().map(e -> new
- ComponentInstanceInterface(e.getKey(), e.getValue()))
- .collect(Collectors.toList());
+ .getMapToscaDataDefinition().entrySet().stream().map(e -> new
+ ComponentInstanceInterface(e.getKey(), e.getValue()))
+ .collect(Collectors.toList());
interfaces.put(key, componentInstanceInterfaces);
}
}
@@ -1593,7 +1646,7 @@ public class ModelConverter {
String key = entry.getKey();
List<ComponentInstanceAttribute> componentInstanceAttributes = entry.getValue()
.getMapToscaDataDefinition().entrySet().stream()
- .map(e -> new ComponentInstanceAttribute(new ComponentInstanceAttribute(e.getValue())))
+ .map(e -> new ComponentInstanceAttribute(new AttributeDefinition(e.getValue())))
.collect(Collectors.toList());
attributes.put(key, componentInstanceAttributes);
}
@@ -1607,15 +1660,17 @@ public class ModelConverter {
if (topologyTemplate.getCalculatedRequirements() != null) {
// Requirements of component organized by capability
- Map<String, List<RequirementDefinition>> instanceRequiermentsFromMapObject = getInstanceRequirementsFromMapObject(topologyTemplate.getCalculatedRequirements(), component);
+ Map<String, List<RequirementDefinition>> instanceRequiermentsFromMapObject = getInstanceRequirementsFromMapObject(
+ topologyTemplate.getCalculatedRequirements(), component);
component.setRequirements(instanceRequiermentsFromMapObject);
}
}
- public static Map<String, List<RequirementDefinition>> getInstanceRequirementsFromMapObject(Map<String, MapListRequirementDataDefinition> mapListRequirements, Component component) {
+ public static Map<String, List<RequirementDefinition>> getInstanceRequirementsFromMapObject(
+ Map<String, MapListRequirementDataDefinition> mapListRequirements, Component component) {
// Requirements of component organized by capability
Map<String, List<RequirementDefinition>> instancesRequirements = new HashMap<>();
- if (mapListRequirements!= null) {
+ if (mapListRequirements != null) {
Map<String, ComponentInstance> instancesMap = new HashMap<>();
for (ComponentInstance currInstance : component.getComponentInstances()) {
instancesMap.put(currInstance.getUniqueId(), currInstance);
@@ -1626,10 +1681,11 @@ public class ModelConverter {
// Requirements of instance organized by capability
Map<String, ListRequirementDataDefinition> capsMapList = entry.getValue().getMapToscaDataDefinition();
- if(capsMapList != null) {
+ if (capsMapList != null) {
for (Entry<String, ListRequirementDataDefinition> entryTypeList : capsMapList.entrySet()) {
String capabilityType = entryTypeList.getKey();
- List<RequirementDefinition> caps = entryTypeList.getValue().getListToscaDataDefinition().stream().map(RequirementDefinition::new).collect(Collectors.toList());
+ List<RequirementDefinition> caps = entryTypeList.getValue().getListToscaDataDefinition().stream()
+ .map(RequirementDefinition::new).collect(Collectors.toList());
if (instancesRequirements.containsKey(capabilityType)) {
instancesRequirements.get(capabilityType).addAll(caps);
} else {
@@ -1644,7 +1700,7 @@ public class ModelConverter {
}
component.setRequirements(instancesRequirements);
}
- return instancesRequirements;
+ return instancesRequirements;
}
public static void setComponentInstancesCapabilitiesToComponentAndCI(TopologyTemplate topologyTemplate, Component component) {
@@ -1664,10 +1720,11 @@ public class ModelConverter {
// capabilities of instance organized by type
Map<String, ListCapabilityDataDefinition> capsMapList = entry.getValue().getMapToscaDataDefinition();
- if(capsMapList != null) {
+ if (capsMapList != null) {
for (Entry<String, ListCapabilityDataDefinition> entryTypeList : capsMapList.entrySet()) {
String capabilityType = entryTypeList.getKey();
- List<CapabilityDefinition> caps = entryTypeList.getValue().getListToscaDataDefinition().stream().map(cap -> mergeInstCapabiltyWithProperty(cap, instanceId, calculatedCapProperties)).collect(Collectors.toList());
+ List<CapabilityDefinition> caps = entryTypeList.getValue().getListToscaDataDefinition().stream()
+ .map(cap -> mergeInstCapabiltyWithProperty(cap, instanceId, calculatedCapProperties)).collect(Collectors.toList());
if (instancesCapabilities.containsKey(capabilityType)) {
instancesCapabilities.get(capabilityType).addAll(caps);
} else {
@@ -1675,7 +1732,8 @@ public class ModelConverter {
}
ComponentInstance instance = instancesMap.get(instanceId);
if (instance == null) {
- log.error("instance is null for id {} entry {}", instanceId, entry.getValue().getToscaPresentationValue(JsonPresentationFields.NAME));
+ log.error("instance is null for id {} entry {}", instanceId,
+ entry.getValue().getToscaPresentationValue(JsonPresentationFields.NAME));
} else {
if (MapUtils.isEmpty(instance.getCapabilities())) {
instance.setCapabilities(new HashMap<>());
@@ -1694,33 +1752,33 @@ public class ModelConverter {
Map<String, MapPropertiesDataDefinition> capabilitiesProperties = topologyTemplate.getCapabilitiesProperties();
Map<String, List<CapabilityDefinition>> allCapabilities = new HashMap<>();
- if(MapUtils.isNotEmpty(capabilities)) {
+ if (MapUtils.isNotEmpty(capabilities)) {
allCapabilities.putAll(groupCapabilityByType(capabilities));
}
- if(MapUtils.isNotEmpty(capabilitiesProperties)) {
- capabilitiesProperties.forEach((s, capProp)-> {
- String[] result = s.split(CAP_PROP_DELIM);
- if (capProp != null) {
- Map<String, PropertyDataDefinition> capMap = capProp.getMapToscaDataDefinition();
+ if (MapUtils.isNotEmpty(capabilitiesProperties)) {
+ capabilitiesProperties.forEach((s, capProp) -> {
+ String[] result = s.split(CAP_PROP_DELIM);
+ if (capProp != null) {
+ Map<String, PropertyDataDefinition> capMap = capProp.getMapToscaDataDefinition();
- if (MapUtils.isNotEmpty(capMap)) {
- List<ComponentInstanceProperty> capPropsList = capMap.values().stream()
- .map(ComponentInstanceProperty::new).collect(Collectors.toList());
+ if (MapUtils.isNotEmpty(capMap)) {
+ List<ComponentInstanceProperty> capPropsList = capMap.values().stream()
+ .map(ComponentInstanceProperty::new).collect(Collectors.toList());
- List<CapabilityDefinition> cap = allCapabilities.get(result[0]);
- if (cap !=null) {
- Optional<CapabilityDefinition> op = cap.stream().filter(c -> c.getName()
- .equals(result[1])).findFirst();
- op.ifPresent(capabilityDefinition -> capabilityDefinition.setProperties(capPropsList));
- }
+ List<CapabilityDefinition> cap = allCapabilities.get(result[0]);
+ if (cap != null) {
+ Optional<CapabilityDefinition> op = cap.stream().filter(c -> c.getName()
+ .equals(result[1])).findFirst();
+ op.ifPresent(capabilityDefinition -> capabilityDefinition.setProperties(capPropsList));
}
}
}
+ }
);
}
Map<String, List<CapabilityDefinition>> componentCapabilities = component.getCapabilities();
- if(MapUtils.isNotEmpty(componentCapabilities)) {
+ if (MapUtils.isNotEmpty(componentCapabilities)) {
mergeCapabilityMap(allCapabilities, componentCapabilities);
}
component.setCapabilities(allCapabilities);
@@ -1729,7 +1787,7 @@ public class ModelConverter {
private static void mergeCapabilityMap(Map<String, List<CapabilityDefinition>> map1,
Map<String, List<CapabilityDefinition>> map2) {
map1.forEach((key1, val1) -> map2.forEach((key2, val2) -> {
- if(key1.equals(key2)) {
+ if (key1.equals(key2)) {
val2.addAll(val1);
}
}));
@@ -1737,23 +1795,23 @@ public class ModelConverter {
}
private static Map<String, List<CapabilityDefinition>> groupCapabilityByType(Map<String,
- ListCapabilityDataDefinition> capabilities) {
- Map<String, List<CapabilityDefinition>> groupedCapabilities = new HashMap<>();
+ ListCapabilityDataDefinition> capabilities) {
+ Map<String, List<CapabilityDefinition>> groupedCapabilities = new HashMap<>();
Set<String> typesSet = new HashSet<>();
List<CapabilityDefinition> allCapabilityDefinitions = new ArrayList<>();
for (Entry<String, ListCapabilityDataDefinition> capabilitiesEntry : capabilities.entrySet()) {
- typesSet.addAll( capabilitiesEntry.getValue().getListToscaDataDefinition()
- .stream().map(CapabilityDataDefinition::getType).collect(Collectors.toSet()));
+ typesSet.addAll(capabilitiesEntry.getValue().getListToscaDataDefinition()
+ .stream().map(CapabilityDataDefinition::getType).collect(Collectors.toSet()));
allCapabilityDefinitions.addAll(capabilitiesEntry.getValue().getListToscaDataDefinition()
- .stream().map(CapabilityDefinition::new).collect(Collectors.toList()));
+ .stream().map(CapabilityDefinition::new).collect(Collectors.toList()));
}
- for(String capType : typesSet) {
+ for (String capType : typesSet) {
groupedCapabilities.put(capType, allCapabilityDefinitions.stream()
- .filter(capabilityDefinition -> capabilityDefinition.getType()
- .equals(capType)).collect(Collectors.toList()));
+ .filter(capabilityDefinition -> capabilityDefinition.getType()
+ .equals(capType)).collect(Collectors.toList()));
}
return groupedCapabilities;
}
@@ -1761,8 +1819,8 @@ public class ModelConverter {
private static void setRequirementsToComponent(TopologyTemplate topologyTemplate, Component component) {
Map<String, ListRequirementDataDefinition> requirements = topologyTemplate.getRequirements();
Map<String, List<RequirementDefinition>> componentRequirements = component.getRequirements();
- if(MapUtils.isNotEmpty(requirements)) {
- if(componentRequirements == null) {
+ if (MapUtils.isNotEmpty(requirements)) {
+ if (componentRequirements == null) {
componentRequirements = new HashMap<>();
}
componentRequirements.putAll(groupRequirementByType(requirements));
@@ -1771,107 +1829,116 @@ public class ModelConverter {
}
private static Map<String, List<RequirementDefinition>> groupRequirementByType(Map<String,
- ListRequirementDataDefinition> requirements) {
- Map<String, List<RequirementDefinition>> groupedRequirement = new HashMap<>();
+ ListRequirementDataDefinition> requirements) {
+ Map<String, List<RequirementDefinition>> groupedRequirement = new HashMap<>();
Set<String> typesSet = new HashSet<>();
List<RequirementDefinition> allRequirements = new ArrayList<>();
for (Entry<String, ListRequirementDataDefinition> requirementsEntry : requirements.entrySet()) {
- typesSet.addAll( requirementsEntry.getValue().getListToscaDataDefinition()
- .stream().map(RequirementDataDefinition::getCapability).collect(Collectors.toSet()));
+ typesSet.addAll(requirementsEntry.getValue().getListToscaDataDefinition()
+ .stream().map(RequirementDataDefinition::getCapability).collect(Collectors.toSet()));
allRequirements.addAll(requirementsEntry.getValue().getListToscaDataDefinition()
- .stream().map(RequirementDefinition::new).collect(Collectors.toList()));
+ .stream().map(RequirementDefinition::new).collect(Collectors.toList()));
}
- for(String capType : typesSet) {
+ for (String capType : typesSet) {
groupedRequirement.put(capType, allRequirements.stream().filter(requirementDefinition ->
- requirementDefinition.getCapability().equals(capType)).collect(Collectors.toList()));
+ requirementDefinition.getCapability().equals(capType)).collect(Collectors.toList()));
}
return groupedRequirement;
}
-
private static void setCapabilitiesToComponentAndGroups(TopologyTemplate topologyTemplate, Component component) {
- Map<String, MapCapabilityProperty> calculatedCapProperties = topologyTemplate.getCalculatedCapabilitiesProperties();
-
- if (capabilitiesAndGroupsExist(topologyTemplate, component)) {
- Map<String, GroupDefinition> groupsMap = component.getGroups().stream().collect(Collectors.toMap(GroupDefinition::getUniqueId,Function.identity()));
-
- for (Map.Entry<String, MapListCapabilityDataDefinition> entry : topologyTemplate.getCalculatedCapabilities().entrySet()) {
- findSetCapabilitiesToComponentAndGroup(calculatedCapProperties, component, groupsMap, entry);
- }
- }
- }
-
- private static boolean capabilitiesAndGroupsExist(TopologyTemplate topologyTemplate, Component component) {
- return MapUtils.isNotEmpty(topologyTemplate.getCalculatedCapabilities()) && CollectionUtils.isNotEmpty(component.getGroups());
- }
-
- private static void findSetCapabilitiesToComponentAndGroup(Map<String, MapCapabilityProperty> calculatedCapProperties, Component component, Map<String, GroupDefinition> groupsMap, Map.Entry<String, MapListCapabilityDataDefinition> entry) {
-
- String uniqueId = entry.getKey();
- if(groupsMap.containsKey(uniqueId)){
- setCapabilitiesToComponentAndGroup(calculatedCapProperties, component, entry, groupsMap.get(uniqueId));
- } else {
- log.warn("The group with uniqueId {} was not found", uniqueId);
- }
- }
-
- private static void setCapabilitiesToComponentAndGroup(Map<String, MapCapabilityProperty> calculatedCapProperties, Component component, Map.Entry<String, MapListCapabilityDataDefinition> entry, GroupDefinition group) {
-
- for (Entry<String, ListCapabilityDataDefinition> entryTypeList : entry.getValue().getMapToscaDataDefinition().entrySet()) {
- String capabilityType = entryTypeList.getKey();
- List<CapabilityDefinition> caps = entryTypeList.getValue().getListToscaDataDefinition().stream().map(cap -> mergeInstCapabiltyWithProperty(cap, group.getUniqueId(), calculatedCapProperties)).collect(Collectors.toList());
- if (component.getCapabilities().containsKey(capabilityType)) {
- component.getCapabilities().get(capabilityType).addAll(caps);
- } else {
- component.getCapabilities().put(capabilityType, caps);
- }
- group.getCapabilities().put(capabilityType, Lists.newArrayList(caps));
- }
- }
-
- private static CapabilityDefinition mergeInstCapabiltyWithProperty(CapabilityDataDefinition cap, String ownerId, Map<String, MapCapabilityProperty> calculatedCapProperties) {
+ Map<String, MapCapabilityProperty> calculatedCapProperties = topologyTemplate.getCalculatedCapabilitiesProperties();
+
+ if (capabilitiesAndGroupsExist(topologyTemplate, component)) {
+ Map<String, GroupDefinition> groupsMap = component.getGroups().stream()
+ .collect(Collectors.toMap(GroupDefinition::getUniqueId, Function.identity()));
+
+ for (Map.Entry<String, MapListCapabilityDataDefinition> entry : topologyTemplate.getCalculatedCapabilities().entrySet()) {
+ findSetCapabilitiesToComponentAndGroup(calculatedCapProperties, component, groupsMap, entry);
+ }
+ }
+ }
+
+ private static boolean capabilitiesAndGroupsExist(TopologyTemplate topologyTemplate, Component component) {
+ return MapUtils.isNotEmpty(topologyTemplate.getCalculatedCapabilities()) && CollectionUtils.isNotEmpty(component.getGroups());
+ }
+
+ private static void findSetCapabilitiesToComponentAndGroup(Map<String, MapCapabilityProperty> calculatedCapProperties, Component component,
+ Map<String, GroupDefinition> groupsMap,
+ Map.Entry<String, MapListCapabilityDataDefinition> entry) {
+
+ String uniqueId = entry.getKey();
+ if (groupsMap.containsKey(uniqueId)) {
+ setCapabilitiesToComponentAndGroup(calculatedCapProperties, component, entry, groupsMap.get(uniqueId));
+ } else {
+ log.warn("The group with uniqueId {} was not found", uniqueId);
+ }
+ }
+
+ private static void setCapabilitiesToComponentAndGroup(Map<String, MapCapabilityProperty> calculatedCapProperties, Component component,
+ Map.Entry<String, MapListCapabilityDataDefinition> entry, GroupDefinition group) {
+
+ for (Entry<String, ListCapabilityDataDefinition> entryTypeList : entry.getValue().getMapToscaDataDefinition().entrySet()) {
+ String capabilityType = entryTypeList.getKey();
+ List<CapabilityDefinition> caps = entryTypeList.getValue().getListToscaDataDefinition().stream()
+ .map(cap -> mergeInstCapabiltyWithProperty(cap, group.getUniqueId(), calculatedCapProperties)).collect(Collectors.toList());
+ if (component.getCapabilities().containsKey(capabilityType)) {
+ component.getCapabilities().get(capabilityType).addAll(caps);
+ } else {
+ component.getCapabilities().put(capabilityType, caps);
+ }
+ group.getCapabilities().put(capabilityType, Lists.newArrayList(caps));
+ }
+ }
+
+ private static CapabilityDefinition mergeInstCapabiltyWithProperty(CapabilityDataDefinition cap, String ownerId,
+ Map<String, MapCapabilityProperty> calculatedCapProperties) {
CapabilityDefinition capability = new CapabilityDefinition(cap);
if (calculatedCapProperties != null) {
- MapCapabilityProperty mapOfMapPropertiesDataDefinition = calculatedCapProperties.get(ownerId);
+ MapCapabilityProperty mapOfMapPropertiesDataDefinition = calculatedCapProperties.get(ownerId);
if (mapOfMapPropertiesDataDefinition != null && mapOfMapPropertiesDataDefinition.getMapToscaDataDefinition() != null) {
Map<String, MapPropertiesDataDefinition> toscaCapPropMap = mapOfMapPropertiesDataDefinition.getMapToscaDataDefinition();
- toscaCapPropMap.forEach(( keyPath, capProp)-> findConvertSetProperties(cap, ownerId, capability, keyPath, capProp));
- }
- }
- return capability;
- }
-
- private static void findConvertSetProperties(CapabilityDataDefinition cap, String primaryPathKey, CapabilityDefinition capability, String path, MapPropertiesDataDefinition capProp) {
- // format key of capability properties :
- // VF instance in service : instanceId#ownerId#type#capName
- // VFC instance in VF : instanceId#type#capName -> instanceId=ownerId
- // Group in service : groupName#ownerId#type#capName
- // Group in VF : groupName#type#capName -> groupName=ownerId
- String[] result = path.split(CAP_PROP_DELIM);
- if (result.length < 4) {
- log.debug("wrong key format for capabilty, key {}", capProp);
- return;
- }
- if (relatedPropertiesExist(cap, primaryPathKey, capProp, result)) {
- capability.setProperties(capProp.getMapToscaDataDefinition().values().stream().map(ComponentInstanceProperty::new).collect(Collectors.toList()));
- }
- }
-
- private static boolean relatedPropertiesExist(CapabilityDataDefinition cap, String primaryPathKey, MapPropertiesDataDefinition capProp, String[] result) {
- return capProp != null && MapUtils.isNotEmpty(capProp.getMapToscaDataDefinition()) && areRelatedProperties(cap, primaryPathKey, result);
- }
-
- private static boolean areRelatedProperties(CapabilityDataDefinition cap, String primaryPathKey, String[] result) {
- int primaryKeyIndex = 0;
- int ownerIndex = 1;
- int typeIndex = result.length - 2;
- int nameIndex = result.length - 1;
- return result[typeIndex].equals(cap.getType()) && result[nameIndex].equals(cap.getName()) && cap.getOwnerId().equals(result[ownerIndex]) && primaryPathKey.equals(result[primaryKeyIndex]);
+ toscaCapPropMap.forEach((keyPath, capProp) -> findConvertSetProperties(cap, ownerId, capability, keyPath, capProp));
+ }
+ }
+ return capability;
+ }
+
+ private static void findConvertSetProperties(CapabilityDataDefinition cap, String primaryPathKey, CapabilityDefinition capability, String path,
+ MapPropertiesDataDefinition capProp) {
+ // format key of capability properties :
+ // VF instance in service : instanceId#ownerId#type#capName
+ // VFC instance in VF : instanceId#type#capName -> instanceId=ownerId
+ // Group in service : groupName#ownerId#type#capName
+ // Group in VF : groupName#type#capName -> groupName=ownerId
+ String[] result = path.split(CAP_PROP_DELIM);
+ if (result.length < 4) {
+ log.debug("wrong key format for capabilty, key {}", capProp);
+ return;
+ }
+ if (relatedPropertiesExist(cap, primaryPathKey, capProp, result)) {
+ capability.setProperties(
+ capProp.getMapToscaDataDefinition().values().stream().map(ComponentInstanceProperty::new).collect(Collectors.toList()));
+ }
+ }
+
+ private static boolean relatedPropertiesExist(CapabilityDataDefinition cap, String primaryPathKey, MapPropertiesDataDefinition capProp,
+ String[] result) {
+ return capProp != null && MapUtils.isNotEmpty(capProp.getMapToscaDataDefinition()) && areRelatedProperties(cap, primaryPathKey, result);
+ }
+
+ private static boolean areRelatedProperties(CapabilityDataDefinition cap, String primaryPathKey, String[] result) {
+ int primaryKeyIndex = 0;
+ int ownerIndex = 1;
+ int typeIndex = result.length - 2;
+ int nameIndex = result.length - 1;
+ return result[typeIndex].equals(cap.getType()) && result[nameIndex].equals(cap.getName()) && cap.getOwnerId().equals(result[ownerIndex])
+ && primaryPathKey.equals(result[primaryKeyIndex]);
}
private static void setComponentInstancesToTopologyTemplate(Component component, TopologyTemplate topologyTemplate) {
@@ -1884,7 +1951,8 @@ public class ModelConverter {
if (instance.getGroupInstances() != null) {
MapGroupsDataDefinition groupsMap = new MapGroupsDataDefinition();
- groupsMap.setMapToscaDataDefinition(instance.getGroupInstances().stream().map(GroupInstanceDataDefinition::new).collect(Collectors.toMap(GroupInstanceDataDefinition::getName, Function.identity())));
+ groupsMap.setMapToscaDataDefinition(instance.getGroupInstances().stream().map(GroupInstanceDataDefinition::new)
+ .collect(Collectors.toMap(GroupInstanceDataDefinition::getName, Function.identity())));
if (topologyTemplate.getInstGroups() == null) {
topologyTemplate.setInstGroups(new HashMap<>());
}
@@ -1905,7 +1973,8 @@ public class ModelConverter {
for (Entry<String, List<ComponentInstanceInput>> entry : component.getComponentInstancesInputs().entrySet()) {
inputsMap = new MapPropertiesDataDefinition();
- inputsMap.setMapToscaDataDefinition(entry.getValue().stream().map(PropertyDataDefinition::new).collect(Collectors.toMap(PropertyDataDefinition::getName, Function.identity())));
+ inputsMap.setMapToscaDataDefinition(entry.getValue().stream().map(PropertyDataDefinition::new)
+ .collect(Collectors.toMap(PropertyDataDefinition::getName, Function.identity())));
topologyTemplate.getInstInputs().put(entry.getKey(), inputsMap);
}
@@ -1920,7 +1989,8 @@ public class ModelConverter {
for (Entry<String, List<ComponentInstanceProperty>> entry : component.getComponentInstancesProperties().entrySet()) {
propertiesMap = new MapPropertiesDataDefinition();
- propertiesMap.setMapToscaDataDefinition(entry.getValue().stream().map(PropertyDataDefinition::new).collect(Collectors.toMap(PropertyDataDefinition::getName, Function.identity())));
+ propertiesMap.setMapToscaDataDefinition(entry.getValue().stream().map(PropertyDataDefinition::new)
+ .collect(Collectors.toMap(PropertyDataDefinition::getName, Function.identity())));
topologyTemplate.getInstProperties().put(entry.getKey(), propertiesMap);
}
@@ -1937,14 +2007,16 @@ public class ModelConverter {
for (ComponentInstance ci : componentInstances) {
Map<String, ArtifactDefinition> artifacts = ci.getArtifacts();
if (artifacts != null) {
- Map<String, ArtifactDataDefinition> mapToscaDataDefinitionArtifact = artifacts.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, e -> new ArtifactDataDefinition(e.getValue())));
+ Map<String, ArtifactDataDefinition> mapToscaDataDefinitionArtifact = artifacts.entrySet().stream()
+ .collect(Collectors.toMap(Map.Entry::getKey, e -> new ArtifactDataDefinition(e.getValue())));
MapArtifactDataDefinition insArtifact = new MapArtifactDataDefinition(mapToscaDataDefinitionArtifact);
topologyTemplate.getInstanceArtifacts().put(ci.getUniqueId(), insArtifact);
}
Map<String, ArtifactDefinition> deplArtifacts = ci.getDeploymentArtifacts();
if (deplArtifacts != null) {
- Map<String, ArtifactDataDefinition> mapToscaDataDefinitionDepArtifact = deplArtifacts.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, e -> new ArtifactDataDefinition(e.getValue())));
+ Map<String, ArtifactDataDefinition> mapToscaDataDefinitionDepArtifact = deplArtifacts.entrySet().stream()
+ .collect(Collectors.toMap(Map.Entry::getKey, e -> new ArtifactDataDefinition(e.getValue())));
MapArtifactDataDefinition insDepArtifact = new MapArtifactDataDefinition(mapToscaDataDefinitionDepArtifact);
topologyTemplate.getInstDeploymentArtifacts().put(ci.getUniqueId(), insDepArtifact);
}
@@ -1956,13 +2028,12 @@ public class ModelConverter {
if (component.getComponentInstancesAttributes() != null) {
topologyTemplate.setInstAttributes(new HashMap<>());
- MapAttributesDataDefinition attributesMap;
- for (Entry<String, List<ComponentInstanceAttribute>> entry : component.getComponentInstancesAttributes()
- .entrySet()) {
- attributesMap = new MapAttributesDataDefinition();
+
+ for (Entry<String, List<ComponentInstanceAttribute>> entry : component.getComponentInstancesAttributes().entrySet()) {
+ final MapAttributesDataDefinition attributesMap = new MapAttributesDataDefinition();
attributesMap.setMapToscaDataDefinition(entry.getValue().stream().map(AttributeDefinition::new)
- .collect(Collectors.toMap(AttributeDataDefinition::getName, Function.identity(),(entity1,entity2) -> entity1)));
+ .collect(Collectors.toMap(AttributeDefinition::getName, Function.identity(), (entity1, entity2) -> entity1)));
topologyTemplate.getInstAttributes().put(entry.getKey(), attributesMap);
}
@@ -1972,17 +2043,17 @@ public class ModelConverter {
public static ComponentMetadataData convertToComponentMetadata(GraphVertex vertex) {
ComponentMetadataData metadata;
switch (vertex.getType()) {
- case SERVICE:
- metadata = new ServiceMetadataData(new GraphPropertiesDictionaryExtractor(vertex.getMetadataJson()));
- break;
- case RESOURCE:
- metadata = new ResourceMetadataData(new GraphPropertiesDictionaryExtractor(vertex.getMetadataJson()));
- break;
- case PRODUCT:
- metadata = new ProductMetadataData(new GraphPropertiesDictionaryExtractor(vertex.getMetadataJson()));
- break;
- default:
- throw new StorageException(JanusGraphOperationStatus.INVALID_TYPE);
+ case SERVICE:
+ metadata = new ServiceMetadataData(new GraphPropertiesDictionaryExtractor(vertex.getMetadataJson()));
+ break;
+ case RESOURCE:
+ metadata = new ResourceMetadataData(new GraphPropertiesDictionaryExtractor(vertex.getMetadataJson()));
+ break;
+ case PRODUCT:
+ metadata = new ProductMetadataData(new GraphPropertiesDictionaryExtractor(vertex.getMetadataJson()));
+ break;
+ default:
+ throw new StorageException(JanusGraphOperationStatus.INVALID_TYPE);
}
metadata.getMetadataDataDefinition().setUniqueId(vertex.getUniqueId());
metadata.getMetadataDataDefinition().setLastUpdateDate((Long) vertex.getJsonMetadataField(JsonPresentationFields.LAST_UPDATE_DATE));
@@ -2017,42 +2088,44 @@ public class ModelConverter {
List<GroupDefinition> groupDefinitions = new ArrayList<>();
if (MapUtils.isNotEmpty(groups)) {
- groupDefinitions = groups.values().stream().map(GroupDefinition::new).collect(Collectors.toList());
+ groupDefinitions = groups.values().stream().map(GroupDefinition::new).collect(Collectors.toList());
}
return groupDefinitions;
- }
-
- public static Map<String, MapCapabilityProperty> extractCapabilityProperteisFromInstances(List<ComponentInstance> instances, boolean fromCsar) {
- return instances
- .stream()
- .collect(Collectors.toMap(ComponentInstanceDataDefinition::getUniqueId,
- ci -> convertToMapOfMapCapabiltyProperties(ci.getCapabilities(), ci.getUniqueId(), fromCsar)));
- }
-
- public static Map<String, MapCapabilityProperty> extractCapabilityPropertiesFromGroups(List<GroupDefinition> groups, boolean fromCsar) {
- if(CollectionUtils.isNotEmpty(groups))
- return groups
- .stream()
- .collect(Collectors.toMap(GroupDefinition::getUniqueId,
- g -> convertToMapOfMapCapabiltyProperties(g.getCapabilities(), g.getUniqueId(), fromCsar)));
- return Maps.newHashMap();
- }
-
- public static Map<String, MapListCapabilityDataDefinition> extractCapabilitiesFromGroups(final List<GroupDefinition> groupDefinitions) {
- Map<String, MapListCapabilityDataDefinition> calculatedCapabilities = Maps.newHashMap();
- for(GroupDefinition groupDefinition :groupDefinitions){
- calculatedCapabilities.put(groupDefinition.getUniqueId(), new MapListCapabilityDataDefinition(buildMapOfListsOfCapabilities(groupDefinition)));
- }
- return calculatedCapabilities;
- }
-
- private static Map<String, ListCapabilityDataDefinition> buildMapOfListsOfCapabilities(GroupDefinition groupDefinition) {
- return groupDefinition.getCapabilities().entrySet()
- .stream()
- .collect(Collectors.toMap(Map.Entry::getKey, e-> new ListCapabilityDataDefinition(e.getValue()
- .stream()
- .map(CapabilityDataDefinition::new)
- .collect(Collectors.toList()))));
+ }
+
+ public static Map<String, MapCapabilityProperty> extractCapabilityProperteisFromInstances(List<ComponentInstance> instances, boolean fromCsar) {
+ return instances
+ .stream()
+ .collect(Collectors.toMap(ComponentInstanceDataDefinition::getUniqueId,
+ ci -> convertToMapOfMapCapabiltyProperties(ci.getCapabilities(), ci.getUniqueId(), fromCsar)));
+ }
+
+ public static Map<String, MapCapabilityProperty> extractCapabilityPropertiesFromGroups(List<GroupDefinition> groups, boolean fromCsar) {
+ if (CollectionUtils.isNotEmpty(groups)) {
+ return groups
+ .stream()
+ .collect(Collectors.toMap(GroupDefinition::getUniqueId,
+ g -> convertToMapOfMapCapabiltyProperties(g.getCapabilities(), g.getUniqueId(), fromCsar)));
+ }
+ return Maps.newHashMap();
+ }
+
+ public static Map<String, MapListCapabilityDataDefinition> extractCapabilitiesFromGroups(final List<GroupDefinition> groupDefinitions) {
+ Map<String, MapListCapabilityDataDefinition> calculatedCapabilities = Maps.newHashMap();
+ for (GroupDefinition groupDefinition : groupDefinitions) {
+ calculatedCapabilities
+ .put(groupDefinition.getUniqueId(), new MapListCapabilityDataDefinition(buildMapOfListsOfCapabilities(groupDefinition)));
+ }
+ return calculatedCapabilities;
+ }
+
+ private static Map<String, ListCapabilityDataDefinition> buildMapOfListsOfCapabilities(GroupDefinition groupDefinition) {
+ return groupDefinition.getCapabilities().entrySet()
+ .stream()
+ .collect(Collectors.toMap(Map.Entry::getKey, e -> new ListCapabilityDataDefinition(e.getValue()
+ .stream()
+ .map(CapabilityDataDefinition::new)
+ .collect(Collectors.toList()))));
}
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/ui/model/UiComponentDataTransfer.java b/catalog-model/src/main/java/org/openecomp/sdc/be/ui/model/UiComponentDataTransfer.java
index d499dfe799..1d1c8cd9dc 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/ui/model/UiComponentDataTransfer.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/ui/model/UiComponentDataTransfer.java
@@ -30,6 +30,7 @@ import org.openecomp.sdc.be.datatypes.elements.SubstitutionFilterDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.model.AdditionalInformationDefinition;
import org.openecomp.sdc.be.model.ArtifactDefinition;
+import org.openecomp.sdc.be.model.AttributeDefinition;
import org.openecomp.sdc.be.model.CapabilityDefinition;
import org.openecomp.sdc.be.model.ComponentInstance;
import org.openecomp.sdc.be.model.ComponentInstanceAttribute;
@@ -78,6 +79,7 @@ public class UiComponentDataTransfer {
private Map<String, UINodeFilter> nodeFilterforNode;
private Map<String, UINodeFilter> substitutionFilterForTopologyTemplate;
private List<PropertyDefinition> properties;
+ private List<AttributeDefinition> attributes;
private Map<String, List<ComponentInstanceInterface>> componentInstancesInterfaces;
public UiComponentDataTransfer() {
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/ui/model/UiResourceDataTransfer.java b/catalog-model/src/main/java/org/openecomp/sdc/be/ui/model/UiResourceDataTransfer.java
index a51c368c71..eabb2cde14 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/ui/model/UiResourceDataTransfer.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/ui/model/UiResourceDataTransfer.java
@@ -25,7 +25,6 @@ import java.util.Map;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
-import org.openecomp.sdc.be.datatypes.elements.AttributeDataDefinition;
import org.openecomp.sdc.be.model.AttributeDefinition;
import org.openecomp.sdc.be.model.InterfaceDefinition;
import org.openecomp.sdc.be.model.PropertyDefinition;
@@ -43,7 +42,7 @@ public class UiResourceDataTransfer extends UiComponentDataTransfer {
private List<PropertyDefinition> properties;
- private List<AttributeDataDefinition> attributes;
+ private List<AttributeDefinition> attributes;
private Map<String, InterfaceDefinition> interfaces;
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentParametersViewTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentParametersViewTest.java
index ec3604498b..1f6719531e 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentParametersViewTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/ComponentParametersViewTest.java
@@ -70,426 +70,6 @@ public class ComponentParametersViewTest {
testSubject.disableAll();
}
-
- @Test
- public void testIsIgnoreGroups() throws Exception {
- ComponentParametersView testSubject;
- boolean result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.isIgnoreGroups();
- }
-
-
- @Test
- public void testSetIgnoreGroups() throws Exception {
- ComponentParametersView testSubject;
- boolean ignoreGroups = false;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setIgnoreGroups(ignoreGroups);
- }
-
-
- @Test
- public void testIsIgnoreComponentInstances() throws Exception {
- ComponentParametersView testSubject;
- boolean result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.isIgnoreComponentInstances();
- }
-
-
- @Test
- public void testSetIgnoreComponentInstances() throws Exception {
- ComponentParametersView testSubject;
- boolean ignoreComponentInstances = false;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setIgnoreComponentInstances(ignoreComponentInstances);
- }
-
-
- @Test
- public void testIsIgnoreProperties() throws Exception {
- ComponentParametersView testSubject;
- boolean result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.isIgnoreProperties();
- }
-
-
- @Test
- public void testSetIgnoreProperties() throws Exception {
- ComponentParametersView testSubject;
- boolean ignoreProperties = false;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setIgnoreProperties(ignoreProperties);
- }
-
-
- @Test
- public void testIsIgnoreCapabilities() throws Exception {
- ComponentParametersView testSubject;
- boolean result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.isIgnoreCapabilities();
- }
-
-
- @Test
- public void testSetIgnoreCapabilities() throws Exception {
- ComponentParametersView testSubject;
- boolean ignoreCapabilities = false;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setIgnoreCapabilities(ignoreCapabilities);
- }
-
-
- @Test
- public void testIsIgnoreRequirements() throws Exception {
- ComponentParametersView testSubject;
- boolean result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.isIgnoreRequirements();
- }
-
-
- @Test
- public void testSetIgnoreRequirements() throws Exception {
- ComponentParametersView testSubject;
- boolean ignoreRequirements = false;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setIgnoreRequirements(ignoreRequirements);
- }
-
-
- @Test
- public void testIsIgnoreCategories() throws Exception {
- ComponentParametersView testSubject;
- boolean result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.isIgnoreCategories();
- }
-
-
- @Test
- public void testSetIgnoreCategories() throws Exception {
- ComponentParametersView testSubject;
- boolean ignoreCategories = false;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setIgnoreCategories(ignoreCategories);
- }
-
-
- @Test
- public void testIsIgnoreAllVersions() throws Exception {
- ComponentParametersView testSubject;
- boolean result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.isIgnoreAllVersions();
- }
-
-
- @Test
- public void testSetIgnoreAllVersions() throws Exception {
- ComponentParametersView testSubject;
- boolean ignoreAllVersions = false;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setIgnoreAllVersions(ignoreAllVersions);
- }
-
-
- @Test
- public void testIsIgnoreAdditionalInformation() throws Exception {
- ComponentParametersView testSubject;
- boolean result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.isIgnoreAdditionalInformation();
- }
-
-
- @Test
- public void testIsIgnoreArtifacts() throws Exception {
- ComponentParametersView testSubject;
- boolean result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.isIgnoreArtifacts();
- }
-
-
- @Test
- public void testSetIgnoreArtifacts() throws Exception {
- ComponentParametersView testSubject;
- boolean ignoreArtifacts = false;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setIgnoreArtifacts(ignoreArtifacts);
- }
-
-
- @Test
- public void testIsIgnoreComponentInstancesProperties() throws Exception {
- ComponentParametersView testSubject;
- boolean result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.isIgnoreComponentInstancesProperties();
- }
-
-
- @Test
- public void testSetIgnoreComponentInstancesProperties() throws Exception {
- ComponentParametersView testSubject;
- boolean ignoreComponentInstancesProperties = false;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setIgnoreComponentInstancesProperties(ignoreComponentInstancesProperties);
- }
-
-
- @Test
- public void testIsIgnoreComponentInstancesInputs() throws Exception {
- ComponentParametersView testSubject;
- boolean result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.isIgnoreComponentInstancesInputs();
- }
-
-
- @Test
- public void testSetIgnoreComponentInstancesInputs() throws Exception {
- ComponentParametersView testSubject;
- boolean ignoreComponentInstancesInputs = false;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setIgnoreComponentInstancesInputs(ignoreComponentInstancesInputs);
- }
-
-
- @Test
- public void testIsIgnoreInterfaces() throws Exception {
- ComponentParametersView testSubject;
- boolean result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.isIgnoreInterfaces();
- }
-
-
-
- @Test
- public void testIsIgnoreAttributesFrom() throws Exception {
- ComponentParametersView testSubject;
- boolean result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.isIgnoreAttributesFrom();
- }
-
-
- @Test
- public void testSetIgnoreAttributesFrom() throws Exception {
- ComponentParametersView testSubject;
- boolean ignoreAttributesFrom = false;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setIgnoreAttributesFrom(ignoreAttributesFrom);
- }
-
-
- @Test
- public void testIsIgnoreComponentInstancesAttributesFrom() throws Exception {
- ComponentParametersView testSubject;
- boolean result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.isIgnoreComponentInstancesAttributesFrom();
- }
-
-
-
- @Test
- public void testIsIgnoreDerivedFrom() throws Exception {
- ComponentParametersView testSubject;
- boolean result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.isIgnoreDerivedFrom();
- }
-
-
-
- @Test
- public void testIsIgnoreUsers() throws Exception {
- ComponentParametersView testSubject;
- boolean result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.isIgnoreUsers();
- }
-
-
- @Test
- public void testSetIgnoreUsers() throws Exception {
- ComponentParametersView testSubject;
- boolean ignoreUsers = false;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setIgnoreUsers(ignoreUsers);
- }
-
-
- @Test
- public void testIsIgnoreInputs() throws Exception {
- ComponentParametersView testSubject;
- boolean result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.isIgnoreInputs();
- }
-
-
- @Test
- public void testSetIgnoreInputs() throws Exception {
- ComponentParametersView testSubject;
- boolean ignoreInputs = false;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setIgnoreInputs(ignoreInputs);
- }
-
-
- @Test
- public void testIsIgnoreCapabiltyProperties() throws Exception {
- ComponentParametersView testSubject;
- boolean result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.isIgnoreCapabiltyProperties();
- }
-
-
- @Test
- public void testSetIgnoreCapabiltyProperties() throws Exception {
- ComponentParametersView testSubject;
- boolean ignoreCapabiltyProperties = false;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setIgnoreCapabiltyProperties(ignoreCapabiltyProperties);
- }
-
-
- @Test
- public void testIsIgnoreForwardingPath() throws Exception {
- ComponentParametersView testSubject;
- boolean result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.isIgnoreForwardingPath();
- }
-
-
- @Test
- public void testSetIgnoreForwardingPath() throws Exception {
- ComponentParametersView testSubject;
- boolean ignoreServicePath = false;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setIgnoreForwardingPath(ignoreServicePath);
- }
-
-
- @Test
- public void testIsIgnorePolicies() throws Exception {
- ComponentParametersView testSubject;
- boolean result;
-
- // default test
- testSubject = createTestSubject();
- result = testSubject.isIgnorePolicies();
- }
-
-
- @Test
- public void testSetIgnorePolicies() throws Exception {
- ComponentParametersView testSubject;
- boolean ignorePolicies = false;
-
- // default test
- testSubject = createTestSubject();
- testSubject.setIgnorePolicies(ignorePolicies);
- }
-
-
- @Test
- public void testIsIgnoreNodeFilterWithTrue() throws Exception {
- ComponentParametersView testSubject;
-
- testSubject = createTestSubject();
- testSubject.setIgnoreNodeFilter(true);
- assertSame(testSubject.isIgnoreNodeFilter(), true);
- }
-
-
- @Test
- public void testIsIgnoreNodeFilterWithFalse() throws Exception {
- ComponentParametersView testSubject;
-
- testSubject = createTestSubject();
- testSubject.setIgnoreNodeFilter(false);
- assertSame(testSubject.isIgnoreNodeFilter(), false);
- }
-
-
@Test
public void testDetectParseFlag() throws Exception {
ComponentParametersView testSubject;