ActivitySpec - Correcting logger messages
[sdc.git] / common / openecomp-tosca-datatype / src / main / java / org / openecomp / sdc / tosca / datatypes / model / InterfaceType.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.openecomp.sdc.tosca.datatypes.model;
22
23 import org.apache.commons.collections4.MapUtils;
24
25 import java.util.HashMap;
26 import java.util.Map;
27 import java.util.Objects;
28
29 public class InterfaceType {
30   private String derived_from;
31   private String version;
32   private Map<String, String> metadata;
33   private String description;
34   private Map<String, PropertyDefinition> inputs;
35   private Map<String, OperationDefinition> operations;
36
37   public Map<String, PropertyDefinition> getInputs() {
38     return inputs;
39   }
40
41   public void setInputs(
42       Map<String, PropertyDefinition> inputs) {
43     this.inputs = inputs;
44   }
45
46   public String getDerived_from() {
47     return derived_from;
48   }
49
50   public void setDerived_from(String derived_from) {
51     this.derived_from = derived_from;
52   }
53
54   public String getVersion() {
55     return version;
56   }
57
58   public void setVersion(String version) {
59     this.version = version;
60   }
61
62   public Map<String, String> getMetadata() {
63     return metadata;
64   }
65
66   public void setMetadata(Map<String, String> metadata) {
67     this.metadata = metadata;
68   }
69
70   public String getDescription() {
71     return description;
72   }
73
74   public void setDescription(String description) {
75     this.description = description;
76   }
77
78   public Map<String, OperationDefinition> getOperations() {
79     return operations;
80   }
81
82   public void setOperations(
83       Map<String, OperationDefinition> operations) {
84     this.operations = operations;
85   }
86
87   public void addOperation(String operationName, OperationDefinition operationDefinition) {
88     if(MapUtils.isEmpty(this.operations)){
89       this.operations = new HashMap<>();
90     }
91     this.operations.put(operationName, operationDefinition);
92   }
93
94   @Override
95   public boolean equals(Object o) {
96     if (this == o) {
97       return true;
98     }
99     if (!(o instanceof InterfaceType)) {
100       return false;
101     }
102     InterfaceType that = (InterfaceType) o;
103     return Objects.equals(derived_from, that.derived_from) &&
104         Objects.equals(version, that.version) &&
105         Objects.equals(metadata, that.metadata) &&
106         Objects.equals(description, that.description) &&
107         Objects.equals(inputs, that.inputs) &&
108         Objects.equals(operations, that.operations);
109   }
110
111   @Override
112   public int hashCode() {
113
114     return Objects.hash(derived_from, version, metadata, description, inputs, operations);
115   }
116 }