Interface operation feature enhancements
[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 static org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields.TOSCA_RESOURCE_NAME;
24
25 import com.fasterxml.jackson.annotation.JsonCreator;
26 import java.io.Serializable;
27 import java.util.HashMap;
28 import java.util.Map;
29 import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
30 import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
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
41     @JsonCreator
42     public InterfaceDataDefinition() {
43         super();
44         setOperations(new HashMap<>());
45     }
46
47     public InterfaceDataDefinition(InterfaceDataDefinition p) {
48         setUniqueId(p.getUniqueId());
49         setType(p.getType());
50         setDescription(p.getDescription());
51         setToscaResourceName(p.getToscaResourceName());
52         setOperations(p.getOperations());
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 String getType() {
64         return (String) getToscaPresentationValue(JsonPresentationFields.TYPE);
65     }
66
67     public void setType(String type) {
68         setToscaPresentationValue(JsonPresentationFields.TYPE, type);
69     }
70
71     public String getDescription() {
72         return (String) getToscaPresentationValue(JsonPresentationFields.DESCRIPTION);
73     }
74
75     public void setDescription(String description) {
76         setToscaPresentationValue(JsonPresentationFields.DESCRIPTION, description);
77     }
78
79     public String getToscaResourceName() {
80         return (String) getToscaPresentationValue(TOSCA_RESOURCE_NAME);
81     }
82
83     public Map<String, OperationDataDefinition> getOperations() {
84         return (Map<String, OperationDataDefinition>) getToscaPresentationValue(JsonPresentationFields.OPERATIONS);
85     }
86
87     public void setOperations(Map<String, OperationDataDefinition> operations) {
88         setToscaPresentationValue(JsonPresentationFields.OPERATIONS, operations);
89     }
90
91     public void setToscaResourceName(String toscaResourceName) {
92         setToscaPresentationValue(TOSCA_RESOURCE_NAME, toscaResourceName);
93     }
94
95     public Long getCreationDate() {
96         return (Long) getToscaPresentationValue(JsonPresentationFields.CREATION_DATE);
97     }
98
99     public void setCreationDate(Long creationDate) {
100         setToscaPresentationValue(JsonPresentationFields.CREATION_DATE, creationDate);
101     }
102
103     public Long getLastUpdateDate() {
104         return (Long) getToscaPresentationValue(JsonPresentationFields.LAST_UPDATE_DATE);
105     }
106
107     public void setLastUpdateDate(Long lastUpdateDate) {
108         setToscaPresentationValue(JsonPresentationFields.LAST_UPDATE_DATE, lastUpdateDate);
109     }
110 }