Merge "[1707-OS] Updated license text according to the"
[sdc.git] / catalog-model / src / main / java / org / openecomp / sdc / be / model / InterfaceDefinition.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.be.model;
22
23 import java.io.Serializable;
24 import java.util.HashMap;
25 import java.util.Map;
26 import java.util.stream.Collectors;
27
28 import org.codehaus.jackson.annotate.JsonIgnore;
29 import org.openecomp.sdc.be.datatypes.elements.AdditionalInfoParameterDataDefinition;
30 import org.openecomp.sdc.be.datatypes.elements.InterfaceDataDefinition;
31 import org.openecomp.sdc.be.datatypes.elements.OperationDataDefinition;
32
33 /**
34  * Definition of the operations that can be performed on (instances of) a Node
35  * Type.
36  * 
37  * @author esofer
38  */
39 public class InterfaceDefinition extends InterfaceDataDefinition implements IOperationParameter, Serializable {
40
41         /**
42          * 
43          */
44         private static final long serialVersionUID = 8220887972866354746L;
45
46         
47
48         private boolean definition;
49
50         public InterfaceDefinition() {
51                 super();
52         }
53
54         public InterfaceDefinition(String type, String description, Map<String, Operation> operations) {
55                 super(type, description);
56                 setOperationsMap(operations);
57         }
58
59         public InterfaceDefinition(InterfaceDataDefinition p) {
60                 super(p);
61         }
62
63         @Override
64         public boolean isDefinition() {
65                 // TODO Auto-generated method stub
66                 return false;
67         }
68
69         public void setDefinition(boolean definition) {
70                 this.definition = definition;
71         }
72         @JsonIgnore
73         public Map<String, Operation> getOperationsMap() {
74                 Map<String, Operation> convertedOperation = getOperations().entrySet().stream().collect(Collectors.toMap(e -> e.getKey(), e -> new Operation(e.getValue())));
75                 return convertedOperation;
76         }
77         @JsonIgnore
78         public void setOperationsMap(Map<String, Operation> operations) {
79                 Map<String, OperationDataDefinition> convertedOperation = operations.entrySet().stream().collect(Collectors.toMap(e -> e.getKey(), e -> new OperationDataDefinition(e.getValue())));
80                 setOperations(convertedOperation);
81         }
82
83         @Override
84         public String toString() {
85                 return "InterfaceDefinition [definition=" + definition + "]";
86         }
87
88 }