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