diff options
author | aribeiro <anderson.ribeiro@est.tech> | 2020-11-17 10:52:41 +0000 |
---|---|---|
committer | S�bastien Determe <sebastien.determe@intl.att.com> | 2020-11-17 16:01:54 +0000 |
commit | 5eb632de67f90a92e3032f97da1dcc25d53e8110 (patch) | |
tree | d1b504d09cb517dd614c344f83a21a68f771c882 /common/onap-tosca-datatype/src | |
parent | 8adf8aa4772b282133e053a21fc8de65973d37e5 (diff) |
Fix import VFC with attributes1.7.3
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
(cherry picked from commit 2f74a4ac81f228bdb0bf0f509e9c0ef296d28d82)
Diffstat (limited to 'common/onap-tosca-datatype/src')
-rw-r--r-- | common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/AttributeDefinition.java | 56 |
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; + } } |