From 6e60006d2e22665b491d176ca9e91b74326bfabc Mon Sep 17 00:00:00 2001 From: Michael Lando Date: Mon, 19 Jun 2017 19:51:24 +0300 Subject: [sdc] update to the current code base and support http Change-Id: I2fb35494b40126a8395b1e309a180db4127754b7 Signed-off-by: Michael Lando --- .../jsontitan/operations/NodeTypeOperation.java | 61 ++++------------------ .../operations/ToscaElementLifecycleOperation.java | 5 ++ .../migration/MigrationMalformedDataLogger.java | 5 +- .../sdc/be/ui/model/UiServiceMetadata.java | 10 ---- 4 files changed, 19 insertions(+), 62 deletions(-) (limited to 'catalog-model/src/main/java/org') diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTypeOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTypeOperation.java index 985870b5e3..8718f72f8a 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTypeOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTypeOperation.java @@ -2,11 +2,8 @@ package org.openecomp.sdc.be.model.jsontitan.operations; import fj.data.Either; -import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.commons.lang3.tuple.ImmutableTriple; import org.apache.tinkerpop.gremlin.structure.Direction; import org.apache.tinkerpop.gremlin.structure.Edge; -import org.openecomp.sdc.be.dao.graph.datatype.GraphNode; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; @@ -15,40 +12,20 @@ import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; import org.openecomp.sdc.be.datatypes.elements.AdditionalInfoParameterDataDefinition; import org.openecomp.sdc.be.datatypes.elements.InterfaceDataDefinition; import org.openecomp.sdc.be.datatypes.elements.ListCapabilityDataDefinition; -import org.openecomp.sdc.be.datatypes.elements.ListDataDefinition; import org.openecomp.sdc.be.datatypes.elements.ListRequirementDataDefinition; -import org.openecomp.sdc.be.datatypes.elements.MapCapabiltyProperty; import org.openecomp.sdc.be.datatypes.elements.MapPropertiesDataDefinition; import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; -import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; import org.openecomp.sdc.be.model.ComponentParametersView; import org.openecomp.sdc.be.model.DerivedNodeTypeResolver; import org.openecomp.sdc.be.model.LifecycleStateEnum; import org.openecomp.sdc.be.model.jsontitan.datamodel.NodeType; -import org.openecomp.sdc.be.model.jsontitan.datamodel.TopologyTemplate; import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement; import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElementTypeEnum; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.DaoStatusConverter; import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder; -import org.openecomp.sdc.be.resources.data.AttributeData; -import org.openecomp.sdc.be.resources.data.AttributeValueData; -import org.openecomp.sdc.be.resources.data.CapabilityData; -import org.openecomp.sdc.be.resources.data.CapabilityTypeData; -import org.openecomp.sdc.be.resources.data.DataTypeData; -import org.openecomp.sdc.be.resources.data.GroupData; -import org.openecomp.sdc.be.resources.data.GroupTypeData; -import org.openecomp.sdc.be.resources.data.InputValueData; -import org.openecomp.sdc.be.resources.data.InputsData; -import org.openecomp.sdc.be.resources.data.PolicyTypeData; -import org.openecomp.sdc.be.resources.data.PropertyData; -import org.openecomp.sdc.be.resources.data.PropertyValueData; -import org.openecomp.sdc.be.resources.data.RelationshipInstData; -import org.openecomp.sdc.be.resources.data.RelationshipTypeData; -import org.openecomp.sdc.be.resources.data.RequirementData; -import org.openecomp.sdc.be.resources.data.ResourceMetadataData; import org.openecomp.sdc.common.jsongraph.util.CommonUtility; import org.openecomp.sdc.common.jsongraph.util.CommonUtility.LogLevelEnum; import org.slf4j.Logger; @@ -57,11 +34,10 @@ import org.springframework.beans.factory.annotation.Qualifier; import java.util.ArrayList; import java.util.Collection; +import java.util.EnumSet; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Map.Entry; -import java.util.function.Function; import java.util.regex.Pattern; @org.springframework.stereotype.Component("node-type-operation") @@ -748,34 +724,17 @@ public class NodeTypeOperation extends ToscaElementOperation { } - private StorageOperationStatus updateDataFromNewDerived(List newDerived, GraphVertex nodeTypeV, NodeType nodeToUpdate) { - - StorageOperationStatus status = updateDataByType(newDerived, nodeTypeV, EdgeLabelEnum.CAPABILITIES, nodeToUpdate); - if (status != StorageOperationStatus.OK) { - return status; - } - - status = updateDataByType(newDerived, nodeTypeV, EdgeLabelEnum.REQUIREMENTS, nodeToUpdate); - if (status != StorageOperationStatus.OK) { - return status; - } - - status = updateDataByType(newDerived, nodeTypeV, EdgeLabelEnum.PROPERTIES, nodeToUpdate); - if (status != StorageOperationStatus.OK) { - return status; - } - - status = updateDataByType(newDerived, nodeTypeV, EdgeLabelEnum.ATTRIBUTES, nodeToUpdate); - if (status != StorageOperationStatus.OK) { - return status; - } - - status = updateDataByType(newDerived, nodeTypeV,EdgeLabelEnum.CAPABILITIES_PROPERTIES, nodeToUpdate); - if (status != StorageOperationStatus.OK) { - return status; + private StorageOperationStatus updateDataFromNewDerived(List newDerived, GraphVertex nodeTypeV, NodeType nodeToUpdate) { + EnumSet edgeLabels = EnumSet.of(EdgeLabelEnum.CAPABILITIES, EdgeLabelEnum.REQUIREMENTS, EdgeLabelEnum.PROPERTIES, EdgeLabelEnum.ATTRIBUTES, EdgeLabelEnum.CAPABILITIES_PROPERTIES, EdgeLabelEnum.ADDITIONAL_INFORMATION); + StorageOperationStatus status = null; + for (EdgeLabelEnum edge : edgeLabels){ + status = updateDataByType(newDerived, nodeTypeV, edge, nodeToUpdate); + if (status != StorageOperationStatus.OK) { + break; + } } - status = updateDataByType(newDerived, nodeTypeV, EdgeLabelEnum.ADDITIONAL_INFORMATION, nodeToUpdate); return status; + } private StorageOperationStatus updateDataByType(List newDerivedList, GraphVertex nodeTypeV, EdgeLabelEnum label, NodeType nodeElement) { diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaElementLifecycleOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaElementLifecycleOperation.java index 1397e81f9c..ca0a51cbbc 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaElementLifecycleOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaElementLifecycleOperation.java @@ -992,6 +992,11 @@ public class ToscaElementLifecycleOperation extends BaseOperation { } return result; } + + //TODO remove after jsonModelMigration + public void resolveToscaComponentName(ComponentInstanceDataDefinition vfInst, Map origCompMap) { + fixToscaComponentName(vfInst, origCompMap); + } private boolean fixToscaComponentName(ComponentInstanceDataDefinition vfInst, Map origCompMap) { if (vfInst.getToscaComponentName() == null || vfInst.getToscaComponentName().isEmpty()) { diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/migration/MigrationMalformedDataLogger.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/migration/MigrationMalformedDataLogger.java index 2d4ca635e7..2e5e520af0 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/migration/MigrationMalformedDataLogger.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/migration/MigrationMalformedDataLogger.java @@ -35,7 +35,10 @@ public class MigrationMalformedDataLogger { Set serviceInstances = componentInstances.stream().map(ComponentInstance::getComponentUid).collect(Collectors.toSet()); serviceInstances.retainAll(malformedVFs); if (!serviceInstances.isEmpty()) { - log.error(String.format("Service %s is using malformed VFs: %s", service.getUniqueId(), StringUtils.join(serviceInstances, ','))); + log.error(String.format("Service %s with id %s and version %s is using malformed VFs: %s", service.getName(), + service.getVersion(), + service.getUniqueId(), + StringUtils.join(serviceInstances, ','))); } } } diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/ui/model/UiServiceMetadata.java b/catalog-model/src/main/java/org/openecomp/sdc/be/ui/model/UiServiceMetadata.java index b68704eeea..96671766eb 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/ui/model/UiServiceMetadata.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/ui/model/UiServiceMetadata.java @@ -10,16 +10,6 @@ public class UiServiceMetadata extends UiComponentMetadata { private String distributionStatus; private Boolean ecompGeneratedNaming; private String namingPolicy; - private UiServiceMetadata metadata; - - - public UiServiceMetadata getMetadata() { - return metadata; - } - - public void setMetadata(UiServiceMetadata metadata) { - this.metadata = metadata; - } public UiServiceMetadata(List categories, ServiceMetadataDataDefinition metadata) { super(categories, metadata); -- cgit 1.2.3-korg