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