5430c37f80272816ece836ea230d51b6f47b85e9
[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 package org.openecomp.sdc.be.datatypes.elements;
17
18 import java.io.Serializable;
19 import java.util.HashMap;
20 import java.util.Map;
21 import java.util.Objects;
22 import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
23 import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
24
25 public class InterfaceInstanceDataDefinition extends ToscaDataDefinition implements Serializable {
26
27     public InterfaceInstanceDataDefinition(InterfaceInstanceDataDefinition inter) {
28         this.toscaPresentation = null;
29         setInputs(inter.getInputs() == null ? new HashMap<String, Object>() : new HashMap<>(inter.getInputs()));
30         setOperations(new HashMap<>(inter.getOperations()));
31     }
32
33     public InterfaceInstanceDataDefinition() {
34         this.toscaPresentation = null;
35     }
36
37     public Map<String, Object> getInputs() {
38         return (Map<String, Object>) getToscaPresentationValue(JsonPresentationFields.INPUTS);
39     }
40
41     public void setInputs(Map<String, Object> inputs) {
42         setToscaPresentationValue(JsonPresentationFields.INPUTS, inputs);
43     }
44
45     public Map<String, OperationInstance> getOperations() {
46         return (Map<String, OperationInstance>) getToscaPresentationValue(JsonPresentationFields.OPERATIONS);
47     }
48
49     public void setOperations(Map<String, OperationInstance> operations) {
50         setToscaPresentationValue(JsonPresentationFields.OPERATIONS, operations);
51     }
52
53     @Override
54     public boolean equals(Object o) {
55         if (this == o) {
56             return true;
57         }
58         if (!(o instanceof InterfaceInstanceDataDefinition)) {
59             return false;
60         }
61         InterfaceInstanceDataDefinition that = (InterfaceInstanceDataDefinition) o;
62         return Objects.equals(this.getInputs(), that.getInputs());
63     }
64
65     @Override
66     public int hashCode() {
67         return Objects.hash(this.getInputs());
68     }
69 }