diff options
author | Talio <tali.orenbach@amdocs.com> | 2019-02-05 11:05:05 +0200 |
---|---|---|
committer | Oren Kleks <orenkle@amdocs.com> | 2019-02-05 10:53:18 +0000 |
commit | 1468fdc4558bb82c025a05b03d1511018d8fd835 (patch) | |
tree | 0b23554bb275284c563226cdc97156527a0dc89e /common-be/src | |
parent | 16154c33f9bb86affa9ad235fd7139ba79da731f (diff) |
fix review comments on property assignment
Change-Id: Ia986294cb552f4e26b3ebf1d1b50c9b7941553ab
Issue-ID: SDC-2097
Signed-off-by: Talio <tali.orenbach@amdocs.com>
Diffstat (limited to 'common-be/src')
2 files changed, 13 insertions, 19 deletions
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceInstanceDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceInstanceDataDefinition.java index 29859cb279..113a6f4ed4 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceInstanceDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/InterfaceInstanceDataDefinition.java @@ -16,7 +16,7 @@ package org.openecomp.sdc.be.datatypes.elements; -import org.apache.commons.collections.MapUtils; +import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; import java.io.Serializable; @@ -25,14 +25,12 @@ import java.util.Map; import java.util.Objects; public class InterfaceInstanceDataDefinition extends ToscaDataDefinition implements Serializable { - protected Map<String, Object> inputs; - protected Map<String, OperationInstance> operations; public InterfaceInstanceDataDefinition( InterfaceInstanceDataDefinition inter) { this.toscaPresentation = null; - this.inputs = inter.inputs == null? new HashMap():new HashMap<>(inter.inputs); - this.operations = new HashMap<>(inter.operations); + setInputs(inter.getInputs() == null? new HashMap():new HashMap<>(inter.getInputs())); + setOperations(new HashMap<>(inter.getOperations())); } public InterfaceInstanceDataDefinition(){ @@ -40,24 +38,19 @@ public class InterfaceInstanceDataDefinition extends ToscaDataDefinition impleme } public Map<String, Object> getInputs() { - return this.inputs; + return (Map<String, Object>)getToscaPresentationValue(JsonPresentationFields.INPUTS); } - public void setInputs( - Map<String, Object> inputs) { - this.inputs = inputs; + public void setInputs(Map<String, Object> inputs) { + setToscaPresentationValue(JsonPresentationFields.INPUTS, inputs); } public Map<String, OperationInstance> getOperations() { - return operations; + return (Map<String, OperationInstance>)getToscaPresentationValue(JsonPresentationFields.OPERATIONS); } - public void addInstanceOperation(String operationName, OperationInstance operation) { - if(MapUtils.isEmpty(this.operations)) { - this.operations = new HashMap<>(); - } - - this.operations.put(operationName, operation); + public void setOperations(Map<String, OperationInstance> operations) { + setToscaPresentationValue(JsonPresentationFields.OPERATIONS, operations); } @Override @@ -69,13 +62,13 @@ public class InterfaceInstanceDataDefinition extends ToscaDataDefinition impleme return false; } InterfaceInstanceDataDefinition that = (InterfaceInstanceDataDefinition) o; - return Objects.equals(inputs, that.inputs); + return Objects.equals(this.getInputs(), that.getInputs()); } @Override public int hashCode() { - return Objects.hash(inputs); + return Objects.hash(this.getInputs()); } } diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java index 6829c72cb4..4d39ec1355 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/JsonPresentationFields.java @@ -227,7 +227,8 @@ public enum JsonPresentationFields { OPERATIONS("operations", null), OPERATION_IMPLEMENTATION("implementation",null), OPERATION_INPUTS("inputs",null), - OPERATION_OUTPUTS("outputs", null); + OPERATION_OUTPUTS("outputs", null), + INPUTS("inputs", null); private String presentation; private GraphPropertyEnum storedAs; |