diff options
Diffstat (limited to 'catalog-be/src/main/java/org/openecomp/sdc/be/tosca')
7 files changed, 15 insertions, 185 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/AttributeConverter.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/AttributeConverter.java index 143fb7b34b..847947badd 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/AttributeConverter.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/AttributeConverter.java @@ -97,16 +97,6 @@ public class AttributeConverter { return toscaAttribute; } - private ToscaSchemaDefinition convert(final EntrySchema entrySchema) { - if (entrySchema == null) { - return null; - } - final ToscaSchemaDefinition toscaSchemaDefinition = new ToscaSchemaDefinition(); - toscaSchemaDefinition.setType(entrySchema.getType()); - toscaSchemaDefinition.setDescription(entrySchema.getDescription()); - return toscaSchemaDefinition; - } - private Object convertToToscaObject(final AttributeDefinition attributeDefinition, String value, final boolean preserveEmptyValue) { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java index 163b67a44f..09c93ed408 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java @@ -277,44 +277,6 @@ public class ToscaExportHandler { return Either.left(toscaRepresentation); } - public Either<ToscaRepresentation, ToscaError> exportComponentInterface(final Component component, final boolean isAssociatedComponent, - final boolean isSkipImports) { - final List<Map<String, Map<String, String>>> imports = new ArrayList<>(getDefaultToscaImports(component.getModel(), isSkipImports)); - if (CollectionUtils.isEmpty(imports)) { - log.debug(FAILED_TO_GET_DEFAULT_IMPORTS_CONFIGURATION); - return Either.right(ToscaError.GENERAL_ERROR); - } - List<Triple<String, String, Component>> dependencies = new ArrayList<>(); - if (component.getDerivedFromGenericType() != null && !component.getDerivedFromGenericType() - .startsWith("org.openecomp.resource.abstract.nodes.")) { - final Either<Component, StorageOperationStatus> baseType = toscaOperationFacade - .getByToscaResourceNameAndVersion(component.getDerivedFromGenericType(), component.getDerivedFromGenericVersion(), - component.getModel()); - if (baseType.isLeft() && baseType.left().value() != null) { - addDependencies(imports, dependencies, baseType.left().value(), isSkipImports); - } else { - log.debug("Failed to fetch derived from type {}", component.getDerivedFromGenericType()); - } - } - - String toscaVersion = null; - if (component instanceof Resource) { - toscaVersion = ((Resource) component).getToscaVersion(); - } - ToscaTemplate toscaTemplate = new ToscaTemplate(toscaVersion != null ? toscaVersion : TOSCA_VERSION); - toscaTemplate.setImports(imports); - final Map<String, ToscaNodeType> nodeTypes = new HashMap<>(); - final Either<ToscaTemplate, ToscaError> toscaTemplateRes = convertInterfaceNodeType(new HashMap<>(), component, toscaTemplate, nodeTypes, - isAssociatedComponent); - if (toscaTemplateRes.isRight()) { - return Either.right(toscaTemplateRes.right().value()); - } - toscaTemplate = toscaTemplateRes.left().value(); - toscaTemplate.setDependencies(dependencies); - ToscaRepresentation toscaRepresentation = this.createToscaRepresentation(toscaTemplate); - return Either.left(toscaRepresentation); - } - private ToscaRepresentation createToscaRepresentation(ToscaTemplate toscaTemplate) { CustomRepresenter representer = new CustomRepresenter(); DumperOptions options = new DumperOptions(); @@ -342,15 +304,6 @@ public class ToscaExportHandler { return Either.left(fillImports.left().value().left); } - public Either<ToscaTemplate, ToscaError> getDependencies(Component component, boolean isSkipImports) { - ToscaTemplate toscaTemplate = new ToscaTemplate(null); - Either<ImmutablePair<ToscaTemplate, Map<String, Component>>, ToscaError> fillImports = fillImports(component, toscaTemplate, isSkipImports); - if (fillImports.isRight()) { - return Either.right(fillImports.right().value()); - } - return Either.left(fillImports.left().value().left); - } - public Either<ToscaTemplate, ToscaError> convertToToscaTemplate(final Component component, final boolean isSkipImports) { final List<Map<String, Map<String, String>>> defaultToscaImportConfig = getDefaultToscaImports(component.getModel(), isSkipImports); if (CollectionUtils.isEmpty(defaultToscaImportConfig)) { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/ToscaAnnotation.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/ToscaAnnotation.java index 5aee23ddbb..9a3253d6d8 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/ToscaAnnotation.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/ToscaAnnotation.java @@ -21,41 +21,15 @@ package org.openecomp.sdc.be.tosca.model; import java.util.HashMap; import java.util.Map; +import lombok.Getter; +import lombok.Setter; +@Getter +@Setter public class ToscaAnnotation { private String type; private Map<String, Object> properties; private String description; - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public void addProperty(String name, Object property) { - if (properties == null) { - properties = new HashMap<>(); - } - properties.put(name, property); - } - - public Map<String, Object> getProperties() { - return properties; - } - - public void setProperties(Map<String, Object> properties) { - this.properties = properties; - } } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/ToscaFilter.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/ToscaFilter.java deleted file mode 100644 index 3ff29e8df9..0000000000 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/ToscaFilter.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * - * ============LICENSE_START======================================================= - * Copyright (C) 2023 Nordix Foundation. - * ================================================================================ - * 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. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ - -package org.openecomp.sdc.be.tosca.model; - -import lombok.Data; - -@Data -public class ToscaFilter { - - private String name; - private String constraint; - private Object value; //ToscaFunction or String or float, etc I guess -} diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/ToscaGroupTemplate.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/ToscaGroupTemplate.java index c7763e6dc8..6e05cc08a5 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/ToscaGroupTemplate.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/ToscaGroupTemplate.java @@ -21,7 +21,11 @@ package org.openecomp.sdc.be.tosca.model; import java.util.List; import java.util.Map; +import lombok.AllArgsConstructor; +import lombok.Data; +@Data +@AllArgsConstructor public class ToscaGroupTemplate { private String type; @@ -30,58 +34,9 @@ public class ToscaGroupTemplate { private Map<String, Object> properties; private Map<String, ToscaTemplateCapability> capabilities; - public ToscaGroupTemplate(String type, List<String> members, IToscaMetadata metadata, Map<String, Object> properties, - Map<String, ToscaTemplateCapability> capabilities) { - this.type = type; - this.members = members; - this.metadata = metadata; - this.properties = properties; - this.capabilities = capabilities; - } - public ToscaGroupTemplate(String type, IToscaMetadata metadata, Map<String, Object> properties) { this.type = type; this.metadata = metadata; this.properties = properties; } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public List<String> getMembers() { - return members; - } - - public void setMembers(List<String> members) { - this.members = members; - } - - public IToscaMetadata getMetadata() { - return metadata; - } - - public void setMetadata(IToscaMetadata metadata) { - this.metadata = metadata; - } - - public Map<String, Object> getProperties() { - return properties; - } - - public void setProperties(Map<String, Object> properties) { - this.properties = properties; - } - - public Map<String, ToscaTemplateCapability> getCapabilities() { - return capabilities; - } - - public void setCapabilities(Map<String, ToscaTemplateCapability> capabilities) { - this.capabilities = capabilities; - } } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/ToscaInput.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/ToscaInput.java index a06f67c005..694430fa74 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/ToscaInput.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/ToscaInput.java @@ -17,32 +17,28 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.openecomp.sdc.be.tosca.model; import java.util.HashMap; import java.util.Map; +import lombok.Getter; +import lombok.Setter; +@Getter +@Setter public class ToscaInput extends ToscaProperty { private Map<String, ToscaAnnotation> annotations; - //copy constructor public ToscaInput(ToscaProperty toscaProperty) { super(toscaProperty); } - public Map<String, ToscaAnnotation> getAnnotations() { - return annotations; - } - - public void setAnnotations(Map<String, ToscaAnnotation> annotations) { - this.annotations = annotations; - } - - public void addAnnotation(String name, ToscaAnnotation annotaion) { + public void addAnnotation(String name, ToscaAnnotation annotation) { if (annotations == null) { annotations = new HashMap<>(); } - annotations.put(name, annotaion); + annotations.put(name, annotation); } } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/ToscaNodeTemplate.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/ToscaNodeTemplate.java index eb34732db9..fe0af5f1a1 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/ToscaNodeTemplate.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/model/ToscaNodeTemplate.java @@ -51,10 +51,4 @@ public class ToscaNodeTemplate { this.directives = CollectionUtils.isEmpty(directives) ? null : directives; } - public void addInterface(String interfaceName, Object interfaceDataDefinition) { - if (MapUtils.isEmpty(this.interfaces)) { - this.interfaces = new HashMap<>(); - } - this.interfaces.put(interfaceName, interfaceDataDefinition); - } } |