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