2  * ============LICENSE_START=======================================================
 
   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
 
  11  *      http://www.apache.org/licenses/LICENSE-2.0
 
  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=========================================================
 
  21 package org.onap.policy.pap.xacml.rest.controller;
 
  23 import java.io.IOException;
 
  24 import java.io.PrintWriter;
 
  25 import java.net.UnknownHostException;
 
  26 import java.util.ArrayList;
 
  27 import java.util.Date;
 
  28 import java.util.HashMap;
 
  29 import java.util.LinkedHashMap;
 
  30 import java.util.List;
 
  33 import javax.servlet.http.HttpServletRequest;
 
  34 import javax.servlet.http.HttpServletResponse;
 
  36 import org.jboss.netty.handler.ipfilter.CIDR;
 
  37 import org.json.JSONObject;
 
  38 import org.onap.policy.common.logging.flexlogger.FlexLogger;
 
  39 import org.onap.policy.common.logging.flexlogger.Logger;
 
  40 import org.onap.policy.pap.xacml.rest.adapters.GridData;
 
  41 import org.onap.policy.pap.xacml.rest.util.JsonMessage;
 
  42 import org.onap.policy.rest.dao.CommonClassDao;
 
  43 import org.onap.policy.rest.jpa.ActionList;
 
  44 import org.onap.policy.rest.jpa.AddressGroup;
 
  45 import org.onap.policy.rest.jpa.FWTag;
 
  46 import org.onap.policy.rest.jpa.FWTagPicker;
 
  47 import org.onap.policy.rest.jpa.FirewallDictionaryList;
 
  48 import org.onap.policy.rest.jpa.GroupServiceList;
 
  49 import org.onap.policy.rest.jpa.PrefixList;
 
  50 import org.onap.policy.rest.jpa.PortList;
 
  51 import org.onap.policy.rest.jpa.ProtocolList;
 
  52 import org.onap.policy.rest.jpa.SecurityZone;
 
  53 import org.onap.policy.rest.jpa.ServiceList;
 
  54 import org.onap.policy.rest.jpa.TermList;
 
  55 import org.onap.policy.rest.jpa.UserInfo;
 
  56 import org.onap.policy.rest.jpa.Zone;
 
  57 import org.onap.policy.xacml.api.XACMLErrorConstants;
 
  58 import org.springframework.beans.factory.annotation.Autowired;
 
  59 import org.springframework.http.MediaType;
 
  60 import org.springframework.stereotype.Controller;
 
  61 import org.springframework.web.bind.annotation.RequestMapping;
 
  62 import org.springframework.web.servlet.ModelAndView;
 
  64 import com.fasterxml.jackson.databind.DeserializationFeature;
 
  65 import com.fasterxml.jackson.databind.JsonNode;
 
  66 import com.fasterxml.jackson.databind.ObjectMapper;
 
  70 public class FirewallDictionaryController {
 
  72         private static final Logger LOGGER  = FlexLogger.getLogger(FirewallDictionaryController.class);
 
  74         private static CommonClassDao commonClassDao;
 
  75         private static String prefixListName = "prefixListName";
 
  76         private static String successMapKey = "successMapKey";
 
  77         private static String successMessage = "success";
 
  78         private static String operation = "operation";
 
  79         private static String getDictionary =  "getDictionary";
 
  80         private static String errorMsg  = "error";
 
  81         private static String dictionaryDBQuery = "dictionaryDBQuery";
 
  82         private static String apiflag = "apiflag";
 
  83         private static String dictionaryFields ="dictionaryFields";
 
  84         private static String update = "update";
 
  85         private static String duplicateResponseString = "Duplicate";
 
  86         private static String successMsg = "Success";
 
  87         private static String utf8 = "UTF-8";
 
  88         private static String applicationJsonContentType = "application / json";
 
  89         private static String existsResponseString = "Exists";
 
  90         private static String protocolName = "protocolName";
 
  91         private static String groupNameStart = "Group_";
 
  92         private static String option = "option";
 
  93         private static String zoneName =  "zoneName";
 
  94         private static String serviceName = "serviceName";
 
  95         private static String termName = "termName";
 
  96         private static String userid = "userid";
 
  97         private static String tagPickerName = "tagPickerName";
 
  98         private static String fwTagPickerDictionaryData = "fwTagPickerDictionaryData";
 
  99         private static String fwTagDictionaryDatas = "fwTagDictionaryDatas";
 
 103         public FirewallDictionaryController(CommonClassDao commonClassDao){
 
 104                 FirewallDictionaryController.commonClassDao = commonClassDao;
 
 107          * This is an empty constructor
 
 109         public FirewallDictionaryController(){} 
 
 111         public UserInfo getUserInfo(String loginId){
 
 112                 return (UserInfo) commonClassDao.getEntityItem(UserInfo.class, "userLoginId", loginId); 
 
 116         @RequestMapping(value={"/get_PrefixListDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 
 117         public void getPrefixListDictionaryEntityDataByName(HttpServletResponse response){
 
 119                         Map<String, Object> model = new HashMap<>();
 
 120                         ObjectMapper mapper = new ObjectMapper();
 
 121                         model.put("prefixListDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(PrefixList.class, prefixListName)));
 
 122                         JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 
 123                         JSONObject j = new JSONObject(msg);
 
 124                         response.getWriter().write(j.toString());
 
 127                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 
 131         @RequestMapping(value={"/get_PrefixListData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 
 132         public void getPrefixListDictionaryEntityData(HttpServletResponse response){
 
 134                         Map<String, Object> model = new HashMap<>();
 
 135                         ObjectMapper mapper = new ObjectMapper();
 
 136                         model.put("prefixListDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(PrefixList.class)));
 
 137                         JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 
 138                         JSONObject j = new JSONObject(msg);
 
 139                         response.addHeader(successMapKey, successMessage); 
 
 140                         response.addHeader(operation, getDictionary);
 
 141                         response.getWriter().write(j.toString());
 
 144                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW, e);
 
 145                         response.setStatus(HttpServletResponse.SC_BAD_REQUEST);                             
 
 146                         response.addHeader(errorMsg, dictionaryDBQuery);
 
 150         @RequestMapping(value={"/fw_dictionary/save_prefixList"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 
 151         public ModelAndView savePrefixListDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException{
 
 153                         boolean duplicateflag = false;
 
 154                         boolean isFakeUpdate = false;
 
 155                         boolean fromAPI = false;
 
 156                         if (request.getParameter(apiflag)!=null && ("api").equalsIgnoreCase(request.getParameter(apiflag))) {
 
 159                         ObjectMapper mapper = new ObjectMapper();
 
 160                         mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 
 161                         JsonNode root = mapper.readTree(request.getReader());
 
 162                         PrefixList prefixList;
 
 164                                 prefixList = (PrefixList)mapper.readValue(root.get(dictionaryFields).toString(), PrefixList.class);
 
 166                                 //check if update operation or create, get id for data to be updated and update attributeData
 
 167                                 if ((update).equals(request.getParameter(operation))) {
 
 168                                         List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(prefixList.getPrefixListName(), prefixListName, PrefixList.class);
 
 169                                         PrefixList data = (PrefixList) duplicateData.get(0);
 
 170                                         int id = data.getId();
 
 175                                                 prefixList.setId(id);
 
 179                                 prefixList = (PrefixList)mapper.readValue(root.get("prefixListDictionaryData").toString(), PrefixList.class);
 
 181                         if(prefixList.getId() == 0){
 
 182                                 List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(prefixList.getPrefixListName(), prefixListName, PrefixList.class);
 
 183                                 if(!duplicateData.isEmpty()){
 
 184                                         duplicateflag = true;
 
 186                                         commonClassDao.save(prefixList);
 
 190                                         commonClassDao.update(prefixList); 
 
 193                         String responseString = "";
 
 195                                 responseString = duplicateResponseString;
 
 197                                 responseString = mapper.writeValueAsString(commonClassDao.getData(PrefixList.class));
 
 201                                 if (responseString!=null && !(duplicateResponseString).equals(responseString)) {
 
 203                                                 responseString = existsResponseString;
 
 205                                                 responseString = successMsg;
 
 208                                 ModelAndView result = new ModelAndView();
 
 209                                 result.setViewName(responseString);
 
 212                                 response.setCharacterEncoding(utf8);
 
 213                                 response.setContentType(applicationJsonContentType);
 
 214                                 request.setCharacterEncoding(utf8);
 
 216                                 PrintWriter out = response.getWriter();
 
 217                                 JSONObject j = new JSONObject("{prefixListDictionaryDatas: " + responseString + "}");
 
 218                                 out.write(j.toString());
 
 221                 }catch (Exception e){
 
 222                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW, e);
 
 223                         response.setCharacterEncoding(utf8);
 
 224                         request.setCharacterEncoding(utf8);
 
 225                         PrintWriter out = response.getWriter();
 
 226                         out.write(e.getMessage());
 
 231         @RequestMapping(value={"/fw_dictionary/remove_PrefixList"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 
 232         public ModelAndView removePrefixListDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException{
 
 234                         ObjectMapper mapper = new ObjectMapper();
 
 235                         mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 
 236                         JsonNode root = mapper.readTree(request.getReader());
 
 237                         PrefixList prefixList = (PrefixList)mapper.readValue(root.get("data").toString(), PrefixList.class);
 
 238                         commonClassDao.delete(prefixList);
 
 239                         response.setCharacterEncoding(utf8);
 
 240                         response.setContentType(applicationJsonContentType);
 
 241                         request.setCharacterEncoding(utf8);
 
 243                         PrintWriter out = response.getWriter();
 
 244                         String responseString = mapper.writeValueAsString(commonClassDao.getData(PrefixList.class));
 
 245                         JSONObject j = new JSONObject("{prefixListDictionaryDatas: " + responseString + "}");
 
 246                         out.write(j.toString());
 
 250                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 
 251                         response.setCharacterEncoding(utf8);
 
 252                         request.setCharacterEncoding(utf8);
 
 253                         PrintWriter out = response.getWriter();
 
 254                         out.write(e.getMessage());
 
 259         @RequestMapping(value={"/fw_dictionary/validate_prefixList"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 
 260         public ModelAndView validatePrefixListDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException{
 
 262                         ObjectMapper mapper = new ObjectMapper();
 
 263                         mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 
 264                         JsonNode root = mapper.readTree(request.getReader());
 
 265                         PrefixList prefixList = (PrefixList)mapper.readValue(root.get("prefixListDictionaryData").toString(), PrefixList.class);
 
 266                         String responseValidation = successMessage;
 
 268                                 CIDR.newCIDR(prefixList.getPrefixListValue());
 
 269                         }catch(UnknownHostException e){
 
 271                                 responseValidation = errorMsg;
 
 273                         response.setCharacterEncoding(utf8);
 
 274                         response.setContentType(applicationJsonContentType);
 
 275                         request.setCharacterEncoding(utf8);
 
 277                         PrintWriter out = response.getWriter();
 
 278                         JSONObject j = new JSONObject("{result: " + responseValidation + "}");
 
 279                         out.write(j.toString());
 
 283                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 
 284                         response.setCharacterEncoding(utf8);
 
 285                         request.setCharacterEncoding(utf8);
 
 286                         PrintWriter out = response.getWriter();
 
 287                         out.write(e.getMessage());
 
 292         @RequestMapping(value={"/get_PortListData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 
 293         public void getPortListDictionaryEntityData(HttpServletResponse response){
 
 295                         Map<String, Object> model = new HashMap<>();
 
 296                         ObjectMapper mapper = new ObjectMapper();
 
 297                         model.put("portListDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(PortList.class)));
 
 298                         JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 
 299                         JSONObject j = new JSONObject(msg);
 
 300                         response.addHeader(successMapKey, successMessage); 
 
 301                         response.addHeader(operation, getDictionary);
 
 302                         response.getWriter().write(j.toString());
 
 305                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 
 306                         response.setStatus(HttpServletResponse.SC_BAD_REQUEST);                             
 
 307                         response.addHeader(errorMsg, dictionaryDBQuery);
 
 311         @RequestMapping(value={"/fw_dictionary/save_portName"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 
 312         public ModelAndView savePortListDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException{
 
 314                         boolean duplicateflag = false;
 
 315                         ObjectMapper mapper = new ObjectMapper();
 
 316                         mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 
 317                         JsonNode root = mapper.readTree(request.getReader());
 
 318                         PortList portList = (PortList)mapper.readValue(root.get("portListDictionaryData").toString(), PortList.class);
 
 319                         if(portList.getId() == 0){
 
 320                                 List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(portList.getPortName(), "portName", PortList.class);
 
 321                                 if(!duplicateData.isEmpty()){
 
 322                                         duplicateflag = true;
 
 324                                         commonClassDao.save(portList);
 
 327                                 commonClassDao.update(portList); 
 
 329                         response.setCharacterEncoding(utf8);
 
 330                         response.setContentType(applicationJsonContentType);
 
 331                         request.setCharacterEncoding(utf8);
 
 333                         PrintWriter out = response.getWriter();
 
 334                         String responseString = "";
 
 336                                 responseString = duplicateResponseString;
 
 338                                 responseString = mapper.writeValueAsString(commonClassDao.getData(PortList.class));
 
 340                         JSONObject j = new JSONObject("{portListDictionaryDatas: " + responseString + "}");
 
 342                         out.write(j.toString());
 
 347                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 
 348                         response.setCharacterEncoding(utf8);
 
 349                         request.setCharacterEncoding(utf8);
 
 350                         PrintWriter out = response.getWriter();
 
 351                         out.write(e.getMessage());
 
 356         @RequestMapping(value={"/fw_dictionary/remove_PortList"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 
 357         public ModelAndView removePortListDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException{
 
 359                         ObjectMapper mapper = new ObjectMapper();
 
 360                         mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 
 361                         JsonNode root = mapper.readTree(request.getReader());
 
 362                         PortList portList = (PortList)mapper.readValue(root.get("data").toString(), PortList.class);
 
 363                         commonClassDao.delete(portList);
 
 364                         response.setCharacterEncoding(utf8);
 
 365                         response.setContentType(applicationJsonContentType);
 
 366                         request.setCharacterEncoding(utf8);
 
 368                         PrintWriter out = response.getWriter();
 
 369                         String responseString = mapper.writeValueAsString(commonClassDao.getData(PortList.class));
 
 370                         JSONObject j = new JSONObject("{portListDictionaryDatas: " + responseString + "}");
 
 371                         out.write(j.toString());
 
 375                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 
 376                         response.setCharacterEncoding(utf8);
 
 377                         request.setCharacterEncoding(utf8);
 
 378                         PrintWriter out = response.getWriter();
 
 379                         out.write(e.getMessage());
 
 384         @RequestMapping(value={"/get_ProtocolListData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 
 385         public void getProtocolListDictionaryEntityData(HttpServletResponse response){
 
 387                         Map<String, Object> model = new HashMap<>();
 
 388                         ObjectMapper mapper = new ObjectMapper();
 
 389                         model.put("protocolListDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(ProtocolList.class)));
 
 390                         JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 
 391                         JSONObject j = new JSONObject(msg);
 
 392                         response.addHeader(successMapKey, successMessage); 
 
 393                         response.addHeader(operation, getDictionary);
 
 394                         response.getWriter().write(j.toString());
 
 397                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 
 398                         response.setStatus(HttpServletResponse.SC_BAD_REQUEST);                             
 
 399                         response.addHeader(errorMsg, dictionaryDBQuery);
 
 403         @RequestMapping(value={"/get_ProtocolListDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 
 404         public void getProtocolListDictionaryEntityDataByName(HttpServletResponse response){
 
 406                         Map<String, Object> model = new HashMap<>();
 
 407                         ObjectMapper mapper = new ObjectMapper();
 
 408                         model.put("protocolListDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(ProtocolList.class, protocolName)));
 
 409                         JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 
 410                         JSONObject j = new JSONObject(msg);
 
 411                         response.getWriter().write(j.toString());
 
 414                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 
 418         @RequestMapping(value={"/fw_dictionary/save_protocolList"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 
 419         public ModelAndView saveProtocolListDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException{
 
 421                         boolean duplicateflag = false;
 
 422                         boolean isFakeUpdate = false;
 
 423                         boolean fromAPI = false;
 
 424                         if (request.getParameter(apiflag)!=null && ("api").equalsIgnoreCase(request.getParameter(apiflag))) {
 
 427                         ObjectMapper mapper = new ObjectMapper();
 
 428                         mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 
 429                         JsonNode root = mapper.readTree(request.getReader());
 
 430                         ProtocolList protocolList;
 
 432                                 protocolList = (ProtocolList)mapper.readValue(root.get(dictionaryFields).toString(), ProtocolList.class);
 
 434                                 //check if update operation or create, get id for data to be updated and update attributeData
 
 435                                 if ((update).equals(request.getParameter(operation))) {
 
 436                                         List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(protocolList.getProtocolName(), protocolName, ProtocolList.class);
 
 437                                         ProtocolList data = (ProtocolList) duplicateData.get(0);
 
 438                                         int id = data.getId();
 
 441                                                 protocolList.setId(1);
 
 443                                                 protocolList.setId(id);
 
 447                                 protocolList = (ProtocolList)mapper.readValue(root.get("protocolListDictionaryData").toString(), ProtocolList.class);
 
 449                         if(protocolList.getId() == 0){
 
 450                                 List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(protocolList.getProtocolName(), protocolName, ProtocolList.class);
 
 451                                 if(!duplicateData.isEmpty()){
 
 452                                         duplicateflag = true;
 
 454                                         commonClassDao.save(protocolList);
 
 458                                         commonClassDao.update(protocolList);
 
 461                         String responseString = "";
 
 463                                 responseString = duplicateResponseString;
 
 465                                 responseString = mapper.writeValueAsString(commonClassDao.getData(ProtocolList.class));
 
 469                                 if (responseString!=null && !(duplicateResponseString).equals(responseString)) {
 
 471                                                 responseString = existsResponseString;
 
 473                                                 responseString = successMsg;
 
 476                                 ModelAndView result = new ModelAndView();
 
 477                                 result.setViewName(responseString);
 
 480                                 response.setCharacterEncoding(utf8);
 
 481                                 response.setContentType(applicationJsonContentType);
 
 482                                 request.setCharacterEncoding(utf8);
 
 484                                 PrintWriter out = response.getWriter();
 
 485                                 JSONObject j = new JSONObject("{protocolListDictionaryDatas: " + responseString + "}");
 
 486                                 out.write(j.toString());
 
 489                 }catch (Exception e){
 
 490                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 
 491                         response.setCharacterEncoding(utf8);
 
 492                         request.setCharacterEncoding(utf8);
 
 493                         PrintWriter out = response.getWriter();
 
 494                         out.write(e.getMessage());
 
 499         @RequestMapping(value={"/fw_dictionary/remove_protocol"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 
 500         public ModelAndView removeProtocolListDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException{
 
 502                         ObjectMapper mapper = new ObjectMapper();
 
 503                         mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 
 504                         JsonNode root = mapper.readTree(request.getReader());
 
 505                         ProtocolList protocolList = (ProtocolList)mapper.readValue(root.get("data").toString(), ProtocolList.class);
 
 506                         commonClassDao.delete(protocolList);
 
 507                         response.setCharacterEncoding(utf8);
 
 508                         response.setContentType(applicationJsonContentType);
 
 509                         request.setCharacterEncoding(utf8);
 
 511                         PrintWriter out = response.getWriter();
 
 513                         String responseString = mapper.writeValueAsString(commonClassDao.getData(ProtocolList.class));
 
 514                         JSONObject j = new JSONObject("{protocolListDictionaryDatas: " + responseString + "}");
 
 515                         out.write(j.toString());
 
 519                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 
 520                         response.setCharacterEncoding(utf8);
 
 521                         request.setCharacterEncoding(utf8);
 
 522                         PrintWriter out = response.getWriter();
 
 523                         out.write(e.getMessage());
 
 528         @RequestMapping(value={"/get_AddressGroupDictionaryDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 
 529         public void getAddressGroupDictionaryEntityDataByName(HttpServletResponse response){
 
 531                         Map<String, Object> model = new HashMap<>();
 
 532                         ObjectMapper mapper = new ObjectMapper();
 
 533                         model.put("addressGroupDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(AddressGroup.class, "name")));
 
 534                         JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 
 535                         JSONObject j = new JSONObject(msg);
 
 536                         response.getWriter().write(j.toString());
 
 539                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 
 543         @RequestMapping(value={"/get_AddressGroupData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 
 544         public void getAddressGroupDictionaryEntityData(HttpServletResponse response){
 
 546                         Map<String, Object> model = new HashMap<>();
 
 547                         ObjectMapper mapper = new ObjectMapper();
 
 548                         model.put("addressGroupDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(AddressGroup.class)));
 
 549                         JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 
 550                         JSONObject j = new JSONObject(msg);
 
 551                         response.addHeader(successMapKey, successMessage); 
 
 552                         response.addHeader(operation, getDictionary);
 
 553                         response.getWriter().write(j.toString());
 
 556                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 
 557                         response.setStatus(HttpServletResponse.SC_BAD_REQUEST);                             
 
 558                         response.addHeader(errorMsg, dictionaryDBQuery);
 
 562         @RequestMapping(value={"/fw_dictionary/save_addressGroup"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 
 563         public ModelAndView saveAddressGroupDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException{
 
 565                         boolean duplicateflag = false;
 
 566                         boolean isFakeUpdate = false;
 
 567                         boolean fromAPI = false;
 
 568                         if (request.getParameter(apiflag)!=null && ("api").equalsIgnoreCase(request.getParameter(apiflag))) {
 
 571                         ObjectMapper mapper = new ObjectMapper();
 
 572                         mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 
 573                         JsonNode root = mapper.readTree(request.getReader());
 
 574                         AddressGroup addressGroup;
 
 577                                 addressGroup = (AddressGroup)mapper.readValue(root.get(dictionaryFields).toString(), AddressGroup.class);
 
 578                                 gridData = (GridData)mapper.readValue(root.get(dictionaryFields).toString(), GridData.class);
 
 580                                 if(!addressGroup.getGroupName().startsWith(groupNameStart)){
 
 581                                         String groupName = groupNameStart+addressGroup.getGroupName();
 
 582                                         addressGroup.setGroupName(groupName);
 
 585                                 //check if update operation or create, get id for data to be updated and update attributeData
 
 586                                 if ((update).equals(request.getParameter(operation))) {
 
 587                                         List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(addressGroup.getGroupName(), "name", AddressGroup.class);
 
 588                                         AddressGroup data = (AddressGroup) duplicateData.get(0);
 
 589                                         int id = data.getId();
 
 592                                                 addressGroup.setId(1);
 
 594                                                 addressGroup.setId(id);
 
 598                                 addressGroup = (AddressGroup)mapper.readValue(root.get("addressGroupDictionaryData").toString(), AddressGroup.class);
 
 599                                 gridData = (GridData)mapper.readValue(root.get("addressGroupDictionaryData").toString(), GridData.class);
 
 600                                 if(!addressGroup.getGroupName().startsWith(groupNameStart)){
 
 601                                         String groupName = groupNameStart+addressGroup.getGroupName();
 
 602                                         addressGroup.setGroupName(groupName);
 
 605                         String userValue = "";
 
 607                         if(!gridData.getAttributes().isEmpty()){
 
 608                                 for(Object attribute : gridData.getAttributes()){
 
 609                                         if(attribute instanceof LinkedHashMap<?, ?>){
 
 610                                                 String key = ((LinkedHashMap<?, ?>) attribute).get(option).toString();
 
 612                                                         userValue = userValue + ",";
 
 614                                                 userValue = userValue + key ;
 
 619                         addressGroup.setServiceList(userValue);
 
 620                         if(addressGroup.getId() == 0){
 
 621                                 List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(addressGroup.getGroupName(), "name", AddressGroup.class);
 
 622                                 if(!duplicateData.isEmpty()){
 
 623                                         duplicateflag = true;
 
 625                                         commonClassDao.save(addressGroup);
 
 629                                         commonClassDao.update(addressGroup); 
 
 632                         String responseString = "";
 
 634                                 responseString = duplicateResponseString;
 
 636                                 responseString = mapper.writeValueAsString(commonClassDao.getData(AddressGroup.class));
 
 639                                 if (responseString!=null && !(duplicateResponseString).equals(responseString)) {
 
 641                                                 responseString = existsResponseString;
 
 643                                                 responseString = successMsg;
 
 646                                 ModelAndView result = new ModelAndView();
 
 647                                 result.setViewName(responseString);
 
 650                                 response.setCharacterEncoding(utf8);
 
 651                                 response.setContentType(applicationJsonContentType);
 
 652                                 request.setCharacterEncoding(utf8);
 
 654                                 PrintWriter out = response.getWriter();
 
 655                                 JSONObject j = new JSONObject("{addressGroupDictionaryDatas: " + responseString + "}");
 
 656                                 out.write(j.toString());
 
 659                 }catch (Exception e){
 
 660                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 
 661                         response.setCharacterEncoding(utf8);
 
 662                         request.setCharacterEncoding(utf8);
 
 663                         PrintWriter out = response.getWriter();
 
 664                         out.write(e.getMessage());
 
 669         @RequestMapping(value={"/fw_dictionary/remove_AddressGroup"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 
 670         public ModelAndView removeAddressGroupDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException{
 
 672                         ObjectMapper mapper = new ObjectMapper();
 
 673                         mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 
 674                         JsonNode root = mapper.readTree(request.getReader());
 
 675                         AddressGroup addressGroup = (AddressGroup)mapper.readValue(root.get("data").toString(), AddressGroup.class);
 
 676                         commonClassDao.delete(addressGroup);
 
 677                         response.setCharacterEncoding(utf8);
 
 678                         response.setContentType(applicationJsonContentType);
 
 679                         request.setCharacterEncoding(utf8);
 
 681                         PrintWriter out = response.getWriter();
 
 683                         String responseString = mapper.writeValueAsString(commonClassDao.getData(AddressGroup.class));
 
 684                         JSONObject j = new JSONObject("{addressGroupDictionaryDatas: " + responseString + "}");
 
 685                         out.write(j.toString());
 
 689                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 
 690                         response.setCharacterEncoding(utf8);
 
 691                         request.setCharacterEncoding(utf8);
 
 692                         PrintWriter out = response.getWriter();
 
 693                         out.write(e.getMessage());
 
 698         @RequestMapping(value={"/get_ActionListDictionaryDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 
 699         public void getActionListDictionaryEntityDataByName(HttpServletResponse response){
 
 701                         Map<String, Object> model = new HashMap<>();
 
 702                         ObjectMapper mapper = new ObjectMapper();
 
 703                         List<Object> list = commonClassDao.getData(ActionList.class);
 
 704                         List<String> dictList = new ArrayList<>();
 
 705                         for(int i = 0; i < list.size(); i++){
 
 706                                 ActionList dict = (ActionList) list.get(i);
 
 707                                 dictList.add(dict.getActionName());
 
 709                         model.put("actionListDictionaryDatas", mapper.writeValueAsString(dictList));
 
 710                         JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 
 711                         JSONObject j = new JSONObject(msg);
 
 712                         response.getWriter().write(j.toString());
 
 715                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 
 719         @RequestMapping(value={"/get_ActionListData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 
 720         public void getActionListDictionaryEntityData(HttpServletResponse response){
 
 722                         Map<String, Object> model = new HashMap<>();
 
 723                         ObjectMapper mapper = new ObjectMapper();
 
 724                         model.put("actionListDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(ActionList.class)));
 
 725                         JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 
 726                         JSONObject j = new JSONObject(msg);
 
 727                         response.addHeader(successMapKey, successMessage); 
 
 728                         response.addHeader(operation, getDictionary);
 
 729                         response.getWriter().write(j.toString());
 
 732                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 
 733                         response.setStatus(HttpServletResponse.SC_BAD_REQUEST);                             
 
 734                         response.addHeader(errorMsg, dictionaryDBQuery);
 
 738         @RequestMapping(value={"/fw_dictionary/save_ActionList"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 
 739         public ModelAndView saveActionListDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException{
 
 741                         boolean duplicateflag = false;
 
 742                         boolean isFakeUpdate = false;
 
 743                         boolean fromAPI = false;
 
 744                         if (request.getParameter(apiflag)!=null && ("api").equalsIgnoreCase(request.getParameter(apiflag))) {
 
 747                         ObjectMapper mapper = new ObjectMapper();
 
 748                         mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 
 749                         JsonNode root = mapper.readTree(request.getReader());
 
 750                         ActionList actionList;
 
 752                                 actionList = (ActionList)mapper.readValue(root.get(dictionaryFields).toString(), ActionList.class);
 
 754                                 //check if update operation or create, get id for data to be updated and update attributeData
 
 755                                 if ((update).equals(request.getParameter(operation))) {
 
 756                                         List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(actionList.getActionName(), "actionName", ActionList.class);
 
 757                                         ActionList data = (ActionList) duplicateData.get(0);
 
 758                                         int id = data.getId();
 
 763                                                 actionList.setId(id);
 
 767                                 actionList = (ActionList)mapper.readValue(root.get("actionListDictionaryData").toString(), ActionList.class);
 
 769                         if(actionList.getId() == 0){
 
 770                                 List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(actionList.getActionName(), "actionName", ActionList.class);
 
 771                                 if(!duplicateData.isEmpty()){
 
 772                                         duplicateflag = true;
 
 774                                         commonClassDao.save(actionList);
 
 778                                         commonClassDao.update(actionList);
 
 781                         String responseString = "";
 
 783                                 responseString = duplicateResponseString;
 
 785                                 responseString = mapper.writeValueAsString(commonClassDao.getData(ActionList.class));
 
 789                                 if (responseString!=null && !(duplicateResponseString).equals(responseString)) {
 
 791                                                 responseString = existsResponseString;
 
 793                                                 responseString = successMsg;
 
 796                                 ModelAndView result = new ModelAndView();
 
 797                                 result.setViewName(responseString);
 
 800                                 response.setCharacterEncoding(utf8);
 
 801                                 response.setContentType(applicationJsonContentType);
 
 802                                 request.setCharacterEncoding(utf8);
 
 804                                 PrintWriter out = response.getWriter();
 
 805                                 JSONObject j = new JSONObject("{actionListDictionaryDatas: " + responseString + "}");
 
 806                                 out.write(j.toString());
 
 809                 }catch (Exception e){
 
 810                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 
 811                         response.setCharacterEncoding(utf8);
 
 812                         request.setCharacterEncoding(utf8);
 
 813                         PrintWriter out = response.getWriter();
 
 814                         out.write(e.getMessage());
 
 819         @RequestMapping(value={"/fw_dictionary/remove_ActionList"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 
 820         public ModelAndView removeActionListDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException{
 
 822                         ObjectMapper mapper = new ObjectMapper();
 
 823                         mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 
 824                         JsonNode root = mapper.readTree(request.getReader());
 
 825                         ActionList actionList = (ActionList)mapper.readValue(root.get("data").toString(), ActionList.class);
 
 826                         commonClassDao.delete(actionList);
 
 827                         response.setCharacterEncoding(utf8);
 
 828                         response.setContentType(applicationJsonContentType);
 
 829                         request.setCharacterEncoding(utf8);
 
 831                         PrintWriter out = response.getWriter();
 
 832                         String responseString = mapper.writeValueAsString(commonClassDao.getData(ActionList.class));
 
 833                         JSONObject j = new JSONObject("{actionListDictionaryDatas: " + responseString + "}");
 
 834                         out.write(j.toString());
 
 838                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 
 839                         response.setCharacterEncoding(utf8);
 
 840                         request.setCharacterEncoding(utf8);
 
 841                         PrintWriter out = response.getWriter();
 
 842                         out.write(e.getMessage());
 
 847         @RequestMapping(value={"/get_ServiceGroupData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 
 848         public void getServiceGroupDictionaryEntityData(HttpServletResponse response){
 
 850                         Map<String, Object> model = new HashMap<>();
 
 851                         ObjectMapper mapper = new ObjectMapper();
 
 852                         model.put("serviceGroupDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(GroupServiceList.class)));
 
 853                         JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 
 854                         JSONObject j = new JSONObject(msg);
 
 855                         response.addHeader(successMapKey, successMessage); 
 
 856                         response.addHeader(operation, getDictionary);
 
 857                         response.getWriter().write(j.toString());
 
 860                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 
 861                         response.setStatus(HttpServletResponse.SC_BAD_REQUEST);                             
 
 862                         response.addHeader(errorMsg, dictionaryDBQuery);
 
 866         @RequestMapping(value={"/get_ServiceGroupDictionaryDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 
 867         public void getServiceGroupDictionaryEntityDataByName(HttpServletResponse response){
 
 869                         Map<String, Object> model = new HashMap<>();
 
 870                         ObjectMapper mapper = new ObjectMapper();
 
 871                         model.put("serviceGroupDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(GroupServiceList.class, "name")));
 
 872                         JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 
 873                         JSONObject j = new JSONObject(msg);
 
 874                         response.getWriter().write(j.toString());
 
 877                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 
 881         @RequestMapping(value={"/fw_dictionary/save_serviceGroup"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 
 882         public ModelAndView saveServiceGroupDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException{
 
 884                         boolean duplicateflag = false;
 
 885                         boolean isFakeUpdate = false;
 
 886                         boolean fromAPI = false;
 
 887                         if (request.getParameter(apiflag)!=null && ("api").equalsIgnoreCase(request.getParameter(apiflag))) {
 
 890                         ObjectMapper mapper = new ObjectMapper();
 
 891                         mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 
 892                         JsonNode root = mapper.readTree(request.getReader());
 
 893                         GroupServiceList groupServiceList;
 
 896                                 groupServiceList = (GroupServiceList)mapper.readValue(root.get(dictionaryFields).toString(), GroupServiceList.class);
 
 897                                 gridData = (GridData)mapper.readValue(root.get(dictionaryFields).toString(), GridData.class);
 
 899                                 if(!groupServiceList.getGroupName().startsWith(groupNameStart)){
 
 900                                         String groupName = groupNameStart+groupServiceList.getGroupName();
 
 901                                         groupServiceList.setGroupName(groupName);
 
 903                                 //check if update operation or create, get id for data to be updated and update attributeData
 
 904                                 if ((update).equals(request.getParameter(operation))) {
 
 905                                         List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(groupServiceList.getGroupName(), "name", GroupServiceList.class);
 
 906                                         GroupServiceList data = (GroupServiceList) duplicateData.get(0);
 
 907                                         int id = data.getId();
 
 911                                                 groupServiceList.setId(1);
 
 913                                                 groupServiceList.setId(id);
 
 917                                 groupServiceList = (GroupServiceList)mapper.readValue(root.get("serviceGroupDictionaryData").toString(), GroupServiceList.class);
 
 918                                 gridData = (GridData)mapper.readValue(root.get("serviceGroupDictionaryData").toString(), GridData.class);
 
 920                         if(!groupServiceList.getGroupName().startsWith(groupNameStart)){
 
 921                                 String groupName = groupNameStart+groupServiceList.getGroupName();
 
 922                                 groupServiceList.setGroupName(groupName);
 
 924                         String userValue = "";
 
 926                         if(!gridData.getAttributes().isEmpty()){
 
 927                                 for(Object attribute : gridData.getAttributes()){
 
 928                                         if(attribute instanceof LinkedHashMap<?, ?>){
 
 929                                                 String key = ((LinkedHashMap<?, ?>) attribute).get(option).toString();
 
 931                                                         userValue = userValue + ",";
 
 933                                                 userValue = userValue + key ;
 
 938                         groupServiceList.setServiceList(userValue);
 
 939                         if(groupServiceList.getId() == 0){
 
 940                                 List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(groupServiceList.getGroupName(), "name", GroupServiceList.class);
 
 941                                 if(!duplicateData.isEmpty()){
 
 942                                         duplicateflag = true;
 
 944                                         commonClassDao.save(groupServiceList);
 
 948                                         commonClassDao.update(groupServiceList); 
 
 951                         String responseString = "";
 
 953                                 responseString = duplicateResponseString;
 
 955                                 responseString = mapper.writeValueAsString(commonClassDao.getData(GroupServiceList.class));
 
 959                                 if (responseString!=null && !(duplicateResponseString).equals(responseString)) {
 
 961                                                 responseString = existsResponseString;
 
 963                                                 responseString = successMsg;
 
 966                                 ModelAndView result = new ModelAndView();
 
 967                                 result.setViewName(responseString);
 
 970                                 response.setCharacterEncoding(utf8);
 
 971                                 response.setContentType(applicationJsonContentType);
 
 972                                 request.setCharacterEncoding(utf8);
 
 974                                 PrintWriter out = response.getWriter();
 
 975                                 JSONObject j = new JSONObject("{serviceGroupDictionaryDatas: " + responseString + "}");
 
 976                                 out.write(j.toString());
 
 979                 }catch (Exception e){
 
 980                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 
 981                         response.setCharacterEncoding(utf8);
 
 982                         request.setCharacterEncoding(utf8);
 
 983                         PrintWriter out = response.getWriter();
 
 984                         out.write(e.getMessage());
 
 989         @RequestMapping(value={"/fw_dictionary/remove_serviceGroup"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 
 990         public ModelAndView removeServiceGroupDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException{
 
 992                         ObjectMapper mapper = new ObjectMapper();
 
 993                         mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 
 994                         JsonNode root = mapper.readTree(request.getReader());
 
 995                         GroupServiceList groupServiceList = (GroupServiceList)mapper.readValue(root.get("data").toString(), GroupServiceList.class);
 
 996                         commonClassDao.delete(groupServiceList);
 
 997                         response.setCharacterEncoding(utf8);
 
 998                         response.setContentType(applicationJsonContentType);
 
 999                         request.setCharacterEncoding(utf8);
 
1001                         PrintWriter out = response.getWriter();
 
1003                         String responseString = mapper.writeValueAsString(commonClassDao.getData(GroupServiceList.class));
 
1004                         JSONObject j = new JSONObject("{serviceGroupDictionaryDatas: " + responseString + "}");
 
1005                         out.write(j.toString());
 
1009                 catch (Exception e){
 
1011                         response.setCharacterEncoding(utf8);
 
1012                         request.setCharacterEncoding(utf8);
 
1013                         PrintWriter out = response.getWriter();
 
1014                         out.write(e.getMessage());
 
1019         @RequestMapping(value={"/get_SecurityZoneDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 
1020         public void getSecurityZoneDictionaryEntityDataByName(HttpServletResponse response){
 
1022                         Map<String, Object> model = new HashMap<>();
 
1023                         ObjectMapper mapper = new ObjectMapper();
 
1024                         model.put("securityZoneDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(SecurityZone.class, zoneName)));
 
1025                         JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 
1026                         JSONObject j = new JSONObject(msg);
 
1027                         response.getWriter().write(j.toString());
 
1029                 catch (Exception e){
 
1030                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 
1034         @RequestMapping(value={"/get_SecurityZoneData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 
1035         public void getSecurityZoneDictionaryEntityData(HttpServletResponse response){
 
1037                         Map<String, Object> model = new HashMap<>();
 
1038                         ObjectMapper mapper = new ObjectMapper();
 
1039                         model.put("securityZoneDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(SecurityZone.class)));
 
1040                         JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 
1041                         JSONObject j = new JSONObject(msg);
 
1042                         response.addHeader(successMapKey, successMessage); 
 
1043                         response.addHeader(operation, getDictionary);
 
1044                         response.getWriter().write(j.toString());
 
1046                 catch (Exception e){
 
1047                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 
1048                         response.setStatus(HttpServletResponse.SC_BAD_REQUEST);                             
 
1049                         response.addHeader(errorMsg, dictionaryDBQuery);
 
1053         @RequestMapping(value={"/fw_dictionary/save_securityZone"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 
1054         public ModelAndView saveSecurityZoneDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException{
 
1056                         boolean duplicateflag = false;
 
1057                         boolean isFakeUpdate = false;
 
1058                         boolean fromAPI = false;
 
1059                         if (request.getParameter(apiflag)!=null && ("api").equalsIgnoreCase(request.getParameter(apiflag))) {
 
1062                         ObjectMapper mapper = new ObjectMapper();
 
1063                         mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 
1064                         JsonNode root = mapper.readTree(request.getReader());
 
1065                         SecurityZone securityZone;
 
1067                                 securityZone = (SecurityZone)mapper.readValue(root.get(dictionaryFields).toString(), SecurityZone.class);
 
1069                                 //check if update operation or create, get id for data to be updated and update attributeData
 
1070                                 if ((update).equals(request.getParameter(operation))) {
 
1071                                         List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(securityZone.getZoneName(), zoneName, SecurityZone.class);
 
1072                                         SecurityZone data = (SecurityZone) duplicateData.get(0);
 
1073                                         int id = data.getId();
 
1076                                                 securityZone.setId(1);
 
1078                                                 securityZone.setId(id);
 
1082                                 securityZone = (SecurityZone)mapper.readValue(root.get("securityZoneDictionaryData").toString(), SecurityZone.class);
 
1084                         if(securityZone.getId() == 0){
 
1085                                 List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(securityZone.getZoneName(), zoneName, SecurityZone.class);
 
1086                                 if(!duplicateData.isEmpty()){
 
1087                                         duplicateflag = true;
 
1089                                         commonClassDao.save(securityZone);
 
1093                                         commonClassDao.update(securityZone); 
 
1096                         String responseString = "";
 
1098                                 responseString = duplicateResponseString;
 
1100                                 responseString = mapper.writeValueAsString(commonClassDao.getData(SecurityZone.class));
 
1104                                 if (responseString!=null && !(duplicateResponseString).equals(responseString)) {
 
1106                                                 responseString = existsResponseString;
 
1108                                                 responseString = successMsg;
 
1111                                 ModelAndView result = new ModelAndView();
 
1112                                 result.setViewName(responseString);
 
1115                                 response.setCharacterEncoding(utf8);
 
1116                                 response.setContentType(applicationJsonContentType);
 
1117                                 request.setCharacterEncoding(utf8);
 
1119                                 PrintWriter out = response.getWriter();
 
1120                                 JSONObject j = new JSONObject("{securityZoneDictionaryDatas: " + responseString + "}");
 
1121                                 out.write(j.toString());
 
1125                 }catch (Exception e){
 
1126                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 
1127                         response.setCharacterEncoding(utf8);
 
1128                         request.setCharacterEncoding(utf8);
 
1129                         PrintWriter out = response.getWriter();
 
1130                         out.write(e.getMessage());
 
1135         @RequestMapping(value={"/fw_dictionary/remove_securityZone"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 
1136         public ModelAndView removeSecurityZoneDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException {
 
1138                         ObjectMapper mapper = new ObjectMapper();
 
1139                         mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 
1140                         JsonNode root = mapper.readTree(request.getReader());
 
1141                         SecurityZone securityZone = (SecurityZone)mapper.readValue(root.get("data").toString(), SecurityZone.class);
 
1142                         commonClassDao.delete(securityZone);
 
1143                         response.setCharacterEncoding(utf8);
 
1144                         response.setContentType(applicationJsonContentType);
 
1145                         request.setCharacterEncoding(utf8);
 
1147                         PrintWriter out = response.getWriter();
 
1149                         String responseString = mapper.writeValueAsString(commonClassDao.getData(SecurityZone.class));
 
1150                         JSONObject j = new JSONObject("{securityZoneDictionaryDatas: " + responseString + "}");
 
1151                         out.write(j.toString());
 
1155                 catch (Exception e){
 
1156                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 
1157                         response.setCharacterEncoding(utf8);
 
1158                         request.setCharacterEncoding(utf8);
 
1159                         PrintWriter out = response.getWriter();
 
1160                         out.write(e.getMessage());
 
1166         @RequestMapping(value={"/get_ServiceListData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 
1167         public void getServiceListDictionaryEntityData(HttpServletResponse response){
 
1169                         Map<String, Object> model = new HashMap<>();
 
1170                         ObjectMapper mapper = new ObjectMapper();
 
1171                         model.put("serviceListDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(ServiceList.class)));
 
1172                         JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 
1173                         JSONObject j = new JSONObject(msg);
 
1174                         response.addHeader(successMapKey, successMessage); 
 
1175                         response.addHeader(operation, getDictionary);
 
1176                         response.getWriter().write(j.toString());
 
1178                 catch (Exception e){
 
1179                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 
1180                         response.setStatus(HttpServletResponse.SC_BAD_REQUEST);                             
 
1181                         response.addHeader(errorMsg, dictionaryDBQuery);
 
1185         @RequestMapping(value={"/get_ServiceListDictionaryDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 
1186         public void getServiceListDictionaryEntityDataByName(HttpServletResponse response){
 
1188                         Map<String, Object> model = new HashMap<>();
 
1189                         ObjectMapper mapper = new ObjectMapper();
 
1190                         model.put("serviceListDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(ServiceList.class, serviceName)));
 
1191                         JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 
1192                         JSONObject j = new JSONObject(msg);
 
1193                         response.getWriter().write(j.toString());
 
1195                 catch (Exception e){
 
1196                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 
1200         @RequestMapping(value={"/fw_dictionary/save_serviceList"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 
1201         public ModelAndView saveServiceListDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException{
 
1203                         boolean duplicateflag = false;
 
1204                         boolean isFakeUpdate = false;
 
1205                         boolean fromAPI = false;
 
1206                         if (request.getParameter(apiflag)!=null && ("api").equalsIgnoreCase(request.getParameter(apiflag))) {
 
1209                         ObjectMapper mapper = new ObjectMapper();
 
1210                         mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 
1211                         JsonNode root = mapper.readTree(request.getReader());
 
1212                         ServiceList serviceList;
 
1213                         GridData serviceListGridData;
 
1215                                 serviceList = (ServiceList)mapper.readValue(root.get(dictionaryFields).toString(), ServiceList.class);
 
1216                                 serviceListGridData = (GridData)mapper.readValue(root.get(dictionaryFields).toString(), GridData.class);
 
1218                                 //check if update operation or create, get id for data to be updated and update attributeData
 
1219                                 if ((update).equals(request.getParameter(operation))) {
 
1220                                         List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(serviceList.getServiceName(), serviceName, ServiceList.class);
 
1221                                         ServiceList data = (ServiceList) duplicateData.get(0);
 
1222                                         int id = data.getId();
 
1225                                                 serviceList.setId(1);
 
1227                                                 serviceList.setId(id);
 
1231                                 serviceList = (ServiceList)mapper.readValue(root.get("serviceListDictionaryData").toString(), ServiceList.class);
 
1232                                 serviceListGridData = (GridData)mapper.readValue(root.get("serviceListDictionaryData").toString(), GridData.class);
 
1234                         String tcpValue = "";
 
1236                         if(!serviceListGridData.getTransportProtocols().isEmpty()){
 
1237                                 for(Object attribute : serviceListGridData.getTransportProtocols()){
 
1238                                         if(attribute instanceof LinkedHashMap<?, ?>){
 
1239                                                 String key = ((LinkedHashMap<?, ?>) attribute).get(option).toString();
 
1241                                                         tcpValue = tcpValue + ",";
 
1243                                                 tcpValue = tcpValue + key ;
 
1248                         serviceList.setServiceTransProtocol(tcpValue);
 
1249                         String appValue = "";
 
1251                         if(!serviceListGridData.getAppProtocols().isEmpty()){
 
1252                                 for(Object attribute : serviceListGridData.getAppProtocols()){
 
1253                                         if(attribute instanceof LinkedHashMap<?, ?>){
 
1254                                                 String key = ((LinkedHashMap<?, ?>) attribute).get(option).toString();
 
1256                                                         appValue = appValue + ",";
 
1258                                                 appValue = appValue + key ;
 
1263                         serviceList.setServiceAppProtocol(appValue);
 
1264                         serviceList.setServiceType("SERVICE");
 
1265                         if(serviceList.getId() == 0){
 
1266                                 List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(serviceList.getServiceName(), serviceName, ServiceList.class);
 
1267                                 if(!duplicateData.isEmpty()){
 
1268                                         duplicateflag = true;
 
1270                                         commonClassDao.save(serviceList);
 
1274                                         commonClassDao.update(serviceList); 
 
1278                         String responseString = "";
 
1280                                 responseString = duplicateResponseString;
 
1282                                 responseString = mapper.writeValueAsString(commonClassDao.getData(ServiceList.class));
 
1285                                 if (responseString!=null && !(duplicateResponseString).equals(responseString)) {
 
1287                                                 responseString = existsResponseString;
 
1289                                                 responseString = successMsg;
 
1292                                 ModelAndView result = new ModelAndView();
 
1293                                 result.setViewName(responseString);
 
1296                                 response.setCharacterEncoding(utf8);
 
1297                                 response.setContentType(applicationJsonContentType);
 
1298                                 request.setCharacterEncoding(utf8);
 
1300                                 PrintWriter out = response.getWriter();
 
1301                                 JSONObject j = new JSONObject("{serviceListDictionaryDatas: " + responseString + "}");
 
1302                                 out.write(j.toString());
 
1305                 }catch (Exception e){
 
1306                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 
1307                         response.setCharacterEncoding(utf8);
 
1308                         request.setCharacterEncoding(utf8);
 
1309                         PrintWriter out = response.getWriter();
 
1310                         out.write(e.getMessage());
 
1316         @RequestMapping(value={"/fw_dictionary/remove_serviceList"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 
1317         public ModelAndView removeServiceListDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException {
 
1319                         ObjectMapper mapper = new ObjectMapper();
 
1320                         mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 
1321                         JsonNode root = mapper.readTree(request.getReader());
 
1322                         ServiceList serviceList = (ServiceList)mapper.readValue(root.get("data").toString(), ServiceList.class);
 
1323                         commonClassDao.delete(serviceList);
 
1324                         response.setCharacterEncoding(utf8);
 
1325                         response.setContentType(applicationJsonContentType);
 
1326                         request.setCharacterEncoding(utf8);
 
1328                         PrintWriter out = response.getWriter();
 
1330                         String responseString = mapper.writeValueAsString(commonClassDao.getData(ServiceList.class));
 
1331                         JSONObject j = new JSONObject("{serviceListDictionaryDatas: " + responseString + "}");
 
1332                         out.write(j.toString());
 
1336                 catch (Exception e){
 
1338                         response.setCharacterEncoding(utf8);
 
1339                         request.setCharacterEncoding(utf8);
 
1340                         PrintWriter out = response.getWriter();
 
1341                         out.write(e.getMessage());
 
1346         @RequestMapping(value={"/get_ZoneData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 
1347         public void getZoneDictionaryEntityData(HttpServletResponse response){
 
1349                         Map<String, Object> model = new HashMap<>();
 
1350                         ObjectMapper mapper = new ObjectMapper();
 
1351                         model.put("zoneDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(Zone.class)));
 
1352                         JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 
1353                         JSONObject j = new JSONObject(msg);
 
1354                         response.addHeader(successMapKey, successMessage); 
 
1355                         response.addHeader(operation, getDictionary);
 
1356                         response.getWriter().write(j.toString());
 
1358                 catch (Exception e){
 
1359                         LOGGER.error("Exception Occured"+e);
 
1363         @RequestMapping(value={"/get_ZoneDictionaryDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 
1364         public void getZoneDictionaryEntityDataByName(HttpServletResponse response){
 
1366                         Map<String, Object> model = new HashMap<>();
 
1367                         ObjectMapper mapper = new ObjectMapper();
 
1368                         model.put("zoneDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(Zone.class, zoneName)));
 
1369                         JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 
1370                         JSONObject j = new JSONObject(msg);
 
1371                         response.getWriter().write(j.toString());
 
1373                 catch (Exception e){
 
1374                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 
1378         @RequestMapping(value={"/fw_dictionary/save_zoneName"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 
1379         public ModelAndView saveZoneDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException{
 
1381                         boolean duplicateflag = false;
 
1382                         boolean isFakeUpdate = false;
 
1383                         boolean fromAPI = false;
 
1384                         if (request.getParameter(apiflag)!=null && ("api").equalsIgnoreCase(request.getParameter(apiflag))) {
 
1387                         ObjectMapper mapper = new ObjectMapper();
 
1388                         mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 
1389                         JsonNode root = mapper.readTree(request.getReader());
 
1392                                 zone = (Zone)mapper.readValue(root.get(dictionaryFields).toString(), Zone.class);
 
1394                                 //check if update operation or create, get id for data to be updated and update attributeData
 
1395                                 if ((update).equals(request.getParameter(operation))) {
 
1396                                         List<Object> duplicateData = commonClassDao.checkDuplicateEntry(zone.getZoneName(), zoneName, Zone.class);
 
1397                                         Zone data = (Zone) duplicateData.get(0);
 
1398                                         int id = data.getId();
 
1407                                 zone = (Zone)mapper.readValue(root.get("zoneDictionaryData").toString(), Zone.class);
 
1409                         if(zone.getId() == 0){
 
1410                                 List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(zone.getZoneName(), zoneName, Zone.class);
 
1411                                 if(!duplicateData.isEmpty()){
 
1412                                         duplicateflag = true;
 
1414                                         commonClassDao.save(zone);
 
1418                                         commonClassDao.update(zone); 
 
1421                         String responseString = "";
 
1423                                 responseString = duplicateResponseString;
 
1425                                 responseString = mapper.writeValueAsString(commonClassDao.getData(Zone.class));
 
1429                                 if (responseString!=null && !(duplicateResponseString).equals(responseString)) {
 
1431                                                 responseString = existsResponseString;
 
1433                                                 responseString = successMsg;
 
1436                                 ModelAndView result = new ModelAndView();
 
1437                                 result.setViewName(responseString);
 
1440                                 response.setCharacterEncoding(utf8);
 
1441                                 response.setContentType(applicationJsonContentType);
 
1442                                 request.setCharacterEncoding(utf8);
 
1444                                 PrintWriter out = response.getWriter();
 
1445                                 JSONObject j = new JSONObject("{zoneDictionaryDatas: " + responseString + "}");
 
1446                                 out.write(j.toString());
 
1449                 }catch (Exception e){
 
1450                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 
1451                         response.setCharacterEncoding(utf8);
 
1452                         request.setCharacterEncoding(utf8);
 
1453                         PrintWriter out = response.getWriter();
 
1454                         out.write(e.getMessage());
 
1459         @RequestMapping(value={"/fw_dictionary/remove_zone"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 
1460         public ModelAndView removeZoneDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException{
 
1462                         ObjectMapper mapper = new ObjectMapper();
 
1463                         mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 
1464                         JsonNode root = mapper.readTree(request.getReader());
 
1465                         Zone zone = (Zone)mapper.readValue(root.get("data").toString(), Zone.class);
 
1466                         commonClassDao.delete(zone);
 
1467                         response.setCharacterEncoding(utf8);
 
1468                         response.setContentType(applicationJsonContentType);
 
1469                         request.setCharacterEncoding(utf8);
 
1471                         PrintWriter out = response.getWriter();
 
1473                         String responseString = mapper.writeValueAsString(commonClassDao.getData(Zone.class));
 
1474                         JSONObject j = new JSONObject("{zoneDictionaryDatas: " + responseString + "}");
 
1475                         out.write(j.toString());
 
1479                 catch (Exception e){
 
1480                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 
1481                         response.setCharacterEncoding(utf8);
 
1482                         request.setCharacterEncoding(utf8);
 
1483                         PrintWriter out = response.getWriter();
 
1484                         out.write(e.getMessage());
 
1489         @RequestMapping(value={"/get_TermListDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 
1490         public void getTermListDictionaryEntityDataByName(HttpServletResponse response){
 
1492                         Map<String, Object> model = new HashMap<>();
 
1493                         ObjectMapper mapper = new ObjectMapper();
 
1494                         model.put("termListDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(TermList.class, termName)));
 
1495                         JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 
1496                         JSONObject j = new JSONObject(msg);
 
1497                         response.getWriter().write(j.toString());
 
1499                 catch (Exception e){
 
1500                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 
1504         @RequestMapping(value={"/get_TermListData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 
1505         public void getTermListDictionaryEntityData(HttpServletResponse response){
 
1507                         Map<String, Object> model = new HashMap<>();
 
1508                         ObjectMapper mapper = new ObjectMapper();
 
1509                         model.put("termListDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(TermList.class)));
 
1510                         JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 
1511                         JSONObject j = new JSONObject(msg);
 
1512                         response.addHeader(successMapKey, successMessage); 
 
1513                         response.addHeader(operation, getDictionary);
 
1514                         response.getWriter().write(j.toString());
 
1516                 catch (Exception e){
 
1517                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 
1518                         response.setStatus(HttpServletResponse.SC_BAD_REQUEST);                             
 
1519                         response.addHeader(errorMsg, dictionaryDBQuery);
 
1523         @RequestMapping(value={"/fw_dictionary/save_termList"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 
1524         public ModelAndView saveTermListDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException{
 
1526                         boolean duplicateflag = false;
 
1527                         boolean isFakeUpdate = false;
 
1528                         boolean fromAPI = false;
 
1529                         if (request.getParameter(apiflag)!=null && ("api").equalsIgnoreCase(request.getParameter(apiflag))) {
 
1532                         ObjectMapper mapper = new ObjectMapper();
 
1533                         mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 
1534                         JsonNode root = mapper.readTree(request.getReader());
 
1536                         TermListData termListDatas;
 
1537                         String userId = null;
 
1539                                 termList = (TermList)mapper.readValue(root.get(dictionaryFields).toString(), TermList.class);
 
1540                                 termListDatas = (TermListData)mapper.readValue(root.get(dictionaryFields).toString(), TermListData.class);
 
1543                                 //check if update operation or create, get id for data to be updated and update attributeData
 
1544                                 if ((update).equals(request.getParameter(operation))) {
 
1545                                         List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(termList.getTermName(), termName, TermList.class);
 
1546                                         TermList data = (TermList) duplicateData.get(0);
 
1547                                         int id = data.getId();
 
1554                                         termList.setUserCreatedBy(this.getUserInfo(userId));
 
1557                                 termList = (TermList)mapper.readValue(root.get("termListDictionaryData").toString(), TermList.class);
 
1558                                 termListDatas = (TermListData)mapper.readValue(root.get("termListDictionaryData").toString(), TermListData.class);
 
1559                                 userId = root.get(userid).textValue();
 
1561                         String fromZoneValue = "";
 
1563                         if(!termListDatas.getFromZoneDatas().isEmpty()){
 
1564                                 for(Object fromZone : termListDatas.getFromZoneDatas()){
 
1565                                         if(fromZone instanceof LinkedHashMap<?, ?>){
 
1566                                                 String key = ((LinkedHashMap<?, ?>) fromZone).get(option).toString();
 
1568                                                         fromZoneValue = fromZoneValue + ",";
 
1570                                                 fromZoneValue = fromZoneValue + key ;
 
1575                         termList.setFromZones(fromZoneValue);
 
1577                         String toZoneValue = "";
 
1578                         int toZonecounter = 0;
 
1579                         if(!termListDatas.getToZoneDatas().isEmpty()){
 
1580                                 for(Object toZone : termListDatas.getToZoneDatas()){
 
1581                                         if(toZone instanceof LinkedHashMap<?, ?>){
 
1582                                                 String key = ((LinkedHashMap<?, ?>) toZone).get(option).toString();
 
1583                                                 if(toZonecounter>0){
 
1584                                                         toZoneValue = toZoneValue + ",";
 
1586                                                 toZoneValue = toZoneValue + key ;
 
1591                         termList.setToZones(toZoneValue);
 
1593                         String srcListValues = "";
 
1594                         int srcListcounter = 0;
 
1595                         if(!termListDatas.getSourceListDatas().isEmpty()){
 
1596                                 for(Object srcList : termListDatas.getSourceListDatas()){
 
1597                                         if(srcList instanceof LinkedHashMap<?, ?>){
 
1598                                                 String key = ((LinkedHashMap<?, ?>) srcList).get(option).toString();
 
1599                                                 if(srcListcounter>0){
 
1600                                                         srcListValues = srcListValues + ",";
 
1602                                                 srcListValues = srcListValues + key ;
 
1607                         termList.setSrcIPList(srcListValues);
 
1609                         String desListValues = "";
 
1610                         int destListcounter = 0;
 
1611                         if(!termListDatas.getDestinationListDatas().isEmpty()){
 
1612                                 for(Object desList : termListDatas.getDestinationListDatas()){
 
1613                                         if(desList instanceof LinkedHashMap<?, ?>){
 
1614                                                 String key = ((LinkedHashMap<?, ?>) desList).get(option).toString();
 
1615                                                 if(destListcounter>0){
 
1616                                                         desListValues = desListValues + ",";
 
1618                                                 desListValues = desListValues + key ;
 
1623                         termList.setDestIPList(desListValues);
 
1625                         String srcSerValue = "";
 
1626                         int srcSercounter = 0;
 
1627                         if(!termListDatas.getSourceServiceDatas().isEmpty()){
 
1628                                 for(Object srcSrc : termListDatas.getSourceServiceDatas()){
 
1629                                         if(srcSrc instanceof LinkedHashMap<?, ?>){
 
1630                                                 String key = ((LinkedHashMap<?, ?>) srcSrc).get(option).toString();
 
1631                                                 if(srcSercounter>0){
 
1632                                                         srcSerValue = srcSerValue + ",";
 
1634                                                 srcSerValue = srcSerValue + key ;
 
1639                         termList.setSrcPortList(srcSerValue);
 
1641                         String desSrcValue = "";
 
1642                         int desSrccounter = 0;
 
1643                         if(!termListDatas.getDestinationServiceDatas().isEmpty()){
 
1644                                 for(Object desSrc : termListDatas.getDestinationServiceDatas()){
 
1645                                         if(desSrc instanceof LinkedHashMap<?, ?>){
 
1646                                                 String key = ((LinkedHashMap<?, ?>) desSrc).get(option).toString();
 
1647                                                 if(desSrccounter>0){
 
1648                                                         desSrcValue = desSrcValue + ",";
 
1650                                                 desSrcValue = desSrcValue + key ;
 
1655                         termList.setDestPortList(desSrcValue);
 
1657                         String actionValue = "";
 
1658                         int actioncounter = 0;
 
1659                         if(!termListDatas.getActionListDatas().isEmpty()){
 
1660                                 for(Object actionList : termListDatas.getActionListDatas()){
 
1661                                         if(actionList instanceof LinkedHashMap<?, ?>){
 
1662                                                 String key = ((LinkedHashMap<?, ?>) actionList).get(option).toString();
 
1663                                                 if(actioncounter>0){
 
1664                                                         actionValue = actionValue + ",";
 
1666                                                 actionValue = actionValue + key ;
 
1671                         termList.setAction(actionValue);
 
1673                         if(termList.getId() == 0){
 
1674                                 List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(termList.getTermName(), termName, TermList.class);
 
1675                                 if(!duplicateData.isEmpty()){
 
1676                                         duplicateflag = true;
 
1678                                         termList.setUserCreatedBy(this.getUserInfo(userId));
 
1679                                         termList.setUserModifiedBy(this.getUserInfo(userId));
 
1680                                         commonClassDao.save(termList);
 
1684                                         termList.setUserModifiedBy(this.getUserInfo(userId));
 
1685                                         commonClassDao.update(termList); 
 
1688                         String responseString = "";
 
1690                                 responseString = duplicateResponseString;
 
1692                                 responseString = mapper.writeValueAsString(commonClassDao.getData(TermList.class));
 
1696                                 if (responseString!=null && !(duplicateResponseString).equals(responseString)) {
 
1698                                                 responseString = existsResponseString;
 
1700                                                 responseString = successMsg;
 
1703                                 ModelAndView result = new ModelAndView();
 
1704                                 result.setViewName(responseString);
 
1707                                 response.setCharacterEncoding(utf8);
 
1708                                 response.setContentType(applicationJsonContentType);
 
1709                                 request.setCharacterEncoding(utf8);
 
1711                                 PrintWriter out = response.getWriter();
 
1712                                 JSONObject j = new JSONObject("{termListDictionaryDatas: " + responseString + "}");
 
1713                                 out.write(j.toString());
 
1716                 }catch (Exception e){
 
1717                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 
1718                         response.setCharacterEncoding(utf8);
 
1719                         request.setCharacterEncoding(utf8);
 
1720                         PrintWriter out = response.getWriter();
 
1721                         out.write(e.getMessage());
 
1726         @RequestMapping(value={"/fw_dictionary/remove_termList"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 
1727         public ModelAndView removeTermListDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException{
 
1729                         ObjectMapper mapper = new ObjectMapper();
 
1730                         mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 
1731                         JsonNode root = mapper.readTree(request.getReader());
 
1732                         TermList termList = (TermList)mapper.readValue(root.get("data").toString(), TermList.class);
 
1733                         commonClassDao.delete(termList);
 
1734                         response.setCharacterEncoding(utf8);
 
1735                         response.setContentType(applicationJsonContentType);
 
1736                         request.setCharacterEncoding(utf8);
 
1738                         PrintWriter out = response.getWriter();
 
1740                         String responseString = mapper.writeValueAsString(commonClassDao.getData(TermList.class));
 
1741                         JSONObject j = new JSONObject("{termListDictionaryDatas: " + responseString + "}");
 
1742                         out.write(j.toString());
 
1746                 catch (Exception e){
 
1747                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 
1748                         response.setCharacterEncoding(utf8);
 
1749                         request.setCharacterEncoding(utf8);
 
1750                         PrintWriter out = response.getWriter();
 
1751                         out.write(e.getMessage());
 
1755         //ParentList Dictionary Data
 
1756         @RequestMapping(value={"/get_FWDictionaryListDataByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 
1757         public void getFWDictListDictionaryEntityDataByName(HttpServletResponse response){
 
1759                         Map<String, Object> model = new HashMap<>();
 
1760                         ObjectMapper mapper = new ObjectMapper();
 
1761                         model.put("fwDictListDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(FirewallDictionaryList.class, "parentItemName")));
 
1762                         JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 
1763                         JSONObject j = new JSONObject(msg);
 
1764                         response.getWriter().write(j.toString());
 
1766                 catch (Exception e){
 
1767                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 
1771         @RequestMapping(value={"/get_FWDictionaryListData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 
1772         public void getFWDictionaryListEntityData(HttpServletResponse response){
 
1774                         Map<String, Object> model = new HashMap<>();
 
1775                         ObjectMapper mapper = new ObjectMapper();
 
1776                         model.put("fwDictListDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(FirewallDictionaryList.class)));
 
1777                         JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 
1778                         JSONObject j = new JSONObject(msg);
 
1779                         response.addHeader(successMapKey, successMessage); 
 
1780                         response.addHeader(operation, getDictionary);
 
1781                         response.getWriter().write(j.toString());
 
1783                 catch (Exception e){
 
1784                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 
1785                         response.setStatus(HttpServletResponse.SC_BAD_REQUEST);                             
 
1786                         response.addHeader(errorMsg, dictionaryDBQuery);
 
1790         @RequestMapping(value={"/fw_dictionary/save_FWDictionaryList"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 
1791         public ModelAndView saveFWDictionaryList(HttpServletRequest request, HttpServletResponse response) throws IOException{
 
1793                         boolean duplicateflag = false;
 
1794                         ObjectMapper mapper = new ObjectMapper();
 
1795                         mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 
1796                         JsonNode root = mapper.readTree(request.getReader());
 
1797                         FirewallDictionaryList fwDictList = (FirewallDictionaryList)mapper.readValue(root.get("fwDictListDictionaryData").toString(), FirewallDictionaryList.class);
 
1798                         GridData gridData = (GridData)mapper.readValue(root.get("fwDictListDictionaryData").toString(), GridData.class);
 
1799                         String userSLValue = "";
 
1801                         if(!gridData.getAttributes().isEmpty()){
 
1802                                 for(Object attribute : gridData.getAttributes()){
 
1803                                         if(attribute instanceof LinkedHashMap<?, ?>){
 
1804                                                 String key = ((LinkedHashMap<?, ?>) attribute).get(option).toString();
 
1806                                                         userSLValue = userSLValue + ",";
 
1808                                                 userSLValue = userSLValue + key ;
 
1813                         fwDictList.setServiceList(userSLValue);
 
1814                         String userALValue = "";
 
1816                         if(!gridData.getAlAttributes().isEmpty()){
 
1817                                 for(Object attribute : gridData.getAlAttributes()){
 
1818                                         if(attribute instanceof LinkedHashMap<?, ?>){
 
1819                                                 String key = ((LinkedHashMap<?, ?>) attribute).get(option).toString();
 
1821                                                         userALValue = userALValue + ",";
 
1823                                                 userALValue = userALValue + key ;
 
1828                         fwDictList.setAddressList(userALValue);
 
1829                         if(fwDictList.getId() == 0){
 
1830                                 List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(fwDictList.getParentItemName(), "parentItemName", FirewallDictionaryList.class);
 
1831                                 if(!duplicateData.isEmpty()){
 
1832                                         duplicateflag = true;
 
1834                                         commonClassDao.save(fwDictList);
 
1837                                 commonClassDao.update(fwDictList); 
 
1839                         response.setCharacterEncoding(utf8);
 
1840                         response.setContentType(applicationJsonContentType);
 
1841                         request.setCharacterEncoding(utf8);
 
1843                         PrintWriter out = response.getWriter();
 
1844                         String responseString = "";
 
1846                                 responseString = duplicateResponseString;
 
1848                                 responseString = mapper.writeValueAsString(commonClassDao.getData(FirewallDictionaryList.class));
 
1850                         JSONObject j = new JSONObject("{fwDictListDictionaryDatas: " + responseString + "}");
 
1852                         out.write(j.toString());
 
1856                 catch (Exception e){
 
1857                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 
1858                         response.setCharacterEncoding(utf8);
 
1859                         request.setCharacterEncoding(utf8);
 
1860                         PrintWriter out = response.getWriter();
 
1861                         out.write(e.getMessage());
 
1866         @RequestMapping(value={"/fw_dictionary/remove_FWDictionaryList"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 
1867         public ModelAndView removeFWDictionaryListy(HttpServletRequest request, HttpServletResponse response) throws IOException {
 
1869                         ObjectMapper mapper = new ObjectMapper();
 
1870                         mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 
1871                         JsonNode root = mapper.readTree(request.getReader());
 
1872                         FirewallDictionaryList fwDictList = (FirewallDictionaryList)mapper.readValue(root.get("data").toString(), FirewallDictionaryList.class);
 
1873                         commonClassDao.delete(fwDictList);
 
1874                         response.setCharacterEncoding(utf8);
 
1875                         response.setContentType(applicationJsonContentType);
 
1876                         request.setCharacterEncoding(utf8);
 
1878                         PrintWriter out = response.getWriter();
 
1880                         String responseString = mapper.writeValueAsString(commonClassDao.getData(FirewallDictionaryList.class));
 
1881                         JSONObject j = new JSONObject("{fwDictListDictionaryDatas: " + responseString + "}");
 
1882                         out.write(j.toString());
 
1886                 catch (Exception e){
 
1887                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 
1888                         response.setCharacterEncoding(utf8);
 
1889                         request.setCharacterEncoding(utf8);
 
1890                         PrintWriter out = response.getWriter();
 
1891                         out.write(e.getMessage());
 
1897         @RequestMapping(value={"/get_TagPickerNameByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 
1898         public void getTagPickerNameEntityDataByName(HttpServletResponse response){
 
1900                         Map<String, Object> model = new HashMap<>();
 
1901                         ObjectMapper mapper = new ObjectMapper();
 
1902                         model.put("fwTagPickerDictionaryDatas", mapper.writeValueAsString(commonClassDao.getDataByColumn(FWTagPicker.class, tagPickerName)));
 
1903                         JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 
1904                         JSONObject j = new JSONObject(msg);
 
1905                         response.getWriter().write(j.toString());
 
1907                 catch (Exception e){
 
1908                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 
1912         @RequestMapping(value={"/get_TagPickerListData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 
1913         public void getTagPickerDictionaryEntityData(HttpServletResponse response){
 
1915                         Map<String, Object> model = new HashMap<>();
 
1916                         ObjectMapper mapper = new ObjectMapper();
 
1917                         model.put("fwTagPickerDictionaryDatas", mapper.writeValueAsString(commonClassDao.getData(FWTagPicker.class)));
 
1918                         JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 
1919                         JSONObject j = new JSONObject(msg);
 
1920                         response.getWriter().write(j.toString());
 
1922                 catch (Exception e){
 
1923                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 
1927         @RequestMapping(value={"/fw_dictionary/save_fwTagPicker"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 
1928         public ModelAndView saveFirewallTagPickerDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException{
 
1930                         boolean duplicateflag = false;
 
1931                         boolean fromAPI = false;
 
1932                         if (request.getParameter(apiflag)!=null && ("api").equalsIgnoreCase(request.getParameter(apiflag))) {
 
1936                         ObjectMapper mapper = new ObjectMapper();
 
1937                         mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 
1938                         JsonNode root = mapper.readTree(request.getReader());
 
1941                         FWTagPicker fwTagPicker;
 
1943                         String userId = null;
 
1945                                 fwTagPicker = (FWTagPicker)mapper.readValue(root.get(fwTagPickerDictionaryData).toString(), FWTagPicker.class);
 
1946                                 data = (TagGridValues)mapper.readValue(root.get(fwTagPickerDictionaryData).toString(), TagGridValues.class);
 
1949                                 //check if update operation or create, get id for data to be updated and update attributeData
 
1950                                 if ((update).equals(request.getParameter(operation))) {
 
1951                                         List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(fwTagPicker.getTagPickerName(), tagPickerName, FWTagPicker.class);
 
1952                                         FWTagPicker dbdata = (FWTagPicker) duplicateData.get(0);
 
1953                                         int id = dbdata.getId();
 
1954                                         fwTagPicker.setId(id);
 
1955                                         fwTagPicker.setUserCreatedBy(this.getUserInfo(userId));
 
1959                                 fwTagPicker = (FWTagPicker)mapper.readValue(root.get(fwTagPickerDictionaryData).toString(), FWTagPicker.class);
 
1960                                 data = (TagGridValues)mapper.readValue(root.get(fwTagPickerDictionaryData).toString(), TagGridValues.class);
 
1961                                 userId = root.get(userid).textValue();
 
1966                         if(!data.getTags().isEmpty()){
 
1967                                 for(Object attribute : data.getTags()){
 
1968                                         if(attribute instanceof LinkedHashMap<?, ?>){
 
1969                                                 String key = ((LinkedHashMap<?, ?>) attribute).get(option).toString();
 
1970                                                 String value = ((LinkedHashMap<?, ?>) attribute).get("number").toString();
 
1972                                                         header = header + "#";
 
1974                                                 header = header + key + ":";
 
1975                                                 header = header + value;
 
1980                         fwTagPicker.setTagValues(header);
 
1981                         if(fwTagPicker.getId() == 0){
 
1982                                 List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(fwTagPicker.getTagPickerName(), tagPickerName, FWTagPicker.class);
 
1983                                 if(!duplicateData.isEmpty()){
 
1984                                         duplicateflag = true;
 
1986                                         fwTagPicker.setUserCreatedBy(this.getUserInfo(userId));
 
1987                                         fwTagPicker.setUserModifiedBy(this.getUserInfo(userId));
 
1988                                         commonClassDao.save(fwTagPicker);
 
1991                                 fwTagPicker.setUserModifiedBy(this.getUserInfo(userId));
 
1992                                 fwTagPicker.setModifiedDate(new Date());
 
1993                                 commonClassDao.update(fwTagPicker); 
 
1996                         String responseString = "";
 
1998                                 responseString = duplicateResponseString;
 
2000                                 responseString =  mapper.writeValueAsString(commonClassDao.getData(FWTagPicker.class));
 
2004                                 if (responseString!=null && !(duplicateResponseString).equals(responseString)) {
 
2005                                         responseString = successMsg;
 
2007                                 ModelAndView result = new ModelAndView();
 
2008                                 result.setViewName(responseString);
 
2011                                 response.setCharacterEncoding(utf8);
 
2012                                 response.setContentType(applicationJsonContentType);
 
2013                                 request.setCharacterEncoding(utf8);
 
2015                                 PrintWriter out = response.getWriter();
 
2016                                 JSONObject j = new JSONObject("{fwTagPickerDictionaryDatas: " + responseString + "}");
 
2017                                 out.write(j.toString());
 
2021                 catch (Exception e){
 
2022                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 
2023                         response.setCharacterEncoding(utf8);
 
2024                         request.setCharacterEncoding(utf8);
 
2025                         PrintWriter out = response.getWriter();
 
2026                         out.write(e.getMessage());
 
2031         @RequestMapping(value={"/fw_dictionary/remove_tagPicker"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 
2032         public ModelAndView removeFirewallTagPickerDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException {
 
2034                         ObjectMapper mapper = new ObjectMapper();
 
2035                         mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 
2036                         JsonNode root = mapper.readTree(request.getReader());
 
2037                         FWTagPicker fwTagPicker = (FWTagPicker)mapper.readValue(root.get("data").toString(), FWTagPicker.class);
 
2038                         commonClassDao.delete(fwTagPicker);
 
2039                         response.setCharacterEncoding(utf8);
 
2040                         response.setContentType(applicationJsonContentType);
 
2041                         request.setCharacterEncoding(utf8);
 
2043                         PrintWriter out = response.getWriter();
 
2044                         String responseString = mapper.writeValueAsString(commonClassDao.getData(FWTagPicker.class));
 
2045                         JSONObject j = new JSONObject("{fwTagPickerDictionaryDatas: " + responseString + "}");
 
2046                         out.write(j.toString());
 
2049                 catch (Exception e){
 
2050                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 
2051                         response.setCharacterEncoding(utf8);
 
2052                         request.setCharacterEncoding(utf8);
 
2053                         PrintWriter out = response.getWriter();
 
2054                         out.write(e.getMessage());
 
2060         @RequestMapping(value={"/get_TagNameByName"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 
2061         public void getTagNameEntityDataByName(HttpServletResponse response){
 
2063                         Map<String, Object> model = new HashMap<>();
 
2064                         ObjectMapper mapper = new ObjectMapper();
 
2065                         model.put(fwTagDictionaryDatas, mapper.writeValueAsString(commonClassDao.getDataByColumn(FWTag.class, "fwTagName")));
 
2066                         JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 
2067                         JSONObject j = new JSONObject(msg);
 
2068                         response.getWriter().write(j.toString());
 
2070                 catch (Exception e){
 
2071                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 
2075         @RequestMapping(value={"/get_TagListData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE)
 
2076         public void getTagDictionaryEntityData(HttpServletResponse response){
 
2078                         Map<String, Object> model = new HashMap<>();
 
2079                         ObjectMapper mapper = new ObjectMapper();
 
2080                         model.put(fwTagDictionaryDatas, mapper.writeValueAsString(commonClassDao.getData(FWTag.class)));
 
2081                         JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model));
 
2082                         JSONObject j = new JSONObject(msg);
 
2083                         response.getWriter().write(j.toString());
 
2085                 catch (Exception e){
 
2086                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 
2090         @RequestMapping(value={"/fw_dictionary/save_fwTag"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 
2091         public ModelAndView saveFirewallTagDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException{
 
2093                         boolean duplicateflag = false;
 
2094                         boolean fromAPI = false;
 
2095                         if (request.getParameter(apiflag)!=null && ("api").equalsIgnoreCase(request.getParameter(apiflag))) {
 
2099                         ObjectMapper mapper = new ObjectMapper();
 
2100                         mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 
2101                         JsonNode root = mapper.readTree(request.getReader());
 
2105                         TagGridValues tagGridValues;
 
2106                         String userId = null;
 
2108                                 fwTag = (FWTag)mapper.readValue(root.get(fwTagDictionaryDatas).toString(), FWTag.class);
 
2109                                 tagGridValues = (TagGridValues)mapper.readValue(root.get(fwTagDictionaryDatas).toString(), TagGridValues.class);
 
2112                                 //check if update operation or create, get id for data to be updated and update attributeData
 
2113                                 if ((update).equals(request.getParameter(operation))) {
 
2114                                         List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(fwTag.getFwTagName(), "tagName", FWTag.class);
 
2115                                         FWTag data = (FWTag) duplicateData.get(0);
 
2116                                         int id = data.getId();
 
2118                                         fwTag.setUserCreatedBy(this.getUserInfo(userId));
 
2122                                 fwTag = (FWTag)mapper.readValue(root.get("fwTagDictionaryData").toString(), FWTag.class);
 
2123                                 tagGridValues = (TagGridValues)mapper.readValue(root.get("fwTagDictionaryData").toString(), TagGridValues.class);
 
2124                                 userId = root.get(userid).textValue();
 
2127                         String userValue = "";
 
2129                         if(!tagGridValues.getTags().isEmpty()){
 
2130                                 for(Object attribute : tagGridValues.getTags()){
 
2131                                         if(attribute instanceof LinkedHashMap<?, ?>){
 
2132                                                 String key = ((LinkedHashMap<?, ?>) attribute).get("tags").toString();
 
2134                                                         userValue = userValue + ",";
 
2136                                                 userValue = userValue + key ;
 
2141                         fwTag.setTagValues(userValue);
 
2142                         if(fwTag.getId() == 0){
 
2143                                 List<Object> duplicateData =  commonClassDao.checkDuplicateEntry(fwTag.getFwTagName(), "fwTagName", FWTag.class);
 
2144                                 if(!duplicateData.isEmpty()){
 
2145                                         duplicateflag = true;
 
2147                                         fwTag.setUserCreatedBy(this.getUserInfo(userId));
 
2148                                         fwTag.setUserModifiedBy(this.getUserInfo(userId));
 
2149                                         commonClassDao.save(fwTag);
 
2152                                 fwTag.setUserModifiedBy(this.getUserInfo(userId));
 
2153                                 fwTag.setModifiedDate(new Date());
 
2154                                 commonClassDao.update(fwTag); 
 
2157                         String responseString = "";
 
2159                                 responseString = duplicateResponseString;
 
2161                                 responseString =  mapper.writeValueAsString(commonClassDao.getData(FWTag.class));
 
2164                                 if (responseString!=null && !(duplicateResponseString).equals(responseString)) {
 
2165                                         responseString = successMsg;
 
2167                                 ModelAndView result = new ModelAndView();
 
2168                                 result.setViewName(responseString);
 
2172                                 response.setCharacterEncoding(utf8);
 
2173                                 response.setContentType(applicationJsonContentType);
 
2174                                 request.setCharacterEncoding(utf8);
 
2176                                 PrintWriter out = response.getWriter();
 
2177                                 JSONObject j = new JSONObject("{fwTagDictionaryDatas: " + responseString + "}");
 
2178                                 out.write(j.toString());
 
2182                 catch (Exception e){
 
2183                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 
2184                         response.setCharacterEncoding(utf8);
 
2185                         request.setCharacterEncoding(utf8);
 
2186                         PrintWriter out = response.getWriter();
 
2187                         out.write(e.getMessage());
 
2192         @RequestMapping(value={"/fw_dictionary/remove_tagList"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
 
2193         public ModelAndView removeFirewallTagDictionary(HttpServletRequest request, HttpServletResponse response) throws IOException{
 
2195                         ObjectMapper mapper = new ObjectMapper();
 
2196                         mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
 
2197                         JsonNode root = mapper.readTree(request.getReader());
 
2198                         FWTag fwTag = (FWTag)mapper.readValue(root.get("data").toString(), FWTag.class);
 
2199                         commonClassDao.delete(fwTag);
 
2200                         response.setCharacterEncoding(utf8);
 
2201                         response.setContentType(applicationJsonContentType);
 
2202                         request.setCharacterEncoding(utf8);
 
2204                         PrintWriter out = response.getWriter();
 
2206                         String responseString = mapper.writeValueAsString(commonClassDao.getData(FWTag.class));
 
2207                         JSONObject j = new JSONObject("{fwTagDictionaryDatas: " + responseString + "}");
 
2208                         out.write(j.toString());
 
2212                 catch (Exception e){
 
2213                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
 
2214                         response.setCharacterEncoding(utf8);
 
2215                         request.setCharacterEncoding(utf8);
 
2216                         PrintWriter out = response.getWriter();
 
2217                         out.write(e.getMessage());
 
2223 class TagGridValues{
 
2224         private List<Object> tags;
 
2226         public List<Object> getTags() {
 
2230         public void setTags(List<Object> tags) {
 
2236         private List<Object> attributes;
 
2238         public List<Object> getAttributes() {
 
2242         public void setAttributes(List<Object> attributes) {
 
2243                 this.attributes = attributes;
 
2248         private List<Object> fromZoneDatas;
 
2249         private List<Object> toZoneDatas;
 
2250         private List<Object> sourceListDatas;
 
2251         private List<Object> destinationListDatas;
 
2252         private List<Object> sourceServiceDatas;
 
2253         private List<Object> destinationServiceDatas;
 
2254         private List<Object> actionListDatas;
 
2255         public List<Object> getFromZoneDatas() {
 
2256                 return fromZoneDatas;
 
2258         public void setFromZoneDatas(List<Object> fromZoneDatas) {
 
2259                 this.fromZoneDatas = fromZoneDatas;
 
2261         public List<Object> getToZoneDatas() {
 
2264         public void setToZoneDatas(List<Object> toZoneDatas) {
 
2265                 this.toZoneDatas = toZoneDatas;
 
2267         public List<Object> getSourceListDatas() {
 
2268                 return sourceListDatas;
 
2270         public void setSourceListDatas(List<Object> sourceListDatas) {
 
2271                 this.sourceListDatas = sourceListDatas;
 
2273         public List<Object> getDestinationListDatas() {
 
2274                 return destinationListDatas;
 
2276         public void setDestinationListDatas(List<Object> destinationListDatas) {
 
2277                 this.destinationListDatas = destinationListDatas;
 
2279         public List<Object> getSourceServiceDatas() {
 
2280                 return sourceServiceDatas;
 
2282         public void setSourceServiceDatas(List<Object> sourceServiceDatas) {
 
2283                 this.sourceServiceDatas = sourceServiceDatas;
 
2285         public List<Object> getDestinationServiceDatas() {
 
2286                 return destinationServiceDatas;
 
2288         public void setDestinationServiceDatas(List<Object> destinationServiceDatas) {
 
2289                 this.destinationServiceDatas = destinationServiceDatas;
 
2291         public List<Object> getActionListDatas() {
 
2292                 return actionListDatas;
 
2294         public void setActionListDatas(List<Object> actionListDatas) {
 
2295                 this.actionListDatas = actionListDatas;