[POLICY-73] replace openecomp for policy-engine
[policy/engine.git] / ONAP-PAP-REST / src / main / java / org / onap / policy / pap / xacml / rest / controller / ClosedLoopDictionaryController.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP-PAP-REST
4  * ================================================================================
5  * Copyright (C) 2017 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 java.io.PrintWriter;
24 import java.util.Date;
25 import java.util.HashMap;
26 import java.util.LinkedHashMap;
27 import java.util.List;
28 import java.util.Map;
29
30 import javax.servlet.http.HttpServletRequest;
31 import javax.servlet.http.HttpServletResponse;
32
33 import org.json.JSONObject;
34 import org.onap.policy.common.logging.flexlogger.FlexLogger;
35 import org.onap.policy.common.logging.flexlogger.Logger;
36 import org.onap.policy.pap.xacml.rest.adapters.GridData;
37 import org.onap.policy.pap.xacml.rest.util.JsonMessage;
38 import org.onap.policy.rest.dao.CommonClassDao;
39 import org.onap.policy.rest.jpa.ClosedLoopD2Services;
40 import org.onap.policy.rest.jpa.ClosedLoopSite;
41 import org.onap.policy.rest.jpa.PEPOptions;
42 import org.onap.policy.rest.jpa.UserInfo;
43 import org.onap.policy.rest.jpa.VNFType;
44 import org.onap.policy.rest.jpa.VSCLAction;
45 import org.onap.policy.rest.jpa.VarbindDictionary;
46 import org.onap.policy.xacml.api.XACMLErrorConstants;
47 import org.springframework.beans.factory.annotation.Autowired;
48 import org.springframework.http.MediaType;
49 import org.springframework.stereotype.Controller;
50 import org.springframework.web.bind.annotation.RequestMapping;
51 import org.springframework.web.servlet.ModelAndView;
52
53 import com.fasterxml.jackson.databind.DeserializationFeature;
54 import com.fasterxml.jackson.databind.JsonNode;
55 import com.fasterxml.jackson.databind.ObjectMapper;
56
57 @Controller
58 public class ClosedLoopDictionaryController{
59
60         private static final Logger LOGGER = FlexLogger.getLogger(ClosedLoopDictionaryController.class);
61
62         private static CommonClassDao commonClassDao;
63         
64         @Autowired
65         public ClosedLoopDictionaryController(CommonClassDao commonClassDao){
66                 ClosedLoopDictionaryController.commonClassDao = commonClassDao;
67         }
68         
69         public ClosedLoopDictionaryController(){}
70
71         public UserInfo getUserInfo(String loginId){
72                 UserInfo name = (UserInfo) commonClassDao.getEntityItem(UserInfo.class, "userLoginId", loginId);
73                 return name;
74         }
75
76
77         @RequestMapping(value={"/get_VSCLActionDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
78         public void getVSCLActionDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response){
79                 try{
80                         Map<String, Object> model = new HashMap<>();
81                         ObjectMapper mapper = new ObjectMapper();
82                         model.put("vsclActionDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(VSCLAction.class, "vsclaction")));
83                         JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
84                         JSONObject j = new JSONObject(msg);
85                         response.getWriter().write(j.toString());
86                 }
87                 catch (Exception e){
88                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
89                 }
90         }
91
92
93         @RequestMapping(value={"/get_VSCLActionData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
94         public void getVSCLActionDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
95                 try{
96                         Map<String, Object> model = new HashMap<>();
97                         ObjectMapper mapper = new ObjectMapper();
98                         model.put("vsclActionDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(VSCLAction.class)));
99                         JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
100                         JSONObject j = new JSONObject(msg);
101                         response.addHeader("successMapKey", "success"); 
102                         response.addHeader("operation", "getDictionary");
103                         response.getWriter().write(j.toString());
104                 }
105                 catch (Exception e){
106                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
107                         response.setStatus(HttpServletResponse.SC_BAD_REQUEST);                             
108                         response.addHeader("error", "dictionaryDBQuery");
109                 }
110         }
111
112         @RequestMapping(value={"/get_VNFTypeDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
113         public void getVNFTypeDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response){
114                 try{
115                         Map<String, Object> model = new HashMap<>();
116                         ObjectMapper mapper = new ObjectMapper();
117                         model.put("vnfTypeDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(VNFType.class, "vnftype")));
118                         JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
119                         JSONObject j = new JSONObject(msg);
120                         response.addHeader("successMapKey", "success"); 
121                         response.addHeader("operation", "getDictionary");
122                         response.getWriter().write(j.toString());
123                 }
124                 catch (Exception e){
125                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
126                 }
127         }
128
129         @RequestMapping(value={"/get_VNFTypeData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
130         public void getVNFTypeDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
131                 try{
132                         Map<String, Object> model = new HashMap<>();
133                         ObjectMapper mapper = new ObjectMapper();
134                         model.put("vnfTypeDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(VNFType.class)));
135                         JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
136                         JSONObject j = new JSONObject(msg);
137                         response.addHeader("successMapKey", "success"); 
138                         response.addHeader("operation", "getDictionary");
139                         response.getWriter().write(j.toString());
140                 }
141                 catch (Exception e){
142                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
143                         response.setStatus(HttpServletResponse.SC_BAD_REQUEST);                             
144                         response.addHeader("error", "dictionaryDBQuery");
145                 }
146         }
147
148         @RequestMapping(value={"/get_PEPOptionsDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
149         public void getPEPOptionsDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response){
150                 try{
151                         Map<String, Object> model = new HashMap<>();
152                         ObjectMapper mapper = new ObjectMapper();
153                         model.put("pepOptionsDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(PEPOptions.class, "pepName")));
154                         JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
155                         JSONObject j = new JSONObject(msg);
156                         response.getWriter().write(j.toString());
157                 }
158                 catch (Exception e){
159                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
160                 }
161         }
162
163         @RequestMapping(value={"/get_PEPOptionsData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
164         public void getPEPOptionsDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
165                 try{
166                         Map<String, Object> model = new HashMap<>();
167                         ObjectMapper mapper = new ObjectMapper();
168                         model.put("pepOptionsDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(PEPOptions.class)));
169                         JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
170                         JSONObject j = new JSONObject(msg);
171                         response.addHeader("successMapKey", "success"); 
172                         response.addHeader("operation", "getDictionary");
173                         response.getWriter().write(j.toString());
174                 }
175                 catch (Exception e){
176                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
177                         response.setStatus(HttpServletResponse.SC_BAD_REQUEST);                             
178                         response.addHeader("error", "dictionaryDBQuery");
179                 }
180         }
181
182         @RequestMapping(value={"/get_VarbindDictionaryDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
183         public void getVarbindDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response){
184                 try{
185                         Map<String, Object> model = new HashMap<>();
186                         ObjectMapper mapper = new ObjectMapper();
187                         model.put("varbindDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(VarbindDictionary.class, "varbindName")));
188                         JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
189                         JSONObject j = new JSONObject(msg);
190                         response.getWriter().write(j.toString());
191                 }
192                 catch (Exception e){
193                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
194                 }
195         }
196
197         @RequestMapping(value={"/get_VarbindDictionaryData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
198         public void getVarbindDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
199                 try{
200                         Map<String, Object> model = new HashMap<>();
201                         ObjectMapper mapper = new ObjectMapper();
202                         model.put("varbindDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(VarbindDictionary.class)));
203                         JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
204                         JSONObject j = new JSONObject(msg);
205                         response.addHeader("successMapKey", "success"); 
206                         response.addHeader("operation", "getDictionary");
207                         response.getWriter().write(j.toString());
208                 }
209                 catch (Exception e){
210                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
211                         response.setStatus(HttpServletResponse.SC_BAD_REQUEST);                             
212                         response.addHeader("error", "dictionaryDBQuery");
213                 }
214         }
215
216         @RequestMapping(value={"/get_ClosedLoopServicesDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
217         public void getClosedLoopServiceDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response){
218                 try{
219                         Map<String, Object> model = new HashMap<>();
220                         ObjectMapper mapper = new ObjectMapper();
221                         model.put("closedLoopServiceDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(ClosedLoopD2Services.class, "serviceName")));
222                         JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
223                         JSONObject j = new JSONObject(msg);
224                         response.getWriter().write(j.toString());
225                 }
226                 catch (Exception e){
227                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
228                 }
229         }
230
231         @RequestMapping(value={"/get_ClosedLoopServicesData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
232         public void getClosedLoopServiceDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
233                 try{
234                         Map<String, Object> model = new HashMap<>();
235                         ObjectMapper mapper = new ObjectMapper();
236                         model.put("closedLoopServiceDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(ClosedLoopD2Services.class)));
237                         JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
238                         JSONObject j = new JSONObject(msg);
239                         response.addHeader("successMapKey", "success"); 
240                         response.addHeader("operation", "getDictionary");
241                         response.getWriter().write(j.toString());
242                 }
243                 catch (Exception e){
244                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
245                         response.setStatus(HttpServletResponse.SC_BAD_REQUEST);                             
246                         response.addHeader("error", "dictionaryDBQuery");
247                 }
248         }
249
250         @RequestMapping(value={"/get_ClosedLoopSiteDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
251         public void getClosedLoopSiteDictionaryByNameEntityData(HttpServletRequest request, HttpServletResponse response){
252                 try{
253                         Map<String, Object> model = new HashMap<>();
254                         ObjectMapper mapper = new ObjectMapper();
255                         model.put("closedLoopSiteDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(ClosedLoopSite.class, "siteName")));
256                         JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
257                         JSONObject j = new JSONObject(msg);
258                         response.getWriter().write(j.toString());
259                 }
260                 catch (Exception e){
261                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
262                 }
263         }
264
265         @RequestMapping(value={"/get_ClosedLoopSiteData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
266         public void getClosedLoopSiteDictionaryEntityData(HttpServletRequest request, HttpServletResponse response){
267                 try{
268                         Map<String, Object> model = new HashMap<>();
269                         ObjectMapper mapper = new ObjectMapper();
270                         model.put("closedLoopSiteDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(ClosedLoopSite.class)));
271                         JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
272                         JSONObject j = new JSONObject(msg);
273                         response.addHeader("successMapKey", "success"); 
274                         response.addHeader("operation", "getDictionary");
275                         response.getWriter().write(j.toString());
276                 }
277                 catch (Exception e){
278                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
279                         response.setStatus(HttpServletResponse.SC_BAD_REQUEST);                             
280                         response.addHeader("error", "dictionaryDBQuery");
281                 }
282         }
283
284         @RequestMapping(value={"/cl_dictionary/save_vsclAction"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
285         public ModelAndView saveVSCLAction(HttpServletRequest request, HttpServletResponse response) throws Exception{
286                 try {
287                         boolean duplicateflag = false;
288                         boolean isFakeUpdate = false;
289                         boolean fromAPI = false;
290                         if (request.getParameter("apiflag")!=null && request.getParameter("apiflag").equalsIgnoreCase("api")) {
291                                 fromAPI = true;
292                         }
293                         ObjectMapper mapper = new ObjectMapper();
294                         mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
295                         JsonNode root = mapper.readTree(request.getReader());
296                         VSCLAction vSCLAction;
297                         String userId = null;
298                         if (fromAPI) {
299                                 vSCLAction = (VSCLAction)mapper.readValue(root.get("dictionaryFields").toString(), VSCLAction.class);
300                                 userId = "API";
301
302                                 //check if update operation or create, get id for data to be updated and update attributeData
303                                 if (request.getParameter("operation").equals("update")) {
304                                         List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(vSCLAction.getVsclaction(), "vsclaction", VSCLAction.class);
305                                         int id = 0;
306                                         VSCLAction data = (VSCLAction) duplicateData.get(0);
307                                         id = data.getId();
308                                         if(id==0){
309                                                 isFakeUpdate=true;
310                                                 vSCLAction.setId(1);
311                                         } else {
312                                                 vSCLAction.setId(id);
313                                         }
314
315                                         vSCLAction.setUserCreatedBy(this.getUserInfo(userId));
316                                 }
317
318                         } else {
319                                 vSCLAction = (VSCLAction)mapper.readValue(root.get("vsclActionDictionaryData").toString(), VSCLAction.class);
320                                 userId = root.get("userid").textValue();
321                         }
322                         if(vSCLAction.getId() == 0){
323                                 List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(vSCLAction.getVsclaction(), "vsclaction", VSCLAction.class);
324                                 if(!duplicateData.isEmpty()){
325                                         duplicateflag = true;
326                                 }else{
327                                         vSCLAction.setUserCreatedBy(this.getUserInfo(userId));
328                                         vSCLAction.setUserModifiedBy(this.getUserInfo(userId));
329                                         vSCLAction.setModifiedDate(new Date());
330                                         commonClassDao.save(vSCLAction);
331                                 }
332                         }else{
333                                 if(!isFakeUpdate) {
334                                         vSCLAction.setUserModifiedBy(this.getUserInfo(userId));
335                                         commonClassDao.update(vSCLAction); 
336                                 }
337                         }
338
339                         String responseString = "";
340                         if(duplicateflag){
341                                 responseString = "Duplicate";
342                         }else{
343                                 responseString = mapper.writeValueAsString(commonClassDao.getData(VSCLAction.class));
344                         }       
345                         if (fromAPI) {
346                                 if (responseString!=null && !responseString.equals("Duplicate")) {
347                                         if(isFakeUpdate) {
348                                                 responseString = "Exists";
349                                         } else {
350                                                 responseString = "Success";
351                                         }               
352
353                                 }
354                                 ModelAndView result = new ModelAndView();
355                                 result.setViewName(responseString);
356                                 return result;
357                         } else {
358                                 response.setCharacterEncoding("UTF-8");
359                                 response.setContentType("application / json"); 
360                                 request.setCharacterEncoding("UTF-8");
361
362                                 PrintWriter out = response.getWriter();
363                                 JSONObject j = new JSONObject("{vsclActionDictionaryDatas: " + responseString + "}");
364                                 out.write(j.toString());
365                                 return null;
366                         }
367                 }
368                 catch (Exception e){
369                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
370                         response.setCharacterEncoding("UTF-8");
371                         request.setCharacterEncoding("UTF-8");
372                         PrintWriter out = response.getWriter();
373                         out.write(e.getMessage());
374                 }
375                 return null;
376         }
377
378         @RequestMapping(value={"/cl_dictionary/remove_VsclAction"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
379         public ModelAndView removeVSCLAction(HttpServletRequest request, HttpServletResponse response) throws Exception {
380                 try{
381                         ObjectMapper mapper = new ObjectMapper();
382                         mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
383                         JsonNode root = mapper.readTree(request.getReader());
384                         VSCLAction vSCLAction = (VSCLAction)mapper.readValue(root.get("data").toString(), VSCLAction.class);
385                         commonClassDao.delete(vSCLAction);
386                         response.setCharacterEncoding("UTF-8");
387                         response.setContentType("application / json");
388                         request.setCharacterEncoding("UTF-8");
389
390                         PrintWriter out = response.getWriter();
391
392                         String responseString = mapper.writeValueAsString(commonClassDao.getData(VSCLAction.class));
393                         JSONObject j = new JSONObject("{vsclActionDictionaryDatas: " + responseString + "}");
394                         out.write(j.toString());
395
396                         return null;
397                 }
398                 catch (Exception e){
399                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
400                         response.setCharacterEncoding("UTF-8");
401                         request.setCharacterEncoding("UTF-8");
402                         PrintWriter out = response.getWriter();
403                         out.write(e.getMessage());
404                 }
405                 return null;
406         }
407
408         @RequestMapping(value={"/cl_dictionary/save_vnfType"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
409         public ModelAndView saveVnfType(HttpServletRequest request, HttpServletResponse response) throws Exception{
410                 try {
411                         boolean duplicateflag = false;
412                         boolean isFakeUpdate = false;
413                         boolean fromAPI = false;
414
415                         if (request.getParameter("apiflag")!=null && request.getParameter("apiflag").equalsIgnoreCase("api")) {
416                                 fromAPI = true;
417                         }
418                         ObjectMapper mapper = new ObjectMapper();
419                         mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
420                         JsonNode root = mapper.readTree(request.getReader());
421                         VNFType vNFType;
422                         String userId = null;
423
424                         if (fromAPI) {
425                                 vNFType = (VNFType)mapper.readValue(root.get("dictionaryFields").toString(), VNFType.class);
426                                 userId = "API";
427
428                                 //check if update operation or create, get id for data to be updated and update attributeData
429                                 if (request.getParameter("operation").equals("update")) {
430                                         List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(vNFType.getVnftype(), "vnftype", VNFType.class);
431                                         int id = 0;
432                                         VNFType data = (VNFType) duplicateData.get(0);
433                                         id = data.getId();
434                                         if(id==0){
435                                                 isFakeUpdate=true;
436                                                 vNFType.setId(1);
437                                         } else {
438                                                 vNFType.setId(id);
439                                         }
440                                         vNFType.setUserCreatedBy(this.getUserInfo(userId));
441                                 }
442                         } else {
443                                 vNFType = (VNFType)mapper.readValue(root.get("vnfTypeDictionaryData").toString(), VNFType.class);
444                                 userId = root.get("userid").textValue();
445                         }
446                         if(vNFType.getId() == 0){
447                                 List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(vNFType.getVnftype(), "vnftype", VNFType.class);
448                                 if(!duplicateData.isEmpty()){
449                                         duplicateflag = true;
450                                 }else{
451                                         vNFType.setUserCreatedBy(this.getUserInfo(userId));
452                                         vNFType.setUserModifiedBy(this.getUserInfo(userId));
453                                         commonClassDao.save(vNFType);
454                                 }        
455                         }else{
456                                 if(!isFakeUpdate) {
457                                         vNFType.setUserModifiedBy(this.getUserInfo(userId));
458                                         vNFType.setModifiedDate(new Date());
459                                         commonClassDao.update(vNFType); 
460                                 }
461                         } 
462                         String responseString = "";
463                         if(duplicateflag){
464                                 responseString = "Duplicate";
465                         }else{
466                                 responseString = mapper.writeValueAsString(commonClassDao.getData(VNFType.class));
467                         } 
468                         if (fromAPI) {
469                                 if (responseString!=null && !responseString.equals("Duplicate")) {
470                                         if(isFakeUpdate) {
471                                                 responseString = "Exists";
472                                         } else {
473                                                 responseString = "Success";
474                                         }        
475                                 }
476                                 ModelAndView result = new ModelAndView();
477                                 result.setViewName(responseString);
478                                 return result; 
479                         } else {
480                                 response.setCharacterEncoding("UTF-8");
481                                 response.setContentType("application / json");
482                                 request.setCharacterEncoding("UTF-8");
483
484                                 PrintWriter out = response.getWriter();
485                                 JSONObject j = new JSONObject("{vnfTypeDictionaryDatas: " + responseString + "}");
486                                 out.write(j.toString()); 
487                                 return null;
488                         }
489                 } 
490                 catch (Exception e){
491                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
492                         response.setCharacterEncoding("UTF-8");
493                         request.setCharacterEncoding("UTF-8");
494                         PrintWriter out = response.getWriter();
495                         out.write(e.getMessage());
496                 }
497                 return null;
498         }
499
500         @RequestMapping(value={"/cl_dictionary/remove_vnfType"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
501         public ModelAndView removeVnfType(HttpServletRequest request, HttpServletResponse response) throws Exception {
502                 try{
503                         ObjectMapper mapper = new ObjectMapper();
504                         mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
505                         JsonNode root = mapper.readTree(request.getReader());
506                         VNFType vNFType = (VNFType)mapper.readValue(root.get("data").toString(), VNFType.class);
507                         commonClassDao.delete(vNFType);
508                         response.setCharacterEncoding("UTF-8");
509                         response.setContentType("application / json");
510                         request.setCharacterEncoding("UTF-8");
511
512                         PrintWriter out = response.getWriter();
513
514                         String responseString = mapper.writeValueAsString(commonClassDao.getData(VNFType.class));
515                         JSONObject j = new JSONObject("{vnfTypeDictionaryDatas: " + responseString + "}");
516                         out.write(j.toString());
517
518                         return null;
519                 }
520                 catch (Exception e){
521                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
522                         response.setCharacterEncoding("UTF-8");
523                         request.setCharacterEncoding("UTF-8");
524                         PrintWriter out = response.getWriter();
525                         out.write(e.getMessage());
526                 }
527                 return null;
528         }
529
530         @RequestMapping(value={"/cl_dictionary/save_pepOptions"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
531         public ModelAndView savePEPOptions(HttpServletRequest request, HttpServletResponse response) throws Exception{
532                 try {
533                         boolean duplicateflag = false;
534             boolean isFakeUpdate = false;
535             boolean fromAPI = false;
536             if (request.getParameter("apiflag")!=null && request.getParameter("apiflag").equalsIgnoreCase("api")) {
537                 fromAPI = true;
538             }
539                         ObjectMapper mapper = new ObjectMapper();
540                         mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
541                         JsonNode root = mapper.readTree(request.getReader());
542             PEPOptions pEPOptions;
543             GridData gridData;
544             String userId = null;
545             if (fromAPI) {
546                 pEPOptions = (PEPOptions)mapper.readValue(root.get("dictionaryFields").toString(), PEPOptions.class);
547                 gridData = (GridData)mapper.readValue(root.get("dictionaryFields").toString(), GridData.class);
548                 userId = "API";
549                 
550                 //check if update operation or create, get id for data to be updated and update attributeData
551                 if (request.getParameter("operation").equals("update")) {
552                     List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(pEPOptions.getPepName(), "pepName", PEPOptions.class);
553                     int id = 0;
554                     PEPOptions data = (PEPOptions) duplicateData.get(0);
555                     id = data.getId();
556                     if(id==0){
557                         isFakeUpdate=true;
558                         pEPOptions.setId(1);
559                     } else {
560                         pEPOptions.setId(id);
561                     }
562                     pEPOptions.setUserCreatedBy(this.getUserInfo(userId));
563                 }
564             } else {
565                 pEPOptions = (PEPOptions)mapper.readValue(root.get("pepOptionsDictionaryData").toString(), PEPOptions.class);
566                 gridData = (GridData)mapper.readValue(root.get("pepOptionsDictionaryData").toString(), GridData.class);
567                 userId = root.get("userid").textValue();
568             }
569                         String actions = "";
570                         int counter = 0;
571                         if(gridData.getAttributes().size() > 0){
572                                 for(Object attribute : gridData.getAttributes()){
573                                         if(attribute instanceof LinkedHashMap<?, ?>){
574                                                 String key = ((LinkedHashMap<?, ?>) attribute).get("option").toString();
575                                                 String value = ((LinkedHashMap<?, ?>) attribute).get("number").toString();
576                                                 if(counter>0){
577                                                         actions = actions + ":#@";
578                                                 }
579                                                 actions = actions + key + "=#@";
580                                                 actions = actions + value;
581                                                 counter ++;
582                                         }
583                                 }
584                         }
585                         pEPOptions.setActions(actions);
586                         if(pEPOptions.getId() == 0){
587                                 List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(pEPOptions.getPepName(), "pepName", PEPOptions.class);
588                                 if(!duplicateData.isEmpty()){
589                                         duplicateflag = true;
590                                 }else{
591                                         pEPOptions.setUserCreatedBy(this.getUserInfo(userId));
592                                         pEPOptions.setUserModifiedBy(this.getUserInfo(userId));
593                                         commonClassDao.save(pEPOptions);
594                                 }        
595                         }else{
596                                 if(!isFakeUpdate){
597                                         pEPOptions.setUserModifiedBy(this.getUserInfo(userId));
598                                         pEPOptions.setModifiedDate(new Date());
599                                         commonClassDao.update(pEPOptions);
600                                 }
601                         }
602             String responseString = "";
603             if(duplicateflag){
604                 responseString = "Duplicate";
605             }else{
606                 responseString = mapper.writeValueAsString(commonClassDao.getData(PEPOptions.class));
607             } 
608             if (fromAPI) {
609                 if (responseString!=null && !responseString.equals("Duplicate")) {
610                     if(isFakeUpdate){
611                         responseString = "Exists";
612                     } else {
613                         responseString = "Success";
614                     } 
615                 }
616                 
617                 ModelAndView result = new ModelAndView();
618                 result.setViewName(responseString);
619                 return result;
620             } else {
621                 response.setCharacterEncoding("UTF-8");
622                 response.setContentType("application / json");
623                 request.setCharacterEncoding("UTF-8");
624  
625                 PrintWriter out = response.getWriter();
626                 JSONObject j = new JSONObject("{pepOptionsDictionaryDatas: " + responseString + "}");
627                 out.write(j.toString());
628                 return null;
629             }
630  
631         }catch (Exception e){
632                 LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
633                         response.setCharacterEncoding("UTF-8");
634                         request.setCharacterEncoding("UTF-8");
635                         PrintWriter out = response.getWriter();
636                         out.write(e.getMessage());
637                 }
638                 return null;
639         }
640
641         @RequestMapping(value={"/cl_dictionary/remove_pepOptions"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
642         public ModelAndView removePEPOptions(HttpServletRequest request, HttpServletResponse response) throws Exception {
643                 try{
644                         ObjectMapper mapper = new ObjectMapper();
645                         mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
646                         JsonNode root = mapper.readTree(request.getReader());
647                         PEPOptions pEPOptions = (PEPOptions)mapper.readValue(root.get("data").toString(), PEPOptions.class);
648                         commonClassDao.delete(pEPOptions);
649                         response.setCharacterEncoding("UTF-8");
650                         response.setContentType("application / json");
651                         request.setCharacterEncoding("UTF-8");
652
653                         PrintWriter out = response.getWriter();
654
655                         String responseString = mapper.writeValueAsString(commonClassDao.getData(PEPOptions.class));
656                         JSONObject j = new JSONObject("{pepOptionsDictionaryDatas: " + responseString + "}");
657                         out.write(j.toString());
658
659                         return null;
660                 }
661                 catch (Exception e){
662                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
663                         response.setCharacterEncoding("UTF-8");
664                         request.setCharacterEncoding("UTF-8");
665                         PrintWriter out = response.getWriter();
666                         out.write(e.getMessage());
667                 }
668                 return null;
669         }
670
671         @RequestMapping(value={"/cl_dictionary/save_service"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
672         public ModelAndView saveServiceType(HttpServletRequest request, HttpServletResponse response) throws Exception{
673                 try {
674                         boolean duplicateflag = false;
675             boolean isFakeUpdate = false;
676             boolean fromAPI = false;
677             if (request.getParameter("apiflag")!=null && request.getParameter("apiflag").equalsIgnoreCase("api")) {
678                 fromAPI = true;
679             }
680                         ObjectMapper mapper = new ObjectMapper();
681                         mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
682                         JsonNode root = mapper.readTree(request.getReader());
683             ClosedLoopD2Services serviceData;
684             String userId = null;
685             if (fromAPI) {
686                 serviceData = (ClosedLoopD2Services)mapper.readValue(root.get("dictionaryFields").toString(), ClosedLoopD2Services.class);
687                 userId = "API";
688                 
689                 //check if update operation or create, get id for data to be updated and update attributeData
690                 if (request.getParameter("operation").equals("update")) {
691                     List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(serviceData.getServiceName(), "serviceName", ClosedLoopD2Services.class);
692                     int id = 0;
693                     ClosedLoopD2Services data = (ClosedLoopD2Services) duplicateData.get(0);
694                     id = data.getId();
695                     if(id==0){
696                         isFakeUpdate=true;
697                         serviceData.setId(1);
698                     } else {
699                         serviceData.setId(id);
700                     }
701                     serviceData.setUserCreatedBy(this.getUserInfo(userId));
702                 }
703             } else {
704                 serviceData = (ClosedLoopD2Services)mapper.readValue(root.get("closedLoopServiceDictionaryData").toString(), ClosedLoopD2Services.class);
705                 userId = root.get("userid").textValue();
706             }
707                         if(serviceData.getId() == 0){
708                                 List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(serviceData.getServiceName(), "serviceName", ClosedLoopD2Services.class);
709                                 if(!duplicateData.isEmpty()){
710                                         duplicateflag = true;
711                                 }else{
712                                         serviceData.setUserCreatedBy(this.getUserInfo(userId));
713                                         serviceData.setUserModifiedBy(this.getUserInfo(userId));
714                                         commonClassDao.save(serviceData);
715                                 }
716                         }else{
717                                 if(!isFakeUpdate){
718                                         serviceData.setUserModifiedBy(this.getUserInfo(userId));
719                                         serviceData.setModifiedDate(new Date());
720                                         commonClassDao.update(serviceData); 
721                                 }
722                         }
723             String responseString = "";
724             if(duplicateflag){
725                 responseString = "Duplicate";
726             }else{
727                 responseString = mapper.writeValueAsString(commonClassDao.getData(ClosedLoopD2Services.class));
728             } 
729             if (fromAPI) {
730                 if (responseString!=null && !responseString.equals("Duplicate")) {
731                     if(isFakeUpdate){
732                         responseString = "Exists";
733                     } else {
734                         responseString = "Success";
735                     }
736                 }
737                 ModelAndView result = new ModelAndView();
738                 result.setViewName(responseString);
739                 return result;
740             } else {
741                 response.setCharacterEncoding("UTF-8");
742                 response.setContentType("application / json");
743                 request.setCharacterEncoding("UTF-8");
744  
745                 PrintWriter out = response.getWriter();
746                 JSONObject j = new JSONObject("{closedLoopServiceDictionaryDatas: " + responseString + "}");
747                 out.write(j.toString());
748                 return null;
749             }
750         }catch (Exception e){
751                 LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
752                         response.setCharacterEncoding("UTF-8");
753                         request.setCharacterEncoding("UTF-8");
754                         PrintWriter out = response.getWriter();
755                         out.write(e.getMessage());
756                 }
757                 return null;
758         }
759
760         @RequestMapping(value={"/cl_dictionary/remove_Service"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
761         public ModelAndView removeServiceType(HttpServletRequest request, HttpServletResponse response) throws Exception {
762                 try{
763                         ObjectMapper mapper = new ObjectMapper();
764                         mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
765                         JsonNode root = mapper.readTree(request.getReader());
766                         ClosedLoopD2Services closedLoopD2Services = (ClosedLoopD2Services)mapper.readValue(root.get("data").toString(), ClosedLoopD2Services.class);
767                         commonClassDao.delete(closedLoopD2Services);
768                         response.setCharacterEncoding("UTF-8");
769                         response.setContentType("application / json");
770                         request.setCharacterEncoding("UTF-8");
771
772                         PrintWriter out = response.getWriter();
773
774                         String responseString = mapper.writeValueAsString(commonClassDao.getData(ClosedLoopD2Services.class));
775                         JSONObject j = new JSONObject("{closedLoopServiceDictionaryDatas: " + responseString + "}");
776                         out.write(j.toString());
777
778                         return null;
779                 }
780                 catch (Exception e){
781                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
782                         response.setCharacterEncoding("UTF-8");
783                         request.setCharacterEncoding("UTF-8");
784                         PrintWriter out = response.getWriter();
785                         out.write(e.getMessage());
786                 }
787                 return null;
788         }
789
790         @RequestMapping(value={"/cl_dictionary/save_siteName"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
791         public ModelAndView saveSiteType(HttpServletRequest request, HttpServletResponse response) throws Exception{
792                 try {
793                         boolean duplicateflag = false;
794             boolean isFakeUpdate = false;
795             boolean fromAPI = false;
796             
797             if (request.getParameter("apiflag")!=null && request.getParameter("apiflag").equalsIgnoreCase("api")) {
798                 fromAPI = true;
799             }
800                         ObjectMapper mapper = new ObjectMapper();
801                         mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
802                         JsonNode root = mapper.readTree(request.getReader());
803             ClosedLoopSite siteData;
804             String userId = null;
805             if (fromAPI) {
806                 siteData = (ClosedLoopSite)mapper.readValue(root.get("dictionaryFields").toString(), ClosedLoopSite.class);
807                 userId = "API";
808                 //check if update operation or create, get id for data to be updated and update attributeData
809                 if (request.getParameter("operation").equals("update")) {
810                     List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(siteData.getSiteName(), "siteName", ClosedLoopSite.class);
811                     int id = 0;
812                     ClosedLoopSite data = (ClosedLoopSite) duplicateData.get(0);
813                     id = data.getId();
814                     if(id==0){
815                         isFakeUpdate=true;
816                         siteData.setId(1);
817                     } else {
818                         siteData.setId(id);
819                     }
820                     siteData.setUserCreatedBy(this.getUserInfo(userId));
821                 }
822             } else {
823                 siteData = (ClosedLoopSite)mapper.readValue(root.get("closedLoopSiteDictionaryData").toString(), ClosedLoopSite.class);
824                 userId = root.get("userid").textValue();
825             }
826                         if(siteData.getId() == 0){
827                                 List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(siteData.getSiteName(), "siteName", ClosedLoopSite.class);
828                                 if(!duplicateData.isEmpty()){
829                                         duplicateflag = true;
830                                 }else{
831                                         siteData.setUserCreatedBy(this.getUserInfo(userId));
832                                         siteData.setUserModifiedBy(this.getUserInfo(userId));
833                                         commonClassDao.save(siteData);
834                                 }
835                         }else{
836                                 if(!isFakeUpdate) {
837                                         siteData.setUserModifiedBy(this.getUserInfo(userId));
838                                         siteData.setModifiedDate(new Date());
839                                         commonClassDao.update(siteData);
840                                 }
841                         }
842             String responseString = "";
843             if(duplicateflag){
844                 responseString = "Duplicate";
845             }else{
846                 responseString = mapper.writeValueAsString(commonClassDao.getData(ClosedLoopSite.class));
847             }   
848             
849             if (fromAPI) {
850                 if (responseString!=null && !responseString.equals("Duplicate")) {
851                     if(isFakeUpdate){
852                         responseString = "Exists";
853                     } else {
854                         responseString = "Success";
855                     }
856                 }
857                 ModelAndView result = new ModelAndView();
858                 result.setViewName(responseString);
859                 return result;
860             } else {
861                 response.setCharacterEncoding("UTF-8");
862                 response.setContentType("application / json");
863                 request.setCharacterEncoding("UTF-8");
864  
865                 PrintWriter out = response.getWriter();
866                 JSONObject j = new JSONObject("{closedLoopSiteDictionaryDatas: " + responseString + "}");
867                 out.write(j.toString());
868                 return null;
869             }
870         }catch (Exception e){
871                 LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
872                         response.setCharacterEncoding("UTF-8");
873                         request.setCharacterEncoding("UTF-8");
874                         PrintWriter out = response.getWriter();
875                         out.write(e.getMessage());
876                 }
877                 return null;
878         }
879
880         @RequestMapping(value={"/cl_dictionary/remove_site"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
881         public ModelAndView removeSiteType(HttpServletRequest request, HttpServletResponse response) throws Exception {
882                 try{
883                         ObjectMapper mapper = new ObjectMapper();
884                         mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
885                         JsonNode root = mapper.readTree(request.getReader());
886                         ClosedLoopSite closedLoopSite = (ClosedLoopSite)mapper.readValue(root.get("data").toString(), ClosedLoopSite.class);
887                         commonClassDao.delete(closedLoopSite);
888                         response.setCharacterEncoding("UTF-8");
889                         response.setContentType("application / json");
890                         request.setCharacterEncoding("UTF-8");
891
892                         PrintWriter out = response.getWriter();
893
894                         String responseString = mapper.writeValueAsString(commonClassDao.getData(ClosedLoopSite.class));
895                         JSONObject j = new JSONObject("{closedLoopSiteDictionaryDatas: " + responseString + "}");
896                         out.write(j.toString());
897
898                         return null;
899                 }
900                 catch (Exception e){
901                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
902                         response.setCharacterEncoding("UTF-8");
903                         request.setCharacterEncoding("UTF-8");
904                         PrintWriter out = response.getWriter();
905                         out.write(e.getMessage());
906                 }
907                 return null;
908         }
909
910         @RequestMapping(value={"/cl_dictionary/save_varbind"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
911         public ModelAndView saveVarbind(HttpServletRequest request, HttpServletResponse response) throws Exception{
912                 try {
913                         boolean duplicateflag = false;
914             boolean isFakeUpdate = false;
915             boolean fromAPI = false;
916             if (request.getParameter("apiflag")!=null && request.getParameter("apiflag").equalsIgnoreCase("api")) {
917                 fromAPI = true;
918             }
919                         ObjectMapper mapper = new ObjectMapper();
920                         mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
921                         JsonNode root = mapper.readTree(request.getReader());
922             VarbindDictionary varbindDictionary;
923             String userId = null;
924             if (fromAPI) {
925                 varbindDictionary = (VarbindDictionary)mapper.readValue(root.get("dictionaryFields").toString(), VarbindDictionary.class);
926                 userId = "API";
927                 
928                 //check if update operation or create, get id for data to be updated and update attributeData
929                 if (request.getParameter("operation").equals("update")) {
930                     List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(varbindDictionary.getVarbindName(), "varbindName", VarbindDictionary.class);
931                     int id = 0;
932                     VarbindDictionary data = (VarbindDictionary) duplicateData.get(0);
933                     id = data.getId();
934                     if(id==0){
935                         isFakeUpdate=true;
936                         varbindDictionary.setId(1);
937                     } else {
938                         varbindDictionary.setId(id);
939                     }
940                     varbindDictionary.setUserCreatedBy(this.getUserInfo(userId));
941                 }
942             } else {
943                 varbindDictionary = (VarbindDictionary)mapper.readValue(root.get("varbindDictionaryData").toString(), VarbindDictionary.class);
944                 userId = root.get("userid").textValue();
945             }
946                         if(varbindDictionary.getId() == 0){
947                                 List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(varbindDictionary.getVarbindName(), "varbindName", VarbindDictionary.class);
948                                 if(!duplicateData.isEmpty()){
949                                         duplicateflag = true;
950                                 }else{
951                                         varbindDictionary.setUserCreatedBy(this.getUserInfo(userId));
952                                         varbindDictionary.setUserModifiedBy(this.getUserInfo(userId));
953                                         commonClassDao.save(varbindDictionary);
954                                 }         
955                         }else{
956                                 if(!isFakeUpdate){
957                                         varbindDictionary.setUserModifiedBy(this.getUserInfo(userId));
958                                         varbindDictionary.setModifiedDate(new Date());
959                                         commonClassDao.update(varbindDictionary);
960                                 }
961                         }
962             String responseString = "";
963             if(duplicateflag){
964                 responseString = "Duplicate";
965             }else{
966                 responseString = mapper.writeValueAsString(commonClassDao.getData(VarbindDictionary.class));
967             }
968             
969             if (fromAPI) {
970                 if (responseString!=null && !responseString.equals("Duplicate")) {
971                     if(isFakeUpdate){
972                         responseString = "Exists";
973                     } else {
974                         responseString = "Success";
975                     }
976                 }
977                 ModelAndView result = new ModelAndView();
978                 result.setViewName(responseString);
979                 return result;
980             } else {
981                 response.setCharacterEncoding("UTF-8");
982                 response.setContentType("application / json");
983                 request.setCharacterEncoding("UTF-8");
984  
985                 PrintWriter out = response.getWriter();
986                 JSONObject j = new JSONObject("{varbindDictionaryDatas: " + responseString + "}");
987                 out.write(j.toString());
988                 return null;
989             }
990         }catch (Exception e){
991                 LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
992                         response.setCharacterEncoding("UTF-8");
993                         request.setCharacterEncoding("UTF-8");
994                         PrintWriter out = response.getWriter();
995                         out.write(e.getMessage());
996                 }
997                 return null;
998         }
999
1000         @RequestMapping(value={"/cl_dictionary/remove_varbindDict"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
1001         public ModelAndView removeVarbind(HttpServletRequest request, HttpServletResponse response) throws Exception {
1002                 try{
1003                         ObjectMapper mapper = new ObjectMapper();
1004                         mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
1005                         JsonNode root = mapper.readTree(request.getReader());
1006                         VarbindDictionary varbindDictionary = (VarbindDictionary)mapper.readValue(root.get("data").toString(), VarbindDictionary.class);
1007                         commonClassDao.delete(varbindDictionary);
1008                         response.setCharacterEncoding("UTF-8");
1009                         response.setContentType("application / json");
1010                         request.setCharacterEncoding("UTF-8");
1011
1012                         PrintWriter out = response.getWriter();
1013
1014                         String responseString = mapper.writeValueAsString(commonClassDao.getData(VarbindDictionary.class));
1015                         JSONObject j = new JSONObject("{varbindDictionaryDatas: " + responseString + "}");
1016                         out.write(j.toString());
1017
1018                         return null;
1019                 }
1020                 catch (Exception e){
1021                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
1022                         response.setCharacterEncoding("UTF-8");
1023                         request.setCharacterEncoding("UTF-8");
1024                         PrintWriter out = response.getWriter();
1025                         out.write(e.getMessage());
1026                 }
1027                 return null;
1028         }
1029
1030 }
1031