aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authoraribeiro <anderson.ribeiro@est.tech>2020-11-17 10:52:41 +0000
committeraribeiro <anderson.ribeiro@est.tech>2020-11-17 10:52:41 +0000
commit2f74a4ac81f228bdb0bf0f509e9c0ef296d28d82 (patch)
tree78a1a00ae007885085304aa835d0e6e4868bc8b3 /common
parentba9b67ace03cd9bf1e5f275c060824ce89599b88 (diff)
Fix import VFC with attributes
Fix import VFC with default attribute value Fix Update, create and delete attribute action Make attribute definition tosca compliant Issue-ID: SDC-3381 Signed-off-by: aribeiro <anderson.ribeiro@est.tech> Change-Id: Ibbd36b105b8c86d1e750f3b6d55752d63fe6530e
Diffstat (limited to 'common')
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/AttributeDefinition.java56
1 files changed, 35 insertions, 21 deletions
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/AttributeDefinition.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/AttributeDefinition.java
index 1b72cbc030..9dfbc39880 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/AttributeDefinition.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/AttributeDefinition.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.
@@ -20,34 +20,48 @@
package org.onap.sdc.tosca.datatypes.model;
+import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Objects;
import lombok.Getter;
import lombok.Setter;
+import org.apache.commons.lang3.StringUtils;
@Getter
@Setter
public class AttributeDefinition implements Cloneable {
- private String type;
- private String description;
- private Object _default;
- private String status;
- private EntrySchema entry_schema;
+ private String type;
+ private String description;
+ @JsonProperty("default")
+ private Object _default;
+ private String status;
+ private EntrySchema entry_schema;
- public AttributeDefinition() {
- status = Status.SUPPORTED.getName();
- }
+ public AttributeDefinition() {
+ status = Status.SUPPORTED.getName();
+ }
+ public AttributeDefinition(final String type,
+ final String description,
+ final Object _default,
+ final String status,
+ final EntrySchema entry_schema) {
+ this.setType(type);
+ this.setDescription(description);
+ this.set_default(_default);
+ this.setStatus(StringUtils.isEmpty(status) ? Status.SUPPORTED.getName() : status);
+ this.setEntry_schema(entry_schema);
+ }
- @Override
- public AttributeDefinition clone() {
- AttributeDefinition attributeDefinition = new AttributeDefinition();
- attributeDefinition.setType(this.getType());
- attributeDefinition.setDescription(this.getDescription());
- attributeDefinition.set_default(this.get_default());
- attributeDefinition.setStatus(this.getStatus());
- attributeDefinition.setEntry_schema(
- Objects.isNull(this.getEntry_schema()) ? null : this.getEntry_schema().clone());
- return attributeDefinition;
- }
+ @Override
+ public AttributeDefinition clone() {
+ AttributeDefinition attributeDefinition = new AttributeDefinition();
+ attributeDefinition.setType(this.getType());
+ attributeDefinition.setDescription(this.getDescription());
+ attributeDefinition.set_default(this.get_default());
+ attributeDefinition.setStatus(this.getStatus());
+ attributeDefinition.setEntry_schema(
+ Objects.isNull(this.getEntry_schema()) ? null : this.getEntry_schema().clone());
+ return attributeDefinition;
+ }
}