2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
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 com.fasterxml.jackson.databind.DeserializationFeature;
24 import com.fasterxml.jackson.databind.JsonNode;
25 import com.fasterxml.jackson.databind.ObjectMapper;
26 import java.io.IOException;
27 import java.io.PrintWriter;
28 import java.net.UnknownHostException;
29 import java.util.Date;
30 import java.util.List;
31 import javax.servlet.http.HttpServletRequest;
32 import javax.servlet.http.HttpServletResponse;
33 import org.jboss.netty.handler.ipfilter.CIDR;
34 import org.json.JSONObject;
35 import org.onap.policy.common.logging.flexlogger.FlexLogger;
36 import org.onap.policy.common.logging.flexlogger.Logger;
37 import org.onap.policy.pap.xacml.rest.adapters.GridData;
38 import org.onap.policy.pap.xacml.rest.util.DictionaryUtils;
39 import org.onap.policy.rest.dao.CommonClassDao;
40 import org.onap.policy.rest.jpa.ActionList;
41 import org.onap.policy.rest.jpa.AddressGroup;
42 import org.onap.policy.rest.jpa.FWTag;
43 import org.onap.policy.rest.jpa.FWTagPicker;
44 import org.onap.policy.rest.jpa.FirewallDictionaryList;
45 import org.onap.policy.rest.jpa.GroupServiceList;
46 import org.onap.policy.rest.jpa.PortList;
47 import org.onap.policy.rest.jpa.PrefixList;
48 import org.onap.policy.rest.jpa.ProtocolList;
49 import org.onap.policy.rest.jpa.SecurityZone;
50 import org.onap.policy.rest.jpa.ServiceList;
51 import org.onap.policy.rest.jpa.TermList;
52 import org.onap.policy.rest.jpa.UserInfo;
53 import org.onap.policy.rest.jpa.Zone;
54 import org.springframework.beans.factory.annotation.Autowired;
55 import org.springframework.http.MediaType;
56 import org.springframework.stereotype.Controller;
57 import org.springframework.web.bind.annotation.RequestMapping;
58 import org.springframework.web.bind.annotation.RequestMethod;
59 import org.springframework.web.servlet.ModelAndView;
63 public class FirewallDictionaryController {
65 private static final Logger LOGGER = FlexLogger.getLogger(FirewallDictionaryController.class);
67 private static CommonClassDao commonClassDao;
68 private static String prefixListName = "prefixListName";
69 private static String successMessage = "success";
70 private static String operation = "operation";
71 private static String errorMsg = "error";
72 private static String dictionaryFields = "dictionaryFields";
73 private static String duplicateResponseString = "Duplicate";
74 private static String utf8 = "UTF-8";
75 private static String applicationJsonContentType = "application / json";
76 private static String protocolName = "protocolName";
77 private static String groupNameStart = "Group_";
78 private static String option = "option";
79 private static String zoneName = "zoneName";
80 private static String serviceName = "serviceName";
81 private static String termName = "termName";
82 private static String userid = "userid";
83 private static String tagPickerName = "tagPickerName";
84 private static String pfListDatas = "prefixListDictionaryDatas";
85 private static String portListDatas = "portListDictionaryDatas";
86 private static String protocolListDatas = "protocolListDictionaryDatas";
87 private static String addressGroupDatas = "addressGroupDictionaryDatas";
88 private static String actionListDatas = "actionListDictionaryDatas";
89 private static String serviceGroupDatas = "serviceGroupDictionaryDatas";
90 private static String securityZoneDatas = "securityZoneDictionaryDatas";
91 private static String serviceListDatas = "serviceListDictionaryDatas";
92 private static String zoneDatas = "zoneDictionaryDatas";
93 private static String termListDictDatas = "termListDictionaryDatas";
94 private static String fwDictListDatas = "fwDictListDictionaryDatas";
95 private static String fwTagPickerDatas = "fwTagPickerDictionaryDatas";
96 private static String fwTagDatas = "fwTagDictionaryDatas";
100 public FirewallDictionaryController(CommonClassDao commonClassDao) {
101 FirewallDictionaryController.commonClassDao = commonClassDao;
104 public static void setCommonClassDao(CommonClassDao clDao) {
105 commonClassDao = clDao;
108 public FirewallDictionaryController() {
112 private DictionaryUtils getDictionaryUtilsInstance() {
113 return DictionaryUtils.getDictionaryUtils();
116 @RequestMapping(value = {"/get_PrefixListDataByName"}, method = {RequestMethod.GET},
117 produces = MediaType.APPLICATION_JSON_VALUE)
118 public void getPrefixListDictionaryEntityDataByName(HttpServletResponse response) {
119 DictionaryUtils utils = getDictionaryUtilsInstance();
120 utils.getDataByEntity(response, pfListDatas, prefixListName, PrefixList.class);
123 @RequestMapping(value = {"/get_PrefixListData"}, method = {RequestMethod.GET},
124 produces = MediaType.APPLICATION_JSON_VALUE)
125 public void getPrefixListDictionaryEntityData(HttpServletResponse response) {
126 DictionaryUtils utils = getDictionaryUtilsInstance();
127 utils.getData(response, pfListDatas, PrefixList.class);
130 @RequestMapping(value = {"/fw_dictionary/save_prefixList"}, method = {RequestMethod.POST})
131 public ModelAndView savePrefixListDictionary(HttpServletRequest request,
132 HttpServletResponse response) throws IOException {
133 DictionaryUtils utils = getDictionaryUtilsInstance();
135 boolean fromAPI = utils.isRequestFromAPI(request);
136 ObjectMapper mapper = new ObjectMapper();
137 mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
138 JsonNode root = mapper.readTree(request.getReader());
139 PrefixList prefixList;
142 mapper.readValue(root.get(dictionaryFields).toString(), PrefixList.class);
144 prefixList = mapper.readValue(root.get("prefixListDictionaryData").toString(),
148 List<Object> duplicateData = commonClassDao.checkDuplicateEntry(
149 prefixList.getPrefixListName(), prefixListName, PrefixList.class);
150 boolean duplicateflag = false;
151 if (!duplicateData.isEmpty()) {
152 PrefixList data = (PrefixList) duplicateData.get(0);
153 if (request.getParameter(operation) != null
154 && "update".equals(request.getParameter(operation))) {
155 prefixList.setId(data.getId());
156 } else if ((request.getParameter(operation) != null
157 && !"update".equals(request.getParameter(operation)))
158 || (request.getParameter(operation) == null
159 && (data.getId() != prefixList.getId()))) {
160 duplicateflag = true;
163 String responseString = null;
164 if (!duplicateflag) {
165 if (prefixList.getId() == 0) {
166 commonClassDao.save(prefixList);
168 commonClassDao.update(prefixList);
171 mapper.writeValueAsString(commonClassDao.getData(PrefixList.class));
173 responseString = duplicateResponseString;
176 return utils.getResultForApi(responseString);
178 utils.setResponseData(response, pfListDatas, responseString);
180 } catch (Exception e) {
181 utils.setErrorResponseData(response, e);
186 @RequestMapping(value = {"/fw_dictionary/remove_PrefixList"}, method = {RequestMethod.POST})
187 public void removePrefixListDictionary(HttpServletRequest request, HttpServletResponse response)
189 DictionaryUtils utils = getDictionaryUtilsInstance();
190 utils.removeData(request, response, pfListDatas, PrefixList.class);
193 @RequestMapping(value = {"/fw_dictionary/validate_prefixList"}, method = {RequestMethod.POST})
194 public void validatePrefixListDictionary(HttpServletRequest request,
195 HttpServletResponse response) throws IOException {
196 DictionaryUtils utils = getDictionaryUtilsInstance();
198 ObjectMapper mapper = new ObjectMapper();
199 mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
200 JsonNode root = mapper.readTree(request.getReader());
201 PrefixList prefixList = mapper
202 .readValue(root.get("prefixListDictionaryData").toString(), PrefixList.class);
203 String responseValidation = successMessage;
205 CIDR.newCIDR(prefixList.getPrefixListValue());
206 } catch (UnknownHostException e) {
208 responseValidation = errorMsg;
210 response.setCharacterEncoding(utf8);
211 response.setContentType(applicationJsonContentType);
212 request.setCharacterEncoding(utf8);
214 PrintWriter out = response.getWriter();
215 JSONObject j = new JSONObject("{result: " + responseValidation + "}");
216 out.write(j.toString());
217 } catch (Exception e) {
218 utils.setErrorResponseData(response, e);
222 @RequestMapping(value = {"/get_PortListData"}, method = {RequestMethod.GET},
223 produces = MediaType.APPLICATION_JSON_VALUE)
224 public void getPortListDictionaryEntityData(HttpServletResponse response) {
225 DictionaryUtils utils = getDictionaryUtilsInstance();
226 utils.getData(response, portListDatas, PortList.class);
229 @RequestMapping(value = {"/fw_dictionary/save_portName"}, method = {RequestMethod.POST})
230 public ModelAndView savePortListDictionary(HttpServletRequest request,
231 HttpServletResponse response) throws IOException {
232 DictionaryUtils utils = getDictionaryUtilsInstance();
234 boolean fromAPI = utils.isRequestFromAPI(request);
235 ObjectMapper mapper = new ObjectMapper();
236 mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
237 JsonNode root = mapper.readTree(request.getReader());
240 portList = mapper.readValue(root.get(dictionaryFields).toString(), PortList.class);
242 portList = mapper.readValue(root.get("portListDictionaryData").toString(),
245 List<Object> duplicateData = commonClassDao.checkDuplicateEntry(portList.getPortName(),
246 "portName", PortList.class);
247 boolean duplicateflag = false;
248 if (!duplicateData.isEmpty()) {
249 PortList data = (PortList) duplicateData.get(0);
250 if (request.getParameter(operation) != null
251 && "update".equals(request.getParameter(operation))) {
252 portList.setId(data.getId());
253 } else if ((request.getParameter(operation) != null
254 && !"update".equals(request.getParameter(operation)))
255 || (request.getParameter(operation) == null
256 && (data.getId() != portList.getId()))) {
257 duplicateflag = true;
260 String responseString = null;
261 if (!duplicateflag) {
262 if (portList.getId() == 0) {
263 commonClassDao.save(portList);
265 commonClassDao.update(portList);
267 responseString = mapper.writeValueAsString(commonClassDao.getData(PortList.class));
269 responseString = duplicateResponseString;
272 return utils.getResultForApi(responseString);
274 utils.setResponseData(response, portListDatas, responseString);
276 } catch (Exception e) {
277 utils.setErrorResponseData(response, e);
282 @RequestMapping(value = {"/fw_dictionary/remove_PortList"}, method = {RequestMethod.POST})
283 public void removePortListDictionary(HttpServletRequest request, HttpServletResponse response)
285 DictionaryUtils utils = getDictionaryUtilsInstance();
286 utils.removeData(request, response, portListDatas, PortList.class);
289 @RequestMapping(value = {"/get_ProtocolListData"}, method = {RequestMethod.GET},
290 produces = MediaType.APPLICATION_JSON_VALUE)
291 public void getProtocolListDictionaryEntityData(HttpServletResponse response) {
292 DictionaryUtils utils = getDictionaryUtilsInstance();
293 utils.getData(response, protocolListDatas, ProtocolList.class);
296 @RequestMapping(value = {"/get_ProtocolListDataByName"}, method = {RequestMethod.GET},
297 produces = MediaType.APPLICATION_JSON_VALUE)
298 public void getProtocolListDictionaryEntityDataByName(HttpServletResponse response) {
299 DictionaryUtils utils = getDictionaryUtilsInstance();
300 utils.getDataByEntity(response, protocolListDatas, protocolName, ProtocolList.class);
303 @RequestMapping(value = {"/fw_dictionary/save_protocolList"}, method = {RequestMethod.POST})
304 public ModelAndView saveProtocolListDictionary(HttpServletRequest request,
305 HttpServletResponse response) throws IOException {
306 DictionaryUtils utils = getDictionaryUtilsInstance();
308 boolean fromAPI = utils.isRequestFromAPI(request);
309 ObjectMapper mapper = new ObjectMapper();
310 mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
311 JsonNode root = mapper.readTree(request.getReader());
312 ProtocolList protocolList;
315 mapper.readValue(root.get(dictionaryFields).toString(), ProtocolList.class);
317 protocolList = mapper.readValue(root.get("protocolListDictionaryData").toString(),
320 List<Object> duplicateData = commonClassDao.checkDuplicateEntry(
321 protocolList.getProtocolName(), protocolName, ProtocolList.class);
322 boolean duplicateflag = false;
323 if (!duplicateData.isEmpty()) {
324 ProtocolList data = (ProtocolList) duplicateData.get(0);
325 if (request.getParameter(operation) != null
326 && "update".equals(request.getParameter(operation))) {
327 protocolList.setId(data.getId());
328 } else if ((request.getParameter(operation) != null
329 && !"update".equals(request.getParameter(operation)))
330 || (request.getParameter(operation) == null
331 && (data.getId() != protocolList.getId()))) {
332 duplicateflag = true;
335 String responseString = null;
336 if (!duplicateflag) {
337 if (protocolList.getId() == 0) {
338 commonClassDao.save(protocolList);
340 commonClassDao.update(protocolList);
343 mapper.writeValueAsString(commonClassDao.getData(ProtocolList.class));
345 responseString = duplicateResponseString;
348 return utils.getResultForApi(responseString);
350 utils.setResponseData(response, protocolListDatas, responseString);
352 } catch (Exception e) {
353 utils.setErrorResponseData(response, e);
358 @RequestMapping(value = {"/fw_dictionary/remove_protocol"}, method = {RequestMethod.POST})
359 public void removeProtocolListDictionary(HttpServletRequest request,
360 HttpServletResponse response) throws IOException {
361 DictionaryUtils utils = getDictionaryUtilsInstance();
362 utils.removeData(request, response, protocolListDatas, ProtocolList.class);
365 @RequestMapping(value = {"/get_AddressGroupDictionaryDataByName"}, method = {RequestMethod.GET},
366 produces = MediaType.APPLICATION_JSON_VALUE)
367 public void getAddressGroupDictionaryEntityDataByName(HttpServletResponse response) {
368 DictionaryUtils utils = getDictionaryUtilsInstance();
369 utils.getDataByEntity(response, addressGroupDatas, "name", AddressGroup.class);
372 @RequestMapping(value = {"/get_AddressGroupData"}, method = {RequestMethod.GET},
373 produces = MediaType.APPLICATION_JSON_VALUE)
374 public void getAddressGroupDictionaryEntityData(HttpServletResponse response) {
375 DictionaryUtils utils = getDictionaryUtilsInstance();
376 utils.getData(response, addressGroupDatas, AddressGroup.class);
379 @RequestMapping(value = {"/fw_dictionary/save_addressGroup"}, method = {RequestMethod.POST})
380 public ModelAndView saveAddressGroupDictionary(HttpServletRequest request,
381 HttpServletResponse response) throws IOException {
382 DictionaryUtils utils = getDictionaryUtilsInstance();
384 boolean fromAPI = utils.isRequestFromAPI(request);
385 ObjectMapper mapper = new ObjectMapper();
386 mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
387 JsonNode root = mapper.readTree(request.getReader());
388 AddressGroup addressGroup;
392 mapper.readValue(root.get(dictionaryFields).toString(), AddressGroup.class);
393 gridData = mapper.readValue(root.get(dictionaryFields).toString(), GridData.class);
395 addressGroup = mapper.readValue(root.get("addressGroupDictionaryData").toString(),
397 gridData = mapper.readValue(root.get("addressGroupDictionaryData").toString(),
400 if (!addressGroup.getGroupName().startsWith(groupNameStart)) {
401 String groupName = groupNameStart + addressGroup.getGroupName();
402 addressGroup.setGroupName(groupName);
404 addressGroup.setServiceList(utils.appendKey(gridData.getAttributes(), option, ","));
405 List<Object> duplicateData = commonClassDao
406 .checkDuplicateEntry(addressGroup.getGroupName(), "name", AddressGroup.class);
407 boolean duplicateflag = false;
408 if (!duplicateData.isEmpty()) {
409 AddressGroup data = (AddressGroup) duplicateData.get(0);
410 if (request.getParameter(operation) != null
411 && "update".equals(request.getParameter(operation))) {
412 addressGroup.setId(data.getId());
413 } else if ((request.getParameter(operation) != null
414 && !"update".equals(request.getParameter(operation)))
415 || (request.getParameter(operation) == null
416 && (data.getId() != addressGroup.getId()))) {
417 duplicateflag = true;
420 String responseString = null;
421 if (!duplicateflag) {
422 if (addressGroup.getId() == 0) {
423 commonClassDao.save(addressGroup);
425 commonClassDao.update(addressGroup);
428 mapper.writeValueAsString(commonClassDao.getData(AddressGroup.class));
430 responseString = duplicateResponseString;
433 return utils.getResultForApi(responseString);
435 utils.setResponseData(response, addressGroupDatas, responseString);
437 } catch (Exception e) {
438 utils.setErrorResponseData(response, e);
443 @RequestMapping(value = {"/fw_dictionary/remove_AddressGroup"}, method = {RequestMethod.POST})
444 public void removeAddressGroupDictionary(HttpServletRequest request,
445 HttpServletResponse response) throws IOException {
446 DictionaryUtils utils = getDictionaryUtilsInstance();
447 utils.removeData(request, response, addressGroupDatas, AddressGroup.class);
450 @RequestMapping(value = {"/get_ActionListDictionaryDataByName"}, method = {RequestMethod.GET},
451 produces = MediaType.APPLICATION_JSON_VALUE)
452 public void getActionListDictionaryEntityDataByName(HttpServletResponse response) {
453 DictionaryUtils utils = getDictionaryUtilsInstance();
454 utils.getDataByEntity(response, actionListDatas, "actionName", ActionList.class);
457 @RequestMapping(value = {"/get_ActionListData"}, method = {RequestMethod.GET},
458 produces = MediaType.APPLICATION_JSON_VALUE)
459 public void getActionListDictionaryEntityData(HttpServletResponse response) {
460 DictionaryUtils utils = getDictionaryUtilsInstance();
461 utils.getData(response, actionListDatas, ActionList.class);
464 @RequestMapping(value = {"/fw_dictionary/save_ActionList"}, method = {RequestMethod.POST})
465 public ModelAndView saveActionListDictionary(HttpServletRequest request,
466 HttpServletResponse response) throws IOException {
467 DictionaryUtils utils = getDictionaryUtilsInstance();
469 boolean fromAPI = utils.isRequestFromAPI(request);
470 ObjectMapper mapper = new ObjectMapper();
471 mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
472 JsonNode root = mapper.readTree(request.getReader());
473 ActionList actionList;
476 mapper.readValue(root.get(dictionaryFields).toString(), ActionList.class);
478 actionList = mapper.readValue(root.get("actionListDictionaryData").toString(),
481 List<Object> duplicateData = commonClassDao.checkDuplicateEntry(
482 actionList.getActionName(), "actionName", ActionList.class);
483 boolean duplicateflag = false;
484 if (!duplicateData.isEmpty()) {
485 ActionList data = (ActionList) duplicateData.get(0);
486 if (request.getParameter(operation) != null
487 && "update".equals(request.getParameter(operation))) {
488 actionList.setId(data.getId());
489 } else if ((request.getParameter(operation) != null
490 && !"update".equals(request.getParameter(operation)))
491 || (request.getParameter(operation) == null
492 && (data.getId() != actionList.getId()))) {
493 duplicateflag = true;
496 String responseString = null;
497 if (!duplicateflag) {
498 if (actionList.getId() == 0) {
499 commonClassDao.save(actionList);
501 commonClassDao.update(actionList);
504 mapper.writeValueAsString(commonClassDao.getData(ActionList.class));
506 responseString = duplicateResponseString;
509 return utils.getResultForApi(responseString);
511 utils.setResponseData(response, actionListDatas, responseString);
513 } catch (Exception e) {
514 utils.setErrorResponseData(response, e);
519 @RequestMapping(value = {"/fw_dictionary/remove_ActionList"}, method = {RequestMethod.POST})
520 public void removeActionListDictionary(HttpServletRequest request, HttpServletResponse response)
522 DictionaryUtils utils = getDictionaryUtilsInstance();
523 utils.removeData(request, response, actionListDatas, ActionList.class);
526 @RequestMapping(value = {"/get_ServiceGroupData"}, method = {RequestMethod.GET},
527 produces = MediaType.APPLICATION_JSON_VALUE)
528 public void getServiceGroupDictionaryEntityData(HttpServletResponse response) {
529 DictionaryUtils utils = getDictionaryUtilsInstance();
530 utils.getData(response, serviceGroupDatas, GroupServiceList.class);
533 @RequestMapping(value = {"/get_ServiceGroupDictionaryDataByName"}, method = {RequestMethod.GET},
534 produces = MediaType.APPLICATION_JSON_VALUE)
535 public void getServiceGroupDictionaryEntityDataByName(HttpServletResponse response) {
536 DictionaryUtils utils = getDictionaryUtilsInstance();
537 utils.getDataByEntity(response, serviceGroupDatas, "name", GroupServiceList.class);
540 @RequestMapping(value = {"/fw_dictionary/save_serviceGroup"}, method = {RequestMethod.POST})
541 public ModelAndView saveServiceGroupDictionary(HttpServletRequest request,
542 HttpServletResponse response) throws IOException {
543 DictionaryUtils utils = getDictionaryUtilsInstance();
545 boolean fromAPI = utils.isRequestFromAPI(request);
546 ObjectMapper mapper = new ObjectMapper();
547 mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
548 JsonNode root = mapper.readTree(request.getReader());
549 GroupServiceList groupServiceList;
552 groupServiceList = mapper.readValue(root.get(dictionaryFields).toString(),
553 GroupServiceList.class);
554 gridData = mapper.readValue(root.get(dictionaryFields).toString(), GridData.class);
556 groupServiceList = mapper.readValue(
557 root.get("serviceGroupDictionaryData").toString(), GroupServiceList.class);
558 gridData = mapper.readValue(root.get("serviceGroupDictionaryData").toString(),
561 if (!groupServiceList.getGroupName().startsWith(groupNameStart)) {
562 String groupName = groupNameStart + groupServiceList.getGroupName();
563 groupServiceList.setGroupName(groupName);
565 groupServiceList.setServiceList(utils.appendKey(gridData.getAttributes(), option, ","));
566 List<Object> duplicateData = commonClassDao.checkDuplicateEntry(
567 groupServiceList.getGroupName(), "name", GroupServiceList.class);
568 boolean duplicateflag = false;
569 if (!duplicateData.isEmpty()) {
570 GroupServiceList data = (GroupServiceList) duplicateData.get(0);
571 if (request.getParameter(operation) != null
572 && "update".equals(request.getParameter(operation))) {
573 groupServiceList.setId(data.getId());
574 } else if ((request.getParameter(operation) != null
575 && !"update".equals(request.getParameter(operation)))
576 || (request.getParameter(operation) == null
577 && (data.getId() != groupServiceList.getId()))) {
578 duplicateflag = true;
581 String responseString = null;
582 if (!duplicateflag) {
583 if (groupServiceList.getId() == 0) {
584 commonClassDao.save(groupServiceList);
586 commonClassDao.update(groupServiceList);
589 mapper.writeValueAsString(commonClassDao.getData(GroupServiceList.class));
591 responseString = duplicateResponseString;
594 return utils.getResultForApi(responseString);
596 utils.setResponseData(response, serviceGroupDatas, responseString);
598 } catch (Exception e) {
599 utils.setErrorResponseData(response, e);
604 @RequestMapping(value = {"/fw_dictionary/remove_serviceGroup"}, method = {RequestMethod.POST})
605 public void removeServiceGroupDictionary(HttpServletRequest request,
606 HttpServletResponse response) throws IOException {
607 DictionaryUtils utils = getDictionaryUtilsInstance();
608 utils.removeData(request, response, serviceGroupDatas, GroupServiceList.class);
611 @RequestMapping(value = {"/get_SecurityZoneDataByName"}, method = {RequestMethod.GET},
612 produces = MediaType.APPLICATION_JSON_VALUE)
613 public void getSecurityZoneDictionaryEntityDataByName(HttpServletResponse response) {
614 DictionaryUtils utils = getDictionaryUtilsInstance();
615 utils.getDataByEntity(response, securityZoneDatas, zoneName, SecurityZone.class);
618 @RequestMapping(value = {"/get_SecurityZoneData"}, method = {RequestMethod.GET},
619 produces = MediaType.APPLICATION_JSON_VALUE)
620 public void getSecurityZoneDictionaryEntityData(HttpServletResponse response) {
621 DictionaryUtils utils = getDictionaryUtilsInstance();
622 utils.getData(response, securityZoneDatas, SecurityZone.class);
625 @RequestMapping(value = {"/fw_dictionary/save_securityZone"}, method = {RequestMethod.POST})
626 public ModelAndView saveSecurityZoneDictionary(HttpServletRequest request,
627 HttpServletResponse response) throws IOException {
628 DictionaryUtils utils = getDictionaryUtilsInstance();
630 boolean fromAPI = utils.isRequestFromAPI(request);
631 ObjectMapper mapper = new ObjectMapper();
632 mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
633 JsonNode root = mapper.readTree(request.getReader());
634 SecurityZone securityZone;
637 mapper.readValue(root.get(dictionaryFields).toString(), SecurityZone.class);
639 securityZone = mapper.readValue(root.get("securityZoneDictionaryData").toString(),
642 List<Object> duplicateData = commonClassDao
643 .checkDuplicateEntry(securityZone.getZoneName(), zoneName, SecurityZone.class);
644 boolean duplicateflag = false;
645 if (!duplicateData.isEmpty()) {
646 SecurityZone data = (SecurityZone) duplicateData.get(0);
647 if (request.getParameter(operation) != null
648 && "update".equals(request.getParameter(operation))) {
649 securityZone.setId(data.getId());
650 } else if ((request.getParameter(operation) != null
651 && !"update".equals(request.getParameter(operation)))
652 || (request.getParameter(operation) == null
653 && (data.getId() != securityZone.getId()))) {
654 duplicateflag = true;
657 String responseString = null;
658 if (!duplicateflag) {
659 if (securityZone.getId() == 0) {
660 commonClassDao.save(securityZone);
662 commonClassDao.update(securityZone);
665 mapper.writeValueAsString(commonClassDao.getData(SecurityZone.class));
667 responseString = duplicateResponseString;
670 return utils.getResultForApi(responseString);
672 utils.setResponseData(response, securityZoneDatas, responseString);
674 } catch (Exception e) {
675 utils.setErrorResponseData(response, e);
680 @RequestMapping(value = {"/fw_dictionary/remove_securityZone"}, method = {RequestMethod.POST})
681 public void removeSecurityZoneDictionary(HttpServletRequest request,
682 HttpServletResponse response) throws IOException {
683 DictionaryUtils utils = getDictionaryUtilsInstance();
684 utils.removeData(request, response, securityZoneDatas, SecurityZone.class);
688 @RequestMapping(value = {"/get_ServiceListData"}, method = {RequestMethod.GET},
689 produces = MediaType.APPLICATION_JSON_VALUE)
690 public void getServiceListDictionaryEntityData(HttpServletResponse response) {
691 DictionaryUtils utils = getDictionaryUtilsInstance();
692 utils.getData(response, serviceListDatas, ServiceList.class);
695 @RequestMapping(value = {"/get_ServiceListDictionaryDataByName"}, method = {RequestMethod.GET},
696 produces = MediaType.APPLICATION_JSON_VALUE)
697 public void getServiceListDictionaryEntityDataByName(HttpServletResponse response) {
698 DictionaryUtils utils = getDictionaryUtilsInstance();
699 utils.getDataByEntity(response, serviceListDatas, serviceName, ServiceList.class);
702 @RequestMapping(value = {"/fw_dictionary/save_serviceList"}, method = {RequestMethod.POST})
703 public ModelAndView saveServiceListDictionary(HttpServletRequest request,
704 HttpServletResponse response) throws IOException {
705 DictionaryUtils utils = getDictionaryUtilsInstance();
707 boolean fromAPI = utils.isRequestFromAPI(request);
708 ObjectMapper mapper = new ObjectMapper();
709 mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
710 JsonNode root = mapper.readTree(request.getReader());
711 ServiceList serviceList;
712 GridData serviceListGridData;
715 mapper.readValue(root.get(dictionaryFields).toString(), ServiceList.class);
716 serviceListGridData =
717 mapper.readValue(root.get(dictionaryFields).toString(), GridData.class);
719 serviceList = mapper.readValue(root.get("serviceListDictionaryData").toString(),
721 serviceListGridData = mapper.readValue(
722 root.get("serviceListDictionaryData").toString(), GridData.class);
724 serviceList.setServiceTransProtocol(
725 utils.appendKey(serviceListGridData.getTransportProtocols(), option, ","));
726 serviceList.setServiceAppProtocol(
727 utils.appendKey(serviceListGridData.getAppProtocols(), option, ","));
728 serviceList.setServiceType("SERVICE");
729 List<Object> duplicateData = commonClassDao.checkDuplicateEntry(
730 serviceList.getServiceName(), serviceName, ServiceList.class);
731 boolean duplicateflag = false;
732 if (!duplicateData.isEmpty()) {
733 ServiceList data = (ServiceList) duplicateData.get(0);
734 if (request.getParameter(operation) != null
735 && "update".equals(request.getParameter(operation))) {
736 serviceList.setId(data.getId());
737 } else if ((request.getParameter(operation) != null
738 && !"update".equals(request.getParameter(operation)))
739 || (request.getParameter(operation) == null
740 && (data.getId() != serviceList.getId()))) {
741 duplicateflag = true;
744 String responseString = null;
745 if (!duplicateflag) {
746 if (serviceList.getId() == 0) {
747 commonClassDao.save(serviceList);
749 commonClassDao.update(serviceList);
752 mapper.writeValueAsString(commonClassDao.getData(ServiceList.class));
754 responseString = duplicateResponseString;
757 return utils.getResultForApi(responseString);
759 utils.setResponseData(response, serviceListDatas, responseString);
761 } catch (Exception e) {
762 utils.setErrorResponseData(response, e);
767 @RequestMapping(value = {"/fw_dictionary/remove_serviceList"}, method = {RequestMethod.POST})
768 public void removeServiceListDictionary(HttpServletRequest request,
769 HttpServletResponse response) throws IOException {
770 DictionaryUtils utils = getDictionaryUtilsInstance();
771 utils.removeData(request, response, serviceListDatas, ServiceList.class);
774 @RequestMapping(value = {"/get_ZoneData"}, method = {RequestMethod.GET},
775 produces = MediaType.APPLICATION_JSON_VALUE)
776 public void getZoneDictionaryEntityData(HttpServletResponse response) {
777 DictionaryUtils utils = getDictionaryUtilsInstance();
778 utils.getData(response, zoneDatas, Zone.class);
781 @RequestMapping(value = {"/get_ZoneDictionaryDataByName"}, method = {RequestMethod.GET},
782 produces = MediaType.APPLICATION_JSON_VALUE)
783 public void getZoneDictionaryEntityDataByName(HttpServletResponse response) {
784 DictionaryUtils utils = getDictionaryUtilsInstance();
785 utils.getDataByEntity(response, zoneDatas, zoneName, Zone.class);
788 @RequestMapping(value = {"/fw_dictionary/save_zoneName"}, method = {RequestMethod.POST})
789 public ModelAndView saveZoneDictionary(HttpServletRequest request, HttpServletResponse response)
791 DictionaryUtils utils = getDictionaryUtilsInstance();
793 boolean fromAPI = utils.isRequestFromAPI(request);
794 ObjectMapper mapper = new ObjectMapper();
795 mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
796 JsonNode root = mapper.readTree(request.getReader());
799 zone = mapper.readValue(root.get(dictionaryFields).toString(), Zone.class);
801 zone = mapper.readValue(root.get("zoneDictionaryData").toString(), Zone.class);
803 List<Object> duplicateData =
804 commonClassDao.checkDuplicateEntry(zone.getZoneName(), zoneName, Zone.class);
805 boolean duplicateflag = false;
806 if (!duplicateData.isEmpty()) {
807 Zone data = (Zone) duplicateData.get(0);
808 if (request.getParameter(operation) != null
809 && "update".equals(request.getParameter(operation))) {
810 zone.setId(data.getId());
811 } else if ((request.getParameter(operation) != null
812 && !"update".equals(request.getParameter(operation)))
813 || (request.getParameter(operation) == null
814 && (data.getId() != zone.getId()))) {
815 duplicateflag = true;
818 String responseString = null;
819 if (!duplicateflag) {
820 if (zone.getId() == 0) {
821 commonClassDao.save(zone);
823 commonClassDao.update(zone);
825 responseString = mapper.writeValueAsString(commonClassDao.getData(Zone.class));
827 responseString = duplicateResponseString;
830 return utils.getResultForApi(responseString);
832 utils.setResponseData(response, zoneDatas, responseString);
834 } catch (Exception e) {
835 utils.setErrorResponseData(response, e);
840 @RequestMapping(value = {"/fw_dictionary/remove_zone"}, method = {RequestMethod.POST})
841 public void removeZoneDictionary(HttpServletRequest request, HttpServletResponse response)
843 DictionaryUtils utils = getDictionaryUtilsInstance();
844 utils.removeData(request, response, zoneDatas, Zone.class);
847 @RequestMapping(value = {"/get_TermListDataByName"}, method = {RequestMethod.GET},
848 produces = MediaType.APPLICATION_JSON_VALUE)
849 public void getTermListDictionaryEntityDataByName(HttpServletResponse response) {
850 DictionaryUtils utils = getDictionaryUtilsInstance();
851 utils.getDataByEntity(response, termListDictDatas, termName, TermList.class);
854 @RequestMapping(value = {"/get_TermListData"}, method = {RequestMethod.GET},
855 produces = MediaType.APPLICATION_JSON_VALUE)
856 public void getTermListDictionaryEntityData(HttpServletResponse response) {
857 DictionaryUtils utils = getDictionaryUtilsInstance();
858 utils.getData(response, termListDictDatas, TermList.class);
861 @RequestMapping(value = {"/fw_dictionary/save_termList"}, method = {RequestMethod.POST})
862 public ModelAndView saveTermListDictionary(HttpServletRequest request,
863 HttpServletResponse response) throws IOException {
864 DictionaryUtils utils = getDictionaryUtilsInstance();
866 boolean fromAPI = utils.isRequestFromAPI(request);
867 ObjectMapper mapper = new ObjectMapper();
868 mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
869 JsonNode root = mapper.readTree(request.getReader());
871 TermListData termListDatas;
872 String userId = null;
874 termList = mapper.readValue(root.get(dictionaryFields).toString(), TermList.class);
876 mapper.readValue(root.get(dictionaryFields).toString(), TermListData.class);
879 termList = mapper.readValue(root.get("termListDictionaryData").toString(),
881 termListDatas = mapper.readValue(root.get("termListDictionaryData").toString(),
883 userId = root.get(userid).textValue();
886 termList.setFromZones(utils.appendKey(termListDatas.getFromZoneDatas(), option, ","));
887 termList.setToZones(utils.appendKey(termListDatas.getToZoneDatas(), option, ","));
888 termList.setSrcIPList(utils.appendKey(termListDatas.getSourceListDatas(), option, ","));
889 termList.setDestIPList(
890 utils.appendKey(termListDatas.getDestinationListDatas(), option, ","));
891 termList.setSrcPortList(
892 utils.appendKey(termListDatas.getSourceServiceDatas(), option, ","));
893 termList.setDestPortList(
894 utils.appendKey(termListDatas.getDestinationServiceDatas(), option, ","));
895 termList.setAction(utils.appendKey(termListDatas.getActionListDatas(), option, ","));
897 UserInfo userInfo = utils.getUserInfo(userId);
898 List<Object> duplicateData = commonClassDao.checkDuplicateEntry(termList.getTermName(),
899 termName, TermList.class);
900 boolean duplicateflag = false;
901 if (!duplicateData.isEmpty()) {
902 TermList data = (TermList) duplicateData.get(0);
903 if (request.getParameter(operation) != null
904 && "update".equals(request.getParameter(operation))) {
905 termList.setId(data.getId());
906 } else if ((request.getParameter(operation) != null
907 && !"update".equals(request.getParameter(operation)))
908 || (request.getParameter(operation) == null
909 && (data.getId() != termList.getId()))) {
910 duplicateflag = true;
913 String responseString = null;
914 if (!duplicateflag) {
915 termList.setUserModifiedBy(userInfo);
916 if (termList.getId() == 0) {
917 termList.setUserCreatedBy(userInfo);
918 commonClassDao.save(termList);
920 termList.setModifiedDate(new Date());
921 commonClassDao.update(termList);
923 responseString = mapper.writeValueAsString(commonClassDao.getData(TermList.class));
925 responseString = duplicateResponseString;
928 return utils.getResultForApi(responseString);
930 utils.setResponseData(response, termListDictDatas, responseString);
932 } catch (Exception e) {
933 utils.setErrorResponseData(response, e);
938 @RequestMapping(value = {"/fw_dictionary/remove_termList"}, method = {RequestMethod.POST})
939 public void removeTermListDictionary(HttpServletRequest request, HttpServletResponse response)
941 DictionaryUtils utils = getDictionaryUtilsInstance();
942 utils.removeData(request, response, termListDictDatas, TermList.class);
945 // ParentList Dictionary Data
946 @RequestMapping(value = {"/get_FWDictionaryListDataByName"}, method = {RequestMethod.GET},
947 produces = MediaType.APPLICATION_JSON_VALUE)
948 public void getFWDictListDictionaryEntityDataByName(HttpServletResponse response) {
949 DictionaryUtils utils = getDictionaryUtilsInstance();
950 utils.getDataByEntity(response, fwDictListDatas, "parentItemName",
951 FirewallDictionaryList.class);
954 @RequestMapping(value = {"/get_FWDictionaryListData"}, method = {RequestMethod.GET},
955 produces = MediaType.APPLICATION_JSON_VALUE)
956 public void getFWDictionaryListEntityData(HttpServletResponse response) {
957 DictionaryUtils utils = getDictionaryUtilsInstance();
958 utils.getData(response, fwDictListDatas, FirewallDictionaryList.class);
961 @RequestMapping(value = {"/fw_dictionary/save_FWDictionaryList"}, method = {RequestMethod.POST})
962 public ModelAndView saveFWDictionaryList(HttpServletRequest request,
963 HttpServletResponse response) throws IOException {
964 DictionaryUtils utils = getDictionaryUtilsInstance();
966 boolean fromAPI = utils.isRequestFromAPI(request);
967 ObjectMapper mapper = new ObjectMapper();
968 mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
969 JsonNode root = mapper.readTree(request.getReader());
970 FirewallDictionaryList fwDictList;
973 fwDictList = mapper.readValue(root.get(dictionaryFields).toString(),
974 FirewallDictionaryList.class);
975 gridData = mapper.readValue(root.get(dictionaryFields).toString(), GridData.class);
977 fwDictList = mapper.readValue(root.get("fwDictListDictionaryData").toString(),
978 FirewallDictionaryList.class);
979 gridData = mapper.readValue(root.get("fwDictListDictionaryData").toString(),
983 fwDictList.setServiceList(utils.appendKey(gridData.getAttributes(), option, ","));
984 fwDictList.setAddressList(utils.appendKey(gridData.getAlAttributes(), option, ","));
986 List<Object> duplicateData = commonClassDao.checkDuplicateEntry(
987 fwDictList.getParentItemName(), "parentItemName", FirewallDictionaryList.class);
988 boolean duplicateflag = false;
989 if (!duplicateData.isEmpty()) {
990 FirewallDictionaryList data = (FirewallDictionaryList) duplicateData.get(0);
991 if (request.getParameter(operation) != null
992 && "update".equals(request.getParameter(operation))) {
993 fwDictList.setId(data.getId());
994 } else if ((request.getParameter(operation) != null
995 && !"update".equals(request.getParameter(operation)))
996 || (request.getParameter(operation) == null
997 && (data.getId() != fwDictList.getId()))) {
998 duplicateflag = true;
1001 String responseString = null;
1002 if (!duplicateflag) {
1003 if (fwDictList.getId() == 0) {
1004 commonClassDao.save(fwDictList);
1006 commonClassDao.update(fwDictList);
1008 responseString = mapper
1009 .writeValueAsString(commonClassDao.getData(FirewallDictionaryList.class));
1011 responseString = duplicateResponseString;
1014 return utils.getResultForApi(responseString);
1016 utils.setResponseData(response, fwDictListDatas, responseString);
1018 } catch (Exception e) {
1019 utils.setErrorResponseData(response, e);
1024 @RequestMapping(value = {"/fw_dictionary/remove_FWDictionaryList"},
1025 method = {RequestMethod.POST})
1026 public void removeFWDictionaryList(HttpServletRequest request, HttpServletResponse response)
1027 throws IOException {
1028 DictionaryUtils utils = getDictionaryUtilsInstance();
1029 utils.removeData(request, response, fwDictListDatas, FirewallDictionaryList.class);
1033 @RequestMapping(value = {"/get_TagPickerNameByName"}, method = {RequestMethod.GET},
1034 produces = MediaType.APPLICATION_JSON_VALUE)
1035 public void getTagPickerNameEntityDataByName(HttpServletResponse response) {
1036 DictionaryUtils utils = getDictionaryUtilsInstance();
1037 utils.getDataByEntity(response, fwTagPickerDatas, tagPickerName, FWTagPicker.class);
1040 @RequestMapping(value = {"/get_TagPickerListData"}, method = {RequestMethod.GET},
1041 produces = MediaType.APPLICATION_JSON_VALUE)
1042 public void getTagPickerDictionaryEntityData(HttpServletResponse response) {
1043 DictionaryUtils utils = getDictionaryUtilsInstance();
1044 utils.getData(response, fwTagPickerDatas, FWTagPicker.class);
1047 @RequestMapping(value = {"/fw_dictionary/save_fwTagPicker"}, method = {RequestMethod.POST})
1048 public ModelAndView saveFirewallTagPickerDictionary(HttpServletRequest request,
1049 HttpServletResponse response) throws IOException {
1050 DictionaryUtils utils = getDictionaryUtilsInstance();
1052 boolean fromAPI = utils.isRequestFromAPI(request);
1053 ObjectMapper mapper = new ObjectMapper();
1054 mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
1055 JsonNode root = mapper.readTree(request.getReader());
1056 FWTagPicker fwTagPicker;
1061 mapper.readValue(root.get(dictionaryFields).toString(), FWTagPicker.class);
1062 data = mapper.readValue(root.get(dictionaryFields).toString(), TagGridValues.class);
1065 fwTagPicker = mapper.readValue(root.get("fwTagPickerDictionaryData").toString(),
1067 data = mapper.readValue(root.get("fwTagPickerDictionaryData").toString(),
1068 TagGridValues.class);
1069 userId = root.get(userid).textValue();
1071 fwTagPicker.setTagValues(utils.appendKeyValue(data.getTags(), "#", ":"));
1073 UserInfo userInfo = utils.getUserInfo(userId);
1075 List<Object> duplicateData = commonClassDao.checkDuplicateEntry(
1076 fwTagPicker.getTagPickerName(), tagPickerName, FWTagPicker.class);
1077 boolean duplicateflag = false;
1078 if (!duplicateData.isEmpty()) {
1079 FWTagPicker data1 = (FWTagPicker) duplicateData.get(0);
1080 if (request.getParameter(operation) != null
1081 && "update".equals(request.getParameter(operation))) {
1082 fwTagPicker.setId(data1.getId());
1083 } else if ((request.getParameter(operation) != null
1084 && !"update".equals(request.getParameter(operation)))
1085 || (request.getParameter(operation) == null
1086 && (data1.getId() != fwTagPicker.getId()))) {
1087 duplicateflag = true;
1090 String responseString = null;
1091 if (!duplicateflag) {
1092 fwTagPicker.setUserModifiedBy(userInfo);
1093 if (fwTagPicker.getId() == 0) {
1094 fwTagPicker.setUserCreatedBy(userInfo);
1095 commonClassDao.save(fwTagPicker);
1097 fwTagPicker.setModifiedDate(new Date());
1098 commonClassDao.update(fwTagPicker);
1101 mapper.writeValueAsString(commonClassDao.getData(FWTagPicker.class));
1103 responseString = duplicateResponseString;
1106 return utils.getResultForApi(responseString);
1108 utils.setResponseData(response, fwTagPickerDatas, responseString);
1110 } catch (Exception e) {
1111 utils.setErrorResponseData(response, e);
1116 @RequestMapping(value = {"/fw_dictionary/remove_tagPicker"}, method = {RequestMethod.POST})
1117 public void removeFirewallTagPickerDictionary(HttpServletRequest request,
1118 HttpServletResponse response) throws IOException {
1119 DictionaryUtils utils = getDictionaryUtilsInstance();
1120 utils.removeData(request, response, fwTagPickerDatas, FWTagPicker.class);
1123 @RequestMapping(value = {"/get_TagListData"}, method = {RequestMethod.GET},
1124 produces = MediaType.APPLICATION_JSON_VALUE)
1125 public void getTagDictionaryEntityData(HttpServletResponse response) {
1126 DictionaryUtils utils = getDictionaryUtilsInstance();
1127 utils.getData(response, fwTagDatas, FWTag.class);
1130 @RequestMapping(value = {"/get_TagNameByName"}, method = {RequestMethod.GET},
1131 produces = MediaType.APPLICATION_JSON_VALUE)
1132 public void getTagNameEntityDataByName(HttpServletResponse response) {
1133 DictionaryUtils utils = getDictionaryUtilsInstance();
1134 utils.getDataByEntity(response, fwTagDatas, "fwTagName", FWTag.class);
1138 @RequestMapping(value = {"/fw_dictionary/save_fwTag"}, method = {RequestMethod.POST})
1139 public ModelAndView saveFirewallTagDictionary(HttpServletRequest request,
1140 HttpServletResponse response) throws IOException {
1141 DictionaryUtils utils = getDictionaryUtilsInstance();
1143 boolean fromAPI = utils.isRequestFromAPI(request);
1144 ObjectMapper mapper = new ObjectMapper();
1145 mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
1146 JsonNode root = mapper.readTree(request.getReader());
1148 TagGridValues tagGridValues;
1151 fwTag = mapper.readValue(root.get(dictionaryFields).toString(), FWTag.class);
1152 tagGridValues = mapper.readValue(root.get(dictionaryFields).toString(),
1153 TagGridValues.class);
1156 fwTag = mapper.readValue(root.get("fwTagDictionaryData").toString(), FWTag.class);
1157 tagGridValues = mapper.readValue(root.get("fwTagDictionaryData").toString(),
1158 TagGridValues.class);
1159 userId = root.get(userid).textValue();
1161 fwTag.setTagValues(utils.appendKey(tagGridValues.getTags(), "tags", ","));
1163 UserInfo userInfo = utils.getUserInfo(userId);
1164 List<Object> duplicateData = commonClassDao.checkDuplicateEntry(fwTag.getFwTagName(),
1165 "fwTagName", FWTag.class);
1166 boolean duplicateflag = false;
1167 if (!duplicateData.isEmpty()) {
1168 FWTag data = (FWTag) duplicateData.get(0);
1169 if (request.getParameter(operation) != null
1170 && "update".equals(request.getParameter(operation))) {
1171 fwTag.setId(data.getId());
1172 } else if ((request.getParameter(operation) != null
1173 && !"update".equals(request.getParameter(operation)))
1174 || (request.getParameter(operation) == null
1175 && (data.getId() != fwTag.getId()))) {
1176 duplicateflag = true;
1179 String responseString = null;
1180 if (!duplicateflag) {
1181 fwTag.setUserModifiedBy(userInfo);
1182 if (fwTag.getId() == 0) {
1183 fwTag.setUserCreatedBy(userInfo);
1184 commonClassDao.save(fwTag);
1186 fwTag.setModifiedDate(new Date());
1187 commonClassDao.update(fwTag);
1189 responseString = mapper.writeValueAsString(commonClassDao.getData(FWTag.class));
1191 responseString = duplicateResponseString;
1194 return utils.getResultForApi(responseString);
1196 utils.setResponseData(response, fwTagDatas, responseString);
1198 } catch (Exception e) {
1199 utils.setErrorResponseData(response, e);
1204 @RequestMapping(value = {"/fw_dictionary/remove_tagList"}, method = {RequestMethod.POST})
1205 public void removeFirewallTagDictionary(HttpServletRequest request,
1206 HttpServletResponse response) throws IOException {
1207 DictionaryUtils utils = getDictionaryUtilsInstance();
1208 utils.removeData(request, response, fwTagDatas, FWTag.class);
1213 class TagGridValues {
1214 private List<Object> tags;
1216 public List<Object> getTags() {
1220 public void setTags(List<Object> tags) {
1227 private List<Object> attributes;
1229 public List<Object> getAttributes() {
1233 public void setAttributes(List<Object> attributes) {
1234 this.attributes = attributes;
1239 class TermListData {
1240 private List<Object> fromZoneDatas;
1241 private List<Object> toZoneDatas;
1242 private List<Object> sourceListDatas;
1243 private List<Object> destinationListDatas;
1244 private List<Object> sourceServiceDatas;
1245 private List<Object> destinationServiceDatas;
1246 private List<Object> actionListDatas;
1248 public List<Object> getFromZoneDatas() {
1249 return fromZoneDatas;
1252 public void setFromZoneDatas(List<Object> fromZoneDatas) {
1253 this.fromZoneDatas = fromZoneDatas;
1256 public List<Object> getToZoneDatas() {
1260 public void setToZoneDatas(List<Object> toZoneDatas) {
1261 this.toZoneDatas = toZoneDatas;
1264 public List<Object> getSourceListDatas() {
1265 return sourceListDatas;
1268 public void setSourceListDatas(List<Object> sourceListDatas) {
1269 this.sourceListDatas = sourceListDatas;
1272 public List<Object> getDestinationListDatas() {
1273 return destinationListDatas;
1276 public void setDestinationListDatas(List<Object> destinationListDatas) {
1277 this.destinationListDatas = destinationListDatas;
1280 public List<Object> getSourceServiceDatas() {
1281 return sourceServiceDatas;
1284 public void setSourceServiceDatas(List<Object> sourceServiceDatas) {
1285 this.sourceServiceDatas = sourceServiceDatas;
1288 public List<Object> getDestinationServiceDatas() {
1289 return destinationServiceDatas;
1292 public void setDestinationServiceDatas(List<Object> destinationServiceDatas) {
1293 this.destinationServiceDatas = destinationServiceDatas;
1296 public List<Object> getActionListDatas() {
1297 return actionListDatas;
1300 public void setActionListDatas(List<Object> actionListDatas) {
1301 this.actionListDatas = actionListDatas;