d3a6903091b579193a66f39281622ead74315c7b
[sdc.git] / common-be / src / main / java / org / openecomp / sdc / be / datatypes / elements / InterfaceDataDefinition.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.datatypes.elements;
22
23 import com.fasterxml.jackson.annotation.JsonCreator;
24 import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
25 import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
26
27 import java.io.Serializable;
28 import java.util.HashMap;
29 import java.util.Map;
30
31 import static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.TOSCA_RESOURCE_NAME;
32
33 public class InterfaceDataDefinition extends ToscaDataDefinition implements Serializable {
34
35         @JsonCreator
36         public InterfaceDataDefinition() {
37                 super();
38                 setOperations(new HashMap<>());
39         }
40
41         public InterfaceDataDefinition(String type, String description) {
42                 this();
43                 setType(type);
44                 setDescription(description);
45
46         }
47
48         public InterfaceDataDefinition(InterfaceDataDefinition p) {
49                 setUniqueId(p.getUniqueId());
50                 setType(p.getType());
51                 setDescription(p.getDescription());
52                 setToscaResourceName(p.getToscaResourceName());
53                 setOperations(p.getOperations());
54         }
55
56         public String getUniqueId() {
57                 return (String) getToscaPresentationValue(JsonPresentationFields.UNIQUE_ID);
58         }
59
60         public void setUniqueId(String uniqueId) {
61                 setToscaPresentationValue(JsonPresentationFields.UNIQUE_ID, uniqueId);
62         }
63
64         public String getType() {
65                 return (String) getToscaPresentationValue(JsonPresentationFields.TYPE);
66         }
67
68         public void setType(String type) {
69                 setToscaPresentationValue(JsonPresentationFields.TYPE, type);
70         }
71
72         public Long getCreationDate() {
73                 return (Long) getToscaPresentationValue(JsonPresentationFields.CREATION_DATE);
74         }
75
76         public void setCreationDate(Long creationDate) {
77                 setToscaPresentationValue(JsonPresentationFields.CREATION_DATE, creationDate);
78         }
79
80         public Long getLastUpdateDate() {
81                 return (Long) getToscaPresentationValue(JsonPresentationFields.LAST_UPDATE_DATE);
82         }
83
84         public void setLastUpdateDate(Long lastUpdateDate) {
85                 setToscaPresentationValue(JsonPresentationFields.LAST_UPDATE_DATE, lastUpdateDate);
86         }
87
88         public String getDescription() {
89                 return (String) getToscaPresentationValue(JsonPresentationFields.DESCRIPTION);
90         }
91
92         public void setDescription(String description) {
93                 setToscaPresentationValue(JsonPresentationFields.DESCRIPTION, description);
94         }
95
96         public  Map<String, OperationDataDefinition>  getOperations() {
97                 return (Map<String, OperationDataDefinition>)
98                                 getToscaPresentationValue(JsonPresentationFields.OPERATIONS);
99         }
100
101         public void setOperations(Map<String, OperationDataDefinition> operations) {
102                 setToscaPresentationValue(JsonPresentationFields.OPERATIONS, operations);
103         }
104
105         public String getToscaResourceName() {
106                 return (String) getToscaPresentationValue(TOSCA_RESOURCE_NAME);
107         }
108
109         public void setToscaResourceName(String toscaResourceName) {
110                 setToscaPresentationValue(TOSCA_RESOURCE_NAME, toscaResourceName);
111         }
112 }