diff options
author | andre.schmid <andre.schmid@est.tech> | 2022-06-15 15:30:40 +0100 |
---|---|---|
committer | Michael Morris <michael.morris@est.tech> | 2022-06-22 20:36:22 +0000 |
commit | 7a7b13726c195e2944ccc59e4d5c5ade57318763 (patch) | |
tree | c22384a2abfc24adeb1c69a3696cda15c8e37548 /catalog-model/src | |
parent | fbab79aeaccf74385c9a55b697a1055a86bdf171 (diff) |
Support TOSCA get_attribute function
Adds support to TOSCA get_attribute function in the Property Assignment
TOSCA Function modal.
Change-Id: I73dda215a7c9d7fecf0803cc259634279c3bdfb6
Issue-ID: SDC-4053
Signed-off-by: andre.schmid <andre.schmid@est.tech>
Diffstat (limited to 'catalog-model/src')
3 files changed, 44 insertions, 2 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 d1bcedc8ea..be9bee0d53 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 @@ -21,9 +21,10 @@ package org.openecomp.sdc.be.model; import lombok.NoArgsConstructor; import org.openecomp.sdc.be.datatypes.elements.AttributeDataDefinition; +import org.openecomp.sdc.be.datatypes.elements.SchemaDefinition; @NoArgsConstructor -public class AttributeDefinition extends AttributeDataDefinition implements IOperationParameter, IComplexDefaultValue { +public class AttributeDefinition extends AttributeDataDefinition implements IOperationParameter, IComplexDefaultValue, ToscaPropertyData { public AttributeDefinition(final AttributeDataDefinition attributeDataDefinition) { super(attributeDataDefinition); @@ -49,4 +50,14 @@ public class AttributeDefinition extends AttributeDataDefinition implements IOpe return "AttributeDefinition{" + "name=" + getName() + "uniqueId=" + getUniqueId() + "ownerId=" + getOwnerId() + "type=" + getType() + "description=" + getDescription() + "default=" + getDefaultValue() + '}'; } + + @Override + public String getSchemaType() { + final SchemaDefinition schema = getSchema(); + if (schema == null || schema.getProperty() == null) { + return null; + } + return schema.getProperty().getType(); + } + } diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/PropertyDefinition.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/PropertyDefinition.java index 6e313eda6c..d9add3f425 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/PropertyDefinition.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/PropertyDefinition.java @@ -31,7 +31,7 @@ import org.apache.commons.collections.CollectionUtils; import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import org.openecomp.sdc.be.model.operations.impl.PropertyOperation; -public class PropertyDefinition extends PropertyDataDefinition implements IOperationParameter, IComplexDefaultValue { +public class PropertyDefinition extends PropertyDataDefinition implements IOperationParameter, IComplexDefaultValue, ToscaPropertyData { private List<PropertyConstraint> constraints; diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/ToscaPropertyData.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/ToscaPropertyData.java new file mode 100644 index 0000000000..14c95757c7 --- /dev/null +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/ToscaPropertyData.java @@ -0,0 +1,31 @@ +/* + * - + * ============LICENSE_START======================================================= + * Copyright (C) 2022 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.model; + +/** + * Represents basic/common TOSCA Property, Attribute or Input methods + */ +public interface ToscaPropertyData { + String getUniqueId(); + String getType(); + String getSchemaType(); +} |