Replace jackson usages with GSON
[clamp.git] / src / main / java / org / onap / clamp / clds / model / properties / Global.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP CLAMP
4  * ================================================================================
5  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights
6  *                             reserved.
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END============================================
20  * ===================================================================
21  * 
22  */
23
24 package org.onap.clamp.clds.model.properties;
25
26 import com.att.eelf.configuration.EELFLogger;
27 import com.att.eelf.configuration.EELFManager;
28
29 import com.google.gson.JsonElement;
30 import com.google.gson.JsonObject;
31 import java.util.List;
32 import org.onap.clamp.clds.util.JsonUtils;
33
34 /**
35  * Parse global json properties.
36  * <p>
37  * Example json:
38  * "global":[{"name":"service","value":["vUSP"]},{"name":"vnf","value":["vCTS",
39  * "v3CDB"]},{"name":"location","value":["san_diego","san_antonio","kansas_city"
40  * ,"kings_mountain","Secaucus","lisle","concord","houston","akron"]}]
41  */
42 public class Global {
43
44     protected static final EELFLogger logger = EELFManager.getInstance().getLogger(Global.class);
45     protected static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger();
46     private String service;
47     private String actionSet;
48     private List<String> resourceVf;
49     private List<String> resourceVfc;
50     private JsonObject deployParameters;
51     private List<String> location;
52     private String vnfScope;
53
54     /**
55      * Parse global given json node.
56      *
57      * @param modelJson
58      */
59     public Global(JsonObject modelJson) {
60         JsonElement globalNode = modelJson.get("global");
61         service = JsonUtils.getStringValueByName(globalNode, "service");
62         actionSet = JsonUtils.getStringValueByName(globalNode, "actionSet");
63         resourceVf = JsonUtils.getStringValuesByName(globalNode, "vf");
64         resourceVfc = JsonUtils.getStringValuesByName(globalNode, "vfc");
65         deployParameters = JsonUtils.getJsonObjectByName(globalNode, "deployParameters");
66         location = JsonUtils.getStringValuesByName(globalNode, "location");
67         vnfScope = JsonUtils.getStringValueByName(globalNode, "vnf");
68     }
69
70     /**
71      * @return the service
72      */
73     public String getService() {
74         return service;
75     }
76
77     /**
78      * @param service
79      *            the service to set
80      */
81     public void setService(String service) {
82         this.service = service;
83     }
84
85     /**
86      * @return the actionSet
87      */
88     public String getActionSet() {
89         return actionSet;
90     }
91
92     public void setActionSet(String actionSet) {
93         this.actionSet = actionSet;
94     }
95
96     /**
97      * @return the resourceVf
98      */
99     public List<String> getResourceVf() {
100         return resourceVf;
101     }
102
103     /**
104      * @param resourceVf
105      *            the resourceVf to set
106      */
107     public void setResourceVf(List<String> resourceVf) {
108         this.resourceVf = resourceVf;
109     }
110
111     /**
112      * @return the resourceVfc
113      */
114     public List<String> getResourceVfc() {
115         return resourceVfc;
116     }
117
118     /**
119      * @param resourceVfc
120      *            the resourceVfc to set
121      */
122     public void setResourceVfc(List<String> resourceVfc) {
123         this.resourceVfc = resourceVfc;
124     }
125
126     /**
127      * @return the location
128      */
129     public List<String> getLocation() {
130         return location;
131     }
132
133     /**
134      * @param location
135      *            the location to set
136      */
137     public void setLocation(List<String> location) {
138         this.location = location;
139     }
140
141     public JsonObject getDeployParameters() {
142         return deployParameters;
143     }
144
145     public void setDeployParameters(JsonObject deployParameters) {
146         this.deployParameters = deployParameters;
147     }
148
149     public String getVnfScope() {
150         return vnfScope;
151     }
152
153 }