Merge "Model enhancement to support embedded JSON"
[policy/engine.git] / ONAP-PAP-REST / src / main / java / org / onap / policy / pap / xacml / rest / controller / PolicyScopeDictionaryController.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP-PAP-REST
4  * ================================================================================
5  * Copyright (C) 2017-2019 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.onap.policy.pap.xacml.rest.controller;
22
23 import com.fasterxml.jackson.databind.DeserializationFeature;
24 import com.fasterxml.jackson.databind.JsonNode;
25 import com.fasterxml.jackson.databind.ObjectMapper;
26 import java.io.IOException;
27 import java.util.ArrayList;
28 import java.util.List;
29 import javax.servlet.http.HttpServletRequest;
30 import javax.servlet.http.HttpServletResponse;
31 import org.apache.commons.lang.StringUtils;
32 import org.onap.policy.common.logging.flexlogger.FlexLogger;
33 import org.onap.policy.common.logging.flexlogger.Logger;
34 import org.onap.policy.pap.xacml.rest.util.DictionaryUtils;
35 import org.onap.policy.rest.dao.CommonClassDao;
36 import org.onap.policy.rest.jpa.GroupPolicyScopeList;
37 import org.onap.policy.rest.jpa.OnapName;
38 import org.onap.policy.rest.jpa.PolicyScopeClosedLoop;
39 import org.onap.policy.rest.jpa.PolicyScopeResource;
40 import org.onap.policy.rest.jpa.PolicyScopeService;
41 import org.onap.policy.rest.jpa.PolicyScopeType;
42 import org.springframework.beans.factory.annotation.Autowired;
43 import org.springframework.http.MediaType;
44 import org.springframework.stereotype.Controller;
45 import org.springframework.web.bind.annotation.RequestMapping;
46 import org.springframework.web.bind.annotation.RequestMethod;
47 import org.springframework.web.servlet.ModelAndView;
48
49 @Controller
50 public class PolicyScopeDictionaryController {
51
52     private static final Logger LOGGER =
53             FlexLogger.getLogger(PolicyScopeDictionaryController.class);
54
55     private static CommonClassDao commonClassDao;
56     private static String operation = "operation";
57     private static String groupPolicyScopeListData1 = "groupPolicyScopeListData1";
58     private static String policyScope = "PolicyScope";
59     private static String duplicateResponseString = "Duplicate";
60     private static String groupPolicyScopeDatas = "groupPolicyScopeListDatas";
61     private static String dictionaryFields = "dictionaryFields";
62     private static String psCLDatas = "psClosedLoopDictionaryDatas";
63     private static String psServiceDatas = "psServiceDictionaryDatas";
64     private static String psTypeDatas = "psTypeDictionaryDatas";
65     private static String psResourceDatas = "psResourceDictionaryDatas";
66
67     public PolicyScopeDictionaryController() {
68         super();
69     }
70
71     private DictionaryUtils getDictionaryUtilsInstance() {
72         return DictionaryUtils.getDictionaryUtils();
73     }
74
75     @Autowired
76     public PolicyScopeDictionaryController(CommonClassDao commonClassDao) {
77         PolicyScopeDictionaryController.commonClassDao = commonClassDao;
78     }
79
80     public void setCommonClassDao(CommonClassDao commonClassDao) {
81         PolicyScopeDictionaryController.commonClassDao = commonClassDao;
82     }
83
84     @RequestMapping(value = {"/get_GroupPolicyScopeDataByName"}, method = {RequestMethod.GET},
85             produces = MediaType.APPLICATION_JSON_VALUE)
86     public void getGroupPolicyScopeEntityDataByName(HttpServletResponse response) {
87         DictionaryUtils utils = getDictionaryUtilsInstance();
88         utils.getDataByEntity(response, groupPolicyScopeDatas, "name", GroupPolicyScopeList.class);
89     }
90
91     @RequestMapping(value = {"/get_GroupPolicyScopeData"}, method = {RequestMethod.GET},
92             produces = MediaType.APPLICATION_JSON_VALUE)
93     public void getGroupPolicyScopeEntityData(HttpServletResponse response) {
94         DictionaryUtils utils = getDictionaryUtilsInstance();
95         utils.getData(response, groupPolicyScopeDatas, GroupPolicyScopeList.class);
96     }
97
98     @RequestMapping(value = {"/ps_dictionary/save_psGroupPolicyScope"},
99             method = {RequestMethod.POST})
100     public ModelAndView savePSGroupScopeDictionary(HttpServletRequest request,
101             HttpServletResponse response) throws IOException {
102         DictionaryUtils utils = getDictionaryUtilsInstance();
103         try {
104             boolean fromAPI = utils.isRequestFromAPI(request);
105             ObjectMapper mapper = new ObjectMapper();
106             mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
107             JsonNode root = mapper.readTree(request.getReader());
108             GroupPolicyScopeList gpdata = null;
109             GroupPolicyScope groupData = null;
110             boolean duplicateGroupFlag = false;
111             if (fromAPI) {
112                 gpdata = mapper.readValue(root.get(dictionaryFields).toString(),
113                         GroupPolicyScopeList.class);
114                 try {
115                     groupData = mapper.readValue(root.get(groupPolicyScopeListData1).toString(),
116                             GroupPolicyScope.class);
117                 } catch (Exception e) {
118                     groupData = new GroupPolicyScope();
119                     groupData.setResource(root.get(dictionaryFields).get("resource").toString()
120                             .replace("\"", ""));
121                     groupData.setClosedloop(root.get(dictionaryFields).get("closedloop").toString()
122                             .replace("\"", ""));
123                     groupData.setService(
124                             root.get(dictionaryFields).get("service").toString().replace("\"", ""));
125                     groupData.setType(
126                             root.get(dictionaryFields).get("type").toString().replace("\"", ""));
127                     LOGGER.error(e);
128                 }
129             } else {
130                 gpdata = mapper.readValue(root.get("groupPolicyScopeListData").toString(),
131                         GroupPolicyScopeList.class);
132                 try {
133                     groupData = mapper.readValue(root.get(groupPolicyScopeListData1).toString(),
134                             GroupPolicyScope.class);
135                 } catch (Exception e) {
136                     LOGGER.error(e);
137                     groupData = new GroupPolicyScope();
138                     groupData.setResource(root.get(groupPolicyScopeListData1).get("resource")
139                             .toString().replace("\"", ""));
140                     groupData.setClosedloop(root.get(groupPolicyScopeListData1).get("closedloop")
141                             .toString().replace("\"", ""));
142                     groupData.setService(root.get(groupPolicyScopeListData1).get("service")
143                             .toString().replace("\"", ""));
144                     groupData.setType(root.get(groupPolicyScopeListData1).get("type").toString()
145                             .replace("\"", ""));
146                 }
147             }
148             if (!gpdata.getGroupName().startsWith(policyScope)) {
149                 String name = "PolicyScope_" + gpdata.getGroupName();
150                 gpdata.setGroupName(name);
151             }
152             ArrayList<String> valueList = new ArrayList<>();
153             String resourceValue = groupData.getResource();
154             String typeValue = groupData.getType();
155             String serviceValue = groupData.getService();
156             String closedLoopValue = groupData.getClosedloop();
157             valueList.add("resource=" + resourceValue);
158             valueList.add("service=" + serviceValue);
159             valueList.add("type=" + typeValue);
160             valueList.add("closedLoopControlName=" + closedLoopValue);
161             String list = StringUtils.replaceEach(valueList.toString(),
162                     new String[] {"[", "]", " "}, new String[] {"", "", ""});
163             gpdata.setGroupList(list);
164
165             List<Object> duplicateData = commonClassDao.checkDuplicateEntry(gpdata.getGroupName(),
166                     "name", GroupPolicyScopeList.class);
167             if (duplicateData.isEmpty()) {
168                 duplicateData = commonClassDao.checkDuplicateEntry(gpdata.getGroupList(),
169                         "groupList", GroupPolicyScopeList.class);
170                 if (duplicateData.isEmpty()) {
171                     duplicateGroupFlag = true;
172                 }
173             }
174             boolean duplicateflag = false;
175             if (!duplicateData.isEmpty()) {
176                 GroupPolicyScopeList data = (GroupPolicyScopeList) duplicateData.get(0);
177                 if (request.getParameter(operation) != null
178                         && "update".equals(request.getParameter(operation))) {
179                     gpdata.setId(data.getId());
180                 } else if ((request.getParameter(operation) != null
181                         && !"update".equals(request.getParameter(operation)))
182                         || (request.getParameter(operation) == null
183                                 && (data.getId() != gpdata.getId()))) {
184                     duplicateflag = true;
185                 }
186             }
187             String responseString = null;
188             if (!duplicateflag && !duplicateGroupFlag) {
189                 if (gpdata.getId() == 0) {
190                     commonClassDao.save(gpdata);
191                 } else {
192                     commonClassDao.update(gpdata);
193                 }
194                 responseString = mapper
195                         .writeValueAsString(commonClassDao.getData(GroupPolicyScopeList.class));
196             } else if (duplicateGroupFlag) {
197                 responseString = "DuplicateGroup";
198             } else {
199                 responseString = duplicateResponseString;
200             }
201             if (fromAPI) {
202                 return utils.getResultForApi(responseString);
203             } else {
204                 utils.setResponseData(response, groupPolicyScopeDatas, responseString);
205             }
206         } catch (Exception e) {
207             utils.setErrorResponseData(response, e);
208         }
209         return null;
210     }
211
212     @RequestMapping(value = {"/ps_dictionary/remove_GroupPolicyScope"},
213             method = {RequestMethod.POST})
214     public void removePSGroupScopeDictionary(HttpServletRequest request,
215             HttpServletResponse response) throws IOException {
216         DictionaryUtils utils = getDictionaryUtilsInstance();
217         utils.removeData(request, response, groupPolicyScopeDatas, GroupPolicyScopeList.class);
218     }
219
220     @RequestMapping(value = {"/get_PSClosedLoopDataByName"}, method = {RequestMethod.GET},
221             produces = MediaType.APPLICATION_JSON_VALUE)
222     public void getPSClosedLoopEntityDataByName(HttpServletResponse response) {
223         DictionaryUtils utils = getDictionaryUtilsInstance();
224         utils.getDataByEntity(response, psCLDatas, "name", OnapName.class);
225     }
226
227     @RequestMapping(value = {"/get_PSClosedLoopData"}, method = {RequestMethod.GET},
228             produces = MediaType.APPLICATION_JSON_VALUE)
229     public void getPSClosedLoopEntityData(HttpServletResponse response) {
230         DictionaryUtils utils = getDictionaryUtilsInstance();
231         utils.getData(response, psCLDatas, PolicyScopeClosedLoop.class);
232     }
233
234     @RequestMapping(value = {"/ps_dictionary/save_psClosedLoop"}, method = {RequestMethod.POST})
235     public ModelAndView savePSClosedLoopDictionary(HttpServletRequest request,
236             HttpServletResponse response) throws IOException {
237         DictionaryUtils utils = getDictionaryUtilsInstance();
238         try {
239             boolean fromAPI = utils.isRequestFromAPI(request);
240             ObjectMapper mapper = new ObjectMapper();
241             mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
242             JsonNode root = mapper.readTree(request.getReader());
243             PolicyScopeClosedLoop onapData;
244             if (fromAPI) {
245                 onapData = mapper.readValue(root.get(dictionaryFields).toString(),
246                         PolicyScopeClosedLoop.class);
247             } else {
248                 onapData = mapper.readValue(root.get("psClosedLoopDictionaryData").toString(),
249                         PolicyScopeClosedLoop.class);
250             }
251
252             List<Object> duplicateData = commonClassDao.checkDuplicateEntry(onapData.getName(),
253                     "name", PolicyScopeClosedLoop.class);
254             boolean duplicateflag = false;
255             if (!duplicateData.isEmpty()) {
256                 PolicyScopeClosedLoop data = (PolicyScopeClosedLoop) duplicateData.get(0);
257                 if (request.getParameter(operation) != null
258                         && "update".equals(request.getParameter(operation))) {
259                     onapData.setId(data.getId());
260                 } else if ((request.getParameter(operation) != null
261                         && !"update".equals(request.getParameter(operation)))
262                         || (request.getParameter(operation) == null
263                                 && (data.getId() != onapData.getId()))) {
264                     duplicateflag = true;
265                 }
266             }
267             String responseString = null;
268             if (!duplicateflag) {
269                 if (onapData.getId() == 0) {
270                     commonClassDao.save(onapData);
271                 } else {
272                     commonClassDao.update(onapData);
273                 }
274                 responseString = mapper
275                         .writeValueAsString(commonClassDao.getData(PolicyScopeClosedLoop.class));
276             } else {
277                 responseString = duplicateResponseString;
278             }
279             if (fromAPI) {
280                 return utils.getResultForApi(responseString);
281             } else {
282                 utils.setResponseData(response, psCLDatas, responseString);
283             }
284         } catch (Exception e) {
285             utils.setErrorResponseData(response, e);
286         }
287         return null;
288     }
289
290     @RequestMapping(value = {"/ps_dictionary/remove_PSClosedLoop"}, method = {RequestMethod.POST})
291     public void removePSClosedLoopDictionary(HttpServletRequest request,
292             HttpServletResponse response) throws IOException {
293         DictionaryUtils utils = getDictionaryUtilsInstance();
294         utils.removeData(request, response, psCLDatas, PolicyScopeClosedLoop.class);
295     }
296
297     @RequestMapping(value = {"/get_PSServiceDataByName"}, method = {RequestMethod.GET},
298             produces = MediaType.APPLICATION_JSON_VALUE)
299     public void getPSServiceEntityDataByName(HttpServletResponse response) {
300         DictionaryUtils utils = getDictionaryUtilsInstance();
301         utils.getDataByEntity(response, psServiceDatas, "name", PolicyScopeService.class);
302     }
303
304     @RequestMapping(value = {"/get_PSServiceData"}, method = {RequestMethod.GET},
305             produces = MediaType.APPLICATION_JSON_VALUE)
306     public void getPSServiceEntityData(HttpServletResponse response) {
307         DictionaryUtils utils = getDictionaryUtilsInstance();
308         utils.getData(response, psServiceDatas, PolicyScopeService.class);
309     }
310
311     @RequestMapping(value = {"/ps_dictionary/save_psService"}, method = {RequestMethod.POST})
312     public ModelAndView savePSServiceDictionary(HttpServletRequest request,
313             HttpServletResponse response) throws IOException {
314         DictionaryUtils utils = getDictionaryUtilsInstance();
315         try {
316             boolean fromAPI = utils.isRequestFromAPI(request);
317             ObjectMapper mapper = new ObjectMapper();
318             mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
319             JsonNode root = mapper.readTree(request.getReader());
320             PolicyScopeService onapData;
321             if (fromAPI) {
322                 onapData = mapper.readValue(root.get(dictionaryFields).toString(),
323                         PolicyScopeService.class);
324             } else {
325                 onapData = mapper.readValue(root.get("psServiceDictionaryData").toString(),
326                         PolicyScopeService.class);
327             }
328
329             List<Object> duplicateData = commonClassDao.checkDuplicateEntry(onapData.getName(),
330                     "name", PolicyScopeService.class);
331             boolean duplicateflag = false;
332             if (!duplicateData.isEmpty()) {
333                 PolicyScopeService data = (PolicyScopeService) duplicateData.get(0);
334                 if (request.getParameter(operation) != null
335                         && "update".equals(request.getParameter(operation))) {
336                     onapData.setId(data.getId());
337                 } else if ((request.getParameter(operation) != null
338                         && !"update".equals(request.getParameter(operation)))
339                         || (request.getParameter(operation) == null
340                                 && (data.getId() != onapData.getId()))) {
341                     duplicateflag = true;
342                 }
343             }
344             String responseString = null;
345             if (!duplicateflag) {
346                 if (onapData.getId() == 0) {
347                     commonClassDao.save(onapData);
348                 } else {
349                     commonClassDao.update(onapData);
350                 }
351                 responseString =
352                         mapper.writeValueAsString(commonClassDao.getData(PolicyScopeService.class));
353             } else {
354                 responseString = duplicateResponseString;
355             }
356             if (fromAPI) {
357                 return utils.getResultForApi(responseString);
358             } else {
359                 utils.setResponseData(response, psServiceDatas, responseString);
360             }
361         } catch (Exception e) {
362             utils.setErrorResponseData(response, e);
363         }
364         return null;
365     }
366
367     @RequestMapping(value = {"/ps_dictionary/remove_PSService"}, method = {RequestMethod.POST})
368     public void removePSServiceDictionary(HttpServletRequest request, HttpServletResponse response)
369             throws IOException {
370         DictionaryUtils utils = getDictionaryUtilsInstance();
371         utils.removeData(request, response, psServiceDatas, PolicyScopeService.class);
372     }
373
374     @RequestMapping(value = {"/get_PSTypeDataByName"}, method = {RequestMethod.GET},
375             produces = MediaType.APPLICATION_JSON_VALUE)
376     public void getPSTypeEntityDataByName(HttpServletResponse response) {
377         DictionaryUtils utils = getDictionaryUtilsInstance();
378         utils.getDataByEntity(response, psTypeDatas, "name", PolicyScopeType.class);
379     }
380
381     @RequestMapping(value = {"/get_PSTypeData"}, method = {RequestMethod.GET},
382             produces = MediaType.APPLICATION_JSON_VALUE)
383     public void getPSTypeEntityData(HttpServletResponse response) {
384         DictionaryUtils utils = getDictionaryUtilsInstance();
385         utils.getData(response, psTypeDatas, PolicyScopeType.class);
386     }
387
388     @RequestMapping(value = {"/ps_dictionary/save_psType"}, method = {RequestMethod.POST})
389     public ModelAndView savePSTypeDictionary(HttpServletRequest request,
390             HttpServletResponse response) throws IOException {
391         DictionaryUtils utils = getDictionaryUtilsInstance();
392         try {
393             boolean fromAPI = utils.isRequestFromAPI(request);
394             ObjectMapper mapper = new ObjectMapper();
395             mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
396             JsonNode root = mapper.readTree(request.getReader());
397             PolicyScopeType onapData;
398             if (fromAPI) {
399                 onapData = mapper.readValue(root.get(dictionaryFields).toString(),
400                         PolicyScopeType.class);
401             } else {
402                 onapData = mapper.readValue(root.get("psTypeDictionaryData").toString(),
403                         PolicyScopeType.class);
404             }
405
406             List<Object> duplicateData = commonClassDao.checkDuplicateEntry(onapData.getName(),
407                     "name", PolicyScopeType.class);
408             boolean duplicateflag = false;
409             if (!duplicateData.isEmpty()) {
410                 PolicyScopeType data = (PolicyScopeType) duplicateData.get(0);
411                 if (request.getParameter(operation) != null
412                         && "update".equals(request.getParameter(operation))) {
413                     onapData.setId(data.getId());
414                 } else if ((request.getParameter(operation) != null
415                         && !"update".equals(request.getParameter(operation)))
416                         || (request.getParameter(operation) == null
417                                 && (data.getId() != onapData.getId()))) {
418                     duplicateflag = true;
419                 }
420             }
421             String responseString = null;
422             if (!duplicateflag) {
423                 if (onapData.getId() == 0) {
424                     commonClassDao.save(onapData);
425                 } else {
426                     commonClassDao.update(onapData);
427                 }
428                 responseString =
429                         mapper.writeValueAsString(commonClassDao.getData(PolicyScopeType.class));
430             } else {
431                 responseString = duplicateResponseString;
432             }
433             if (fromAPI) {
434                 return utils.getResultForApi(responseString);
435             } else {
436                 utils.setResponseData(response, psTypeDatas, responseString);
437             }
438         } catch (Exception e) {
439             utils.setErrorResponseData(response, e);
440         }
441         return null;
442     }
443
444     @RequestMapping(value = {"/ps_dictionary/remove_PSType"}, method = {RequestMethod.POST})
445     public void removePSTypeDictionary(HttpServletRequest request, HttpServletResponse response)
446             throws IOException {
447         DictionaryUtils utils = getDictionaryUtilsInstance();
448         utils.removeData(request, response, psTypeDatas, PolicyScopeType.class);
449     }
450
451     @RequestMapping(value = {"/get_PSResourceDataByName"}, method = {RequestMethod.GET},
452             produces = MediaType.APPLICATION_JSON_VALUE)
453     public void getPSResourceEntityDataByName(HttpServletResponse response) {
454         DictionaryUtils utils = getDictionaryUtilsInstance();
455         utils.getDataByEntity(response, psResourceDatas, "name", PolicyScopeResource.class);
456     }
457
458     @RequestMapping(value = {"/get_PSResourceData"}, method = {RequestMethod.GET},
459             produces = MediaType.APPLICATION_JSON_VALUE)
460     public void getPSResourceEntityData(HttpServletResponse response) {
461         DictionaryUtils utils = getDictionaryUtilsInstance();
462         utils.getData(response, psResourceDatas, PolicyScopeResource.class);
463     }
464
465     @RequestMapping(value = {"/ps_dictionary/save_psResource"}, method = {RequestMethod.POST})
466     public ModelAndView savePSResourceDictionary(HttpServletRequest request,
467             HttpServletResponse response) throws IOException {
468         DictionaryUtils utils = getDictionaryUtilsInstance();
469         try {
470             boolean fromAPI = utils.isRequestFromAPI(request);
471             ObjectMapper mapper = new ObjectMapper();
472             mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
473             JsonNode root = mapper.readTree(request.getReader());
474             PolicyScopeResource onapData;
475             if (fromAPI) {
476                 onapData = mapper.readValue(root.get(dictionaryFields).toString(),
477                         PolicyScopeResource.class);
478             } else {
479                 onapData = mapper.readValue(root.get("psResourceDictionaryData").toString(),
480                         PolicyScopeResource.class);
481             }
482
483             List<Object> duplicateData = commonClassDao.checkDuplicateEntry(onapData.getName(),
484                     "name", PolicyScopeResource.class);
485             boolean duplicateflag = false;
486             if (!duplicateData.isEmpty()) {
487                 PolicyScopeResource data = (PolicyScopeResource) duplicateData.get(0);
488                 if (request.getParameter(operation) != null
489                         && "update".equals(request.getParameter(operation))) {
490                     onapData.setId(data.getId());
491                 } else if ((request.getParameter(operation) != null
492                         && !"update".equals(request.getParameter(operation)))
493                         || (request.getParameter(operation) == null
494                                 && (data.getId() != onapData.getId()))) {
495                     duplicateflag = true;
496                 }
497             }
498             String responseString = null;
499             if (!duplicateflag) {
500                 if (onapData.getId() == 0) {
501                     commonClassDao.save(onapData);
502                 } else {
503                     commonClassDao.update(onapData);
504                 }
505                 responseString = mapper
506                         .writeValueAsString(commonClassDao.getData(PolicyScopeResource.class));
507             } else {
508                 responseString = duplicateResponseString;
509             }
510             if (fromAPI) {
511                 return utils.getResultForApi(responseString);
512             } else {
513                 utils.setResponseData(response, psResourceDatas, responseString);
514             }
515         } catch (Exception e) {
516             utils.setErrorResponseData(response, e);
517         }
518         return null;
519     }
520
521     @RequestMapping(value = {"/ps_dictionary/remove_PSResource"}, method = {RequestMethod.POST})
522     public void removePSResourceDictionary(HttpServletRequest request, HttpServletResponse response)
523             throws IOException {
524         DictionaryUtils utils = getDictionaryUtilsInstance();
525         utils.removeData(request, response, psResourceDatas, PolicyScopeResource.class);
526     }
527 }
528
529
530 class GroupPolicyScope {
531     String resource;
532     String type;
533     String service;
534     String closedloop;
535
536     public String getResource() {
537         return resource;
538     }
539
540     public void setResource(String resource) {
541         this.resource = resource;
542     }
543
544     public String getType() {
545         return type;
546     }
547
548     public void setType(String type) {
549         this.type = type;
550     }
551
552     public String getService() {
553         return service;
554     }
555
556     public void setService(String service) {
557         this.service = service;
558     }
559
560     public String getClosedloop() {
561         return closedloop;
562     }
563
564     public void setClosedloop(String closedloop) {
565         this.closedloop = closedloop;
566     }
567
568 }