42a7dbafe730ab61702e9f3cf139a75f1abe744a
[sdc.git] /
1 /*
2  * Copyright © 2016-2018 European Support Limited
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package org.openecomp.sdc.be.datatypes.elements;
18
19 import java.io.Serializable;
20 import java.util.HashMap;
21 import java.util.Map;
22 import java.util.Objects;
23 import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
24 import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
25
26 public class InterfaceInstanceDataDefinition extends ToscaDataDefinition implements Serializable {
27
28     public InterfaceInstanceDataDefinition(
29         InterfaceInstanceDataDefinition inter) {
30         this.toscaPresentation = null;
31         setInputs(inter.getInputs() == null ? new HashMap<String, Object>() : new HashMap<>(inter.getInputs()));
32         setOperations(new HashMap<>(inter.getOperations()));
33     }
34
35     public InterfaceInstanceDataDefinition() {
36         this.toscaPresentation = null;
37     }
38
39     public Map<String, Object> getInputs() {
40         return (Map<String, Object>) getToscaPresentationValue(JsonPresentationFields.INPUTS);
41     }
42
43     public void setInputs(Map<String, Object> inputs) {
44         setToscaPresentationValue(JsonPresentationFields.INPUTS, inputs);
45     }
46
47     public Map<String, OperationInstance> getOperations() {
48         return (Map<String, OperationInstance>) getToscaPresentationValue(JsonPresentationFields.OPERATIONS);
49     }
50
51     public void setOperations(Map<String, OperationInstance> operations) {
52         setToscaPresentationValue(JsonPresentationFields.OPERATIONS, operations);
53     }
54
55     @Override
56     public boolean equals(Object o) {
57         if (this == o) {
58             return true;
59         }
60         if (!(o instanceof InterfaceInstanceDataDefinition)) {
61             return false;
62         }
63         InterfaceInstanceDataDefinition that = (InterfaceInstanceDataDefinition) o;
64         return Objects.equals(this.getInputs(), that.getInputs());
65     }
66
67     @Override
68     public int hashCode() {
69
70         return Objects.hash(this.getInputs());
71     }
72
73 }