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;
23 import java.util.Objects;
25 public class InterfaceDefinitionTemplate extends InterfaceDefinition {
27 private Map<String, Object> inputs;
28 private Map<String, OperationDefinitionTemplate> operations;
30 public Map<String, Object> getInputs() {
34 public void setInputs(
35 Map<String, Object> inputs) {
39 public Map<String, OperationDefinitionTemplate> getOperations() {
43 public void addOperation(String operationName, OperationDefinitionTemplate operation) {
44 if(MapUtils.isEmpty(this.operations)) {
45 this.operations = new HashMap<>();
48 this.operations.put(operationName, operation);
52 public boolean equals(Object o) {
56 if (!(o instanceof InterfaceDefinitionTemplate)) {
59 InterfaceDefinitionTemplate that = (InterfaceDefinitionTemplate) o;
60 return Objects.equals(inputs, that.inputs) &&
61 Objects.equals(operations, that.operations);
65 public int hashCode() {
67 return Objects.hash(inputs, operations);
71 public void addOperation(String operationName, OperationDefinition operationDefinition) {
72 addOperation(operationName, (OperationDefinitionTemplate)operationDefinition);