[CLAMP-1] Initial ONAP CLAMP seed code commit
[clamp.git] / src / main / java / org / onap / clamp / clds / model / prop / Global.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP CLAMP
4  * ================================================================================
5  * Copyright (C) 2017 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  * ECOMP is a trademark and service mark of AT&T Intellectual Property.
22  */
23
24 package org.onap.clamp.clds.model.prop;
25
26 import com.fasterxml.jackson.databind.JsonNode;
27
28 import java.util.List;
29 import java.util.logging.Logger;
30
31 /**
32  * Parse global json properties.
33  * <p>
34  * Example json: "global":[{"name":"service","value":["vUSP"]},{"name":"vnf","value":["vCTS","v3CDB"]},{"name":"location","value":["san_diego","san_antonio","kansas_city","kings_mountain","Secaucus","lisle","concord","houston","akron"]}]
35  */
36 public class Global {
37     private static final Logger logger = Logger.getLogger(Global.class.getName());
38
39     private String service;
40     private List<String> resourceVf;
41     private List<String> resourceVfc;
42     private List<String> location;
43
44     /**
45      * Parse global given json node.
46      *
47      * @param modelJson
48      */
49     public Global(JsonNode modelJson) {
50         JsonNode globalNode = modelJson.get("global");
51         service = ModelElement.getValueByName(globalNode, "service");
52         resourceVf = ModelElement.getValuesByName(globalNode, "vf");
53         resourceVfc = ModelElement.getValuesByName(globalNode, "vfc");
54         location = ModelElement.getValuesByName(globalNode, "location");
55     }
56
57     /**
58      * @return the service
59      */
60     public String getService() {
61         return service;
62     }
63
64     /**
65      * @param service the service to set
66      */
67     public void setService(String service) {
68         this.service = service;
69     }
70
71     /**
72      * @return the resourceVf
73      */
74     public List<String> getResourceVf() {
75         return resourceVf;
76     }
77
78     /**
79      * @param resourceVf the resourceVf to set
80      */
81     public void setResourceVf(List<String> resourceVf) {
82         this.resourceVf = resourceVf;
83     }
84
85     /**
86      * @return the resourceVfc
87      */
88     public List<String> getResourceVfc() {
89         return resourceVfc;
90     }
91
92     /**
93      * @param resourceVfc the resourceVfc to set
94      */
95     public void setResourceVfc(List<String> resourceVfc) {
96         this.resourceVfc = resourceVfc;
97     }
98
99     /**
100      * @return the location
101      */
102     public List<String> getLocation() {
103         return location;
104     }
105
106     /**
107      * @param location the location to set
108      */
109     public void setLocation(List<String> location) {
110         this.location = location;
111     }
112
113 }