From 09c6320df7f768e42edeaedd7ba69e6fb13d433d Mon Sep 17 00:00:00 2001 From: shiria Date: Mon, 4 Jun 2018 11:07:29 +0300 Subject: fix get flat node type update node type interface update return value to object which include the type hierarchy Change-Id: I97623c7bbad0223a174370d13aabf4c3efe9c21e Issue-ID: SDC-1394 Signed-off-by: shiria --- .../tosca/datatypes/model/InterfaceDefinition.java | 7 +- .../datatypes/model/InterfaceDefinitionType.java | 121 ++++++++++----------- .../main/resources/globalTypes/tosca/groups.yml | 2 +- 3 files changed, 62 insertions(+), 68 deletions(-) (limited to 'common') diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinition.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinition.java index 28e871a454..053f0b33ec 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinition.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinition.java @@ -13,13 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.onap.sdc.tosca.datatypes.model; -import java.util.Map; +package org.onap.sdc.tosca.datatypes.model; public abstract class InterfaceDefinition { - protected Map operations; - - public abstract void addOperation(String operationName, OperationDefinition operationDefinition); + public abstract void addOperation(String operationName, OperationDefinition operationDefinition); } diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinitionType.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinitionType.java index 800786c1af..a8207ba828 100644 --- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinitionType.java +++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinitionType.java @@ -24,75 +24,72 @@ import java.util.Map; public class InterfaceDefinitionType extends InterfaceDefinition { - private String type; - private Map inputs; - protected Map operations; - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public Map getInputs() { - return inputs; - } - - public void setInputs( - Map inputs) { - this.inputs = inputs; - } - - public Map getOperations() { - return operations; - } - - public void setOperations( - Map operations) { - this.operations = operations; - } - - public void addOperation(String operationName, OperationDefinitionType operation) { - if(MapUtils.isEmpty(this.operations)) { - this.operations = new HashMap<>(); + private String type; + private Map inputs; + private Map operations; + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public Map getInputs() { + return inputs; + } + + public void setInputs(Map inputs) { + this.inputs = inputs; } - this.operations.put(operationName, operation); - } + public Map getOperations() { + return operations; + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + public void setOperations(Map operations) { + this.operations = operations; } - if (!(o instanceof InterfaceDefinitionType)) { - return false; + + public void addOperation(String operationName, OperationDefinitionType operation) { + if (MapUtils.isEmpty(this.operations)) { + this.operations = new HashMap<>(); + } + + this.operations.put(operationName, operation); } - InterfaceDefinitionType that = (InterfaceDefinitionType) o; + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof InterfaceDefinitionType)) { + return false; + } + + InterfaceDefinitionType that = (InterfaceDefinitionType) o; + + if (getType() != null ? !getType().equals(that.getType()) : that.getType() != null) { + return false; + } + if (getInputs() != null ? !getInputs().equals(that.getInputs()) : that.getInputs() != null) { + return false; + } + return getOperations() != null ? getOperations().equals(that.getOperations()) : that.getOperations() == null; + } - if (getType() != null ? !getType().equals(that.getType()) : that.getType() != null) { - return false; + @Override + public int hashCode() { + int result = getType() != null ? getType().hashCode() : 0; + result = 31 * result + (getInputs() != null ? getInputs().hashCode() : 0); + result = 31 * result + (getOperations() != null ? getOperations().hashCode() : 0); + return result; } - if (getInputs() != null ? !getInputs().equals(that.getInputs()) : that.getInputs() != null) { - return false; + + @Override + public void addOperation(String operationName, OperationDefinition operationDefinition) { + addOperation(operationName, (OperationDefinitionType) operationDefinition); } - return getOperations() != null ? getOperations().equals(that.getOperations()) - : that.getOperations() == null; - } - - @Override - public int hashCode() { - int result = getType() != null ? getType().hashCode() : 0; - result = 31 * result + (getInputs() != null ? getInputs().hashCode() : 0); - result = 31 * result + (getOperations() != null ? getOperations().hashCode() : 0); - return result; - } - - @Override - public void addOperation(String operationName, OperationDefinition operationDefinition) { - addOperation(operationName, (OperationDefinitionType)operationDefinition); - } } diff --git a/common/onap-tosca-datatype/src/main/resources/globalTypes/tosca/groups.yml b/common/onap-tosca-datatype/src/main/resources/globalTypes/tosca/groups.yml index 0ddc15175c..907a9b8c22 100644 --- a/common/onap-tosca-datatype/src/main/resources/globalTypes/tosca/groups.yml +++ b/common/onap-tosca-datatype/src/main/resources/globalTypes/tosca/groups.yml @@ -26,5 +26,5 @@ group_types: tosca.groups.Root: description: This is the default (root) TOSCA Group Type definition that all other TOSCA base Group Types derive from. interfaces: - standard: + Standard: type: tosca.interfaces.node.lifecycle.Standard -- cgit 1.2.3-korg