Fix interface types creation
[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     public InterfaceDataDefinition(String type, String description) {
36         this();
37         setType(type);
38         setDescription(description);
39
40     }
41
42     @JsonCreator
43     public InterfaceDataDefinition() {
44         super();
45         setOperations(new HashMap<>());
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 String getDescription() {
73         return (String) getToscaPresentationValue(JsonPresentationFields.DESCRIPTION);
74     }
75
76     public void setDescription(String description) {
77         setToscaPresentationValue(JsonPresentationFields.DESCRIPTION, description);
78     }
79
80     public String getDerivedFrom() {
81         return (String) getToscaPresentationValue(JsonPresentationFields.DERIVED_FROM);
82     }
83
84     public void setDerivedFrom(final String derivedFrom) {
85         setToscaPresentationValue(JsonPresentationFields.DERIVED_FROM, derivedFrom);
86     }
87
88     public void setVersion(final String version) {
89         setToscaPresentationValue(JsonPresentationFields.VERSION, version);
90     }
91
92     public String getToscaResourceName() {
93         return (String) getToscaPresentationValue(TOSCA_RESOURCE_NAME);
94     }
95
96     public Map<String, OperationDataDefinition> getOperations() {
97         return (Map<String, OperationDataDefinition>) getToscaPresentationValue(JsonPresentationFields.OPERATIONS);
98     }
99
100     public void setOperations(Map<String, OperationDataDefinition> operations) {
101         setToscaPresentationValue(JsonPresentationFields.OPERATIONS, operations);
102     }
103
104     public void setToscaResourceName(String toscaResourceName) {
105         setToscaPresentationValue(TOSCA_RESOURCE_NAME, toscaResourceName);
106     }
107
108     public Long getCreationDate() {
109         return (Long) getToscaPresentationValue(JsonPresentationFields.CREATION_DATE);
110     }
111
112     public void setCreationDate(Long creationDate) {
113         setToscaPresentationValue(JsonPresentationFields.CREATION_DATE, creationDate);
114     }
115
116     public Long getLastUpdateDate() {
117         return (Long) getToscaPresentationValue(JsonPresentationFields.LAST_UPDATE_DATE);
118     }
119
120     public void setLastUpdateDate(Long lastUpdateDate) {
121         setToscaPresentationValue(JsonPresentationFields.LAST_UPDATE_DATE, lastUpdateDate);
122     }
123 }