af49ee0d37dcb77e07af373d0bcb37b32ddbcf05
[so.git] / packages / arquillian-unit-tests / src / test / java / org / openecomp / mso / global_tests / asdc / notif_emulator / JsonResourceInfo.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
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.mso.global_tests.asdc.notif_emulator;
22
23 import java.util.HashMap;
24 import java.util.List;
25 import java.util.Map;
26
27 import org.codehaus.jackson.annotate.JsonAnySetter;
28 import org.codehaus.jackson.annotate.JsonIgnore;
29 import org.codehaus.jackson.annotate.JsonProperty;
30 import org.codehaus.jackson.map.annotate.JsonDeserialize;
31
32 import org.openecomp.sdc.api.notification.IArtifactInfo;
33 import org.openecomp.sdc.api.notification.IResourceInstance;
34
35 public class JsonResourceInfo implements IResourceInstance {
36
37         @JsonIgnore
38         private Map<String,Object> attributesMap = new HashMap<>();
39
40         @JsonProperty("artifacts")
41         @JsonDeserialize(using=JsonArtifactInfoDeserializer.class)
42         private List<IArtifactInfo> artifacts;
43
44         public JsonResourceInfo() {
45
46         }
47
48         @Override
49         public List<IArtifactInfo> getArtifacts() {
50                 return artifacts;
51         }
52
53         @Override
54         public String getResourceInstanceName() {
55                 return (String)attributesMap.get("resourceInstanceName");
56         }
57
58         @Override
59         public String getResourceInvariantUUID() {
60                 return (String)attributesMap.get("resourceInvariantUUID");
61         }
62
63         @Override
64         public String getResourceName() {
65                 return (String)attributesMap.get("resourceName");
66         }
67
68         @Override
69         public String getResourceType() {
70                 return (String)attributesMap.get("resourceType");
71         }
72
73         @Override
74         public String getResourceUUID() {
75                 return (String)attributesMap.get("resourceUUID");
76         }
77
78         @Override
79         public String getResourceVersion() {
80                 return (String)attributesMap.get("resourceVersion");
81         }
82
83         @Override
84         public String getResourceCustomizationUUID() {
85                 return (String)attributesMap.get("resourceCustomizationUUID");
86         }
87
88         @Override
89         public String getSubcategory() {
90                 return (String)attributesMap.get("subCategory");
91         }
92
93         @Override
94         public String getCategory() {
95                 return (String)attributesMap.get("category");
96         }
97
98         @SuppressWarnings("unused")
99         @JsonAnySetter
100         public final void setAttribute(String attrName, Object attrValue) {
101                 if ((null != attrName) && (!attrName.isEmpty()) && (null != attrValue) && (null != attrValue.toString())) {
102                         this.attributesMap.put(attrName,attrValue);
103                 }
104         }
105 }