Rework the Clds DAO and properties associated
[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 java.util.List;
27
28 import com.att.eelf.configuration.EELFLogger;
29 import com.att.eelf.configuration.EELFManager;
30 import com.fasterxml.jackson.databind.JsonNode;
31
32 /**
33  * Parse global json properties.
34  * <p>
35  * Example json:
36  * "global":[{"name":"service","value":["vUSP"]},{"name":"vnf","value":["vCTS",
37  * "v3CDB"]},{"name":"location","value":["san_diego","san_antonio","kansas_city"
38  * ,"kings_mountain","Secaucus","lisle","concord","houston","akron"]}]
39  */
40 public class Global {
41     protected static final EELFLogger       logger      = EELFManager.getInstance().getLogger(Global.class);
42     protected static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger();
43
44     private String                  service;
45     private String                  actionSet;
46     private List<String>            resourceVf;
47     private List<String>            resourceVfc;
48     private List<String>            location;
49
50     /**
51      * Parse global given json node.
52      *
53      * @param modelJson
54      */
55     public Global(JsonNode modelJson) {
56         JsonNode globalNode = modelJson.get("global");
57         service = ModelElement.getValueByName(globalNode, "service");
58         actionSet = ModelElement.getValueByName(globalNode, "actionSet");
59         resourceVf = ModelElement.getValuesByName(globalNode, "vf");
60         resourceVfc = ModelElement.getValuesByName(globalNode, "vfc");
61         location = ModelElement.getValuesByName(globalNode, "location");
62     }
63
64     /**
65      * @return the service
66      */
67     public String getService() {
68         return service;
69     }
70
71     /**
72      * @param service
73      *            the service to set
74      */
75     public void setService(String service) {
76         this.service = service;
77     }
78
79     /**
80      * @return the actionSet
81      */
82     public String getActionSet() {
83         return actionSet;
84     }
85
86     /**
87      * @return the resourceVf
88      */
89     public List<String> getResourceVf() {
90         return resourceVf;
91     }
92
93     /**
94      * @param resourceVf
95      *            the resourceVf to set
96      */
97     public void setResourceVf(List<String> resourceVf) {
98         this.resourceVf = resourceVf;
99     }
100
101     /**
102      * @return the resourceVfc
103      */
104     public List<String> getResourceVfc() {
105         return resourceVfc;
106     }
107
108     /**
109      * @param resourceVfc
110      *            the resourceVfc to set
111      */
112     public void setResourceVfc(List<String> resourceVfc) {
113         this.resourceVfc = resourceVfc;
114     }
115
116     /**
117      * @return the location
118      */
119     public List<String> getLocation() {
120         return location;
121     }
122
123     /**
124      * @param location
125      *            the location to set
126      */
127     public void setLocation(List<String> location) {
128         this.location = location;
129     }
130
131 }