2 * Copyright © 2016-2018 European Support Limited
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package org.openecomp.sdc.tosca.datatypes.model;
19 import org.apache.commons.collections4.MapUtils;
21 import java.util.HashMap;
24 public class InterfaceDefinitionTemplate extends InterfaceDefinition {
26 private Map<String, Object> inputs;
27 private Map<String, OperationDefinitionTemplate> operations;
29 public Map<String, Object> getInputs() {
33 public void setInputs(
34 Map<String, Object> inputs) {
38 public Map<String, OperationDefinitionTemplate> getOperations() {
42 public void setOperations(
43 Map<String, OperationDefinitionTemplate> operations) {
44 this.operations = operations;
47 public void addOperation(String operationName, OperationDefinitionTemplate operation) {
48 if(MapUtils.isEmpty(this.operations)) {
49 this.operations = new HashMap<>();
52 this.operations.put(operationName, operation);
56 public boolean equals(Object o) {
60 if (!(o instanceof InterfaceDefinitionTemplate)) {
64 InterfaceDefinitionTemplate that = (InterfaceDefinitionTemplate) o;
66 if (getInputs() != null ? !getInputs().equals(that.getInputs()) : that.getInputs() != null) {
69 return getOperations() != null ? getOperations().equals(that.getOperations())
70 : that.getOperations() == null;
74 public int hashCode() {
75 int result = getInputs() != null ? getInputs().hashCode() : 0;
76 result = 31 * result + (getOperations() != null ? getOperations().hashCode() : 0);
81 public void addOperation(String operationName, OperationDefinition operationDefinition) {
82 addOperation(operationName, (OperationDefinitionTemplate)operationDefinition);