a0b2143a5fc5e25ea74e1cd6aba1ddaa8cfc0525
[sdc.git] / common-be / src / main / java / org / openecomp / sdc / be / datatypes / enums / JsonPresentationFieldsExtractor.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  * Modifications copyright (c) 2019 Nokia
20  * ================================================================================
21  */
22 package org.openecomp.sdc.be.datatypes.enums;
23
24 import java.util.List;
25 import java.util.Map;
26 import lombok.AllArgsConstructor;
27 import lombok.Getter;
28
29 @Getter
30 @AllArgsConstructor
31 public class JsonPresentationFieldsExtractor {
32
33     private final Map<String, Object> properties;
34
35     public String getUniqueId() {
36         return (String) properties.get(JsonPresentationFields.UNIQUE_ID.getPresentation());
37     }
38
39     public String getName() {
40         return (String) properties.get(JsonPresentationFields.NAME.getPresentation());
41     }
42
43     public String getVersion() {
44         return (String) properties.get(JsonPresentationFields.VERSION.getPresentation());
45     }
46
47     public Boolean isHighestVersion() {
48         return (Boolean) properties.get(JsonPresentationFields.HIGHEST_VERSION.getPresentation());
49     }
50
51     public Long getCreationDate() {
52         return (Long) properties.get(JsonPresentationFields.CREATION_DATE.getPresentation());
53     }
54
55     public Long getLastUpdateDate() {
56         return (Long) properties.get(JsonPresentationFields.LAST_UPDATE_DATE.getPresentation());
57     }
58
59     public String getDescription() {
60         return (String) properties.get(JsonPresentationFields.DESCRIPTION.getPresentation());
61     }
62
63     public String getState() {
64         return (String) properties.get(JsonPresentationFields.LIFECYCLE_STATE.getPresentation());
65     }
66
67     @SuppressWarnings("unchecked")
68     public List<String> getTags() {
69         return (List<String>) properties.get(JsonPresentationFields.TAGS.getPresentation());
70     }
71
72     public String getIcon() {
73         return (String) properties.get(JsonPresentationFields.ICON.getPresentation());
74     }
75
76     public String getContactId() {
77         return (String) properties.get(JsonPresentationFields.CONTACT_ID.getPresentation());
78     }
79
80     public String getUUID() {
81         return (String) properties.get(JsonPresentationFields.UUID.getPresentation());
82     }
83
84     public String getNormalizedName() {
85         return (String) properties.get(JsonPresentationFields.NORMALIZED_NAME.getPresentation());
86     }
87
88     public String getSystemName() {
89         return (String) properties.get(JsonPresentationFields.SYSTEM_NAME.getPresentation());
90     }
91
92     public Boolean isDeleted() {
93         return (Boolean) properties.get(JsonPresentationFields.IS_DELETED.getPresentation());
94     }
95
96     public String getProjectCode() {
97         return (String) properties.get(JsonPresentationFields.PROJECT_CODE.getPresentation());
98     }
99
100     public String getCsarUuid() {
101         return (String) properties.get(JsonPresentationFields.CSAR_UUID.getPresentation());
102     }
103
104     public String getCsarVersion() {
105         return (String) properties.get(JsonPresentationFields.CSAR_VERSION.getPresentation());
106     }
107
108     public String getCsarVersionId() {
109         return (String) properties.get(JsonPresentationFields.CSAR_VERSION_ID.getPresentation());
110     }
111
112     public String getImportedToscaChecksum() {
113         return (String) properties.get(JsonPresentationFields.IMPORTED_TOSCA_CHECKSUM.getPresentation());
114     }
115
116     public String getInvariantUuid() {
117         return (String) properties.get(JsonPresentationFields.INVARIANT_UUID.getPresentation());
118     }
119
120     public Boolean isArchived() {
121         return (Boolean) properties.get(JsonPresentationFields.IS_ARCHIVED.getPresentation());
122     }
123
124     public Boolean isVspArchived() {
125         return (Boolean) properties.get(JsonPresentationFields.IS_VSP_ARCHIVED.getPresentation());
126     }
127
128     public Long getArchiveTime() {
129         Object archiveTimeObject = properties.get(JsonPresentationFields.ARCHIVE_TIME.getPresentation());
130         if (archiveTimeObject instanceof Integer) {
131             return Long.valueOf((Integer) archiveTimeObject);
132         } else {
133             return (Long) archiveTimeObject;
134         }
135     }
136
137     public String getVendorName() {
138         return (String) properties.get(JsonPresentationFields.VENDOR_NAME.getPresentation());
139     }
140
141     public String getVendorRelease() {
142         return (String) properties.get(JsonPresentationFields.VENDOR_RELEASE.getPresentation());
143     }
144
145     public String getResourceVendorModelNumber() {
146         return (String) properties.get(JsonPresentationFields.RESOURCE_VENDOR_MODEL_NUMBER.getPresentation());
147     }
148
149     public Boolean isAbstract() {
150         return (Boolean) properties.get(JsonPresentationFields.IS_ABSTRACT.getPresentation());
151     }
152
153     public ResourceTypeEnum getResourceType() {
154         return ResourceTypeEnum.valueOf((String) properties.get(JsonPresentationFields.RESOURCE_TYPE.getPresentation()));
155     }
156
157     public String getToscaResourceName() {
158         return (String) properties.get(JsonPresentationFields.TOSCA_RESOURCE_NAME.getPresentation());
159     }
160
161     public String getServiceType() {
162         return (String) properties.get(JsonPresentationFields.SERVICE_TYPE.getPresentation());
163     }
164
165     public String getServiceRole() {
166         return (String) properties.get(JsonPresentationFields.SERVICE_ROLE.getPresentation());
167     }
168
169     public String getServiceFunction() {
170         return (String) properties.get(JsonPresentationFields.SERVICE_FUNCTION.getPresentation());
171     }
172
173     public String getModel() {
174         return (String) properties.get(JsonPresentationFields.MODEL.getPresentation());
175     }
176 }